Skip to content

Commit

Permalink
www: make it pretty
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Spooren <[email protected]>
  • Loading branch information
aparcar committed Sep 12, 2024
1 parent ca3dc58 commit 8f47d44
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
12 changes: 8 additions & 4 deletions www/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ header {
font-weight: 500;
width: 100%;
z-index: 1100;
box-shadow: 0em 0.125em 0.25em -0.06em rgba(0, 0, 0, 0.2),
box-shadow:
0em 0.125em 0.25em -0.06em rgba(0, 0, 0, 0.2),
0em 0.25em 0.3em 0em rgba(0, 0, 0, 0.14),
0em 0.06em 0.625em 0em rgba(0, 0, 0, 0.12);
}
Expand Down Expand Up @@ -119,7 +120,8 @@ header > div {
.container > div {
padding: 0.625em 20px;
text-align: left;
box-shadow: 0em 0.06em 0.19em 0em rgba(0, 0, 0, 0.2),
box-shadow:
0em 0.06em 0.19em 0em rgba(0, 0, 0, 0.2),
0em 0.06em 0.06em 0em rgba(0, 0, 0, 0.14),
0em 0.125em 0.06em -0.06em rgba(0, 0, 0, 0.12);
border-radius: 0.25em;
Expand Down Expand Up @@ -212,7 +214,8 @@ header > div {
letter-spacing: 0.05em;
display: inline-flex;
align-items: center;
box-shadow: 0em 0.06em 0.3em 0em rgba(0, 0, 0, 0.2),
box-shadow:
0em 0.06em 0.3em 0em rgba(0, 0, 0, 0.2),
0em 0.125em 0.125em 0em rgba(0, 0, 0, 0.14),
0em 0.19em 0.06em -0.125em rgba(0, 0, 0, 0.12);
color: #fff;
Expand Down Expand Up @@ -321,7 +324,8 @@ header > div {
letter-spacing: 0.05em;
display: inline-flex;
align-items: center;
box-shadow: 0em 0.06em 0.3em 0em rgba(0, 0, 0, 0.2),
box-shadow:
0em 0.06em 0.3em 0em rgba(0, 0, 0, 0.2),
0em 0.125em 0.125em 0em rgba(0, 0, 0, 0.14),
0em 0.19em 0.06em -0.125em rgba(0, 0, 0, 0.12);
color: #fff;
Expand Down
14 changes: 7 additions & 7 deletions www/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<!doctype html>

<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>OpenWrt Firmware Selector</title>
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" href="index.css">
<link rel="icon" href="favicon.ico" />
<link rel="stylesheet" href="index.css" />
<script src="config.js"></script>
<script src="index.js"></script>
</head>
Expand All @@ -15,7 +15,7 @@
<header>
<div>
<a href="https://openwrt.org">
<img src="logo.svg" width="180" alt="Logo">
<img src="logo.svg" width="180" alt="Logo" />
</a>
<div style="flex-grow: 1"></div>

Expand Down Expand Up @@ -94,7 +94,7 @@ <h2 class="tr-load">Download OpenWrt Firmware for your Device</h2>
spellcheck="false"
autocapitalize="off"
autofocus
>
/>
<select id="versions" size="1"></select>
</div>

Expand Down
28 changes: 14 additions & 14 deletions www/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function buildAsuRequest(request_hash) {
showStatus(
`tr-${mobj.imagebuilder_status || "init"}`,
true,
"info"
"info",
);
setTimeout(buildAsuRequest.bind(null, mobj.request_hash), 5000);
});
Expand Down Expand Up @@ -187,8 +187,8 @@ function setupSelectList(select, items, onselection) {
(a + (a.indexOf("-") < 0 ? "-Z" : "")).localeCompare(
b + (b.indexOf("-") < 0 ? "-Z" : ""),
undefined,
{ numeric: true }
)
{ numeric: true },
),
);

for (const item of items) {
Expand Down Expand Up @@ -498,7 +498,7 @@ function createLink(mobj, image, image_url) {
}

return htmlToElement(
`<td><a href="${href}" class="download-link"><span></span>${label.toUpperCase()}</a></td>`
`<td><a href="${href}" class="download-link"><span></span>${label.toUpperCase()}</a></td>`,
);
}

Expand All @@ -517,7 +517,7 @@ function createExtra(image) {
(image.sha256
? `<div class="hash-content">sha256sum: ${image.sha256}</div>`
: "") +
"</td>"
"</td>",
);
}

Expand Down Expand Up @@ -564,7 +564,7 @@ function updateImages(mobj) {
.replace("{title}", encodeURI($("#models").value))
.replace("{target}", mobj.target)
.replace("{id}", mobj.id)
.replace("{version}", mobj.version_number)
.replace("{version}", mobj.version_number),
);

setValue(
Expand All @@ -575,7 +575,7 @@ function updateImages(mobj) {
"&target=" +
encodeURIComponent(mobj.target) +
"&id=" +
encodeURIComponent(mobj.id)
encodeURIComponent(mobj.id),
);

images.sort((a, b) => a.name.localeCompare(b.name));
Expand Down Expand Up @@ -604,7 +604,7 @@ function updateImages(mobj) {

link.onmouseover = function () {
links2.childNodes.forEach((e) =>
e.firstChild.classList.remove("download-link-hover")
e.firstChild.classList.remove("download-link-hover"),
);
link.firstChild.classList.add("download-link-hover");

Expand Down Expand Up @@ -633,7 +633,7 @@ function updateImages(mobj) {
"&target=" +
encodeURIComponent(mobj.target) +
"&id=" +
encodeURIComponent(mobj.id)
encodeURIComponent(mobj.id),
);

hide("#notfound");
Expand Down Expand Up @@ -763,7 +763,7 @@ async function init() {
return obj.json();
} else {
// .versions.json is optional
return {versions_list: []}
return { versions_list: [] };
}
})
.then((obj) => {
Expand All @@ -773,7 +773,7 @@ async function init() {
version.localeCompare("19.07.4", undefined, {
numeric: true,
sensitivity: "base",
}) >= 0
}) >= 0,
);

if (config.show_snapshots) {
Expand Down Expand Up @@ -842,7 +842,7 @@ async function init() {
for (let title of getModelTitles(profile.titles)) {
if (title.length == 0) {
console.warn(
`Empty device title for model id: ${profile.target}, ${profile.id}`
`Empty device title for model id: ${profile.target}, ${profile.id}`,
);
continue;
}
Expand All @@ -865,14 +865,14 @@ async function init() {
updateImages,
(selectList) => {
changeModel(version, obj, selectList.value);
}
},
);

// set model when selected version changes
setModel(
obj,
current_device["target"] || url_params.get("target"),
current_device["id"] || url_params.get("id")
current_device["id"] || url_params.get("id"),
);

// trigger update of current selected model
Expand Down

0 comments on commit 8f47d44

Please sign in to comment.