mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-11 09:30:46 +01:00
Requested changes
This commit is contained in:
parent
bfb876af8b
commit
47d0d340d4
1 changed files with 12 additions and 11 deletions
13
content.js
13
content.js
|
@ -224,6 +224,7 @@ function videoIDChange(id) {
|
|||
|
||||
// ID is not valid
|
||||
if (id === false) return;
|
||||
|
||||
if (previewBar == null) {
|
||||
//create it
|
||||
let progressBar = document.getElementsByClassName("ytp-progress-bar-container")[0] || document.getElementsByClassName("no-model cue-range-markers")[0];
|
||||
|
@ -532,21 +533,22 @@ function reskipSponsorTime(UUID) {
|
|||
|
||||
function removePlayerControlsButton() {
|
||||
if (!sponsorVideoID) return;
|
||||
|
||||
document.getElementById("changeStartSponsor").style.display = "none";
|
||||
document.getElementById("submitButton").style.display = "none";
|
||||
}
|
||||
|
||||
function createButton(baseid, title, callback, imageName) {
|
||||
if (document.getElementById(baseid+"Button") != null) return;
|
||||
function createButton(baseID, title, callback, imageName) {
|
||||
if (document.getElementById(baseID+"Button") != null) return;
|
||||
// Button HTML
|
||||
let newButton = document.createElement("button");
|
||||
newButton.id = baseid+"Button";
|
||||
newButton.id = baseID+"Button";
|
||||
newButton.className = "ytp-button playerButton";
|
||||
newButton.setAttribute("title", chrome.i18n.getMessage(baseid));
|
||||
newButton.setAttribute("title", chrome.i18n.getMessage(baseID));
|
||||
newButton.addEventListener("click", callback);
|
||||
// Image HTML
|
||||
let newButtonImage = document.createElement("img");
|
||||
newButtonImage.id = baseid+"Image";
|
||||
newButtonImage.id = baseID+"Image";
|
||||
newButtonImage.className = "playerButtonImage";
|
||||
newButtonImage.src = chrome.extension.getURL("icons/"+imageName);
|
||||
// Append image to button
|
||||
|
@ -564,7 +566,6 @@ function getControls() {
|
|||
function addButtons() {
|
||||
wait(getControls).then(result => {
|
||||
controls = result; // Global
|
||||
|
||||
// Add button if does not already exist in html
|
||||
createButton("startSponsor", "sponsorStart", startSponsorClicked, "PlayerStartIconSponsorBlocker256px.png");
|
||||
createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker256px.png")
|
||||
|
|
Loading…
Reference in a new issue