diff --git a/app/main/controller/appcontroller.php b/app/main/controller/appcontroller.php index c4e541ec..1ad3ae1e 100644 --- a/app/main/controller/appcontroller.php +++ b/app/main/controller/appcontroller.php @@ -31,7 +31,7 @@ class AppController extends Controller { */ public function init(\Base $f3) { // page title - $f3->set('pageTitle', 'Login'); + $f3->set('pageTitle', 'Pathfinder'); // main page content $f3->set('pageContent', $f3->get('PATHFINDER.VIEW.LOGIN')); diff --git a/app/main/controller/mapcontroller.php b/app/main/controller/mapcontroller.php index a0a69836..c5a103f2 100644 --- a/app/main/controller/mapcontroller.php +++ b/app/main/controller/mapcontroller.php @@ -14,9 +14,11 @@ class MapController extends AccessController { * @param \Base $f3 */ public function init($f3) { + $character = $this->getCharacter(); // page title - $f3->set('pageTitle', 'Maps'); + $pageTitle = $character ? $character->name : 'Map'; + $f3->set('pageTitle', $pageTitle); // main page content $f3->set('pageContent', false); diff --git a/js/app/notification.js b/js/app/notification.js index 443858ab..f5aa2fd5 100644 --- a/js/app/notification.js +++ b/js/app/notification.js @@ -37,6 +37,12 @@ define([ } }; + // initial page title (cached) + var initialPageTitle = document.title; + + // global blink timeout cache + var blinkTimer; + // stack container for all notifications var stack = { bottomRight: { @@ -137,35 +143,48 @@ define([ var startTabBlink = function(blinkTitle){ var initBlink = (function(blinkTitle){ - var currentTitle = document.title; + // count blinks if tab is currently active + var activeTabBlinkCount = 0; - var timeoutId; var blink = function(){ - document.title = document.title === blinkTitle ? currentTitle : blinkTitle; - }; + // number of "blinks" should be limited if tab is currently active + if(window.isVisible){ + activeTabBlinkCount++; + } - var clear = function() { - clearInterval(timeoutId); - document.title = currentTitle; - window.onmousemove = null; - timeoutId = null; - }; + // toggle page title + document.title = (document.title === blinkTitle) ? initialPageTitle : blinkTitle; - return function () { - if (!timeoutId) { - timeoutId = setInterval(blink, 1000); - window.onmousemove = clear; + if(activeTabBlinkCount > 10){ + stopTabBlink(); } }; + return function () { + if (!blinkTimer) { + blinkTimer = setInterval(blink, 1000); + } + }; }( blinkTitle )); initBlink(); }; + /** + * stop blinking document.title + */ + var stopTabBlink = function(){ + if(blinkTimer){ + clearInterval(blinkTimer); + document.title = initialPageTitle; + blinkTimer = null; + } + }; + return { showNotify: showNotify, - startTabBlink: startTabBlink + startTabBlink: startTabBlink, + stopTabBlink: stopTabBlink }; }); diff --git a/js/app/page.js b/js/app/page.js index 92f89220..325a8f7a 100644 --- a/js/app/page.js +++ b/js/app/page.js @@ -890,12 +890,21 @@ define([ function handleVisibilityChange() { if (document[hidden]) { // tab is invisible + // globally store current visibility status + window.isVisible = false; + Util.getCurrentTriggerDelay( mapUpdateKey, increaseTimer ); Util.getCurrentTriggerDelay( mapUserUpdateKey, increaseTimer ); } else { // tab is visible + // globally store current visibility status + window.isVisible = true; + Util.getCurrentTriggerDelay( mapUpdateKey, -increaseTimer ); Util.getCurrentTriggerDelay( mapUserUpdateKey, -increaseTimer ); + + // stop blinking tab from previous notifications + Util.stopTabBlink(); } } diff --git a/js/app/util.js b/js/app/util.js index 91234e44..ee92c871 100644 --- a/js/app/util.js +++ b/js/app/util.js @@ -970,12 +970,20 @@ define([ * @param desktop */ var showNotify = function(customConfig, desktop){ - requirejs(['app/notification'], function(Notification) { Notification.showNotify(customConfig, desktop); }); }; + /** + * stop browser tab title "blinking" + */ + var stopTabBlink = function(){ + requirejs(['app/notification'], function(Notification) { + Notification.stopTabBlink(); + }); + }; + /** * get log entry info * @param logType @@ -1726,6 +1734,7 @@ define([ timeStop: timeStop, log: log, showNotify: showNotify, + stopTabBlink: stopTabBlink, getLogInfo: getLogInfo, isXHRAborted: isXHRAborted, getMapModule: getMapModule, diff --git a/public/js/v1.1.3/app/notification.js b/public/js/v1.1.3/app/notification.js index 443858ab..f5aa2fd5 100644 --- a/public/js/v1.1.3/app/notification.js +++ b/public/js/v1.1.3/app/notification.js @@ -37,6 +37,12 @@ define([ } }; + // initial page title (cached) + var initialPageTitle = document.title; + + // global blink timeout cache + var blinkTimer; + // stack container for all notifications var stack = { bottomRight: { @@ -137,35 +143,48 @@ define([ var startTabBlink = function(blinkTitle){ var initBlink = (function(blinkTitle){ - var currentTitle = document.title; + // count blinks if tab is currently active + var activeTabBlinkCount = 0; - var timeoutId; var blink = function(){ - document.title = document.title === blinkTitle ? currentTitle : blinkTitle; - }; + // number of "blinks" should be limited if tab is currently active + if(window.isVisible){ + activeTabBlinkCount++; + } - var clear = function() { - clearInterval(timeoutId); - document.title = currentTitle; - window.onmousemove = null; - timeoutId = null; - }; + // toggle page title + document.title = (document.title === blinkTitle) ? initialPageTitle : blinkTitle; - return function () { - if (!timeoutId) { - timeoutId = setInterval(blink, 1000); - window.onmousemove = clear; + if(activeTabBlinkCount > 10){ + stopTabBlink(); } }; + return function () { + if (!blinkTimer) { + blinkTimer = setInterval(blink, 1000); + } + }; }( blinkTitle )); initBlink(); }; + /** + * stop blinking document.title + */ + var stopTabBlink = function(){ + if(blinkTimer){ + clearInterval(blinkTimer); + document.title = initialPageTitle; + blinkTimer = null; + } + }; + return { showNotify: showNotify, - startTabBlink: startTabBlink + startTabBlink: startTabBlink, + stopTabBlink: stopTabBlink }; }); diff --git a/public/js/v1.1.3/app/page.js b/public/js/v1.1.3/app/page.js index 92f89220..325a8f7a 100644 --- a/public/js/v1.1.3/app/page.js +++ b/public/js/v1.1.3/app/page.js @@ -890,12 +890,21 @@ define([ function handleVisibilityChange() { if (document[hidden]) { // tab is invisible + // globally store current visibility status + window.isVisible = false; + Util.getCurrentTriggerDelay( mapUpdateKey, increaseTimer ); Util.getCurrentTriggerDelay( mapUserUpdateKey, increaseTimer ); } else { // tab is visible + // globally store current visibility status + window.isVisible = true; + Util.getCurrentTriggerDelay( mapUpdateKey, -increaseTimer ); Util.getCurrentTriggerDelay( mapUserUpdateKey, -increaseTimer ); + + // stop blinking tab from previous notifications + Util.stopTabBlink(); } } diff --git a/public/js/v1.1.3/app/util.js b/public/js/v1.1.3/app/util.js index 91234e44..ee92c871 100644 --- a/public/js/v1.1.3/app/util.js +++ b/public/js/v1.1.3/app/util.js @@ -970,12 +970,20 @@ define([ * @param desktop */ var showNotify = function(customConfig, desktop){ - requirejs(['app/notification'], function(Notification) { Notification.showNotify(customConfig, desktop); }); }; + /** + * stop browser tab title "blinking" + */ + var stopTabBlink = function(){ + requirejs(['app/notification'], function(Notification) { + Notification.stopTabBlink(); + }); + }; + /** * get log entry info * @param logType @@ -1726,6 +1734,7 @@ define([ timeStop: timeStop, log: log, showNotify: showNotify, + stopTabBlink: stopTabBlink, getLogInfo: getLogInfo, isXHRAborted: isXHRAborted, getMapModule: getMapModule, diff --git a/public/templates/view/index.html b/public/templates/view/index.html index c19781c4..0b4c9234 100644 --- a/public/templates/view/index.html +++ b/public/templates/view/index.html @@ -31,7 +31,7 @@ -