PageSourceSearch

https://diariodecuba.net/modules/revisium-antivirus/js/ra_domain.js

js diariodecuba.net collected 2026-10-03 22:35:57 UTC 8,176 bytes, 260 lines download raw bytes

1
2var list_component              = null;
3var domain_list_current_values  = [];
4var timeout_pointer             = null;
5var button_lock                 = false;
6var cancel_all_button_lock      = false;
7
8function startTask(sendButton, event, domain_id, task_name) {
9    event.preventDefault();
10    if (sendButton.readAttribute('disabled') !== null) return;
11
12    sendButton.writeAttribute('disabled', '');
13    sendButton.addClassName('disabled');
14    
15    if (task_name == 'cure') {
16        $('cleanup_hint').show();
17    }
18
19    new Ajax.Request(start_task_url, {
20        method:     'post',
21        parameters: {domain_id: domain_id, task: task_name},
22        onFailure: function() {
23            sendButton.disabled = false;
24            sendButton.removeClassName('disabled');
25        },
26        onSuccess: function (transport) {
27            var data = transport.responseText.evalJSON();
28            if (data.redirect !== undefined) {
29                window.location.href = data.redirect;
30            }
31            reAjaxUpdate();
32        }
33    });
34}
35    
36function scanAll(sendButton, event) {
37    event.preventDefault();
38    if (sendButton.disabled) return;
39    button_lock = true;
40    progressShow(null);
41    scanAllDisable();
42    cancelAllDisable();
43    new Ajax.Request(scan_all_url, {
44        method:     'post',
45        parameters: {start: 1, client_id: client_id},
46        onFailure: function() {
47            button_lock = false;
48        },
49        onSuccess: function (transport) {
50            var data = transport.responseText.evalJSON();
51            if (data.redirect !== undefined) {
52                window.location.href = data.redirect;
53            }
54            reAjaxUpdate();
55            button_lock = false;
56        }
57    });
58}
59    
60function cancelTask(sendButton, event, domain_id, task_name) {
61    event.preventDefault();
62    if (sendButton.disabled) return;
63    button_lock = true;
64    sendButton.disabled = true;
65
66    new Ajax.Request(cancel_task_url, {
67        method:     'post',
68        parameters: {domain_id: domain_id, task: task_name},
69        onFailure: function() {
70            sendButton.disabled = false;
71            button_lock = false;
72        },
73        onSuccess: function (transport) {
74            var data = transport.responseText.evalJSON();
75            sendButton.disabled = false;
76            if (data.redirect !== undefined) {
77                window.location.href = data.redirect;
78            }
79            button_lock = false;
80            reAjaxUpdate();
81        }
82    });
83}    
84    
85function cancelAll(sendButton, event) {
86    event.preventDefault();
87    if (sendButton.disabled) return;
88    button_lock             = true;
89    cancel_all_button_lock  = true;
90    progressShow(null);
91    scanAllDisable();
92    cancelAllDisable();
93
94    new Ajax.Request(cancel_all_url, {
95        method:     'post',
96        parameters: {start: 1, client_id: client_id},
97        onFailure: function() {
98            button_lock = false;
99        },
100        onSuccess: function (transport) {
101            var data = transport.responseText.evalJSON();
102            if (data.redirect !== undefined) {
103                window.location.href = data.redirect;
104            }
105            reAjaxUpdate();
106            button_lock = false;
107        }
108    });
109}
110    
111function needUpdateDomainListCell(domain_id, type, value) {
112    if (typeof domain_list_current_values[domain_id] === "undefined") {
113        domain_list_current_values[domain_id] = {};
114    }
115    if (typeof domain_list_current_values[domain_id][type] === "undefined") {
116        domain_list_current_values[domain_id][type] = '';
117    }
118    if (domain_list_current_values[domain_id][type] === value) {
119        return false;
120    }
121    domain_list_current_values[domain_id][type] = value;
122    return true;
123}
124    
125function reAjaxUpdate() {
126    clearTimeout(timeout_pointer);
127    ajaxUpdate();
128}
129    
130function ajaxUpdate() {
131    var current_button_lock = button_lock;
132    new Ajax.Request(ajax_update_url, {
133        method: 'get',
134        parameters: {last_update_time: last_update_time},
135        onSuccess: function (transport) {
136            var data = transport.responseText.evalJSON();
137            if (typeof data.domains_list === "undefined") {
138                onTimeoutAjaxUpdate();
139                return;
140            }
141            if (typeof data.last_update_time !== "undefined") {
142                last_update_time = data.last_update_time;
143            }
144            data.domains_list.forEach(function(item, index, array){
145                var domain_id = item.domain_id;
146                if ($('domain_' + domain_id) === null) {
147                    return;
148                }
149                if (needUpdateDomainListCell(domain_id, 'domain_status', item.domain)) {
150                    $('domain_' + domain_id).replace(item.domain);
151                }
152                if (needUpdateDomainListCell(domain_id, 'report_time_domain', item.report_time)) {
153                    $('report_time_domain_' + domain_id).replace(item.report_time);
154                }
155                if (needUpdateDomainListCell(domain_id, 'status', item.status)) {
156                    $('status_' + domain_id).replace(item.status);
157                }
158
159                if (needUpdateDomainListCell(domain_id, 'state', item.state)) {
160                    $('state_' + domain_id).replace(item.state);
161                }
162                if (needUpdateDomainListCell(domain_id, 'buttons' , item.buttons)) {
163                    $('buttons_domain_' + item.domain_id).replace(item.buttons);
164                }
165            });
166            if (cancel_all_button_lock && data.cnt_working_domains == 0) {
167                cancel_all_button_lock = false;
168            }
169            if (!current_button_lock && !button_lock) {
170                if (data.progress_text != "") {
171                    progressShow(data.progress_text);
172                    scanAllDisable();
173                    if (!cancel_all_button_lock) {
174                        cancelAllEnable();
175                    }
176                }
177                else {
178                    progressHide();
179                    scanAllEnable();
180                    cancelAllDisable();
181                }
182            }
183            onTimeoutAjaxUpdate();
184        },
185        onFailure: function (transport) {
186            onTimeoutAjaxUpdate();
187        }        
188    });
189}
190
191function setClientFilter() {
192    window.location.href = '?client_id=' + $('select_login').value;
193}
194
195function onTimeoutAjaxUpdate() {
196    clearTimeout(timeout_pointer);
197    timeout_pointer = setTimeout(function(){
198        ajaxUpdate();
199    }, ajax_update_interval);
200}
201
202function scanAllDisable() {
203    if ($('btn_scan_all') === null) {
204        return;
205    }
206    $('btn_scan_all').disabled = true;
207    $('btn_scan_all').up().addClassName('disabled');
208}
209
210function cancelAllEnable() {
211    if ($('btn_cancel_all') === null) {
212        return;
213    }
214    $('btn_cancel_all').disabled = false;
215    $('btn_cancel_all').up().removeClassName('disabled');
216}
217
218function cancelAllDisable() {
219    if ($('btn_cancel_all') === null) {
220        return;
221    }
222    $('btn_cancel_all').disabled = true;
223    $('btn_cancel_all').up().addClassName('disabled');
224}
225
226function scanAllEnable() {
227    if ($('btn_scan_all') === null) {
228        return;
229    }
230    $('btn_scan_all').disabled = false;
231    $('btn_scan_all').up().removeClassName('disabled');
232}
233
234function progressShow(text) {
235    if (typeof text != 'undefined') {
236        if (text !== null) {
237            $('progress_text').update(text);
238            $('img_progress').show();
239        }
240    }
241    else {
242        $('progress_text').update('');
243    }
244}
245
246function progressHide() {
247    $('img_progress').hide();
248    $('progress_text').update('');
249}
250
251progressShow(null);
252scanAllDisable();
253cancelAllDisable();
254
255Jsw.onReady(function () {
256    list_component = Jsw.getComponent(domain_list_id);
257    if (list_component !== null) {
258        ajaxUpdate();
259    }
260});    

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.