first
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,176 @@
|
||||
"use strict";
|
||||
|
||||
var siteUrl = window.location.protocol + "//" + window.location.hostname;
|
||||
|
||||
/*
|
||||
(function ($, undefined) {
|
||||
function get_posts() {
|
||||
var offset = localStorage.getItem("current-offset");
|
||||
var banner = !localStorage.getItem("banner-displayed");
|
||||
var tag = localStorage.getItem("search-tag");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: myajax.url,
|
||||
dataType: "html",
|
||||
data: {
|
||||
action: "get_ajax_blog_posts",
|
||||
offset: offset,
|
||||
tag: tag,
|
||||
numberposts: 11
|
||||
},
|
||||
success: function success(response) {
|
||||
$("#articles-container").append(response);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: myajax.url,
|
||||
dataType: "html",
|
||||
data: {
|
||||
action: "get_ajax_blog_posts",
|
||||
offset: offset * 1 + 11,
|
||||
tag: tag,
|
||||
numberposts: 11
|
||||
},
|
||||
success: function success(response) {
|
||||
if (!response) {
|
||||
$("#show-more").remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
(function ($, undefined) {
|
||||
function get_posts() {
|
||||
|
||||
var offset = localStorage.getItem("current-offset");
|
||||
var banner = !localStorage.getItem("banner-displayed");
|
||||
var tag = localStorage.getItem("search-tag");
|
||||
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: myajax.url,
|
||||
data: {'action': 'get_ajax_blog_posts', 'offset':offset, 'tag': tag, numberposts: 11 },
|
||||
success: function (response) {
|
||||
var data = JSON.parse(response);
|
||||
// console.log(data);
|
||||
if (data.results == true)
|
||||
{
|
||||
console.log('success');
|
||||
jQuery("#articles-container").append(data.response);
|
||||
var pagen = (offset / 11) + 1;
|
||||
|
||||
if ((pagen) && (pagen > 0))
|
||||
{
|
||||
var pageUrl = '?' + 'PAGEN=' + pagen;
|
||||
var pageUrlPrev = '?' + 'PAGEN=' + (pagen - 1);
|
||||
window.history.pushState('', '', pageUrl);
|
||||
document.title = document.title + " Страница " + pagen;
|
||||
var meta=document.getElementsByTagName("meta");
|
||||
for (var i=0; i<meta.length; i++) {
|
||||
if (meta[i].name.toLowerCase()=="description") {
|
||||
meta[i].content = meta[i].content + " Страница " + pagen;
|
||||
console.log('description ', meta[i].content);
|
||||
}
|
||||
}
|
||||
console.log('pushState ', pageUrl);
|
||||
ym(55127530, 'hit', pageUrl, {title: document.title, referer: pageUrlPrev});
|
||||
ga('send', 'pageview', pageUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.history.pushState('', '', siteUrl);
|
||||
console.log('pushState ', siteUrl);
|
||||
}
|
||||
console.log('success pagen ', pagen);
|
||||
}
|
||||
else if ( data.results == false )
|
||||
{
|
||||
console.log('not success');
|
||||
jQuery("#show-more").hide();
|
||||
jQuery("#rel_next").remove();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
console.log("Start Site jQuery, current Link:", siteUrl);
|
||||
|
||||
|
||||
var offset = jQuery('#articles-container').data('paged');
|
||||
|
||||
if (offset > 1)
|
||||
{
|
||||
offset = (offset * 11 ) - 11;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
localStorage.setItem("current-offset", offset);
|
||||
console.log('offset ', offset);
|
||||
localStorage.setItem("banner-displayed", false);
|
||||
var selectedTag = $('.blog-tag.active').attr("id");
|
||||
localStorage.setItem("search-tag", selectedTag === "all" ? "" : selectedTag);
|
||||
// var offset = 0; // get_posts();
|
||||
|
||||
$(".show-more").on("click", function () {
|
||||
localStorage.setItem("current-offset", localStorage.getItem("current-offset") * 1 + 11);
|
||||
get_posts();
|
||||
});
|
||||
$(".blog-tag").on("click", function () {
|
||||
$(".blog-tag").removeClass("active");
|
||||
localStorage.setItem("search-tag", $(this).attr("id"));
|
||||
$(this).addClass("active");
|
||||
$("#articles-container").empty();
|
||||
get_posts();
|
||||
});
|
||||
$(".sm-headbar-control").on("click", function () {
|
||||
$(this).toggleClass('opened');
|
||||
$(".mobile-menu").toggle();
|
||||
});
|
||||
$("#menu-mobilnoe-menyu>.menu-item-has-children").on("click", function () {
|
||||
$(this).toggleClass('opened');
|
||||
$(this).find('.sub-menu').toggle();
|
||||
});
|
||||
$("#footer-mobile-menu>.menu-item-has-children").on("click", function () {
|
||||
$(this).toggleClass('opened');
|
||||
$(this).find('.sub-menu').toggle();
|
||||
});
|
||||
$('#menu-item-1042 > a').on("click", function () {
|
||||
carrotquest.open();
|
||||
});
|
||||
$(".sub-menu").on("click", function (e) {
|
||||
e.stopPropagation();
|
||||
}); //localStorage.setItem("banner-displayed", true);
|
||||
}); //utm_links
|
||||
|
||||
$("a").each(function () {
|
||||
var href = $(this).attr("href");
|
||||
var anchor = '';
|
||||
|
||||
if (href) {
|
||||
if (href.indexOf('#') != -1) {
|
||||
anchor = '#' + href.split('#')[1];
|
||||
href = href.split('#')[0];
|
||||
}
|
||||
|
||||
var search = "?" + window.location.search.split("&").filter(function (val) {
|
||||
return val.replace('?', '').indexOf('s_') !== 0;
|
||||
}).join("&").replace('?', '');
|
||||
|
||||
if (search !== "?" && href != undefined && href.includes(".")) {
|
||||
if (!href.includes("?")) {
|
||||
$(this).attr("href", href + search + anchor);
|
||||
} else {
|
||||
$(this).attr("href", href + search.replace("?", "&") + anchor);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
"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);
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user