86 lines
2.5 KiB
HTML
86 lines
2.5 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>catch.sistav.com</title>
|
|
<style>
|
|
body { max-width: 44em; margin: 1.5em auto; padding: 0 1em;
|
|
font: 18px/1.5 Georgia, "Times New Roman", serif;
|
|
background: #faf9f5; color: #222; }
|
|
h1 { margin: .5em 0; }
|
|
input[type=url] { width: 100%; font-size: 1em; padding: .5em;
|
|
box-sizing: border-box; border: 1px solid #999;
|
|
background: #fff; }
|
|
button { font-size: .95em; padding: .35em 1.1em; cursor: pointer; }
|
|
a { overflow-wrap: anywhere; }
|
|
hr { border: 0; border-top: 1px solid #ccc; margin: 1.5em 0; }
|
|
.art { float: right; width: 160px; height: 160px; margin: 0 0 1em 1em;
|
|
border: 1px solid #ccc; }
|
|
.label { font-size: 1.15em; font-weight: bold; }
|
|
.error { color: #b00; }
|
|
.row { margin: 1.25em 0; }
|
|
.alt { margin: .6em 0 .6em 1.5em; }
|
|
.note { color: #666; }
|
|
summary { cursor: pointer; color: #444; }
|
|
@media (max-width: 600px) { .art { width: 112px; height: 112px; } }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<h1>catch</h1>
|
|
|
|
<form method="get">
|
|
<input type="url" name="link" placeholder="spotify / tidal / apple music link" value="{{ link }}" autofocus>
|
|
<button>convert</button>
|
|
</form>
|
|
|
|
{% if error %}
|
|
<hr>
|
|
<p class="error">{{ error }}</p>
|
|
{% elif result %}
|
|
<hr>
|
|
{% if result.art %}<img class="art" src="{{ result.art }}" alt="">{% endif %}
|
|
<p class="label">{{ result.label }}</p>
|
|
{% for row in rows %}
|
|
<div class="row">
|
|
<b>{{ row.service }}</b><br>
|
|
{% if row.url %}
|
|
<a href="{{ row.play_url }}">{{ row.url }}</a>
|
|
<button data-copy="{{ row.play_url }}">copy</button>
|
|
{% if row.alts %}
|
|
<details>
|
|
<summary>not the right one?</summary>
|
|
{% for alt in row.alts %}
|
|
<div class="alt">
|
|
<a href="{{ alt.play_url }}">{{ alt.url }}</a>
|
|
<button data-copy="{{ alt.play_url }}">copy</button>
|
|
<span class="note">{{ alt.note }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
</details>
|
|
{% endif %}
|
|
{% else %}
|
|
no match
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
<p><button data-copy-page>share</button></p>
|
|
{% endif %}
|
|
|
|
<script>
|
|
document.addEventListener("click", (e) => {
|
|
const btn = e.target.closest("[data-copy], [data-copy-page]");
|
|
if (!btn) return;
|
|
const text = btn.hasAttribute("data-copy-page") ? location.href : btn.dataset.copy;
|
|
navigator.clipboard.writeText(text).then(() => {
|
|
const old = btn.textContent;
|
|
btn.textContent = "copied!";
|
|
setTimeout(() => { btn.textContent = old; }, 1500);
|
|
});
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|