From a5ce5ddbbb0fcce6c7e6b15a66487381c2c1b1fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 27 Jan 2011 14:39:48 +0100 Subject: [PATCH] Prevent multiple blink cycles happening simultaneously. --- src/main/resources/static/javascript/sone.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- 2.7.4