$(document).ready(function() { if( $(document).width() * 1 < 993) { var $bg_active = 0; $("#m-kategorie").click(function() { $(".menu_m").slideToggle(0); if($bg_active === 0) { $(".menu_m").css("display","block"); $bg_active = 1; } else { $(".menu_m").css("display","none"); $bg_active = 0; } }); var $active = 0; $(".topp").click(function() { if($active === 0) { $(".topp").css("display","none"); $(this).css("display","block"); $(".sub-menu").css("display","block"); $(".amenu").addClass("amenu_after"); $active = 1; } else { $("body").css("overflow","auto"); $(".topp").css("display","block"); $(".sub-menu").css("display","none"); $(".amenu").removeClass("amenu_after"); $active = 0; } }); } s = $(window).scrollTop(); h = $(window).height(); $(window).scroll(function() { s = $(window).scrollTop(); h = $(window).height(); if(s >= h * 2) { $(".roltop").stop().animate({opacity: 1},function() { $(this).css({ display: "block" }) }); } else { $(".roltop").stop().animate({opacity: 0},function() { $(this).css({ display: "none" }) }); } }); setTimeout(function(){ if($(".ads").css('display') == "none") { $('.adblock').css({ display: 'block'}); $('body').css({ overflow: 'hidden' }); } }, 1500); if( $(document).width() * 1 > 993) { $(".video_block").hover(function() { $img_old = $(this).find("img").attr("src"); $img_play = ""; $(this).find("a.add_play").append($img_play); },function() { $(".button_play").remove(); } ); } $rozbal = 1; $(".rozbal_komentare").click(function() { if($rozbal === 1) { $("#komentare").css({ height: 'auto' }); $rozbal = 0; $("#rozbal_icon").attr("class","fa fa-chevron-up"); } else { $("#komentare").css({ height: '42px' }); $rozbal = 1; $("#rozbal_icon").attr("class","fa fa-chevron-down"); } }); $("#komentar_send").click(function() { event.preventDefault(); $film_id = $(".r_film_id").val().trim(); $komentar = $(".r_komentar").val().trim(); $prezyvka = $(".r_prezyvka").val().trim(); if($film_id.length > 0 && $komentar.length > 0) { $.ajax({ url : "/load_komentare.php", type : "post", data : { film_id: $film_id, komentar: $komentar, prezyvka: $prezyvka}, dataType: 'json', error : function() { console.log("ERROR - load_komentare.php"); }, success: function($load) { alert($load.odpoved); $(".pridaj").remove(); } }); } else { alert("Ak chceš pridať komentár, čo keby si aj niečo napísal ?!"); } }); $(".share").click(function() { $(".bg_black").css({ display: 'inline-block' },200); $("#box_share").animate({ top: '100px' },1000); }); $(".nahlasit").click(function() { $(".bg_black").css({ display: 'inline-block' },200); $("#box_nahlasit").animate({ top: '100px' },1000); $(document).on("click","#problem_odoslat",function() { $problem_id = $("#problem_id").val(); $problem_text = $("#problem_text").val(); $.ajax({ url : "/load_nahlasit.php", type : "post", data : { problem_id: $problem_id, problem_text: $problem_text}, dataType: 'json', error : function() { console.log("ERROR - load_nahlasit.php"); }, success: function($load) { $(".problem_h").css({ display: "none"}); $("#problem_oznam").text($load.odpoved); } }); }); }); $(document).on("click","#problem_zavriet,.problem_zavriet,.share_zavriet",function() { $("#box_nahlasit,#box_share").animate({ top: '-1000px' },1000,function() { $(".bg_black").css({ display: 'none' },200); }); }); $(".add_obl").click(function() { $add = $(this).attr("id"); $.ajax({ url : "/load_oblubene.php", type : "post", data : { add: $add}, dataType: 'json', error : function() { console.log("ERROR - load_oblubene.php"); }, success: function($load) { alert($load.odpoved); } }); }); $(".del_obl").click(function() { $del = $(this).attr("id"); $.ajax({ url : "/load_oblubene.php", type : "post", data : { del: $del}, dataType: 'json', error : function() { console.log("ERROR - load_oblubene.php"); }, success: function($load) { alert($load.odpoved); if($load.refresh === 1) { location.reload();} } }); }); var $ss_hladat; $("#hladat").on('input paste click keyup keypress', function(e) { var keyCode = e.keyCode || e.which; if (keyCode === 13) { e.preventDefault(); return false; } $ss_hladat && $ss_hladat.abort(); if($("#hladat").val().length > 2) { $(".autocom p").remove(); $nasepkaj = ""; $hladat = $("#hladat").val(); $ss_hladat = $.ajax({ url : "/load_hladat.php", type : "post", data : { hladat: $hladat}, dataType: 'json', success: function($load) { $count = $load.pocet; for($i=0;$i<$count;$i++) { $nasepkaj +="

"+$load.najdene[$i]["nazov"]+"

"; }; if($count >= 10) { $nasepkaj +="

A ďalších "+$load.dalsie+" výsledkov. Upresni hľadanie ...

"; } $(".autocom").append($nasepkaj); if($count > 0) { $(".autocom").slideDown(500); } } }); } }); $(document).click(function() { $(".autocom").hide(0); }); $(".videolink").click(function() { if (!$(this).hasClass("activ")) { $id = $(this).parent().attr("class"); $v = $(this).attr("id"); $ss_hladat = $.ajax({ url : "/load_video.php", type : "post", data : { id: $id, v: $v}, dataType: 'json', success: function($load) { $("#videoplayer").html($load.embed); } }); $(".videolink").removeClass("activ"); $(this).addClass("activ"); } }); $(".videolinks").click(function() { $id = $(this).parent().attr("class"); $v = $(this).attr("id"); $ss_hladat = $.ajax({ url : "/load_video.php", type : "post", data : { id: $id, v: $v}, dataType: 'json', success: function($load) { $("#videoplayer").html($load.embed); } }); }); $("#videoplayer").hover(function() { $(".button_play_video").css({ opacity: "1" }) }, function() { $(".button_play_video").css({ opacity: "0.5" }) }); $("#share").mouseenter(function() { $(this).animate({ right: "0px"}, {queue: false}); }); $("#share").mouseleave(function() { $(this).animate({ right: "-115px"}, {queue: false}); }); });