This commit is contained in:
Arkadiusz Wieczorek 2024-01-06 16:26:50 +01:00
parent 6a1a187e1c
commit 895302fa1e
2 changed files with 8 additions and 10 deletions

View File

@ -3,11 +3,7 @@ function generateHtml() {
document.querySelector("#episode_name").value &&
document.querySelector("#castopod").value &&
document.querySelector("#peertube").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
document.querySelector("#youtube").value
) {
let castopod_url;
let peertube_id;
@ -16,19 +12,20 @@ function generateHtml() {
.querySelector("#castopod").value;
const regex = /^https:\/\/podcast\.internet-czas-dzialac\.pl\/@icd\/episodes\//;
if (!regex.test(castopod_url)) {
throw new Error("Incorrect Castopod URL format! Please paste the correct 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");
}
} catch (error) {
alert(error);
}
try {
const regex = /^https:\/\/video\.internet-czas-dzialac\.pl\/w\/[a-zA-Z0-9]{22,}$/;
peertube_id = document
.querySelector("#peertube")
.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) {
alert(error);
@ -154,7 +151,7 @@ function generateHtml() {
html += `
<div class="podcast-logos video-logos">
<a
title="${document.querySelector("#episode_name").value} w serwisie PeerTube."
title="${document.querySelector("#episode_name").value} na naszej instancji PeerTube."
alt="Logo PeerTube"
href="https://video.internet-czas-dzialac.pl/videos/watch/${peertube_id}"
>

View File

@ -85,6 +85,7 @@ button {
}
.preview {
width: 700px;
padding: 1rem;
border: 1px solid #5e636e;
}