/* * cssUpdate - v1.1.0 */ /** @namespace customify */ window.customify = window.customify || parent.customify || {} ;(function ($, window, customify) { const pluginName = 'cssUpdate', defaults = { properties: ['color'], propertyValue: 'pink', classes: 'Null' } // Plugin constructor function cssLiveUpdater (element, options) { this.element = element this.settings = $.extend({}, defaults, options) this._defaults = defaults this._name = pluginName this._cssproperties = CSSOM.parse($(this.element).html()) this.init() } cssLiveUpdater.prototype = { init: function () { this.changeProperties() }, changeProperties: function () { const self = this, css = this._cssproperties.cssRules if (typeof css[0] !== 'undefined' && css[0].hasOwnProperty('media')) { // in this case we run a media query object $.each(css, function (key, media_query) { // simple object with css properties // change them with new ones $.each(media_query.cssRules, function (i, property) { const property_name = property.style[0] css[key].cssRules[i].style[property_name] = self.updateCssRule(property_name, self.settings, css[key].cssRules[i].selectorText) }) }) } else { // simple object with css properties // change them with new ones $.each(css, function (i, property) { if (property.hasOwnProperty('style')) { const property_name = property.style[0] css[i].style[property_name] = self.updateCssRule(property_name, self.settings, css[i].selectorText) } }) } //Insert the new properties into