trail
This commit is contained in:
1 parent
4f10325b3e
commit
c557ca01e7
5 files changed
+84
-10
No files matched your search
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
{% macro this(route) %}
|
||||
<p>
|
||||
<a href="{{ url_for(route.name) }}"
|
||||
>{{ route.name }}: {{ route.path }}</a
|
||||
>
|
||||
</p>
|
||||
{% endmacro %} {% for route in routes if "GET" in route.methods %} {{
|
||||
this(route) }} {% endfor %}
|
||||
</body>
|
||||
</html>
|
||||
+13
-9
@@ -34,9 +34,9 @@
|
||||
<script>
|
||||
/** @type {HTMLDivElement} */
|
||||
const bij = document.getElementById("gonk");
|
||||
let arrlen = 0;
|
||||
/** @type {HTMLInputElement} */
|
||||
const n = document.getElementById("n");
|
||||
|
||||
const changeHandler = async () => {
|
||||
const number = parseInt(n.value);
|
||||
if (isNaN(number)) {
|
||||
@@ -46,12 +46,11 @@
|
||||
const f = new URL("/api/queue", window.location.href);
|
||||
f.searchParams.append("n", number);
|
||||
console.log("fetching", f);
|
||||
const c = await fetch(f)
|
||||
return await fetch(f)
|
||||
.then((r) => r.json())
|
||||
.then((n) => {
|
||||
console.log(n);
|
||||
arrlen = n.length;
|
||||
if (n) {
|
||||
if (n.length > 0) {
|
||||
const ol = document.createElement("ol");
|
||||
for (const i of n) {
|
||||
const li = document.createElement("li");
|
||||
@@ -64,7 +63,7 @@
|
||||
ol.appendChild(li);
|
||||
}
|
||||
bij.textContent = `next ${
|
||||
n.length != 1
|
||||
n.length > 1
|
||||
? `${n.length} entries are`
|
||||
: "entry is"
|
||||
} SO gone`;
|
||||
@@ -72,26 +71,31 @@
|
||||
} else {
|
||||
bij.textContent = "wym empty";
|
||||
}
|
||||
return n.length;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
arrlen = 0;
|
||||
bij.textContent = `shit. cant fetch`;
|
||||
return 0;
|
||||
});
|
||||
};
|
||||
|
||||
n.addEventListener("change", changeHandler);
|
||||
|
||||
/** @type {HTMLFormElement} */
|
||||
const c = document.getElementById("c");
|
||||
c.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
await changeHandler();
|
||||
});
|
||||
|
||||
changeHandler();
|
||||
|
||||
const s = document.getElementById("s");
|
||||
s.addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
console.log("ts runs");
|
||||
changeHandler();
|
||||
const arrlen = changeHandler();
|
||||
for (const _ of Array(arrlen)) {
|
||||
const w = window.open(
|
||||
"/r",
|
||||
@@ -103,11 +107,12 @@
|
||||
arrlen = 0;
|
||||
bij.textContent = "something idk";
|
||||
});
|
||||
|
||||
/** @type {HTMLButtonElement} */
|
||||
const all = document.getElementById("all");
|
||||
all.addEventListener(
|
||||
"click",
|
||||
async () =>
|
||||
async (e) =>
|
||||
await fetch("/api/queue/len")
|
||||
.then((d) => d.json())
|
||||
.then((len) => {
|
||||
@@ -120,7 +125,6 @@
|
||||
);
|
||||
console.log(w);
|
||||
}
|
||||
arrlen = 0;
|
||||
bij.textContent = "everything idk";
|
||||
})
|
||||
.catch((e) => console.error(e))
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<p>no</p>
|
||||
<p>no. go add some to <a href="/queuein">queuein</a></p>
|
||||
<button onclick="location.reload();">reload</button>
|
||||
{% endif %}
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Trail</title>
|
||||
</head>
|
||||
<body>
|
||||
{% if queue_length > 0 %}
|
||||
<p>
|
||||
<a
|
||||
href="{{ current_link }}"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>{{ current_link }}</a
|
||||
>
|
||||
</p>
|
||||
<p>{{ queue_length }} left: click the screen to do magic</p>
|
||||
<script>
|
||||
window.addEventListener("load", () => {
|
||||
window.addEventListener("click", () => {
|
||||
window.open(window.location.href, "_blank");
|
||||
history.replaceState(
|
||||
null,
|
||||
"lol. lmao, even.",
|
||||
new URL("/r", window.location.href).href
|
||||
);
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<a href="/queuein">add some to queuein lil guy</a>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
+16
@@ -19,6 +19,12 @@ def link_extract_from_onetab(line):
|
||||
return link
|
||||
|
||||
|
||||
@app.get("/", response_class=HTMLResponse)
|
||||
async def index(request: Request):
|
||||
"idgaf"
|
||||
return templates.TemplateResponse(request, "index.html", {"routes": app.routes})
|
||||
|
||||
|
||||
@app.get("/q", response_class=HTMLResponse)
|
||||
async def no(request: Request):
|
||||
current_link = queue[0] if queue else None
|
||||
@@ -29,6 +35,16 @@ async def no(request: Request):
|
||||
)
|
||||
|
||||
|
||||
@app.get("/t", response_class=HTMLResponse)
|
||||
async def trail(request: Request):
|
||||
current_link = queue[0] if queue else None
|
||||
return templates.TemplateResponse(
|
||||
request,
|
||||
"trail.html",
|
||||
{"current_link": current_link, "queue_length": len(queue)},
|
||||
)
|
||||
|
||||
|
||||
@app.get("/r")
|
||||
async def redir(request: Request):
|
||||
if queue:
|
||||
|
||||
Reference in new issue
Block a user