Commit 958c527d authored by Matthew Wright's avatar Matthew Wright
Browse files

refactor and reformat some things; update appearance of index and api pages

parent 992fcd18
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2,3 +2,4 @@ config.py
README.md.backup
*.pyc
nohup.out
.idea/
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ async def noscript_load():
    <html>
    <head><meta http-equiv="refresh" content="0; url=/noscript_load_thing.html?id=%s" /></head>
    <body>
    <img src="/static/ab79a231234507.564a1d23814ef.gif" width="25" height="25" />Loading could take up to 45 seconds.</img>
    <img src="/static/loading.gif" width="25" height="25" />Loading could take up to 45 seconds.</img>
    </body>
    </html>
    """ % id, headers=(("FinUrl", f"/noscript_load_thing.html?id={id}"),))
@@ -137,7 +137,7 @@ async def index():
    """
    default = request.args.get("q") or ""
    default_id = coerce_to_id(default) or ""
    return render_template("init.html", default=default,default_id=default_id)
    return render_template("index.html", default=default, default_id=default_id)

def parse_changelog(changelog):
    """
+1 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 640 480" xmlns="http://www.w3.org/2000/svg">
<svg viewBox="0 0 480 480" xmlns="http://www.w3.org/2000/svg">
 <g fill-rule="evenodd">
  <path d="m371.97 312.16c-18.111-18.288-119.49-78.851-148.1-79.784-31.52 2.4782-149.42 75.629-162.79 75.564 6.3304-29.776 47.61-45.055 65.085-81.826-69.744-5.8226-112.65-85.187-117.14-88.391 8.5434 0.7767 114.3 0.22121 106.91-7.0337-15.448-7.7241-80.18-82.533-77.371-84.405 14.431 11.807 136.8 35.136 142.08 36.576 1.1286-12.414 46.192-68.177 47.83-73.634 9.0508 27.939 37.249 73.617 42.203 76.447 6.9387-3.965 94.123-61.897 102.69-61.897 8.5456-3.2046-63.176 94.855-71.744 108.32-2.0297 3.8339 5.6539 3.3092 11.254 0 22.406-5.272 84.596-27.206 99.879-30.949-3.5683 2.0391-68.298 96.311-70.338 99.88-24.427 12.453 23.446 78.778 29.542 111.13z" stroke-width="6.25"/>
  <path d="m336.35 198.25c0 43.196-58.957 87.542-57.622 133.74 1.5848 56.506-31.446 92.127-60.344 91.304-47.427 0-56.289-33.975-56.92-88.628-0.5414-45.526-62.314-98.843-62.314-142.04 0-86.392 54.994-126.65 120.84-126.65 65.851 0 116.35 45.88 116.35 132.27z" fill="#fff"/>

static/darkmode.js

0 → 100644
+44 −0
Original line number Diff line number Diff line
const DARKNESS = {
    "html": "dark"
}

function toggleDarkness() {
    if (localStorage.getItem("dark")) {
        console.log("MODE = DARK");
        lightMode();
    } else {
        console.log("MODE != DARK");
        darkMode();
    }
}

function lightMode() {
    for (const [key, value] of Object.entries(DARKNESS)) {
        document.querySelectorAll(key).forEach((e) => e.classList.remove(value));
    }
    try {
        localStorage.removeItem("dark");
    } catch (e) {
        alert("Could not save preference!");
    }
}

function darkMode() {
    for (const [key, value] of Object.entries(DARKNESS)) {
        document.querySelectorAll(key).forEach((e) => e.classList.add(value));
    }
    try {
        localStorage.setItem("dark", true);
    } catch (e) {
        alert("Could not save preference!");
    }
}

function initDarkMode() {
    if (localStorage.getItem("dark")) {
        darkMode();
        console.log("DarkModeSetup");
    }
}

console.log(localStorage.getItem("dark"));
 No newline at end of file
Loading