Merge pull request #43 from ajayyy/experimental

Updates to the video player controls
This commit is contained in:
Ajay Ramachandran 2019-07-28 20:53:38 -04:00 committed by GitHub
commit acb3c67629
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -146,9 +146,12 @@ function videoIDChange(id) {
if (response != undefined) { if (response != undefined) {
let sponsorTimes = response.sponsorTimes; let sponsorTimes = response.sponsorTimes;
if (sponsorTimes != null && sponsorTimes.length > 0 && sponsorTimes[sponsorTimes.length - 1].length >= 2) { if (sponsorTimes != null && sponsorTimes.length > 0 && sponsorTimes[sponsorTimes.length - 1].length >= 2) {
document.getElementById("submitButton").style.display = "unset"; changeStartSponsorButton(true, true);
} else if (sponsorTimes != null && sponsorTimes.length > 0 && sponsorTimes[sponsorTimes.length - 1].length < 2) { } else if (sponsorTimes != null && sponsorTimes.length > 0 && sponsorTimes[sponsorTimes.length - 1].length < 2) {
toggleStartSponsorButton(); changeStartSponsorButton(false, true);
} else {
changeStartSponsorButton(true, true);
document.getElementById("submitButton").style.display = "none";
} }
} }
}); });
@ -304,6 +307,7 @@ function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
if (showStartSponsor) { if (showStartSponsor) {
showingStartSponsor = true; showingStartSponsor = true;
document.getElementById("startSponsorImage").src = chrome.extension.getURL("icons/PlayerStartIconSponsorBlocker256px.png"); document.getElementById("startSponsorImage").src = chrome.extension.getURL("icons/PlayerStartIconSponsorBlocker256px.png");
document.getElementById("startSponsorButton").setAttribute("title", "Sponsor Starts Now");
if (document.getElementById("startSponsorImage").style.display != "none" && uploadButtonVisible) { if (document.getElementById("startSponsorImage").style.display != "none" && uploadButtonVisible) {
document.getElementById("submitButton").style.display = "unset"; document.getElementById("submitButton").style.display = "unset";
@ -314,6 +318,7 @@ function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
} else { } else {
showingStartSponsor = false; showingStartSponsor = false;
document.getElementById("startSponsorImage").src = chrome.extension.getURL("icons/PlayerStopIconSponsorBlocker256px.png"); document.getElementById("startSponsorImage").src = chrome.extension.getURL("icons/PlayerStopIconSponsorBlocker256px.png");
document.getElementById("startSponsorButton").setAttribute("title", "Sponsor Ends Now");
//disable submit button //disable submit button
document.getElementById("submitButton").style.display = "none"; document.getElementById("submitButton").style.display = "none";

View file

@ -1,7 +1,7 @@
{ {
"name": "SponsorBlock - YouTube Sponsorship Blocker", "name": "SponsorBlock - YouTube Sponsorship Blocker",
"short_name": "SponsorBlock", "short_name": "SponsorBlock",
"version": "1.0.12", "version": "1.0.13",
"description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.", "description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.",
"content_scripts": [ "content_scripts": [
{ {

View file

@ -16,6 +16,10 @@ SB.reportAnIssue = document.getElementById("reportAnIssue");
SB.sponsorTimesContributionsContainer = document.getElementById("sponsorTimesContributionsContainer"); SB.sponsorTimesContributionsContainer = document.getElementById("sponsorTimesContributionsContainer");
SB.sponsorTimesContributionsDisplay = document.getElementById("sponsorTimesContributionsDisplay"); SB.sponsorTimesContributionsDisplay = document.getElementById("sponsorTimesContributionsDisplay");
SB.sponsorTimesContributionsDisplayEndWord = document.getElementById("sponsorTimesContributionsDisplayEndWord"); SB.sponsorTimesContributionsDisplayEndWord = document.getElementById("sponsorTimesContributionsDisplayEndWord");
// sponsorTimesViewsDisplay
SB.sponsorTimesViewsContainer = document.getElementById("sponsorTimesViewsDisplayContainer");
SB.sponsorTimesViewsDisplay = document.getElementById("sponsorTimesViewsDisplayDisplay");
SB.sponsorTimesViewsDisplayEndWord = document.getElementById("sponsorTimesViewsDisplayDisplayEndWord");
//setup click listeners //setup click listeners
SB.sponsorStart.addEventListener("click", sendSponsorStartMessage); SB.sponsorStart.addEventListener("click", sendSponsorStartMessage);