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>
|
<script>
|
||||||
/** @type {HTMLDivElement} */
|
/** @type {HTMLDivElement} */
|
||||||
const bij = document.getElementById("gonk");
|
const bij = document.getElementById("gonk");
|
||||||
let arrlen = 0;
|
|
||||||
/** @type {HTMLInputElement} */
|
/** @type {HTMLInputElement} */
|
||||||
const n = document.getElementById("n");
|
const n = document.getElementById("n");
|
||||||
|
|
||||||
const changeHandler = async () => {
|
const changeHandler = async () => {
|
||||||
const number = parseInt(n.value);
|
const number = parseInt(n.value);
|
||||||
if (isNaN(number)) {
|
if (isNaN(number)) {
|
||||||
@@ -46,12 +46,11 @@
|
|||||||
const f = new URL("/api/queue", window.location.href);
|
const f = new URL("/api/queue", window.location.href);
|
||||||
f.searchParams.append("n", number);
|
f.searchParams.append("n", number);
|
||||||
console.log("fetching", f);
|
console.log("fetching", f);
|
||||||
const c = await fetch(f)
|
return await fetch(f)
|
||||||
.then((r) => r.json())
|
.then((r) => r.json())
|
||||||
.then((n) => {
|
.then((n) => {
|
||||||
console.log(n);
|
console.log(n);
|
||||||
arrlen = n.length;
|
if (n.length > 0) {
|
||||||
if (n) {
|
|
||||||
const ol = document.createElement("ol");
|
const ol = document.createElement("ol");
|
||||||
for (const i of n) {
|
for (const i of n) {
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
@@ -64,7 +63,7 @@
|
|||||||
ol.appendChild(li);
|
ol.appendChild(li);
|
||||||
}
|
}
|
||||||
bij.textContent = `next ${
|
bij.textContent = `next ${
|
||||||
n.length != 1
|
n.length > 1
|
||||||
? `${n.length} entries are`
|
? `${n.length} entries are`
|
||||||
: "entry is"
|
: "entry is"
|
||||||
} SO gone`;
|
} SO gone`;
|
||||||
@@ -72,26 +71,31 @@
|
|||||||
} else {
|
} else {
|
||||||
bij.textContent = "wym empty";
|
bij.textContent = "wym empty";
|
||||||
}
|
}
|
||||||
|
return n.length;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
arrlen = 0;
|
|
||||||
bij.textContent = `shit. cant fetch`;
|
bij.textContent = `shit. cant fetch`;
|
||||||
|
return 0;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
n.addEventListener("change", changeHandler);
|
n.addEventListener("change", changeHandler);
|
||||||
|
|
||||||
/** @type {HTMLFormElement} */
|
/** @type {HTMLFormElement} */
|
||||||
const c = document.getElementById("c");
|
const c = document.getElementById("c");
|
||||||
c.addEventListener("submit", async (e) => {
|
c.addEventListener("submit", async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
await changeHandler();
|
await changeHandler();
|
||||||
});
|
});
|
||||||
|
|
||||||
changeHandler();
|
changeHandler();
|
||||||
|
|
||||||
const s = document.getElementById("s");
|
const s = document.getElementById("s");
|
||||||
s.addEventListener("click", (e) => {
|
s.addEventListener("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log("ts runs");
|
console.log("ts runs");
|
||||||
changeHandler();
|
const arrlen = changeHandler();
|
||||||
for (const _ of Array(arrlen)) {
|
for (const _ of Array(arrlen)) {
|
||||||
const w = window.open(
|
const w = window.open(
|
||||||
"/r",
|
"/r",
|
||||||
@@ -103,11 +107,12 @@
|
|||||||
arrlen = 0;
|
arrlen = 0;
|
||||||
bij.textContent = "something idk";
|
bij.textContent = "something idk";
|
||||||
});
|
});
|
||||||
|
|
||||||
/** @type {HTMLButtonElement} */
|
/** @type {HTMLButtonElement} */
|
||||||
const all = document.getElementById("all");
|
const all = document.getElementById("all");
|
||||||
all.addEventListener(
|
all.addEventListener(
|
||||||
"click",
|
"click",
|
||||||
async () =>
|
async (e) =>
|
||||||
await fetch("/api/queue/len")
|
await fetch("/api/queue/len")
|
||||||
.then((d) => d.json())
|
.then((d) => d.json())
|
||||||
.then((len) => {
|
.then((len) => {
|
||||||
@@ -120,7 +125,6 @@
|
|||||||
);
|
);
|
||||||
console.log(w);
|
console.log(w);
|
||||||
}
|
}
|
||||||
arrlen = 0;
|
|
||||||
bij.textContent = "everything idk";
|
bij.textContent = "everything idk";
|
||||||
})
|
})
|
||||||
.catch((e) => console.error(e))
|
.catch((e) => console.error(e))
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>no</p>
|
<p>no. go add some to <a href="/queuein">queuein</a></p>
|
||||||
<button onclick="location.reload();">reload</button>
|
<button onclick="location.reload();">reload</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</body>
|
</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
|
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)
|
@app.get("/q", response_class=HTMLResponse)
|
||||||
async def no(request: Request):
|
async def no(request: Request):
|
||||||
current_link = queue[0] if queue else None
|
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")
|
@app.get("/r")
|
||||||
async def redir(request: Request):
|
async def redir(request: Request):
|
||||||
if queue:
|
if queue:
|
||||||
|
|||||||
Reference in new issue
Block a user