fucking pagination
This commit is contained in:
@ -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)
|
||||
|
@ -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;
|
||||
},
|
||||
|
Reference in New Issue
Block a user