mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-13 23:17:05 +03:00
Fixed sponsor times not properly saving
This commit is contained in:
10
popup.js
10
popup.js
@@ -209,7 +209,9 @@ function runThePopup() {
|
|||||||
function onTabs(tabs) {
|
function onTabs(tabs) {
|
||||||
chrome.tabs.sendMessage(tabs[0].id, {message: 'getVideoID'}, function(result) {
|
chrome.tabs.sendMessage(tabs[0].id, {message: 'getVideoID'}, function(result) {
|
||||||
if (result != undefined && result.videoID) {
|
if (result != undefined && result.videoID) {
|
||||||
loadTabData(tabs, result.videoID);
|
currentVideoID = result.videoID;
|
||||||
|
|
||||||
|
loadTabData(tabs);
|
||||||
} else if (result == undefined && chrome.runtime.lastError) {
|
} else if (result == undefined && chrome.runtime.lastError) {
|
||||||
//this isn't a YouTube video then, or at least the content script is not loaded
|
//this isn't a YouTube video then, or at least the content script is not loaded
|
||||||
displayNoVideo();
|
displayNoVideo();
|
||||||
@@ -217,15 +219,15 @@ function runThePopup() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadTabData(tabs, videoID) {
|
function loadTabData(tabs) {
|
||||||
if (!videoID) {
|
if (!currentVideoID) {
|
||||||
//this isn't a YouTube video then
|
//this isn't a YouTube video then
|
||||||
displayNoVideo();
|
displayNoVideo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//load video times for this video
|
//load video times for this video
|
||||||
let sponsorTimeKey = "sponsorTimes" + videoID;
|
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
|
||||||
chrome.storage.sync.get([sponsorTimeKey], function(result) {
|
chrome.storage.sync.get([sponsorTimeKey], function(result) {
|
||||||
let sponsorTimesStorage = result[sponsorTimeKey];
|
let sponsorTimesStorage = result[sponsorTimeKey];
|
||||||
if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
|
if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user