mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 20:47:11 +03:00
Update content.js
This commit is contained in:
13
content.js
13
content.js
@@ -545,19 +545,18 @@ function createButton(baseID, title, callback, imageName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getControls() {
|
function getControls() {
|
||||||
let controls = document.getElementsByClassName("ytp-right-controls");
|
let controls = document.getElementsByClassName("ytp-right-controls");
|
||||||
return (controls === undefined) ? false : controls[controls.length - 1];
|
return (!controls || controls.length === 0) ? false : controls[controls.length - 1]
|
||||||
};
|
};
|
||||||
|
|
||||||
//adds the player controls buttons
|
//adds the player controls buttons
|
||||||
function addButtons() {
|
function addButtons() {
|
||||||
wait(getControls).then(result => {
|
wait(getControls).then(result => {
|
||||||
controls = result; // Global
|
controls = result; // Global
|
||||||
|
// Add button if does not already exist in html
|
||||||
// Add button if does not already exist in html
|
createButton("startSponsor", "sponsorStart", startSponsorClicked, "PlayerStartIconSponsorBlocker256px.png");
|
||||||
createButton("startSponsor", "sponsorStart", startSponsorClicked, "PlayerStartIconSponsorBlocker256px.png");
|
|
||||||
createButton("infoButton", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker256px.png")
|
createButton("infoButton", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker256px.png")
|
||||||
createButton("deleteButton", "clearTimes", clearSponsorTimes, "PlayerDeleteIconSponsorBlocker256px.png");
|
createButton("deleteButton", "clearTimes", clearSponsorTimes, "PlayerDeleteIconSponsorBlocker256px.png");
|
||||||
createButton("submitButton", "SubmitTimes", submitSponsorTimes, "PlayerUploadIconSponsorBlocker256px.png");
|
createButton("submitButton", "SubmitTimes", submitSponsorTimes, "PlayerUploadIconSponsorBlocker256px.png");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user