Skip to content

Commit

Permalink
Revert "Using sync instead Of Local Storage (hrai#269)" This reverts …
Browse files Browse the repository at this point in the history
…commit 46d39b1.
  • Loading branch information
hrai authored and Felix Wong committed Oct 15, 2024
1 parent 3048f9b commit c92eace
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
14 changes: 11 additions & 3 deletions distribution/manifest_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
"default_popup": "popup/settings.html"
},
"background": {
"scripts": ["dependencies/jquery.min.js", "lib/background.bundle.js"]
"scripts": [
"dependencies/jquery.min.js",
"lib/background.bundle.js"
]
},
"content_scripts": [
{
"run_at": "document_end",
"matches": ["<all_urls>"],
"matches": [
"<all_urls>"
],
"js": [
"dependencies/jquery.min.js",
"lib/main.bundle.js",
Expand All @@ -28,7 +33,10 @@
"48": "icons/auto-capitalise-sentence.png",
"128": "icons/auto-capitalise-sentence.png"
},
"permissions": ["storage", "tabs"],
"permissions": [
"storage",
"tabs"
],
"browser_specific_settings": {
"gecko": {
"id": "{680e06ed-65ed-4e11-a9c0-0e6f80b9a347}"
Expand Down
2 changes: 1 addition & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from './plugin-constants';
import browser from 'webextension-polyfill';

browser.storage.sync.set({
browser.storage.local.set({
[constantsKeyVal]: constantsKeyValuePairs,
[namesKeyVal]: namesKeyValuePairs,
[acronymsKeyVal]: acronymsKeyValuePairs,
Expand Down
2 changes: 1 addition & 1 deletion src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
const errorMsg = 'breaking loop';
let sitesToExclude = ['aws.amazon.com', 'whatsapp.com', 'messenger.com'];

browser.storage.sync
browser.storage.local
.get([
sitesToIgnore,
shouldCapitaliseI,
Expand Down
12 changes: 6 additions & 6 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $(document).on(`click.${pluginNamespace}`, '#ignoreSiteButton', function () {
var sites = getExcludedSites();
sites.push(hostname);

browser.storage.sync.set({
browser.storage.local.set({
sitesToIgnore: sites,
});

Expand All @@ -61,7 +61,7 @@ $(document).on(`click.${pluginNamespace}`, '#ignoreSiteButton', function () {
$(document).on(`click.${pluginNamespace}`, '#submitButton', function () {
var sites = getExcludedSites();

browser.storage.sync.set({
browser.storage.local.set({
sitesToIgnore: sites,
});

Expand All @@ -75,7 +75,7 @@ $(document).on(
function () {
var excludedWords = getExcludedWords();

browser.storage.sync.set({
browser.storage.local.set({
wordsToExclude: excludedWords,
});

Expand All @@ -90,7 +90,7 @@ $(document).on(
function () {
var includedWords = getIncludedWords();

browser.storage.sync.set({
browser.storage.local.set({
wordsToInclude: includedWords,
});

Expand All @@ -105,7 +105,7 @@ loadFlagValuesFromBrowserStorage(shouldCapitaliseAcronyms);
loadFlagValuesFromBrowserStorage(shouldCapitaliseLocations);

function loadFlagValuesFromBrowserStorage(flagName) {
browser.storage.sync.get(flagName).then((items) => {
browser.storage.local.get(flagName).then((items) => {
const flagValue = items[flagName];

if (flagValue === true || flagValue === undefined) {
Expand Down Expand Up @@ -135,7 +135,7 @@ function setupCheckboxChangeEventHandlers(flagName) {
}

function setShouldCapitaliseVariable(variableName, value) {
browser.storage.sync.set({
browser.storage.local.set({
[variableName]: value,
});
}
Expand Down

0 comments on commit c92eace

Please sign in to comment.