Skip to content

Commit

Permalink
Merge pull request #333 from AntennaPod/subscribe-js-error
Browse files Browse the repository at this point in the history
Fix JavaScript on subscribe page
  • Loading branch information
keunes authored Mar 3, 2024
2 parents 22ee144 + b536e46 commit 00a8ad8
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions deeplink/subscribe/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,22 @@ <h2 id="podcastTitle">{% t generic.subscribe %}</h2>
</div>

<script>
const getUrlParameter = (sParam) => {
const paramValue = new URLSearchParams(window.location.search.substring(1)).get(sParam) ?? "";
if (0 < paramValue.length) {
return decodeURIComponent(paramValue);
}
return false;
};

const urlParams = new URLSearchParams(window.location.search.substring(1));
const urlTextBox = document.getElementById("urlTextBox");
const subscribeButton = document.getElementById("subscribeButton");
const podcastTitle = document.getElementById("podcastTitle");
if (getUrlParameter("url") === false) {
if (!urlParams.has("url")) {
urlTextBox.textContent = "URL not available";
subscribeButton.disabled = true;
subscribeButton.textContent += " (error)";
} else {
if (getUrlParameter("title") !== false) {
podcastTitle.textContent = getUrlParameter("title");
if (urlParams.has("title")) {
podcastTitle.textContent = urlParams.get("title");
}
urlTextBox.textContent = getUrlParameter("url");
const url = urlParams.get("url");
urlTextBox.textContent = url;
subscribeButton.onclick = () => {
window.open("antennapod-subscribe://" + getUrlParameter("url"));
window.open("antennapod-subscribe://" + url);
};
}
</script>

0 comments on commit 00a8ad8

Please sign in to comment.