mw.js 1.53 KB
$(window).on("load",function() {
show_mw();
jQuery("body").on("click", "#actio", function(e) {
show_mw();
});
jQuery("body").on("click", "#overlay, #close_mw", function(e) {
close_mw();
});	
});
function close_mw() {
setCookie_("no_mw__", "1");
$("#overlay").css({"display": "none"});
$("#modal_form").css({"display": "none"});
}
function show_mw() {
if (getCookie_("no_mw___")) {
//setCookie_("no_mw__", "");
//alert();
} else {

$("#overlay").css({"display": "block"});
$("#modal_form").css({"display": "block"});
$("#modal_form").html("<div style='text-align:center;'><a onclick='close_mw();' href='http://extremepride.com.ua/news/kupuy_of%D1%96ts%D1%96yn%D1%96_kameri_gopro_-_otrimay_prizi!-50/'><img style='width:80%;' src='../img/ffb.png' /></a><div style='cursor:pointer;float:right;' id='close_mw'><img width='32' src='https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/VisualEditor_-_Icon_-_Close.svg/1000px-VisualEditor_-_Icon_-_Close.svg.png' /></div></div>");
}
}
function setCookie_(key, value, expires) {
	if (!expires) {
                 var expires = new Date();
				 expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
				 document.cookie = key + '=' + value + ';expires=' + expires.toUTCString() + ';path=/';
	} else {          
                 document.cookie = key + '=' + value + ';expires=' + expires;
	}
}
function getCookie_(name) {
  var matches = document.cookie.match(new RegExp(
    "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\/\+^])/g, '\$1') + "=([^;]*)"
  ));
  return matches ? decodeURIComponent(matches[1]) : "";
}