mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-13 02:14:23 +01:00
Made the info button not appear on embeds.
Also fixed issues with the buttons changing visibility before being added.
This commit is contained in:
parent
cdccc43b31
commit
9bd1b03504
1 changed files with 18 additions and 15 deletions
33
content.js
33
content.js
|
@ -658,29 +658,30 @@ function getControls() {
|
||||||
};
|
};
|
||||||
|
|
||||||
//adds all the player controls buttons
|
//adds all the player controls buttons
|
||||||
function createButtons() {
|
async function createButtons() {
|
||||||
wait(getControls).then(result => {
|
let result = await wait(getControls).catch();
|
||||||
//set global controls variable
|
|
||||||
controls = result;
|
|
||||||
|
|
||||||
// Add button if does not already exist in html
|
//set global controls variable
|
||||||
createButton("startSponsor", "sponsorStart", startSponsorClicked, "PlayerStartIconSponsorBlocker256px.png");
|
controls = result;
|
||||||
createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker256px.png")
|
|
||||||
createButton("delete", "clearTimes", clearSponsorTimes, "PlayerDeleteIconSponsorBlocker256px.png");
|
// Add button if does not already exist in html
|
||||||
createButton("submit", "SubmitTimes", submitSponsorTimes, "PlayerUploadIconSponsorBlocker256px.png");
|
createButton("startSponsor", "sponsorStart", startSponsorClicked, "PlayerStartIconSponsorBlocker256px.png");
|
||||||
});
|
createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker256px.png")
|
||||||
|
createButton("delete", "clearTimes", clearSponsorTimes, "PlayerDeleteIconSponsorBlocker256px.png");
|
||||||
|
createButton("submit", "SubmitTimes", submitSponsorTimes, "PlayerUploadIconSponsorBlocker256px.png");
|
||||||
}
|
}
|
||||||
//adds or removes the player controls button to what it should be
|
//adds or removes the player controls button to what it should be
|
||||||
function updateVisibilityOfPlayerControlsButton() {
|
async function updateVisibilityOfPlayerControlsButton() {
|
||||||
//not on a proper video yet
|
//not on a proper video yet
|
||||||
if (!sponsorVideoID) return;
|
if (!sponsorVideoID) return;
|
||||||
|
|
||||||
createButtons();
|
await createButtons();
|
||||||
|
|
||||||
if (hideVideoPlayerControls) {
|
if (hideVideoPlayerControls) {
|
||||||
removePlayerControlsButton();
|
removePlayerControlsButton();
|
||||||
}
|
}
|
||||||
if (hideInfoButtonPlayerControls) {
|
//don't show the info button on embeds
|
||||||
|
if (hideInfoButtonPlayerControls || document.URL.includes("/embed/")) {
|
||||||
document.getElementById("infoButton").style.display = "none";
|
document.getElementById("infoButton").style.display = "none";
|
||||||
}
|
}
|
||||||
if (hideDeleteButtonPlayerControls) {
|
if (hideDeleteButtonPlayerControls) {
|
||||||
|
@ -818,8 +819,10 @@ function closeInfoMenu() {
|
||||||
if (popup != null) {
|
if (popup != null) {
|
||||||
popup.remove();
|
popup.remove();
|
||||||
|
|
||||||
//show info button
|
//show info button if it's not an embed
|
||||||
document.getElementById("infoButton").style.display = "unset";
|
if (!document.URL.includes("/embed/")) {
|
||||||
|
document.getElementById("infoButton").style.display = "unset";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue