mono theme, keep it black and simple

This commit is contained in:
x
2026-01-24 11:12:25 +01:00
parent 2229f32dd3
commit fc7d38e3f1
3 changed files with 34 additions and 37 deletions

View File

@@ -23,14 +23,14 @@ const Cookie = {
const themes = [...themecontainer.querySelectorAll("li > a")].map(t => t.innerText.toLowerCase()); const themes = [...themecontainer.querySelectorAll("li > a")].map(t => t.innerText.toLowerCase());
if (acttheme !== document.documentElement.getAttribute("theme") && themes.includes(acttheme)) if (acttheme !== document.documentElement.getAttribute("theme") && themes.includes(acttheme))
document.documentElement.setAttribute("theme", acttheme); document.documentElement.setAttribute("theme", acttheme);
[...themecontainer.querySelectorAll("li > a")].forEach(t => t.addEventListener("click", e => { // [...themecontainer.querySelectorAll("li > a")].forEach(t => t.addEventListener("click", e => {
e.preventDefault(); // e.preventDefault();
const _theme = e.target.innerText.toLowerCase(); // const _theme = e.target.innerText.toLowerCase();
document.documentElement.setAttribute("theme", _theme); // document.documentElement.setAttribute("theme", _theme);
document.querySelector("#themes > a").setAttribute("content", _theme); // document.querySelector("#themes > a").setAttribute("content", _theme);
Cookie.set("theme", _theme, { path: "/", days: 360 }); // Cookie.set("theme", _theme, { path: "/", days: 360 });
return false; // return false;
})); // }));
document.addEventListener("keydown", e => { document.addEventListener("keydown", e => {
if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA") if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA")
@@ -38,15 +38,15 @@ const Cookie = {
const acttheme = Cookie.get('theme') ?? "w0bm"; const acttheme = Cookie.get('theme') ?? "w0bm";
const themes = [...themecontainer.querySelectorAll("li > a")].map(t => t.innerText.toLowerCase()); const themes = [...themecontainer.querySelectorAll("li > a")].map(t => t.innerText.toLowerCase());
const k = e.key; const k = e.key;
if (k === "t") { // if (k === "t") {
e.preventDefault(); // e.preventDefault();
let i = themes.indexOf(acttheme); // let i = themes.indexOf(acttheme);
if (++i >= themes.length) // if (++i >= themes.length)
i = 0; // i = 0;
document.documentElement.setAttribute("theme", themes[i]); // document.documentElement.setAttribute("theme", themes[i]);
document.querySelector("#themes > a").setAttribute("content", themes[i]); // document.querySelector("#themes > a").setAttribute("content", themes[i]);
Cookie.set("theme", themes[i], { path: "/", days: 360 }); // Cookie.set("theme", themes[i], { path: "/", days: 360 });
} // }
}); });
if (tbuttonfull = document.querySelector('svg#a_tfull')) { if (tbuttonfull = document.querySelector('svg#a_tfull')) {

View File

@@ -69,7 +69,7 @@ process.on('unhandledRejection', err => {
req.session = false; req.session = false;
if (req.url.pathname.match(/^\/(s|b|t|ca)\//)) if (req.url.pathname.match(/^\/(s|b|t|ca)\//))
return; return;
req.theme = req.cookies.theme || 'amoled'; req.theme = 'amoled';
req.fullscreen = req.cookies.fullscreen || 0; req.fullscreen = req.cookies.fullscreen || 0;
if (req.cookies.session) { if (req.cookies.session) {

View File

@@ -2,18 +2,14 @@
<div class="settings"> <div class="settings">
<h1>Settings</h1> <h1>Settings</h1>
<h2>Site settings</h2> <h2>Site settings</h2>
<div class="themes">
<h3>Themes</h3>
@each(themes as t)
<a href="/theme/{{ t }}">{{ t }}</a>
@endeach
</div>
<div class="modes"> <div class="modes">
<h3>Modes</h3> <h3>Modes</h3>
<span>Current: {{ modes[session.mode] ?? 'sfw' }}</span> <span>Current: {{ modes[session.mode] ?? 'sfw' }}</span>
@for(let i = 0; i < modes.length; i++) <a class="dropdown-item" href="/mode/0">sfw</a>
<a class="dropdown-item" href="/mode/{{ i }}">{{ modes[i] }}</a> <a class="dropdown-item" href="/mode/1">nsfw</a>
@endfor <a class="dropdown-item" href="/mode/2">untagged</a>
<a class="dropdown-item" href="/mode/3">all</a>
</div> </div>
<h2>Account</h2> <h2>Account</h2>
<table class="table"> <table class="table">
@@ -31,7 +27,8 @@
<td>{!! session.user !!}</td> <td>{!! session.user !!}</td>
</tr> </tr>
<tr> <tr>
<td>@if(session.avatar)<a href="/{{ session.avatar }}"><img id="img_avatar" src="/t/{{ session.avatar }}.webp"></a>@endif</td> <td>@if(session.avatar)<a href="/{{ session.avatar }}"><img id="img_avatar"
src="/t/{{ session.avatar }}.webp"></a>@endif</td>
<td><input type="text" class="input" name="i_avatar" value="{{ session.avatar }}"></td> <td><input type="text" class="input" name="i_avatar" value="{{ session.avatar }}"></td>
</tr> </tr>
<tr> <tr>
@@ -39,7 +36,7 @@
<td><input type="text" class="input" name="i_mail" placeholder="hashed" disabled></td> <td><input type="text" class="input" name="i_mail" placeholder="hashed" disabled></td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><input type="submit" id="s_avatar" value="save"></td> <td><input type="submit" id="s_avatar" value="save"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>