mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 21:47:06 +03:00
Made the preview bar only get created if a video is found.
This commit is contained in:
10
content.js
10
content.js
@@ -25,8 +25,7 @@ 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
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "SponsorBlock for YouTube - Skip Sponsorships",
|
"name": "SponsorBlock for YouTube - Skip Sponsorships",
|
||||||
"short_name": "SponsorBlock",
|
"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.",
|
"description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.",
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user