mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Renamed addButtons and defined controls.
This commit is contained in:
parent
989db6d6b6
commit
f0e1979aab
1 changed files with 9 additions and 5 deletions
14
content.js
14
content.js
|
@ -30,6 +30,9 @@ var channelWhitelisted = false;
|
|||
// create preview bar
|
||||
var previewBar = null;
|
||||
|
||||
//the player controls on the YouTube player
|
||||
var controls = null;
|
||||
|
||||
// Direct Links
|
||||
videoIDChange(getYouTubeVideoID(document.URL));
|
||||
|
||||
|
@ -552,7 +555,6 @@ function removePlayerControlsButton() {
|
|||
}
|
||||
|
||||
function createButton(baseID, title, callback, imageName, isDraggable=false) {
|
||||
|
||||
if (document.getElementById(baseID + "Button") != null) return;
|
||||
|
||||
// Button HTML
|
||||
|
@ -582,10 +584,12 @@ function getControls() {
|
|||
return (!controls || controls.length === 0) ? false : controls[controls.length - 1]
|
||||
};
|
||||
|
||||
//adds the player controls buttons
|
||||
function addButtons() {
|
||||
//adds all the player controls buttons
|
||||
function createButtons() {
|
||||
wait(getControls).then(result => {
|
||||
controls = result; // Global
|
||||
//set global controls variable
|
||||
controls = result;
|
||||
|
||||
// Add button if does not already exist in html
|
||||
createButton("startSponsor", "sponsorStart", startSponsorClicked, "PlayerStartIconSponsorBlocker256px.png");
|
||||
createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker256px.png")
|
||||
|
@ -598,7 +602,7 @@ function updateVisibilityOfPlayerControlsButton() {
|
|||
//not on a proper video yet
|
||||
if (!sponsorVideoID) return;
|
||||
|
||||
addButtons();
|
||||
createButtons();
|
||||
|
||||
if (hideVideoPlayerControls) {
|
||||
removePlayerControlsButton();
|
||||
|
|
Loading…
Reference in a new issue