/********************************* MyBB.ru, Уведомление о Вновь вошедших на форум! Версия: V0.1 Автор: Deff Дата: 23.06.2020 Последние изменения: 23.06.2020 *********************************/ (function(onlineUrl) { if(!window.сколько_онлайн_ON )window.сколько_онлайн_ON = 0; var a = $getCookie("clearStore"); if (!a) { delete localStorage.PageIndent; delete localStorage.Archive_UserOnline; $setCookie("clearStore", 1); delete localStorage.N_user; setTimeout(function(){Get_Incoming_Users();}, 2000); } var PageIndent = []; var del = 1; function get_set_indentPage(in_RequestTime, del) { try {if (!localStorage.PageIndent) localStorage.setItem('PageIndent',JSON.stringify(PageIndent)); PageIndent = JSON.parse(localStorage.PageIndent); var ind = PageIndent.indexOf(in_RequestTime); if (ind != -1) PageIndent.splice(ind, 1); if (!del) PageIndent.unshift(in_RequestTime); localStorage.setItem('PageIndent',JSON.stringify(PageIndent)); //alert(localStorage.PageIndent); } catch (e) {} } get_set_indentPage(RequestTime); function get_PageIndent() { try {PageIndent = JSON.parse(localStorage.PageIndent);} catch (e) {} } /*Видимость/невидимость Вкладки Браузера с выводом победителе!*/ // При первом входе на страницу Событие(ниже) не работает! $(document).on('visibilitychange', function() { if (document.visibilityState == 'visible') { get_set_indentPage(RequestTime); } }); $(window).on("beforeunload", function() { try {get_set_indentPage(RequestTime, del);} catch (e) {} }); var busy = 0; var b; /*МЕНЯЕМ/МИГАЕМ favicon И title*/ function change_title_And_favicon(N){ if(busy) return; busy = 1; var a = 0; var b = [$('head > link[rel="shortcut icon"]')[0].href,document.title]; //.replace(/^\d+ • /,'') function seticon(N){//alert([цикл_[2*(a%2)],цикл_[1 + 2*(a%2)]]) $('head > link[rel="shortcut icon"]')[0].href = цикл_[2*(a%2)]; document.title = '[+'+ N +'] '+цикл_[1 + 2*(a%2)]; ++a; if(a>6){ $('head > link[rel="shortcut icon"]')[0].href = b[0]; document.title = b[1]; return busy = 0; } setTimeout(function(){seticon(N)}, 1000); } seticon(N); } var Archive_UserOnline; function Check_newVisitors(User_On) { try { if (!!localStorage.Archive_UserOnline) Archive_UserOnline = JSON.parse(localStorage.Archive_UserOnline); else Archive_UserOnline = {} } catch (e) { Archive_UserOnline = {} } if (!Archive_UserOnline && !Object.keys(Archive_UserOnline).length) { Archive_UserOnline = JSON.parse(JSON.stringify(User_On)); localStorage.setItem('Archive_UserOnline', JSON.stringify(User_On)); return; } var listUserLength = 0; for (var key in User_On) { if (!!window.UserID && +key == UserID) continue; if (!Archive_UserOnline[key]) ++listUserLength; } function kyky() { var ky = new Audio(zvyk_kyky); ky.play(); }; if(listUserLength)kyky(); localStorage.setItem('Archive_UserOnline', JSON.stringify(User_On)); Archive_UserOnline = JSON.parse(localStorage.Archive_UserOnline); if (listUserLength) { delete localStorage.listUserLength; //ОБЯЗАТЕЛЬНО СТИРАТЬ, ЧТОБЫ ВОЗНИКЛО СОБЫТИЕ 'storage' при равенстве старого и нового ЗНАЧЕНИЯ!!!// localStorage.setItem('listUserLength',listUserLength); change_title_And_favicon(listUserLength); } }; var UsOnline; var N_user = 0; function Get_Incoming_Users() { $.get(onlineUrl, function(cnt) { //cors-anywhere.herokuapp.com cnt = '
' + cnt.split(/\n\n
/gi)[1].split('