Skip to content

Commit

Permalink
Made some things more Firefox friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
aopell committed Feb 14, 2018
1 parent b6dc7f5 commit 98c9822
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ document.getElementById("home").innerHTML = svg;
document.documentElement.style.setProperty("--default-visibility", "visible");
document.body.appendChild(createElement("script", undefined, { src: "https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.7.1/gist-embed.min.js" }));

let footerText = `&copy; Aaron Opell 2018 | <a href="https://chrome.google.com/webstore/detail/${chrome.runtime.id}">Schoology Plus v${chrome.runtime.getManifest().version}${chrome.runtime.getManifest().update_url ? '' : ' dev'}</a> | <a href="https://github.com/aopell/SchoologyPlus/issues/new" title="Submit bug report or feature request">Send Feedback</a> | <a href="https://github.com/aopell/SchoologyPlus">View Source & Contribute</a> | <a href="#" id="open-contributors">Contributors</a> | <a href="#" id="open-changelog"> Changelog</a>`;
let footerText = `&copy; Aaron Opell 2018 | <a href="${getBrowser() == "Chrome" ? `https://chrome.google.com/webstore/detail/${chrome.runtime.id}` : "https://github.com/aopell/SchoologyPlus/releases/latest"}">Schoology Plus v${chrome.runtime.getManifest().version}${chrome.runtime.getManifest().update_url ? '' : ' dev'}</a> | <a href="https://github.com/aopell/SchoologyPlus/issues/new" title="Submit bug report or feature request">Send Feedback</a> | <a href="https://github.com/aopell/SchoologyPlus">View Source & Contribute</a> | <a href="#" id="open-contributors">Contributors</a> | <a href="#" id="open-changelog"> Changelog</a>`;

let frame = document.createElement("iframe");
frame.src = "data:text/html;charset=utf-8,<script src='https://gist.github.com/aopell/2cc6e752ee4dcee9b2f44fa3862f2886.js'></script>";
Expand Down
8 changes: 5 additions & 3 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ chrome.alarms.onAlarm.addListener(onAlarm);
console.log("Adding notification listener");
chrome.notifications.onClicked.addListener(function () {
console.log("Notification clicked");
window.open("https://lms.lausd.net/home/notifications", "_blank");
chrome.tabs.create({ url: "https://lms.lausd.net/home/notifications" }, null);
chrome.browserAction.setBadgeText({ text: "" });
});
chrome.browserAction.setBadgeBackgroundColor({ color: [217, 0, 0, 255] });
console.log("Adding browser action listener");
chrome.browserAction.onClicked.addListener(function () {
console.log("Browser action clicked");
chrome.browserAction.getBadgeText({}, x => {
console.log("Callback");
console.log(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");
if (n) chrome.tabs.create({ url: "https://lms.lausd.net/home/notifications" }, null);
else chrome.tabs.create({ url: "https://lms.lausd.net" }, null);
chrome.browserAction.setBadgeText({ text: "" });
});
});
Expand Down
12 changes: 12 additions & 0 deletions js/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ function createButton(id, text, callback) {
return createElement("span", ["submit-span-wrapper", "splus-modal-button"], { onclick: callback }, [createElement("input", ["form-submit"], { type: "button", value: text, id: id })]);
}

function getBrowser() {
if (typeof chrome !== "undefined") {
if (typeof browser !== "undefined") {
return "Firefox";
} else {
return "Chrome";
}
} else {
return "Edge";
}
}

/**
* Creates a setting, appends it to the settings list
* @param {string} name - The name of the setting, to be stored in extension settings
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"update_url": "https://gist.githubusercontent.com/aopell/82a6f5c409dc0af7e97d2ebaf88c84f6/raw/986586e057edde16f31e236e068370ffbb2203cd/update.json"
}
},
"version": "3.9.1",
"version": "3.9.2",
"icons": {
"128": "imgs/[email protected]",
"64": "imgs/[email protected]",
Expand Down

0 comments on commit 98c9822

Please sign in to comment.