From fadb294c98a82efb81bf6b7213028c7456af5dbf Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 13 Aug 2019 14:05:32 -0400 Subject: [PATCH 1/6] Made the preview bar only get created if a video is found. --- content.js | 12 ++++++++---- manifest.json | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/content.js b/content.js index 868c8ddf..690bb77e 100644 --- a/content.js +++ b/content.js @@ -25,10 +25,9 @@ var channelURL; var channelWhitelisted = false; // create preview bar -let progressBar = document.getElementsByClassName("ytp-progress-bar-container")[0] || document.getElementsByClassName("no-model cue-range-markers")[0]; -var previewBar = new PreviewBar(progressBar); +var previewBar; -if(id = getYouTubeVideoID(document.URL)){ // Direct Links +if (id = getYouTubeVideoID(document.URL)) { // Direct Links videoIDChange(id); } @@ -203,10 +202,15 @@ document.onkeydown = function(e){ } function videoIDChange(id) { - //not a url change if (sponsorVideoID == id) return; + if (previewBar == null) { + //create it + let progressBar = document.getElementsByClassName("ytp-progress-bar-container")[0] || document.getElementsByClassName("no-model cue-range-markers")[0]; + previewBar = new PreviewBar(progressBar); + } + //warn them if they had unsubmitted times if (previousVideoID != null) { //get the sponsor times from storage diff --git a/manifest.json b/manifest.json index d71a7f4b..5b7847c6 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "SponsorBlock for YouTube - Skip Sponsorships", "short_name": "SponsorBlock", - "version": "1.0.35", + "version": "1.0.36", "description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.", "content_scripts": [ { From 60fc61560d6cb581654497abf0b9a78500223e1d Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 13 Aug 2019 14:39:20 -0400 Subject: [PATCH 2/6] Added leaderboard link --- popup.css | 4 ++++ popup.html | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/popup.css b/popup.css index 1d5dd91e..ae3f79dc 100644 --- a/popup.css +++ b/popup.css @@ -51,6 +51,10 @@ h1.popupElement { padding: 5px; } +.discreteLink.popupElement { + color: black; +} + .recordingSubtitle.popupElement { margin-bottom: 10px; } diff --git a/popup.html b/popup.html index 0c829494..039db0e2 100644 --- a/popup.html +++ b/popup.html @@ -73,6 +73,10 @@ sponsor segments. + +
+ View the leaderboard here. +

From 57f076c5d3cd642fc800f8f84f9e526b570fcf01 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 13 Aug 2019 18:40:46 -0400 Subject: [PATCH 3/6] Removed debug log --- content.js | 1 - 1 file changed, 1 deletion(-) diff --git a/content.js b/content.js index ed578fc7..6495aed9 100644 --- a/content.js +++ b/content.js @@ -329,7 +329,6 @@ function sponsorsLookup(id) { //update the preview bar //leave the type blank for now until categories are added - console.log(v.duration) if (isNaN(v.duration)) { //wait until it is loaded v.addEventListener('durationchange', updatePreviewBar); From d89238f76bdf7fcd3264bf06114582a604dee514 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 13 Aug 2019 18:44:47 -0400 Subject: [PATCH 4/6] Changed to not change popup HTML file based on language --- _locales/en/messages.json | 3 --- manifest.json | 2 +- popup_en.html => popup.html | 0 3 files changed, 1 insertion(+), 4 deletions(-) rename popup_en.html => popup.html (100%) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 78b12c19..f29c36f8 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -105,8 +105,5 @@ }, "leftTimes": { "message": "You seem to have left some sponsor times unsubmitted. Go back to that page to submit them (they are not deleted)." - }, - "Popup": { - "message": "popup_en.html" } } diff --git a/manifest.json b/manifest.json index ab00d1ec..90cdaad3 100644 --- a/manifest.json +++ b/manifest.json @@ -44,7 +44,7 @@ ], "browser_action": { "default_title": "__MSG_Name__", - "default_popup": "__MSG_Popup__" + "default_popup": "popup.html" }, "background": { "scripts":[ diff --git a/popup_en.html b/popup.html similarity index 100% rename from popup_en.html rename to popup.html From 29da12ec71e1df6ea8f9357384ed659960de09b9 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 13 Aug 2019 18:49:55 -0400 Subject: [PATCH 5/6] Updated popup title --- popup.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/popup.html b/popup.html index 039db0e2..bb5e16cc 100644 --- a/popup.html +++ b/popup.html @@ -1,6 +1,6 @@ - Set Page Color Popup + SponsorBlock Popup From bfd841486ec3baff92e20955d61c1d390746919c Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 13 Aug 2019 18:55:50 -0400 Subject: [PATCH 6/6] Fixed incorrect message and changed formatting --- _locales/en/messages.json | 6 +++--- popup.js | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index f29c36f8..7a3e9064 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -82,16 +82,16 @@ "sponsorStart": { "message": "Sponsorship Starts Now" }, - "sponsorEND": { + "sponsorEnd": { "message": "Sponsorship Ends Now" }, - "noVIDEOID": { + "noVideoID": { "message": "This probably isn't a YouTube tab, or you clicked too early. \n If you know this is a YouTube tab,\n close this popup and open it again." }, "Voted": { "message": "Thanks for voting!" }, - "voteFAIL": { + "voteFail": { "message": "You have already voted this way before." }, "serverDown": { diff --git a/popup.js b/popup.js index 76d7dba8..8bf8d020 100644 --- a/popup.js +++ b/popup.js @@ -233,7 +233,7 @@ function runThePopup() { if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) { if (sponsorTimesStorage[sponsorTimesStorage.length - 1] != undefined && sponsorTimesStorage[sponsorTimesStorage.length - 1].length < 2) { startTimeChosen = true; - SB.sponsorStart.innerHTML = chrome.i18n.getMessage("sponsorEND"); + SB.sponsorStart.innerHTML = chrome.i18n.getMessage("sponsorEnd"); } sponsorTimes = sponsorTimesStorage; @@ -966,7 +966,7 @@ function runThePopup() { //update startTimeChosen letiable if (!startTimeChosen) { startTimeChosen = true; - SB.sponsorStart.innerHTML = chrome.i18n.getMessage("sponsorEND"); + SB.sponsorStart.innerHTML = chrome.i18n.getMessage("sponsorEnd"); } else { resetStartTimeChosen(); } @@ -1051,7 +1051,7 @@ function runThePopup() { //this is not a YouTube video page function displayNoVideo() { - document.getElementById("loadingIndicator").innerHTML = chrome.i18n.getMessage("sponsor404"); + document.getElementById("loadingIndicator").innerHTML = chrome.i18n.getMessage("noVideoID"); } function reportAnIssue() { @@ -1091,7 +1091,7 @@ function runThePopup() { addVoteMessage(chrome.i18n.getMessage("Voted"), UUID) } else if (response.successType == 0) { //failure: duplicate vote - addVoteMessage(chrome.i18n.getMessage("voteFAIL"), UUID) + addVoteMessage(chrome.i18n.getMessage("voteFail"), UUID) } else if (response.successType == -1) { if (response.statusCode == 502) { addVoteMessage(chrome.i18n.getMessage("serverDown"), UUID)