commandlineでjQuery

メソッドチェーンとワンライナーは相性がよさげなのでつくってみた。


こんな感じに使えます。

:js jQuery.core("a:odd").css("background-color","#fef").each(function(i){jQuery.core(this).delay(1000*i).hide(1000).delay(1000).show(1000);})


jQuery に 直接 割り当てていないのは、直接だと を押すと常に組込まれる点を回避するためです。


// vim: set fdm=marker :
(function(){
  with({
    get window() content.window.wrappedJSObject,
    get document() content.document.wrappedJSObject,
  }){
    
    //{{{import jQuery
    //}}}

    modules.jQuery={
      get core() window.jQuery||setup(window)||window.jQuery,
    };
  }
})()
;


「//{{{...//}}}」 に 下記修正を加えた jQueryを挿入します。
(min版でも 同等の修正は容易だと思います。)


修正内容は、匿名関数が直接callされて 組込む点を、名前を付与して、任意のタイミングでcall するためです。

diff -r 39a2ab9dd845 jquery-1.4.2.js
--- a/jquery-1.4.2.js	Mon Feb 22 22:34:10 2010 +0900
+++ b/jquery-1.4.2.js	Mon Feb 22 22:38:16 2010 +0900
@@ -13,7 +13,7 @@
  *
  * Date: Sat Feb 13 22:33:48 2010 -0500
  */
-(function( window, undefined ) {
+function setup( window, undefined ) {
 
 // Define a local copy of jQuery
 var jQuery = function( selector, context ) {
@@ -6237,4 +6237,4 @@
 // Expose jQuery to the global object
 window.jQuery = window.$ = jQuery;
 
-})(window);
+}//)(window);