mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 22:17:21 +03:00
Made it auto vote when a sponsor is skipped
This commit is contained in:
10
content.js
10
content.js
@@ -517,6 +517,9 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
|
|||||||
if (trackViewCount) {
|
if (trackViewCount) {
|
||||||
sendRequestToServer("GET", "/api/viewedVideoSponsorTime?UUID=" + currentUUID);
|
sendRequestToServer("GET", "/api/viewedVideoSponsorTime?UUID=" + currentUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//vote on this
|
||||||
|
vote(1, currentUUID, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,10 +1067,13 @@ function resetVoteButtonInfo(UUID) {
|
|||||||
document.getElementById("sponsorTimesDownvoteButtonsContainer" + UUID).style.removeProperty("display");
|
document.getElementById("sponsorTimesDownvoteButtonsContainer" + UUID).style.removeProperty("display");
|
||||||
}
|
}
|
||||||
|
|
||||||
function vote(type, UUID) {
|
//if inTheBackground is true, then no UI methods will be called
|
||||||
|
function vote(type, UUID, inTheBackground = false) {
|
||||||
|
if (!inTheBackground) {
|
||||||
//add loading info
|
//add loading info
|
||||||
addVoteButtonInfo("Loading...", UUID)
|
addVoteButtonInfo("Loading...", UUID)
|
||||||
resetNoticeInfoMessage(UUID);
|
resetNoticeInfoMessage(UUID);
|
||||||
|
}
|
||||||
|
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
message: "submitVote",
|
message: "submitVote",
|
||||||
@@ -1076,6 +1082,7 @@ function vote(type, UUID) {
|
|||||||
}, function(response) {
|
}, function(response) {
|
||||||
if (response != undefined) {
|
if (response != undefined) {
|
||||||
//see if it was a success or failure
|
//see if it was a success or failure
|
||||||
|
if (!inTheBackground) {
|
||||||
if (response.successType == 1) {
|
if (response.successType == 1) {
|
||||||
//success
|
//success
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
@@ -1096,6 +1103,7 @@ function vote(type, UUID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user