Posted By

Piotrek290 on 12/06/09


Tagged

javascript SoQ


Versions (?)

SoQ 1.8.2


 / Published in: JavaScript
 

Oto najnowsza wersja - 1.8.2

  1. SoQ=$=function(a1,a2,a3){if(typeof a1=='string')a1=$.init(a1,a2||0,a3||0);a1=a1.length==1?a1[0]:a1;if(!a1.SoQ){for(var rx in $.e)a1[rx]=$.e[rx];a1.SoQ=1;a1.now=a1.now||{};a1.evt=a1.evt||{};a1.tno=a1.tno||{};};return a1;}
  2. $.request=window.XMLHttpRequest?new XMLHttpRequest():window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):false;
  3. $.browser=/firefox/gi.test(navigator.userAgent)?'firefox':/opera/gi.test(navigator.userAgent)?'opera':/ie/gi.test(navigator.userAgent)?'ie':/chrome/gi.test(navigator.userAgent)?'chrome':/safari/gi.test(navigator.userAgent)?'safari':'other';
  4. $.l=0;$.t=[];$.o={};
  5. $.version='1.8.2';
  6.  
  7. $.init=function(a1,a2,a3){var all=[],a2=a2||document,a3=a3||'',a1s=a1.split(/\s*\,\s*(?![\d\-])/i),ns;if(a1s.length>1){for(var x=0;x<a1s.length;x++)all.push($.init(a1s[x],a2,a3));var all=$.merge.apply(0,all);return all.length?all.length==1?all[0]:all:null;}if(a1.replace(/\s/gi,'')=='')return a2;var a1=a1.replace(/\s+/gi,' ').replace(/^\s/,''),el=a1.split(' ')[0].replace(/\[.*?\]/gi,''),to=el.charAt(0)=='^'?1:0;if(to)var el=el.slice(1);if(el.replace(/\s/gi,'')=='+')return $.init(a1.slice(el.length+1),a2,'+');if(el.replace(/\s/gi,'')=='>')return $.init(a1.slice(el.length+1),a2,'>');;var nm=el.match(/\:([\-\d\,]+)/),co2=el.match(/\=(\d+)(\,\d+)?/i),co=co2?co2[1]:1,od=co2&&co2[2]?(co2[2].slice(1).num()-1)%co:co-1;var szz=a3=='+'?a2.parentNode.childNodes:a3=='>'?a2.childNodes:a2.getElementsByTagName(el.match(/^(\w+)/i)?el.match(/^(\w+)/i)[1]:'*'),el=el.replace(/^(\w+)/gi,'[tagName=$1]').replace(/\.(\w+)/gi,'[className~=$1]').replace(/\#(\w+)/gi,'[id=$1]').replace(/\:empty/gi,'[innerHTML==(|\s+|(\&nbsp)+)+]').replace(/\:noempty/gi,'[innerHTML!==(|\s+|(\&nbsp)+)+]').replace(/\:hide/gi,'[.display=none]').replace(/\([\d\-\,]\)/gi,'')+a1.slice(el.length),el=el.split(/\s+/gi)[0],els=el.replace(/\[\!(\w+)\]/gi,'[$1=]').match(/\[(.+?)\]/gi),els=els||[];X:for(var x=0;x<szz.length;x++){var sz=szz[x];for(var z=0;z<els.length;z++){var elsz=els[z].slice(1,-1),odd=elsz.match(/\!?[\~\^\$\*]?\=\=?/i),odd=odd?odd[0]:'!=',naz=elsz.split(odd)[0],war=elsz.slice(naz.length+odd.length).toLowerCase();if(naz.charAt(0)=='.')var war=war.color().toHex();if(odd.search('==')==-1)var war=war.replace(/(\W)/gi,'\\$1');var szw=naz.charAt(0)=='.'?$.cur(sz,naz.slice(1)).toHex():sz.getAttribute(naz)?sz.getAttribute(naz):sz[naz],szw=szw?szw.toString().toLowerCase():'',odz=odd.replace('!','').replace('==','=');var wrn=szw.search(RegExp(odz=='='?'^'+war+'$':odz=='~='?'(^|\\W)'+war+'(\\W|$)':odz=='^='?'^'+war:odz=='$='?war+'$':odz=='*='?war:''),'gi');if(odd.search('!')!=-1?wrn!=-1:wrn==-1)continue X;}if(a2!=sz&&sz.tagName&&(ns=$.init(a1.slice(a1.split(' ')[0].length),sz))&&ns.constructor==Array?ns.length:1)all.push($(to?sz:ns));};var all2=nm?$.e.sel.call($(all),nm[1]).array():all,all3=[];for(var x=od;x<all2.length;x+=co.num())all3.push(all2[x]);var all3=$.merge.apply(0,all3);return all3.length?all3:[];}
  8. $.ready=function(a1){if(window.addEventListener)window.addEventListener('DOMContentLoaded',a1,false);else if(window.attachEvent)window.attachEvent('onload',a1);else window.onload=a1;}
  9. $.extend=function(a1){for(var x in a1){$.e[x]=a1[x];}};
  10. $.load=function(a1){return $.o[a1||0];}
  11. $.merge=function(){var ret=[];for(var m=0;m<arguments.length;m++){if(arguments[m].constructor==Array){for(var mm=0;mm<arguments[m].length;mm++)ret.push(arguments[m][mm]);}else{ret.push(arguments[m]);}};return ret;}
  12. $.rcss=function(a1,a2){var dor=['border!-width','border!-color','border!-style','margin!','padding!'],kie=['top','right','bottom','left'];if(a2)var kie=kie.reverse();for(var r=0;r<5;r++){var ret='',mth=a1.toString().match(RegExp(dor[r].replace('!','')+'\s*\:\s*([^;]+)\;','i')),mth2=a1.toString().match(RegExp(dor[r].replace('!','')+'($|\s|\,)','i'));if(mth){var mthl=mth[1].split(' ').length;for(var rr=0;rr<4;rr++){ret+=dor[r].replace('!','-'+kie[rr])+':'+mth[1].split(' ')[rr%mthl]+'; ';}var a1=a1.replace(mth[0],ret);}else if(mth2){for(var rr=0;rr<4;rr++)ret+=dor[r].replace('!','-'+kie[rr])+', ';var a1=a1.replace(mth2[0],ret);}};return a1;}
  13. $.zero=function(a1,a2){return '0'.x(a2-a1.toString().length)+a1;}
  14. $.interval=function(a1,a2,a3,a4){var a4=a4||0;this.now=this.now||{};this.now[a4]=0;var arg=[];for(var x=4;x<arguments.length;x++){arg.push(arguments[x]);};arg.push(0);$.t.push([$.func(a1),a2,1,this]);$.t.push(arg);this.now[a4]=setInterval(Function('var li='+($.t.length-2)+';$.t[li+1][$.t[li+1].length-1]++;'+(a3?'if(($.t[li][2]++)=='+a3+'){clearInterval($.t[li][3].now["'+a4+'"]);delete $.t[li][3].now["'+a4+'"];};':'')+'$.t[li][0].apply($.t[li][3],$.t[li+1]);'),a2);}
  15. $.clear=function(a1,a2){clearInterval(a1.now[a2]);};
  16. $.avg=function(a1,a2,a3){var a3=typeof a3=='undefined'?.5:a3,a1=a1.toString();if(a1.search(/\#[0-9a-f]+/gi)!=-1||a1.search(/rgb/gi)!=-1){var a1=a1.toHex().slice(1).replace(/[0-9a-f]{2}/gi,function(a1){return $.zero(parseInt(a1,16),3);}).share(3);var a2=a2.toHex().slice(1).replace(/[0-9a-f]{2}/gi,function(a1){return $.zero(parseInt(a1,16),3);}).share(3);return '#'+$.zero((a1[0]-(a1[0]-a2[0])*a3).round().toString(16),2)+$.zero((a1[1]-(a1[1]-a2[1])*a3).round().toString(16),2)+$.zero((a1[2]-(a1[2]-a2[2])*a3).round().toString(16),2);}else if(a1.search(/\d+/gi)!=-1){return (a1.num()-((a1.num()-a2.num())*a3))+(a1.match(/[a-z\%]+/gi)?a1.match(/[a-z\%]+/gi)[0]:'');}else{return a2;}}
  17. $.cur=function(a1,a2){var ret=window.getComputedStyle?window.opera&&!a1.style[a2]&&(a2=='left'||a2=='top')?a1['client'+a2.charAt(0).toUpperCase()+a2.slice(1)]+'px':window.getComputedStyle(a1,null).getPropertyValue(a2):a1.currentStyle[a2.camelCase()]||0;if(ret=='auto')var ret=a2=='width'?a1.offsetWidth-$.cur(a1,'padding-left').num()-$.cur(a1,'padding-right').num()-$.cur(a1,'border-left-width').num()-$.cur(a1,'border-right-width').num()+'px':a2=='height'?a1.offsetHeight-$.cur(a1,'padding-top').num()-$.cur(a1,'padding-bottom').num()-$.cur(a1,'border-top-width').num()-$.cur(a1,'border-bottom-width').num()+'px':'0px';if(ret=='normal'||ret=='medium')var ret='0px';if(a2=='opacity'&&document.body.style.opacity==undefined)var ret=a1.Opacity||'1';return ret;}
  18. $.obj=function(a1){if(typeof a1=='string'){var ret={},spl=a1.split(/\s*\;\s*/gi);for(var x=0;x<spl.length;x++){spl2=spl[x].split(/\:\s*/gi);if(spl[x]!='')ret[spl2[0]]=spl2[1];};return ret;}else return a1;}
  19. $.str=function(a1){if(typeof a1!='object')return a1;var ret='';for(var q in a1)ret+=q+':'+a1[q]+';';return ret;}
  20. $.create=function(a1,a2){if(a2){var nt=[];for(var z=0;z<a2;z++)var nt=$.merge(nt,$.create(a1,0));return $(nt);};var tt2=[];if(typeof a1=='string'){tt2.push($(document.createElement(a1)));}else{var a1=$(a1).array();for(var x=0;x<a1.length;x++)tt2.push($(a1[x]).clone());$(a1).remove();};return $(tt2);}
  21. $.each=function(a1,a2,a3){var a1=a1.constructor==Array?a1:[a1],a2=$.func(a2),len=a1.length;for(var e=0;e<len;e++){var fu=a2.call(a1[e],e,a1);if(a3||fu!==undefined)a1[e]=fu;};return a1;}
  22. $.rand=function(a1,a2){return Math.round(Math.random()*(a2-a1))+a1;}
  23. $.json=function(a1){var t=[];for(var x in a1)t.push(x+"="+encodeURI(a1[x]));return t.join("&");};
  24. $.ajax=function(a1){parms=typeof a1.parms=='string'?a1.parms:$.json(a1.parms||{});if(a1.interval)$.interval($.ajax,a1.interval,0,'AJAX',a1);$.request.onreadystatechange=function(){var F=$.request.readyState==4&&$.request.status==200?a1.success||'':a1.loading||'';$.func(F).call(a1.newthis||window,$.request);};if(a1.type=='post'){$.request.open("POST",a1.url,true);$.request.setRequestHeader("Content-type","application/x-www-form-urlencoded");$.request.setRequestHeader("Content-length",$.json(a1.parms).length);$.request.setRequestHeader("Connection","close");$.request.send(parms);}else{$.request.open("GET",a1.url+'?'+parms,true);$.request.send(null);}};
  25. $.mouse=function(e){var a1=0,a2=0,e=e||window.event;if(e.pageX||e.pageY)a1=e.pageX,a2=e.pageY;else if(e.clientX||e.clientY)a1=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a2=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;return{x:a1,y:a2};}
  26. $.display=function(a1){var sd=$('body').create(a1).css('width:0;height:0;border:0;margin:0;padding:0;left:0;top:0;'),ret=sd.css('display');sd.remove();return ret;};
  27. $.func=function(a1){return typeof a1=='function'?a1:Function(a1||'');};
  28. $.amove=function(a1,a2,a3){var el=a1[a2];a1.splice(a2,1);return $.merge(a1.slice(0,a3),el,a1.slice(a3));};
  29. $.sort=function(a1,a2){var ret=[a1[0]],a2=typeof a2=='function'?a2:typeof a2=='string'?Function(a2):function(a1,a2){return a1<a2;},len=a1.length;Q:for(var q=1;q<len;q++){var il=ret.push(a1[q])-1;for(var w=0;w<il;w++){if(!a2.call(a1,ret[w],ret[il])){ret=$.amove(ret,il,w);continue Q;}}};return $(ret);};
  30. $.cookie=function(a1,a2,a3,a4,a5,a6){var now=new Date();if(arguments.length==1){var dd=document.cookie.match(RegExp('(?:^|\\W)(?:'+a1+')\=([^;]*)(?:$|\;)'));return dd?dd[1]:undefined;}else if(!a2)return document.cookie=escape(a1)+'=;expires='+now; else return document.cookie=escape(a1)+'='+escape(a2)+(a3?';expires='+new Date(now.getTime()+a3).toUTCString():'')+(a4?';path='+a4:'')+(a5?';domain='+a5:'')+(a6?';secure':'')+'; ';}
  31.  
  32. Sp=String.prototype;
  33. Np=Number.prototype;
  34. Np.round=function(){return Math.round(this);}
  35. Sp.round=function(){return Math.round(this.num());}
  36. Np.num=function(){return this;}
  37. Sp.num=function(){return parseFloat(this);}
  38. Sp.camelCase=function(){return this.replace(/-(.)/gi,function(a1,a2){return a2.toUpperCase();});}
  39. Sp.x=function(a1,a2){return Array(a1+1).join(this+(a2||''));}
  40. Sp.toHex=function(){var th=this.toString();if(th.search(/rgb/gi)!=-1){return '#'+th.split('(')[1].split(')')[0].replace(/\d+/gi,function(a1){return a1.num()<16?'0'+a1.num().toString(16):a1.num().toString(16);}).replace(/\,|\s/gi,'');};if(th.search(/\#[0-9a-f]+/gi)!=-1){var th=th.replace(/\#/gi,'');var th2='';for(var x=0;x<th.length;x++){th2+=th.charAt(x).x(Math.round(6/th.length));};return '#'+th2.slice(0,6);};return th.color();}
  41. Sp.rep=function(a1){var ret=this.toString();for(var x in a1){ret=ret.replace(RegExp(x,'gi'),a1[x]);};return ret;}
  42. Sp.color=function(){return this.rep({'transparent':'#ffffff','black':'#000000','maroon':'#800000','green':'#008000','olive':'#808000','navy':'#000080','purple':'#800080','teal':'#008080','silver':'#c0c0c0','gray':'#808080','red':'#ff0000','lime':'#00ff00','yellow':'#ffff00','blue':'#0000ff','fuchsia':'#ff00ff','aqua':'#00ffff','white':'#ffffff'});}
  43. Sp.share=function(a1){var ret=[];for(var x=0;x<this.length;x+=a1){ret.push(this.slice(x,x+a1));};return ret;}
  44.  
  45. $.e={
  46. on:function(a1,a2,a3){var tt=this.array(),a2=$.func(a2),a3=a3||'no'+($.l++);for(var y=0;y<tt.length;y++){var a2c=Function('event','$.t['+($.t.push(a2)-1)+'].call($.t['+($.t.push(tt[y])-1)+'],event,$.t['+($.t.push(tt[y].clone())-1)+']);');if(window.addEventListener)tt[y].addEventListener(a1,a2c,0);else tt[y].attachEvent('on'+a1,a2c);tt[y].evt=tt[y].evt||{};tt[y].evt[a1+'_'+a3]=a2c;};return this;},
  47. no:function(a1,a2,a3){var tt=this.array();for(var y=0;y<tt.length;y++){if(a3)tt[y].child('*').no(a1,a2);var te=tt[y].event(a1);for(var xn in te){if(!a2||a2==xn.slice(xn.split('_')[0].length+1)){delete tt[y].evt[xn];if(window.removeEventListener)tt[y].removeEventListener(xn.split('_')[0],te[xn],0);else tt[y].detachEvent('on'+xn.split('_')[0],te[xn]);}};};return this;},
  48. ton:function(a1){var tt=this.array();for(var y=0;y<tt.length;y++){if(!tt[y].tno[a1]){tt[y].tno[a1+'l']=0;tt[y].tno[a1+'t']=[];tt[y].tno[a1]=Function('event','cl',"var tot=this.tno."+a1+"t;tot[this.tno."+a1+"l++%tot.length].call(this,event,cl,this.tno."+a1+"l);");tt[y].on(a1,tt[y].tno[a1],'toggle');}for(var x=1;x<arguments.length;x++)tt[y].tno[a1+'t'].push($.func(arguments[x]));};return this;},
  49. event:function(a1,a2){var eret={},tt=this.array();if(typeof a1=='object'){for(var y=0;y<tt.length;y++){for(var x in a1){tt[y].on(x.split('_')[0],$.t[a1[x].toString().match(/\$\.t\[(\d+)\]/i)[1]],x.slice(x.split('_')[0].length+1));}};return this;}else{for(var y=0;y<tt.length;y++){for(var x in tt[y].evt){if(!a1||a1=='all'||a1==x.split('_')[0]){if(a2&&a1+'_'+a2==x){return tt[y].evt[x];}else{eret[x]=tt[y].evt[x];}}}}};return eret;},
  50. anim:function(a1,a2){var a2=a2||{},css=$.obj($.rcss($.str(a1).replace(/background\:/gi,'background-color:')||'')),inf=a2.infinity||0,seq=a2.sequence||0,wait=a2.wait?a2.wait+50:50,grav=a2.gravitation||0,bo=Math.sin(Math.PI/2*(a2.bounce?a2.bounce/100:0)),speed=a2.speed||a2.speed===0?a2.speed:(bo?1:0),re=a2.reflections||3,repeat=a2.repeat||1,repeat=bo?speed==2||speed=='constant'?re+1:re*2+1:repeat,time=a2.time||1000,time=bo?Math.max(time,500)/repeat:time,frames=a2.frames||(time/25),calb=$.func(a2.callback),arg=a2.arg||[],tt=this.array(),ttl=tt.length,xx=0;if(seq){var last=calb,acss=seq==3||seq==4||seq.toString().search('all')!=-1?$.rcss($.str(a1)):$.str(a1),acss=acss.replace(/\;\s*$/gi,'').split(/\s*[\:\;]\s*/gi),rev=seq==2||seq==4||seq.toString().search('reverse')!=-1;if(!rev)var acss=acss.reverse();a2.sequence=0;for(var x=0;x<acss.length;x+=2){a2c={};for(var q in a2)a2c[q]=a2[q];a2c.callback=last;var last=Function("this.anim('"+acss[x+(rev?0:1)]+":"+acss[x+(rev?1:0)]+";',$.t["+($.t.push(a2c)-1)+"])");}last.call(this);return this;};if(css)for(var y=0;y<ttl;y++)for(var x in css)if(x=='opacity'||tt[y].style[x.camelCase()]!=undefined){tt[y].stop(x);var mp=Math.PI/2,fr=1/frames,slower="Math.abs(Math.sin("+(mp*fr)+"*a6))",faster="Math.abs(1-Math.sin("+mp+"*(kt+kto-("+fr+"*a6))))",ile=speed==0||speed=='slower'?slower:speed==1||speed=='faster'?faster:speed==3||speed=='alter'?"["+slower+","+faster+"][kto]":fr+"*(a6%"+(frames)+")||1",fun=Function("a1","a2","a3","a4","a5","a6",(bo?"var a6=(a6%"+(frames*repeat)+")||a6,kt=Math.ceil("+fr+"*a6),kto=kt%2?0:1,il="+ile+",to=$.avg(a2,'"+css[x]+"',(kt>1?"+(1-bo)+":0)+(kt>1?"+bo+":1)*"+(grav?"(":"Math.sin("+mp+"*")+"(il-(il-1)*(a6/"+(frames*repeat)+"))));":"var kt=Math.ceil("+fr+"*a6),kto=kt%2?0:1,il="+ile+",to=$.avg(a2,'"+css[x]+"',il);")+(x=='opacity'?"a1.opacity(to);":"a1.style."+x.camelCase()+"=to;")+(!xx++?"if(a6=="+(frames*repeat)+")$.interval.call(a1,function(a1,a2,a3){a1.apply(a2,a3);},"+wait+",1,'CSS"+($.l++)+"',a3,a4,a5);":""));$.interval.call(tt[y],fun,time/frames,inf?0:(frames*repeat).round(),x,tt[y],$.cur(tt[y],x).color(),calb,this,arg);}else $.interval.call(tt[0],function(a1,a2,a3){a1.apply(a2,a3);},time*repeat+wait,1,'NOCSS',calb,this,arg);return this;},
  51. stop:function(a11,a111){var ttt=this.array(),a11=$.rcss(a11||''),a12=a11.split(/\s*[\,\;]\s*/gi);for(var z=0;z<a12.length;z++){for(var y=0;y<ttt.length;y++){if(ttt[y].now){for(var x in ttt[y].now){if(a111?(a12[z]!=x):(!a11||a12[z]==x)){clearInterval(ttt[y].now[x]);delete ttt[y].now[x];}}}}};if(!a11)clearInterval(ttt[0].now['anim']);return this;},
  52. array:function(){return this.constructor==Array?this:[this];},
  53. remove:function(){var tt=this.array();for(var y=0;y<tt.length;y++){if(tt[y].parentNode)tt[y].parentNode.removeChild(tt[y]);};return this;},
  54. parent:function(a1){if(this.length)for(var y=0;y<this.length;y++){this[y]=$(this[y].parentNode);}else return $(this.parentNode);return a1?this.one():this;},
  55. empty:function(){var tt=this.array();for(var y=0;y<tt.length;y++){tt[y].innerHTML='';};return this;},
  56. outer:function(){var ns=document.createElement('div');ns.appendChild(this);return ns.innerHTML;},
  57. clone:function(){var tt=this.array(),tt2=[];for(var y=0;y<tt.length;y++){var evtc={};for(var ei in tt[y].evt)evtc[ei]=tt[y].evt[ei];var tt3=$(tt[y].cloneNode(1)).no().event(evtc);tt[y].evt=evtc;tt3.tno=tt[y].tno;var tt3c=tt3.getElementsByTagName('*');var ttc=tt[y].getElementsByTagName('*');for(var z=0;z<ttc.length;z++){var evtc={};for(var ei in ttc[z].evt)evtc[ei]=ttc[z].evt[ei];$(tt3c[z]).no().event(evtc);ttc[z].evt=evtc;tt3c[z].tno=ttc[z].tno;};tt2.push(tt3);};return $(tt2);},
  58. create:function(a1,a2,a3){var tt=this.array(),ttn=$.create(a1,a2).array(),tt2=[];for(var y=0;y<tt.length;y++)for(var x=(a3?y:0);x<(a3?y+1:ttn.length);x++)tt2.push(tt[y].appendChild(ttn[x].clone()));return $(tt2);},
  59. one:function(){var tt=this.array(),tt2=[];Y:for(var y=0;y<tt.length;y++){for(var x=0;x<tt2.length;x++)if(tt[y]==tt2[x])continue Y;tt2.push(tt[y]);};return $(tt2);},
  60. to:function(a1,a2){return $(a1).create(this,0,$(a1).length?a2:1);},
  61. append:function(a1,a2){return this.create($(a1),0,this.length?a2:1);},
  62. index:function(a1){var tt=this.array();for(var y=0;y<tt.length;y++)if(tt[y]==a1)return y+1;},
  63. add:function(a1){return $($.merge(this,$(a1)));},
  64. sort:function(a1){return $.sort(this.array(),a1);},
  65. slice:function(){var ret=[];for(var x=0;x<arguments.length;x+=2)ret=$.merge(ret,$(Array.prototype.slice.call(this.array(),arguments[x]||0,arguments[x+1]||this.array().length)));return $(ret);},
  66. sel:function(a1){var nm=a1.toString().split(','),th=this.array(),ret=[];for(var x=0;x<nm.length;x++){var nma=nm[x].match(/(\-?\d+)\-(\-?\d+)/);var nma=nma?nma:[0,nm[x],nm[x]];var xx1=nma[1]<0?th.length+nma[1].num()+1:nma[1].num();var xx2=nma[2]<0?th.length+nma[2].num()+1:nma[2].num();var xx3=Math.min(xx1,xx2);var xx4=Math.max(xx1,xx2)+1;for(var xx=xx3;xx<xx4;xx++)if(th[xx-1])ret.push(th[xx-1]);};return $(ret)},
  67. save:function(a1,a2){$.o[a1||0]=a2?this.clone():this;return this;},
  68. load:function(a1,a2){return a2?this.replace($.o[a1||0]):$.o[a1||0];},
  69. move:function(a1,a2){var tt=this.array().sort();if(a1>-1)var tt=tt.reverse(),dd=a1<0?-a1:a1+1;for(var y=0;y<tt.length;y++){var elm=a2?(a2.constructor==Array?a2:[a2])[y]:tt[y];var elm2=elm;for(var x=0;x<dd;x++){var elm=$(elm)[a1<0?'prev':'next'](1);if(!elm)break;};elm2.parentNode.insertBefore(tt[y],elm||null);};return this;},
  70. hover:function(a1,a2,a3){return this.on('mouseover',a1,a3).on('mouseout',a2,a3);},
  71. replace:function(a1){var tt=this.array();var ret=[];for(var y=0;y<tt.length;y++){var th=a1.constructor==Array?a1[y]:a1;tt[y].parentNode.replaceChild(th.clone(),tt[y]);ret.push($(th));};return $(ret);},
  72. opacity:function(a1){var tt=this.array();for(var y=0;y<tt.length;y++){tt[y].style.opacity=a1;tt[y].style.filter='alpha(opacity='+(a1*100)+')';tt[y].Opacity=a1;};return this;},
  73. sCSS:function(a1){var tt=this.array();for(var y=0;y<tt.length;y++){var old=tt[y].css('display');if(old!='none'){var di=old;}else{tt[y].style.display='';var di=tt[y].css('display');};if(tt[y].css('display')=='none'){tt[y].style.display=$.display(tt[y].tagName);var di=tt[y].css('display');};tt[y].cCSS=tt[y].cCSS||{};tt[y].cCSS[a1]={};tt[y].Ss=old=='none'?1:0;tt[y].Sf=old=='none'?0:1;for(var q in tt[y].style)tt[y].cCSS[a1][q]=$.cur(tt[y],q.replace(/([A-Z])/g,'-$1'));tt[y].cCSS[a1].opacity=$.cur(tt[y],'opacity');tt[y].cCSS[a1].display=di;tt[y].style.display=old;};return this;},
  74. lCSS:function(a1,a2){var tt=this.array(),ret=[];for(var y=0;y<tt.length;y++)ret.push(tt[y].cCSS&&tt[y].cCSS[a1]?tt[y].cCSS[a1][a2]:$.cur(tt[y],a2));return ret.length==1?ret[0]:ret;},
  75. select:function(a1,a2,a3){var a1=$(a1),tt=this.array().dif(a1).array(),rr=this.array().sub(a1).array(),a2=$.func(a2),a3=$.func(a3);for(var y=0;y<tt.length;y++)a2.call(tt[y],y,tt);for(var y=0;y<rr.length;y++)a3.call(rr[y],y,rr);return this;},
  76. slides:function(a1,a2,a3){var tt=this.array(),ir=0,a2=a2||{},a1=(a1||'hov').replace(/w/gi,'v'),att=[],at={'h':['height','margin-top','margin-bottom','padding-top','padding-bottom'],'v':['width','margin-left','margin-right','padding-left','padding-right'],'o':['opacity']};for(var x in at)if(a1.search(RegExp(x,'gi'))!=-1)var att=$.merge(att,at[x]);for(var y=0;y<tt.length;y++){if((tt[y].Ss||a3==1)&&a3!=2){tt[y].Ss=0;for(var x=0;x<att.length;x++){var atc=att[x].camelCase();tt[y].style.display=tt[y].cCSS['slide_CSS']['display'];if(!tt[y].Sf++)tt[y].css(att.join(':0;')+':0;');tt[y].anim(att[x]+':'+tt[y].cCSS['slide_CSS'][atc]+';',a2);}}else{tt[y].Ss=1;a2.callback=a1.search(/n/gi)==-1?Function("this.style.display='none';$.t["+($.t.push($.func(a2.callback))-1)+"].apply(this,arguments);"):a2.callback;tt[y].Sf=1;tt[y].anim(att.join(':0;')+':0;',a2);}};return this;},
  77. slide:function(){return this.sCSS('slide_CSS');},
  78. len:function(){return this.array().length;},
  79. each:function(a1,a2){return $.each(this,a1,a2);}
  80. };
  81.  
  82. $.each(['css','att'],function(a1){$.e[this]=Function("a1","a2","var tt=this.array();if(arguments.length>1){for(var y=0;y<tt.length;y++)for(var x=0;x<arguments.length;x+=2){var ar=arguments[x+1],cz=arguments[x+2],cz=cz===1||cz===true,ar=ar.constructor==Array?ar[cz?y%ar.length:y]||'':ar;"+["if(arguments[x]=='opacity'){tt[y].opacity(typeof ar=='function'?ar.call(tt[y],y+1):ar);}else{tt[y].style[arguments[x].camelCase()]=typeof ar=='function'?ar.call(tt[y],y+1):ar;}","tt[y].setAttribute(arguments[x].camelCase(),typeof ar=='function'?ar.call(tt[y],y+1):ar)"][a1]+";if(cz)x++;};return this;}else if(typeof a1=='string'&&a1.search(/\:/gi)==-1){var tt2=[];for(var y=0;y<tt.length;y++)"+["tt2.push($.cur(tt[y],a1))","tt2.push(tt[y].getAttribute(a1))"][a1]+";return tt2;};var a1=$.obj(a1);for(var y=0;y<tt.length;y++){for(var x in a1){"+["if(x=='opacity')tt[y].opacity(a1[x]);else tt[y].style[x.camelCase()]=a1[x]","tt[y].setAttribute(x.camelCase(),a1[x])"][a1]+";}};return this;");});
  83. $.each(['html','tekst','val'],function(a1){$.e[this]=Function("a1","a2","if(a1||a1===''){var tt=this.array();for(var y=0;y<tt.length;y++){var a11=a1.constructor==Array?a1[a2?y%a1.length:y]||tt[y]."+["innerHTML","innerHTML","value"][a1]+":a1;var a12=typeof a11=='function'?a11.call(tt[y],y,tt):a11.toString().replace(/^\\.\\.|\\.\\.$/gi,tt[y]."+["innerHTML","innerHTML","value"][a1]+").replace(/\\.(-?\\d+)\./gi,function(a1,a2){return y+a2.num();});tt[y]."+["innerHTML=a12","appendChild(document.createTextNode(a12))","value=a12"][a1]+";};return this;};var a12=a12;return $(this.each('return this."+["innerHTML","innerHTML.replace(/\\<.+?\\>/gi,\\'\\')","value"][a1]+"',1));");});
  84. $.each(['next','prev'],function(a1){var tb=['next','previous'][a1];$.e[this]=Function("a1","var tt=this.array();Y:for(var y=0;y<tt.length;y++){var tns=$(tt[y]."+tb+"Sibling);while(tns){if(tns.tagName){tt[y]=tns;continue Y;}else{tns=tns."+tb+"Sibling;}};if(a1)tt.splice(y,1);};return $(tt);")});
  85. $.each(['child','sibling'],function(a1){$.e[this]=Function("a1","var tt=this.array(),tt2=[];for(var y=0;y<tt.length;y++)var tt2=$.merge(tt2,$(a1||'*',tt[y],'"+["","+"][a1]+"'));return $(tt2);");});
  86. $.each(['show','hide','toggle'],function(a1){$.e[this]=Function("a1","a2","if(a1){this.slides(a1,a2,"+[1,2,0][a1]+");return this;};var tt=this.array();for(var y=0;y<tt.length;y++){var dp=tt[y].style.display="+["tt[y].cCSS?tt[y].cCSS['display']:'';if(tt[y].css('display')=='none')tt[y].style.display='';if(tt[y].css('display')=='none')tt[y].css('display')=$.display(tt[y].tagName)","'none'","tt[y].css('display')=='none'?$.display(tt[y].tagName):'none'"][a1]+";tt[y].Ss="+["0","1;tt[y].Sf=0;","dp=='none'?1:0"][a1]+";}return this;");});
  87. $.each(['sub','dif'],function(a1){$.e[this]=Function("a1","var a1=$(a1).array(),tt=this.array(),tt2=[];Y:for(var y=0;y<tt.length;y++){for(var x=0;x<a1.length;x++){if(tt[y]==a1[x]){"+["continue Y;","tt2.push(tt[y]);"][a1]+"}};"+["tt2.push(tt[y]);",""][a1]+"};return $(tt2);");});
  88. $.each(['aClass','rClass','tClass'],function(a1){$.e[this]=Function("a1","a2","var tt=this.array();for(var y=0;y<tt.length;y++)"+["tt[y].className+=typeof a1==Array?' '+a1[a2?y%a1.length:y]||'':' '+a1","tt[y].className=tt[y].className.replace(RegExp(a1,'gi'),'')","if(tt[y].className.search(RegExp('(^|\\\\W)'+a1+'(\\\\W|$)','gi'))==-1)tt[y].aClass(a1);else tt[y].rClass(a1)"][a1]+";return this;");});
  89. $.each(['Text','Order','Child'],function(a1){$.e['sortBy'+this]=Function("return this.sort(function(a1,a2){return "+["a1.html()<a2.html()","this.index(a1)<this.index(a2)","a1.child('*').len()<a2.child('*').len()"][a1]+";});");});

Report this snippet  

You need to login to post a comment.