Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,349
    Thanks
    11
    Thanked 589 Times in 570 Posts

    Javascript Compression

    Last spring i wrote a brand new code compressor for javascript. It take's a different approach than other compressors like packer, and yui. It finds characters that are valid in js, but not used in your code. It then uses those unused characters as replacement key slotholders.


    It works best for medium-sized chunks of code.
    1kb to 10kb is a guideline sweetspot, but it really depends on what your're compressing.

    I usually get the best compression by first using packer on my code, with "private vars" but without "base62", and then using Slim on the result.





    Usage

    Slim(code, options)

    Options are passed as an object of the default you want to over-ride:

    Code:
    	{
     		stringMode:	false, 
    		depth:		3,
    		test:			false
    		}

    StringMode should be used for compressing text, HTML, css, and other non-javascript code. Text mode is not as efficient as code mode, so don't use it on javascript code or json. On the other hand, Slim is one of the only JavaScript-based compressors that can even handle plain text.


    Depth can be a number from 1-15. Higher numbers take longer to compress. Sometimes much longer. A level of 5 will usually provide most of the benefit of higher numbers. There is a diminishing return, but for highly repetitive text like xml, it can be worth waiting for higher depths.


    Feel free to paste the code in your own projects.

    Code:
    <script >
    
    
    function Slim(strCode, objOptions){var dandavis='\
     A js compressor by "dandavis";   \
      Creative Commons Attribution License applies to this function.   \
      Leave code intact for easy compliance. ';
    var t=objOptions, z=strCode;if(!t){t={stringMode:false,depth:3,test:false}}var l={};l.matchRules=[{b:"",a:""},{b:".",a:""},{b:"",a:"."},{b:".",a:"."},{b:"..",a:"."},{b:".",a:".."},{b:"..",a:".."},{b:"...",a:".."},{b:"..",a:"..."},{b:"...",a:"..."},{b:"....",a:"..."},{b:"...",a:"...."},{b:"....",a:"...."},{b:".....",a:"...."},{b:"....",a:"....."},{b:".....",a:"....."}];l.fuzzyDepth=t.depth||3;l.debug=false;l.autoEval=t.test!=null?!!t.test:false;l.lastBase="";t.string=!!t.stringMode;z=z+"";l.fnSource=function Z(a){if(typeof a==="function"){return a[window.FF?"toSource":"toString"]()}return"'"+J(a)+"'"};function J(a){return String(a).replace(/\r/g,"").replace(/(['\f\n\\])/g,"\\$1")}function A(a){return a.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")}function L(a){var b=Function(a).toSource();return b.slice(b.indexOf("{")+1,b.lastIndexOf("}"))}function M(e){var d=[9];var f=K.A(128,1).map(K.F("b")).slice(32).concat(d).clean(K.run,String.fromCharCode);var c=f.indexOf("\\");if(c>0){f.splice(c,1)}return f.filter(function(a,b){if(e.indexOf(a)==-1){return 1}}).filter(function(a){return a&&!{'\'':1}[a]}).sort();var h=f.concat().sort().reverse();return h.slice(0,h.indexOf("~"))}function ba(a){var b="ABCDEFGHIJKLMNOPQRSTUVQXYZ";var e="abcdefghijklmnopqrstuvqxyz";var d=a%26,f=parseInt(a/26);return b[f]+e[d]}function N(e,d){var f=" ",c=e,h=c,m=new Date;var r=!c.match(/^\s*</);if(r){try{var s=Function(c)}catch(y){r=false}}if(d.string){r=false}var o=d.string?JSON.stringify:d.fnSource;if(!r){c=o(c).replace(/\\u000([a-f0-9])/gi,function(a,b){return{9:"\\t",a:"\\n"}[b]||""})+";"}l.isOK=!!r;l.oTitle=document.title;l.orig=c;var k=O(c).replace(/\\{2}t/g,"\t");return k}function P(Q){var w=Q;var R=w.length;var E=[],F={};var S=[/\w+/m,/\{[^\}]+\}/g,/\([^\)]+\)/g,/[^\w\.]+/,/\.\w+/g,/\b/g,/\,/,/;/];function T(a,b){return("0000000"+a).slice(-b)}function U(a){if(a.per>(F[a.id]||0)){F[a.id]=a.per;E[a.id]=a}}function V(a,b,e){var d={name:a,n:b,sz:b*(a.length-1)};d.per=d.sz/e;d.toString=function(){return T(d.sz,4)+(" : \""+a+"\"- "+d.id)};return d}function bb(a,b,e){e=e||"";b=b||"";return w.match(RegExp(b+A(a)+e,"g"))||[]}var B={},G={};function W(a,b,e){e=e||"";b=b||"";var d=b+a+e;if(B[d]){return B[d]}var f=G[a]||(G[a]=A(a));return B[d]=w.match(RegExp(b+f+e,"g"))||[]}function X(q,C){var H=q.global;var x=q.multiline?w.match(q)||[]:w.split(q);x=x.concat("return ,function,.length,ndexOf(,switch(,case,undefined,.replace(,.substr(,.slice(,false,true,Number,String,window.,ocument".split(","));x.filter(function(a){return a.length>1}).unique().map(function I(a,b){var e=l.matchRules.slice(0,H?1:l.fuzzyDepth);var d="ABCDEFGHIJKLMNOP".split("");var f={n:0,s:"",w:0},c="",h=0;for(var m=0,r=e.length;m<r;m++){var s=e[m];var o=W(a,s.b,s.a)||[];if(!o.sort||o.length<2){continue}o.sort();for(var k=0,p=o.length,g;k<p;k++){g=o[k];var n=Math.max(o.lastIndexOf(g)-k,0);var u=n*g.length;if(u>f.w){h++;f.w=u;f.n=n;f.s=g}k=k+Math.max(n-1,0)}var j=f.n;if(j<2){return}var v=V(f.s,j,R);if(v.per<0.00005){return}v.id=d[C]+b;U(v)}})}S.map(X);return Y(E).sort()}function O(h){if(window.FF&&l.isOK){h=L(h)}var m=D(h);var r="\"";var s=[],o={};var k="\n`";var p=m,g;var n=M(p+k);for(var u=0;u<n.length-1;u++){var j=p;var v=n.length;var q=n.length-1;if(q<0){break}var C=P(j).reverse();C.map(K.extract,"name").some(function H(a,b,e){if(q<0){return}if(o[a]){return}else{o[a]=1}var d=A(a);var f=p.length;var c=String(p).replace(RegExp(d,"g"),n[q]||"SLIM_ERROR:"+d);if(c.length<=f){p=c;k+=n[q];s[s.length]=n[q]+a;q=-1;n.pop();return 1}return},1)}var x="eval";var I=x+("(function(s,r){for(var i=0,h,b,m=r.length;i<m;i++){b=r[i],c=b[0],t=b.substr(1),x=RegExp(c.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\"),\"g\");s=s.replace(x,t);for(h=i+1;h<m;h++){r[h]=r[h][0]+r[h].substr(1).replace(x,t)}}return s}("+l.fnSource(p+"")+",\n"+l.fnSource(s.join("`"))+".split(\"`\")));");return I}(function bc(e){var d=Math;window.K={min:d.min,max:d.max};var f;if(e.pre){e.pre(K);delete e.pre}for(i in e){f=e[i];f=f.join?f:[0,f];K[i]=Function(f[0]||"a",f[1].replace(/`([0-7])/g,function(a,b){return[":function(a,b){var t=this.concat(),m=t.length,i=","function","length","return ","this","concat","var ","a.call("][b]||b}))}if(K.init){K.init(K);delete K.init}}({A:["o,l","if(o.charAt){o=o.split(o.match(/\\,/)?\",\":\"\");}\nif(o*0.1){`3K.S(Array(o)).split(\"\").map(K.fill,l!=null?l:\"\");}\n`6r=[],z;for(z in o){if(o.hasOwnProperty(z)){r.push(l?l(o[z]):o[z]);}}\n`3r"],F:["a,c","`6s=c||a;`3a.call?a:Function(c?a:\"a,b,c\",s.indexOf(\"`3\")!==-1?s:\"`3\"+s)"],IF:"`3Function(\"a,b\",\"`3\"+a+\"?a:undefined\")",avg:["a,b,c","`4[0]+=a/c.`2;`6t=\"R\""],count:"`3`4[a]=`4[a]?`4[a]+1:1",as:["fn","`3`1(a,b,c){`3fn.call(`4.call?`4.call(c,a):`4,a,b,c);}"],bytypes:"`3typeof a==`4?1:0",equal:"`3a===`4",even:"`3a%2==0",extract:"`3a[`4]",fill:["a,b,c","`3`4.call?`4.apply(c,K.A(arguments)):`4"],gt:"`3a>`4",init:"`6o=Array.prototype,it,i,e={map`00,r=[];for(;i<m;i++){if(i in t){r[i]=`7b,t[i],i,t);}}`3r;},filter`00,r=[],g=0;for(;i<m;i++){if(i in t&&`7b,t[i],i,t)){r[g++]=t[i];}}`3r;},every`00;`3m&&t.filter(a,b).`2==m;},some`01;for(;m--;){if(m in t&&`7t,t[m],m,t)&&!--i){`3true;}}`3false;},lastIndexOf`0b||-1;for(;m>i;m--){if(m in t&&t[m]===a){`3l;}}`3-1;},indexOf`0b||0;for(;i<m;i++){if(i in t&&t[i]===a){`3i;}}`3-1;},reduce`00,r=b||t[i++];for(;i<m;i++){r=`7null,r,t[i],i,t);}`3r;},reduceRight`0m-1,r=b||t[i--];for(;i>-1;i--){r=`7null,r,t[i],i,t);}`3r;},forEach:`1(a,b){`4.`5().map(a,b);},clean`00,r=[],g=0,x,O;a=K.F(a||K.S);for(;i<m;i++){if(i in t&&(x=`7b,t[i],i,t))){r[g++]=x;}}`3arguments[2]?b:r;}};for(it in e){i=o[it];o[it]=i||e[it];}\"String,Number,RegExp,Boolean,Document\".split(\",\").map(K.F(\"K[a.slice(0,1)]=window[a]\"));K.I=`1(a){`3parseInt(a,10);}",invoke:"`3a[`4]()",isInt:"`3parseInt(a,10)===a",k:"`3a",keys:["o","`6r=[];o=o||K;for(z in o){if(o.hasOwnProperty(z)){r[r.`2]=z;}}\n`3r"],lt:"`3a<`4",match:"`3K.S(a).indexOf(`4)!==-1",not:"`3a!=`4",odd:"`3a%2!==0",ok:"`3a!=null",pre:"",run:"`3`4(a)",same:"`3a==`4",sum:["a,b","`3a+b"],tag:"`3\"<\"+`4+\">\"+a+\"</\"+`4+\">\"",times:"`3a*`4",unique:["a,b,c","`3c.lastIndexOf(a)==b?a:undefined"],zip:["a,b","`6it=[a];if(b in `4){it=it.`5(`4[b]);}\n`3it"]}));String.prototype.after=function(a){var b=this,e=b.indexOf(a)+a.length;return b.substr(e)};String.prototype.has=function(a){return this.indexOf(a)>-1};function D(e,d,f){if(d===undefined){d=e;e="";f=2}else if(f===undefined||f<1||f>3){f=2}if(e.length>0){e+="\n"}var c="",h="",m=-1,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",s="0123456789",o=r+s+("_$\\"),k=m;function p(a){return a!=m&&(o.has(a)||a.charCodeAt(0)>126)}function g(){var a=k;if(g.i==g.l){return m}k=m;if(a==m){a=d.charAt(g.i);++g.i}if(a>=" "||a=="\n"){return a}if(a=="\r"){return"\n"}return" "}g.i=0;g.l=d.length;function n(){k=g();return k}function u(){var a=g();if(a=="/"){switch(n()){case"/":for(;;){a=g();if(a<="\n"){return a}}break;case"*":g();for(;;){switch(g()){case"*":if(n()=="/"){g();return" "}break;case m:throw"Error";default:}}break;default:return a}}return a}function j(a){var b=[];if(a==1){b.push(c)}if(a<3){c=h;if(c=="'"||c=="\""){for(;;){b.push(c);c=g();if(c==h){break}if(c<="\n"){throw"Error"+c;}if(c=="\\"){b.push(c);c=g()}}}}h=u();if(h=="/"&&"(,=:[!&|".has(c)){b.push(c);b.push(h);for(;;){c=g();if(c=="/"){break}else if(c=="\\"){b.push(c);c=g()}else if(c<="\n"){throw"Error:";}b.push(c)}h=u()}return b.join("")}function v(){var a=[];c="\n";a.push(j(3));while(c!=m){switch(c){case" ":if(p(h)){a.push(j(1))}else{a.push(j(2))}break;case"\n":switch(h){case"{":case"[":case"(":case"+":case"-":a.push(j(1));break;case" ":a.push(j(3));break;default:if(p(h)){a.push(j(1))}else{if(f==1&&h!="\n"){a.push(j(1))}else{a.push(j(2))}}}break;default:switch(h){case" ":if(p(c)){a.push(j(1));break}a.push(j(3));break;case"\n":if(f==1&&c!="\n"){a.push(j(1))}else{switch(c){case"}":case"]":case")":case"+":case"-":case"\"":case"'":if(f==3){a.push(j(3))}else{a.push(j(1))}break;default:if(p(c)){a.push(j(1))}else{a.push(j(3))}}}break;default:a.push(j(1));break}}}return a.join("")}D.oldSize=d.length;ret=v(d);D.newSize=ret.length;return e+ret}Array.prototype.unique=function bd(){var a=this;var b=[];var e=a.length;for(var d=0;d<e;d++){if(b.indexOf(a[d])==-1){b[b.length]=a[d]}}return b};function Y(a){var b=[];var e=0;for(var d in a){if(a&&a.hasOwnProperty&&a.hasOwnProperty(d)){b[e++]=a[d]}}return b}return N(z,t);
    }
    
    
    
    
    //to show usage, not required to impliment
    (function demo(){
      var 	inp=prompt("Paste your code below", Slim ),
    	out=inp ? Slim(inp) : "" ;
    	if(out){prompt(	"Compressed "+(inp.length / out.length).toFixed(3)+" times\n\n"+
    			"Copy your compressed code below", out
    		);
    	}
    }());
    
    
    </script>
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,349
    Thanks
    11
    Thanked 589 Times in 570 Posts

    Call for Help

    Forgot to mention that there is a slightly enhanced (but copyrighted) version online, along with some demos.


    I would like to open this up to the community. I think there are some great minds on here, and i am hoping someone notices a way to improve the function.


    I cleaned up the online version's code, and am posting the original source below in the hope that everyone picks it apart and shares their improvements in a reply.

    Code:
    function Slim( strCode, ops ){ 	
    
    
    	if(!ops){	// defaults:
    
    	ops={ 	stringMode:	false, 
    		depth:		3,
    		test:		false
    	  };
    	}//end if no config
    
    
    	//program variables:
    	var App={};
    	App.matchRules= [{b: "", a: ""}, {b: ".", a: ""}, {b: "", a: "."}, {b: ".", a: "."}, 
    	{b: "..", a: "."},{b: ".", a: ".."},{b: "..", a: ".."}, 
    	{b: "...", a: ".."},{b: "..", a: "..."},{b: "...", a: "..."},
    	{b: "....", a: "..."},{b: "...", a: "...."},{b: "....", a: "...."},
    	{b: ".....", a: "...."},{b: "....", a: "....."},{b: ".....", a: "....."}	];
    	App.fuzzyDepth=ops.depth||3;
    	App.debug=false;
    	App.autoEval= ops.test!=null?(!!ops.test):false;
    	App.lastBase="";
    	ops.string=!!ops.stringMode;
    	strCode=strCode+"";
    
    
    App.fnSource=function source(v){
     if(typeof v==="function"){return v[ window.FF?"toSource":"toString"](); }
     return "'"+escJS(v)+"'";
    };
    
    
    
    function escJS(tes) {
      return  String(tes).replace(/\r/g,"").replace(/(['\f\n\\])/g, "\\$1");
    }
    
    
    function escRx(s) {
        return s.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1");
    }//end escRx
    
    function foxy(s){
     var t=Function(s).toSource();
     return t.slice(t.indexOf("{")+1, t.lastIndexOf("}") );
    }
    
    
    
    
    function getUnUsedChars(s){
    	var bRay=[9]; 
    	var r=K.A(128,1).map(K.F("b")).slice(32).concat(bRay).clean(K.run, String.fromCharCode);
    	var badPos=r.indexOf("\\");
    	 if(badPos>0){ r.splice(badPos,1);}
    	return r.filter(function(a,nn){
    	     if(s.indexOf(a)==-1){return 1;}
        }).filter(function(a){return a && !{"\'":1}[a]}).sort();
    
    	
    	var r2=r.concat().sort().reverse();
    	return r2.slice(0, r2.indexOf("~"));
    }//end getUnUsedChars()
    
    
    
    function id(n){//AA-ZZ, 0-2704
     var A="ABCDEFGHIJKLMNOPQRSTUVQXYZ";
     var a="abcdefghijklmnopqrstuvqxyz";
     var a2=n%26, a1=parseInt(n/26);
    return A[a1]+a[a2];
    }
    
    
    function processWrapper(strCode, ops){
    	var b=" ",  x=strCode,ox=x, d1= new Date;
    	var ok=!x.match(/^\s*</);
    	if(ok){ try{var jnk=Function(x); }catch(y){ok=false;}}
    	if(ops.string  ){ok=false;}
    	var packFN=ops.string?JSON.stringify : ops.fnSource;
    	if(!ok){x=packFN(x).replace(/\\u000([a-f0-9])/ig,function(b,a){
    		 return {9:"\\t",a:"\\n"}[a]||"";
    	 })+";"}
    
    	App.isOK=!!ok;
    	App.oTitle=document.title;
    	App.orig=x;
    	var buff=comp2(x).replace(/\\{2}t/g,"\t");
    	
    return buff;
    }//end processWrapper()
    
    
    function squeeze(strCode) {
    	var t = strCode;
    	var mx = t.length;
    	var poss = [], possLut = {};
    
    
         var splits = [
    	/\w+/m,
    	/\{[^\}]+\}/g,
    	/\([^\)]+\)/g,
    	/[^\w\.]+/,
    	/\.\w+/g,
    	/\b/g, 
    	/\,/, 
    	/;/
    
          ];
    
    	function fix(d, amt) {
    	  return ("0000000" + d).slice(- amt);
    	}
    	function addPoss(p) {
    	  if (p.per > (possLut[p.id] || 0)) {
    		possLut[p.id] = p.per;
    		poss[p.id] = p;
    	  }
    	}
    	function Hit(str, n, mx) {
    	  var o = {name: str, n: n, sz: n * (str.length - 1)};
    	  o.per = o.sz / mx;
    	  o.toString = function () {return fix(o.sz, 4) + " : \"" + str + "\"" + "- " + o.id;};
    	  return o;
    	}
    
    
    	function getHits2(s, b, a) {
    	  a = a || ""; b = b || "";
    	  return  t.match(RegExp(b + escRx(s) + a, "g")) || [];
    	}
    
    	var sba={}, srx={};//backup s in a LUT to prevent redundant expensive operations
    
    	function getHits(s, b, a) {
    	  a = a || ""; b = b || ""; var key=b+s+a;
    	if(sba[key]){return sba[key];}
    	var rx= srx[s] || (srx[s]=escRx(s));
    	  return  sba[key]=(t.match(RegExp(b + rx + a, "g")) || []);
    	}
    
    
    
    	function runPattern(pattern, setNum) {//8937 runs@0.35,s
    		var isGlobal=pattern.global;
    	//m should match, otherwise split...
    
    	var workload= pattern.multiline ? (t.match(pattern)||[]) : t.split(pattern);
    
    	workload=workload.concat("return ,function,.length,ndexOf(,switch(,case,undefined,.replace(,.substr(,.slice(,false,true,Number,String,window.,ocument".split(","));
    
    	 workload.filter(function(pa){return pa.length>1}).unique().map(function _runPAt(a, n) {
    			var rules =App.matchRules.slice(0, isGlobal ? 1 : App.fuzzyDepth);
    			var  IDs = "ABCDEFGHIJKLMNOP".split("");
    			var best = {n: 0, s: "",w:0}, lstPat = "", lstn = 0;
    			for (var ii = 0, mxx = rules.length; ii < mxx; ii++) {
    			  var rule = rules[ii];
    			  var hitBod = getHits(a, rule.b, rule.a)||[];
    			  if (!hitBod.sort || hitBod.length < 2) {
    				continue;
    			  }
    
    
    
    			hitBod.sort();
    			for(var hitNo=0, mx1=hitBod.length,thit; hitNo<mx1;hitNo++){	
    
    				thit=hitBod[hitNo];
    				var hitCount=Math.max(hitBod.lastIndexOf(thit) - hitNo , 0);
    				var wgt=hitCount * thit.length;
    
    				if (wgt>best.w) {
    				  lstn++;
    				  best.w= wgt;
    				  best.n = hitCount;
    				  best.s = thit;
    				}
    				hitNo=hitNo+ Math.max(hitCount-1,0);
    			};//next hitNo  (best finder)
    
    			  var hits = best.n;
    			  if (hits < 2) {
    				return;
    			  }
    			  var hit = Hit(best.s, hits, mx);
    			  if (hit.per < 0.00005) {
    				return;
    			  }
    			  hit.id = IDs[setNum] + n;
    			  addPoss(hit);
    			}
    		});//map()
    	}
    	splits.map(runPattern);
    	return obVals(poss).sort();
    }//end squeeze : suggestion builder
    
    
    //third gen: loops the loop, keeping just the best.
    function comp2(str2) {
    	if(window.FF && App.isOK){str2=foxy(str2);}
    	var str=jsmin(str2)//.slice(23,-3);
    
    	var R='"';
    
    	var reps = [], used = {};
    
    	var reserves="\n`";
    
    	var t = str, y;
    var uu = getUnUsedChars(t+reserves);//.clean(K.F("(a!=='\\n'||a!==R)?a:null"));
    
    
    for(var i=0;i<uu.length-1;i++){
    	var s=t;
    	var mx=uu.length;
    	var len = uu.length - 1;
    	if(len<0){break;}
    
    	//get a list of suggestions from the suggestion builder:
    	var r2=squeeze(s).reverse();
    
    	r2.map(K.extract, "name").some(function _runReps(a, b, c) {
    			if (len < 0) {
    			  return;
    			}
    
    			if (used[a]) {
    			  return;
    			} else {
    			  used[a] = 1;
    			}
    			var y = escRx(a);
    			var oldLen = t.length;
    			var nt=String(t).replace(RegExp(y, "g"), uu[len]||"SLIM_ERROR:"+y);
    			if (nt.length <= oldLen) {
    				t=nt;
    				reserves+=uu[len];
    			 	reps[reps.length]= uu[len] + a;
    			  	len=-1;
    				uu.pop();
    				return 1;
    			}
    			return;
    		}, 1);//end map runReps
    
    
    }//next i
    
    var verb ="eval" //App.string? "eval":"String";
    var buff=verb+'(function(s,r){for(var i=0,h,b,m=r.length;i<m;i++){b=r[i],c=b[0],t=b.substr(1),x=RegExp(c.replace(/([.*+?^${}()|[\\]\\\/\\\\])/g,"\\\\$1"),"g");s=s.replace(x,t);for(h=i+1;h<m;h++){r[h]=r[h][0]+r[h].substr(1).replace(x,t)}}return s}('+
    	App.fnSource(t+"")+',\n'+ 
    	App.fnSource(reps.join("`")) +'.split("`")));';
    
    
    
    return buff;
    }//comp2
    
    
    //array protos:
    ;(function build(o){var M=Math;window.K={min:M.min,max:M.max};var it;if(o.pre){o.pre(K);delete o.pre;}for(i in o){it=o[i];it=it.join?it:[0,it];K[i]=Function(it[0]||"a",it[1].replace(/`([0-7])/g,function(b,a){return[":function(a,b){var t=this.concat(),m=t.length,i=","function","length","return ","this","concat","var ","a.call("][a]||a;}));}if(K.init){K.init(K);delete K.init;}}(({A:["o,l","if(o.charAt){o=o.split(o.match(/\\,/)?\",\":\"\");}\nif(o*0.1){`3K.S(Array(o)).split(\"\").map(K.fill,l!=null?l:\"\");}\n`6r=[],z;for(z in o){if(o.hasOwnProperty(z)){r.push(l?l(o[z]):o[z]);}}\n`3r"],F:["a,c","`6s=c||a;`3a.call?a:Function(c?a:\"a,b,c\",s.indexOf(\"`3\")!==-1?s:\"`3\"+s)"],IF:"`3Function(\"a,b\",\"`3\"+a+\"?a:undefined\")",avg:["a,b,c","`4[0]+=a/c.`2;`6t=\"R\""],count:"`3`4[a]=`4[a]?`4[a]+1:1",as:["fn","`3`1(a,b,c){`3fn.call(`4.call?`4.call(c,a):`4,a,b,c);}"],bytypes:"`3typeof a==`4?1:0",equal:"`3a===`4",even:"`3a%2==0",extract:"`3a[`4]",fill:["a,b,c","`3`4.call?`4.apply(c,K.A(arguments)):`4"],gt:"`3a>`4",init:"`6o=Array.prototype,it,i,e={map`00,r=[];for(;i<m;i++){if(i in t){r[i]=`7b,t[i],i,t);}}`3r;},filter`00,r=[],g=0;for(;i<m;i++){if(i in t&&`7b,t[i],i,t)){r[g++]=t[i];}}`3r;},every`00;`3m&&t.filter(a,b).`2==m;},some`01;for(;m--;){if(m in t&&`7t,t[m],m,t)&&!--i){`3true;}}`3false;},lastIndexOf`0b||-1;for(;m>i;m--){if(m in t&&t[m]===a){`3l;}}`3-1;},indexOf`0b||0;for(;i<m;i++){if(i in t&&t[i]===a){`3i;}}`3-1;},reduce`00,r=b||t[i++];for(;i<m;i++){r=`7null,r,t[i],i,t);}`3r;},reduceRight`0m-1,r=b||t[i--];for(;i>-1;i--){r=`7null,r,t[i],i,t);}`3r;},forEach:`1(a,b){`4.`5().map(a,b);},clean`00,r=[],g=0,x,O;a=K.F(a||K.S);for(;i<m;i++){if(i in t&&(x=`7b,t[i],i,t))){r[g++]=x;}}`3arguments[2]?b:r;}};for(it in e){i=o[it];o[it]=i||e[it];}\"String,Number,RegExp,Boolean,Document\".split(\",\").map(K.F(\"K[a.slice(0,1)]=window[a]\"));K.I=`1(a){`3parseInt(a,10);}",invoke:"`3a[`4]()",isInt:"`3parseInt(a,10)===a",k:"`3a",keys:["o","`6r=[];o=o||K;for(z in o){if(o.hasOwnProperty(z)){r[r.`2]=z;}}\n`3r"],lt:"`3a<`4",match:"`3K.S(a).indexOf(`4)!==-1",not:"`3a!=`4",odd:"`3a%2!==0",ok:"`3a!=null",pre:"",run:"`3`4(a)",same:"`3a==`4",sum:["a,b","`3a+b"],tag:"`3\"<\"+`4+\">\"+a+\"</\"+`4+\">\"",times:"`3a*`4",unique:["a,b,c","`3c.lastIndexOf(a)==b?a:undefined"],zip:["a,b","`6it=[a];if(b in `4){it=it.`5(`4[b]);}\n`3it"]})));
    
    
    //jsmin:
    String.prototype.after=function (delm) {  var t = this, s = t.indexOf(delm) + delm.length;  return t.substr(s);}
    String.prototype.has=function(c){return this.indexOf(c)>-1;};
    function jsmin(comment,input,level){if(input===undefined){input=comment;comment='';level=2;}else if(level===undefined||level<1||level>3){level=2;}if(comment.length>0){comment+='\n';}var a='',b='',EOF=-1,LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',DIGITS='0123456789',ALNUM=LETTERS+DIGITS+'_$\\',theLookahead=EOF;function isAlphanum(c){return c!=EOF&&(ALNUM.has(c)||c.charCodeAt(0)>126);}function get(){var c=theLookahead;if(get.i==get.l){return EOF;}theLookahead=EOF;if(c==EOF){c=input.charAt(get.i);++get.i;}if(c>=' '||c=='\n'){return c;}if(c=='\r'){return'\n';}return' ';}get.i=0;get.l=input.length;function peek(){theLookahead=get();return theLookahead;}function next(){var c=get();if(c=='/'){switch(peek()){case'/':for(;;){c=get();if(c<='\n'){return c;}}break;case'*':get();for(;;){switch(get()){case'*':if(peek()=='/'){get();return' ';}break;case EOF:throw'Error: Unterminated comment.';}}break;default:return c;}}return c;}function action(d){var r=[];if(d==1){r.push(a);}if(d<3){a=b;if(a=='\''||a=='"'){for(;;){r.push(a);a=get();if(a==b){break;}if(a<='\n'){throw'Error: unterminated string literal: '+a;}if(a=='\\'){r.push(a);a=get();}}}}b=next();if(b=='/'&&'(,=:[!&|'.has(a)){r.push(a);r.push(b);for(;;){a=get();if(a=='/'){break;}else if(a=='\\'){r.push(a);a=get();}else if(a<='\n'){throw'Error: unterminated Regular Expression literal';}r.push(a);}b=next();}return r.join('');}function m(){var r=[];a='\n';r.push(action(3));while(a!=EOF){switch(a){case' ':if(isAlphanum(b)){r.push(action(1));}else{r.push(action(2));}break;case'\n':switch(b){case'{':case'[':case'(':case'+':case'-':r.push(action(1));break;case' ':r.push(action(3));break;default:if(isAlphanum(b)){r.push(action(1));}else{if(level==1&&b!='\n'){r.push(action(1));}else{r.push(action(2));}}}break;default:switch(b){case' ':if(isAlphanum(a)){r.push(action(1));break;}r.push(action(3));break;case'\n':if(level==1&&a!='\n'){r.push(action(1));}else{switch(a){case'}':case']':case')':case'+':case'-':case'"':case'\'':if(level==3){r.push(action(3));}else{r.push(action(1));}break;default:if(isAlphanum(a)){r.push(action(1));}else{r.push(action(3));}}}break;default:r.push(action(1));break;}}}return r.join('');}jsmin.oldSize=input.length;ret=m(input);jsmin.newSize=ret.length;return comment+ret;}
    
    
    Array.prototype.unique=(function unique() {var r = this;var t = [];var mx = r.length;for (var z = 0; z < mx; z++) {if (t.indexOf(r[z]) == -1) {t[t.length] = r[z];}}return t;});
    function obVals(ob) {var r = [];var i = 0;for (var z in ob) {if (ob && ob.hasOwnProperty && ob.hasOwnProperty(z)) {r[i++] = ob[z];}}return r;}
    
    
    
    //done, actually do it and return the result:
    return processWrapper( strCode, ops );
    }//end Slim()
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •