mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 13:07:05 +03:00
Fixed submissions being broken.
This commit is contained in:
@@ -7,29 +7,29 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
|
|||||||
chrome.runtime.onMessage.addListener(function (request, sender, callback) {
|
chrome.runtime.onMessage.addListener(function (request, sender, callback) {
|
||||||
switch(request.message) {
|
switch(request.message) {
|
||||||
case "submitTimes":
|
case "submitTimes":
|
||||||
submitTimes(request.videoID, callback);
|
submitTimes(request.videoID, callback);
|
||||||
|
|
||||||
//this allows the callback to be called later by the submitTimes function
|
//this allows the callback to be called later by the submitTimes function
|
||||||
return true;
|
return true;
|
||||||
case "addSponsorTime":
|
case "addSponsorTime":
|
||||||
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({
|
||||||
sponsorTimes: sponsorTimes
|
sponsorTimes: sponsorTimes
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
//this allows the callback to be called later
|
//this allows the callback to be called later
|
||||||
return true;
|
return true;
|
||||||
case "submitVote":
|
case "submitVote":
|
||||||
submitVote(request.type, request.UUID, callback);
|
submitVote(request.type, request.UUID, callback);
|
||||||
|
|
||||||
//this allows the callback to be called later
|
//this allows the callback to be called later
|
||||||
return true;
|
return true;
|
||||||
case "alertPrevious":
|
case "alertPrevious":
|
||||||
chrome.notifications.create("stillThere" + Math.random(), {
|
chrome.notifications.create("stillThere" + Math.random(), {
|
||||||
type: "basic",
|
type: "basic",
|
||||||
|
|||||||
@@ -896,7 +896,7 @@ function submitSponsorTimes() {
|
|||||||
//called after all the checks have been made that it's okay to do so
|
//called after all the checks have been made that it's okay to do so
|
||||||
function sendSubmitMessage(){
|
function sendSubmitMessage(){
|
||||||
//add loading animation
|
//add loading animation
|
||||||
document.getElementById("submitButtonImage").src = chrome.extension.getURL("icons/PlayerUploadIconSponsorBlocker256px.png");
|
document.getElementById("submitImage").src = chrome.extension.getURL("icons/PlayerUploadIconSponsorBlocker256px.png");
|
||||||
document.getElementById("submitButton").style.animation = "rotate 1s 0s infinite";
|
document.getElementById("submitButton").style.animation = "rotate 1s 0s infinite";
|
||||||
|
|
||||||
let currentVideoID = sponsorVideoID;
|
let currentVideoID = sponsorVideoID;
|
||||||
@@ -931,7 +931,7 @@ function sendSubmitMessage(){
|
|||||||
} else {
|
} else {
|
||||||
//show that the upload failed
|
//show that the upload failed
|
||||||
document.getElementById("submitButton").style.animation = "unset";
|
document.getElementById("submitButton").style.animation = "unset";
|
||||||
document.getElementById("submitButtonImage").src = chrome.extension.getURL("icons/PlayerUploadFailedIconSponsorBlocker256px.png");
|
document.getElementById("submitImage").src = chrome.extension.getURL("icons/PlayerUploadFailedIconSponsorBlocker256px.png");
|
||||||
|
|
||||||
if([400,429,409,502].includes(response.statusCode)) {
|
if([400,429,409,502].includes(response.statusCode)) {
|
||||||
alert(chrome.i18n.getMessage(response.statusCode));
|
alert(chrome.i18n.getMessage(response.statusCode));
|
||||||
|
|||||||
Reference in New Issue
Block a user