1var root_domain = root_domain || location.hostname; 2var http_addr = document.location.protocol + '//' + root_domain; 3var prevAjax; 4var actions_post = {}; 5var actions_url = []; 6 7var sunsite_anchor = ''; 8var sunsite_loaded = sunsite_loaded || ''; 9 10var loaded_files = []; 11var my_callbacks_index = 0; 12var my_callbacks = [], my_callbacks_sources = []; 13var sunsite_inits = []; 14 15file_ext = function(fname) { 16 var re = /(?:\.([^.]+))?$/; 17 return re.exec(fname)[1]; 18}; 19 20in_array = function(needle, haystack, strict) { 21 var found = -1, key, strict = !!strict; 22 for (key in haystack) { 23 if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) { 24 found = key; 25 break; 26 } 27 } 28 return found; 29}; 30 31function ajax(url, callback, data, x) { 32 try { 33 x = new(this.XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0'); 34 x.open(data ? 'POST' : 'GET', url, 1); 35 x.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 36 x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 37 x.onreadystatechange = function () { 38 x.readyState > 3 && callback && callback(x.responseText, x); 39 }; 40 x.send(data) 41 } catch (e) { 42 window.console && console.log(e); 43 } 44}; 45 46var css_ind = 1; 47load_srcs = function(srcs, callback) { 48 var callback_needed = true; 49 my_callbacks_index++; 50 my_callbacks[my_callbacks_index] = callback; 51 my_callbacks_sources[my_callbacks_index] = []; 52 var html = document.getElementsByTagName("html")[0]; 53 54 if (!typeof srcs === 'object' ) { 55 return; 56 } 57 if (Array.isArray(srcs)) { 58 var mysrcs = srcs; 59 } else { 60 var mysrcs = [srcs]; 61 } 62 for(var x in mysrcs) { 63 var href = mysrcs[x]; 64 if (file_ext(href) == 'js') { 65 if (typeof(loaded_files[href]) == "undefined") { 66 my_callbacks_sources[my_callbacks_index].push(href); 67 callback_needed = false; 68 if (loaded_files[href] === false) { 69 continue; 70 } else { 71 loaded_files[href] = false; 72 } 73 74 var head = document.getElementsByTagName("head")[0]; 75 var script = document.createElement("script"); 76 script.type = 'text/javascript'; 77 script.async = true; 78 script.cache = true; 79 if (script.readyState) { 80 script.onreadystatechange = function () { 81 if (script.readyState == "loaded" || script.readyState == "complete") { 82 script.onreadystatechange = null; 83 var sript_src = this.src.replace(location.protocol + '//' + location.host, ''); 84 loaded_files[sript_src] = true; 85 part_loaded(sript_src); 86 } 87 } 88 } else { 89 script.onload = function () { 90 var sript_src = this.src.replace(location.protocol + '//' + location.host, ''); 91 loaded_files[sript_src] = true; 92 part_loaded(sript_src); 93 } 94 } 95 script.src = href; 96 head.appendChild(script); 97 } else if (loaded_files[href] === false) { 98 my_callbacks_sources[my_callbacks_index].push(href); 99 callback_needed = false; 100 } 101 } else if (file_ext(href) == 'css') { 102 if (typeof(loaded_files[href]) == "undefined") { 103 loaded_files[href] = true; 104 var style = document.createElement('style'); 105 html.appendChild(style); 106 style.setAttribute('id', 'asyncInlineStyle' + css_ind); 107 108 (function(h,i){ 109 ajax(h, function(data){ 110 document.getElementById('asyncInlineStyle' + i).innerText = data; 111 }); 112 })(href, css_ind); 113 css_ind ++; 114 } 115 } 116 } 117 118 if (callback_needed && callback) { 119 my_callbacks[my_callbacks_index] = false; 120 callback(); 121 } 122}; 123 124function part_loaded(script_src) { 125 for(var x in my_callbacks_sources) { 126 var position = in_array(script_src, my_callbacks_sources[x]); 127 if (position >= 0) { 128 my_callbacks_sources[x].splice(position, 1); 129 } 130 131 if (my_callbacks_sources[x].length <= 0 && my_callbacks[x]) { 132 my_callbacks[x](); 133 my_callbacks[x] = false; 134 } 135 } 136} 137 138function loadPage(url, divclass) { 139 NProgress.done(); 140 NProgress.start(); 141 if (prevAjax) { 142 prevAjax.abort(); 143 } 144 prevAjax = $.ajax({
145 url: url, 146 dataType: 'html', 147 xhrFields: { 148 onprogress: function (e) { 149 if (e.lengthComputable) { 150 NProgress.set(e.loaded / e.total); 151 } 152 } 153 }, 154 success: function (response) { 155 sunsite_before_load(); 156 var result = document.createElement( 'html' ); 157 var clear_result = document.createElement( 'html' ); 158 result.innerHTML = clear_result.innerHTML = response; 159 160 if (typeof(divclass) == 'undefined') { 161 divclass = 'sbody'; 162 } 163 var clear_scripts = clear_result.getElementsByTagName('script'); 164 for(var x in clear_scripts) { 165 if (clear_scripts[x].id) { 166 clear_scripts[x].parentNode.removeChild(clear_scripts[x]); 167 } 168 } 169 document.title = result.getElementsByTagName('title').item(0).innerHTML; 170 var meta_description = $(result).find('meta[name=description]').attr('content'); 171 if(typeof meta_description !== 'undefined') { 172 $('meta[name=description]').attr('content', meta_description); 173 } 174 175 $('.js-meta').remove(); 176 $(result).find('.js-meta').each(function() { 177 $('head').append($(this)); 178 }); 179 180 $('div.'+divclass).html(clear_result.getElementsByClassName(divclass).item(0).innerHTML); 181 // ÐÑÑавлÑÑм ÑкÑÑпÑи з id в head 182 var scripts = result.getElementsByTagName('script'); 183 for(var x in scripts) { 184 if (scripts[x].id) { 185 $("#" + scripts[x].id).remove(); 186 $("head").append(scripts[x]); 187 } 188 } 189 NProgress.done(); 190 if (typeof ga == 'function') { 191 ga('send', 'pageview', location.pathname); 192 } 193 sunsite_after_load(); 194 }, 195 complete: function (response, status) { 196 if (status == "error") { 197 var result = document.createElement( 'html' ); 198 result.innerHTML = response.responseText; 199 if (typeof(div) == 'undefined') { 200 div = 'sbody'; 201 } 202 $('div.'+div).html(result.getElementsByClassName(div).item(0).innerHTML); 203 document.title = result.getElementsByTagName('title').item(0).innerHTML; 204 var scripts = result.getElementsByTagName('script'); 205 for(var x in scripts) { 206 if (scripts[x].id) { 207 $("head").append(scripts[x]); 208 } 209 } 210 NProgress.done(); 211 sunsite_after_load(); 212 } 213 } 214 }); 215} 216 217function sunsite_actions() { 218 $('.sunsite_actions').each(function () { 219 if ($(this).data('action')) { 220 if ($.inArray($(this).data('action'), actions_url) == -1) actions_url.push($(this).data('action')); 221 if (!actions_post[$(this).data('action')]) actions_post[$(this).data('action')] = []; 222 actions_post[$(this).data('action')].push($(this).data()); 223 } 224 }); 225 if (actions_url.length > 0) { 226 $.ajax({ type: 'POST', xhrFields: { withCredentials: true }, url: http_addr + '/actions/'+actions_url.join('/'), data: actions_post, dataType: 'json', 227 success: function(data, textStatus, XMLHttpRequest) { 228 data = (typeof data == 'string' ? $.parseJSON( data ) : data); 229 for(var action in data){ 230 if (data[action] && data[action]['success']) { 231 if (typeof window['sunsite_action_'+action] === "function") { 232 window['sunsite_action_'+action](data[action].result); 233 } else { 234 console.log("Action's handler not founded! Action = "+action); 235 } 236 } else { 237 console.log("Action result id false! Action = "+action); 238 } 239 } 240 actions_url = []; 241 actions_post = {}; 242 } 243 }); 244 } 245} 246 247function sunsite_before_load() {} 248 249function sunsite_after_load() { 250 sunsite_actions(); 251 for(var init in sunsite_inits){ 252 if (typeof sunsite_inits[init] === "function") { 253 sunsite_inits[init](); 254 } 255 } 256} 257 258var profile_data; 259var editor_data = []; 260var sunsite_action_profile = function(data){ 261 data = typeof data === 'string' ? JSON.parse(data) : data; 262 profile_data = data; 263 264 if (typeof(data.groupid) !== 'undefined') { 265 if (data.groupid & 8 | data.groupid & 2 | data.groupid & 4 ){ 266 $('[data-edit]').each(function () { 267 var $this = $(this); 268 var edit = ($this.data('edit') || '').split(','); 269 if ($this.next('.js-edit').length === 0) { 270 $this.after('<a target="_blank" href="' + http_addr + '/sunsite/#/sunsite/content/sitetree/#/sunsite/utils/contedit/' + 271 edit[0] + '/' + edit[1] + '.html" class="js-edit">â</a>'); 272 } 273 }); 274 $('.js-edit').hover(function() { 275 var $this = $(this); 276 var absnum = parseInt((($this.prev().data('edit') || '').split(','))[0]) || 0; 277 if (absnum > 0) { 278 if (typeof editor_data[absnum] != 'undefined') { 279 show_editor_info($this, editor_data[absnum]); 280 } else { 281 $.get('/sunsite/utils/actions/article_info', {absnum: absnum}, function(info) { 282 var info = typeof info === 'string' ? JSON.parse(info) : info; 283 if (info.article_info.success) { 284 editor_data[absnum] = info.article_info.result; 285 show_editor_info($this, editor_data[absnum]); 286 } 287 }); 288 } 289 } 290 }, function() { 291 hide_editor_info(); 292 }); 293 } 294 } 295 296 /*if(typeof data.absnum === 'undefined' || !(data.absnum > 0 || data.major_ip)){ 297 sunsite_inits['add_this'] = addthis_init; 298 addthis_init(); 299 }*/ 300}; 301 302function check_subdomain(href) { 303 let split = window.location.host.split('.'); 304 let sbd = split.length >= 3 ? split[0] : null; 305 306 if(sbd) { 307 window.location = href; 308 return true; 309 } 310 311 return false; 312} 313 314function show_editor_info($el, data) { 315 var offs = $el.offset(); 316 if ($('#popup-editor-info').length == 0) { 317 $('<div/>', {'id': 'popup-editor-info'}).appendTo($('body:eq(0)')); 318 } 319 $('#popup-editor-info').html( 320 '<ul>' 321 + '<li><span>ÐÑоÑмоÑÑов:</span><span>' + (data.views || 0) + '</span></li>' 322 + '<li><span>Создано:</span><span>' + (data.created || '') + '</span></li>' 323 + '<li><span>ÐодиÑиÑиÑовано:</span><span>' + (data.changed || '') + '</span></li>' 324 + '<li><span>ÐвÑоÑ:</span><span>' + (data.firstname + ' ' + data.lastname) + '</span></li>' 325 +'</ul>' 326 ).css({ 327 'left': parseInt(offs.left + 30) + 'px', 328 'top': parseInt(offs.top) + 'px', 329 'z-index': 1000 330 }).show(); 331} 332 333function hide_editor_info() { 334 $('#popup-editor-info').hide(); 335} 336 337load_srcs(['/user/js/jquery-3.5.1.min.js'],function(){ 338 sunsite_actions(); 339 load_srcs(['/user/js/jquery.history.js', '/user/js/nprogress.min.js', '/user/css/nprogress.css'], function() { 340 $('body:eq(0)').on('click', 'a', function(event) { 341 var $this = $(this); 342 var href = $this.attr('href') || ''; 343 var component_url = href.split(/[#]/); 344 345 if(component_url.length > 1){ 346 href = component_url[0]; 347 sunsite_anchor = component_url[1];
348 349 if(href.length == 0){ 350 href = window.location.pathname; 351 } 352 353 if(href == window.location.pathname) { 354 sunsite_loaded = location.protocol + '//' + location.host + href; 355 window.location.hash = '#' + sunsite_anchor; 356 sunsite_anchor = ''; 357 358 return false; 359 } 360 } 361 362 if (event.ctrlKey || event.which == 2) { 363 window.open((href.indexOf('http') != 0 ? location.protocol + '//' + location.host : '') + href,'_blank'); 364 return false; 365 } 366 367 if ( href == '' || href.substr(0, 1) == '#' ){ 368 return false; 369 } else if ( $this.prop('download') || ['_blank', '_parent', '_top'].indexOf($this.attr('target') || '') != -1) { 370 return true; 371 } 372 373 /* fix */ 374 if(check_subdomain(href)) { 375 return true; 376 } 377 378 if (((href.substr(0, 2) !== '//' && href.substr(0, 1) === '/') || href.indexOf(location.protocol + '//' + location.host) == 0) && (['.jpg', '.jpeg', '.png', '.pdf'].indexOf(href.split('.').pop() == -1))) { 379 event.preventDefault(); 380 window.History.pushState(null, document.title, decodeURIComponent(href)); 381 if($(window).scrollTop() > 355) { 382 $('html, body').animate({scrollTop: 0}, 'fast'); 383 } 384 385 return true; 386 } else if (location.host.indexOf(root_domain) != -1) { 387 window.location = href; 388 return true; 389 } else { 390 return true; 391 } 392 }); 393 394 var History = window.History; 395 396 window.onpopstate = function (e) { 397 var State = History.getState(); 398 var component_url = State.url.split(/[#]/); 399 400 if(component_url.length > 1) { 401 State.url = component_url[0]; 402 } 403 404 if(sunsite_loaded != State.url) { 405 sunsite_loaded = State.url; 406 loadPage(State.url); 407 } 408 }; 409 410 }); 411}); 412 413if (typeof loadsrcscache == 'object') { 414 for (var i in loadsrcscache) { 415 load_srcs(loadsrcscache[i][0], loadsrcscache[i][1]); 416 } 417}
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.