PluginProbe
Customify / 2.1.2
Customify v2.1.2
2.10.9 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.7.1 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.6.0 1.6.0.1 1.6.5 1.7.0 1.7.1 All 77 releases
customify / js / CSSOM.js

CSSOM.js in Customify 2.1.2, at js/CSSOM.js

1 lines 15.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(e){"use strict";var t=e.CSSOM={};t.CSSStyleDeclaration=function(){this.length=0;this.parentRule=null;this._importants={}};t.CSSStyleDeclaration.prototype={constructor:t.CSSStyleDeclaration,getPropertyValue:function(e){return this[e]||""},setProperty:function(e,t,n){if(this[e]){var r=Array.prototype.indexOf.call(this,e);if(r<0){this[this.length]=e;this.length++}}else{this[this.length]=e;this.length++}this[e]=t;this._importants[e]=n},removeProperty:function(e){if(!(e in this)){return""}var t=Array.prototype.indexOf.call(this,e);if(t<0){return""}var n=this[e];this[e]="";Array.prototype.splice.call(this,t,1);return n},getPropertyCSSValue:function(){},getPropertyPriority:function(e){return this._importants[e]||""},getPropertyShorthand:function(){},isPropertyImplicit:function(){},get cssText(){var e=[];for(var t=0,n=this.length;t<n;++t){var r=this[t];var i=this.getPropertyValue(r);var s=this.getPropertyPriority(r);if(s){s=" !"+s}e[t]=r+": "+i+s+";"}return e.join(" ")},set cssText(e){var n,r;for(n=this.length;n--;){r=this[n];this[r]=""}Array.prototype.splice.call(this,0,this.length);this._importants={};var i=t.parse("#bogus{"+e+"}").cssRules[0].style;var s=i.length;for(n=0;n<s;++n){r=i[n];this.setProperty(i[n],i.getPropertyValue(r),i.getPropertyPriority(r))}}};t.CSSRule=function(){this.parentRule=null;this.parentStyleSheet=null};t.CSSRule.STYLE_RULE=1;t.CSSRule.IMPORT_RULE=3;t.CSSRule.MEDIA_RULE=4;t.CSSRule.FONT_FACE_RULE=5;t.CSSRule.PAGE_RULE=6;t.CSSRule.WEBKIT_KEYFRAMES_RULE=8;t.CSSRule.WEBKIT_KEYFRAME_RULE=9;t.CSSRule.prototype={constructor:t.CSSRule};t.CSSStyleRule=function(){t.CSSRule.call(this);this.selectorText="";this.style=new t.CSSStyleDeclaration;this.style.parentRule=this};t.CSSStyleRule.prototype=new t.CSSRule;t.CSSStyleRule.prototype.constructor=t.CSSStyleRule;t.CSSStyleRule.prototype.type=1;Object.defineProperty(t.CSSStyleRule.prototype,"cssText",{get:function(){var e;if(this.selectorText){e=this.selectorText+" {"+this.style.cssText+"}"}else{e=""}return e},set:function(e){var n=t.CSSStyleRule.parse(e);this.style=n.style;this.selectorText=n.selectorText}});t.CSSStyleRule.parse=function(e){var n=0;var r="selector";var i;var s=n;var o="";var u={selector:true,value:true};var a=new t.CSSStyleRule;var f,l="";for(var c;c=e.charAt(n);n++){switch(c){case" ":case" ":case"\r":case"\n":case"\f":if(u[r]){switch(e.charAt(n-1)){case" ":case" ":case"\r":case"\n":case"\f":break;default:o+=" ";break}}break;case'"':s=n+1;i=e.indexOf('"',s)+1;if(!i){throw'" is missing'}o+=e.slice(n,i);n=i-1;break;case"'":s=n+1;i=e.indexOf("'",s)+1;if(!i){throw"' is missing"}o+=e.slice(n,i);n=i-1;break;case"/":if(e.charAt(n+1)==="*"){n+=2;i=e.indexOf("*/",n);if(i===-1){throw new SyntaxError("Missing */")}else{n=i+1}}else{o+=c}break;case"{":if(r==="selector"){a.selectorText=o.trim();o="";r="name"}break;case":":if(r==="name"){f=o.trim();o="";r="value"}else{o+=c}break;case"!":if(r==="value"&&e.indexOf("!important",n)===n){l="important";n+="important".length}else{o+=c}break;case";":if(r==="value"){a.style.setProperty(f,o.trim(),l);l="";o="";r="name"}else{o+=c}break;case"}":if(r==="value"){a.style.setProperty(f,o.trim(),l);l="";o=""}else if(r==="name"){break}else{o+=c}r="selector";break;default:o+=c;break}}return a};t.MediaList=function(){this.length=0};t.MediaList.prototype={constructor:t.MediaList,get mediaText(){return Array.prototype.join.call(this,", ")},set mediaText(e){var t=e.split(",");var n=this.length=t.length;for(var r=0;r<n;r++){this[r]=t[r].trim()}},appendMedium:function(e){if(Array.prototype.indexOf.call(this,e)===-1){this[this.length]=e;this.length++}},deleteMedium:function(e){var t=Array.prototype.indexOf.call(this,e);if(t!==-1){Array.prototype.splice.call(this,t,1)}}};t.CSSMediaRule=function(){t.CSSRule.call(this);this.media=new t.MediaList;this.cssRules=[]};t.CSSMediaRule.prototype=new t.CSSRule;t.CSSMediaRule.prototype.constructor=t.CSSMediaRule;t.CSSMediaRule.prototype.type=4;Object.defineProperty(t.CSSMediaRule.prototype,"cssText",{get:function(){var e=[];for(var t=0,n=this.cssRules.length;t<n;t++){e.push(this.cssRules[t].cssText)}return"@media "+this.media.mediaText+" {"+e.join("")+"}"}});t.CSSImportRule=function(){t.CSSRule.call(this);this.href="";this.media=new t.MediaList;this.styleSheet=new t.CSSStyleSheet};t.CSSImportRule.prototype=new t.CSSRule;t.CSSImportRule.prototype.constructor=t.CSSImportRule;t.CSSImportRule.prototype.type=3;Object.defineProperty(t.CSSImportRule.prototype,"cssText",{get:function(){var e=this.media.mediaText;return"@import url("+this.href+")"+(e?" "+e:"")+";"},set:function(e){var t=0;var n="";var r="";var i;for(var s;s=e.charAt(t);t++){switch(s){case" ":case" ":case"\r":case"\n":case"\f":if(n==="after-import"){n="url"}else{r+=s}break;case"@":if(!n&&e.indexOf("@import",t)===t){n="after-import";t+="import".length;r=""}break;case"u":if(n==="url"&&e.indexOf("url(",t)===t){i=e.indexOf(")",t+1);if(i===-1){throw t+': ")" not found'}t+="url(".length;var o=e.slice(t,i);if(o[0]===o[o.length-1]){if(o[0]==='"'||o[0]==="'"){o=o.slice(1,-1)}}this.href=o;t=i;n="media"}break;case'"':if(n==="url"){i=e.indexOf('"',t+1);if(!i){throw t+": '\"' not found"}this.href=e.slice(t+1,i);t=i;n="media"}break;case"'":if(n==="url"){i=e.indexOf("'",t+1);if(!i){throw t+': "\'" not found'}this.href=e.slice(t+1,i);t=i;n="media"}break;case";":if(n==="media"){if(r){this.media.mediaText=r.trim()}}break;default:if(n==="media"){r+=s}break}}}});t.CSSFontFaceRule=function(){t.CSSRule.call(this);this.style=new t.CSSStyleDeclaration;this.style.parentRule=this};t.CSSFontFaceRule.prototype=new t.CSSRule;t.CSSFontFaceRule.prototype.constructor=t.CSSFontFaceRule;t.CSSFontFaceRule.prototype.type=5;Object.defineProperty(t.CSSFontFaceRule.prototype,"cssText",{get:function(){return"@font-face {"+this.style.cssText+"}"}});t.StyleSheet=function(){this.parentStyleSheet=null};t.CSSStyleSheet=function(){t.StyleSheet.call(this);this.cssRules=[]};t.CSSStyleSheet.prototype=new t.StyleSheet;t.CSSStyleSheet.prototype.constructor=t.CSSStyleSheet;t.CSSStyleSheet.prototype.insertRule=function(e,n){if(n<0||n>this.cssRules.length){throw new RangeError("INDEX_SIZE_ERR")}var r=t.parse(e).cssRules[0];r.parentStyleSheet=this;this.cssRules.splice(n,0,r);return n};t.CSSStyleSheet.prototype.deleteRule=function(e){if(e<0||e>=this.cssRules.length){throw new RangeError("INDEX_SIZE_ERR")}this.cssRules.splice(e,1)};t.CSSStyleSheet.prototype.toString=function(){var e="";var t=this.cssRules;for(var n=0;n<t.length;n++){e+=t[n].cssText+"\n"}return e};t.CSSKeyframesRule=function(){t.CSSRule.call(this);this.name="";this.cssRules=[]};t.CSSKeyframesRule.prototype=new t.CSSRule;t.CSSKeyframesRule.prototype.constructor=t.CSSKeyframesRule;t.CSSKeyframesRule.prototype.type=8;Object.defineProperty(t.CSSKeyframesRule.prototype,"cssText",{get:function(){var e=[];for(var t=0,n=this.cssRules.length;t<n;t++){e.push(" "+this.cssRules[t].cssText)}return"@"+(this._vendorPrefix||"")+"keyframes "+this.name+" { \n"+e.join("\n")+"\n}"}});t.CSSKeyframeRule=function(){t.CSSRule.call(this);this.keyText="";this.style=new t.CSSStyleDeclaration;this.style.parentRule=this};t.CSSKeyframeRule.prototype=new t.CSSRule;t.CSSKeyframeRule.prototype.constructor=t.CSSKeyframeRule;t.CSSKeyframeRule.prototype.type=9;Object.defineProperty(t.CSSKeyframeRule.prototype,"cssText",{get:function(){return this.keyText+" {"+this.style.cssText+"} "}});t.MatcherList=function(){this.length=0};t.MatcherList.prototype={constructor:t.MatcherList,get matcherText(){return Array.prototype.join.call(this,", ")},set matcherText(e){var t=e.split(",");var n=this.length=t.length;for(var r=0;r<n;r++){this[r]=t[r].trim()}},appendMatcher:function(e){if(Array.prototype.indexOf.call(this,e)===-1){this[this.length]=e;this.length++}},deleteMatcher:function(e){var t=Array.prototype.indexOf.call(this,e);if(t!==-1){Array.prototype.splice.call(this,t,1)}}};t.CSSDocumentRule=function(){t.CSSRule.call(this);this.matcher=new t.MatcherList;this.cssRules=[]};t.CSSDocumentRule.prototype=new t.CSSRule;t.CSSDocumentRule.prototype.constructor=t.CSSDocumentRule;t.CSSDocumentRule.prototype.type=10;Object.defineProperty(t.CSSDocumentRule.prototype,"cssText",{get:function(){var e=[];for(var t=0,n=this.cssRules.length;t<n;t++){e.push(this.cssRules[t].cssText)}return"@-moz-document "+this.matcher.matcherText+" {"+e.join("")+"}"}});t.CSSValue=function(){};t.CSSValue.prototype={constructor:t.CSSValue,set cssText(e){var t=this._getConstructorName();throw new Error('DOMException: property "cssText" of "'+t+'" is readonly and can not be replaced with "'+e+'"!')},get cssText(){var e=this._getConstructorName();throw new Error('getter "cssText" of "'+e+'" is not implemented!')},_getConstructorName:function(){var e=this.constructor.toString(),t=e.match(/function\s([^\(]+)/),n=t[1];return n}};t.CSSValueExpression=function(t,n){this._token=t;this._idx=n};t.CSSValueExpression.prototype=new t.CSSValue;t.CSSValueExpression.prototype.constructor=t.CSSValueExpression;t.CSSValueExpression.prototype.parse=function(){var e=this._token,t=this._idx;var n="",r="",i="",s,o=[];for(;;++t){n=e.charAt(t);if(n===""){i="css expression error: unfinished expression!";break}switch(n){case"(":o.push(n);r+=n;break;case")":o.pop(n);r+=n;break;case"/":if(s=this._parseJSComment(e,t)){if(s.error){i="css expression error: unfinished comment in expression!"}else{t=s.idx}}else if(s=this._parseJSRexExp(e,t)){t=s.idx;r+=s.text}else{r+=n}break;case"'":case'"':s=this._parseJSString(e,t,n);if(s){t=s.idx;r+=s.text}else{r+=n}break;default:r+=n;break}if(i){break}if(o.length===0){break}}var u;if(i){u={error:i}}else{u={idx:t,expression:r}}return u};t.CSSValueExpression.prototype._parseJSComment=function(e,t){var n=e.charAt(t+1),r;if(n==="/"||n==="*"){var i=t,s,o;if(n==="/"){o="\n"}else if(n==="*"){o="*/"}s=e.indexOf(o,i+1+1);if(s!==-1){s=s+o.length-1;r=e.substring(t,s+1);return{idx:s,text:r}}else{var u="css expression error: unfinished comment in expression!";return{error:u}}}else{return false}};t.CSSValueExpression.prototype._parseJSString=function(e,t,n){var r=this._findMatchedIdx(e,t,n),i;if(r===-1){return false}else{i=e.substring(t,r+n.length);return{idx:r,text:i}}};t.CSSValueExpression.prototype._parseJSRexExp=function(e,t){var n=e.substring(0,t).replace(/\s+$/,""),r=[/^$/,/\($/,/\[$/,/\!$/,/\+$/,/\-$/,/\*$/,/\/\s+/,/\%$/,/\=$/,/\>$/,/<$/,/\&$/,/\|$/,/\^$/,/\~$/,/\?$/,/\,$/,/delete$/,/in$/,/instanceof$/,/new$/,/typeof$/,/void$/];var i=r.some(function(e){return e.test(n)});if(!i){return false}else{var s="/";return this._parseJSString(e,t,s)}};t.CSSValueExpression.prototype._findMatchedIdx=function(e,t,n){var r=t,i;var s=-1;while(true){i=e.indexOf(n,r+1);if(i===-1){i=s;break}else{var o=e.substring(t+1,i),u=o.match(/\\+$/);if(!u||u[0]%2===0){break}else{r=i}}}var a=e.indexOf("\n",t+1);if(a<i){i=s}return i};t.parse=function(n){var r=0;var i="before-selector";var s;var o="";var u={selector:true,value:true,atRule:true,"importRule-begin":true,importRule:true,atBlock:true,"documentRule-begin":true};var a=new t.CSSStyleSheet;var f=a;var l;var c,h="",p,d,v,m,g,y;var b=/@(-(?:\w+-)+)?keyframes/g;var w=function(e){var t=n.substring(0,r).split("\n");var i=t.length;var s=t.pop().length+1;var o=new Error(e+" (line "+i+", char "+s+")");o.line=i;o["char"]=s;o.styleSheet=a;throw o};for(var E;E=n.charAt(r);r++){switch(E){case" ":case" ":case"\r":case"\n":case"\f":if(u[i]){o+=E}break;case'"':s=r+1;do{s=n.indexOf('"',s)+1;if(!s){w('Unmatched "')}}while(n[s-2]==="\\");o+=n.slice(r,s);r=s-1;switch(i){case"before-value":i="value";break;case"importRule-begin":i="importRule";break}break;case"'":s=r+1;do{s=n.indexOf("'",s)+1;if(!s){w("Unmatched '")}}while(n[s-2]==="\\");o+=n.slice(r,s);r=s-1;switch(i){case"before-value":i="value";break;case"importRule-begin":i="importRule";break}break;case"/":if(n.charAt(r+1)==="*"){r+=2;s=n.indexOf("*/",r);if(s===-1){w("Missing */")}else{r=s+1}}else{o+=E}if(i==="importRule-begin"){o+=" ";i="importRule"}break;case"@":if(n.indexOf("@-moz-document",r)===r){i="documentRule-begin";y=new t.CSSDocumentRule;y.__starts=r;r+="-moz-document".length;o="";break}else if(n.indexOf("@media",r)===r){i="atBlock";d=new t.CSSMediaRule;d.__starts=r;r+="media".length;o="";break}else if(n.indexOf("@import",r)===r){i="importRule-begin";r+="import".length;o+="@import";break}else if(n.indexOf("@font-face",r)===r){i="fontFaceRule-begin";r+="font-face".length;m=new t.CSSFontFaceRule;m.__starts=r;o="";break}else{b.lastIndex=r;var S=b.exec(n);if(S&&S.index===r){i="keyframesRule-begin";g=new t.CSSKeyframesRule;g.__starts=r;g._vendorPrefix=S[1];r+=S[0].length-1;o="";break}else if(i==="selector"){i="atRule"}}o+=E;break;case"{":if(i==="selector"||i==="atRule"){p.selectorText=o.trim();p.style.__starts=r;o="";i="before-name"}else if(i==="atBlock"){d.media.mediaText=o.trim();f=l=d;d.parentStyleSheet=a;o="";i="before-selector"}else if(i==="fontFaceRule-begin"){if(l){m.parentRule=l}m.parentStyleSheet=a;p=m;o="";i="before-name"}else if(i==="keyframesRule-begin"){g.name=o.trim();if(l){g.parentRule=l}g.parentStyleSheet=a;f=l=g;o="";i="keyframeRule-begin"}else if(i==="keyframeRule-begin"){p=new t.CSSKeyframeRule;p.keyText=o.trim();p.__starts=r;o="";i="before-name"}else if(i==="documentRule-begin"){y.matcher.matcherText=o.trim();if(l){y.parentRule=l}f=l=y;y.parentStyleSheet=a;o="";i="before-selector"}break;case":":if(i==="name"){c=o.trim();o="";i="before-value"}else{o+=E}break;case"(":if(i==="value"){if(o.trim()==="expression"){var x=(new t.CSSValueExpression(n,r)).parse();if(x.error){w(x.error)}else{o+=x.expression;r=x.idx}}else{s=n.indexOf(")",r+1);if(s===-1){w('Unmatched "("')}o+=n.slice(r,s+1);r=s}}else{o+=E}break;case"!":if(i==="value"&&n.indexOf("!important",r)===r){h="important";r+="important".length}else{o+=E}break;case";":switch(i){case"value":p.style.setProperty(c,o.trim(),h);h="";o="";i="before-name";break;case"atRule":o="";i="before-selector";break;case"importRule":v=new t.CSSImportRule;v.parentStyleSheet=v.styleSheet.parentStyleSheet=a;v.cssText=o+E;a.cssRules.push(v);o="";i="before-selector";break;default:o+=E;break}break;case"}":switch(i){case"value":p.style.setProperty(c,o.trim(),h);h="";case"before-name":case"name":p.__ends=r+1;if(l){p.parentRule=l}p.parentStyleSheet=a;f.cssRules.push(p);o="";if(f.constructor===t.CSSKeyframesRule){i="keyframeRule-begin"}else{i="before-selector"}break;case"keyframeRule-begin":case"before-selector":case"selector":if(!l){w("Unexpected }")}f.__ends=r+1;a.cssRules.push(f);f=a;l=null;o="";i="before-selector";break}break;default:switch(i){case"before-selector":i="selector";p=new t.CSSStyleRule;p.__starts=r;break;case"before-name":i="name";break;case"before-value":i="value";break;case"importRule-begin":i="importRule";break}o+=E;break}}return a};t.clone=function n(e){var r=new t.CSSStyleSheet;var i=e.cssRules;if(!i){return r}var s={1:t.CSSStyleRule,4:t.CSSMediaRule,8:t.CSSKeyframesRule,9:t.CSSKeyframeRule};for(var o=0,u=i.length;o<u;o++){var a=i[o];var f=r.cssRules[o]=new s[a.type];var l=a.style;if(l){var c=f.style=new t.CSSStyleDeclaration;for(var h=0,p=l.length;h<p;h++){var d=c[h]=l[h];c[d]=l[d];c._importants[d]=l.getPropertyPriority(d)}c.length=l.length}if(a.hasOwnProperty("keyText")){f.keyText=a.keyText}if(a.hasOwnProperty("selectorText")){f.selectorText=a.selectorText}if(a.hasOwnProperty("mediaText")){f.mediaText=a.mediaText}if(a.hasOwnProperty("cssRules")){f.cssRules=n(a).cssRules}}return r}})(this)