diff options
Diffstat (limited to 'src/client/Main.hx')
| -rw-r--r-- | src/client/Main.hx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx index 62fffcc..9ecae82 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -701,15 +701,7 @@ class Main { if (name == personal.name) { msgBuf.scrollTop = msgBuf.scrollHeight; } - if (document.hidden && onBlinkTab == null) { - onBlinkTab = new Timer(1000); - onBlinkTab.run = () -> { - if (document.title.startsWith(pageTitle)) - document.title = "*Chat*"; - else document.title = getPageTitle(); - } - onBlinkTab.run(); - } + if (onBlinkTab == null) blinkTabWithTitle("*Chat*"); } function onChatImageLoaded(e:Event):Void { @@ -753,6 +745,18 @@ class Main { } } + public function blinkTabWithTitle(title:String):Void { + if (!document.hidden) return; + if (onBlinkTab != null) onBlinkTab.stop(); + onBlinkTab = new Timer(1000); + onBlinkTab.run = () -> { + if (document.title.startsWith(pageTitle)) + document.title = title; + else document.title = getPageTitle(); + } + onBlinkTab.run(); + } + function setLeaderButton(flag:Bool):Void { final leaderBtn = ge("#leader_btn"); if (flag) leaderBtn.classList.add("label-success"); |
