Commits

Anonymous committed 183ca88

Imported from svn by Bitbucket

  • Participants

Comments (0)

Files changed (14)

+/*  Cross-Browser Split 0.2.1
+    By Steven Levithan <http://stevenlevithan.com>
+    MIT license
+    http://blog.stevenlevithan.com/archives/cross-browser-split
+*/
+(function() {
+    var nativeSplit = nativeSplit || String.prototype.split;
+    String.prototype.split = function (s /* separator */, limit) {
+        // If separator is not a regex, use the native split method
+        if (!(s instanceof RegExp)) {
+                return nativeSplit.apply(this, arguments);
+        }
+
+        /* Behavior for limit: If it's...
+         - Undefined: No limit
+         - NaN or zero: Return an empty array
+         - A positive number: Use limit after dropping any decimal
+         - A negative number: No limit
+         - Other: Type-convert, then use the above rules */
+        if (limit === undefined || +limit < 0) {
+            limit = false;
+        } else {
+            limit = Math.floor(+limit);
+            if (!limit) {
+                return [];
+            }
+        }
+
+        var flags = (s.global ? "g" : "") + (s.ignoreCase ? "i" : "") + (s.multiline ? "m" : ""),
+            s2 = new RegExp("^" + s.source + "$", flags),
+            output = [],
+            lastLastIndex = 0,
+            i = 0,
+            match;
+
+        if (!s.global) {
+            s = new RegExp(s.source, "g" + flags);
+        }
+
+        while ((!limit || i++ <= limit) && (match = s.exec(this))) {
+            var zeroLengthMatch = !match[0].length;
+
+            // Fix IE's infinite-loop-resistant but incorrect lastIndex
+            if (zeroLengthMatch && s.lastIndex > match.index) {
+                s.lastIndex = match.index; // The same as s.lastIndex--
+            }
+
+            if (s.lastIndex > lastLastIndex) {
+                // Fix browsers whose exec methods don't consistently return undefined for non-participating capturing groups
+                if (match.length > 1) {
+                    match[0].replace(s2, function () {
+                        for (var j = 1; j < arguments.length - 2; j++) {
+                            if (arguments[j] === undefined) { match[j] = undefined; }
+                        }
+                    });
+                }
+
+                output = output.concat(this.slice(lastLastIndex, match.index), (match.index === this.length ? [] : match.slice(1)));
+                lastLastIndex = s.lastIndex;
+            }
+
+            if (zeroLengthMatch) {
+                s.lastIndex++;
+            }
+        }
+
+        return (lastLastIndex === this.length) ?
+            (s.test("") ? output : output.concat("")) :
+            (limit      ? output : output.concat(this.slice(lastLastIndex)));
+    };
+})();

File ie.split.min.js

