Chickenfoot for Firefox: Rewrite the Web

User Interface Design Group

Chickenfoot Example Scripts

The following examples present a small subset of the functionality that Chickenfoot offers. Once Chickenfoot is installed, press F8 to open the Chickenfoot Sidebar and then copy the chickenfoot code into the sidebar's text area. Press Alt-R (Windows) or Ctrl-R (MacOS) to run the script.

Image Replacement

Running this chickenfoot script on google.com will replace the google logo with the ninja.png image.

replace('Google image',
  '<img src="http://www.bolinfest.com/ninja.png">')

Finding a book in the library

This script can be run on this page. It will insert the availability of the following book in MIT's library system as a link after the author's name.

originalTab = tab;
isbn = find(/ISBN: (\d+)/).groups[1];
with(openTab('http://libraries.mit.edu/', true)) {
  pick('Keyword');
  enter(isbn)
  click('Search button')
  link = find('stacks link')
}
originalTab.show();
insert(after(/^Name:.*/), '<li>' + link.html)
  • Name: The Catcher in the Rye by J.D. Salinger
  • List Price: $6.99
  • Price: $6.29
  • Paperback: 224 pages
  • Publisher: Little, Brown (May 1, 1991)
  • Language: English
  • ISBN: 0316769487
  • Product Dimensions: 6.7 x 4.2 x 0.6 inches
  • Shipping Weight: 3.8 ounces

TargetAlert

This script will add an icon to all hyperlinks giving visual information about their final destinations. Hyperlinks that do not point to webpages are appended with icons, eliminating, for example, the "surprise" of arriving at a pdf document.

excludedExtensions = {
  'html' : 1,  'shtml' : 1,  'php' : 1,  'jsp' : 1,  'asp' : 1,
}

mailto = /^mailto:/i
javascript = /^javascript:/i
type = /^[^\\?]*\.(\w+)$/i

for (link = find('link'); link.hasMatch; link = link.next) {
  if (!link.element) {
    output(link.html)
    continue;
  }
  href = link.element.getAttribute('href')
  if (href.match(mailto)) {
    continue
  } else if (href.match(javascript)) {
    html = ' <img src="moz-icon://.js?size=16"> '
  } else if (match = href.match(type)) {
    extension = match[1]
    if (extension in excludedExtensions) continue
    html = ' <img src="moz-icon://.' + extension + '?size=16"> '      
  } else {
    continue
  }
  insert(after(link), html) 
}


©2004-2008 Massachusetts Institute of Technology