var page = window.location.pathname; var file = page; if (file === '/') { file = '/index' } file = 'datoteke' + file + '.txt'; var slideIndex = 1; var days; var hours; var minutes; var seconds; var distance; var naslovna_slika; var xhr = new XMLHttpRequest(); xhr.onload = function () { var doctype = document.implementation.createDocumentType('html', '', ''); document.doctype.parentNode.replaceChild(doctype, document.doctype); var html = document.getElementsByTagName("html")[0]; html.innerHTML = xhr.responseText; html.removeAttribute('xmlns'); html.removeAttribute('xml:lang'); html.setAttribute('lang', 'en'); pageSpecificJs(); }; xhr.open('GET', file, true); xhr.send(null); function w3_open() { document.getElementById('mySidebar').style.display = 'block'; document.getElementById('myOverlay').style.display = 'block'; } function w3_close() { document.getElementById('mySidebar').style.display = 'none'; document.getElementById('myOverlay').style.display = 'none'; } function pageSpecificJs() { initCountDown(); naslovna_slika = $('#naslovna_slika_img'); $(window).resize(function () { fixPadding(); }); fixPadding(); $(document).ready(function () { if (page === '/') { $('#link-domov').addClass('w3-text-teal'); showDivs(slideIndex); $('#sibasta-header').hide(); } else if (page === '/arhiv') { $('#link-arhiv').addClass('w3-text-teal'); } else if (page === '/sponzorji') { $('#link-sponzorji').addClass('w3-text-teal'); } else if (page === '/za-medije') { $('#link-za-medije').addClass('w3-text-teal'); } else if (page === '/organizatorji') { $('#link-organizatorji').addClass('w3-text-teal'); } else if (page === '/slike') { $('#link-slike').addClass('w3-text-teal'); } else if (page === '/program') { $('#link-program').addClass('w3-text-teal'); } else if (page === '/prijave') { $('#link-prijave').addClass('w3-text-teal'); } else if (page === '/himna') { $('#link-himna').addClass('w3-text-teal'); } else { console.log('napaka') } }); } function fixPadding() { var margin = -50 * document.documentElement.clientWidth / 100 + 250; if (margin > 0) margin = 0; naslovna_slika.css('margin-top', '' + margin + 'px'); } function plusDivs(n) { showDivs(slideIndex += n); } function currentDiv(n) { showDivs(slideIndex = n); } function showDivs(n) { var i; var x = document.getElementsByClassName("mySlides"); var dots = document.getElementsByClassName("dot"); if (n > x.length) { slideIndex = 1 } if (n < 1) { slideIndex = x.length } for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" w3-white", ""); } x[slideIndex - 1].style.display = "block"; dots[slideIndex - 1].className += " w3-white"; } function veselimse() { $('#neveselimse').hide(); $('#veselimse').show(); } function neveselimse() { $('#veselimse').hide(); $('#neveselimse').show(); } function recalcDays() { // Get today's date and time var now = new Date().getTime(); var countDownDate = new Date("Jul 12, 2021 9:0:0").getTime(); // Find the distance between now and the count down date distance = countDownDate - now; if (distance < 0) distance = 0; // Time calculations for days, hours, minutes and seconds days = Math.floor(distance / (1000 * 60 * 60 * 24)); hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); seconds = Math.floor((distance % (1000 * 60)) / 1000); } function updateCountdown() { recalcDays(); var text = 'čez ' + days + ' dni ' + hours + ' ur ' + minutes + ' min ' + seconds + ' s'; $('.countdown-text').text(text); } function initCountDown() { recalcDays(); if (distance !== 0) { updateCountdown(); $('.countdown').show(); setInterval(updateCountdown, 1000); } }