From 68ce51b89221bfaa23231a5e799cd0420287355f Mon Sep 17 00:00:00 2001 From: Flummi Date: Fri, 6 May 2022 14:46:32 +0200 Subject: [PATCH 1/4] chrome lol --- public/s/css/f0ck.css | 1 + 1 file changed, 1 insertion(+) diff --git a/public/s/css/f0ck.css b/public/s/css/f0ck.css index 6d47944..01cc61c 100644 --- a/public/s/css/f0ck.css +++ b/public/s/css/f0ck.css @@ -474,6 +474,7 @@ html, body { overscroll-behavior-y: contain; overflow: overlay; font-size: 14px; + height: 100%; } .noscript-badge { From 7b2ad52fe0c551b4872402dc2e45ce550bc7f65d Mon Sep 17 00:00:00 2001 From: Flummi Date: Fri, 6 May 2022 14:48:47 +0200 Subject: [PATCH 2/4] fix undefined if searchstring is empty --- src/inc/routes/search.mjs | 1 - views/search.html | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/inc/routes/search.mjs b/src/inc/routes/search.mjs index 28f52fd..ffd6f26 100644 --- a/src/inc/routes/search.mjs +++ b/src/inc/routes/search.mjs @@ -36,7 +36,6 @@ export default (router, tpl) => { result: ret, totals: await lib.countf0cks(), searchstring: tag, - session: req.session, tmp: null }, req) }); diff --git a/views/search.html b/views/search.html index f3e3297..9735fd3 100644 --- a/views/search.html +++ b/views/search.html @@ -1,7 +1,7 @@ @include(snippets/header)

f0ckgle

@if(result) From 2162f1565c346adc1722284f6b2abfd55aaa9a3f Mon Sep 17 00:00:00 2001 From: Flummi Date: Fri, 6 May 2022 17:01:42 +0200 Subject: [PATCH 3/4] fucking pagination --- src/inc/lib.mjs | 13 +++++++++++-- src/inc/routeinc/f0cklib.mjs | 18 ++++++++---------- views/index.html | 4 ++-- views/item.html | 4 ++-- views/snippets/navbar.html | 10 +++++----- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/inc/lib.mjs b/src/inc/lib.mjs index ff6bfea..780878d 100644 --- a/src/inc/lib.mjs +++ b/src/inc/lib.mjs @@ -64,8 +64,17 @@ export default new class { if(env.tag) link.push("tag", env.tag); if(env.user) link.push("user", env.user, env.type ?? 'f0cks'); if(env.mime.length > 2) link.push(env.mime); - if(env.page) link.push("p", env.page); - return link.join("/"); + + let tmp = link.length === 0 ? '/' : link.join('/'); + if(!tmp.endsWith('/')) + tmp = tmp + '/'; + if(!tmp.startsWith('/')) + tmp = '/' + tmp; + + return { + main: tmp, + path: env.path ? env.path : '' + }; }; parseTag(tag) { if(!tag) diff --git a/src/inc/routeinc/f0cklib.mjs b/src/inc/routeinc/f0cklib.mjs index c7270a1..3c26ac9 100644 --- a/src/inc/routeinc/f0cklib.mjs +++ b/src/inc/routeinc/f0cklib.mjs @@ -161,7 +161,7 @@ export default { for(let i = Math.max(1, act_page - 3); i <= Math.min(act_page + 3, pages); i++) cheat.push(i); - const link = lib.genLink({ user, tag, mime, type: o.fav ? 'favs' : 'f0cks' }); + const link = lib.genLink({ user, tag, mime, type: o.fav ? 'favs' : 'f0cks', path: 'p/' }); data = { success: true, @@ -172,11 +172,10 @@ export default { prev: (act_page > 1) ? act_page - 1 : null, next: (act_page < pages) ? act_page + 1 : null, page: act_page, - cheat: cheat, - uff: false + cheat: cheat }, - link: link, - tmp: tmp + link, + tmp }; return data; }, @@ -279,7 +278,7 @@ export default { const tags = await lib.getTags(itemid); const cheat = [...new Set(items.slice(Math.max(0, item - 3), item + 4).map(i => i.id))]; - const link = lib.genLink({ user, tag, mime, type: o.fav ? 'favs' : 'f0cks' }); + const link = lib.genLink({ user, tag, mime, type: o.fav ? 'favs' : 'f0cks', path: '' }); const favorites = await db` select "user".user, "user_options".avatar from "favorites" @@ -327,12 +326,11 @@ export default { next: items[item + 1]?.id, prev: items[item - 1]?.id, page: actitem.id, - cheat: cheat, - uff: true + cheat: cheat }, phrase: cfg.websrv.phrases[~~(Math.random() * cfg.websrv.phrases.length)], - link: link, - tmp: tmp + link, + tmp }; return data; }, diff --git a/views/index.html b/views/index.html index 0563074..a18189d 100644 --- a/views/index.html +++ b/views/index.html @@ -1,10 +1,10 @@ @include(snippets/header)
@if(tmp.user)

user: {!! tmp.user.toLowerCase() !!}@if(tmp.mime) ({{ tmp.mime }}s)@else (all)@endif

@endif - @if(tmp.tag)

tag: @if(session){!! tmp.tag.toLowerCase() !!}@else{!! tmp.tag.toLowerCase() !!}@endif@if(tmp.mime) ({{ tmp.mime }}s)@else (all)@endif

@endif + @if(tmp.tag)

tag: @if(session){!! tmp.tag.toLowerCase() !!}@else{!! tmp.tag.toLowerCase() !!}@endif@if(tmp.mime) ({{ tmp.mime }}s)@else (all)@endif

@endif
@each(items as item) -

+

@endeach
diff --git a/views/item.html b/views/item.html index 8d0dd6f..d30dc29 100644 --- a/views/item.html +++ b/views/item.html @@ -4,7 +4,7 @@