wp_back/wp-content/themes/simple-theme/js/main.min.js

1 line
2.0 KiB
JavaScript
Raw Permalink Normal View History

2024-05-20 15:37:46 +03:00
"use strict";var siteUrl=window.location.protocol+"//"+window.location.hostname;!function(t,e){function o(){var e=localStorage.getItem("current-offset"),o=(localStorage.getItem("banner-displayed"),localStorage.getItem("search-tag"));t.ajax({type:"POST",url:myajax.url,dataType:"html",data:{action:"get_ajax_blog_posts",offset:e,tag:o,numberposts:11},success:function(a){t("#articles-container").append(a),t.ajax({type:"POST",url:myajax.url,dataType:"html",data:{action:"get_ajax_blog_posts",offset:1*e+11,tag:o,numberposts:11},success:function(e){e||t("#show-more").remove()}})}})}jQuery(document).ready((function(){console.log("Start Site jQuery, current Link:",siteUrl),localStorage.setItem("current-offset",0),localStorage.setItem("banner-displayed",!1);var e=t(".blog-tag.active").attr("id");localStorage.setItem("search-tag","all"===e?"":e);t(".show-more").on("click",(function(){localStorage.setItem("current-offset",1*localStorage.getItem("current-offset")+11),o()})),t(".blog-tag").on("click",(function(){t(".blog-tag").removeClass("active"),localStorage.setItem("search-tag",t(this).attr("id")),t(this).addClass("active"),t("#articles-container").empty(),o()})),t(".sm-headbar-control").on("click",(function(){t(this).toggleClass("opened"),t(".mobile-menu").toggle()})),t("#menu-mobilnoe-menyu>.menu-item-has-children").on("click",(function(){t(this).toggleClass("opened"),t(this).find(".sub-menu").toggle()})),t("#footer-mobile-menu>.menu-item-has-children").on("click",(function(){t(this).toggleClass("opened"),t(this).find(".sub-menu").toggle()})),t("#menu-item-1042 > a").on("click",(function(){carrotquest.open()})),t(".sub-menu").on("click",(function(t){t.stopPropagation()}))})),t("a").each((function(){var e=t(this).attr("href"),o="";if(e){-1!=e.indexOf("#")&&(o="#"+e.split("#")[1],e=e.split("#")[0]);var a="?"+window.location.search.split("&").filter((function(t){return 0!==t.replace("?","").indexOf("s_")})).join("&").replace("?","");"?"!==a&&null!=e&&e.includes(".")&&(e.includes("?")?t(this).attr("href",e+a.replace("?","&")+o):t(this).attr("href",e+a+o))}}))}(jQuery);