1/* eslint-disable */ 2(function (exports,main_core) { 3 'use strict'; 4 5 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 6 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 7 var DEFAULT = { 8 containerId: 'rstuning', 9 styleSelectId: 'rstuning_styles', 10 timeoutChanageStylesDelay: 250, 11 timeoutChanageStylesId: 0 12 }; 13 var Tuning = /*#__PURE__*/function () { 14 function Tuning() { 15 var _this = this; 16 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 17 babelHelpers.classCallCheck(this, Tuning); 18 babelHelpers.defineProperty(this, "container", null); 19 babelHelpers.defineProperty(this, "elements", []); 20 babelHelpers.defineProperty(this, "colorMacrosContent", ''); 21 babelHelpers.defineProperty(this, "colorMacrosCompiled", ''); 22 babelHelpers.defineProperty(this, "macrosList", {}); 23 this.options = _objectSpread(_objectSpread({}, DEFAULT), options); 24 document.addEventListener('DOMContentLoaded', this.init.bind(this)); 25 main_core.Event.EventEmitter.subscribe('Redsign.Tuning.Component:afterResponse', function (_ref) { 26 var data = _ref.data; 27 if (data.MACROS_LIST) { 28 for (var macros in data.MACROS_LIST) _this.setMacros(macros, data.MACROS_LIST[macros]); 29 _this.generateCss(); 30 } 31 }); 32 } 33 babelHelpers.createClass(Tuning, [{ 34 key: "init", 35 value: function init() { 36 this.container = document.getElementById(this.options.containerId); 37 if (!this.container) return; 38 this.elements = babelHelpers.toConsumableArray(this.container.querySelectorAll('[data-macros]')); 39 if (this.elements && this.elements.length > 0) { 40 for (var i = 0; i < this.elements.length; i++) { 41 this.setMacros(this.elements[i].getAttribute('data-macros'), this.elements[i].value); 42 if (this.elements[i].getAttribute('data-tuning-color-macros')) { 43 this.setMacros(this.elements[i].getAttribute('data-tuning-color-macros'), this.elements[i].value); 44 } 45 } 46 } 47 } 48 }, { 49 key: "generateCss", 50 value: function generateCss() { 51 this.replaceMacros(); 52 this.innerStyles(); 53 return true; 54 } 55 }, { 56 key: "getReadyMacros", 57 value: function getReadyMacros() { 58 var event = new CustomEvent('rs.tuning.onBeforeGetReadyMacros', { 59 'detail': { 60 'macrosList': this.macrosList 61 } 62 }); 63 document.dispatchEvent(event); 64 return this.macrosList; 65 } 66 }, { 67 key: "setColorMacrosContent", 68 value: function setColorMacrosContent(content) { 69 this.colorMacrosContent = content; 70 return true; 71 } 72 }, { 73 key: "getColorMacrosContent", 74 value: function getColorMacrosContent() { 75 return this.colorMacrosContent; 76 } 77 }, { 78 key: "replaceMacros", 79 value: function replaceMacros() { 80 var content = this.getColorMacrosContent(), 81 macrosList = this.getReadyMacros(); 82 for (var key1 in macrosList) { 83 content = content.replace(new RegExp('#' + key1 + '#', 'g'), macrosList[key1]); 84 } 85 this.setColorMacrosCompiled(content); 86 return true; 87 } 88 }, { 89 key: "innerStyles", 90 value: function innerStyles() { 91 var _this2 = this; 92 clearTimeout(this.options.timeoutChanageStylesId); 93 this.options.timeoutChanageStylesId = setTimeout(function () { 94 document.getElementById(_this2.options.styleSelectId).innerHTML = '' + '<style>' + _this2.getColorMacrosCompiled() + '</style>'; 95 }, this.options.timeoutChanageStylesDelay); 96 return true; 97 } 98 }, { 99 key: "setColorMacrosCompiled", 100 value: function setColorMacrosCompiled(content) { 101 this.colorMacrosCompiled = content; 102 return true; 103 } 104 }, { 105 key: "getColorMacrosCompiled", 106 value: function getColorMacrosCompiled() { 107 return this.colorMacrosCompiled; 108 } 109 }, { 110 key: "setMacros", 111 value: function setMacros(macrosName, value) { 112 this.macrosList[macrosName] = value; 113 return true; 114 } 115 }]); 116 return Tuning; 117 }(); 118 babelHelpers.defineProperty(Tuning, "instance", null); 119 120 exports.Tuning = Tuning; 121 122}((this.RS = this.RS || {}),BX)); 123//# sourceMappingURL=tuning.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.