标题闪烁

pull/30/head
taoshihan1991 4 years ago
parent 911a40c4bd
commit 1365e1af78

@ -183,7 +183,9 @@
this.saveHistory(content); this.saveHistory(content);
this.scrollBottom(); this.scrollBottom();
flashTitle();//标题闪烁
} }
window.parent.postMessage(redata);
}, },
//发送给客户 //发送给客户
chatToUser() { chatToUser() {
@ -378,11 +380,19 @@
} }
},5000); },5000);
}, },
//初始化
init(){
this.initCss();
this.initConn();
window.onfocus = function () {
clearTimeout(titleTimer);
document.title = originTitle;
};
},
}, },
created: function () { created: function () {
this.initCss(); this.init();
this.initConn();
this.getUserInfo(); this.getUserInfo();
//加载历史记录 //加载历史记录
this.getMesssagesByVisitorId(); this.getMesssagesByVisitorId();

@ -8,6 +8,7 @@
<meta name="description" content="GO-FLY{{.SubIntro}}" /> <meta name="description" content="GO-FLY{{.SubIntro}}" />
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.min.js"></script> <script src="https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.min.js"></script>
<script src="/static/js/functions.js"></script>
<style> <style>
*{ *{
margin: 0;padding: 0; margin: 0;padding: 0;
@ -148,5 +149,15 @@ $("#visitorBtn").click(function(){
} }
}); });
}); });
window.addEventListener('message',function(e){
var msg=e.data;
if(msg.type=="message"){
flashTitle();//标题闪烁
}
});
window.onfocus = function () {
clearTimeout(titleTimer);
document.title = originTitle;
};
</script> </script>
</html> </html>

@ -38,3 +38,18 @@ function notify(title, options, callback) {
} }
} }
} }
var titleTimer,titleNum=0;
var originTitle = document.title;
function flashTitle() {
titleNum++;
if (titleNum == 3) {
titleNum = 1;
}
if (titleNum == 1) {
document.title = '【】' + originTitle;
}
if (titleNum == 2) {
document.title = '【你有一条消息】' + originTitle;
}
titleTimer = setTimeout("flashTitle()", 500);
}
Loading…
Cancel
Save