+(function(){var A=A||String.prototype.split;String.prototype.split=function(J,E){if(!(J instanceof RegExp)){return A.apply(this,arguments)}if(E===undefined||+E<0){E=false}else{E=Math.floor(+E);if(!E){return[]}}var D=(J.global?"g":"")+(J.ignoreCase?"i":"")+(J.multiline?"m":""),H=new RegExp("^"+J.source+"$",D),C=[],B=0,F=0,G;if(!J.global){J=new RegExp(J.source,"g"+D)}while((!E||F++<=E)&&(G=J.exec(this))){var I=!G[0].length;if(I&&J.lastIndex>G.index){J.lastIndex=G.index}if(J.lastIndex>B){if(G.length>1){G[0].replace(H,function(){for(var K=1;K<arguments.length-2;K++){if(arguments[K]===undefined){G[K]=undefined}}})}C=C.concat(this.slice(B,G.index),(G.index===this.length?[]:G.slice(1)));B=J.lastIndex}if(I){J.lastIndex++}}return(B===this.length)?(J.test("")?C:C.concat("")):(E?C:C.concat(this.slice(B)))}})();
+/* Usage: XPath style Javascript object selection
+
+    This is an implementation of the abbreviated syntax of XPath. You can't use axis::nodetest
+    No functions are supported other than last()
+    Only node name tests are allowed, no nodetype tests. So you can't do text() and node()
+    Indices are zero-based, not 1-based
+
+    para                        selects the para child of the context       -- not all para children of the context
+    *                           selects all children of the context
+    para[0]                     selects the first para child of the context -- same as /para/0
+    para[last()]                selects the last para child of the context  -- same as /para/last()
+    * /para                     selects all para grandchildren of the context
+    /doc/chapter[5]/section[2]  same as /doc/chapter/5/section/2
+    chapter//para               selects the para descendants of the chapter children of the context
+    //para                      selects all the para descendants of the context
+    //olist/item                selects all the item children of having an olist parent under the context
+    .                           selects the context
+    .//para                     selects the para element descendants of the context
+    ..                          selects the parent of the context
+
+    Not done: (and won't be unless someone asks for it)
+        chapter[title] selects the chapter children of the context that have one or more title children
+        chapter[title="Introduction"] selects the chapter children of the context that have one or more title children with string-value equal to Introduction
+
+    Limitations:
+        Cannot handle self-linked structures (e.g. a.x = a )
+ */
+
+var jpath = (function() {
+    function _u(arr) { for (var a=arr.slice(0), i=1, l=arguments.length; i<l; i++) { a.unshift(arguments[i]); } return a; }
+    function merge(a,b) { return a.push.apply(a, b); }
+    function jp(obj, path, parents) {
+        if (!path.length)           { return [ obj ]; }
+        var id = path[0];
+        if (id == "..")             { return jp(parents.shift(), path.slice(1), parents); }
+        if (typeof obj != "object") { return path.length == 1 && id == "*" ? [ obj ] : []; }
+        if (id == "last()")         { return obj.length ? jp(obj[obj.length-1], path.slice(1), _u(parents, obj)) : []; }
+        var out = [];
+        if (id !== "") { // Find children
+                if (obj.hasOwnProperty(id))     { merge(out, jp(obj[id], path.slice(1), _u(parents, obj))); }
+                else if (id == "*")             { for (var i in obj) { if (obj.hasOwnProperty(i)) { merge(out, jp(obj[i], path.slice(1), _u(parents, obj))); } } }
+        }
+        else { // Find desendants
+            id = path[1];
+            for (var i in obj) { if (obj.hasOwnProperty(i)) {
+                if (obj[i].hasOwnProperty(id))  { merge(out, jp(obj[i][id], path.slice(2), _u(parents, obj, obj[i]))); }
+                else if (id == "*" || i === id) { merge(out, jp(obj[i],     path.slice(2), _u(parents, obj        ))); }
+                else                            { merge(out, jp(obj[i],     path,          _u(parents, obj        ))); }
+            } }
+        }
+        // TODO: Remove duplicates in out
+        return out;
+    }
+
+    function jpstr(obj, str) {
+        if (str.charAt(0) != "/") { str = "/" + str; }  // Add leading slash if required
+        var arr = str.replace(/\/+$/, "")               // Remove trailing slashes
+                     .replace(/\/\/+/, "//")            // Convert /// -> //
+                     .replace(/\[(\d+)\]/, "/$1")       // Convert chapter[0]/para to chapter/0/para
+                     .replace(/\/(\.\/)+/g, "/").replace(/^\.\//, "/").replace(/\/\.$/, "")    // Ignore "."
+                     .split("/").slice(1);
+
+        var arr2 = [];
+        for (var i=0,l=arr.length,depth=0; i<l; i++) {
+            if (depth <= 0) { arr2.push(arr[i]); } else { arr2[arr2.length-1] += "/" + arr[i]; }
+            var open  = arr[i].match(/\[/g);
+            var close = arr[i].match(/\]/g);
+            depth += (open ? open.length : 0) - (close ? close.length : 0);
+        }
+
+        return jp(obj, arr2, []);
+    }
+
+    return jpstr;
+})();

File jpath.min.js

+var jpath=(function(){function C(E){for(var G=E.slice(0),H=1,F=arguments.length;H<F;H++){G.unshift(arguments[H])}return G}function D(F,E){return F.push.apply(F,E)}function A(I,H,F){if(!H.length){return[I]}var J=H[0];if(J==".."){return A(F.shift(),H.slice(1),F)}if(typeof I!="object"){return H.length==1&&J=="*"?[I]:[]}if(J=="last()"){return I.length?A(I[I.length-1],H.slice(1),C(F,I)):[]}var E=[];if(J!==""){if(I.hasOwnProperty(J)){D(E,A(I[J],H.slice(1),C(F,I)))}else{if(J=="*"){for(var G in I){if(I.hasOwnProperty(G)){D(E,A(I[G],H.slice(1),C(F,I)))}}}}}else{J=H[1];for(var G in I){if(I.hasOwnProperty(G)){if(I[G].hasOwnProperty(J)){D(E,A(I[G][J],H.slice(2),C(F,I,I[G])))}else{if(J=="*"||G===J){D(E,A(I[G],H.slice(2),C(F,I)))}else{D(E,A(I[G],H,C(F,I)))}}}}}return E}function B(G,L){if(L.charAt(0)!="/"){L="/"+L}var J=L.replace(/\/+$/,"").replace(/\/\/+/,"//").replace(/\[(\d+)\]/,"/$1").replace(/\/(\.\/)+/g,"/").replace(/^\.\//,"/").replace(/\/\.$/,"").split("/").slice(1);var K=[];for(var H=0,E=J.length,F=0;H<E;H++){if(F<=0){K.push(J[H])}else{K[K.length-1]+="/"+J[H]}var I=J[H].match(/\[/g);var M=J[H].match(/\]/g);F+=(I?I.length:0)-(M?M.length:0)}return A(G,K,[])}return B})();

File jpath.test.js

+// rhino jpath.test.js
+
+load("jpath.js");
+
+var v = { chs: { x:300, y:200 }, cht:"lc", chtt:"Title", datasets: [ { chd: "5,10,15,20,25" } ], more: [0,1,2,3,4] };
+
+var tested = 0, failed = 0;
+function test(str, val) {
+    var a = jpath(v, str).join(",");
+    if (a != val) { failed++; print(str + " failed: " + a + " != " + val + "\n"); }
+    tested++;
+}
+
+test("chs/x", v.chs.x);
+test("chs/y", v.chs.y);
+test("cht",   v.cht);
+test("chtt",  v.chtt);
+test("datasets/0/chd", v.datasets[0].chd);
+
+test("chs//x", v.chs.x);
+test("chs//y", v.chs.y);
+test("datasets//chd", v.datasets[0].chd);
+test("//0/chd",  v.datasets[0].chd);
+
+test("chs///x", v.chs.x);
+test("chs////x", v.chs.x);
+test("chs////x/", v.chs.x);
+test("chs////x//", v.chs.x);
+test("chs////x///", v.chs.x);
+
+test("//x", v.chs.x);
+test("//y", v.chs.y);
+test("//chd", v.datasets[0].chd);
+test("//cht",   v.cht);
+test("//chtt",  v.chtt);
+
+test("chs/x/.", v.chs.x);
+test("chs/y/.", v.chs.y);
+test("cht/.",   v.cht);
+test("chtt/.",  v.chtt);
+test("datasets/0/chd/.", v.datasets[0].chd);
+
+test("./chs/x", v.chs.x);
+test("./chs/y", v.chs.y);
+test("./cht",   v.cht);
+test("./chtt",  v.chtt);
+test("./datasets/0/chd", v.datasets[0].chd);
+
+test("./chs/./x", v.chs.x);
+test("./chs/./y", v.chs.y);
+test("./cht/.",   v.cht);
+test("./chtt/.",  v.chtt);
+test("./datasets/./0/chd", v.datasets[0].chd);
+
+test("./chs/./x/./", v.chs.x);
+test("./chs/./y/./", v.chs.y);
+test("./cht/./",   v.cht);
+test("./chtt/./",  v.chtt);
+test("./datasets/./0/chd/./", v.datasets[0].chd);
+
+test("chs//./x", v.chs.x);
+test("chs//./y", v.chs.y);
+test("datasets//./chd", v.datasets[0].chd);
+
+test("//x/../y", v.chs.y);
+test("//x/../../chtt", v.chtt);
+
+test("//./x", v.chs.x);
+test("//./y", v.chs.y);
+test("//./chd", v.datasets[0].chd);
+test("//./cht",   v.cht);
+test("//./chtt",  v.chtt);
+
+test("/chs/x/../y",  v.chs.y);
+test("/chs/x/../../chtt",  v.chtt);
+test("//chd/../..//chd",  v.datasets[0].chd);
+test("/chs/x/../y/../../cht/../chtt/../datasets/0/chd",  v.datasets[0].chd);
+test("/chs/*",  [v.chs.x, v.chs.y].join(","));
+test("/chs/*/../x",  [v.chs.x, v.chs.x].join(","));
+test("/datasets/last()/chd", v.datasets[0].chd);
+test("/more/last()", v.more[v.more.length-1]);
+
+test("//chs/nothing/..", "");
+test("././cht", v.cht);
+
+/* Dynamic tests */
+function $map(arr, fn) {
+    for (var out=[], i=0, l=arr.length; i<l; i++) {
+        out[i] = fn(arr[i], i);
+    }
+    return out;
+}
+function randomtest(stack, object, parents) {
+    while (1) {
+        var r = Math.random(), key;
+        if (typeof object == "object") {
+            var arr = [];
+            for (var i in object) { if (object.hasOwnProperty(i)) { arr.push(i); } }
+            key = arr[Math.floor(Math.random() * arr.length)];
+        }
+        if (r < 0.05) { stack.push("."); return randomtest(stack, object, parents); }
+        if (r < 0.15) { if ((typeof object).match(/number|string|boolean/)) { return object; } }
+        if (r < 0.25) { if (parents.length > 0)        { stack.push("..");                              return randomtest(stack, parents.shift(), parents); } }
+        if (r < 0.75) { if (typeof object == "object") { stack.push(key);      parents.unshift(object); return randomtest(stack, object[key], parents);     } }
+        if (r < 0.95) { if (object instanceof Array)   { stack.push("last()"); parents.unshift(object); return randomtest(stack, object[object.length-1], parents); } }
+        // Need to test *
+    }
+}
+
+
+// load("D:/code/jslib/rsh/json.js");
+for (var i=0; i<1000; i++) {
+    var stack = [];
+    var out = randomtest(stack, v, []);
+    test(stack.join("/"), out);
+}
+
+if (!failed) { print("OK. Passed " + tested + " tests."); }
+else { print(failed + " failed tests out of " + tested); }

File jquery.alert.js

+/*  Transparent alerts
+    By S Anand <http://www.s-anand.net/>
+    Licensed under the WTFPL (http://sam.zoy.org/wtfpl/)
+    http://js-tables.googlecode.com/
+
+    Usage: jQuery.alert("Hello world");
+    Adds message to a queued non-modal transparent alert that stays until the mouse is moved.
+ */
+
+(function($){
+
+$.alert = (function() {
+    // ---- Begin configration ----
+    var hideDelay        = 1000,    // Alerts will stay on screen for at least this many milliseconds
+        slideUpDelay     = 300,     // Alerts will be hidden with a slide-up animation that lasts this many milliseconds
+        slideDownDelay   = 300,     // Alerts will be shown with a slide-down animation that lasts this many milliseconds
+        // CSS for the box that contains all the alerts
+        messageBoxCSS = {
+            'top': '-4px',
+            'width': '50%',
+            'margin': '0 25%',
+            'padding': '0 5px',
+            'position': 'fixed',
+            'border-color': '#777',
+            'border-style': 'solid',
+            'border-width': '0 4px 4px',
+            'background': 'rgb(255,255,255)',
+            'background': 'rgba(255,255,255,0.75)',
+            'border-radius-bottomleft': '20px',
+            'border-radius-bottomright': '20px',
+            '-moz-border-radius-bottomleft': '20px',
+            '-moz-border-radius-bottomright': '20px',
+            '-webkit-border-bottom-left-radius': '20px',
+            '-webkit-border-bottom-right-radius': '20px'
+        },
+        // CSS for the alert itself
+        messageCSS = {
+            'background': '#f3da86',
+            'margin': '2px 0 5px 0',
+            'padding': '2px 10px',
+            'border-radius': '20px',
+            'text-align': 'center',
+            'font': '24px Garamond',
+            '-moz-border-radius': '20px',
+            '-webkit-border-radius': '20px'
+        };
+
+    // ---- End configration. Begin code ----
+    var message = $('<div></div>').appendTo('body').css(messageBoxCSS),
+        hideTimer = 0;
+    $('body').mousemove(function() {
+        if (!hideTimer) {
+            hideTimer = setTimeout(function() {
+                message.stop(true, true).slideUp(slideUpDelay);
+            }, hideDelay)
+        }
+    });
+    return function(text) {
+        message.stop(true, true).show();
+        clearTimeout(hideTimer);
+        $('<p>').css(messageCSS).html('' + text).prependTo(message).hide().slideDown(slideDownDelay, function() { hideTimer = 0; });
+        $('p:gt(2)', message).hide();
+        $('p:eq(1)', message).css('opacity', '0.6');
+        $('p:eq(2)', message).css('opacity', '0.3');
+    };
+})();
+
+})(jQuery);

File jquery.alert.min.js

+/*  Transparent alerts
+    By S Anand <http://www.s-anand.net/>
+    Licensed under the WTFPL (http://sam.zoy.org/wtfpl/)
+    http://js-tables.googlecode.com/
+*/
+(function(A){A.alert=(function(){var D=1000,G=300,H=300,C={top:"-4px",width:"50%",margin:"0 25%",padding:"0 5px",position:"fixed","border-color":"#777","border-style":"solid","border-width":"0 4px 4px",background:"rgb(255,255,255)",background:"rgba(255,255,255,0.75)","border-radius-bottomleft":"20px","border-radius-bottomright":"20px","-moz-border-radius-bottomleft":"20px","-moz-border-radius-bottomright":"20px","-webkit-border-bottom-left-radius":"20px","-webkit-border-bottom-right-radius":"20px"},F={background:"#f3da86",margin:"2px 0 5px 0",padding:"2px 10px","border-radius":"20px","text-align":"center",font:"24px Garamond","-moz-border-radius":"20px","-webkit-border-radius":"20px"};var E=A("<div></div>").appendTo("body").css(C),B=0;A("body").mousemove(function(){if(!B){B=setTimeout(function(){E.stop(true,true).slideUp(G)},D)}});return function(I){E.stop(true,true).show();clearTimeout(B);A("<p>").css(F).html(I).hide().prependTo(E).slideDown(H,function(){B=0});A("p:gt(2)",E).hide();A("p:eq(1)",E).css("opacity","0.6");A("p:eq(2)",E).css("opacity","0.3")}})()})(jQuery);

File jquery.aws.js

+/* Usage:
+    aws({
+        Operation:      'ItemSearch',
+        SearchIndex:    'Books',
+        ResponseGroup:  'ItemAttributes,Similarities',
+        Keywords:       'Harry Potter',
+        Sort:           'salesrank'
+    }, function(data) { console.log(data); })
+
+    Requires jquery.pipes.js for $.getXML()
+*/
+
+(function($) {
+    var endpoints = {
+        'US': 'ecs.amazonaws.com',
+        'UK': 'ecs.amazonaws.co.uk',
+        'JP': 'aws.amazonaws.jp',
+        'FR': 'aws.amazonaws.fr',
+        'DE': 'aws.amazonaws.de',
+        'CA': 'aws.amazonaws.ca'
+    },
+    secure = 0,
+    euc = (encodeURIComponent || escape);
+
+    $.extend({
+        AWS: function(country, accesskey, associatetag) {
+            var base = secure ? 'https://' : 'http://'
+                 + (endpoints[country] || endpoints.US)
+                 + '/onca/xml?Service=AWSECommerceService'
+                 + "&AWSAccessKeyId=" + accesskey
+                 + "&AssociateTag" + associatetag;
+
+            // Windows CP-1252 non-ISO-8859-1 characters
+            var cp1252 = {
+                    "\x80" : "\u20AC",	// EURO SIGN
+                    "\x82" : "\u201A",	// SINGLE LOW-9 QUOTATION MARK
+                    "\x83" : "\u0192",	// LATIN SMALL LETTER F WITH HOOK
+                    "\x84" : "\u201E",	// DOUBLE LOW-9 QUOTATION MARK
+                    "\x85" : "\u2026",	// HORIZONTAL ELLIPSIS
+                    "\x86" : "\u2020",	// DAGGER
+                    "\x87" : "\u2021",	// DOUBLE DAGGER
+                    "\x88" : "\u02C6",	// MODIFIER LETTER CIRCUMFLEX ACCENT
+                    "\x89" : "\u2030",	// PER MILLE SIGN
+                    "\x8A" : "\u0160",	// LATIN CAPITAL LETTER S WITH CARON
+                    "\x8B" : "\u2039",	// SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+                    "\x8C" : "\u0152",	// LATIN CAPITAL LIGATURE OE
+                    "\x8E" : "\u017D",	// LATIN CAPITAL LETTER Z WITH CARON
+                    "\x91" : "\u2018",	// LEFT SINGLE QUOTATION MARK
+                    "\x92" : "\u2019",	// RIGHT SINGLE QUOTATION MARK
+                    "\x93" : "\u201C",	// LEFT DOUBLE QUOTATION MARK
+                    "\x94" : "\u201D",	// RIGHT DOUBLE QUOTATION MARK
+                    "\x95" : "\u2022",	// BULLET
+                    "\x96" : "\u2013",	// EN DASH
+                    "\x97" : "\u2014",	// EM DASH
+                    "\x98" : "\u02DC",	// SMALL TILDE
+                    "\x99" : "\u2122",	// TRADE MARK SIGN
+                    "\x9A" : "\u0161",	// LATIN SMALL LETTER S WITH CARON
+                    "\x9B" : "\u203A",	// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+                    "\x9C" : "\u0153",	// LATIN SMALL LIGATURE OE
+                    "\x9E" : "\u017E",	// LATIN SMALL LETTER Z WITH CARON
+                    "\x9F" : "\u0178"	// LATIN CAPITAL LETTER Y WITH DIAERESIS
+            };
+
+            var cache = {};
+
+            // AWS ECS returns data that is sometimes double-UTF8 encoded, sometimes CP1252 encoded. So adjust.
+            // UTF8 decode snippet from http://localhost/amazon-browser.html#Related:032147404X
+            // CP1252 conversion from
+            function decode_aws(data) {
+                var t = typeof data;
+                if (t == "object") { for (var i in data) { if (data.hasOwnProperty(i)) { data[i] = decode_aws(data[i]); } } }
+                else if (t == "string") {
+                    try { data = decodeURIComponent(escape(data)); } catch(e) { }
+                    data = data.replace(/([\x80-\x9F])/g, function(str, c) { return cp1252[c]; });
+                }
+                return data;
+            }
+
+            return function(params, callback) {
+                var url = [];
+                for (var key in params) { if (params.hasOwnProperty(key)) {
+                    // url.push(euc(key) + "=" + euc(params[key]));
+                    url.push(key + "=" + params[key]);
+                } }
+
+                url = base + '&' + url.sort().join('&');
+                if (cache[url]) { setTimeout(function() { callback(cache[url]); }, 0); }
+                else {
+                    $.getXML(url, function(data) {
+                        for (var key in data) { data = data[key]; break; }
+                        cache[url] = decode_aws(data);
+                        callback(cache[url]);
+                    });
+                }
+            };
+        }
+    });
+})(jQuery);

File jquery.aws.min.js

+(function(C){var A={US:"ecs.amazonaws.com",UK:"aws.amazonaws.co.uk",JP:"aws.amazonaws.jp",FR:"aws.amazonaws.fr",DE:"aws.amazonaws.de",CA:"aws.amazonaws.ca"},D=0,B=(encodeURIComponent||escape);C.extend({AWS:function(K,J,G){var H=D?"https://":"http://"+(A[K]||A.US)+"/onca/xml?Service=AWSECommerceService&AWSAccessKeyId="+J+"&AssociateTag"+G;var I={"\x80":"\u20AC","\x82":"\u201A","\x83":"\u0192","\x84":"\u201E","\x85":"\u2026","\x86":"\u2020","\x87":"\u2021","\x88":"\u02C6","\x89":"\u2030","\x8A":"\u0160","\x8B":"\u2039","\x8C":"\u0152","\x8E":"\u017D","\x91":"\u2018","\x92":"\u2019","\x93":"\u201C","\x94":"\u201D","\x95":"\u2022","\x96":"\u2013","\x97":"\u2014","\x98":"\u02DC","\x99":"\u2122","\x9A":"\u0161","\x9B":"\u203A","\x9C":"\u0153","\x9E":"\u017E","\x9F":"\u0178"};var E={};function F(N){var M=typeof N;if(M=="object"){for(var L in N){if(N.hasOwnProperty(L)){N[L]=F(N[L])}}}else{if(M=="string"){try{N=decodeURIComponent(escape(N))}catch(O){}N=N.replace(/([\x80-\x9F])/g,function(P,Q){return I[Q]})}}return N}return function(N,O){var L=[];for(var M in N){if(N.hasOwnProperty(M)){L.push(B(M)+"="+B(N[M]))}}L=H+"&"+L.sort().join("&");if(E[L]){setTimeout(function(){O(E[L])},0)}else{C.getXML(L,function(Q){for(var P in Q){Q=Q[P];break}E[L]=F(Q);O(E[L])})}}}})})(jQuery);

File jquery.csv.js

+/* Usage:
+ *  jQuery.csv()(csvtext)               returns an array of arrays representing the CSV text.
+ *  jQuery.csv("\t")(tsvtext)           uses Tab as a delimiter (comma is the default)
+ *  jQuery.csv("\t", "'")(tsvtext)      uses single quotes as the quote character (double quotes is the default)
+ *  jQuery.csv("\t", "'\"")(tsvtext)    uses single & double quotes as the quote character
+ *  Note: Use jQuery.csv(delim, 0) to speed up loading, if there are no quotes. Use with care: there might be quotes
+ *
+ *  jQuery.csv2json()(csvtext)          returns an array of hashes, whose keys are from the header row.
+ *                                      Otherwise, syntax identical to jQuery.csv()
+ */
+
+(function($) {
+
+// split() doesn't work properly on IE. "a,,b".split(",") returns ["a", "b"] and not ["a", "", "b"]
+// On IE, you need to fix String.prototype.split first. See http://blog.stevenlevithan.com/archives/cross-browser-split
+if ('a,,b'.split(',').length < 3) {
+    var nativeSplit = nativeSplit || String.prototype.split;
+    String.prototype.split = function (s /* separator */, limit) {
+        // If separator is not a regex, use the native split method
+        if (!(s instanceof RegExp)) {
+                return nativeSplit.apply(this, arguments);
+        }
+
+        /* Behavior for limit: If it's...
+         - Undefined: No limit
+         - NaN or zero: Return an empty array
+         - A positive number: Use limit after dropping any decimal
+         - A negative number: No limit
+         - Other: Type-convert, then use the above rules */
+        if (limit === undefined || +limit < 0) {
+            limit = false;
+        } else {
+            limit = Math.floor(+limit);
+            if (!limit) {
+                return [];
+            }
+        }
+
+        var flags = (s.global ? "g" : "") + (s.ignoreCase ? "i" : "") + (s.multiline ? "m" : ""),
+            s2 = new RegExp("^" + s.source + "$", flags),
+            output = [],
+            lastLastIndex = 0,
+            i = 0,
+            match;
+
+        if (!s.global) {
+            s = new RegExp(s.source, "g" + flags);
+        }
+
+        while ((!limit || i++ <= limit) && (match = s.exec(this))) {
+            var zeroLengthMatch = !match[0].length;
+
+            // Fix IE's infinite-loop-resistant but incorrect lastIndex
+            if (zeroLengthMatch && s.lastIndex > match.index) {
+                s.lastIndex = match.index; // The same as s.lastIndex--
+            }
+
+            if (s.lastIndex > lastLastIndex) {
+                // Fix browsers whose exec methods don't consistently return undefined for non-participating capturing groups
+                if (match.length > 1) {
+                    match[0].replace(s2, function () {
+                        for (var j = 1; j < arguments.length - 2; j++) {
+                            if (arguments[j] === undefined) { match[j] = undefined; }
+                        }
+                    });
+                }
+
+                output = output.concat(this.slice(lastLastIndex, match.index), (match.index === this.length ? [] : match.slice(1)));
+                lastLastIndex = s.lastIndex;
+            }
+
+            if (zeroLengthMatch) {
+                s.lastIndex++;
+            }
+        }
+
+        return (lastLastIndex === this.length) ?
+            (s.test("") ? output : output.concat("")) :
+            (limit      ? output : output.concat(this.slice(lastLastIndex)));
+    };
+}
+
+
+
+// Returns a function that splits a line into fields using a simple delimiter
+// delimre is the regular expression for the delimiter, e.g. /,/
+function simple_splitline(delimre) {
+    return function(v) { return v.split(delimre); };
+}
+
+// Returns a function that splits a line into fields using a delimiter, and accounts for quotes.
+// For example, quoted_splitline(/,/, /"/, /""/) will break the following line:
+//      a,"b,c",d,"e,""f"",g"
+// into
+//      ['a', 'b,c', 'd', 'e,"f",g']
+function quoted_splitline(delim, delimre, quotere, doublequotere) {
+    return function(v) {
+        var arr = v.split(delimre);
+        for (var out=[], q, i=0, l=arr.length; i<l; i++) {
+            // If the value is within quotes, then from the point where the quote begins ...
+            if (q = arr[i].match(quotere)) {
+                q = q[0];
+                // ... to the point where the quote ends
+                for (var j=i; j<l; j++) {
+                    if (arr[j].charAt(arr[j].length-1) == q) { break; }
+                }
+
+                // Join the pieces into a single piece
+                var s = arr.slice(i,j+1).join(delim);
+
+                // Double quoting is the escape sequence for quotes. ("" instead of ")
+                s = s.replace(doublequotere[q], q);
+
+                // Use this joined piece instead of the individual pieces
+                out.push(s.substr(1,s.length-2));
+                i = j;
+            }
+            else {
+                out.push(arr[i]);
+            }
+        }
+        return out;
+    };
+}
+
+function parse_param(delim, quote, lined) {
+    var undef = 'undefined';
+    delim = typeof delim == undef ? ','    : delim;         // delimiter is comma by default
+    quote = typeof quote == undef ? '"'    : quote;         // quotes mark is "double quotes" by default
+    lined = typeof lined == undef ? '\r\n' : lined;         // line delimiter is \r or \n or both
+    var quotes  = quote ? quote.split('') : [],             // get each character in the quote
+        delimre = new RegExp( '[' + delim + ']' ),
+        quotere = new RegExp('^[' + quote + ']' );
+    for (var i=0, doublequotere={}, q; q=quotes[i]; i++) {  // and make a dictionary of doublequote possibilities
+        doublequotere[q] = new RegExp(q + q, 'g');
+    }
+    return [
+        new RegExp( '[' + lined + ']*$' ),                                  // trailing line delimiter
+        new RegExp( '[' + lined + '][' + lined + ']*'),                     // line delimiter,
+        quote ? quoted_splitline(delim, delimre, quotere, doublequotere) :  // splitline function
+                simple_splitline(delimre)
+    ];
+}
+
+jQuery.extend({
+    csv: function(delim, quote, lined) {
+        var param = parse_param(delim, quote, lined),
+            trailing  = param[0],
+            linedre   = param[1],
+            splitline = param[2];
+
+        // The main function. Split into lines, and then call splitline repeatedly.
+        return function(text) {
+            var lines = text.replace(trailing, '').split(linedre);
+            for (var i=0, l=lines.length; i<l; i++) {
+                lines[i] = splitline(lines[i]);
+            }
+            return lines;
+        };
+    },
+
+    csv2json: function(delim, quote, lined) {
+        var param = parse_param(delim, quote, lined),
+            trailing  = param[0],
+            linedre   = param[1],
+            splitline = param[2];
+
+        // The main function. Split into lines, and then call splitline repeatedly.
+        return function(text) {
+            var lines = text.replace(trailing, '').split(linedre),  // split into lines
+                header = splitline(lines[0]),                       // and get the first row (header)
+                nfields = header.length,
+                out = [];                                           // put the results into this array
+            for (var i=1, l=lines.length; i<l; i++) {
+                var line = splitline(lines[i]);                     // split each subsequent row
+                for (var j=0, result={}; j<nfields; j++) {          // and make it a hash of fields, using the header
+                    result[header[j]] = line[j];
+                }
+                out.push(result);                                   // add the hash
+            }
+            return out;
+        };
+    }
+});
+
+})(jQuery);

File jquery.csv.min.js

+(function(){function p(a){return function(c){return c.split(a)}}function q(a,c,f,i){return function(e){e=e.split(c);for(var g=[],d,b=0,h=e.length;b<h;b++)if(d=e[b].match(f)){d=d[0];for(var j=b;j<h;j++)if(e[j].charAt(e[j].length-1)==d)break;b=e.slice(b,j+1).join(a);b=b.replace(i[d],d);g.push(b.substr(1,b.length-2));b=j}else g.push(e[b]);return g}}function m(a,c,f){a=typeof a=="undefined"?",":a;c=typeof c=="undefined"?'"':c;f=typeof f=="undefined"?"\r\n":f;for(var i=c?c.split(""):[],e=RegExp("["+a+
+"]"),g=RegExp("^["+c+"]"),d=0,b={},h;h=i[d];d++)b[h]=RegExp(h+h,"g");return[RegExp("["+f+"]*$"),RegExp("["+f+"]["+f+"]*"),c?q(a,e,g,b):p(e)]}if("a,,b".split(",").length<3){var n=n||String.prototype.split;String.prototype.split=function(a,c){if(!(a instanceof RegExp))return n.apply(this,arguments);if(c===undefined||+c<0)c=false;else{c=Math.floor(+c);if(!c)return[]}var f=(a.global?"g":"")+(a.ignoreCase?"i":"")+(a.multiline?"m":""),i=RegExp("^"+a.source+"$",f),e=[],g=0,d=0,b;for(a.global||(a=RegExp(a.source,
+"g"+f));(!c||d++<=c)&&(b=a.exec(this));){if((f=!b[0].length)&&a.lastIndex>b.index)a.lastIndex=b.index;if(a.lastIndex>g){b.length>1&&b[0].replace(i,function(){for(var h=1;h<arguments.length-2;h++)if(arguments[h]===undefined)b[h]=undefined});e=e.concat(this.slice(g,b.index),b.index===this.length?[]:b.slice(1));g=a.lastIndex}f&&a.lastIndex++}return g===this.length?a.test("")?e:e.concat(""):c?e:e.concat(this.slice(g))}}jQuery.extend({csv:function(a,c,f){a=m(a,c,f);var i=a[0],e=a[1],g=a[2];return function(d){d=
+d.replace(i,"").split(e);for(var b=0,h=d.length;b<h;b++)d[b]=g(d[b]);return d}},csv2json:function(a,c,f){a=m(a,c,f);var i=a[0],e=a[1],g=a[2];return function(d){d=d.replace(i,"").split(e);for(var b=g(d[0]),h=b.length,j=[],l=1,r=d.length;l<r;l++){for(var s=g(d[l]),k=0,o={};k<h;k++)o[b[k]]=s[k];j.push(o)}return j}}})})(jQuery);

File jquery.pipes.js

+/*  Usage: $.getXML("http://....", function(data) {
+});
+*/
+
+/*
+(function($) {
+    var pipes   = 'http://pipes.yahoo.com/pipes/pipe.run?_id=$id&_render=json&url=$url&_callback=?',
+        getdata = function(o) { return o.data; },
+        euc     = encodeURIComponent || escape;
+    $.extend({
+        getXML : function(url, fn) { url = pipes.replace(/\$url/, euc(url)).replace(/\$id/, 'hrDp8A0v3RGr1Dm_yZ1_DQ'          ); $.getJSON(url, function(data) { fn(data.value.items[0]);              }); },
+        getHTML: function(url, fn) { url = pipes.replace(/\$url/, euc(url)).replace(/\$id/, '_sgmlzCy3BG9f_bJX0sBXw'          ); $.getJSON(url, function(data) { fn(data.value.items[0].content);      }); },
+        getCSV : function(url, fn) { url = pipes.replace(/\$url/, euc(url)).replace(/\$id/, 'tjQdGky93BGl8_s0EpPZnA'          ); $.getJSON(url, function(data) { fn($.map(data.value.items, getdata)); }); },
+        getFeed: function(url, fn) { url = pipes.replace(/\$url/, euc(url)).replace(/\$id/, '2d772f68598fcbd4c707a0af891e0f34'); $.getJSON(url, function(data) { fn(data.value);                       }); }
+    });
+})(jQuery);
+*/
+
+(function($) {
+        // Note: use "where(...)" instead of "where ..." to avoid Infosys Proxy from killing it
+    var yql = function(src, url) { return "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20" + src + "%20where(url%3D'" + euc(url) + "')&format=json&callback=?"; },
+        euc = encodeURIComponent || escape;
+    $.extend({
+        getXML : function(url, fn) { $.getJSON(yql('xml' , url), function(data) { fn(data.query.results); }); },
+        getHTML: function(url, fn) { $.getJSON(yql('html', url), function(data) { fn(data.query.results); }); },
+        getCSV : function(url, fn) { $.getJSON(yql('csv' , url), function(data) { fn(data.query.results); }); },
+        getFeed: function(url, fn) { $.getJSON(yql('rss' , url), function(data) { fn(data.query.results); }); }
+    });
+})(jQuery);

File jquery.pipes.min.js

+(function(C){var B=function(E,D){return"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20"+E+"%20where(url%3D'"+A(D)+"')&format=json&callback=?"},A=encodeURIComponent||escape;C.extend({getXML:function(D,E){C.getJSON(B("xml",D),function(F){E(F.query.results)})},getHTML:function(D,E){C.getJSON(B("html",D),function(F){E(F.query.results)})},getCSV:function(D,E){C.getJSON(B("csv",D),function(F){E(F.query.results)})},getFeed:function(D,E){C.getJSON(B("rss",D),function(F){E(F.query.results)})}})})(jQuery);

File jquery.table.js

+/*  Usage: $(selector).table(array, options)
+    Creates a table inside the first element matched by selector, displaying contents of the array of arrays
+    Options:
+        noscroll  = don't scroll when user get's to bottom of the window
+        maxshow   = number of rows to display per search
+        matches   = array of function(value, regexp, searchfilter) for each column
+        display   = array of function(value) for each column
+    TODO:
+        sort      = array of function(a,b) for each column to sort by
+    TODO CSS:
+        constant width
+        right-align numerical columns
+
+    Bugs: dropdowns look ugly
+ */
+
+(function($) {
+    // fn.later(100, this, a,b,...) executes a this.fn(a,b,...) 100 milliseconds later
+    Function.prototype.later = function() {
+        var f = this,
+            args = Array.prototype.slice.call(arguments),
+            ms = args.shift(), obj = args.shift();
+        if (f._timeout_id) { clearTimeout(f._timeout_id); }
+        if (ms > 0) { f._timeout_id = setTimeout( function () { f.apply(obj, args); }, ms); }
+    };
+    Function.prototype.clear = function() {
+        if (this._timeout_id) { clearTimeout(this._timeout_id); this._timeout_id = 0; }
+    };
+
+    /* http://blog.stevenlevithan.com/archives/faster-trim-javascript */
+    if (!String.prototype.trim) {
+        String.prototype.trim = function() { return this.replace(/^\s\s*/, "").replace(/\s\s*$/, ""); };
+    }
+
+    $.fn.extend({
+        table: function(array, options) {
+            var $header,            // Header input fields
+                $results,           // DIV that contains the result tables
+                shown,              // Number of rows shown so far
+                next,               // Next data row to search in
+                lastfilter,         // Array of parameters in $header last time search was called
+                re,                 // Regular expressions of lastfilter (cached)
+                hide,               // Whether to hide matching values or show matching values. Based on whether first char of filter is ! or not
+                $suggest,           // Drop-down suggesting values
+                suggestelem;        // Element on which dropdown was last invoked
+
+            var id = this,
+                header    = array[0].slice(0,array[0].length),
+                cols      = header.length,
+                rows      = array.length - 1,
+                getval    = function () { return $(this).val(); },
+                noscroll  = (options && options.noscroll ) || 0,    // Disable scroll at the bottom of the window
+                matches   = (options && options.matches  ) || [],   // Array of fns that match a cell
+                display   = (options && options.display  ) || [],   // Array of fns that show a cell
+                maxshow   = (options && options.maxshow  ) || 100,  // Max rows to display per
+                frequency = (options && options.frequency) || 0;    // Whether to do frequency analysis or not
+
+            /* Column Analysis fields */
+            var colIsNumber = [],   // colIsNumber[4] is true if column index 4 (5th column) is numeric, false otherwise
+                freq = [],          // freq[4][val] is the of val in column index 4 (5th column)
+                freqhtml = [],      // HTML showing top n items
+                analysed = 0,       // Rows analysed so far
+                maxanalysis = 1000; // Analyse 1000 rows at a time
+
+            for (var j=0; j<cols; j++) { freq[j] = {}; colIsNumber[j] = false; }
+
+            /*  search(-1) -- Restart search, no matter what
+                search()   -- If filters haven't changed, does nothing. If not, restarts.
+                search(1)  -- If filters haven't changed, extends current search. If not, restarts
+            */
+            function search(option) {
+                // Get the filters entered by the user
+                var filter = $header.map(getval).get();
+                var restart = (option == -1) || !lastfilter || (lastfilter.join("") != filter.join(""));
+                var extend  = (option == 1);
+
+                if (restart) {
+                    id.trigger('change', [filter]);
+                    lastfilter = filter;
+                    shown = next = 0;
+                    re = [];
+                    hide = [];
+                    for (var j=0; j<cols; j++) {
+                        if (filter[j].charAt(0) == '!') { hide[j] = 1; re[j] = new RegExp(filter[j].substr(1).trim(), "i"); }
+                        else                            { hide[j] = 0; re[j] = new RegExp(filter[j].trim(), "i"); }
+                    }
+                }
+
+                if (restart || extend) {
+                    var html = ["<table><tbody>"];
+                    ROWS: for (var i=next, shownnow=0, row; row = array[i]; i++) {
+                        // Skip row if it doesn't match the filter (or matches the filter, and we want to hide those rows)
+                        for (var j=0; j<cols; j++) {
+                            var match = matches[j] ? matches[j](''+row[j] || "", re[j], filter[j]) : (''+row[j] || "").match(re[j]);
+                            if (hide[j] ? match : !match) { continue ROWS; }
+                        }
+
+                        // If it does, display the row.
+                        html.push("<tr>");
+                        for (var j=0; j<cols; j++) {
+                            html.push("<td class='", header[j], "'>",
+                                      display[j] ? display[j](row[j] || "") : row[j] || "",
+                                      "</td>");
+                        }
+                        html.push("</tr>");
+                        shown++; shownnow++;
+
+                        // Limit the number or rows shown each time.
+                        if (shownnow >= maxshow) { break; }
+                    }
+                    next = i;
+                    html.push("</tbody></table>");
+
+                    if (extend) { $results.append(html.join("")); }
+                    else        { $results.html  (html.join("")); }
+
+                    // TODO: Align the widths of the columns
+                }
+            }
+
+            /* Sort */
+            function sort(elem) {
+                var cls = $(elem).attr("class"),
+                    col = $(elem).parent().attr("class").match(/col(\d\d*)/)[1],
+                    num = colIsNumber[col];
+                array.sort(
+                    cls.match(/desc/) ? ( num ? function(a,b) { a = +a[col]; b = +b[col]; return a < b ? 1 : a > b ? -1 : 0; }
+                                              : function(a,b) { a =  a[col]; b =  b[col]; return a < b ? 1 : a > b ? -1 : 0; } )
+                                      : ( num ? function(a,b) { a = +a[col]; b = +b[col]; return a > b ? 1 : a < b ? -1 : 0; }
+                                              : function(a,b) { a =  a[col]; b =  b[col]; return a > b ? 1 : a < b ? -1 : 0; } )
+                );
+            }
+
+            /* Suggest top values for a column */
+            function suggest(elem) {
+                suggestelem = $(elem);
+                var cls  = suggestelem.parent().attr("class"),
+                    col  = +cls.match(/col(\d\d*)/)[1],
+                    pos  = $header.eq(col).offset(),
+                    h    = $header.eq(col).height();
+                $suggest.css({left: pos.left + 'px', top: (pos.top + h + 2) + 'px'}).html(freqhtml[col]).show();
+            }
+
+            function unsuggest() {
+                suggestelem = undefined;
+                $suggest.hide();
+            }
+
+            /* Create header and body */
+            function addheader(id) {
+                for (var j=0; j<cols; j++) { header[j] = header[j].trim().replace(/\s/g, "_"); }
+                var html = ["<table><thead>"];
+                for (var row=array[0],j=0,lj=row.length; j<lj; j++) {
+                    html.push("<th class='", header[j], " col", j, "'>", row[j], " ",
+                        "<span class='sort asc' title='sort ascending'>&#x25b2;</span>",
+                        "<span class='sort desc' title='sort descending'>&#x25bc;</span>",
+                        // "<span class='sort asc' title='sort ascending'>&#9652;</span>",
+                        // "<span class='sort desc' title='sort descending'>&#9662;</span>",
+                        "<br/><input></input></th>");
+                }
+                html.push("</thead></table>");
+                $header = $(html.join(""))
+                    .appendTo(id)
+                    .find("span.sort")
+                        .click(function() { sort(this); search(-1); })
+                        .css({cursor: 'pointer'})
+                    .end()
+                    .find("input")
+                        .css("width", "95%")
+                        .keyup(function (e) {               // Use keyup to detect backspaces that clear the field. keypress won't do this.
+                            suggest.clear();
+                            if (e.keyCode == 40) { suggest(this); }
+                            else { unsuggest(); search.later(200); }
+                        })
+                        .focus(function (e) { suggest.later(2000, window, this); })
+                        .blur(function() { unsuggest.later(200); });
+
+                array.shift();                              // Remove the header row. Don't want it interfering with sort.
+                $results = $("<div></div>").appendTo(id);   // Create the results placeholder and search
+            }
+
+            /* Analyse frequency */
+            function analyse(col, fully) {
+                var freqshow = 20,                                  // Show top 20 items
+                    freqmax  = fully ? Infinity : 200,              // Analyse finite distinct items per column, unless it's a full analysis
+                    l = fully ? rows : rows < 5000 ? rows : 5000;   // Analyse up to 5000 rows, unless it's a full analysis
+                    f = freq[col],
+                    vals = [];
+                for (var i=0, n=0; (n < freqmax) && (i<l); i++) {
+                    var cell = array[i][col];
+                    if (cell) {
+                        if (!isFinite(cell)) { colIsNumber[col] = -1; }
+                        if (!f[cell]) { f[cell] = 1; vals.push(cell); n++; }
+                        else { f[cell]++; }
+                    }
+                }
+                vals.sort(function(a,b) { a = f[a]; b = f[b]; return a < b ? 1 : a > b ? -1 : 0; });
+                for (var html=[],i=0, l=vals.length, max=f[vals[0]] || 1; i<freqshow && i<l; i++) {
+                    var w = Math.round(f[vals[i]] / max * 100);
+                    html.push('<div>', vals[i], '</div>');
+                }
+                freqhtml[col] = html.join('');
+                colIsNumber[col] = colIsNumber[col] == -1 ? false : true;
+            }
+
+            id.eq(0).html("").css("table-layout", "fixed");      // Force fixed layout, otherwise column alignment will go for a toss.
+            addheader(id);
+            for (var j=0; j<cols; j++) { analyse(j, true); }
+            search(-1);
+
+
+            $suggest = $('<div></div>')
+                .css({position:'absolute', border:'1px solid #ccc', 'background-color':'#fff', padding: '0 5px'})
+                .appendTo(document.body)
+                .click(function(e) {        // If user clicks on suggestion, search for it
+                    if (suggestelem) {
+                        suggestelem.val($(e.target).text());
+                        search();
+                    }
+                    unsuggest();
+                })
+                .hide();
+
+            // Scrolling will continue the search. If you have multiple tables, it'll continue ALL the searches, but that's OK.
+            if (!noscroll) {
+                $(window).scroll(function(e) {
+                    var scrollX = window.pageYOffset || document.documentElement && document.documentElement.scrollTop    || document.body.scrollTop || 0,
+                        height  = window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body.clientHeight || 0;
+                    if (scrollX + height + 100 >= id.offset().top + id.height()) { search(1); }
+                });
+            }
+
+            return this;
+        }
+    });
+}) (jQuery);