Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v3.3.2 #92

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ if (typeof browser == "undefined") {
globalThis.browser = chrome;
}

const styleIdentifier = "pfwa";
const settingsIdentifier = "settings";
const defaultSettings = {
settings: {
Expand Down Expand Up @@ -57,7 +56,11 @@ browser.runtime.onInstalled.addListener(() => {

// Set default settings upon install
browser.storage.sync.get([settingsIdentifier]).then((result) => {
if (result.hasOwnProperty(settingsIdentifier)) return;
if (result.hasOwnProperty(settingsIdentifier)) {
var defaultKeys = Object.keys(defaultSettings.settings).sort();
var currentKeys = Object.keys(result.settings).sort();
if(JSON.stringify(defaultKeys) === JSON.stringify(currentKeys)) return;
}
browser.storage.sync.set(defaultSettings);
});
});
Expand All @@ -67,7 +70,10 @@ browser.commands.onCommand.addListener((command) => {
if (command != "toggle") return;

browser.storage.sync.get([settingsIdentifier]).then((result) => {
if (!result.hasOwnProperty(settingsIdentifier)) return;
if (!result.hasOwnProperty(settingsIdentifier)) {
browser.runtime.reload();
return;
}

result.settings.on = !result.settings.on;
browser.storage.sync.set(result);
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default_locale": "en",
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "3.3.0",
"version": "3.3.1",
"action": {
"default_title": "__MSG_extensionName__",
"default_popup": "popup/popup.html",
Expand Down
2 changes: 1 addition & 1 deletion src/manifest_firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default_locale": "en",
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "3.3.0",
"version": "3.3.1",
"action": {
"default_title": "__MSG_extensionName__",
"default_popup": "popup/popup.html",
Expand Down
5 changes: 4 additions & 1 deletion src/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ function saveSettings() {
let checked = this.checked;

browser.storage.sync.get([settingsIdentifier]).then((result) => {
if (!result.hasOwnProperty(settingsIdentifier)) return;
if (!result.hasOwnProperty(settingsIdentifier)) {
browser.runtime.reload();
return;
}
if (id == "on") {
result.settings.on = checked;
} else if (id === "blurOnIdle") {
Expand Down