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("#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}"
> >

View File

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