mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 21:17:20 +03:00
Fixed preview bar being added too soon.
This commit is contained in:
16
content.js
16
content.js
@@ -28,7 +28,7 @@ var channelURL;
|
|||||||
var channelWhitelisted = false;
|
var channelWhitelisted = false;
|
||||||
|
|
||||||
// create preview bar
|
// create preview bar
|
||||||
var previewBar;
|
var previewBar = null;
|
||||||
|
|
||||||
// Direct Links
|
// Direct Links
|
||||||
videoIDChange(getYouTubeVideoID(document.URL));
|
videoIDChange(getYouTubeVideoID(document.URL));
|
||||||
@@ -206,7 +206,9 @@ function resetValues() {
|
|||||||
sponsorLookupRetries = 0;
|
sponsorLookupRetries = 0;
|
||||||
|
|
||||||
//empty the preview bar
|
//empty the preview bar
|
||||||
|
if (previewBar !== null) {
|
||||||
previewBar.set([], [], 0);
|
previewBar.set([], [], 0);
|
||||||
|
}
|
||||||
|
|
||||||
//reset sponsor data found check
|
//reset sponsor data found check
|
||||||
sponsorDataFound = false;
|
sponsorDataFound = false;
|
||||||
@@ -214,11 +216,16 @@ function resetValues() {
|
|||||||
|
|
||||||
function videoIDChange(id) {
|
function videoIDChange(id) {
|
||||||
//if the id has not changed return
|
//if the id has not changed return
|
||||||
if (sponsorVideoID === id) return
|
if (sponsorVideoID === id) return;
|
||||||
|
|
||||||
//set the global videoID
|
//set the global videoID
|
||||||
sponsorVideoID = id;
|
sponsorVideoID = id;
|
||||||
|
|
||||||
|
resetValues();
|
||||||
|
|
||||||
|
//id is not valid
|
||||||
|
if (!id) return;
|
||||||
|
|
||||||
//setup the preview bar
|
//setup the preview bar
|
||||||
if (previewBar == null) {
|
if (previewBar == null) {
|
||||||
//create it
|
//create it
|
||||||
@@ -226,11 +233,6 @@ function videoIDChange(id) {
|
|||||||
previewBar = new PreviewBar(progressBar);
|
previewBar = new PreviewBar(progressBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
resetValues();
|
|
||||||
|
|
||||||
//id is not valid
|
|
||||||
if (id === false) return;
|
|
||||||
|
|
||||||
//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
|
||||||
|
|||||||
Reference in New Issue
Block a user