Fixes
This commit is contained in:
parent
6a1a187e1c
commit
895302fa1e
17
script.js
17
script.js
|
@ -3,11 +3,7 @@ function generateHtml() {
|
||||||
document.querySelector("#episode_name").value &&
|
document.querySelector("#episode_name").value &&
|
||||||
document.querySelector("#castopod").value &&
|
document.querySelector("#castopod").value &&
|
||||||
document.querySelector("#peertube").value &&
|
document.querySelector("#peertube").value &&
|
||||||
document.querySelector("#youtube").value &&
|
document.querySelector("#youtube").value
|
||||||
document.querySelector("#castopod-player-visible").value &&
|
|
||||||
document.querySelector("#peertube-player-visible").value &&
|
|
||||||
document.querySelector("#audio-links-visible").value &&
|
|
||||||
document.querySelector("#video-links-visible").value
|
|
||||||
) {
|
) {
|
||||||
let castopod_url;
|
let castopod_url;
|
||||||
let peertube_id;
|
let peertube_id;
|
||||||
|
@ -16,19 +12,20 @@ function generateHtml() {
|
||||||
.querySelector("#castopod").value;
|
.querySelector("#castopod").value;
|
||||||
const regex = /^https:\/\/podcast\.internet-czas-dzialac\.pl\/@icd\/episodes\//;
|
const regex = /^https:\/\/podcast\.internet-czas-dzialac\.pl\/@icd\/episodes\//;
|
||||||
if (!regex.test(castopod_url)) {
|
if (!regex.test(castopod_url)) {
|
||||||
|
throw new Error("Incorrect Castopod URL format! Please paste the correct URL. Example: https://podcast.internet-czas-dzialac.pl/@icd/episodes/icd-weekend-6-stara-myszka-mickey-nowy-prezes-uodo-i-sony-psujace-sylwestra");
|
||||||
throw new Error("Incorrect Castopod URL format! Please paste the correct URL.");
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert(error);
|
alert(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const regex = /^https:\/\/video\.internet-czas-dzialac\.pl\/w\/[a-zA-Z0-9]{22,}$/;
|
||||||
peertube_id = document
|
peertube_id = document
|
||||||
.querySelector("#peertube")
|
.querySelector("#peertube")
|
||||||
.value.split("/w/")[1];
|
.value.split("/w/")[1];
|
||||||
if (!peertube_id) {
|
|
||||||
throw new Error("Incorrect PeerTube URL format! Please paste the correct URL.");
|
if (!regex.test(document.querySelector("#peertube").value) || !peertube_id) {
|
||||||
|
throw new Error("Incorrect PeerTube URL format! Please paste the correct URL. Example: https://video.internet-czas-dzialac.pl/w/nTgqnY7FJLQzNYfD9xtcSy");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert(error);
|
alert(error);
|
||||||
|
@ -154,7 +151,7 @@ function generateHtml() {
|
||||||
html += `
|
html += `
|
||||||
<div class="podcast-logos video-logos">
|
<div class="podcast-logos video-logos">
|
||||||
<a
|
<a
|
||||||
title="${document.querySelector("#episode_name").value} w serwisie PeerTube."
|
title="${document.querySelector("#episode_name").value} na naszej instancji PeerTube."
|
||||||
alt="Logo PeerTube"
|
alt="Logo PeerTube"
|
||||||
href="https://video.internet-czas-dzialac.pl/videos/watch/${peertube_id}"
|
href="https://video.internet-czas-dzialac.pl/videos/watch/${peertube_id}"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user