ActiveState Community

jQuery Library Extension for Komodo

Posted by jeffg on 2007-05-30 13:59
OS: All / Any

Attached is a *very* simple Extension that bundles the jQuery JavaScript library into an XPI that you can install into Komodo. The benefit? You can now use jQuery code in JavaScript macros and extensions!

Simple example Macro:

try {
  $('#project_tab').get(0).click();
} catch(e) { alert(e); }
try {
  $('#project_tab').get(0).click();
} catch(e) { alert(e); }

If you start using jQuery extensively in Komodo, you may want to use checks in your code to make sure that the extension is installed:

if(typeof(window.jQuery) == "undefined") {
    // no jQuery, fail gracefully
    alert("seems like the jQuery extension isn't installed?");
} else {
    // brilliant code here
    alert("we got jQuery!");
}
if(typeof(window.jQuery) == "undefined") {
    // no jQuery, fail gracefully
    alert("seems like the jQuery extension isn't installed?");
} else {
    // brilliant code here
    alert("we got jQuery!");
}

Watch this space for updates, at least until I finish implementing the extension hosting code.

AttachmentSize
jquery-1.1.2.xpi12.04 KB

jeffg | Mon, 2007-07-23 21:32

Note: this has now been moved and updated to jQuery 1.1.3:

http://community.activestate.com/xpi/jquery

--
JeffG