function setCookie(cname, cvalue, exdays) { const d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); let expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } function getCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for (let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } $(document).ready(function () { function changeCategoryName($activeCategory) { var $categoryName = $('.card-tabs .card-header h2'); var activeCategoryText = $activeCategory.text(); $categoryName.text(activeCategoryText); } // $('.card-tabs .nav-link').on('click', function(){ // changeCategoryName($(this)); // }); // changeCategoryName($('.card-tabs .nav-link.active')); $("#navbarCollapse a+ul").each(function () { var $ul = $(this); var $a = $ul.prev(); var $button = $(''); $close.off("click").on("click", function () { if (players[id] && typeof players[id].stopVideo === 'function') { players[id].stopVideo(); } else { players[id].g.contentWindow.postMessage(JSON.stringify({ "event": "command", "func": "stopVideo", "args": "" }), "*"); } return false; }); $popup.off("click").on("click", function () { if (players[id] && typeof players[id].stopVideo === 'function') { players[id].stopVideo(); } else { players[id].g.contentWindow.postMessage(JSON.stringify({ "event": "command", "func": "stopVideo", "args": "" }), "*"); } return false; }); $wrap.append($close); }); $(".articles-content iframe").each(function () { $(this).data('yt-events', { // 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange }); }); function onPlayerStateChange(event) { console.log('--------------------onPlayerStateChange'); var $popup = $(event.target.g).parents('.yt-popup'); var playerStatus = event.data; if (playerStatus == -1) { $popup.removeClass("active"); } else if (playerStatus == 0) { } else if (playerStatus == 1) { $popup.addClass("active"); } else if (playerStatus == 2) { } else if (playerStatus == 3) { } else if (playerStatus == 5) { } } // $(".videos-player iframe").data('yt-events', { // // 'onReady': onPlayerReady, // 'onStateChange': vp_onPlayerStateChange // }); if ($(".show-weather").length) { function callLocalize(isEmpty, lat, long) { if (isEmpty) { data = {}; } else { data = {}; data.lat = lat; data.long = long; } $.ajax({ url: $(".show-weather").data("url"), method: "POST", dataType: "json", async: false, data: data, success: function (data) { var html = '' + data.miasto + ''; $(data.zachmurzenie.split(",")).each(function (i, v) { html += " " }); html += '' + data.temperatura + '℃'; $(".show-weather").html(html); }, error: function (xhr, status, error) { console.log(error); console.log("err"); } }); } callLocalize(true, null, null); var position = null; if (!navigator.geolocation) { console.log("Geolocation is not supported by your browser"); } if (navigator.geolocation && navigator.geolocation.getCurrentPosition) { navigator.geolocation.getCurrentPosition(function (position_) { position = position_; callLocalize(false, position.coords.latitude, position.coords.longitude); }, function () { console.log("Couldn\'t get your position!"); }); } } var mainTabsTimeout; $(".main-tabs .card-header a").on("click", function () { clearTimeout(mainTabsTimeout); mainTabsTimeout = setTimeout(() => { var $li = $(this).parents('li'); if ($li.next().length) { $li = $li.next(); } else { $li = $li.parent().children().first(); } $li.find('a').click(); }, 30000); }); $(".main-tabs .card-header a").first().click(); $(".twitter-embed").each(function (i, v) { let url = $(v).data('url'); $(v).removeClass('mce-object'); $(v).css('display', 'none'); $.ajax({ url: url, success: function (data) { $(v).html(data.html); let intervalHnd = setInterval(() => { if ($(".twitter-tweet-rendered").length) { clearInterval(intervalHnd); $(v).fadeIn(2000); } }, 1000); }, async: false }); }); }); var tag = document.createElement('script'); tag.id = 'iframe-demo'; tag.src = 'https://www.youtube.com/iframe_api'; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var players = []; function onYouTubeIframeAPIReady() { setTimeout(function () { $("iframe").each(function (i, element) { if ($(this).data('yt-events')) { var id; if (!$(this).is("[id]")) { id = "__player-" + i; $(this).attr("id", id); } id = $(this).attr("id"); // Tworzymy nową instancję i zapisujemy ją w tablicy players players[id] = new YT.Player(id, { events: $(this).data('yt-events') }); } }); }, 1000); } var scrollTimeout; $(window).scroll(function () { if (clearTimeout != undefined) { clearTimeout(scrollTimeout); } scrollTimeout = setTimeout(function () { var sticky = $('header'), scroll = $(window).scrollTop(); if (scroll >= 50) sticky.addClass('scrolled'); else sticky.removeClass('scrolled'); }, 10); }); // TODO!!!!! scrollTimeout = setTimeout(function () { var w = 2; $(".simply-scroll-list").children().each(function () { $(this).width($(this).width() + 2); w += $(this).width(); }); $(".simply-scroll-list").width(w); }, 2000);