mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 04:27:15 +03:00
Made player controls work
This commit is contained in:
14
content.js
14
content.js
@@ -125,11 +125,11 @@ function goBackToPreviousTime() {
|
||||
}
|
||||
|
||||
//Adds a sponsorship starts button to the player controls
|
||||
function addPlayerControlsButton(){
|
||||
function addPlayerControlsButton() {
|
||||
let startSponsorButton = document.createElement("button");
|
||||
startSponsorButton.className = "ytp-button";
|
||||
startSponsorButton.setAttribute("title", "Sponsor Starts Now");
|
||||
startSponsorButton.addEventListener("click", console.log);
|
||||
startSponsorButton.addEventListener("click", startSponsorClicked);
|
||||
|
||||
let startSponsorImage = document.createElement("img");
|
||||
startSponsorImage.style.height = "60%";
|
||||
@@ -149,6 +149,14 @@ function addPlayerControlsButton(){
|
||||
|
||||
addPlayerControlsButton();
|
||||
|
||||
function startSponsorClicked() {
|
||||
//send back current time witj message
|
||||
chrome.runtime.sendMessage({
|
||||
message: "addSponsorTime",
|
||||
time: v.currentTime
|
||||
});
|
||||
}
|
||||
|
||||
//Opens the notice that tells the user that a sponsor was just skipped
|
||||
function openSkipNotice(){
|
||||
if (dontShowNotice) {
|
||||
@@ -233,8 +241,6 @@ function dontShowNoticeAgain() {
|
||||
function sponsorMessageStarted() {
|
||||
let v = document.querySelector('video');
|
||||
|
||||
console.log(v.currentTime)
|
||||
|
||||
//send back current time
|
||||
chrome.runtime.sendMessage({
|
||||
message: "time",
|
||||
|
||||
Reference in New Issue
Block a user