Files
Testing/html5-chat/js/cssEditor/style.min.js
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

1 line
1.4 KiB
JavaScript

(function($){if($.fn.xstyle){return}var escape=function(text){return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")};var isStyleFuncSupported=!!CSSStyleDeclaration.prototype.getPropertyValue;if(!isStyleFuncSupported){CSSStyleDeclaration.prototype.getPropertyValue=function(a){return this.getAttribute(a)};CSSStyleDeclaration.prototype.setProperty=function(styleName,value,priority){console.log("set-priority",styleName,value,priority);this.setAttribute(styleName,value);var priority=typeof priority!="undefined"?priority:"";if(priority!=""){var rule=new RegExp(escape(styleName)+"\\s*:\\s*"+escape(value)+"(\\s*;)?","gmi");this.cssText=this.cssText.replace(rule,styleName+": "+value+" !"+priority+";");console.log(this.cssText)}};CSSStyleDeclaration.prototype.removeProperty=function(a){return this.removeAttribute(a)};CSSStyleDeclaration.prototype.getPropertyPriority=function(styleName){var rule=new RegExp(escape(styleName)+"\\s*:\\s*[^\\s]*\\s*!important(\\s*;)?","gmi");return rule.test(this.cssText)?"important":""}}$.fn.xstyle=function(styleName,value,priority){var node=this.get(0);if(typeof node=="undefined"){return this}var style=this.get(0).style;console.log("style",styleName,value,priority);if(typeof styleName!="undefined"){if(typeof value!="undefined"){priority=typeof priority!="undefined"?priority:"";style.setProperty(styleName,value,priority);return this}else{return style.getPropertyValue(styleName)}}else{return style}}})(jQuery);