修复标题闪烁问题

pull/23/head
taoshihan1991 5 years ago
parent 23a599f7ca
commit 6614d3eeb9

@ -80,12 +80,13 @@ GOFLY.init=function(config){
} }
if(msg.type=="focus"){ if(msg.type=="focus"){
clearTimeout(_this.titleTimer); clearTimeout(_this.titleTimer);
_this.titleTimer=0;
document.title = _this.originTitle; document.title = _this.originTitle;
} }
}); });
window.onfocus = function () { window.onfocus = function () {
clearTimeout(_this.titleTimer); clearTimeout(_this.titleTimer);
console.log(1); _this.titleTimer=0;
document.title = _this.originTitle; document.title = _this.originTitle;
}; };
} }
@ -269,6 +270,12 @@ GOFLY.windowOpen=function (){
window.open(this.GOFLY_URL+'/chatIndex?kefu_id='+this.GOFLY_KEFU_ID+'&lang='+this.GOFLY_LANG+'&refer='+window.document.title+'&extra='+this.GOFLY_EXTRA); window.open(this.GOFLY_URL+'/chatIndex?kefu_id='+this.GOFLY_KEFU_ID+'&lang='+this.GOFLY_LANG+'&refer='+window.document.title+'&extra='+this.GOFLY_EXTRA);
} }
GOFLY.flashTitle=function () { GOFLY.flashTitle=function () {
if(this.titleTimer!=0){
return;
}
this.titleTimer = setInterval("GOFLY.flashTitleFunc()", 500);
}
GOFLY.flashTitleFunc=function(){
this.titleNum++; this.titleNum++;
if (this.titleNum >=3) { if (this.titleNum >=3) {
this.titleNum = 1; this.titleNum = 1;
@ -279,7 +286,6 @@ GOFLY.flashTitle=function () {
if (this.titleNum == 2) { if (this.titleNum == 2) {
document.title = '【new message】' + this.originTitle; document.title = '【new message】' + this.originTitle;
} }
this.titleTimer = setTimeout("GOFLY.flashTitle()", 500);
} }

Loading…
Cancel
Save