mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 01:01:55 +01:00
Fixed weird way of getting stored data.
This commit is contained in:
parent
ca9aa130f8
commit
81f88a3656
1 changed files with 13 additions and 11 deletions
24
popup.js
24
popup.js
|
@ -34,15 +34,15 @@ function loadTabData(tabs) {
|
|||
//load video times for this video
|
||||
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
|
||||
chrome.storage.local.get([sponsorTimeKey], function(result) {
|
||||
sponsorTimes = result[sponsorTimeKey];
|
||||
if (sponsorTimes != undefined && sponsorTimes != []) {
|
||||
if (sponsorTimes[sponsorTimes.length - 1]!= undefined && sponsorTimes[sponsorTimes.length - 1].length < 2) {
|
||||
let sponsorTimesStorage = result[sponsorTimeKey];
|
||||
if (sponsorTimesStorage != undefined && sponsorTimesStorage != []) {
|
||||
if (sponsorTimesStorage[sponsorTimesStorage.length - 1] != undefined && sponsorTimesStorage[sponsorTimesStorage.length - 1].length < 2) {
|
||||
startTimeChosen = true;
|
||||
}
|
||||
|
||||
sponsorTimes = sponsorTimesStorage;
|
||||
|
||||
displaySponsorTimes();
|
||||
} else {
|
||||
sponsorTimes = []
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -170,12 +170,14 @@ function clearTimes() {
|
|||
}
|
||||
|
||||
function submitTimes() {
|
||||
chrome.runtime.sendMessage({
|
||||
message: "submitTimes",
|
||||
videoID: currentVideoID
|
||||
}, function(request) {
|
||||
clearTimes();
|
||||
});
|
||||
if (sponsorTimes.length > 0) {
|
||||
chrome.runtime.sendMessage({
|
||||
message: "submitTimes",
|
||||
videoID: currentVideoID
|
||||
}, function(request) {
|
||||
clearTimes();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//converts time in seconds to minutes:seconds
|
||||
|
|
Loading…
Reference in a new issue