Made player controls work

This commit is contained in:
Ajay Ramachandran
2019-07-12 16:44:50 -04:00
parent c6cd092c87
commit 932b8cf4bb
3 changed files with 40 additions and 6 deletions

View File

@@ -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",