Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
changed browser to chrome for local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Nulkem committed Dec 8, 2021
1 parent 5887faf commit 984a060
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/SEQTA.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ async function finishLoad() {
}

function SetDefaultValues() {
browser.storage.local.set({
onoff: true,
});
chrome.storage.local.set({ onoff: true });
}

function waitForElm(selector) {
Expand Down Expand Up @@ -67,8 +65,9 @@ function RunFunctionOnTrue(storedSetting) {
if (storedSetting.onoff == undefined) {
// Set the value to true, and rerun the function
SetDefaultValues();
var gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(RunFunctionOnTrue, SetDefaultValues);
chrome.storage.local.get(null, function (items) {
RunFunctionOnTrue(items);
});
}
// If the option is 'on', open BetterSEQTA
if (storedSetting.onoff) {
Expand Down Expand Up @@ -184,8 +183,9 @@ document.addEventListener(
if (document.childNodes[1].textContent.includes("SEQTA") && !IsSEQTAPage) {
IsSEQTAPage = true;
console.log("seqta page");
var gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(RunFunctionOnTrue, SetDefaultValues);
chrome.storage.local.get(null, function (items) {
RunFunctionOnTrue(items);
});
}
},
true
Expand Down
4 changes: 3 additions & 1 deletion src/inject/injected.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ function CheckCurrentLesson(lesson, num) {
} else {
// Removes the activelesson class to ensure only the active lesson have the class
var elementA = document.getElementById("lesson" + num);
elementA.classList.remove("activelesson");
if (elementA != null) {
elementA.classList.remove("activelesson");
}
}
}

Expand Down
13 changes: 8 additions & 5 deletions src/popup/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ function FindSEQTATab() {
Store the currently selected settings using chrome.storage.local.
*/
function storeSettings() {
browser.storage.local.set({
onoff: onoffselection.checked,
chrome.storage.local.set({ onoff: onoffselection.checked }, function () {
console.log("set the value");
FindSEQTATab();
});
FindSEQTATab();
}
/*
Update the options UI with the settings values retrieved from storage,
Expand All @@ -38,8 +38,11 @@ function onError(e) {
/*
On opening the options page, fetch stored settings and update the UI with them.
*/
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(updateUI, onError);
chrome.storage.local.get(["onoff"], function (result) {
updateUI(result);
});
// const gettingStoredSettings = browser.storage.local.get();
// gettingStoredSettings.then(updateUI, onError);

/*
On blur, save the currently selected settings.
Expand Down

0 comments on commit 984a060

Please sign in to comment.