jQuery(document).ready(function () { if (window.innerWidth > 992) { disabilities(); } var wapoMainWindowWidth = $(window).width(); $('.sf-menu ul li').mouseover(function () { // checks if third level menu exist var subMenuExist = $(this).find('.dropdown').length; if (subMenuExist > 0) { var subMenuWidth = $(this).find('.dropdown').width(); var subMenuOffset = $(this).find('.dropdown').parent().offset().left + subMenuWidth; // if sub menu is off screen, give new position if ((subMenuOffset + subMenuWidth) > wapoMainWindowWidth) { var newSubMenuPosition = subMenuWidth + 3; $(this).find('.dropdown').css({ left: -newSubMenuPosition, top: '0', }); } } }); $('#scrolltop').click(function (e) { e.preventDefault; $('#top').animate({ scrollTop: 0 }, 600); // return false; }); }); $(window).bind("load", function () { enquire.register("screen and (min-width: 992px)", function () { /////////////// CONTENT HEIGHT var contentHeight = 0; if ($('.position-side-left').height() >= $('.position-side-right').height()) contentHeight = $('.position-side-left').height(); else contentHeight = $('.position-side-right').height(); if ($('.content').height() < contentHeight) $('.content').height(contentHeight - 15); }); $('.content-subpage-utilities-plus').on('click', function () { var fontsize = parseInt($('.content-subpage-text').css('font-size').replace(/px/g, '')); $('.content-subpage-text').css('font-size', fontsize + 1 + 'px'); for (var i = 6; i > 0; i--) { if ($('.content-subpage-text h' + i).length > 0) { var fontsize = parseInt($('.content-subpage-text h' + i).css('font-size').replace(/px/g, '')); $('.content-subpage-text h' + i).css('font-size', fontsize + 1 + 'px'); } }; }); $('.content-subpage-utilities-minus').on('click', function () { var fontsize = parseInt($('.content-subpage-text').css('font-size').replace(/px/g, '')); $('.content-subpage-text').css('font-size', fontsize - 1 + 'px'); for (var i = 6; i > 0; i--) { if ($('.content-subpage-text h' + i).length > 0) { var fontsize = parseInt($('.content-subpage-text h' + i).css('font-size').replace(/px/g, '')); $('.content-subpage-text h' + i).css('font-size', fontsize - 1 + 'px'); } }; }); /* WHCheckCookies(); $('#cookieRozumiem').click(function (e) { e.preventDefault(); WHCreateCookie('cookies_accepted', 'T', 365); $('#cookieBoxCont').fadeOut(); }); */ if (document.querySelector('#popup') && !WHReadCookie('interPop')) { const dialog = new A11yDialog(document.querySelector('#popup')); WHCreateCookie('interPop', 'popup', 1); dialog.on('show', () => (document.documentElement.style.overflowY = 'hidden')).on('hide', () => (document.documentElement.style.overflowY = '')); dialog.show(); } if (document.querySelector('.lightbox')) { new Tobii({ //captionsSelector: 'self', //captionAttribute: 'title', navLabel: ['Poprzednie zdjęcie', 'Następne zdjęcie'], closeLabel: 'Zamknij galerię', }); } const getFilesize = (url, callback) => { const xhr = new XMLHttpRequest(); xhr.open("HEAD", url, true); xhr.onreadystatechange = () => { if (xhr.readyState === XMLHttpRequest.DONE) { const status = xhr.status; if (status === 0 || (status >= 200 && status < 400)) { callback(parseInt(xhr.getResponseHeader("Content-Length"))); } } }; xhr.send(); } document.querySelectorAll('.attachments_list-item-title').forEach(el => { getFilesize(el.href, (size) => { const parent = el.parentElement; parent.querySelector('.attachments_list-item-type').innerHTML = el.href.split(".").pop().toUpperCase(); parent.querySelector('.attachments_list-item-size').innerHTML = `${(size / (1024 * 1024)).toFixed(2)}MB`; }); }); const addPaddingToFooter = () => { const footer = document.querySelector('footer'); const cookiesBox = document.querySelector('.cookies'); const footerBottomPadding = cookiesBox.clientHeight + 10; footer.setAttribute('style', `padding-bottom: ${footerBottomPadding}px`); } const removePaddingFromFooter = () => document.querySelector('footer').removeAttribute('style'); if (WHReadCookie('cookies_accepted') !== 'T') { document.querySelector('.cookies').hidden = false; addPaddingToFooter(); } document.querySelector('.cookies__btn-agree').addEventListener('click', () => { WHCreateCookie('cookies_accepted', 'T', 365); document.querySelector('.cookies').hidden = true; removePaddingFromFooter(); }); if(WHReadCookie('return') != 'T') { $.ajax({url: "//"+document.domain+"/addviewer"}) .done(function ( data ) { WHCreateCookie('return', 'T', 1); }); } }); function WHCreateCookie(name, value, days) { var now = new Date(); var expire = new Date(); expire.setFullYear(now.getFullYear()); expire.setMonth(now.getMonth()); expire.setDate(now.getDate() + days); expire.setHours(0); expire.setMinutes(0); document.cookie = name + "=" + value + "; expires=" + expire.toString() + "; path=/"; } function WHReadCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } /* function WHCheckCookies() { if (WHReadCookie('cookies_accepted') != 'T') { var message_container = document.createElement('div'); message_container.id = 'cookieBoxCont'; var html_code = '
'; message_container.innerHTML = html_code; document.body.appendChild(message_container); } if (WHReadCookie('return') != 'T') { $.ajax({ url: "//" + document.domain + "/addviewer" }) .done(function (data) { WHCreateCookie('return', 'T', 1); }); } } function updateCalendar(curmonth, curyear) { var loading = document.getElementById('monthyear'); var eventscalendar = document.getElementById('eventscalendar'); $.ajax({ url: "//" + document.domain + "/eventsajax?month=" + curmonth + "&year=" + curyear, beforeSend: function (xhr) { loading.innerHTML = '