From bd232b2e2b4acb4772a279b3c9564479714c8c20 Mon Sep 17 00:00:00 2001 From: JohnPiwinski <67392898+JohnPiwinski@users.noreply.github.com> Date: Wed, 16 Jun 2021 15:42:45 -0500 Subject: [PATCH 1/2] Update README.md --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 6d94366..aa42a13 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Web Activity Time Tracker Add to Chrome +# Web Activity Time Tracker Web Activity Time Tracker keeps track of how much time you spend on the web and presents the stats in a useful and intuitive way. You can set a daily visit limit for sites and block it after the expiration of the limit. @@ -7,12 +7,6 @@ Extension uses only local [chrome.storage API](https://developer.chrome.com/apps ![image](https://user-images.githubusercontent.com/23387046/68947288-242bf100-07c6-11ea-8b08-184be2dd306a.png) -If you have suggestions or problems using the extension, please [submit a bug or a feature request](https://github.com/Stigmatoz/web-activity-time-tracker/issues). - -# Chrome Web Store - -Web Activity Time Tracker is available via the official [Chrome Web Store](https://chrome.google.com/webstore/detail/web-activity-time-tracker/hhfnghjdeddcfegfekjeihfmbjenlomm). - # Install as an extension from source 1. Download the latest available version and unarchive to your preferred location (whichever suits you). From 64d4696279ede38a80058d92d9607702a2ba7229 Mon Sep 17 00:00:00 2001 From: JohnPiwinski Date: Wed, 16 Jun 2021 16:50:59 -0500 Subject: [PATCH 2/2] update --- src/block.html | 4 +- src/manifest.json | 95 +++++++++++++++++++++------------------ src/scripts/background.js | 2 +- src/scripts/common.js | 2 +- src/scripts/content.js | 25 +++++++++++ src/scripts/settings.js | 2 +- src/scripts/ui.js | 2 +- src/scripts/webact.js | 2 +- src/style/content.css | 9 ++++ 9 files changed, 92 insertions(+), 51 deletions(-) create mode 100644 src/scripts/content.js create mode 100644 src/style/content.css diff --git a/src/block.html b/src/block.html index cbeaf6f..690202a 100644 --- a/src/block.html +++ b/src/block.html @@ -14,7 +14,7 @@

Time limit

-
You've reached today your limit on
+
Do something meaningful with your life! You've reached today your limit on
Your current daily limit is
@@ -22,4 +22,4 @@

Web Activity Time Tracker

