diff options
| author | RblSb <msrblsb@gmail.com> | 2020-05-09 19:53:42 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2020-05-09 19:53:42 +0300 |
| commit | 89063941699b71cbed2a523e978477cdc286f4a4 (patch) | |
| tree | fe8661c1ba687a8120aafc1c5306f5a6616190af /res/client.js | |
| parent | 047400de951a90e51967c0298cf3e8895410a071 (diff) | |
Blink tab on first video of player
Diffstat (limited to 'res/client.js')
| -rw-r--r-- | res/client.js | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/res/client.js b/res/client.js index 24ec1c5..6d00cff 100644 --- a/res/client.js +++ b/res/client.js @@ -1568,7 +1568,6 @@ client_Main.prototype = { window.document.querySelector("#messagebuffer").textContent = ""; } ,addMessage: function(name,text,time) { - var _gthis = this; var msgBuf = window.document.querySelector("#messagebuffer"); var userDiv = window.document.createElement("div"); userDiv.className = "chat-msg-" + name; @@ -1617,16 +1616,8 @@ client_Main.prototype = { if(name == this.personal.name) { msgBuf.scrollTop = msgBuf.scrollHeight; } - if(window.document.hidden && this.onBlinkTab == null) { - this.onBlinkTab = new haxe_Timer(1000); - this.onBlinkTab.run = function() { - if(StringTools.startsWith(window.document.title,_gthis.pageTitle)) { - return window.document.title = "*Chat*"; - } else { - return window.document.title = _gthis.getPageTitle(); - } - }; - this.onBlinkTab.run(); + if(this.onBlinkTab == null) { + this.blinkTabWithTitle("*Chat*"); } } ,onChatImageLoaded: function(e) { @@ -1659,6 +1650,24 @@ client_Main.prototype = { this.send({ type : "Rewind", rewind : { time : Std.parseInt(text)}}); } } + ,blinkTabWithTitle: function(title) { + var _gthis = this; + if(!window.document.hidden) { + return; + } + if(this.onBlinkTab != null) { + this.onBlinkTab.stop(); + } + this.onBlinkTab = new haxe_Timer(1000); + this.onBlinkTab.run = function() { + if(StringTools.startsWith(window.document.title,_gthis.pageTitle)) { + return window.document.title = title; + } else { + return window.document.title = _gthis.getPageTitle(); + } + }; + this.onBlinkTab.run(); + } ,setLeaderButton: function(flag) { var leaderBtn = window.document.querySelector("#leader_btn"); if(flag) { @@ -1773,9 +1782,12 @@ client_Player.prototype = { this.setItemElementType(this.videoItemsEl.children[pos],this.items[pos].isTemp); } ,setPlayer: function(newPlayer) { - if(this.player != null && this.player != newPlayer) { - client_JsApi.fireVideoRemoveEvents(this.items[this.itemPos]); - this.player.removeVideo(); + if(this.player != newPlayer) { + if(this.player != null) { + client_JsApi.fireVideoRemoveEvents(this.items[this.itemPos]); + this.player.removeVideo(); + } + this.main.blinkTabWithTitle("*Video*"); } this.player = newPlayer; } |
