// ===================================================================== // # Carou TNS and settings var tns=function(){var t=window,Ai=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||function(t){return setTimeout(t,16)},e=window,Ni=e.cancelAnimationFrame||e.mozCancelAnimationFrame||function(t){clearTimeout(t)};function Li(){for(var t,e,n,i=arguments[0]||{},a=1,r=arguments.length;a";return r.innerHTML=o,a.appendChild(r),n.appendChild(a),t=Math.abs(a.getBoundingClientRect().left-r.children[67].getBoundingClientRect().left)<2,n.fake?Di(n,i):a.remove(),t}(),n),D=e.tMQ?Bi(e.tMQ):Si(e,"tMQ",function(){if(window.matchMedia||window.msMatchMedia)return!0;var t,e=document,n=Hi(),i=Oi(n),a=e.createElement("div"),r=e.createElement("style"),o="@media all and (min-width:1px){.tns-mq-test{position:absolute}}";return r.type="text/css",a.className="tns-mq-test",n.appendChild(r),n.appendChild(a),r.styleSheet?r.styleSheet.cssText=o:r.appendChild(e.createTextNode(o)),t=window.getComputedStyle?window.getComputedStyle(a).position:a.currentStyle.position,n.fake?Di(n,i):a.remove(),"absolute"===t}(),n),r=e.tTf?Bi(e.tTf):Si(e,"tTf",Ki("transform"),n),o=e.t3D?Bi(e.t3D):Si(e,"t3D",function(t){if(!t)return!1;if(!window.getComputedStyle)return!1;var e,n=document,i=Hi(),a=Oi(i),r=n.createElement("p"),o=9=-St)return t}:function(){return at&&I&&!ft?Q-1:ft||I?Math.max(0,Lt-Math.ceil(rt)):Lt-1},It=en(sn("startIndex")),Pt=It,zt=(tn(),0),Wt=$?null:Rt(),qt=H.preventActionWhenRunning,Ft=H.swipeAngle,jt=!Ft||"?",Vt=!1,Gt=H.onInit,Qt=new Zi,Xt=" tns-slider tns-"+H.mode,Yt=V.id||(S=window.tnsId,window.tnsId=S?S+1:1,"tns"+window.tnsId),Kt=sn("disable"),Jt=!1,Ut=H.freezable,_t=!(!Ut||$)&&Tn(),Zt=!1,$t={click:oi,keydown:function(t){t=pi(t);var e=[a.LEFT,a.RIGHT].indexOf(t.keyCode);0<=e&&(0===e?we.disabled||oi(t,-1):Ce.disabled||oi(t,1))}},te={click:function(t){if(Vt){if(qt)return;ai()}var e=hi(t=pi(t));for(;e!==Ae&&!qi(e,"data-nav");)e=e.parentNode;if(qi(e,"data-nav")){var n=Se=Number(Fi(e,"data-nav")),i=tt||$?n*Q/Le:n*rt,a=le?n:Math.min(Math.ceil(i),Q-1);ri(a,t),He===n&&(Pe&&fi(),Se=-1)}},keydown:function(t){t=pi(t);var e=O.activeElement;if(!qi(e,"data-nav"))return;var n=[a.LEFT,a.RIGHT,a.ENTER,a.SPACE].indexOf(t.keyCode),i=Number(Fi(e,"data-nav"));0<=n&&(0===n?0"," animation"];if(ce||fe)var Qe,Xe,Ye={},Ke={},Je=!1,Ue=F?function(t,e){return t.x-e.x}:function(t,e){return t.y-e.y};$||$e(Kt||_t),r&&(Ot=r,Dt="translate",o?(Dt+=F?"3d(":"3d(0px, ",kt=F?", 0px, 0px)":", 0px)"):(Dt+=F?"X(":"Y(",kt=")")),I&&(V.className=V.className.replace("tns-vpfix","")),function(){ln("gutter");T.className="tns-outer",j.className="tns-inner",T.id=Yt+"-ow",j.id=Yt+"-iw",""===V.id&&(V.id=Yt);Xt+=g||$?" tns-subpixel":" tns-no-subpixel",Xt+=y?" tns-calc":" tns-no-calc",$&&(Xt+=" tns-autowidth");Xt+=" tns-"+H.axis,V.className+=Xt,I?((M=O.createElement("div")).id=Yt+"-mw",M.className="tns-ovh",T.appendChild(M),M.appendChild(j)):T.appendChild(j);if(dt){var t=M||j;t.className+=" tns-ah"}if(E.insertBefore(T,V),j.appendChild(V),Ii(G,function(t,e){zi(t,"tns-item"),t.id||(t.id=Yt+"-item"+e),!I&&W&&zi(t,W),ji(t,{"aria-hidden":"true",tabindex:"-1"})}),Nt){for(var e=O.createDocumentFragment(),n=O.createDocumentFragment(),i=Nt;i--;){var a=i%Q,r=G[a].cloneNode(!0);if(zi(r,ve),Vi(r,"id"),n.insertBefore(r,n.firstChild),I){var o=G[Q-1-a].cloneNode(!0);zi(o,ve),Vi(o,"id"),e.appendChild(o)}}V.insertBefore(e,V.firstChild),V.appendChild(n),G=V.children}}(),function(){if(!I)for(var t=It,e=It+Math.min(Q,rt);t .tns-item","font-size:"+m.getComputedStyle(G[0]).fontSize+";",Ri(Mt)),ki(Mt,"#"+Yt,"font-size:0;",Ri(Mt))):I&&Ii(G,function(t,e){var n;t.style.marginLeft=(n=e,y?y+"("+100*n+"% / "+Lt+")":100*n/Lt+"%")}));if(D){if(x){var i=M&&H.autoHeight?hn(H.speed):"";ki(Mt,"#"+Yt+"-mw",i,Ri(Mt))}i=cn(H.edgePadding,H.gutter,H.fixedWidth,H.speed,H.autoHeight),ki(Mt,"#"+Yt+"-iw",i,Ri(Mt)),I&&(i=F&&!$?"width:"+fn(H.fixedWidth,H.gutter,H.items)+";":"",x&&(i+=hn(st)),ki(Mt,"#"+Yt,i,Ri(Mt))),i=F&&!$?dn(H.fixedWidth,H.gutter,H.items):"",H.gutter&&(i+=vn(H.gutter)),I||(x&&(i+=hn(st)),b&&(i+=mn(st))),i&&ki(Mt,"#"+Yt+" > .tns-item",i,Ri(Mt))}else{I&&dt&&(M.style[x]=st/1e3+"s"),j.style.cssText=cn(et,nt,tt,dt),I&&F&&!$&&(V.style.width=fn(tt,nt,rt));var i=F&&!$?dn(tt,nt,rt):"";nt&&(i+=vn(nt)),i&&ki(Mt,"#"+Yt+" > .tns-item",i,Ri(Mt))}if(k&&D)for(var a in k){a=parseInt(a);var r=k[a],i="",o="",u="",l="",s="",c=$?null:sn("items",a),f=sn("fixedWidth",a),d=sn("speed",a),v=sn("edgePadding",a),p=sn("autoHeight",a),h=sn("gutter",a);x&&M&&sn("autoHeight",a)&&"speed"in r&&(o="#"+Yt+"-mw{"+hn(d)+"}"),("edgePadding"in r||"gutter"in r)&&(u="#"+Yt+"-iw{"+cn(v,h,f,d,p)+"}"),I&&F&&!$&&("fixedWidth"in r||"items"in r||tt&&"gutter"in r)&&(l="width:"+fn(f,h,c)+";"),x&&"speed"in r&&(l+=hn(d)),l&&(l="#"+Yt+"{"+l+"}"),("fixedWidth"in r||tt&&"gutter"in r||!I&&"items"in r)&&(s+=dn(f,h,c)),"gutter"in r&&(s+=vn(h)),!I&&"speed"in r&&(x&&(s+=hn(d)),b&&(s+=mn(d))),s&&(s="#"+Yt+" > .tns-item{"+s+"}"),(i=o+u+l+s)&&Mt.insertRule("@media (min-width: "+a/16+"em) {"+i+"}",Mt.cssRules.length)}}(),yn();var _e=ft?I?function(){var t=zt,e=Wt;t+=ot,e-=ot,et?(t+=1,e-=1):tt&&(it+nt)%(tt+nt)&&(e-=1),Nt&&(e=parseInt(i)&&t in k[i]&&(n=k[i][t]);return"slideBy"===t&&"page"===n&&(n=sn("items")),I||"slideBy"!==t&&"items"!==t||(n=Math.floor(n)),n}function cn(t,e,n,i,a){var r="";if(void 0!==t){var o=t;e&&(o-=e),r=F?"margin: 0 "+o+"px 0 "+t+"px;":"margin: "+t+"px 0 "+o+"px 0;"}else if(e&&!n){var u="-"+e+"px";r="margin: 0 "+(F?u+" 0 0":"0 "+u+" 0")+";"}return!I&&a&&x&&i&&(r+=hn(i)),r}function fn(t,e,n){return t?(t+e)*Lt+"px":y?y+"("+100*Lt+"% / "+n+")":100*Lt/n+"%"}function dn(t,e,n){var i;if(t)i=t+e+"px";else{I||(n=Math.floor(n));var a=I?Lt:n;i=y?y+"(100% / "+a+")":100/a+"%"}return i="width:"+i,"inner"!==R?i+";":i+" !important;"}function vn(t){var e="";!1!==t&&(e=(F?"padding-":"margin-")+(F?"right":"bottom")+": "+t+"px;");return e}function pn(t,e){var n=t.substring(0,t.length-e).toLowerCase();return n&&(n="-"+n+"-"),n}function hn(t){return pn(x,18)+"transition-duration:"+t/1e3+"s;"}function mn(t){return pn(b,17)+"animation-duration:"+t/1e3+"s;"}function yn(){if(ln("autoHeight")||$||!F){var t=V.querySelectorAll("img");Ii(t,function(t){var e=t.src;Tt||(e&&e.indexOf("data:image")<0?(t.src="",Ui(t,he),zi(t,"loading"),t.src=e):kn(t))}),Ai(function(){zn(Gi(t),function(){L=!0})}),ln("autoHeight")&&(t=In(It,Math.min(It+rt-1,Lt-1))),Tt?gn():Ai(function(){zn(Gi(t),gn)})}else I&&$n(),bn(),wn()}function gn(){if($&&1slide '+Hn()+" of "+Q+""),B=T.querySelector(".tns-liveregion .current"),se){var t=gt?"stop":"start";je?ji(je,{"data-action":t}):H.autoplayButtonOutput&&(T.insertAdjacentHTML(on(H.autoplayPosition),'"),je=T.querySelector("[data-action]")),je&&Ui(je,{click:di}),gt&&(ci(),wt&&Ui(V,ee),Ct&&Ui(V,ne))}if(ue){if(Ae)ji(Ae,{"aria-label":"Carousel Pagination"}),Ii(Ee=Ae.children,function(t,e){ji(t,{"data-nav":e,tabindex:"-1","aria-label":ke+(e+1),"aria-controls":Yt})});else{for(var e="",n=le?"":'style="display:none"',i=0;i';e='
'+e+"
",T.insertAdjacentHTML(on(H.navPosition),e),Ae=T.querySelector(".tns-nav"),Ee=Ae.children}if(Ti(),x){var a=x.substring(0,x.length-18).toLowerCase(),r="transition: all "+st/1e3+"s";a&&(r="-"+a+"-"+r),ki(Mt,"[aria-controls^="+Yt+"-item]",r,Ri(Mt))}ji(Ee[He],{"aria-label":ke+(He+1)+Re}),Vi(Ee[He],"tabindex"),zi(Ee[He],De),Ui(Ae,te)}oe&&(xe||we&&Ce||(T.insertAdjacentHTML(on(H.controlsPosition),'
"),xe=T.querySelector(".tns-controls")),we&&Ce||(we=xe.children[0],Ce=xe.children[1]),H.controlsContainer&&ji(xe,{"aria-label":"Carousel Navigation",tabindex:"0"}),(H.controlsContainer||H.prevButton&&H.nextButton)&&ji([we,Ce],{"aria-controls":Yt,tabindex:"-1"}),(H.controlsContainer||H.prevButton&&H.nextButton)&&(ji(we,{"data-controls":"prev"}),ji(Ce,{"data-controls":"next"})),ye=Qn(we),ge=Qn(Ce),Kn(),xe?Ui(xe,$t):(Ui(we,$t),Ui(Ce,$t))),An()}function wn(){if(I&&s){var t={};t[s]=ai,Ui(V,t)}mt&&Ui(V,ae,H.preventScrollOnTouch),yt&&Ui(V,re),lt&&Ui(O,ie),"inner"===R?Qt.on("outerResized",function(){Mn(),Qt.emit("innerLoaded",Ei())}):(k||tt||$||dt||!F)&&Ui(m,{resize:Cn}),dt&&("outer"===R?Qt.on("innerLoaded",Pn):Kt||Pn()),Dn(),Kt?Bn():_t&&Ln(),Qt.on("indexChanged",Wn),"inner"===R&&Qt.emit("innerLoaded",Ei()),"function"==typeof Gt&&Gt(Ei()),Y=!0}function Cn(t){Ai(function(){Mn(pi(t))})}function Mn(t){if(Y){"outer"===R&&Qt.emit("outerResized",Ei(t)),X=rn();var e,n=q,i=!1;k&&(En(),(e=n!==q)&&Qt.emit("newBreakpointStart",Ei(t)));var a,r,o,u,l=rt,s=Kt,c=_t,f=lt,d=vt,v=ht,p=mt,h=yt,m=gt,y=wt,g=Ct,x=It;if(e){var b=tt,w=dt,C=pt,M=at,T=bt;if(!D)var E=nt,A=et}if(lt=sn("arrowKeys"),vt=sn("controls"),ht=sn("nav"),mt=sn("touch"),at=sn("center"),yt=sn("mouseDrag"),gt=sn("autoplay"),wt=sn("autoplayHoverPause"),Ct=sn("autoplayResetOnVisibility"),e&&(Kt=sn("disable"),tt=sn("fixedWidth"),st=sn("speed"),dt=sn("autoHeight"),pt=sn("controlsText"),bt=sn("autoplayText"),xt=sn("autoplayTimeout"),D||(et=sn("edgePadding"),nt=sn("gutter"))),$e(Kt),it=un(),F&&!$||Kt||(jn(),F||(Ci(),i=!0)),(tt||$)&&(St=_n(),Wt=Rt()),(e||tt)&&(rt=sn("items"),ot=sn("slideBy"),(r=rt!==l)&&(tt||$||(Wt=Rt()),_e())),e&&Kt!==s&&(Kt?Bn():function(){if(!Jt)return;if(Mt.disabled=!1,V.className+=Xt,$n(),ft)for(var t=Nt;t--;)I&&Xi(G[t]),Xi(G[Lt-t-1]);if(!I)for(var e=It,n=It+Q;e .tns-item",S,Ri(Mt))}dt&&Pn(),i&&($n(),Pt=It)}e&&Qt.emit("newBreakpointEnd",Ei(t))}}function Tn(){if(!tt&&!$)return Q<=(at?rt-(rt-1)/2:rt);var t=tt?(tt+nt)*Q:N[Q],e=et?it+2*et:it+nt;return at&&(e-=tt?(it-tt)/2:(it-(N[It+1]-N[It]-nt))/2),t<=e}function En(){for(var t in q=0,k)(t=parseInt(t))<=X&&(q=t)}function An(){!gt&&je&&Qi(je),!ht&&Ae&&Qi(Ae),vt||(xe?Qi(xe):(we&&Qi(we),Ce&&Qi(Ce)))}function Nn(){gt&&je&&Xi(je),ht&&Ae&&Xi(Ae),vt&&(xe?Xi(xe):(we&&Xi(we),Ce&&Xi(Ce)))}function Ln(){if(!Zt){if(et&&(j.style.margin="0px"),Nt)for(var t="tns-transparent",e=Nt;e--;)I&&zi(G[e],t),zi(G[Lt-e-1],t);An(),Zt=!0}}function Bn(){if(!Jt){if(Mt.disabled=!0,V.className=V.className.replace(Xt.substring(1),""),Vi(V,["style"]),ft)for(var t=Nt;t--;)I&&Qi(G[t]),Qi(G[Lt-t-1]);if(F&&I||Vi(j,["style"]),!I)for(var e=It,n=It+Q;e=N[Lt-1])It=Wt;else for(var n=0;n=N[n];)e>N[It=n]&&a<0&&(It+=1),n++}ni(i,a),Qt.emit(mi(i)?"touchEnd":"dragEnd",Ei(i))}):jt&&oi(i,0{const textarea=document.getElementById("comments");if(textarea){const counter=document.createElement("div");counter.id="counter";counter.style.display="none";textarea.parentNode.appendChild(counter);const updateCounterAndMessage=()=>{const length=textarea.value.length;let text=`${length}`;const checkRange=(min,max,message)=>{return(length>=min&&length<=max)?message:null};text=checkRange(140,150,"Супер, коммент 👍")||checkRange(200,210,"Отличный объём 💪")||checkRange(280,290,"🚀 Избранный коммент")||text;counter.innerHTML=text;if(length>0){counter.style.display="block";}else{counter.style.display="none";}};textarea.addEventListener("input",updateCounterAndMessage);}}); const marquee = document.querySelector('#marquee'); marquee.onmouseover = () => marquee.style.animationPlayState = "paused", marquee.onmouseout = () => marquee.style.animationPlayState = "running"; document.querySelectorAll('.i_dottcom').forEach(el => { const next = el.nextElementSibling; if (next?.classList.contains('edithide')) { el.onclick = () => next.classList.toggle('active'); } }); // ===================================================================== // # Если не основных жанров игры // # выведем первый тег из apptag в жанрах document.addEventListener("DOMContentLoaded", () => { const genreBlock = document.querySelector('.ulgenre'), firstTag = document.querySelector('.apptag a'); if (!genreBlock || !firstTag || genreBlock.querySelector('a')) return; genreBlock.innerHTML = `Жанр: ${firstTag.textContent}`; }); // ===================================================================== // # Добавление emoji (() => { document.querySelectorAll('.smileicon').forEach(icon => icon.addEventListener('click', () => document.querySelector('.smile-podlogka')?.classList.toggle('active') ) ); window.addEmoji = emoji => { const ta = document.getElementById("comments"); const { selectionStart, selectionEnd } = ta; ta.setRangeText(emoji, selectionStart, selectionEnd, "end"); ta.focus(); ta.setSelectionRange(selectionStart + emoji.length, selectionStart + emoji.length); }; })(); // ===================================================================== // # Обновляем type_dist в зависимости от типа актуальной раздачи const acVer = document.querySelector('.ac_ver'); const gameVersion = document.querySelector('.acver_dist')?.textContent.trim(); const storageVersion = document.querySelector('.show_ver.storage')?.textContent.trim(); const torrentVersions = Array.from(document.querySelectorAll('.show_ver.torrent'), el => el.textContent.trim()); const typeDist = document.querySelector('.type_dist'); if (acVer && gameVersion === storageVersion && !torrentVersions.includes(gameVersion) && typeDist) { typeDist.textContent = 'Хранилище обновлено'; } // ===================================================================== // # night mode toggle document.addEventListener('DOMContentLoaded', () => { const html = document.documentElement, nightModeInput = document.querySelector('#night-mode'), theme = localStorage.getItem('theme-dark') ?? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'true' : 'false'), isDark = theme === 'true'; html.classList.remove('hidden'); html.classList.toggle('dark', isDark); nightModeInput && (nightModeInput.checked = isDark); window.changeTheme = () => { const isDark = !html.classList.contains('dark'); html.classList.toggle('dark', isDark); nightModeInput && (nightModeInput.checked = isDark); localStorage.setItem('theme-dark', isDark); }; }); // ===================================================================== // # все id="version" fix document.querySelectorAll('[id="version"]').forEach(el => { const prop = el instanceof HTMLInputElement ? 'value' : 'textContent'; const text = el[prop]; if (/^v\s*(demo|alpha|build|season|obt|chapter)/i.test(text)) { el[prop] = text.replace(/^v\s*/i, ''); } }); // ===================================================================== // # Переход и подсветка блока $('a[href^="#"]').on('click', function(e) { const target = $(this.hash); if (target.length) { e.preventDefault(); $('html, body').animate({ scrollTop: target.offset().top - 400 }, 1000); target.addClass('highlighted'); setTimeout(() => target.removeClass('highlighted'), 1500); } }); // ===================================================================== // # Подсветка комментария после дефолтного перехода $(() => { const match = window.location.hash.match(/#findcomment(\d+)/); if (match) { const $comment = $(`#comm-id-${match[1]}`); $comment.addClass('highlighted'); setTimeout(() => $comment.removeClass('highlighted'), 2000); } }); // ===================================================================== // # Ротация комментариев с Local Storage let current = 0, timer; const $comments = $('.rcomm_item'), $container = $('.commright'), GAP = 14, COUNT = 5, heights = $comments.toArray().map(el => $(el).outerHeight(true)), offset = i => heights.slice(0, i).reduce((s, h) => s + h + GAP, 0), setHeight = () => $container.height( heights.slice(current, current + COUNT).reduce((s, h, i, arr) => s + h + (i < arr.length - 1 ? GAP : 0), 0) ), scroll = () => { current = current > heights.length - COUNT ? 0 : current + 1; setHeight(); $container.animate({ scrollTop: offset(current) }, 1500); }, start = () => { if (timer) return; scroll(); timer = setTimeout(() => { timer = null; start(); }, 3500); }; setHeight(); (!localStorage.getItem('stopScrollingTime') || Date.now() - localStorage.getItem('stopScrollingTime') > 48 * 3600 * 1000) && start(); $container.hover(() => { clearTimeout(timer); localStorage.setItem('stopScrollingTime', Date.now()); }); // ===================================================================== // # Кликабельный год в полной новости document.addEventListener('DOMContentLoaded', () => document.querySelectorAll('.dateym').forEach(el => el.innerHTML = el.innerHTML.replace(/\b(199[0-9]|20(?:0\d|1\d|2[0-5]))\b/g, y => `${y}`) ) ); // ===================================================================== // # Переключение блока меток и жанров с Local Storage $(function(){ const ls = localStorage, s = ls.getItem('listState'), e = ls.getItem('listStateExpires'); e && Date.now() > e && (ls.removeItem('listState'), ls.removeItem('listStateExpires')); $('.lmenu-list').toggle(s !== 'list2'); $('.lmenu-list2').toggle(s === 'list2'); $('.open_alltag .genres').click(() => { $('.lmenu-list, .lmenu-list2').toggle(); ls.setItem('listState', $('.lmenu-list').is(':visible') ? 'list1' : 'list2'); ls.setItem('listStateExpires', Date.now() + 4 * 60 * 60 * 1000); $('html, body').animate({scrollTop: $('nav.block-right.menu').offset().top - 8}, 500); }); }); // ===================================================================== // # Переключение табов head carusel document.addEventListener('DOMContentLoaded', () => { const tabs = document.querySelectorAll('.carousp'); const contents = document.querySelectorAll('.tab1, .tab2'); document.addEventListener('click', e => { const tab = e.target.closest('.carousp'); if (!tab) return; tabs.forEach(t => t.classList.toggle('active', t === tab)); contents.forEach(c => c.style.display = c.classList.contains(tab.id.replace('tab-', '')) ? 'block' : 'none'); }); }); // ===================================================================== // # Apptag форматирование и скрытие меток // # Вывод / скрытие кнопки button_showtag в зависимости от кол-ва меток $(document).ready(function() { $('.apptag_ctn').each(function() { const $container = $(this); const $apptag = $container.find('.apptag'); const $tags = $apptag.find('a').addClass('hidetag'); const $button = $container.find('.button_showtag'); $apptag.contents().filter(function() { return this.nodeType === 3; }) .each(function() { this.nodeValue = this.nodeValue.replace(/,/g, ''); }); const firstTop = $tags.first().removeClass('hidetag').position().top; $tags.slice(1, 5).each(function() { if ($(this).removeClass('hidetag').position().top === firstTop) return; $(this).addClass('hidetag'); return false; }); if (!$apptag.find('.hidetag').length) $button.hide(); $button.click(() => $container.toggleClass('active') && false); }); }); // ===================================================================== // # AJAX навигация custom блоков const CustomNav = (function() { const blocksConfig = {}; function init() { executConfigScripts(); $(document).on('click', '.custom_block span[data-page]', function(e) { e.preventDefault(); const $btn = $(this); const $block = $btn.closest('.custom_block'); const blockId = $block.attr('id'); if (blocksConfig[blockId]) { loadPage(blockId, $btn.data('page'), $btn.data('next')); } }); $('.custom_block').each(function() {}); } function setConfig(blockId, config) { blocksConfig[blockId] = config; } function executConfigScripts() { $('script[type="text/x-custom-config"]').each(function() { try { new Function($(this).text())(); $(this).remove(); } catch (e) { console.error('Ошибка выполнения скрипта конфигурации:', e); } }); } function scrollToElement($element, offset = 0) { if ($element && $element.length) { $('html, body').animate({ scrollTop: $element.offset().top + offset }, 600); } } function loadPage(blockId, page, isNext) { const $block = $('#' + blockId); const config = blocksConfig[blockId]; if (!config) return; $.get(dle_root + 'engine/ajax/controller.php?mod=custom', { id: blockId, page, params: config.params, count: config.count, limit: config.limit, navtpl: config.navtpl, next: isNext ? 1 : 0 }).done(function(html) { if (isNext) { const itemsBefore = $block.children().not('.custom-navigation, script').length; const $temp = $('
').html(html); const $newNav = $temp.find('.custom-navigation'); $block.find('.custom-navigation').remove(); $newNav.remove(); $block.append($temp.html()).append($newNav); const $firstNew = $block.children().not('.custom-navigation, script').eq(itemsBefore); if ($firstNew.length) scrollToElement($firstNew, -20); executConfigScripts(); } else { $block.html(html); scrollToElement($block, -90); executConfigScripts(); } }); } return { init, loadPage, setConfig }; })(); $(function() { CustomNav.init(); }); // ===================================================================== // # Tabs в категориях с Local Storage document.addEventListener('DOMContentLoaded', () => { const btn = document.querySelector('.allcontent'); const tabs = document.querySelectorAll('.tab_group > div'); const el = document.querySelector('.catnewscount'); if (!btn || !tabs.length || !el || !el.id) return; const key = 'allcontent-' + el.id; const toggle = active => tabs.forEach(t => { const match = t.classList.contains('allcatgame'); t.classList.toggle('active', active && match); t.style.display = active && match ? '' : active ? 'none' : ''; }); const saved = localStorage.getItem(key) === 'true'; btn.classList.toggle('active', saved); toggle(saved); btn.addEventListener('click', () => { if (btn.classList.contains('active') && location.pathname.match(/\/page\/\d+\//)) { localStorage.setItem(key, false); location.href = location.pathname.replace(/\/page\/\d+\//g, '/'); return; } const active = btn.classList.toggle('active'); localStorage.setItem(key, active); toggle(active); }); }); // ===================================================================== // # Читать далее document.querySelectorAll('.cat_overflow').forEach(b => { const t = b.querySelector('.cat_overflow__text'); t.onclick = () => b.classList.toggle('expanded'); }); // ===================================================================== // # Форматирование catnewscount document.querySelectorAll('.catnewscount').forEach( el => el.textContent = Number(el.textContent).toLocaleString('ru-RU').replace(/\u00A0/g, '\u202F') ); // ===================================================================== // # Видео Steam document.addEventListener("DOMContentLoaded", () => { const elements = { autoplayToggle: document.getElementById('autoplayToggle'), autoplayContainer: document.querySelector('.autoplayToggle'), video1: document.querySelector('#video1 video'), video2: document.querySelector('#video2 video'), steamContainer: document.querySelector('.video_steam'), containers: document.querySelectorAll('.moviesteam'), switchBtn1: document.querySelector('.switch_video.one'), switchBtn2: document.querySelector('.switch_video.two') }; if (!elements.autoplayToggle || !elements.steamContainer || !elements.containers.length) return; const storage = { key: 'autoplaySetting', save: v => localStorage.setItem(storage.key, JSON.stringify(v)), load: () => JSON.parse(localStorage.getItem(storage.key) || 'false') }; const setVideoState = (video, autoplay) => { if (!video) return; video[autoplay ? 'play' : 'pause'](); video.toggleAttribute('autoplay', autoplay); }; elements.autoplayToggle.checked = storage.load(); setVideoState(elements.video1, elements.autoplayToggle.checked); elements.autoplayToggle.addEventListener('change', () => { const autoplay = elements.autoplayToggle.checked; setVideoState(elements.video1, autoplay); storage.save(autoplay); }); const loadHighQuality = container => { const video = container.querySelector('video'); if (!video || video.dataset.loaded) return; const videoId = video.querySelector('source')?.src.match(/\/(\d+)\/(microtrailer|movie_max)\./)?.[1]; if (!videoId) return; video.innerHTML = '' + ''; video.load(); video.play(); Object.assign(video, { controls: true, loop: false, muted: false }); video.dataset.loaded = 'true'; container.querySelector('.play_video')?.remove(); elements.autoplayContainer.remove(); elements.steamContainer.classList.add('play'); elements.containers.forEach(other => { if (other !== container) other.style.display = 'none'; }); container.removeEventListener('mouseenter', () => handleHover(container)); container.removeEventListener('mouseleave', () => handleLeave(container)); }; const handleHover = container => { const video = container.querySelector('video'); if (!video || video.dataset.loaded) return; container.hoverTimeout = setTimeout(() => video.play(), 1000); container.hideTimeout = setTimeout(() => elements.autoplayContainer.style.display = 'none', 2500); }; const handleLeave = container => { const video = container.querySelector('video'); if (!video || video.dataset.loaded) return; clearTimeout(container.hoverTimeout); clearTimeout(container.hideTimeout); video.pause(); elements.autoplayContainer.style.display = 'flex'; }; elements.containers.forEach(container => { container.addEventListener('mouseenter', () => handleHover(container)); container.addEventListener('mouseleave', () => handleLeave(container)); container.addEventListener('click', () => loadHighQuality(container)); }); const switchVideo = (show, hide) => { if (!show || !hide) return; hide.closest('.moviesteam').style.display = 'none'; hide.pause(); const showContainer = show.closest('.moviesteam'); showContainer.style.display = 'block'; show.dataset.loaded ? setVideoState(show, elements.autoplayToggle.checked) : loadHighQuality(showContainer); }; if (elements.switchBtn1 && elements.switchBtn2) { elements.switchBtn1.addEventListener('click', () => switchVideo(elements.video1, elements.video2)); elements.switchBtn2.addEventListener('click', () => switchVideo(elements.video2, elements.video1)); } }); // ===================================================================== // # Мобильное меню $(document).ready(() => { const $body = $('body'); const menuSelector = '.block-right.menu'; let $originalParent; const toggleMenu = () => $body.toggleClass('opened-menu').hasClass('opened-menu') ? openMenu() : closeMenu(); const openMenu = () => { $originalParent = $originalParent || $(menuSelector).parent(); const $panel = $('
').append($(menuSelector)); const $overlay = $('
').fadeIn(200).on('click', closeMenu); $body.append($overlay, $panel).find('.btn-menu').addClass('toggle-close'); }; const closeMenu = () => { const $panel = $('#side-panel').removeClass('active'); const $overlayToRemove = $('#close-overlay'); $overlayToRemove.fadeOut(200, () => { $(menuSelector).appendTo($originalParent); $panel.remove(); $overlayToRemove.remove(); }); $body.removeClass('opened-menu').find('.btn-menu').removeClass('toggle-close'); }; $('.btn-menu-wr').on('click', toggleMenu); }); // ===================================================================== // # Мобильная кнопка поиска $('#search_btn').click(function() { $('html').toggleClass("search_open");return false;}); // ===================================================================== // # Открытие / скрытие меток -> в правом меню сайта for (let i = 1; i <= 5; i++) $('.open_hidecat.md' + i).click(function() { $('.menu_hidecat.md' + i + ', .open_hidecat.md' + i).toggleClass('active'); return false; }); // ===================================================================== // # Открытие / закрытие выпадающих меню $(function(){ function Dropdown(selector, linkClass, menuClass, multiple){ this.el = $(selector) || {}; this.multiple = multiple || false; this.linkClass = linkClass; this.menuClass = menuClass; this.el.find(this.linkClass).on("click", {el: this.el, multiple: this.multiple, menuClass: this.menuClass}, this.toggleDropdown); } Dropdown.prototype.toggleDropdown = function(event){ var el = event.data.el; var $this = $(this); var $next = $this.next(); var menuClass = event.data.menuClass; $next.toggle(); $this.parent().toggleClass("open"); if(!event.data.multiple){ el.find(menuClass).not($next).hide().parent().removeClass("open"); } }; new Dropdown("#side-panel, .nav-menu", ".link", ".menu-headnav-list", false); new Dropdown(".menu-headnav-list", ".selyears", ".selyears-content", false); }); const setupToggle = (selector) => $(selector).click(function() { $(this).toggleClass('active'); var $panel = $(this).next(); $panel.css('display', $panel.css('display') === 'block' ? 'none' : 'block'); }); setupToggle(".head-right"); // ===================================================================== // # Youtube lazyframe (LiteYTEmbed) class LiteYTEmbed extends HTMLElement {connectedCallback(){this.videoId=this.getAttribute('videoid');let playBtnEl=this.querySelector('.lty-playbtn');this.playLabel=(playBtnEl&&playBtnEl.textContent.trim())||this.getAttribute('playlabel')||'Play';if(!this.style.backgroundImage){this.style.backgroundImage=`url("https://i.ytimg.com/vi/${this.videoId}/hqdefault.jpg")`;}if(!playBtnEl){playBtnEl=document.createElement('button');playBtnEl.type='button';playBtnEl.classList.add('lty-playbtn');this.append(playBtnEl);}if(!playBtnEl.textContent){const playBtnLabelEl=document.createElement('span');playBtnLabelEl.className='lyt-visually-hidden';playBtnLabelEl.textContent=this.playLabel;playBtnEl.append(playBtnLabelEl);}this.addEventListener('pointerover',LiteYTEmbed.warmConnections,{once:true});this.addEventListener('click',this.addIframe);}static addPrefetch(kind,url,as){const linkEl=document.createElement('link');linkEl.rel=kind;linkEl.href=url;if(as){linkEl.as=as;}document.head.append(linkEl);}static warmConnections(){if(LiteYTEmbed.preconnected)return;LiteYTEmbed.addPrefetch('preconnect','https://www.youtube-nocookie.com');LiteYTEmbed.addPrefetch('preconnect','https://www.google.com');LiteYTEmbed.addPrefetch('preconnect','https://googleads.g.doubleclick.net');LiteYTEmbed.addPrefetch('preconnect','https://static.doubleclick.net');LiteYTEmbed.preconnected=true;}addIframe(e){if(this.classList.contains('lyt-activated'))return;e.preventDefault();this.classList.add('lyt-activated');const params=new URLSearchParams(this.getAttribute('params')||[]);params.append('autoplay','1');const iframeEl=document.createElement('iframe');iframeEl.width=560;iframeEl.height=315;iframeEl.title=this.playLabel;iframeEl.allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture';iframeEl.allowFullscreen=true;iframeEl.src=`https://www.youtube-nocookie.com/embed/${encodeURIComponent(this.videoId)}?${params.toString()}`;this.append(iframeEl);iframeEl.focus();}}customElements.define('lite-youtube',LiteYTEmbed); // ===================================================================== // # Скрытие dist-dashboard document.addEventListener('DOMContentLoaded', () => { const dashboard = document.querySelector('.dist-dashboard'); if (!dashboard) return; if (localStorage.getItem('messageClosed') === 'true') { dashboard.style.display = 'none'; } else { document.querySelector('.dist-dashboard_close') .addEventListener('click', () => { dashboard.style.display = 'none'; localStorage.setItem('messageClosed', 'true'); }); } }); // ===================================================================== // # Group status document.addEventListener('DOMContentLoaded',()=>{const s=(k,v,t)=>localStorage.setItem(k,JSON.stringify({value:v,expiry:Date.now()+t})),g=k=>{const i=localStorage.getItem(k);if(!i)return null;const {value:v,expiry:e}=JSON.parse(i);if(Date.now()>e)return localStorage.removeItem(k),null;return v},t=document.querySelectorAll('.team_status'),v={day:[[2,3,4,5,6,7,8,9,10,11,12,13],[2,3,4,6,7,9,11,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29],[2,3,4,6,7,9,11,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39]],night:[[26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],[26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]]},p=[[0.73,0.27],[0.29,0.17],[0.22,0.11]],m=n=>n===1||(n%10===1&&n%100!==11)?'минуту':(n%10>=2&&n%10<=4&&(n%100<10||n%100>=20))?'минуты':'минут';t.forEach((e,i)=>{const c=g(`status-${i}`);if(c)return e.textContent=c;const h=(new Date().getUTCHours()+3)%24,d=h>=6&&h<=23,gp=i<2?0:i<=6?1:2,vs=v[d?'day':'night'][gp],pr=p[gp][d?0:1],val=Math.random()((s,t)=>s==='Только что'?0:parseInt(s,10))(a.querySelector('.team_status').textContent.split(': ')[1])-((s,t)=>s==='Только что'?0:parseInt(s,10))(b.querySelector('.team_status').textContent.split(': ')[1])).forEach(a=>document.querySelector('.team_site').appendChild(a))}); // ===================================================================== // # 1 Преобразование рейтинга Steam в рейтинг для сайта // # 1.1 в такой формат: 8.4 или случайно от 7.2 до 7.6 // # 2 присвоение цветовых классов в зависимости от значения // # 3 проверка/сохранение рейтинга из/в rating_stars.js const process = e => { let userRating = null; let gameId = null; // Ищем ближайший gameLink для получения ID игры let parent = e.parentNode; while (parent && !parent.querySelector('#gameLink')) { parent = parent.parentNode; } const gameLink = parent?.querySelector('#gameLink'); if (gameLink) { const match = gameLink.href.match(/\/(\d+)-/); if (match?.[1]) { gameId = match[1]; const data = JSON.parse(localStorage.getItem('ratingID_' + gameId) || '{}'); if (data.rating && data.expiration && new Date() < new Date(data.expiration)) { userRating = data.rating; } } } // Получаем или генерируем рейтинг const rating = userRating || (e.getAttribute('strating') ? (+e.getAttribute('strating') / 10).toFixed(1) : (Math.random() * 0.6 + 7.2).toFixed(1)); // Сохраняем сгенерированный рейтинг, если его не было и есть ID игры if (!userRating && !e.getAttribute('strating') && gameId) { const expirationDate = new Date(); expirationDate.setDate(expirationDate.getDate() + 4); localStorage.setItem('ratingID_' + gameId, JSON.stringify({ rating: rating, expiration: expirationDate, autoGenerated: true })); } // Всегда форматируем рейтинг с одним десятичным знаком e.textContent = parseFloat(rating).toFixed(1); e.classList.add(rating < 5 ? "rating_low" : rating < 7 ? "rating_medium" : rating < 7.6 ? "rating_high" : "rating_excellent"); e.removeAttribute('strating'); }; document.querySelectorAll('#rating').forEach(process); new MutationObserver(mutations => mutations.forEach(({addedNodes}) => addedNodes.forEach(n => n.nodeType === 1 && (n.matches('#rating') && process(n), n.querySelectorAll?.('#rating').forEach(process)) )) ).observe(document.body, {childList: true, subtree: true}); // ===========================BETA========================================== // # Bot Fight Rating + rating caching to reduce load document.addEventListener("DOMContentLoaded", () => { document.querySelectorAll(".ratingbox").forEach(box => { const rateLabel = box.querySelector(".ratelabel"); const currentRating = box.querySelector(".current-rating"); const ratingId = box.querySelector(".rate-stars").id; const storedKey = `ratingID_${ratingId}`; // Проверка голосования const storedData = JSON.parse(localStorage.getItem(storedKey) || '{}'); if (storedData.rating && storedData.expiration && new Date() < new Date(storedData.expiration)) { rateLabel.textContent = storedData.rating; currentRating.style.width = (parseFloat(storedData.rating) / 10) * 100 + "%"; } else if (storedData.expiration && new Date() < new Date(storedData.expiration)) { // Только запись о голосовании без изменения рейтинга null; // Ничего не делаем, оставляем текущий рейтинг } else if (localStorage.getItem(storedKey)) { localStorage.removeItem(storedKey); } currentRating.style.width = (parseFloat(rateLabel.textContent) / 10) * 100 + "%"; box.querySelector(".unit-rating").addEventListener("click", event => { ShowLoading('Загрузка...'); setTimeout(HideLoading, 1500); // Проверка повторного голосования const storedData = JSON.parse(localStorage.getItem(storedKey) || '{}'); // Игнорируем автоматически сгенерированные рейтинги if (storedData.autoGenerated) { localStorage.removeItem(storedKey); } else if (storedData.expiration && new Date() < new Date(storedData.expiration)) { return DLEPush.error('Вы уже оценили эту игру'); } const ratingMatch = event.target.className.match(/r(\d+)-unit/); if (!ratingMatch) return; const ratingValue = parseFloat(ratingMatch[1]); let currentRatingValue = parseFloat(rateLabel.textContent); let ratingChanged = false; // Заливка звезд currentRating.style.width = (ratingValue / 5) * 100 + "%"; currentRating.style.backgroundPosition = "0px -66px"; // Проверка изменения рейтинга const rand = Math.random(); let delta = rand < 0.22 ? 0.1 : (rand < 0.3 ? 0.2 : 0); if (delta > 0) { const direction = ratingValue > (currentRatingValue / 10) * 5 ? 1 : -1; if ((direction > 0 && currentRatingValue < 10) || (direction < 0 && currentRatingValue > 0)) { currentRatingValue = Math.max(0, Math.min(10, currentRatingValue + direction * delta)); rateLabel.textContent = currentRatingValue.toFixed(1); ratingChanged = true; } } // Запись в хранилище const expirationDate = new Date(); expirationDate.setDate(expirationDate.getDate() + 4); localStorage.setItem(storedKey, JSON.stringify(ratingChanged ? { rating: currentRatingValue.toFixed(1), expiration: expirationDate } : { expiration: expirationDate } )); DLEPush.info('Спасибо за вашу оценку'); }); }); }); // ===================================================================== // # Tooltips document.addEventListener("DOMContentLoaded", function () { const tooltip = document.createElement("div"); tooltip.id = "Tooltip"; document.body.appendChild(tooltip); tooltip.style.display = "none"; tooltip.style.position = "absolute"; document.addEventListener("mouseover", (e) => { const target = e.target.closest("[info]"); if (!target) return; const info = target.getAttribute("info"); tooltip.innerHTML = info; // Поддержка HTML-содержимого tooltip.style.top = `${e.pageY + 15}px`; tooltip.style.left = `${e.pageX + 10}px`; tooltip.style.display = "block"; }); document.addEventListener("mousemove", (e) => { tooltip.style.top = `${e.pageY + 15}px`; tooltip.style.left = `${e.pageX + 10}px`; }); document.addEventListener("mouseout", (e) => { if (e.target.closest("[info]")) { tooltip.style.display = "none"; } }); document.addEventListener("mousedown", () => { tooltip.style.display = "none"; }); }); // ===================================================================== // # Button_action document.addEventListener('DOMContentLoaded', () => { let clickedOnce = false; document.querySelectorAll("#scrollToComments").forEach(el => el.addEventListener("click", () => { const target = clickedOnce ? document.body.scrollHeight : document.getElementById("comm_line"); clickedOnce = !clickedOnce; if (target?.scrollIntoView) { target.scrollIntoView({behavior: "smooth"}); } else if (typeof target === "number") { window.scrollTo({top: target, behavior: "smooth"}); } }) ); document.getElementById("scrollToTop")?.addEventListener("click", () => { window.scrollTo({top: 0, behavior: "smooth"}); clickedOnce = false; }); }); // ===================================================================== // # Explicit контент (() => { const id = 'cat_1', key = 'cat1RemovedExpiry', exp = 2592000000; const rm = () => { document.querySelectorAll(`[id="${id}"]`).forEach(e => e.removeAttribute('id')); document.querySelectorAll('.explicit,.explicit_other').forEach(e => e.remove()); }; if (+localStorage.getItem(key) > Date.now()) return rm(); if (document.querySelector(`.main_content#${id}`)) { document.querySelectorAll('.poster-imgbox,.scrblock,.video_steam') .forEach(e => e.insertAdjacentHTML('beforeend', '
Да
')); document.querySelectorAll(`.si-games#${id} .imgbox`) .forEach(e => e.insertAdjacentHTML('beforeend', '
')); document.body.addEventListener('click', ({ target }) => { if (target.matches('.confirm_1') && target.textContent.trim() === 'Да') { rm(); localStorage.setItem(key, Date.now() + exp); } }); } })(); ;!function(i,e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):i.Fresco=e(jQuery)}(this,function($){var Fresco={};$.extend(Fresco,{version:"2.3.0"}),Fresco.Skins={fresco:{}};var Bounds={viewport:function(){var i={width:$(window).width()};if(Browser.MobileSafari||Browser.Android&&Browser.Gecko){var e=document.documentElement.clientWidth/window.innerWidth;i.height=window.innerHeight*e}else i.height=$(window).height();return i}},Browser=(e=navigator.userAgent,{IE:!(!window.attachEvent||-1!==e.indexOf("Opera"))&&f("MSIE "),Opera:-1i.width||h&&s.height>i.height);){var r=1,d=1;a&&s.width>i.width&&(r=i.width/s.width),h&&s.height>i.height&&(d=i.height/s.height),n=Math.min(r,d),s={width:e.width*n,height:e.height*n},o--}return s.width=Math.max(s.width,0),s.height=Math.max(s.height,0),s}};$.extend($.easing,{frescoEaseInCubic:function(i,e,t,s,n){return s*(e/=n)*e*e+t},frescoEaseInSine:function(i,e,t,s,n){return-s*Math.cos(e/n*(Math.PI/2))+s+t},frescoEaseOutSine:function(i,e,t,s,n){return s*Math.sin(e/n*(Math.PI/2))+t}});var Support=(O=document.createElement("div"),P="Webkit Moz O ms Khtml".split(" "),{canvas:(ba=document.createElement("canvas"),!(!ba.getContext||!ba.getContext("2d"))),css:{animation:S("animation"),transform:S("transform"),prefixed:function(i){return S(i,"prefix")}},svg:!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,touch:function(){try{return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}catch(i){return!1}}()}),ba,O,P;function S(i,e){var t=i.charAt(0).toUpperCase()+i.substr(1);return function(i,e){for(var t in i)if(void 0!==O.style[i[t]])return"prefix"!==e||i[t];return!1}((i+" "+P.join(t+" ")+t).split(" "),e)}Support.detectMobileTouch=function(){Support.mobileTouch=Support.touch&&(Browser.MobileSafari||Browser.Android||Browser.IEMobile||Browser.ChromeMobile||!/^(Win|Mac|Linux)/.test(navigator.platform))},Support.detectMobileTouch();var ImageReady=function(){return this.initialize.apply(this,Array.prototype.slice.call(arguments))};function Timers(){return this.initialize.apply(this,_slice.call(arguments))}function getURIData(s){var n={type:"image"};return $.each(Types,function(i,e){var t=e.data(s);t&&((n=t).type=i,n.url=s)}),n}function detectExtension(i){var e=(i||"").replace(/\?.*/g,"").match(/\.([^.]{3,4})$/);return e?e[1].toLowerCase():null}$.extend(ImageReady.prototype,{supports:{naturalWidth:"naturalWidth"in new Image},initialize:function(i,e,t){this.img=$(i)[0],this.successCallback=e,this.errorCallback=t,this.isLoaded=!1,this.options=$.extend({method:"naturalWidth",pollFallbackAfter:1e3},arguments[3]||{}),this.supports.naturalWidth&&"onload"!==this.options.method?this.img.complete&&"undefined"!==$.type(this.img.naturalWidth)?setTimeout($.proxy(function(){0=this.options.pollFallbackAfter&&!this._usedPollFallback&&(this._usedPollFallback=!0,this.fallback()),this._time>this.intervals[this._ipos][0]){if(!this.intervals[this._ipos+1])return void this.error();this._ipos++,this._delay=this.intervals[this._ipos][1]}this.poll()}},this),this._delay)},fallback:function(){var i=new Image;(this._fallbackImg=i).onload=$.proxy(function(){i.onload=function(){},this.supports.naturalWidth||(this.img.naturalWidth=i.width,this.img.naturalHeight=i.height),this.success()},this),i.onerror=$.proxy(this.error,this),i.src=this.img.src},abort:function(){this._fallbackImg&&(this._fallbackImg.onload=function(){}),this._polling&&(clearTimeout(this._polling),this._polling=null)},success:function(){this._calledSuccess||(this._calledSuccess=!0,this.isLoaded=!0,this.successCallback(this))},error:function(){this._calledError||(this._calledError=!0,this.abort(),this.errorCallback&&this.errorCallback(this))}}),$.extend(Timers.prototype,{initialize:function(){this._timers={}},set:function(i,e,t){this._timers[i]=setTimeout(e,t)},get:function(i){return this._timers[i]},clear:function(i){i?this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]):this.clearAll()},clearAll:function(){$.each(this._timers,function(i,e){clearTimeout(e)}),this._timers={}}});var Type={isVideo:function(i){return/^(youtube|vimeo)$/.test(i)}},Types={image:{extensions:"bmp gif jpeg jpg png webp",detect:function(i){return-1<$.inArray(detectExtension(i),this.extensions.split(" "))},data:function(i){return!!this.detect()&&{extension:detectExtension(i)}}},vimeo:{detect:function(i){var e=/(vimeo\.com)\/([a-zA-Z0-9-_]+)(?:\S+)?$/i.exec(i);return!(!e||!e[2])&&e[2]},data:function(i){var e=this.detect(i);return!!e&&{id:e}}},youtube:{detect:function(i){var e=/(youtube\.com|youtu\.be)\/watch\?(?=.*vi?=([a-zA-Z0-9-_]+))(?:\S+)?$/.exec(i);return e&&e[2]?e[2]:!(!(e=/(youtube\.com|youtu\.be)\/(vi?\/|u\/|embed\/)?([a-zA-Z0-9-_]+)(?:\S+)?$/i.exec(i))||!e[3])&&e[3]},data:function(i){var e=this.detect(i);return!!e&&{id:e}}}},VimeoThumbnail=function(){function i(){return this.initialize.apply(this,_slice.call(arguments))}$.extend(i.prototype,{initialize:function(i,e,t){this.url=i,this.successCallback=e,this.errorCallback=t,this.load()},load:function(){var i=s.get(this.url);if(i)return this.successCallback(i.data.url);var e="http"+(window.location&&"https:"===window.location.protocol?"s":"")+":",t=getURIData(this.url).id;this._xhr=$.getJSON(e+"//vimeo.com/api/oembed.json?url="+e+"//vimeo.com/"+t+"&callback=?",$.proxy(function(i){if(i&&i.thumbnail_url){var e={url:i.thumbnail_url};s.set(this.url,e),this.successCallback(e.url)}else this.errorCallback()},this))},abort:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)}});var s={cache:[],get:function(i){for(var e=null,t=0;t").addClass("fr-overlay").hide().append($("
").addClass("fr-overlay-background")),this.element.on("click",$.proxy(function(){var i=Pages.page;i&&i.view&&i.view.options.overlay&&!i.view.options.overlay.close||Window.hide()},this)),Support.mobileTouch&&this.element.addClass("fr-mobile-touch"),this.element.on("fresco:mousewheel",function(i){i.preventDefault()})},setSkin:function(i){this.skin&&this.element.removeClass("fr-overlay-skin-"+this.skin),this.element.addClass("fr-overlay-skin-"+i),this.skin=i},attach:function(){$(document.body).append(this.element)},detach:function(){this.element.detach()},show:function(i,e){if(this.visible)i&&i();else{this.visible=!0,this.attach(),this.max();var t=Pages.page&&Pages.page.view.options.effects.window.show||0,s=("number"===$.type(e)?e:t)||0;this.element.stop(!0).fadeTo(s,1,i)}},hide:function(i,e){if(this.visible){var t=Pages.page&&Pages.page.view.options.effects.window.hide||0,s=("number"===$.type(e)?e:t)||0;this.element.stop(!0).fadeOut(s||0,$.proxy(function(){this.detach(),this.visible=!1,i&&i()},this))}else i&&i()},getScrollDimensions:function(){var n={};return $.each(["width","height"],function(i,e){var t=e.substr(0,1).toUpperCase()+e.substr(1),s=document.documentElement;n[e]=(Browser.IE?Math.max(s["offset"+t],s["scroll"+t]):Browser.WebKit?document.body["scroll"+t]:s["scroll"+t])||0}),n},max:function(){var i;if(Browser.MobileSafari&&Browser.WebKit&&Browser.WebKit<533.18&&(i=this.getScrollDimensions(),this.element.css(i)),Browser.IE&&Browser.IE<9){var e=Bounds.viewport();this.element.css({height:e.height,width:e.width})}Support.mobileTouch&&!i&&this.element.css({height:this.getScrollDimensions().height})}},Window={initialize:function(){this.queues=[],this.queues.hide=$({}),this.pages=[],this._tracking=[],this._first=!0,this.timers=new Timers,this.build(),this.setSkin(Options.defaults.skin)},build:function(){if(this.element=$("
").addClass("fr-window fr-measured").hide().append(this._box=$("
").addClass("fr-box").append(this._pages=$("
").addClass("fr-pages"))).append(this._thumbnails=$("
").addClass("fr-thumbnails")),Overlay.initialize(),Pages.initialize(this._pages),Thumbnails.initialize(this._thumbnails),Spinner.initialize(),UI.initialize(),this.element.addClass("fr"+(Support.mobileTouch?"":"-no")+"-mobile-touch"),this.element.addClass("fr"+(Support.svg?"":"-no")+"-svg"),Browser.IE)for(var i=7;i<=9;i++)Browser.IE").addClass("fr-stroke fr-stroke-top fr-stroke-horizontal").append($("
").addClass("fr-stroke-color")).add($("
").addClass("fr-stroke fr-stroke-bottom fr-stroke-horizontal").append($("
").addClass("fr-stroke-color"))).add($("
").addClass("fr-stroke fr-stroke-left fr-stroke-vertical").append($("
").addClass("fr-stroke-color"))).add($("
").addClass("fr-stroke fr-stroke-right fr-stroke-vertical").append($("
").addClass("fr-stroke-color"))),$.extend(Oc.prototype,{initialize:function(i,e,t){this.view=i,this.dimensions={width:0,height:0},this.uid=Lc++,this._position=e,this._total=t,this._fullClick=!1,this._visible=!1,this.queues={},this.queues.showhide=$({})},create:function(){if(!this._created){Pages.element.append(this.element=$("
").addClass("fr-page").append(this.container=$("
").addClass("fr-container")).css({opacity:0}).hide());var i=this.view.options.position&&1").addClass("fr-info").append($("
").addClass("fr-info-background")).append(Nc.clone(!0)).append(this.infoPadder=$("
").addClass("fr-info-padder"))),i&&(this.element.addClass("fr-has-position"),this.infoPadder.append(this.pos=$("
").addClass("fr-position").append($("").addClass("fr-position-text").html(this._position+" / "+this._total)))),this.view.caption&&this.infoPadder.append(this.caption=$("
").addClass("fr-caption").html(this.view.caption))),this.container.append(this.background=$("
").addClass("fr-content-background")).append(this.content=$("
").addClass("fr-content")),"image"==this.view.type&&(this.content.append(this.image=$("").addClass("fr-content-element").attr({src:this.view.url})),this.content.append(Nc.clone(!0))),i&&"outside"==this.view.options.ui&&this.container.append(this.positionOutside=$("
").addClass("fr-position-outside").append($("
").addClass("fr-position-background")).append($("").addClass("fr-position-text").html(this._position+" / "+this._total))),"inside"==this.view.options.ui){this.content.append(this.previousInside=$("
").addClass("fr-side fr-side-previous fr-toggle-ui").append($("
").addClass("fr-side-button").append($("
").addClass("fr-side-button-background")).append($("
").addClass("fr-side-button-icon")))).append(this.nextInside=$("
").addClass("fr-side fr-side-next fr-toggle-ui").append($("
").addClass("fr-side-button").append($("
").addClass("fr-side-button-background")).append($("
").addClass("fr-side-button-icon")))).append(this.closeInside=$("
").addClass("fr-close fr-toggle-ui").append($("
").addClass("fr-close-background")).append($("
").addClass("fr-close-icon"))),(this.view.caption||i&&this.view.grouped.caption)&&(this.content.append(this.infoInside=$("
").addClass("fr-info fr-toggle-ui").append($("
").addClass("fr-info-background")).append(Nc.clone(!0)).append(this.infoPadderInside=$("
").addClass("fr-info-padder"))),i&&this.infoPadderInside.append(this.posInside=$("
").addClass("fr-position").append($("").addClass("fr-position-text").html(this._position+" / "+this._total))),this.view.caption&&this.infoPadderInside.append(this.captionInside=$("
").addClass("fr-caption").html(this.view.caption))),this.view.caption||!i||this.view.grouped.caption||this.content.append(this.positionInside=$("
").addClass("fr-position-inside fr-toggle-ui").append($("
").addClass("fr-position-background")).append($("").addClass("fr-position-text").html(this._position+" / "+this._total)));var e=this.view.options.loop&&1").addClass("fr-error fr-content-element").append($("
").addClass("fr-error-icon"))),this.element.addClass("fr-has-error"),this.setDimensions({width:this.error.outerWidth(),height:this.error.outerHeight()}),this.error.css({width:"100%",height:"100%"}),e&&e()},this),{method:this.view.options.loadedMethod});break;case"vimeo":this.vimeoReady=new VimeoReady(this.view.url,$.proxy(function(i){this._markAsLoaded(),this.setDimensions({width:i.dimensions.width,height:i.dimensions.height}),e&&e()},this));break;case"youtube":this._markAsLoaded(),this.setDimensions({width:this.view.options.width,height:this.view.options.height}),e&&e()}},setDimensions:function(i){if(this.dimensions=i,this.view.options.maxWidth||this.view.options.maxHeight){var e=this.view.options,t={width:e.maxWidth?e.maxWidth:this.dimensions.width,height:e.maxHeight?e.maxHeight:this.dimensions.height};this.dimensions=Fit.within(t,this.dimensions)}},_markAsLoaded:function(){this._abortSpinnerDelay(),this.loading=!1,this.loaded=!0,Mc[this.view.url]=!0,Spinner.hide(null,null,this._position)},isVideo:function(){return Type.isVideo(this.view.type)},insertVideo:function(i){if(!this.playerIframe&&this.isVideo()){var e="http"+(window.location&&"https:"===window.location.protocol?"s":"")+":",t=$.extend({},this.view.options[this.view.type]||{}),s=$.param(t),n={vimeo:e+"//player.vimeo.com/video/{id}?{queryString}",youtube:e+"//www.youtube.com/embed/{id}?{queryString}"}[this.view.type].replace("{id}",this.view._data.id).replace("{queryString}",s);this.content.prepend(this.playerIframe=$("