1if (typeof window.JDeveloper === "undefined") { 2 window.JDeveloper = function (result) { 3 var _private = { 4 inited: false, 5 }; 6 7 Object.defineProperties(this, { 8 inited: { 9 get: function () { 10 return _private.inited; 11 }, 12 set: function (value) { 13 if (value) { 14 _private.inited = true; 15 } 16 }, 17 }, 18 }); 19 20 this.result = function (key) { 21 if (typeof result === "object") { 22 if (typeof key !== "undefined") { 23 if (Object.keys(result).indexOf(key) > -1) { 24 return result[key]; 25 } 26 } 27 } 28 29 return undefined; 30 }; 31 32 this.init(); 33 }; 34 35 window.JDeveloper.prototype = { 36 node: null, 37 handlers: {}, 38 39 init: function () { 40 if (!this.inited) { 41 this.inited = true; 42 43 this.node = BX("developer"); 44 this.node.developer = this; 45 46 this.bindEvents(); 47 48 var prefersColorScheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; 49 50 if (this.result.NEED_AJAX || this.result.color !== prefersColorScheme) { 51 this.refresh(); 52 } 53 } 54 }, 55 56 bindEvents: function () { 57 var that = this; 58 59 if (typeof this.handlers.onChangePrefersColorScheme !== "function") { 60 this.handlers.onChangePrefersColorScheme = function (event) { 61 if (!event) { 62 event = window.event; 63 } 64 65 var newColorScheme = event.matches ? "dark" : "light"; 66 that.refresh(); 67 }; 68 69 window 70 .matchMedia("(prefers-color-scheme: dark)") 71 .addEventListener("change", this.handlers.onChangePrefersColorScheme); 72 } 73 74 if (typeof this.handlers.onChangeThemeColor !== "function") { 75 this.handlers.onChangeThemeColor = function () { 76 that.refresh(); 77 }; 78 79 BX.addCustomEvent("onChangeThemeColor", this.handlers.onChangeThemeColor); 80 } 81 }, 82 83 unbindEvents: function () { 84 if (typeof this.handlers.onChangeThemeColor === "function") { 85 BX.removeCustomEvent("onChangeThemeColor", this.handlers.onChangeThemeColor); 86 delete this.handlers.onChangeThemeColor; 87 } 88 }, 89 90 refresh: function () { 91 var componentAction = "getDeveloper"; 92 var componentName = "aspro:developer.max"; 93 var sessid = BX.message("bitrix_sessid"); 94 var lang = BX.message("LANGUAGE_ID"); 95 var siteId = arAsproOptions.SITE_ID; 96 var signedParams = this.result("SIGNED_PARAMS"); 97 var prefersColorScheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; 98 99 var that = this; 100 BX.ajax({ 101 url: 102 "/bitrix/services/main/ajax.php?mode=ajax&c=" + 103 encodeURIComponent(componentName) + 104 "&action=" + 105 componentAction + 106 "&sessid=" + 107 sessid + 108 "&SITE_ID=" + 109 siteId + 110 "&siteId=" + 111 siteId + 112 "&lang=" + 113 lang + 114 "&signedParameters=" + 115 encodeURIComponent(signedParams) + 116 "&clear_cache=Y&prefersColorScheme=" + 117 prefersColorScheme, 118 method: "POST", 119 async: true, 120 processData: true, 121 scriptsRunFirst: true, 122 emulateOnload: true, 123 start: true, 124 cache: false, 125 onsuccess: function (response) { 126 if (response.trim().length) { 127 if (that.node) { 128 that.unbindEvents(); 129 that.node.parentElement.insertAdjacentHTML("beforeEnd", response); 130 that.node.remove(); 131 132 that.node = BX("developer"); 133 that.node.developer = that; 134 that.bindEvents(); 135 } 136 } 137 }, 138 onfailure: function () {}, 139 }); 140 }, 141 }; 142}
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.