mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +03:00
Renamed addButtons and defined controls.
This commit is contained in:
14
content.js
14
content.js
@@ -30,6 +30,9 @@ var channelWhitelisted = false;
|
|||||||
// create preview bar
|
// create preview bar
|
||||||
var previewBar = null;
|
var previewBar = null;
|
||||||
|
|
||||||
|
//the player controls on the YouTube player
|
||||||
|
var controls = null;
|
||||||
|
|
||||||
// Direct Links
|
// Direct Links
|
||||||
videoIDChange(getYouTubeVideoID(document.URL));
|
videoIDChange(getYouTubeVideoID(document.URL));
|
||||||
|
|
||||||
@@ -552,7 +555,6 @@ function removePlayerControlsButton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createButton(baseID, title, callback, imageName, isDraggable=false) {
|
function createButton(baseID, title, callback, imageName, isDraggable=false) {
|
||||||
|
|
||||||
if (document.getElementById(baseID + "Button") != null) return;
|
if (document.getElementById(baseID + "Button") != null) return;
|
||||||
|
|
||||||
// Button HTML
|
// Button HTML
|
||||||
@@ -582,10 +584,12 @@ function getControls() {
|
|||||||
return (!controls || controls.length === 0) ? false : controls[controls.length - 1]
|
return (!controls || controls.length === 0) ? false : controls[controls.length - 1]
|
||||||
};
|
};
|
||||||
|
|
||||||
//adds the player controls buttons
|
//adds all the player controls buttons
|
||||||
function addButtons() {
|
function createButtons() {
|
||||||
wait(getControls).then(result => {
|
wait(getControls).then(result => {
|
||||||
controls = result; // Global
|
//set global controls variable
|
||||||
|
controls = result;
|
||||||
|
|
||||||
// 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("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker256px.png")
|
createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker256px.png")
|
||||||
@@ -598,7 +602,7 @@ function updateVisibilityOfPlayerControlsButton() {
|
|||||||
//not on a proper video yet
|
//not on a proper video yet
|
||||||
if (!sponsorVideoID) return;
|
if (!sponsorVideoID) return;
|
||||||
|
|
||||||
addButtons();
|
createButtons();
|
||||||
|
|
||||||
if (hideVideoPlayerControls) {
|
if (hideVideoPlayerControls) {
|
||||||
removePlayerControlsButton();
|
removePlayerControlsButton();
|
||||||
|
|||||||
Reference in New Issue
Block a user