jQuery(function($) { // General $("a[rel^='external']").attr("target","_blank"); // Membership Aside Check if( $(".page-template-page-widget #content .membershipWidget").size() != 0 ) { $(".page-template-page-widget aside .membershipWidget").remove(); } else { $(".page-template-page-widget aside .membershipWidget").show(); } // Favourite $(".safirButton.favourite").click(function (event) { if (event.preventDefault) event.preventDefault(); event.returnValue = false; parent = $(this).parent(); if(parent.hasClass('loggedin')) { $(this).hide(); parent.find('.safirButton.waiting').show(); postID = $(this).attr("data-postID"); nonce = $(this).attr("data-nonce"); make = $(this).attr("data-make"); link = $(this).attr("data-link"); $.ajax({ type: "post", dataType: "json", url: safirAjax.ajaxurl, data: { action: "favor", postID: postID, nonce: nonce, link: link, make: make, }, success: function (response) { $(".safirButton.favourite." + response.showLink).show(); $(parent).find('.safirButton.waiting').hide(); $('#membership .favors span').html(response.count); swal({ title: response.message, text:"Favorilerime Git" , type: "success", confirmButtonText: "Kapat", html:true }); } }); } else { swal({ title: "Kullanıcı girişi yapmalısınız.", text:"Bu sistemi sadece üyeler kullanabilir." , type: "error", confirmButtonText: "Kapat", html:true }); } }); // Like clicked = false; $("#single .safirButton.likeButton").click(function(event) { if (event.preventDefault) event.preventDefault(); event.returnValue = false; if(clicked == false) { activeButton = $(this); activeButton.addClass("loading"); postID = $(this).attr("data-postID"); make = $(this).attr("data-make"); nonce = $(this).attr("data-nonce"); $.ajax({ type: "post", dataType: "json", url: safirAjax.ajaxurl, data: { action: "safirLikeDislike", make: make, postID: postID, nonce: nonce, }, success: function (response) { current = activeButton.find('.count'); text = current.html().replace(".", ""); current.html(safirFormatNumber(parseInt(text)+1)); swal({ title: "Oy verdiğiniz için teşekkürler.", text:"", type: "success", confirmButtonText: "Kapat"}); activeButton.removeClass("loading"); }, error: function(xhr, ajaxOptions, thrownError) { swal({ title: "Bir hata oluştu", text:"Lütfen daha sonra tekrar deneyiniz.", type: "error", confirmButtonText: "Kapat"}); activeButton.removeClass("loading"); } }); } else { swal({ title: "Hata", text:"Daha önce tıkladınız." , type: "error", confirmButtonText: "Kapat" }); } clicked = true; }); // Menu $('#menu a').each(function() { $('').prependTo($(this)); }); $('#menu>ul>.menu-item-has-children').hover(function() { if($(window).width() > 980) { $(this).find('.sub-menu').first().css('visibility', 'visible').css('margin-top', '-3px').stop().fadeIn(300); } }, function() { if($(window).width() > 980) { var activeMenu = $(this); activeMenu.find('.sub-menu').first().css('margin-top', '0').fadeOut(300); } }); $('#menu .menu-item-has-children .menu-item-has-children').hover(function() { if($(window).width() > 980) { $(this).find('.sub-menu').first().css('visibility', 'visible').stop().fadeIn(300); } }, function() { if($(window).width() > 980) { var activeMenu = $(this); activeMenu.find('.sub-menu').first().fadeOut(300); } }); $('#menu').prepend('MENÜ'); $('#menu .toggleMenu').click(function() { $('#menu>ul, #menu div.menu>ul').slideToggle(300); $(this).toggleClass('open'); $(this).css('display','none').fadeIn(); }); $(window).resize(function() { if($(window).width() > 980) { $('#menu>ul').css('display','block'); $('#menu .toggleMenu').removeClass('open'); } else if($('#menu .toggleMenu').hasClass('open') == false) { $('#menu>ul').css('display','none'); } }); $('#menu li.menu-item-has-children').each(function() { $('').appendTo($(this).find('a').first()); }); $("#menu .menu-item-has-children>a").on("click", function (event) { if($(window).width() < 980) { if (event.preventDefault) event.preventDefault(); event.returnValue = false; $(this).next().slideToggle(); } }); $("#menu li a").click(function (event) { if($(window).width() < 980 && $(this).parent().hasClass('menu-item-has-children') == false) { $("#menu>ul").slideUp(); } }); // Switcher $("#switcher .icon").click(function() { if($(this).hasClass("active")) { $("#switcher").animate({"left":"-100px"}); } else { $("#switcher").animate({"left":"-1px"}); } $(this).toggleClass("active"); }); if($('.switcherInput.input1').length) { $('.switcherInput.input1').minicolors({ change: function(hex, opacity) { $('#menu>ul>li:hover>a, #menu .menu-item-home a, .homeWidget .mainHeading, .safirHeading, .authorHeading, #menu .sub-menu, footer, .safirnavi').css('border-color', hex); $('#featured .owl-pagination .owl-page.active, .mainHeading .icon, .safirHeading .icon, .safirnavi span, .safirnavi a, .sidebarWidget .mainHeading.alt, #main form input[type=submit]:hover, #main .sfrIconForm form .fileLabel span.button:hover, #main .sfrIconForm form .buttonLabel:hover').css('background', hex); $('.homeWidget .mainHeading .allLink span').css('border-color', 'transparent transparent transparent ' + hex); $('.sidebarWidget .mainHeading .icon').addClass("nopseudo"); $('.sidebarWidget .mainHeading.alt .icon').css("background", "rgba(0,0,0,0.15)"); }, show: function() { $('body,html').animate({ scrollTop: 0 }, 800); } }); } if($('.switcherInput.input2').length) { $('.switcherInput.input2').minicolors({ show: function() { $('body,html').animate({ scrollTop: 0 }, 800); } }); } // Responsive Video $('#videoBlock iframe, #videoBlock object, #videoBlock embed').wrap('
') // Widescreen if( $('#content').hasClass('widescreen') ) { $('aside').appendTo('#singleFloat'); } $(".safirButton.widescreen").click(function() { if($(this).hasClass('active')) { datamake = 'narrow'; } else { datamake = 'wide'; } dataurl = $(this).attr('data-url'); $.ajax({ type: 'POST', dataType: 'json', url: safirAjax.ajaxurl, data: { action: "safirWidePlayerSession", make: datamake }, success: function(data){ }, error: function(xhr, ajaxOptions, thrownError) { console.log(xhr.reponseText); } }); $(this).toggleClass('active'); $(this).find('span').toggle(); $('#content, #singleFloat').toggleClass('widescreen'); if( $(this).hasClass('active') ) { $('aside').appendTo('#singleFloat'); } else { $('aside').appendTo('#main .innerContainer'); } }); // Membership Widget $(".membershipWidget .titles .item").click(function () { if ($(this).hasClass('active') == false) { $('.membershipWidget .tab').stop().css('display', 'none'); $('.membershipWidget .tab').eq($(this).index()).stop().fadeIn(400); $('.membershipWidget .titles .item').removeClass("active"); $(this).addClass("active"); } }); // Single Ad $('#single .videoAdBlock .skipAd').click(function(event){ $('#single .videoAdBlock .hideBlock').css('display', 'none'); $('#single .videoAdBlock .content').fadeIn(); }); if($('#single .videoAdBlock .counting span').length != 0) { var sec = $('#single .videoAdBlock .counting span').text(); var timer = setInterval(function() { sec--; if (sec >= 1) { $('#single .videoAdBlock .counting span').text(sec); } else { clearInterval(timer); $('#single .videoAdBlock .hideBlock').css('display', 'none'); $('#single .videoAdBlock .content').fadeIn(); } }, 1000); } // Filelabel $('.sfrIconForm form .fileLabel+input[type=file]').change(function() { $(this).prev().find('span.text').html( $(this).val().substr(0, 20) + '...' ); }); // Featured $('#featured').hover(function() { $('#featured .owl-buttons div').stop().fadeIn(); }, function (){ $('#featured .owl-buttons div').stop().fadeOut(); }); // Hover Effects $(".safirHover .post").hover(function () { $(".safirHover .hover").remove(); $(this).find("a").append('