Add first working version

This commit is contained in:
Cadence Ember 2020-08-02 18:18:40 +12:00
parent 9384ef4435
commit 6a1e8edde6
No known key found for this signature in database
GPG key ID: 128B99B1B74A6412
16 changed files with 970 additions and 0 deletions

View file

@ -0,0 +1 @@
:root{--bg-primary: #fcf5f4;--bg-secondary: #e9e1df;--bg-tertiary: #cec8c6;--fg-header: #000;--fg-primary: #181818;--fg-dim: #646464;--fg-link: #2664b5;--edge-mark: #aaa;--edge-table: #333}@media(prefers-color-scheme: dark){:root{--bg-primary: #232323;--bg-secondary: #191919;--bg-tertiary: #383838;--fg-header: #fff;--fg-primary: #d9d9d9;--fg-dim: #828282;--fg-link: #529ef5;--edge-mark: #555;--edge-table: #aaa}}body{background-color:var(--bg-primary);color:var(--fg-primary);font-size:20px;margin:0;padding:8px;font-family:sans-serif}a,a:visited{color:var(--fg-link)}noscript{display:block}mark{background-color:var(--bg-tertiary);color:var(--fg-primary);padding:3px 5px;border-radius:4px;border:1px solid var(--edge-mark)}table,td,th{border:1px solid var(--edge-table);border-collapse:collapse}td,th{padding:4px 8px}thead,tr:nth-child(even){background-color:var(--bg-secondary)}.banner{display:grid;grid-gap:24px;align-items:center;justify-items:center;justify-content:center;padding:20px}@media screen and (min-width: 520px){.banner{grid-template-columns:80px auto}}.banner .logo{width:80px;height:80px;background-size:contain;background-image:url(/static/img/invidious-logo-light.svg?static=25c5cd3acc)}@media(prefers-color-scheme: dark){.banner .logo{background-image:url(/static/img/invidious-logo-dark.svg?static=aa528cbad6)}}.banner h1{color:var(--fg-header);font-size:56px;font-weight:bold;text-transform:uppercase;margin:0;padding:0}.story{margin:40px 0px;text-align:center}@media screen and (min-width: 520px){.story{white-space:pre-line}}.instances-table{display:flex;justify-content:center}.instances-table table{width:100%;max-width:700px}.instances-list{text-align:center}.instances-list .list{margin:0 auto;padding-left:1em;text-align:left;max-width:max-content}.loading-td{text-align:center;padding:20px;background-color:var(--bg-secondary)}.column-center{text-align:center}.health-unknown{color:var(--fg-dim)}.script-warning{margin:0 auto;max-width:max-content;background:#700;color:#fff;padding:4px 20px;border-radius:8px;border:1px solid}

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="129.158" height="129.158" viewBox="0 0 34.173 34.173"><g transform="translate(26.909 -78.793)" paint-order="fill markers stroke"><circle cx="-9.822" cy="95.88" r="16.557" fill="none" stroke="#ddd" stroke-width="1.058" stroke-linecap="round" stroke-linejoin="round"/><path style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000;solid-opacity:1" d="M-10.713 89.306l-.743 2.64 6.893 13.75h2.034zm-.743 2.64l-3.976 13.423.508.15 4.49-15.177zm-4.933 13.228v.53h2.813v-.53z" color="#000" font-weight="400" font-family="sans-serif" overflow="visible" fill="#ddd"/><circle cx="-10.763" cy="87.186" r="1.105" fill="#00b6f0"/></g></svg>

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="129.158" height="129.158" viewBox="0 0 34.173 34.173"><g transform="translate(26.909 -78.793)" paint-order="fill markers stroke"><circle cx="-9.822" cy="95.88" r="16.557" fill="none" stroke="#212121" stroke-width="1.058" stroke-linecap="round" stroke-linejoin="round"/><path style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000;solid-opacity:1" d="M-10.713 89.306l-.743 2.64 6.893 13.75h2.034zm-.743 2.64l-3.976 13.423.508.15 4.49-15.177zm-4.933 13.228v.53h2.813v-.53z" color="#000" font-weight="400" font-family="sans-serif" overflow="visible" fill="#212121"/><circle cx="-10.763" cy="87.186" r="1.105" fill="#00b6f0"/></g></svg>

After

Width:  |  Height:  |  Size: 1 KiB

45
build/static/js/main.js Normal file
View file

@ -0,0 +1,45 @@
"use strict";
;(() => {
const q = s => document.querySelector(s)
const qa = s => document.querySelectorAll(s)
function createElement(tag, properties = {}, children = []) {
const e = document.createElement(tag)
for (const key of Object.keys(properties)) {
e[key] = properties[key]
}
for (const child of children) {
e.appendChild(child)
}
return e
}
const destinationPath = window.location.href.slice(window.location.origin.length)
q("#watch-on-youtube").href = "https://www.youtube.com" + destinationPath
fetch("https://instances.invidio.us/instances.json?pretty=1&sort_by=type,health").then(res => res.json()).then(
/** @param {[string, {monitor: any, flag: string, region: string, stats: any, type: string, uri: string}][]} root */ root => {
console.log(root)
root.filter(entry => entry[1].type === "https").forEach(entry => {
let healthUnknown = "health-unknown "
let health = "(unknown)"
if (entry[1].monitor && entry[1].monitor.dailyRatios && entry[1].monitor.dailyRatios[0]) {
health = entry[1].monitor.dailyRatios[0].ratio
healthUnknown = ""
}
let target = entry[1].uri.replace(/\/*$/, "") + destinationPath
q("#instances-tbody").appendChild(
createElement("tr", {}, [
createElement("td", {textContent: entry[0]}),
createElement("td", {className: "column-center "+healthUnknown, textContent: health}),
createElement("td", {className: "column-center"}, [
createElement("a", {href: target, textContent: "Go →"})
])
])
)
})
qa(".loading").forEach(e => e.remove())
})
})()