');
$(".current-grid+.griditem>.bg").css('opacity', 0);
}
else{
var $modalBlock = $('
');
}
$modalBlock.appendTo('#grid'); // Добавляем блок на страницу
$modalBlock.html($html); // Вставляем в него полученный код
$('.griditem').each(function() {
zind = $(this).zIndex();
zind = zind+1;
$(this).css('z-index', zind);
//$(this+'>.bg').css('z-index', zind);
});
$('#adriver_banner_335944353').attr('id','adriver_banner_335944353'+ban);
add_script('(function(){var custom = [];var width = screen.width;var std = {width:110},i;for(i in std){try{custom[std[i]]=eval(i)}catch(e){}}new adriver("adriver_banner_335944353'+ban+'", {sid:163066, bt:52, bn:8, pz:2, custom: custom});})();','banner_3');
//add_script('(function(){var custom = [];var width = screen.width;var std = {width:110},i;for(i in std){try{custom[std[i]]=eval(i)}catch(e){}}new adriver("adriver_banner_335944353'+ban+'", {sid:163066, bt:52, bn:8, pz:2, custom: custom});})();', 'banner_3');
ban = ban+1;
add_script("var $aimElement = $('
');myWidget.render('5e2596b7ffe30ccaff1e9b2375df3a87', $aimElement.get(0));console.log($aimElement);$('.my-widget-anchor').html($aimElement);", "my-widget-anchor");
add_script('(function() {var sc = document.createElement("script"); sc.type = "text/javascript"; sc.async = true;sc.src = "//smi2.ru/data/js/87957.js"; sc.charset = "utf-8";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(sc, s); }());',"smi2-"+newsid);
add_script('if (window.relap) window.relap.ar("iikpP-YnRrxGs7Oz");', 'relap', 'iikpP-YnRrxGs7Oz');
add_script('cackle_widget=window.cackle_widget||[];cackle_widget.push({widget:"Comment",id:"39793",container: "mc-container-'+newsid+'",channel:"'+newsid+'"});document.getElementById("mc-container-'+newsid+'").innerHTML="";(function(){var mc=document.createElement("script");mc.type="text/javascript";mc.async=true;mc.src=("https:"==document.location.protocol?"https":"http")+"://cackle.me/widget.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(mc,s.nextSibling);})();', 'mc-container-'+newsid);
if($(document).width().bg").css('opacity', 0);
}
if($.browser.mozilla){
$(".griditem:last>.bg").css('opacity', 0);
}
})
.fail(function () {
console.log("full-story error");
});
}
}
window.clearTimeout($.data("this", "scrollTimer"));
var windowHeight = (typeof window.outerHeight !== "undefined") ? Math.max(window.outerHeight, $(window).height()) : $(window).height();
if(!$.browser.mozilla){
$.data(this, "scrollTimer", window.setTimeout(function() {
currentScroll = $(window).scrollTop();
if (currentScroll > lastScroll) {
// If it's scrolling down
$('.griditem').each(function(key, value) {
if ($(value).offset().top + $(value).height() > currentScroll) {
// Change title and URL
if($(document).width()>992){
$(this).css('margin-top', +$(this).css('margin-top')+(lastScroll-currentScroll));
}
changeTitleAndURL(value);
$('.current-grid').removeClass('current-grid');
$(this).addClass('current-grid');
lastScrollmar = 0;
// Quit each loop
return false;
}
});
} else if (currentScroll currentScroll) {
// Change title and URL
changeTitleAndURL(value);
$('.current-grid').removeClass('current-grid');
$(this).addClass('current-grid');
// Quit each loop
return false;
}
});
} else {}
lastScroll = currentScroll;
}, 200));
if($("*").is(".current-grid+.griditem")){
if(s_top > $(".current-grid+.griditem").offset().top && parseInt($(".current-grid+.griditem").css('margin-top'))992){
marg = parseInt($(".current-grid+.griditem").css('margin-top'))-(lastScrollmar-$(window).scrollTop());
var opacity = (marg*(-1))/windowHeight;
if(marg > 0){
marg = 0;
opacity = 0;
}
$(".current-grid+.griditem").css('margin-top', marg);
$(".current-grid+.griditem>.bg").css('opacity', opacity);
if(opacity.bg").hide();}
}
lastScrollmar = $(window).scrollTop();
}
}
if(s_top 0-windowHeight){
if(lastScrollmar == 0){
lastScrollmar = $(".current-grid+.griditem").offset().top;
}
if($(document).width()>992){
marg = parseInt($(".current-grid+.griditem").css('margin-top'))-(lastScrollmar-$(window).scrollTop());
var opacity = (marg*(-1))/windowHeight;
if(marg .bg").css('opacity', opacity);
$(".current-grid+.griditem>.bg").show();
}
lastScrollmar = $(window).scrollTop();
}
}
});
});
setTitleAndHistory = function(_title, _path) {
// Set history
history.pushState(null, _title, _path);
// Set title
$("title").html(_title);
},
changeTitleAndURL = function(_value) {
// value is an element of a content user is seeing
// Get title and path of the article page from hidden span elements
var title = $(_value).find(".name_news").text(),
path = $(_value).find(".current-link").attr('href');
if ($("title").text() !== title) {
setTitleAndHistory(title, path);
}
};
function add_script(txt, tag, id) {
var newScript = document.createElement("script");
newScript.type = "text/javascript";
newScript.text = txt;
if(id !== undefined) newScript.id = id;
document.getElementsByClassName(tag)[0].appendChild(newScript);
}