Created
February 16, 2017 14:56
-
-
Save framingeinstein/e9ab58fa26fc902157d0b8eee24c079b to your computer and use it in GitHub Desktop.
Adobe Utility Plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Utility Functions: apl, p_c, p_gh, split, replace, join | |
*/ | |
s.apl=new Function("L","v","d","u","" | |
+"var s=this,m=0;if(!L)L='';if(u){var i,n,a=s.split(L,d);for(i=0;i<a." | |
+"length;i++){n=a[i];m=m||(u==1?(n==v):(n.toLowerCase()==v.toLowerCas" | |
+"e()));}}if(!m)L=L?L+d+v:v;return L"); | |
s.p_c=new Function("v","c","" | |
+"var x=v.indexOf('=');return c.toLowerCase()==v.substring(0,x<0?v.le" | |
+"ngth:x).toLowerCase()?v:0"); | |
s.p_gh=new Function("" | |
+"var s=this;if(!s.eo&&!s.lnk)return '';var o=s.eo?s.eo:s.lnk,y=s.ot(" | |
+"o),n=s.oid(o),x=o.s_oidt;if(s.eo&&o==s.eo){while(o&&!n&&y!='BODY'){" | |
+"o=o.parentElement?o.parentElement:o.parentNode;if(!o)return '';y=s." | |
+"ot(o);n=s.oid(o);x=o.s_oidt}}return o.href?o.href:'';"); | |
s.split=new Function("l","d","" | |
+"var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x" | |
+"++]=l.substring(0,i);l=l.substring(i+d.length);}return a"); | |
s.repl=new Function("x","o","n","" | |
+"var i=x.indexOf(o),l=n.length;while(x&&i>=0){x=x.substring(0,i)+n+x." | |
+"substring(i+o.length);i=x.indexOf(o,i+l)}return x"); | |
s.join = new Function("v","p","" | |
+"var s = this;var f,b,d,w;if(p){f=p.front?p.front:'';b=p.back?p.back" | |
+":'';d=p.delim?p.delim:'';w=p.wrap?p.wrap:'';}var str='';for(var x=0" | |
+";x<v.length;x++){if(typeof(v[x])=='object' )str+=s.join( v[x],p);el" | |
+"se str+=w+v[x]+w;if(x<v.length-1)str+=d;}return f+str+b;"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment