minor tweaks

This commit is contained in:
Booteille 2024-11-27 03:22:16 +01:00
parent 117fe87282
commit 457732ae03
No known key found for this signature in database
GPG Key ID: 0AB6C6CA01272646
3 changed files with 85 additions and 79 deletions

View File

@ -96,6 +96,10 @@ a {
color: var(--active-color); color: var(--active-color);
} }
a:hover {
filter: brightness(80%);
}
a:visited { a:visited {
color: var(--active-color); color: var(--active-color);
} }

View File

@ -302,4 +302,4 @@ document.addEventListener('DOMContentLoaded', () => {
} }
}); });
</script> </script>
%= javascript '/js/lufi-upload.js', type => 'module' %= javascript '/js/lufi-upload.js', type => 'module', defer => "true"

View File

@ -17,6 +17,7 @@
<link rel="apple-touch-icon" sizes="152x152" href="<%= url_for('/img/lufi152.png') %>"> <link rel="apple-touch-icon" sizes="152x152" href="<%= url_for('/img/lufi152.png') %>">
<link rel="apple-touch-icon-precomposed" sizes="128x128" href="<%= url_for('/img/lufi128.png') %>"> <link rel="apple-touch-icon-precomposed" sizes="128x128" href="<%= url_for('/img/lufi128.png') %>">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preload" href="/css/lufi.css" as="style">
<link rel="stylesheet" href="/css/lufi.css"> <link rel="stylesheet" href="/css/lufi.css">
</head> </head>
<body> <body>
@ -62,82 +63,11 @@
</header> </header>
<main role="main"> <main role="main">
<script type="text/javascript">
const langUrl = '<%= url_for('lang') %>';
const prefix = '<%= substr(config('prefix'), 1) %>';
const entityMap = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;",
"/": "&#x2F;",
};
const escapeHtml = (string) => String(string).replace(/[&<>"'\/]/g, (s) => entityMap[s]);
const formatDate = (unixTimestamp) => {
return new Date(unixTimestamp * 1000).toLocaleString(
window.navigator.language,
{
year: "numeric",
month: "long",
day: "numeric",
weekday: "long",
hour: "2-digit",
minute: "2-digit",
}
);
};
const addToast = (text, type) => {
const toastDOM = document.querySelector("template#toast").content.cloneNode(true).children[0];
toastDOM.classList.add(type)
toastDOM.querySelector(".message").innerText = escapeHtml(text);
document.querySelector(".toast-container").appendChild(toastDOM);
setTimeout(() => {
toastDOM.remove();
}, 3500)
toastDOM.onclick = () => {
toastDOM.remove();
}
};
const notify = (title, body) => {
if (!"Notification" in window || typeof Notification === "undefined") {
console.log(
`This browser does not support desktop notification, cannot send following message: ${title} ${body}`
);
return;
}
if (Notification.permission !== "granted") {
Notification.requestPermission();
} else {
new Notification(title, {
body,
icon: "/img/lufi196.png",
});
}
};
document.addEventListener("DOMContentLoaded", () => {
if (!"Notification" in window || typeof Notification === "undefined") {
return;
}
if (Notification.permission !== "granted") {
Notification.requestPermission();
}
document.getElementById("menu-language").onchange = (event) => window.location = langUrl + event.target.value;
})
</script>
<%= content %> <%= content %>
% if (defined(config('piwik_img'))) {
<img src="<%== config('piwik_img') %>" class="no_border" alt="" />
% }
</main> </main>
<div class="toast-container"></div> <div class="toast-container"></div>
@ -151,8 +81,80 @@
</div> </div>
</template> </template>
% if (defined(config('piwik_img'))) { <script type="text/javascript">
<img src="<%== config('piwik_img') %>" class="no_border" alt="" /> const langUrl = '<%= url_for('lang') %>';
% } const prefix = '<%= substr(config('prefix'), 1) %>';
const entityMap = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;",
"/": "&#x2F;",
};
const escapeHtml = (string) => String(string).replace(/[&<>"'\/]/g, (s) => entityMap[s]);
const formatDate = (unixTimestamp) => {
return new Date(unixTimestamp * 1000).toLocaleString(
window.navigator.language,
{
year: "numeric",
month: "long",
day: "numeric",
weekday: "long",
hour: "2-digit",
minute: "2-digit",
}
);
};
const addToast = (text, type) => {
const toastDOM = document.querySelector("template#toast").content.cloneNode(true).children[0];
toastDOM.classList.add(type)
toastDOM.querySelector(".message").innerText = escapeHtml(text);
document.querySelector(".toast-container").appendChild(toastDOM);
setTimeout(() => {
toastDOM.remove();
}, 3500)
toastDOM.onclick = () => {
toastDOM.remove();
}
};
const notify = (title, body) => {
if (!"Notification" in window || typeof Notification === "undefined") {
console.log(
`This browser does not support desktop notification, cannot send following message: ${title} ${body}`
);
return;
}
if (Notification.permission !== "granted") {
Notification.requestPermission();
} else {
new Notification(title, {
body,
icon: "/img/lufi196.png",
});
}
};
document.addEventListener("DOMContentLoaded", () => {
if (!"Notification" in window || typeof Notification === "undefined") {
return;
}
if (Notification.permission !== "granted") {
Notification.requestPermission();
}
document.getElementById("menu-language").onchange = (event) => window.location = langUrl + event.target.value;
})
</script>
</body> </body>
</html> </html>