diff --git a/public/s/css/f0ck.css b/public/s/css/f0ck.css index 672cdd6..57e6d72 100644 --- a/public/s/css/f0ck.css +++ b/public/s/css/f0ck.css @@ -1105,6 +1105,21 @@ html[theme="f0ck95d"] .admin-search button { color: black; } +/* fullscreen */ +html[res="fullscreen"] .embed-responsive-16by9::before { + padding-top: 32.99%; +} + +html[res="fullscreen"] .container { + max-width: 100% !important; + padding: 0 !important; +} + +html[res="fullscreen"] span#favs { + padding: 0 !important; +} + + ::-webkit-scrollbar { width: 2px; } diff --git a/public/s/img/iconset.svg b/public/s/img/iconset.svg index cafc7df..ddb27db 100644 --- a/public/s/img/iconset.svg +++ b/public/s/img/iconset.svg @@ -6,5 +6,7 @@ + + diff --git a/public/s/js/theme.js b/public/s/js/theme.js index f7de92c..9a6368e 100644 --- a/public/s/js/theme.js +++ b/public/s/js/theme.js @@ -8,6 +8,7 @@ const Cookie = { opts['max-age'] = opts.days * 60 * 60 * 24; delete opts.days; } + opts.SameSite = 'Strict'; opts = Object.entries(opts).reduce((accumulatedStr, [k, v]) => `${accumulatedStr}; ${k}=${v}`, ''); document.cookie = name + '=' + encodeURIComponent(value) + opts } @@ -44,4 +45,21 @@ const Cookie = { Cookie.set("theme", themes[i], { path: "/", days: 360 }); } }); + + if(tbuttonfull = document.querySelector('svg#a_tfull')) { + tbuttonfull.addEventListener('click', e => { + let f = Cookie.get('fullscreen'); + if(f == 1) { + Cookie.set('fullscreen', 0); + document.querySelector('html').setAttribute('res', ''); + tbuttonfull.innerHTML = ``; + } + else { + Cookie.set('fullscreen', 1); + document.querySelector('html').setAttribute('res', 'fullscreen'); + tbuttonfull.innerHTML = ``; + } + return true; + }); + } })(); diff --git a/src/inc/routes/theme.mjs b/src/inc/routes/theme.mjs index e2b5566..dbe886c 100644 --- a/src/inc/routes/theme.mjs +++ b/src/inc/routes/theme.mjs @@ -12,5 +12,19 @@ export default (router, tpl) => { "Location": req.headers.referer ?? "/" }).end(); }); + + router.get(/^\/tfull\//, async (req, res) => { + let full = req.session.fullscreen; + if(full == 1) + full = 0; + else + full = 1; + + return res.writeHead(301, { + "Cache-Control": "no-cache, public", + "Set-Cookie": `theme=${full}; Path=/`, + "Location": req.headers.referer ?? "/" + }).end(); + }); return router; }; diff --git a/src/index.mjs b/src/index.mjs index c83a9f9..5b04e8e 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -67,6 +67,7 @@ process.on('unhandledRejection', err => { if(req.url.pathname.match(/^\/(s|b|t|ca)\//)) return; req.theme = req.cookies.theme || 'f0ck'; + req.fullscreen = req.cookies.fullscreen || 0; if(req.cookies.session) { const user = await db` @@ -101,6 +102,7 @@ process.on('unhandledRejection', err => { `; req.session.theme = req.cookies.theme; + req.session.fullscreen = req.cookies.fullscreen; // update userprofile await db` @@ -108,12 +110,14 @@ process.on('unhandledRejection', err => { db({ user_id: +user[0].id, mode: user[0].mode ?? 0, - theme: req.session.theme ?? 'f0ck' - }, 'user_id', 'mode', 'theme') + theme: req.session.theme ?? 'f0ck', + fullscreen: req.session.fullscreen || 0 + }, 'user_id', 'mode', 'theme', 'fullscreen') } on conflict ("user_id") do update set mode = excluded.mode, theme = excluded.theme, + fullscreen = excluded.fullscreen, user_id = excluded.user_id `; } diff --git a/views/item.html b/views/item.html index 6538a46..78dbc1d 100644 --- a/views/item.html +++ b/views/item.html @@ -12,6 +12,7 @@ @if(session)
+
@endif diff --git a/views/snippets/header.html b/views/snippets/header.html index b45c04f..6aca2fd 100644 --- a/views/snippets/header.html +++ b/views/snippets/header.html @@ -1,5 +1,5 @@ - + f0ck!