diff --git a/src/inc/routes/index.mjs b/src/inc/routes/index.mjs
index 5fb59d8..c15b934 100644
--- a/src/inc/routes/index.mjs
+++ b/src/inc/routes/index.mjs
@@ -44,14 +44,24 @@ export default (router, tpl) => {
session: !!req.session
});
- if('items' in f0cks)
+ const count = {
+ f0cks: 0,
+ favs: 0
+ };
+
+ if('items' in f0cks) {
+ count.f0cks = f0cks.items.length;
f0cks.items = f0cks.items.slice(0, 50);
- if('items' in favs)
+ }
+ if('items' in favs) {
+ count.favs = favs.items.length;
favs.items = favs.items.slice(0, 50);
+ }
const data = {
user: query[0],
f0cks,
+ count,
favs,
tmp: null
};
diff --git a/views/user.html b/views/user.html
index ba085ae..ee3bf8c 100644
--- a/views/user.html
+++ b/views/user.html
@@ -2,12 +2,8 @@
{{ user.user }}@if(user.avatar) @endif
ID: {{ user.user_id }}
- @if('items' in f0cks)
-
{{ f0cks.items.length }} f0ck{{ f0cks.items.length == 1 ? '' : 's' }}
- @endif
- @if('items' in favs)
-
{{ favs.items.length }} fav{{ favs.items.length == 1 ? '' : 's' }}
- @endif
+
{{ count.f0cks }} f0ck{{ count.f0cks == 1 ? '' : 's' }}
+
{{ count.favs }} fav{{ count.favs == 1 ? '' : 's' }}
Joined: {{ user.created_at }}
f0cks: