PageSourceSearch

https://cproject.ru/local/components/aspro/developer.allcorp3heat/templates/.default/script.js

js cproject.ru collected 2026-10-07 11:21:16 UTC 4,559 bytes, 133 lines download raw bytes

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(
51                    this.result.NEED_AJAX ||
52                    this.result.color !== prefersColorScheme
53                ){
54                    this.refresh();
55                }
56            }
57        },
58
59        bindEvents: function() {
60            var that = this;
61
62            if (typeof this.handlers.onChangePrefersColorScheme !== 'function') {
63                this.handlers.onChangePrefersColorScheme = function(event){
64                    if (!event) {
65                        event = window.event;
66                    }
67    
68                    var newColorScheme = event.matches ? 'dark' : 'light';
69                    that.refresh();
70                }
71
72                try {
73                    window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', this.handlers.onChangePrefersColorScheme);
74                }
75                catch (e) {
76                }
77            }
78
79            if (typeof this.handlers.onChangeThemeColor !== 'function') {
80                this.handlers.onChangeThemeColor = function(){
81                    that.refresh();
82                }
83
84                BX.addCustomEvent('onChangeThemeColor', this.handlers.onChangeThemeColor);
85            }
86        },
87
88        unbindEvents: function() {
89            if (typeof this.handlers.onChangeThemeColor === 'function') {
90                BX.removeCustomEvent('onChangeThemeColor', this.handlers.onChangeThemeColor);
91                delete this.handlers.onChangeThemeColor;
92            }
93        },
94
95        refresh: function(){
96            var componentAction = 'getDeveloper';
97            var componentName = 'aspro:developer.allcorp3heat';
98            var sessid = BX.message('bitrix_sessid');
99            var lang = BX.message('LANGUAGE_ID');
100            var siteId = arAsproOptions.SITE_ID;
101            var signedParams = this.result('SIGNED_PARAMS');
102            var prefersColorScheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? 'dark' : 'light';
103
104            var that = this;
105            BX.ajax({
106                url: '/bitrix/services/main/ajax.php?mode=ajax&c=' + encodeURIComponent(componentName) +'&action=' + componentAction + '&sessid=' + sessid + '&SITE_ID=' + siteId + '&siteId=' + siteId + '&lang=' + lang + '&signedParameters=' 
106+ encodeURIComponent(signedParams) + '&clear_cache_session=Y&prefersColorScheme=' + prefersColorScheme,
107                method: 'POST',
108                async: true,
109                processData: true,
110                scriptsRunFirst: true,
111                emulateOnload: true,
112                start: true,
113                cache: false,
114                onsuccess: function(response){
115                    if(response.trim().length){
116                        if(that.node){
117                            that.unbindEvents();
118                            that.node.parentElement.insertAdjacentHTML('afterBegin', response);
119                            that.node.remove();
120
121                            that.node = BX('developer');
122                            that.node.developer = that;
123                            that.bindEvents();
124                        }
125                    }
126                },
127                onfailure: function(){
128    
129                }
130            });
131        }
132    }
133}

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.