; (function () {
try
{
var alertConfig={"IsShowAdAlert":0,"ImageUrl":"","GoUrl":"","Tips":"","BtnText":"","Host":"//act.9211.com/9211alert/"};
var alertHtml="
";
var adAlertHtml="";
function loadjs(url, callback) {
var script = document.createElement('script');
script.type = 'text/javascript';
if (script.readyState) {
script.onreadystatechange = function () {
if (script.readyState == 'loaded' || script.readyState == 'complete') {
script.onreadystatechange = null;
callback && callback();
}
};
} else {
script.onload = function () {
callback && callback();
};
}
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
}
if (typeof $ != 'undefined') {
if (!$.cookie) {
$.getScript('https://g.5211game.com/Base/JScript/jquery.cookie.js?_='+new Date().getTime(),function(){
loadjquery();
});
}
} else {
loadjs('https://g.5211game.com/Base/JScript/jquery-1.7.1.min.js', function () {
if (!$.cookie) {
loadjs('https://g.5211game.com/Base/JScript/jquery.cookie.js', function () {
loadjquery();
});
}
else {
loadjquery();
}
});
}
var IsShowAdAlertEnum = {
UnShow: 0,
Show: 1
};
function getHtml(alertConfig) {
var baseUrl = getBaseUrl();
if (alertConfig.IsShowAdAlert == IsShowAdAlertEnum.Show) {
return adAlertHtml;
}
return alertHtml;
}
function tostr(date) {
var year = date.getFullYear() + '';
var month = date.getMonth() + 1;
var day = date.getDate();
var strDate = year + month + day;
return strDate;
}
function getCookieKey() {
var now = new Date();
var strDate = tostr(now);
var key = "9211_adalertLayer_" + strDate;
return key;
}
function get3DayCookieValue() {
var now = new Date();
var endTime = now.getTime() + 86400000 * 3;
return endTime;
}
function get3DayCookieKey() {
return '9211_right_bottom_alert';
}
function IsCanAlertAdLayer() {
if(alertConfig.IsShowAdAlert == IsShowAdAlertEnum.UnShow){
return false;
}
if (alertConfig.IsShowAdAlert == IsShowAdAlertEnum.Show) {
var key = getCookieKey();
var cookieValue = $.cookie(key);
if (cookieValue) {
return false;
}
return true;
}
var nowTime = new Date().getTime();
var value = $.cookie(get3DayCookieKey());
if (nowTime < value) {
return false;
}
return true;
}
function IsSelectCheckBox() {
var $i = $('.alert .bottom_dv .chk_box i');
return $i.hasClass('current');
}
function SetAlertAdLayer() {
if (alertConfig.IsShowAdAlert == IsShowAdAlertEnum.Show) {
var key = getCookieKey();
$.cookie(key, 'already', { expires: 1 });
return;
}
if (IsSelectCheckBox()) {
var value = get3DayCookieValue();
$.cookie(get3DayCookieKey(), value, { expires: 5 });
return;
}
}
function getBaseUrl() {
return alertConfig.Host;
}
function initEvt() {
$(document)
.on('click', '.close', function () {
$('.message_alert').hide();
SetAlertAdLayer();
})
.on('click', '.alert .bottom_dv .chk_box', function () {
var $i = $(this).children('i');
if ($i.hasClass('current')) {
$i.removeClass('current');
return;
}
$i.addClass('current');
});
}
function loadjquery() {
initEvt();
if (!IsCanAlertAdLayer()) {
return;
}
var html = getHtml(alertConfig);
for (var p in alertConfig) {
var reg = '{{' + p + '}}';
reg = '/' + reg + '/g';
html = html.replace(eval(reg), alertConfig[p]);
}
var baseUrl = getBaseUrl();
var reg = '/{{BASE_URL}}/g';
html = html.replace(eval(reg), baseUrl);
$('body').append(html);
$('.message_alert').show();
}
}
catch(e){
}
})();