Skip to content

Commit a37a74b

Browse files
committed
Updated to 1.1.1
- Fixed a small bug
1 parent ee755fd commit a37a74b

File tree

2 files changed

+23
-25
lines changed

2 files changed

+23
-25
lines changed

js/background.js

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,27 @@ function saveUrlToData(enabled, time = 0) {
180180
});
181181
}
182182
}
183+
184+
if (timeSpentToday >= 0 && timeSpentToday < 60 * 30) {
185+
//30 minutes || OK
186+
changeIcon(0);
187+
setBadgeText(((timeSpentToday - (timeSpentToday % 60)) / 60).toString() + "m");
188+
} else if (timeSpentToday >= 60 * 30 && timeSpentToday < 60 * 60) {
189+
//60 minutes (1 hour) || Yellow
190+
changeIcon(2);
191+
createNotification(2, currentUrl, "30 minutes", "You have already spent 30 minutes on this site today");
192+
setBadgeText(((timeSpentToday - (timeSpentToday % 60)) / 60).toString() + "m", "#FFD400", "#000000");
193+
} else if (timeSpentToday >= 60 * 60 && timeSpentToday < 60 * 60 * 3) {
194+
//3 hours || Orange
195+
changeIcon(3);
196+
createNotification(3, currentUrl, "1 hour", "You have already spent 1 hour on this site today");
197+
setBadgeText(((timeSpentToday - (timeSpentToday % (60 * 60))) / (60 * 60)).toString() + "h", "#FF7C00", "#000000");
198+
} else if (timeSpentToday >= 60 * 60 * 3) {
199+
//>3 hours || Red
200+
changeIcon(4);
201+
createNotification(4, currentUrl, "3 hours", "You have already spent 3 hours on this site today");
202+
setBadgeText(">3h", "#FF0000");
203+
}
183204
})
184205
}
185206

@@ -265,29 +286,6 @@ function increaseTime(url) {
265286
if (url == currentUrl) {
266287
saveUrlToData(true, 1);
267288
}
268-
269-
if (timeSpentToday >= 0 && timeSpentToday < 60 * 30) {
270-
//30 minutes || OK
271-
changeIcon(0);
272-
setBadgeText(((timeSpentToday - (timeSpentToday % 60)) / 60).toString() + "m");
273-
} else if (timeSpentToday >= 60 * 30 && timeSpentToday < 60 * 60) {
274-
//60 minutes (1 hour) || Yellow
275-
changeIcon(2);
276-
createNotification(2, currentUrl, "30 minutes", "You have already spent 30 minutes on this site today");
277-
setBadgeText(((timeSpentToday - (timeSpentToday % 60)) / 60).toString() + "m", "#FFD400", "#000000");
278-
} else if (timeSpentToday >= 60 * 60 && timeSpentToday < 60 * 60 * 3) {
279-
//3 hours || Orange
280-
changeIcon(3);
281-
createNotification(3, currentUrl, "1 hour", "You have already spent 1 hour on this site today");
282-
setBadgeText(((timeSpentToday - (timeSpentToday % (60 * 60))) / (60 * 60)).toString() + "h", "#FF7C00", "#000000");
283-
} else if (timeSpentToday >= 60 * 60 * 3) {
284-
//>3 hours || Red
285-
changeIcon(4);
286-
createNotification(4, currentUrl, "3 hours", "You have already spent 1 hours on this site today");
287-
setBadgeText(">3h", "#FF0000");
288-
}
289-
290-
//console.log("All websites: " + JSON.stringify(websites_json));
291289
}
292290
}
293291

@@ -342,4 +340,4 @@ function setBadgeText(text, background_color = "#0080FF", text_color = "#FFFFFF"
342340
browser.browserAction.setBadgeBackgroundColor({color: background_color});
343341
}
344342

345-
loaded();
343+
loaded();

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "Limite",
4-
"version": "1.1",
4+
"version": "1.1.1",
55
"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!",
66
"icons": {
77
"16": "./img/icon-16.png",

0 commit comments

Comments
 (0)