From 89063941699b71cbed2a523e978477cdc286f4a4 Mon Sep 17 00:00:00 2001 From: RblSb Date: Sat, 9 May 2020 19:53:42 +0300 Subject: Blink tab on first video of player --- src/client/Main.hx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/client/Main.hx') 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"); -- cgit v1.2.3