mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-30 19:38:34 +03:00
Made it not load the extension on the YouTube homepage and channel pages.
This commit is contained in:
15
popup.js
15
popup.js
@@ -34,6 +34,12 @@ function loadTabData(tabs) {
|
||||
//set current videoID
|
||||
currentVideoID = getYouTubeVideoID(tabs[0].url);
|
||||
|
||||
if (!currentVideoID) {
|
||||
//this isn't a YouTube video then
|
||||
displayNoVideo();
|
||||
return;
|
||||
}
|
||||
|
||||
//load video times for this video
|
||||
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
|
||||
chrome.storage.local.get([sponsorTimeKey], function(result) {
|
||||
@@ -66,8 +72,7 @@ function loadTabData(tabs) {
|
||||
function infoFound(request) {
|
||||
if(chrome.runtime.lastError) {
|
||||
//This page doesn't have the injected content script, or at least not yet
|
||||
document.getElementById("loadingIndicator").innerHTML = "This probably isn't a YouTube tab, or you clicked too early. " +
|
||||
"If you know this is a YouTube tab, close this popup and open it again.";
|
||||
displayNoVideo();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -215,6 +220,12 @@ function showNoticeAgain() {
|
||||
document.getElementById("showNoticeAgain").style.display = "none";
|
||||
}
|
||||
|
||||
//this is not a YouTube video page
|
||||
function displayNoVideo() {
|
||||
document.getElementById("loadingIndicator").innerHTML = "This probably isn't a YouTube tab, or you clicked too early. " +
|
||||
"If you know this is a YouTube tab, close this popup and open it again.";
|
||||
}
|
||||
|
||||
//converts time in seconds to minutes:seconds
|
||||
function getFormattedTime(seconds) {
|
||||
let minutes = Math.floor(seconds / 60);
|
||||
|
||||
Reference in New Issue
Block a user