/* | __ _____ ________ __ | / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / / | __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ / | / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__ | \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/ | \/ /____/ version 0.3.3 http://terminal.jcubic.pl Licensed under GNU LGPL Version 3 license Copyright (c) 2011 Jakub Jankiewicz Includes: Storage plugin Distributed under the MIT License Copyright (c) 2010 Dave Schindler LiveQuery plugin Dual MIT and GPL Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net) jQuery Timers licenced with the WTFPL Date: Mon, 07 Mar 2011 11:57:17 +0000 */ Array.prototype.has=function(g){for(var v=this.length;v--;)if(this[v]==g)return true;return false};function get_stack(g){return g?[g.toString().match(/.*\n.*\n/)].concat(get_stack(g.caller)):[]} (function(g,v){function S(a,d){var c;if(typeof a==="string"&&typeof d==="string"){localStorage[a]=d;return true}else if(typeof a==="object"&&typeof d==="undefined"){for(c in a)if(a.hasOwnProperty(c))localStorage[c]=a[c];return true}return false}function O(a,d){var c,i;c=new Date;c.setTime(c.getTime()+31536E6);c="; expires="+c.toGMTString();if(typeof a==="string"&&typeof d==="string"){document.cookie=a+"="+d+c+"; path=/";return true}else if(typeof a==="object"&&typeof d==="undefined"){for(i in a)if(a.hasOwnProperty(i))document.cookie= i+"="+a[i]+c+"; path=/";return true}return false}function T(a){return localStorage[a]}function U(a){var d,c,i;a+="=";d=document.cookie.split(";");for(c=0;c/g,">");a=a.replace(/\n/g,"
");a=a.replace(/ /g," ");a=a.replace(/\t/g,"    ");var d=a.split(X);if(d.length>1)a=g.map(d,function(c){return c[0]=="["?c.replace(Y,function(i,j,p,u,k){i="";if(j.indexOf("b")!=-1)i+="font-weight:bold;";if(j.indexOf("u")!=-1)i+="text-decoration:underline;";if(j.indexOf("i")!=-1)i+="font-style:italic; ";if(p.match(Q))i+="color:"+p+";";if(u.match(Q))i+="background-color:"+ u;return a=''+k+""}):""+c+""}).join("");return a}else return""}function R(a){var d=a instanceof Array?a:a?[a]:[],c=0;g.extend(this,{left:function(){if(c===0)c=d.length-1;else--c;return d[c]},right:function(){if(c==d.length-1)c=0;else++c;return d[c]},current:function(){return d[c]},data:function(){return d},reset:function(){c=0},append:function(i){d.push(i);this.reset()}})}function Z(a){var d=a?[a]:[];g.extend(this,{size:function(){return d.length},pop:function(){if(d.length=== 0)return null;else{var c=d[d.length-1];d=d.slice(0,d.length-1);return c}},push:function(c){d=d.concat([c]);return c},top:function(){return d.length>0?d[d.length-1]:null}})}function $(a){var d=true;if(typeof a==="string"&&a!=="")a+="_";var c=g.Storage.get(a+"commands"),i=new R(c?eval("("+c+")"):[""]);g.extend(this,{append:function(j){if(d&&i.current()!=j){i.append(j);g.Storage.set(a+"commands",g.json_stringify(i.data()))}},data:function(){return i.data()},next:function(){return i.right()},last:function(){i.reset()}, previous:function(){return i.left()},clear:function(){i=new R;g.Storage.remove(a+"commands")},enable:function(){d=true},disable:function(){d=false}})}g.extend(g.fn,{livequery:function(a,d,c){var i=this,j;if(g.isFunction(a)){c=d;d=a;a=v}g.each(g.livequery.queries,function(p,u){if(i.selector==u.selector&&i.context==u.context&&a==u.type&&(!d||d.$lqguid==u.fn.$lqguid)&&(!c||c.$lqguid==u.fn2.$lqguid))return(j=u)&&false});j=j||new g.livequery(this.selector,this.context,a,d,c);j.stopped=false;j.run();return this}, expire:function(a,d,c){var i=this;if(g.isFunction(a)){c=d;d=a;a=v}g.each(g.livequery.queries,function(j,p){if(i.selector==p.selector&&i.context==p.context&&(!a||a==p.type)&&(!d||d.$lqguid==p.fn.$lqguid)&&(!c||c.$lqguid==p.fn2.$lqguid)&&!this.stopped)g.livequery.stop(p.id)});return this}});g.livequery=function(a,d,c,i,j){this.selector=a;this.context=d||document;this.type=c;this.fn=i;this.fn2=j;this.elements=[];this.stopped=false;this.id=g.livequery.queries.push(this)-1;i.$lqguid=i.$lqguid||g.livequery.guid++; if(j)j.$lqguid=j.$lqguid||g.livequery.guid++;return this};g.livequery.prototype={stop:function(){var a=this;if(this.type)this.elements.unbind(this.type,this.fn);else this.fn2&&this.elements.each(function(d,c){a.fn2.apply(c)});this.elements=[];this.stopped=true},run:function(){if(!this.stopped){var a=this,d=this.elements,c=g(this.selector,this.context),i=c.not(d);this.elements=c;if(this.type){i.bind(this.type,this.fn);d.length>0&&g.each(d,function(j,p){g.inArray(p,c)<0&&g.event.remove(p,a.type,a.fn)})}else{i.each(function(){a.fn.apply(this)}); this.fn2&&d.length>0&&g.each(d,function(j,p){g.inArray(p,c)<0&&a.fn2.apply(p)})}}}};g.extend(g.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if(g.livequery.running&&g.livequery.queue.length)for(var a=g.livequery.queue.length;a--;)g.livequery.queries[g.livequery.queue.shift()].run()},pause:function(){g.livequery.running=false},play:function(){g.livequery.running=true;g.livequery.run()},registerPlugin:function(){g.each(arguments,function(a,d){if(g.fn[d]){var c= g.fn[d];g.fn[d]=function(){var i=c.apply(this,arguments);g.livequery.run();return i}}})},run:function(a){if(a!=v)g.inArray(a,g.livequery.queue)<0&&g.livequery.queue.push(a);else g.each(g.livequery.queries,function(d){g.inArray(d,g.livequery.queue)<0&&g.livequery.queue.push(d)});g.livequery.timeout&&clearTimeout(g.livequery.timeout);g.livequery.timeout=setTimeout(g.livequery.checkQueue,20)},stop:function(a){a!=v?g.livequery.queries[a].stop():g.each(g.livequery.queries,function(d){g.livequery.queries[d].stop()})}}); g.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove");g(function(){g.livequery.play()});var aa=g.prototype.init;g.prototype.init=function(a,d){var c=aa.apply(this,arguments);if(a&&a.selector){c.context=a.context;c.selector=a.selector}if(typeof a=="string"){c.context=d||document;c.selector=a}return c};g.prototype.init.prototype=g.prototype;var J=typeof window.localStorage!=="undefined";g.extend({Storage:{set:J? S:O,get:J?T:U,remove:J?V:W}});jQuery.fn.extend({everyTime:function(a,d,c,i,j){return this.each(function(){jQuery.timer.add(this,a,d,c,i,j)})},oneTime:function(a,d,c){return this.each(function(){jQuery.timer.add(this,a,d,c,1)})},stopTime:function(a,d){return this.each(function(){jQuery.timer.remove(this,a,d)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1E3,das:1E4,hs:1E5,ks:1E6},timeParse:function(a){if(a==v||a==null)return null;var d=this.regex.exec(jQuery.trim(a.toString())); return d[2]?parseInt(d[1],10)*(this.powers[d[2]]||1):a},add:function(a,d,c,i,j,p){var u=0;if(jQuery.isFunction(c)){j||(j=i);i=c;c=d}d=jQuery.timer.timeParse(d);if(!(typeof d!="number"||isNaN(d)||d<=0)){if(j&&j.constructor!=Number){p=!!j;j=0}j=j||0;p=p||false;if(!a.$timers)a.$timers={};a.$timers[c]||(a.$timers[c]={});i.$timerID=i.$timerID||this.guid++;var k=function(){if(!(p&&this.inProgress)){this.inProgress=true;if(++u>j&&j!==0||i.call(a,u)===false)jQuery.timer.remove(a,c,i);this.inProgress=false}}; k.$timerID=i.$timerID;a.$timers[c][i.$timerID]||(a.$timers[c][i.$timerID]=window.setInterval(k,d));this.global[c]||(this.global[c]=[]);this.global[c].push(a)}},remove:function(a,d,c){var i=a.$timers,j;if(i){if(d){if(i[d]){if(c){if(c.$timerID){window.clearInterval(i[d][c.$timerID]);delete i[d][c.$timerID]}}else for(c in i[d]){window.clearInterval(i[d][c]);delete i[d][c]}for(j in i[d])break;if(!j){j=null;delete i[d]}}}else for(d in i)this.remove(a,d,c);for(j in i)break;if(!j)a.$timers=null}}}});if(jQuery.browser.msie)jQuery(window).one("unload", function(){var a=jQuery.timer.global,d;for(d in a)for(var c=a[d],i=c.length;--i;)jQuery.timer.remove(c[i],d)});var X=/(\[\[[biu]*;[^;]*;[^\]]*\][^\]]*\])/g,Y=/\[\[([biu]*);([^;]*);([^\]]*)\]([^\]]*)\]/g,Q=/#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})/;g.json_stringify=function(a,d){var c="";d=d===v?1:d;switch(typeof a){case "function":c+=a;break;case "boolean":c+=a?"true":"false";break;case "object":if(a===null)c+="null";else if(a instanceof Array){c+="[";for(var i=a.length,j=0;j1?",":"";if(d==1)c=c.replace(/,([\]}])/g,"$1");return c.replace(/([\[{]),/g,"$1")};g.fn.cmd=function(a){function d(e){var q=e.substring(0,j-p-1);e= e.substring(j-p-1);return[q].concat(P(e,j))}var c=this;c.addClass("cmd");c.append(' ');var i=g("