From e6d8c31d7ad9d51c5ac2503335c301045a099701 Mon Sep 17 00:00:00 2001 From: Nokita Kaze Date: Sat, 3 Jan 2015 00:32:17 +0300 Subject: [PATCH] =?UTF-8?q?*=20=D0=95=D1=81=D0=BB=D0=B8=20=D0=BE=D0=BA?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=BD=D0=BE=D0=B5?= =?UTF-8?q?,=20=D0=BC=D1=8B=20=D0=BD=D0=B5=20=D0=BC=D0=B5=D0=BD=D1=8F?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=B7=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chrome_point_plus/js/point-plus.js | 29 ++++++++++++++++++++++++++++- chrome_point_plus/manifest.json | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/chrome_point_plus/js/point-plus.js b/chrome_point_plus/js/point-plus.js index 2384cdb..c9ff5cd 100644 --- a/chrome_point_plus/js/point-plus.js +++ b/chrome_point_plus/js/point-plus.js @@ -1231,6 +1231,32 @@ function set_comments_refresh_tick(current_options) { setInterval(function() { comments_count_refresh_tick(current_options); }, 60000); + + // Ставим слежение за позицией мыши + if (current_options.option_other_comments_count_refresh_title.value == true) { + $(document). + on('mouseenter', function() { + set_comments_refresh_clear_title_marks(); + }).on('mouseleave', function() { + window_focused = false; + }); + + $(window). + on('focus', function() { + set_comments_refresh_clear_title_marks(); + }).on('blur', function() { + window_focused = false; + }); + } +} + +var window_focused = true; + +// Очищаем [0; 0] +function set_comments_refresh_clear_title_marks() { + var new_title = document.title.replace(new RegExp('^\\[[0-9]+\\; [0-9]+\\] '), ''); + document.title = new_title; + window_focused = true; } // Проверка обновления комментариев, обновляется по крону @@ -1280,7 +1306,8 @@ function comments_count_refresh_tick(current_options) { $('#main #left-menu #menu-comments .unread').text('0').hide(); } - if (current_options.option_other_comments_count_refresh_title.value == true) { + if ((current_options.option_other_comments_count_refresh_title.value == true) && + (!window_focused)) { var new_title = document.title.replace(new RegExp('^\\[[0-9]+\\; [0-9]+\\] '), ''); if ((count_recent > 0) || (count_comments > 0)) { new_title = '[' + count_recent + '; ' + count_comments + '] ' + new_title; diff --git a/chrome_point_plus/manifest.json b/chrome_point_plus/manifest.json index b80db4e..c2d1015 100644 --- a/chrome_point_plus/manifest.json +++ b/chrome_point_plus/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Point+", - "version": "1.18.5", + "version": "1.18.6", "default_locale": "ru", "author": "__MSG_ext_author__", "homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus",