From: David ‘Bombe’ Roden Date: Thu, 27 Jan 2011 13:39:48 +0000 (+0100) Subject: Prevent multiple blink cycles happening simultaneously. X-Git-Tag: 0.4.4^2~21 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a5ce5ddbbb0fcce6c7e6b15a66487381c2c1b1fd;hp=90b3a56445528f7331eeb0d47c65242e9dc51059;p=Sone.git Prevent multiple blink cycles happening simultaneously. --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 0bed52b..254c0c3 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1036,13 +1036,19 @@ function setActivity() { if (title.indexOf('(') != 0) { document.title = "(!) " + title; } - setTimeout(toggleIcon, 1500); + if (!iconBlinking) { + setTimeout(toggleIcon, 1500); + iconBlinking = true; + } } } /** Whether the icon is currently showing activity. */ var iconActive = false; +/** Whether the icon is currently supposed to blink. */ +var iconBlinking = false; + /** * Toggles the icon. If the window has gained focus and the icon is still * showing the activity state, it is returned to normal. @@ -1053,6 +1059,7 @@ function toggleIcon() { changeIcon("images/icon.png"); iconActive = false; } + iconBlinking = false; } else { iconActive = !iconActive; console.log("showing icon: " + iconActive);