mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2026-01-01 14:19:23 +03:00
Merge pull request #113 from ajayyy/experimental-ajay
Fixes for #86 and better preview bar
This commit is contained in:
@@ -82,16 +82,16 @@
|
|||||||
"sponsorStart": {
|
"sponsorStart": {
|
||||||
"message": "Sponsorship Starts Now"
|
"message": "Sponsorship Starts Now"
|
||||||
},
|
},
|
||||||
"sponsorEND": {
|
"sponsorEnd": {
|
||||||
"message": "Sponsorship Ends Now"
|
"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."
|
"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": {
|
"Voted": {
|
||||||
"message": "Thanks for voting!"
|
"message": "Thanks for voting!"
|
||||||
},
|
},
|
||||||
"voteFAIL": {
|
"voteFail": {
|
||||||
"message": "You have already voted this way before."
|
"message": "You have already voted this way before."
|
||||||
},
|
},
|
||||||
"serverDown": {
|
"serverDown": {
|
||||||
@@ -105,8 +105,5 @@
|
|||||||
},
|
},
|
||||||
"leftTimes": {
|
"leftTimes": {
|
||||||
"message": "You seem to have left some sponsor times unsubmitted. Go back to that page to submit them (they are not deleted)."
|
"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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
content.js
13
content.js
@@ -25,10 +25,9 @@ var channelURL;
|
|||||||
var channelWhitelisted = false;
|
var channelWhitelisted = false;
|
||||||
|
|
||||||
// create preview bar
|
// create preview bar
|
||||||
let progressBar = document.getElementsByClassName("ytp-progress-bar-container")[0] || document.getElementsByClassName("no-model cue-range-markers")[0];
|
var previewBar;
|
||||||
var previewBar = new PreviewBar(progressBar);
|
|
||||||
|
|
||||||
if(id = getYouTubeVideoID(document.URL)){ // Direct Links
|
if (id = getYouTubeVideoID(document.URL)) { // Direct Links
|
||||||
videoIDChange(id);
|
videoIDChange(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,10 +202,15 @@ document.onkeydown = function(e){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function videoIDChange(id) {
|
function videoIDChange(id) {
|
||||||
|
|
||||||
//not a url change
|
//not a url change
|
||||||
if (sponsorVideoID == id) return;
|
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
|
//warn them if they had unsubmitted times
|
||||||
if (previousVideoID != null) {
|
if (previousVideoID != null) {
|
||||||
//get the sponsor times from storage
|
//get the sponsor times from storage
|
||||||
@@ -325,7 +329,6 @@ function sponsorsLookup(id) {
|
|||||||
|
|
||||||
//update the preview bar
|
//update the preview bar
|
||||||
//leave the type blank for now until categories are added
|
//leave the type blank for now until categories are added
|
||||||
console.log(v.duration)
|
|
||||||
if (isNaN(v.duration)) {
|
if (isNaN(v.duration)) {
|
||||||
//wait until it is loaded
|
//wait until it is loaded
|
||||||
v.addEventListener('durationchange', updatePreviewBar);
|
v.addEventListener('durationchange', updatePreviewBar);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "__MSG_Name__",
|
"short_name": "__MSG_Name__",
|
||||||
"version": "1.0.35",
|
"version": "1.0.36",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
],
|
],
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"default_title": "__MSG_Name__",
|
"default_title": "__MSG_Name__",
|
||||||
"default_popup": "__MSG_Popup__"
|
"default_popup": "popup.html"
|
||||||
},
|
},
|
||||||
"background": {
|
"background": {
|
||||||
"scripts":[
|
"scripts":[
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ h1.popupElement {
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.discreteLink.popupElement {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
.recordingSubtitle.popupElement {
|
.recordingSubtitle.popupElement {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Set Page Color Popup</title>
|
<title>SponsorBlock Popup</title>
|
||||||
<link id="sponorBlockPopupFont" rel="stylesheet" type="text/css" href="/libs/Source+Sans+Pro.css"/>
|
<link id="sponorBlockPopupFont" rel="stylesheet" type="text/css" href="/libs/Source+Sans+Pro.css"/>
|
||||||
<link id="sponorBlockStyleSheet" rel="stylesheet" type="text/css" href="popup.css"/>
|
<link id="sponorBlockStyleSheet" rel="stylesheet" type="text/css" href="popup.css"/>
|
||||||
</head>
|
</head>
|
||||||
@@ -73,6 +73,10 @@
|
|||||||
sponsor segments.
|
sponsor segments.
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<div class="popupElement">
|
||||||
|
View the leaderboard <a class="popupElement discreteLink" href="https://sponsor.ajay.app/stats" target="_blank">here</a>.
|
||||||
|
</div>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="popupElement">
|
<p class="popupElement">
|
||||||
8
popup.js
8
popup.js
@@ -233,7 +233,7 @@ function runThePopup() {
|
|||||||
if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
|
if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
|
||||||
if (sponsorTimesStorage[sponsorTimesStorage.length - 1] != undefined && sponsorTimesStorage[sponsorTimesStorage.length - 1].length < 2) {
|
if (sponsorTimesStorage[sponsorTimesStorage.length - 1] != undefined && sponsorTimesStorage[sponsorTimesStorage.length - 1].length < 2) {
|
||||||
startTimeChosen = true;
|
startTimeChosen = true;
|
||||||
SB.sponsorStart.innerHTML = chrome.i18n.getMessage("sponsorEND");
|
SB.sponsorStart.innerHTML = chrome.i18n.getMessage("sponsorEnd");
|
||||||
}
|
}
|
||||||
|
|
||||||
sponsorTimes = sponsorTimesStorage;
|
sponsorTimes = sponsorTimesStorage;
|
||||||
@@ -966,7 +966,7 @@ function runThePopup() {
|
|||||||
//update startTimeChosen letiable
|
//update startTimeChosen letiable
|
||||||
if (!startTimeChosen) {
|
if (!startTimeChosen) {
|
||||||
startTimeChosen = true;
|
startTimeChosen = true;
|
||||||
SB.sponsorStart.innerHTML = chrome.i18n.getMessage("sponsorEND");
|
SB.sponsorStart.innerHTML = chrome.i18n.getMessage("sponsorEnd");
|
||||||
} else {
|
} else {
|
||||||
resetStartTimeChosen();
|
resetStartTimeChosen();
|
||||||
}
|
}
|
||||||
@@ -1051,7 +1051,7 @@ function runThePopup() {
|
|||||||
|
|
||||||
//this is not a YouTube video page
|
//this is not a YouTube video page
|
||||||
function displayNoVideo() {
|
function displayNoVideo() {
|
||||||
document.getElementById("loadingIndicator").innerHTML = chrome.i18n.getMessage("sponsor404");
|
document.getElementById("loadingIndicator").innerHTML = chrome.i18n.getMessage("noVideoID");
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportAnIssue() {
|
function reportAnIssue() {
|
||||||
@@ -1091,7 +1091,7 @@ function runThePopup() {
|
|||||||
addVoteMessage(chrome.i18n.getMessage("Voted"), UUID)
|
addVoteMessage(chrome.i18n.getMessage("Voted"), UUID)
|
||||||
} else if (response.successType == 0) {
|
} else if (response.successType == 0) {
|
||||||
//failure: duplicate vote
|
//failure: duplicate vote
|
||||||
addVoteMessage(chrome.i18n.getMessage("voteFAIL"), UUID)
|
addVoteMessage(chrome.i18n.getMessage("voteFail"), UUID)
|
||||||
} else if (response.successType == -1) {
|
} else if (response.successType == -1) {
|
||||||
if (response.statusCode == 502) {
|
if (response.statusCode == 502) {
|
||||||
addVoteMessage(chrome.i18n.getMessage("serverDown"), UUID)
|
addVoteMessage(chrome.i18n.getMessage("serverDown"), UUID)
|
||||||
|
|||||||
Reference in New Issue
Block a user