Files
2023-06-22 13:33:25 +08:00

53 lines
1.2 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//及时消息开始
var newMessageRemind = {
_step : 0,
_title : document.title,
_timer : null,
//显示新消息提示
show : function () {
var temps = newMessageRemind._title.replace("【   】", "").replace("【新消息】", "");
newMessageRemind._timer = setTimeout(function () {
newMessageRemind.show();
//这里写Cookie操作
newMessageRemind._step++;
if (newMessageRemind._step == 3) {
newMessageRemind._step = 1
};
if (newMessageRemind._step == 1) {
document.title = "【   】" + temps
};
if (newMessageRemind._step == 2) {
document.title = "【新消息】" + temps
};
}, 800);
return [newMessageRemind._timer, newMessageRemind._title];
},
//取消新消息提示
clear : function () {
clearTimeout(newMessageRemind._timer);
document.title = newMessageRemind._title;
//这里写Cookie操作
}
};
function clearNewMessageRemind() {
newMessageRemind.clear();
}
function evdata() {
$.ajax({
type : "GET",
url : siteUrl + "index.php?app=message&ac=newmsg",
success : function (msg) {
if (msg == '0') {}
else if (msg > 0) {
$('#newmsg').html(msg);
newMessageRemind.show();
}
}
});
}
//及时消息结束
evdata();