Activate your free membership today | Log-in

Wednesday, January 3rd, 2007

Using YUI in GreaseMonkey Scripts

Category: Yahoo!

<p>Carlo Zottmann, a Yahoo! engineer in Munich, is a fan of GreaseMonkey and wanted to use YUI in his user scripts.

His article provides a reusable model for how to make use of YUI in the GM script without stomping on any YUI use already on the page:

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.

Related Content:

  • Ajax testing: Using available tools is key
    Ted Husted is a business analyst, author, consultant, and speaker. His books include JUnit in Action, Struts in Action, and Professional JSP Site...
  • Trap JavaScript runtime errors in Domino Web apps
    Domino developers know that errors can and do occur during application development and testing as well as during production. This JavaScript traps...
  • GMaps4JSF with Ajax PUSH
    GMaps4JSF aims at integrating Google maps with JavaServer Faces (JSF). JSF users will be also able to construct complex street view panoramas and maps...
  • Future technologies
    We take a closer look at the next top ten "make-it-big" ideas to try and find the killer application that will banish...
  • An Introduction to GMaps4JSF
    GMaps4JSF is one of the JSF Mashups libraries that enable JSF users to build Web 2.0 Mashup applications in JSF easily. In this article, I will...

Posted by Dion Almaer at 11:47 am
2 Comments

+++--
3.8 rating from 24 votes

2 Comments »

Comments feed TrackBack URI

http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/

Comment by Patrick Mueller — January 3, 2007

Why isn’t YUI listed on the RESOURCES page of ajaxian?

Comment by Steve Nolte — January 5, 2007

Leave a comment

You must be logged in to post a comment.