mirror of
https://github.com/imgfloat/client.git
synced 2026-02-05 03:59:26 +00:00
130 lines
5.3 KiB
HTML
130 lines
5.3 KiB
HTML
<!doctype html>
|
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>Browse channels - Imgfloat</title>
|
|
<link rel="stylesheet" href="./css/index.css" />
|
|
</head>
|
|
<body class="channels-body">
|
|
<div class="window-frame" role="presentation">
|
|
<div class="window-frame-title">Imgfloat</div>
|
|
<div class="window-frame-controls">
|
|
<button class="window-control" type="button" data-window-action="minimize" aria-label="Minimize">
|
|
−
|
|
</button>
|
|
<button class="window-control" type="button" data-window-action="devtools" aria-label="Toggle dev tools">
|
|
⚙
|
|
</button>
|
|
<button
|
|
class="window-control window-control-close"
|
|
type="button"
|
|
data-window-action="close"
|
|
aria-label="Close"
|
|
>
|
|
×
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="channels-shell">
|
|
<header class="channels-header">
|
|
<div class="brand">
|
|
<img class="brand-mark" alt="brand" src="../res/icon/brand.png" />
|
|
<div>
|
|
<div class="brand-title">Imgfloat</div>
|
|
<div class="brand-subtitle">Twitch overlay manager</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="channels-main">
|
|
<section class="channel-card">
|
|
<p class="eyebrow subtle">Broadcast overlay</p>
|
|
<h1>Open a channel</h1>
|
|
<p class="muted">Type the channel name to jump straight to their overlay.</p>
|
|
<form id="channel-search-form" class="channel-form">
|
|
<label class="sr-only" for="channel-search">Channel name</label>
|
|
<input
|
|
id="channel-search"
|
|
name="channel"
|
|
class="text-input"
|
|
type="text"
|
|
list="channel-suggestions"
|
|
placeholder="Type a channel name"
|
|
autocomplete="off"
|
|
autofocus
|
|
spellcheck="false"
|
|
/>
|
|
<label class="sr-only" for="domain-input">Server domain</label>
|
|
<input
|
|
id="domain-input"
|
|
name="domain"
|
|
class="text-input"
|
|
type="url"
|
|
autocomplete="off"
|
|
spellcheck="false"
|
|
/>
|
|
<datalist id="channel-suggestions"></datalist>
|
|
<button type="submit" class="button block">Open overlay</button>
|
|
</form>
|
|
</section>
|
|
</main>
|
|
</div>
|
|
<script>
|
|
const form = document.getElementById("channel-search-form");
|
|
const input = document.getElementById("channel-search");
|
|
const domainInput = document.getElementById("domain-input");
|
|
const windowActionButtons = document.querySelectorAll("[data-window-action]");
|
|
|
|
window.store.loadBroadcaster().then((value) => {
|
|
if (value && input.value === "") {
|
|
input.value = value;
|
|
}
|
|
});
|
|
|
|
Promise.all([window.store.loadDomain(), window.store.loadDefaultDomain()]).then(
|
|
([savedDomain, defaultDomain]) => {
|
|
domainInput.value = savedDomain || defaultDomain;
|
|
domainInput.placeholder = defaultDomain;
|
|
},
|
|
);
|
|
|
|
domainInput.addEventListener("change", () => {
|
|
const trimmedDomain = domainInput.value.trim();
|
|
if (trimmedDomain) {
|
|
window.store.saveDomain(trimmedDomain);
|
|
}
|
|
});
|
|
|
|
form.addEventListener("submit", (e) => {
|
|
e.preventDefault();
|
|
|
|
const channel = input.value.trim();
|
|
const fallbackDomain = domainInput.placeholder || "";
|
|
const domain = domainInput.value.trim() || fallbackDomain;
|
|
if (!channel) {
|
|
return;
|
|
}
|
|
|
|
const params = new URLSearchParams({ broadcaster: channel });
|
|
window.store.saveDomain(domain);
|
|
window.location.href = `${domain}/view/${encodeURIComponent(channel)}/broadcast`;
|
|
});
|
|
|
|
windowActionButtons.forEach((button) => {
|
|
button.addEventListener("click", () => {
|
|
const action = button.dataset.windowAction;
|
|
if (action === "minimize") {
|
|
window.store.minimizeWindow();
|
|
}
|
|
if (action === "devtools") {
|
|
window.store.toggleDevTools();
|
|
}
|
|
if (action === "close") {
|
|
window.store.closeWindow();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|