Converted options page to TypeScript

This commit is contained in:
Ajay Ramachandran
2020-02-03 22:34:43 -05:00
parent 5bb5dae20e
commit b0a23a5c4e
6 changed files with 59 additions and 50 deletions

View File

@@ -49,8 +49,8 @@ var previewBar = null;
//the player controls on the YouTube player
var controls = null;
// Direct Links
videoIDChange(getYouTubeVideoID(document.URL));
// Direct Links after the config is loaded
utils.wait(() => SB.config !== null).then(() => videoIDChange(getYouTubeVideoID(document.URL)));
//the last time looked at (used to see if this time is in the interval)
var lastTime = -1;
@@ -417,7 +417,7 @@ function sponsorsLookup(id: string, channelIDPromise = null) {
function getYouTubeVideoID(url: string) {
// For YouTube TV support
if(url.startsWith("https://www.youtube.com/tv#/")) url = url.replace("#", "");
//Attempt to parse url
let urlObject = null;
try {
@@ -433,7 +433,7 @@ function getYouTubeVideoID(url: string) {
} else if (!["www.youtube.com", "www.youtube-nocookie.com"].includes(urlObject.host)) {
if (!SB.config) {
// Call this later, in case this is an Invidious tab
this.wait(() => SB.config !== null).then(() => this.videoIDChange(this.getYouTubeVideoID(url)));
utils.wait(() => SB.config !== null).then(() => videoIDChange(getYouTubeVideoID(url)));
}
return false