mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 05:57:07 +03:00
Map test
This commit is contained in:
@@ -15,7 +15,8 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
|
|||||||
addSponsorTime(request.time, request.videoID, callback);
|
addSponsorTime(request.time, request.videoID, callback);
|
||||||
|
|
||||||
//this allows the callback to be called later
|
//this allows the callback to be called later
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "getSponsorTimes":
|
case "getSponsorTimes":
|
||||||
getSponsorTimes(request.videoID, function(sponsorTimes) {
|
getSponsorTimes(request.videoID, function(sponsorTimes) {
|
||||||
callback({
|
callback({
|
||||||
@@ -61,12 +62,12 @@ chrome.runtime.onInstalled.addListener(function (object) {
|
|||||||
//gets the sponsor times from memory
|
//gets the sponsor times from memory
|
||||||
function getSponsorTimes(videoID, callback) {
|
function getSponsorTimes(videoID, callback) {
|
||||||
let sponsorTimes = [];
|
let sponsorTimes = [];
|
||||||
let sponsorTimeKey = "sponsorTimes" + videoID;
|
let sponsorTimesStorage = SB.config.sponsorTimes.get(videoID);
|
||||||
let sponsorTimesStorage = SB.config.sponsorTimeKey[sponsorTimeKey];
|
|
||||||
|
|
||||||
if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
|
if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
|
||||||
sponsorTimes = sponsorTimesStorage;
|
sponsorTimes = sponsorTimesStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(sponsorTimes);
|
callback(sponsorTimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,8 +86,7 @@ function addSponsorTime(time, videoID, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//save this info
|
//save this info
|
||||||
let sponsorTimeKey = "sponsorTimes" + videoID;
|
SB.config.sponsorTimes.set(videoID, sponsorTimes);
|
||||||
SB.config.sponsorTimeKey[sponsorTimeKey] = sponsorTimes;
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -124,8 +124,7 @@ function submitVote(type, UUID, callback) {
|
|||||||
|
|
||||||
async function submitTimes(videoID, callback) {
|
async function submitTimes(videoID, callback) {
|
||||||
//get the video times from storage
|
//get the video times from storage
|
||||||
let sponsorTimeKey = 'sponsorTimes' + videoID;
|
let sponsorTimes = SB.config.sponsorTimes.get(videoID);
|
||||||
let sponsorTimes = SB.config.sponsorTimeKey[sponsorTimeKey];
|
|
||||||
let userID = SB.config.userID;
|
let userID = SB.config.userID;
|
||||||
|
|
||||||
if (sponsorTimes != undefined && sponsorTimes.length > 0) {
|
if (sponsorTimes != undefined && sponsorTimes.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user