Skip to content

Commit 64d4696

Browse files
committed
update
1 parent bd232b2 commit 64d4696

File tree

9 files changed

+92
-51
lines changed

9 files changed

+92
-51
lines changed

src/block.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<div>
1515
<img src="icons/time.svg" height="50">
1616
<p class="title">Time limit</p>
17-
<div class="description">You've reached today your limit on <span id='site' class="current-site"></span></div>
17+
<div class="description">Do something meaningful with your life! You've reached today your limit on <span id='site' class="current-site"></span></div>
1818
<div class="description margin-top-10">Your current daily limit is <span id='limit' class="current-limit"></span></div>
1919

2020
<div class="margin-top-10"><a id="deffererBtn" class="defferer-link">Set aside for 5 minutes</a></div>
2121
</div>
2222
<p class="product-title">Web Activity Time Tracker</p>
2323
</body>
2424

25-
</html>
25+
</html>

src/manifest.json

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,56 @@
11
{
2-
"manifest_version": 2,
3-
4-
"name": "Web Activity Time Tracker",
5-
"short_name": "Web Time Tracker",
6-
"version": "1.5.4",
7-
"minimum_chrome_version": "26",
2+
"manifest_version": 2,
83

9-
"description": "Track and limit time your activity in the browser every day.",
4+
"name": "Web Activity Time Tracker",
5+
"short_name": "Web Time Tracker",
6+
"version": "1.5.4",
7+
"minimum_chrome_version": "26",
108

11-
"options_page": "options.html",
12-
13-
"icons": {
14-
"16": "icons/16x16.png",
15-
"32": "icons/32x32.png",
16-
"48": "icons/48x48.png",
17-
"128": "icons/128x128.png"
18-
},
19-
"permissions": [
20-
"tabs",
21-
"activeTab",
22-
"storage",
23-
"idle",
24-
"chrome://favicon/*",
25-
"webNavigation",
26-
"unlimitedStorage"
27-
],
28-
"optional_permissions": [
29-
"https://www.youtube.com/*",
30-
"https://www.netflix.com/*",
31-
"notifications"
32-
],
33-
"offline_enabled": true,
34-
"background": {
35-
"scripts": ["scripts/common.js",
36-
"scripts/storage.js",
37-
"scripts/activity.js",
38-
"scripts/tab.js",
39-
"scripts/timeInterval.js",
40-
"scripts/background.js",
41-
"scripts/restriction.js"],
9+
"description": "Track and limit time your activity in the browser every day.",
10+
11+
"options_page": "options.html",
12+
13+
"icons": {
14+
"16": "icons/16x16.png",
15+
"32": "icons/32x32.png",
16+
"48": "icons/48x48.png",
17+
"128": "icons/128x128.png"
18+
},
19+
"permissions": [
20+
"tabs",
21+
"activeTab",
22+
"storage",
23+
"idle",
24+
"chrome://favicon/*",
25+
"webNavigation",
26+
"unlimitedStorage"
27+
],
28+
"optional_permissions": [
29+
"https://www.youtube.com/*",
30+
"https://www.netflix.com/*",
31+
"notifications"
32+
],
33+
"offline_enabled": true,
34+
"background": {
35+
"scripts": ["scripts/common.js",
36+
"scripts/storage.js",
37+
"scripts/activity.js",
38+
"scripts/tab.js",
39+
"scripts/timeInterval.js",
40+
"scripts/background.js",
41+
"scripts/restriction.js"],
4242
"persistent": false
43-
},
44-
"browser_action": {
45-
"default_popup": "index.html",
46-
"default_title": "Web Activity Time Tracker",
47-
"default_icon": "icons/48x48.png"
43+
},
44+
"content_scripts": [
45+
{
46+
"matches": ["https://*.youtube.com/*"],
47+
"css": ["style/content.css"],
48+
"js": ["scripts/content.js"]
4849
}
49-
}
50+
],
51+
"browser_action": {
52+
"default_popup": "index.html",
53+
"default_title": "Web Activity Time Tracker",
54+
"default_icon": "icons/48x48.png"
55+
}
56+
}

src/scripts/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,4 @@ loadPermissions();
396396
addListener();
397397
loadAddDataFromStorage();
398398
updateSummaryTime();
399-
updateStorage();
399+
updateStorage();

src/scripts/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,4 @@ function treatAsUTC(date) {
228228
function daysBetween(startDate, endDate) {
229229
var millisecondsPerDay = 24 * 60 * 60 * 1000;
230230
return ((treatAsUTC(endDate) - treatAsUTC(startDate)) / millisecondsPerDay) + 1;
231-
}
231+
}

src/scripts/content.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var banner = document.createElement("h2");
2+
banner.id = "timer-banner"
3+
banner.innerHTML = "";
4+
document.body.insertBefore(banner,document.body.childNodes[0]);
5+
6+
var seconds = 0, minutes = 0, hours = 0, t;
7+
8+
function add() {
9+
seconds++;
10+
if (seconds >= 60) {
11+
seconds = 0;
12+
minutes++;
13+
if (minutes >= 60) {
14+
minutes = 0;
15+
hours++;
16+
}
17+
}
18+
19+
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.";
20+
timer();
21+
}
22+
function timer() {
23+
t = setTimeout(add, 1000);
24+
}
25+
timer();

src/scripts/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,4 +528,4 @@ function updateNotificationList() {
528528

529529
function updateNotificationMessage() {
530530
storage.saveValue(STORAGE_NOTIFICATION_MESSAGE, document.getElementById('notifyMessage').value);
531-
}
531+
}

src/scripts/ui.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,4 +419,4 @@ class UI {
419419
document.getElementById('preloader').classList.remove('preloader');
420420
document.getElementById('preloader').classList.add('hide');
421421
}
422-
}
422+
}

src/scripts/webact.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,4 +562,4 @@ function fillValuesForBlockWithInActiveDay(prefix, dayValue, timeValue, flag) {
562562
document.getElementById(prefix).value = dayValue;
563563
document.getElementById(prefix + 'Time').value = timeValue;
564564
}
565-
}
565+
}

src/style/content.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#timer-banner {
2+
/*all: revert;*/
3+
4+
margin: auto;
5+
width: 50%;
6+
position: absolute;
7+
text-align: center;
8+
z-index: 1000000000;
9+
}

0 commit comments

Comments
 (0)