Small fix

This commit is contained in:
Brahim Hadriche committed 2023-06-25 16:27:34 -04:00
1 parent 3acf733eec
commit ad753deac7
1 file changed
+7 -7
+7 -7
View File
@@ -62,8 +62,10 @@
try { try {
isLoading = true; isLoading = true;
videoMetadata = await invidiousApi.getVideoMetadata(videoId); videoMetadata = await invidiousApi.getVideoMetadata(videoId);
videoStartAtTimestamp = timestamp; videoStartAtChecked = timestamp !== undefined;
videoStartAtChecked = videoStartAtTimestamp !== undefined; if (videoStartAtChecked) {
videoStartAtTimestamp = timestamp;
}
modal.showModal(); modal.showModal();
} finally { } finally {
isLoading = false; isLoading = false;
@@ -93,12 +95,10 @@
function parseYouTubeUrl(url) { function parseYouTubeUrl(url) {
const urlSearchParams = new URLSearchParams(new URL(url).search); const urlSearchParams = new URLSearchParams(new URL(url).search);
function getTimestamp(){ function getTimestamp() {
const timestamp = urlSearchParams.get("t"); const timestamp = urlSearchParams.get("t");
if (timestamp) { if (timestamp) {
return timestamp.endsWith("s") return timestamp.endsWith("s") ? timestamp.slice(0, -1) : timestamp;
? timestamp.slice(0, -1)
: timestamp;
} }
} }
@@ -140,7 +140,7 @@
const timestamp = getTimestamp(); const timestamp = getTimestamp();
if (timestamp) { if (timestamp) {
result.timestamp = timestamp result.timestamp = timestamp;
} }
return result; return result;