Using YUI in GreaseMonkey Scripts

Written By Alla Levin
January 04, 2007
1 Star2 Stars3 Stars4 Stars5 Stars

Another good and useful link from Ajaxian

In this brief article, I?ll share with you my own effort to reach that goal ? a Greasemonkey script that adds calls to external JavaScript libraries and CSS files to a given page and, once they are loaded, passes the YAHOO global object to the code inside the Greasemonkey script. (All YUI components reside within this single single global variable, YAHOO ? so, for example, you access the YUI Event Utility by referencing YAHOO.util.Event.) I?m sure that this approach is neither the perfect nor the only solution to achieving YUI/Greasemonkey integration, so suggestions and ideas are welcome! Please sound off in the comments and let me know what approaches you?ve taken to this problem in your own projects.

The example script in action: The Greasemonkey script loads YUI components, sends selected text to Yahoo! Babelfish for translation, then displays the results in a YUI Panel Control.

I Need More

Enter your Email Address to Join the
Gang of Curious and Life Loving

Related Articles