Skip to content

Commit

Permalink
Updated to 1.1.1
Browse files Browse the repository at this point in the history
- Fixed a small bug
  • Loading branch information
Sav22999 committed Jul 19, 2021
1 parent ee755fd commit a37a74b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
46 changes: 22 additions & 24 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,27 @@ function saveUrlToData(enabled, time = 0) {
});
}
}

if (timeSpentToday >= 0 && timeSpentToday < 60 * 30) {
//30 minutes || OK
changeIcon(0);
setBadgeText(((timeSpentToday - (timeSpentToday % 60)) / 60).toString() + "m");
} else if (timeSpentToday >= 60 * 30 && timeSpentToday < 60 * 60) {
//60 minutes (1 hour) || Yellow
changeIcon(2);
createNotification(2, currentUrl, "30 minutes", "You have already spent 30 minutes on this site today");
setBadgeText(((timeSpentToday - (timeSpentToday % 60)) / 60).toString() + "m", "#FFD400", "#000000");
} else if (timeSpentToday >= 60 * 60 && timeSpentToday < 60 * 60 * 3) {
//3 hours || Orange
changeIcon(3);
createNotification(3, currentUrl, "1 hour", "You have already spent 1 hour on this site today");
setBadgeText(((timeSpentToday - (timeSpentToday % (60 * 60))) / (60 * 60)).toString() + "h", "#FF7C00", "#000000");
} else if (timeSpentToday >= 60 * 60 * 3) {
//>3 hours || Red
changeIcon(4);
createNotification(4, currentUrl, "3 hours", "You have already spent 3 hours on this site today");
setBadgeText(">3h", "#FF0000");
}
})
}

Expand Down Expand Up @@ -265,29 +286,6 @@ function increaseTime(url) {
if (url == currentUrl) {
saveUrlToData(true, 1);
}

if (timeSpentToday >= 0 && timeSpentToday < 60 * 30) {
//30 minutes || OK
changeIcon(0);
setBadgeText(((timeSpentToday - (timeSpentToday % 60)) / 60).toString() + "m");
} else if (timeSpentToday >= 60 * 30 && timeSpentToday < 60 * 60) {
//60 minutes (1 hour) || Yellow
changeIcon(2);
createNotification(2, currentUrl, "30 minutes", "You have already spent 30 minutes on this site today");
setBadgeText(((timeSpentToday - (timeSpentToday % 60)) / 60).toString() + "m", "#FFD400", "#000000");
} else if (timeSpentToday >= 60 * 60 && timeSpentToday < 60 * 60 * 3) {
//3 hours || Orange
changeIcon(3);
createNotification(3, currentUrl, "1 hour", "You have already spent 1 hour on this site today");
setBadgeText(((timeSpentToday - (timeSpentToday % (60 * 60))) / (60 * 60)).toString() + "h", "#FF7C00", "#000000");
} else if (timeSpentToday >= 60 * 60 * 3) {
//>3 hours || Red
changeIcon(4);
createNotification(4, currentUrl, "3 hours", "You have already spent 1 hours on this site today");
setBadgeText(">3h", "#FF0000");
}

//console.log("All websites: " + JSON.stringify(websites_json));
}
}

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

loaded();
loaded();
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Limite",
"version": "1.1",
"version": "1.1.1",
"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": {
"16": "./img/icon-16.png",
Expand Down

0 comments on commit a37a74b

Please sign in to comment.