<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    >

<channel>
    <title>Webmonkey &#187; chickenfoot</title>
    <atom:link href="http://www.webmonkey.com/tag/chickenfoot/feed/" rel="self" type="application/rss+xml" />
    <link>http://www.webmonkey.com</link>
    <description>The Web Developer&#039;s Resource</description>
    <lastBuildDate>Mon, 06 May 2013 17:29:19 +0000</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <generator>http://wordpress.org/?v=3.4.2</generator>
    
    <item>
        <title>Get Started With Chickenfoot</title>
        <link>http://www.webmonkey.com/2010/02/get_started_with_chickenfoot/</link>
        <comments>http://www.webmonkey.com/2010/02/get_started_with_chickenfoot/#comments</comments>
        <pubDate>Tue, 16 Feb 2010 01:45:47 +0000</pubDate>

                <dc:creator>Webmonkey Staff</dc:creator>

        <guid isPermaLink="false">http://stag.wired.com/primate/?p=934</guid>
        		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[chickenfoot]]></category>
		<category><![CDATA[wiki]]></category>
        <description><![CDATA[Chickenfoot is a scripting wrapper that allows you to manipulate websites on the fly. By building and running simple scripts in Chickenfoot, you can alter the behavior of your favorite websites and make the pages display and respond in different ways, customizing them to your liking. Best of all, Chickenfoot isn&#8217;t difficult to learn or [...]]]></description>

            <content:encoded><![CDATA[<!-- wpautop disabled --><p>Chickenfoot is a scripting wrapper that allows you to manipulate websites on the fly. By building and running simple scripts in Chickenfoot, you can alter the behavior of your favorite websites and make the pages display and respond in different ways, customizing them to your liking. Best of all, Chickenfoot isn&#8217;t difficult to learn or use. The scripts can be created using only your browser (via a downloadable extension) and some light coding.

</p><span id="more-934"></span>

<table id="toc" class="toc" summary="Contents"><tbody><tr><td><div id="toctitle"><h2>Contents</h2> </div>

<ol>

<li><a href="#Introduction">Introduction</a></li>



<li><a href="#What_you.27ll_need">What you&#8217;ll need</a></li>

<li><a href="#Steps">Steps</a>

<ol>

<li><a href="#Step_1:_Basic_Page_Navigation">Step 1: Basic Page Navigation</a></li>

<li><a href="#Step_2:_Pattern_Matching">Step 2: Pattern Matching</a></li>



<li><a href="#Step_3:_Page_Modification">Step 3: Page Modification</a></li>

<li><a href="#Step_4:_Activating_Triggers">Step 4: Activating Triggers</a></li>

</ol>

</li>

<li><a href="#Alternate_methods">Alternate methods</a>

<ol>

<li><a href="#JavaScript_Integration">JavaScript Integration</a></li>



<li><a href="#Greasemonkey">Greasemonkey</a></li>

</ol>

</li>

<li><a href="#Suggested_readings">Suggested readings</a></li>

</ol>





</td></tr></tbody></table>



<a name="Introduction"></a><h2> <span class="mw-headline"> Introduction </span></h2>



<div class="floatright"><span><a href="/wp-content/uploads/2009/12/chickenfoot.png" class="image" title="Chickenfoot.png"><img alt="" src="/wp-content/uploads/2009/12/chickenfoot.png" border="0" height="259" width="289"></a></span></div>

<p>As every budding developer knows, sometimes when the internet fails to give you exactly what you want, you have to hack it yourself. The ability to do this is made easy (and legal) with tools like <a href="http://groups.csail.mit.edu/uid/chickenfoot" class="external text" title="http://groups.csail.mit.edu/uid/chickenfoot" rel="nofollow">Chickenfoot</a>, a scripting tool currently available as a plug-in for the Firefox browser. By installing Chickenfoot, you add a scripting layer over your browser and you can start manipulating your browsing experience through some easy-to-learn JavaScript-based coding.

</p><p>Chickenfoot is similar to Greasemonkey, another Firefox add-on providing page scripting. But it goes a step beyond Greasemonkey by manipulating the browser&#8217;s <a href="/2010/02/Document_Object_Model" title="Reference:Document Object Model"> Document Object Model (DOM)</a>. The DOM represents the interactive abilities of the web &#8212; things like links, text boxes, radio buttons, and check boxes all lay within the DOM. The ability to manipulate the DOM allows you to change the behavior of a website&#8217;s code, the way the page lets you interact with it and submissions based on preference or whimsy.

</p><p>This direct relationship with the DOM is actually where Chickenfoot gets its name. Chickenfoot is the name of <a href="http://www.domino-games.com/domino-rules/chickenfoot-rules.html" class="external text" title="http://www.domino-games.com/domino-rules/chickenfoot-rules.html" rel="nofollow">a game played with dominoes</a> &#8212; DOMinoes? Get it?

</p><p>Sample applications of Chickenfoot:

</p>

<ul>

<li>Change page colors. Add photos</li>



<li>Automatically fill forms</li>

<li>Automatically navigate around through a website</li>

<li>Change text box sizes</li>

<li>Find the number of links on a page</li>

</ul>

<p>Scripts can be saved and loaded on demand. It allows you to write code while browsing and then run, or &#8220;trigger&#8221; it, at any time. Triggers can be set for page actions or whenever the page matches a criteria pattern you set. For example, scripts can be triggered when pages are loaded or when the browser sees particular links.

</p><p>The Chickenfoot extension&#8217;s interface is contained inside a browser sidebar. It includes a text box for on-the-fly scripting, and an area allowing you to see the output and error messages of your scripts. There are a couple tabs at the top of the sidebar which allow you to browse pattern matches and tweak the preferences controlling when your scripts are triggered.

</p><p>There are some sample scripts bundled with Chickenfoot, including an &#8220;icon search&#8221; that&#8217;s useful for filtering Google image search results for icons. There&#8217;s also a script which highlights and defines SAT words, and one which allows you to resize text boxes by dragging a small image in the box&#8217;s corner.

</p><p>Chickenfoot offers some functionality Greasemonkey lacks. Most significantly, scripting in Chickenfoot has an easier learning curve. Easy script commands include functions like <tt>"click("This Link")</tt>. Manipulating the same type of command in Greasemonkey involves an intermediate level of JavaScript knowledge, a text editor, and a page refresh.

</p>

<a name="What_you.27ll_need"></a><h2> <span class="mw-headline"> What you&#8217;ll need </span></h2>



<p>You&#8217;ll need to be running Firefox and the Chickenfoot add-on. You&#8217;ll also need a general understanding of scripting and a good idea for a script you&#8217;d like to create.

</p><p>You can get Firefox at <a href="http://www.firefox.com" class="external text" title="http://www.firefox.com" rel="nofollow">Mozilla&#8217;s Firefox site</a>.

</p><p>You can get Chickenfoot at <a href="http://groups.csail.mit.edu/uid/chickenfoot" class="external text" title="http://groups.csail.mit.edu/uid/chickenfoot" rel="nofollow">Chickenfoot&#8217;s home page</a>

</p>

<a name="Steps"></a><h2> <span class="mw-headline"> Steps </span></h2>

<a name="Step_1:_Basic_Page_Navigation"></a><h3> <span class="mw-headline">Step 1: Basic Page Navigation</span></h3>

<p>Basic page navigation is probably the most most unique feature of Chickenfoot. For example, all it takes to open a page, enter a query and press a button is:

</p>



<pre class="brush: js">go("webmonkey.com")

enter("search","chickenfoot")

click("second button")

</pre>

<p>Let&#8217;s take that idea a step further. Say I want to set up a script to open Gmail (presuming I&#8217;m already logged in to my Google account) and search account for any unread messages. In Chickenfoot, the script would look like.

</p>

<pre class="brush: js">go("http://www.gmail.com")

enter("search","is:unread")

click("Search Mail")

</pre>

<p>Chickenfoot will find the best match for the arguments given. However, what if there are multiple search forms on a page? With a little JavaScript know-how, you can specify exactly the right textbox, image or button you want Chickenfoot to interact with. For example, you can specify the DOM using something like.

</p><p><code>

click(new XPath("/HTML[1]/BODY[1]/DIV[1]/DIV[1]/DIV[2]/UL[1]/LI[7]/FORM[1]/INPUT[2]"))

</code>

</p><p>If the DOM and JavaScript are a little over your head, Chickenfoot makes it easy to write such a script anyway. You can &#8220;Record actions&#8221; as you perform your desired task, then copy and paste the actions into a script.

</p><p><a href="/wp-content/uploads/2009/12/080606-chickenfoot.png" class="image" title="Image:080606-chickenfoot.png"><img alt="Image:080606-chickenfoot.png" src="/wp-content/uploads/2009/12/080606-chickenfoot.png" border="0" height="605" width="546"></a>

</p><p>Other form elements are supported as well. For example, you can use <code>pick("<em>my selection</em>")</code> to select from a drop-down list and <code>check("<em>my choice</em>")</code> to choose a particular checkbox.



</p><p><br />

</p>

<a name="Step_2:_Pattern_Matching"></a><h3> <span class="mw-headline">Step 2: Pattern Matching</span></h3>

<p>Want to load and search for strings on a page? Basic page manipulation is possible using built in pattern-matching.

</p><p>Let&#8217;s say we want to find how many times the word &#8220;chickenfoot&#8221; appears in this article. We&#8217;d write something like this:

</p>

<pre class="brush: js">m=find("chickenfoot")

m.count

</pre>

<p>The answer would appear in the output field.

</p><p><br />

</p>

<a name="Step_3:_Page_Modification"></a><h3> <span class="mw-headline">Step 3: Page Modification</span></h3>

<p>Chickenfoot allows you to change a page&#8217;s rendered source code on the fly. For example, let&#8217;s say we want to customize an image on a page. Maybe you&#8217;d even want to go as far as replacing the Webmonkey logo with an image of your own design.



</p><p>This is just one way:

</p>

<pre class="brush: js">replace("http:www.webmonkey.com/logo.gif", "http://myserver/mylogo.gif")

</pre>

<p><br />

</p>

<a name="Step_4:_Activating_Triggers"></a><h3> <span class="mw-headline">Step 4: Activating Triggers</span></h3>

<p>Up until this point, we&#8217;ve focused on writing ad hoc code from the sidebar. Let&#8217;s say we wrote a script we liked and wanted to apply it every time it matched a specific set of criteria.

</p><p>On the bottom of the Chickenfoot sidebar is a tab called &#8220;Triggers.&#8221; Triggers can be set to activate whenever a page meets the criteria you set. You can set your script to run when it sees a match for a page URL, when a new window opens or when Firefox starts.

</p><p>To add a trigger, press the &#8220;plus&#8221; icon at the top of the triggers tab. You may have to expand the width of the sidebar to see icons for adding, editing, and removing triggers.

</p><p><a href="/wp-content/uploads/2009/12/080606-chickenfoot-triggers.png" class="image" title="Image:080606-chickenfoot-triggers.png"><img alt="Image:080606-chickenfoot-triggers.png" src="/wp-content/uploads/2009/12/080606-chickenfoot-triggers.png" border="0" height="94" width="422"></a>

</p><p>Notably, the last option on the right of the Trigger tab gives you the ability to package your triggers as stand-alone Firefox extensions. Packaged extensions can be sent to, and installed by, friends who use Firefox &#8212; even if they don&#8217;t have Chickenfoot installed.

</p>

<a name="Alternate_methods"></a><h2> <span class="mw-headline"> Alternate methods </span></h2>



<a name="JavaScript_Integration"></a><h3> <span class="mw-headline">JavaScript Integration</span></h3>

<p>Chickenfoot scripting is heavily based on JavaScript. If you know JavaScript, you can bypass the easy-to-use Chickenfoot commands and write your functions completely in JavaScript. Scripts written in JavaScript are easily portable across browsers, extensions and platforms.

</p>

<a name="Greasemonkey"></a><h3> <span class="mw-headline">Greasemonkey</span></h3>

<p>As mentioned above, Greasemonkey is an alternative to Chickenfoot for scripting your browser. You can find Greasemonkey at <a href="https://addons.mozilla.org/en-US/firefox/addon/748" class="external text" title="https://addons.mozilla.org/en-US/firefox/addon/748" rel="nofollow">the Mozilla add-on site</a>.

</p><p>As mentioned above, you can write your scripts directly in JavaScript and port them over to Greasemonkey. Chickenfoot also allows you to port over your Greasemonkey scripts by inserting:

</p>

<pre class="brush: js">include("greasemonkey.js");</pre>

<p>at the top of your script. You can also use the Chickenfoot tool to compose Greasemonkey scripts. To start a new Greasemonkey script in Chickenfoot, click the arrow next to the &#8220;New&#8221; button and select &#8220;Greasemonkey template.&#8221;

</p>



<a name="Suggested_readings"></a><h2> <span class="mw-headline"> Suggested readings </span></h2>

<p>Chickenfoot&#8217;s <a href="http://groups.csail.mit.edu/uid/chickenfoot/quickstart.html" class="external text" title="http://groups.csail.mit.edu/uid/chickenfoot/quickstart.html" rel="nofollow">Quick Start guide</a> is a great place to learn the basics. It also <a href="http://groups.csail.mit.edu/uid/chickenfoot/api.html" class="external text" title="http://groups.csail.mit.edu/uid/chickenfoot/api.html" rel="nofollow">offers a great command library</a> that you can bookmark for reference.

</p><p>There&#8217;s a <a href="http://groups.csail.mit.edu/uid/chickenfoot/scripts/index.php/Main_Page" class="external text" title="http://groups.csail.mit.edu/uid/chickenfoot/scripts/index.php/Main_Page" rel="nofollow">Chickenfoot Scripts wiki</a> &#8212; a great place to download scripts and learn by example.

</p><p>Webmonkey <a href="/2010/02/tag/javascript" class="external text" title="/2010/02/tag/javascript" rel="nofollow">has a load of JavaScript tutorials</a> to get you started on the portable scripting language.



</p><div id='linker_widget' class='contextly-widget'></div>]]></content:encoded>
            <wfw:commentRss>http://www.webmonkey.com/2010/02/get_started_with_chickenfoot/feed/</wfw:commentRss>
        <slash:comments>2</slash:comments>

        
    </item>
    </channel>
</rss>