- \ No newline at end of file + diff --git a/src/manifest.json b/src/manifest.json index a5426e7..f279426 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,49 +1,56 @@ { - "manifest_version": 2, - - "name": "Web Activity Time Tracker", - "short_name": "Web Time Tracker", - "version": "1.5.4", - "minimum_chrome_version": "26", + "manifest_version": 2, - "description": "Track and limit time your activity in the browser every day.", + "name": "Web Activity Time Tracker", + "short_name": "Web Time Tracker", + "version": "1.5.4", + "minimum_chrome_version": "26", - "options_page": "options.html", - - "icons": { - "16": "icons/16x16.png", - "32": "icons/32x32.png", - "48": "icons/48x48.png", - "128": "icons/128x128.png" - }, - "permissions": [ - "tabs", - "activeTab", - "storage", - "idle", - "chrome://favicon/*", - "webNavigation", - "unlimitedStorage" - ], - "optional_permissions": [ - "https://www.youtube.com/*", - "https://www.netflix.com/*", - "notifications" - ], - "offline_enabled": true, - "background": { - "scripts": ["scripts/common.js", - "scripts/storage.js", - "scripts/activity.js", - "scripts/tab.js", - "scripts/timeInterval.js", - "scripts/background.js", - "scripts/restriction.js"], + "description": "Track and limit time your activity in the browser every day.", + + "options_page": "options.html", + + "icons": { + "16": "icons/16x16.png", + "32": "icons/32x32.png", + "48": "icons/48x48.png", + "128": "icons/128x128.png" + }, + "permissions": [ + "tabs", + "activeTab", + "storage", + "idle", + "chrome://favicon/*", + "webNavigation", + "unlimitedStorage" + ], + "optional_permissions": [ + "https://www.youtube.com/*", + "https://www.netflix.com/*", + "notifications" + ], + "offline_enabled": true, + "background": { + "scripts": ["scripts/common.js", + "scripts/storage.js", + "scripts/activity.js", + "scripts/tab.js", + "scripts/timeInterval.js", + "scripts/background.js", + "scripts/restriction.js"], "persistent": false - }, - "browser_action": { - "default_popup": "index.html", - "default_title": "Web Activity Time Tracker", - "default_icon": "icons/48x48.png" + }, + "content_scripts": [ + { + "matches": ["https://*.youtube.com/*"], + "css": ["style/content.css"], + "js": ["scripts/content.js"] } -} \ No newline at end of file + ], + "browser_action": { + "default_popup": "index.html", + "default_title": "Web Activity Time Tracker", + "default_icon": "icons/48x48.png" + } +} diff --git a/src/scripts/background.js b/src/scripts/background.js index f4ffb5d..0d40718 100644 --- a/src/scripts/background.js +++ b/src/scripts/background.js @@ -396,4 +396,4 @@ loadPermissions(); addListener(); loadAddDataFromStorage(); updateSummaryTime(); -updateStorage(); \ No newline at end of file +updateStorage(); diff --git a/src/scripts/common.js b/src/scripts/common.js index 08f35bf..b5ca72d 100644 --- a/src/scripts/common.js +++ b/src/scripts/common.js @@ -228,4 +228,4 @@ function treatAsUTC(date) { function daysBetween(startDate, endDate) { var millisecondsPerDay = 24 * 60 * 60 * 1000; return ((treatAsUTC(endDate) - treatAsUTC(startDate)) / millisecondsPerDay) + 1; -} \ No newline at end of file +} diff --git a/src/scripts/content.js b/src/scripts/content.js new file mode 100644 index 0000000..8d93649 --- /dev/null +++ b/src/scripts/content.js @@ -0,0 +1,25 @@ +var banner = document.createElement("h2"); +banner.id = "timer-banner" +banner.innerHTML = ""; +document.body.insertBefore(banner,document.body.childNodes[0]); + +var seconds = 0, minutes = 0, hours = 0, t; + +function add() { + seconds++; + if (seconds >= 60) { + seconds = 0; + minutes++; + if (minutes >= 60) { + minutes = 0; + hours++; + } + } + + banner.textContent = "You have wasted " + (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds) + " of your life."; + timer(); +} +function timer() { + t = setTimeout(add, 1000); +} +timer(); diff --git a/src/scripts/settings.js b/src/scripts/settings.js index 46112b8..457e53c 100644 --- a/src/scripts/settings.js +++ b/src/scripts/settings.js @@ -528,4 +528,4 @@ function updateNotificationList() { function updateNotificationMessage() { storage.saveValue(STORAGE_NOTIFICATION_MESSAGE, document.getElementById('notifyMessage').value); -} \ No newline at end of file +} diff --git a/src/scripts/ui.js b/src/scripts/ui.js index 83e9175..a189dde 100644 --- a/src/scripts/ui.js +++ b/src/scripts/ui.js @@ -419,4 +419,4 @@ class UI { document.getElementById('preloader').classList.remove('preloader'); document.getElementById('preloader').classList.add('hide'); } -} \ No newline at end of file +} diff --git a/src/scripts/webact.js b/src/scripts/webact.js index de0f653..be758ab 100644 --- a/src/scripts/webact.js +++ b/src/scripts/webact.js @@ -562,4 +562,4 @@ function fillValuesForBlockWithInActiveDay(prefix, dayValue, timeValue, flag) { document.getElementById(prefix).value = dayValue; document.getElementById(prefix + 'Time').value = timeValue; } -} \ No newline at end of file +} diff --git a/src/style/content.css b/src/style/content.css new file mode 100644 index 0000000..d6efd6d --- /dev/null +++ b/src/style/content.css @@ -0,0 +1,9 @@ +#timer-banner { + /*all: revert;*/ + + margin: auto; + width: 50%; + position: absolute; + text-align: center; + z-index: 1000000000; +}