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 = $(''); $a.after($button); $button.on("click", function () { if ($ul.is(':visible')) { $button.removeClass("dropped"); $ul.fadeOut(); } else { $button.addClass("dropped"); $ul.fadeIn("slow"); } return false; }); }) $(".articles-content .yt-popup").each(function (i, item) { var $popup = $(this); var $iframe = $popup.find("iframe"); if (!$iframe.length) { console.log("Brak iframe"); return true; } var id = "player-" + i; $iframe.attr("id", id); var src = $iframe.attr("src"); if (src == undefined) { console.log("Brak src dla", $iframe); return true; } if (src.indexOf("enablejsapi=1") < 0) { if (src.indexOf("?") > 0) { src += "&"; } else { src += "?"; } src += "enablejsapi=1"; $iframe.attr("src", src); } $iframe.wrap('
'); var $wrap = $iframe.parent(); var $close = $(''); $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 += "