mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-15 07:57:09 +03:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e795c8fb1 | ||
|
|
c83eb589ea | ||
|
|
7cd6b324b9 | ||
|
|
5891fccacb | ||
|
|
59233f3307 | ||
|
|
796466a72a | ||
|
|
3f35642010 | ||
|
|
5bbfcf742d | ||
|
|
aaf79fda0d | ||
|
|
519a822751 | ||
|
|
fef31c399b | ||
|
|
da21081a12 | ||
|
|
2d12f957bc | ||
|
|
c1efe02614 |
@@ -14,6 +14,7 @@
|
|||||||
<a href="https://sponsor.ajay.app/stats">Stats</a>
|
<a href="https://sponsor.ajay.app/stats">Stats</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
[](https://addons.mozilla.org/addon/sponsorblock/?src=external-github) [](https://chrome.google.com/webstore/detail/mnjggcdmjocbbbhaepdhchncahnbgone)
|
||||||
|
|
||||||
SponsorBlock is an extension that will skip over sponsored segments of YouTube videos. SponsorBlock is a crowdsourced browser extension that lets anyone submit the start and end times of sponsored segments of YouTube videos. Once one person submits this information, everyone else with this extension will skip right over the sponsored segment.
|
SponsorBlock is an extension that will skip over sponsored segments of YouTube videos. SponsorBlock is a crowdsourced browser extension that lets anyone submit the start and end times of sponsored segments of YouTube videos. Once one person submits this information, everyone else with this extension will skip right over the sponsored segment.
|
||||||
|
|
||||||
|
|||||||
@@ -135,5 +135,17 @@
|
|||||||
},
|
},
|
||||||
"submitCheck": {
|
"submitCheck": {
|
||||||
"message": "Are you sure you want to submit this?"
|
"message": "Are you sure you want to submit this?"
|
||||||
|
},
|
||||||
|
"longDescription": {
|
||||||
|
"message": "SponsorBlock is an extension that will skip over sponsored segments of YouTube videos. SponsorBlock is a crowdsourced browser extension that let's anyone submit the start and end time's of sponsored segments of YouTube videos. Once one person submits this information, everyone else with this extension will skip right over the sponsored segment.",
|
||||||
|
"description": "Full description of the extension on the store pages."
|
||||||
|
},
|
||||||
|
"website": {
|
||||||
|
"message": "Website",
|
||||||
|
"description": "Used on Firefox Store Page"
|
||||||
|
},
|
||||||
|
"sourceCode": {
|
||||||
|
"message": "Source Code",
|
||||||
|
"description": "Used on Firefox Store Page"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
content.js
16
content.js
@@ -238,8 +238,10 @@ function videoIDChange(id) {
|
|||||||
//setup the preview bar
|
//setup the preview bar
|
||||||
if (previewBar == null) {
|
if (previewBar == null) {
|
||||||
//create it
|
//create it
|
||||||
|
wait(getControls).then(result => {
|
||||||
let progressBar = document.getElementsByClassName("ytp-progress-bar-container")[0] || document.getElementsByClassName("no-model cue-range-markers")[0];
|
let progressBar = document.getElementsByClassName("ytp-progress-bar-container")[0] || document.getElementsByClassName("no-model cue-range-markers")[0];
|
||||||
previewBar = new PreviewBar(progressBar);
|
previewBar = new PreviewBar(progressBar);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//warn them if they had unsubmitted times
|
//warn them if they had unsubmitted times
|
||||||
@@ -271,7 +273,7 @@ function videoIDChange(id) {
|
|||||||
sponsorsLookup(id);
|
sponsorsLookup(id);
|
||||||
|
|
||||||
//make sure everything is properly added
|
//make sure everything is properly added
|
||||||
updateVisibilityOfPlayerControlsButton(true);
|
updateVisibilityOfPlayerControlsButton();
|
||||||
|
|
||||||
//reset sponsor times submitting
|
//reset sponsor times submitting
|
||||||
sponsorTimesSubmitting = [];
|
sponsorTimesSubmitting = [];
|
||||||
@@ -412,7 +414,7 @@ function updatePreviewBar() {
|
|||||||
types.push("previewSponsor");
|
types.push("previewSponsor");
|
||||||
}
|
}
|
||||||
|
|
||||||
previewBar.set(allSponsorTimes, types, v.duration);
|
wait(() => previewBar !== null).then((result) => previewBar.set(allSponsorTimes, types, v.duration));
|
||||||
|
|
||||||
//update last video id
|
//update last video id
|
||||||
lastPreviewBarUpdate = sponsorVideoID;
|
lastPreviewBarUpdate = sponsorVideoID;
|
||||||
@@ -666,11 +668,14 @@ function isSubmitButtonLoaded() {
|
|||||||
return document.getElementById("submitButton") !== null;
|
return document.getElementById("submitButton") !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
|
async function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
|
||||||
if(!sponsorVideoID) return false;
|
if(!sponsorVideoID) return false;
|
||||||
wait(isSubmitButtonLoaded).then(result => {
|
|
||||||
|
//make sure submit button is loaded
|
||||||
|
await wait(isSubmitButtonLoaded);
|
||||||
|
|
||||||
//if it isn't visible, there is no data
|
//if it isn't visible, there is no data
|
||||||
let shouldHide = (uploadButtonVisible && !hideDeleteButtonPlayerControls) ? "unset":"none"
|
let shouldHide = (uploadButtonVisible && !hideDeleteButtonPlayerControls) ? "unset" : "none"
|
||||||
document.getElementById("deleteButton").style.display = shouldHide;
|
document.getElementById("deleteButton").style.display = shouldHide;
|
||||||
|
|
||||||
if (showStartSponsor) {
|
if (showStartSponsor) {
|
||||||
@@ -692,7 +697,6 @@ function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
|
|||||||
//disable submit button
|
//disable submit button
|
||||||
document.getElementById("submitButton").style.display = "none";
|
document.getElementById("submitButton").style.display = "none";
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleStartSponsorButton() {
|
function toggleStartSponsorButton() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "__MSG_Name__",
|
"short_name": "__MSG_Name__",
|
||||||
"version": "1.1.5",
|
"version": "1.1.7",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
|
|||||||
13
utils.js
13
utils.js
@@ -1,14 +1,20 @@
|
|||||||
// Function that can be used to wait for a condition before returning
|
// Function that can be used to wait for a condition before returning
|
||||||
async function wait(condition, timeout = 5000, check = 100) {
|
async function wait(condition, timeout = 5000, check = 100) {
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
setTimeout(() => {reject("TIMEOUT")}, timeout);
|
setTimeout(() => reject("TIMEOUT"), timeout);
|
||||||
const interval = setInterval(() => {
|
|
||||||
|
let intervalCheck = () => {
|
||||||
let result = condition();
|
let result = condition();
|
||||||
if (result !== false) {
|
if (result !== false) {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
};
|
};
|
||||||
}, check);
|
};
|
||||||
|
|
||||||
|
let interval = setInterval(intervalCheck, check);
|
||||||
|
|
||||||
|
//run the check once first, this speeds it up a lot
|
||||||
|
intervalCheck();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,5 +43,6 @@ function getYouTubeVideoID(url) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user