Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //does not reduce size?
- var
- base64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
- trans64="abcdefghijklmnopqrstuvwxyz()[]{}:;,\"'\\!?*><&$ _-@=#\n0123456789+/"
- ;
- var shrink_64=function(d,s){
- //s = shrink (2 bit downsize)
- var a,b,m,o="",L=d.length,i=0,r,c,w,z;
- if(s){a=trans64;b=base64; m=d; }else{b=trans64;a=base64; m=btoa(d); }
- while(i<L){
- z=0;
- c=m[i];
- r=a.indexOf(c);
- if(r<0){
- w=m.substr(0,i)+( "\\u"+(65536|c.charCodeAt(0)).toString(16).substr(1) )+m.substr(i+1); L=w.length; m=w; }else{ o+=b[r];
- i++; }
- }
- if(s) o=atob(o);
- return o;
- };
Add Comment
Please, Sign In to add comment