diff --git a/.DS_Store b/.DS_Store index 4d5997b..eb666dc 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/js/background.js b/js/background.js index fe0a35f..b92d054 100644 --- a/js/background.js +++ b/js/background.js @@ -14,6 +14,8 @@ var checkTimer = null; var changedEdits = false; var changedTab = false; +var minimized = false; + var activeTabId; const linkReview = ["https://addons.mozilla.org/firefox/addon/limite/"]; //{firefox add-ons} @@ -24,6 +26,18 @@ function loaded() { //catch changing of tab browser.tabs.onActivated.addListener(tabUpdated); browser.tabs.onUpdated.addListener(tabUpdated); + browser.windows.onFocusChanged.addListener(checkLostFocus); +} + +function checkLostFocus(windowId) { + if (windowId === browser.windows.WINDOW_ID_NONE) { + // The browser window is minimized or lost focus + minimized = true; + } else { + //browser has focus + minimized = false; + } + //console.log("Minimized: " + minimized); } function reload() { @@ -289,7 +303,7 @@ function checkEverySecond(url) { } function increaseTime(url) { - if (enabledOrNot) { + if (enabledOrNot && !minimized) { if (url === currentUrl) { saveUrlToData(true, 1); } diff --git a/manifest.json b/manifest.json index 67dbde6..616d991 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Limite", - "version": "2.0.0.1", + "version": "2.0.1", "author": "Saverio Morelli (Sav22999)", "description": "Check how much time you spend on each website every day.\nOptimise your productivity, your time and your life as well.\nDon't lose precious time!", "icons": {