Skip to content

Commit

Permalink
Changed browseraction url depending on notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
aopell committed Jan 15, 2018
1 parent a9cfca8 commit bc8b2aa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ chrome.browserAction.setBadgeText({ text: "" });
console.log("Adding browser action listener");
chrome.browserAction.onClicked.addListener(function () {
console.log("Browser action clicked");
window.open("https://lms.lausd.net/home/notifications", "_blank");
chrome.browserAction.setBadgeText({ text: "" });
chrome.browserAction.getBadgeText({}, x => {
let n = Number.parseInt(x);
if (n) window.open("https://lms.lausd.net/home/notifications", "_blank");
else window.open("https://lms.lausd.net", "_blank");
chrome.browserAction.setBadgeText({ text: "" });
});
});

function onAlarm(alarm) {
Expand Down

0 comments on commit bc8b2aa

Please sign in to comment.