aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2019-07-22 16:42:57 -0400
committerAjay Ramachandran <[email protected]>2019-07-22 16:42:57 -0400
commitbaefc5995461f38beaed5759928ff6bbf27f923d (patch)
treeb4a58611f5890c3dbd87cc124197a79625dc4e4f
parent14121af9005d5664503ac75861379cddf4afb562 (diff)
downloadSponsorBlock-baefc5995461f38beaed5759928ff6bbf27f923d.tar.gz
SponsorBlock-baefc5995461f38beaed5759928ff6bbf27f923d.zip
Switched it from using local storage to synced storage.
-rw-r--r--background.js12
-rw-r--r--content.js8
-rw-r--r--popup.js16
3 files changed, 18 insertions, 18 deletions
diff --git a/background.js b/background.js
index 026b83f8..1c1c3ad6 100644
--- a/background.js
+++ b/background.js
@@ -53,7 +53,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
function getSponsorTimes(videoID, callback) {
let sponsorTimes = [];
let sponsorTimeKey = "sponsorTimes" + videoID;
- chrome.storage.local.get([sponsorTimeKey], function(result) {
+ chrome.storage.sync.get([sponsorTimeKey], function(result) {
let sponsorTimesStorage = result[sponsorTimeKey];
if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
sponsorTimes = sponsorTimesStorage;
@@ -79,7 +79,7 @@ function addSponsorTime(time) {
//save this info
let sponsorTimeKey = "sponsorTimes" + previousVideoID;
- chrome.storage.local.set({[sponsorTimeKey]: sponsorTimes});
+ chrome.storage.sync.set({[sponsorTimeKey]: sponsorTimes});
});
}
@@ -109,7 +109,7 @@ function submitVote(type, UUID, callback) {
function submitTimes(videoID, callback) {
//get the video times from storage
let sponsorTimeKey = 'sponsorTimes' + videoID;
- chrome.storage.local.get([sponsorTimeKey], function(result) {
+ chrome.storage.sync.get([sponsorTimeKey], function(result) {
let sponsorTimes = result[sponsorTimeKey];
if (sponsorTimes != undefined && sponsorTimes.length > 0) {
@@ -140,7 +140,7 @@ function videoIDChange(currentVideoID) {
if (previousVideoID != null) {
//get the sponsor times from storage
let sponsorTimeKey = 'sponsorTimes' + previousVideoID;
- chrome.storage.local.get([sponsorTimeKey], function(result) {
+ chrome.storage.sync.get([sponsorTimeKey], function(result) {
let sponsorTimes = result[sponsorTimeKey];
if (sponsorTimes != undefined && sponsorTimes.length > 0) {
@@ -168,7 +168,7 @@ function getUserID(callback) {
}
//if it is not cached yet, grab it from storage
- chrome.storage.local.get(["userID"], function(result) {
+ chrome.storage.sync.get(["userID"], function(result) {
let userIDStorage = result.userID;
if (userIDStorage != undefined) {
userID = userIDStorage;
@@ -178,7 +178,7 @@ function getUserID(callback) {
userID = generateUUID();
//save this UUID
- chrome.storage.local.set({"userID": userID});
+ chrome.storage.sync.set({"userID": userID});
callback(userID);
}
diff --git a/content.js b/content.js
index 969bf7c8..2e2310fe 100644
--- a/content.js
+++ b/content.js
@@ -36,7 +36,7 @@ var hideVideoPlayerControls = false;
//if the notice should not be shown
//happens when the user click's the "Don't show notice again" button
var dontShowNotice = false;
-chrome.storage.local.get(["dontShowNoticeAgain"], function(result) {
+chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) {
let dontShowNoticeAgain = result.dontShowNoticeAgain;
if (dontShowNoticeAgain != undefined) {
dontShowNotice = dontShowNoticeAgain;
@@ -106,7 +106,7 @@ function videoIDChange(id) {
});
//see if video control buttons should be added
- chrome.storage.local.get(["hideVideoPlayerControls"], function(result) {
+ chrome.storage.sync.get(["hideVideoPlayerControls"], function(result) {
if (result.hideVideoPlayerControls != undefined) {
hideVideoPlayerControls = result.hideVideoPlayerControls;
}
@@ -495,7 +495,7 @@ function closeAllSkipNotices(){
}
function dontShowNoticeAgain() {
- chrome.storage.local.set({"dontShowNoticeAgain": true});
+ chrome.storage.sync.set({"dontShowNoticeAgain": true});
dontShowNotice = true;
@@ -540,7 +540,7 @@ function submitSponsorTimes() {
//clear the sponsor times
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
- chrome.storage.local.set({[sponsorTimeKey]: []});
+ chrome.storage.sync.set({[sponsorTimeKey]: []});
} else {
//for a more detailed error message, they should check the popup
//show that the upload failed
diff --git a/popup.js b/popup.js
index 3490297a..561a273e 100644
--- a/popup.js
+++ b/popup.js
@@ -22,7 +22,7 @@ var isYouTubeTab = false;
//if the don't show notice again variable is true, an option to
// disable should be available
-chrome.storage.local.get(["dontShowNoticeAgain"], function(result) {
+chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) {
let dontShowNoticeAgain = result.dontShowNoticeAgain;
if (dontShowNoticeAgain != undefined && dontShowNoticeAgain) {
document.getElementById("showNoticeAgain").style.display = "unset";
@@ -30,7 +30,7 @@ chrome.storage.local.get(["dontShowNoticeAgain"], function(result) {
});
//show proper video player controls option
-chrome.storage.local.get(["hideVideoPlayerControls"], function(result) {
+chrome.storage.sync.get(["hideVideoPlayerControls"], function(result) {
let hideVideoPlayerControls = result.hideVideoPlayerControls;
if (hideVideoPlayerControls != undefined && hideVideoPlayerControls) {
document.getElementById("hideVideoPlayerControls").style.display = "none";
@@ -55,7 +55,7 @@ function loadTabData(tabs) {
//load video times for this video
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
- chrome.storage.local.get([sponsorTimeKey], function(result) {
+ chrome.storage.sync.get([sponsorTimeKey], function(result) {
let sponsorTimesStorage = result[sponsorTimeKey];
if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
if (sponsorTimesStorage[sponsorTimesStorage.length - 1] != undefined && sponsorTimesStorage[sponsorTimesStorage.length - 1].length < 2) {
@@ -140,7 +140,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
sponsorTimes[sponsorTimesIndex][startTimeChosen ? 1 : 0] = request.time;
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
- chrome.storage.local.set({[sponsorTimeKey]: sponsorTimes});
+ chrome.storage.sync.set({[sponsorTimeKey]: sponsorTimes});
updateStartTimeChosen();
@@ -260,7 +260,7 @@ function clearTimes() {
sponsorTimes = [];
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
- chrome.storage.local.set({[sponsorTimeKey]: sponsorTimes});
+ chrome.storage.sync.set({[sponsorTimeKey]: sponsorTimes});
displaySponsorTimes();
@@ -305,7 +305,7 @@ function submitTimes() {
}
function showNoticeAgain() {
- chrome.storage.local.set({"dontShowNoticeAgain": false});
+ chrome.storage.sync.set({"dontShowNoticeAgain": false});
chrome.tabs.query({
active: true,
@@ -320,7 +320,7 @@ function showNoticeAgain() {
}
function hideVideoPlayerControls() {
- chrome.storage.local.set({"hideVideoPlayerControls": true});
+ chrome.storage.sync.set({"hideVideoPlayerControls": true});
chrome.tabs.query({
active: true,
@@ -337,7 +337,7 @@ function hideVideoPlayerControls() {
}
function showVideoPlayerControls() {
- chrome.storage.local.set({"hideVideoPlayerControls": false});
+ chrome.storage.sync.set({"hideVideoPlayerControls": false});
chrome.tabs.query({
active: true,