replace menu open icon

This commit is contained in:
Izalia Mae 2024-06-16 11:27:43 -04:00
parent cad7f47e7e
commit f49bc0ae90
6 changed files with 2100 additions and 11 deletions

View file

@ -33,7 +33,7 @@ from .views.frontend import handle_frontend_path
def get_csp(request: web.Request) -> str: def get_csp(request: web.Request) -> str:
data = [ data = [
"default-src 'none'", "default-src 'self'",
f"script-src 'nonce-{request['hash']}'", f"script-src 'nonce-{request['hash']}'",
f"style-src 'self' 'nonce-{request['hash']}'", f"style-src 'self' 'nonce-{request['hash']}'",
"form-action 'self'", "form-action 'self'",

View file

@ -13,6 +13,7 @@
%meta(name="viewport" content="width=device-width, initial-scale=1") %meta(name="viewport" content="width=device-width, initial-scale=1")
%link(rel="stylesheet" type="text/css" href="/theme/{{config.theme}}.css" nonce="{{view.request['hash']}}" class="theme") %link(rel="stylesheet" type="text/css" href="/theme/{{config.theme}}.css" nonce="{{view.request['hash']}}" class="theme")
%link(rel="stylesheet" type="text/css" href="/static/style.css" nonce="{{view.request['hash']}}") %link(rel="stylesheet" type="text/css" href="/static/style.css" nonce="{{view.request['hash']}}")
%link(rel="stylesheet" type="text/css" href="/static/bootstrap-icons.css" nonce="{{view.request['hash']}}")
%link(rel="manifest" href="/manifest.json") %link(rel="manifest" href="/manifest.json")
%script(type="application/javascript" src="/static/api.js" nonce="{{view.request['hash']}}" defer) %script(type="application/javascript" src="/static/api.js" nonce="{{view.request['hash']}}" defer)
-block head -block head
@ -41,7 +42,7 @@
#container #container
#header.section #header.section
%span#menu-open << &#8286; %span#menu-open -> %i(class="bi bi-list")
%a.title(href="/") -> =config.name %a.title(href="/") -> =config.name
.empty .empty

View file

@ -32,18 +32,18 @@ function toast(text, type="error", timeout=5) {
const body = document.getElementById("container") const body = document.getElementById("container")
const menu = document.getElementById("menu"); const menu = document.getElementById("menu");
const menu_open = document.getElementById("menu-open"); const menu_open = document.querySelector("#menu-open i");
const menu_close = document.getElementById("menu-close"); const menu_close = document.getElementById("menu-close");
menu_open.addEventListener("click", (event) => { function toggle_menu() {
var new_value = menu.attributes.visible.nodeValue === "true" ? "false" : "true"; let new_value = menu.attributes.visible.nodeValue === "true" ? "false" : "true";
menu.attributes.visible.nodeValue = new_value; menu.attributes.visible.nodeValue = new_value;
}); }
menu_close.addEventListener("click", (event) => {
menu.attributes.visible.nodeValue = "false" menu_open.addEventListener("click", toggle_menu);
}); menu_close.addEventListener("click", toggle_menu);
body.addEventListener("click", (event) => { body.addEventListener("click", (event) => {
if (event.target === menu_open) { if (event.target === menu_open) {
@ -53,6 +53,10 @@ body.addEventListener("click", (event) => {
menu.attributes.visible.nodeValue = "false"; menu.attributes.visible.nodeValue = "false";
}); });
for (const elem of document.querySelectorAll("#menu-open div")) {
elem.addEventListener("click", toggle_menu);
}
// misc // misc

2077
relay/frontend/static/bootstrap-icons.css vendored Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -155,6 +155,7 @@ textarea {
z-index: 1; z-index: 1;
font-size: 1.5em; font-size: 1.5em;
min-width: 300px; min-width: 300px;
overflow-x: auto;
} }
#menu[visible="false"] { #menu[visible="false"] {
@ -188,11 +189,17 @@ textarea {
} }
#menu-open { #menu-open {
color: var(--primary); color: var(--background);
background: var(--primary);
font-size: 38px;
line-height: 38px;
border: 1px solid var(--primary);
border-radius: 5px;
} }
#menu-open:hover { #menu-open:hover {
color: var(--primary-hover); color: var(--primary);
background: var(--background);
} }
#menu-open, #menu-close { #menu-open, #menu-close {