summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-02-12 16:44:45 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-02-12 16:44:45 -0500
commit98f612774cd0fa1f11b4166a0c7656722152aba1 (patch)
treec9f8fed728097362165d2dd60a5e005af364232b /public
parentrefactor (diff)
downloadxssbook-98f612774cd0fa1f11b4166a0c7656722152aba1.tar.gz
xssbook-98f612774cd0fa1f11b4166a0c7656722152aba1.tar.bz2
xssbook-98f612774cd0fa1f11b4166a0c7656722152aba1.zip
update dependicies, fix profile page
Diffstat (limited to 'public')
-rw-r--r--public/js/main.js3
-rw-r--r--public/js/profile.js14
2 files changed, 14 insertions, 3 deletions
diff --git a/public/js/main.js b/public/js/main.js
index 9993cee..3ad36b0 100644
--- a/public/js/main.js
+++ b/public/js/main.js
@@ -66,6 +66,7 @@ export function form(attrs, ...children) {
}
export function img(attrs, ...children) {
+ attrs['onerror'] = (event) => event.target.remove()
return createElement("img", attrs, ...children)
}
@@ -102,7 +103,7 @@ export function pfp(id) {
}
export function banner(id) {
- return img({src: `/image/banner?user_id=${id}`, onerror: () => {this.remove()}})
+ return img({src: `/image/banner?user_id=${id}`})
}
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
diff --git a/public/js/profile.js b/public/js/profile.js
index b053b5d..8322ef0 100644
--- a/public/js/profile.js
+++ b/public/js/profile.js
@@ -198,9 +198,15 @@ async function load(id) {
}
const posts = (await loadusersposts(id, page)).json
+ if (posts == undefined) {
+ posts = []
+ }
if (posts.length < 1) {
- document.getElementsByClassName('loadp')[0].remove()
+ let el = document.getElementsByClassName('loadp')[0]
+ if (el) {
+ el.remove()
+ }
return []
} else {
page++
@@ -213,7 +219,11 @@ async function load(id) {
}
if (batch.length != 0) {
- const users = await loadusers(batch).json
+ const users = (await loadusers(batch)).json
+ if (users == undefined) {
+ users = []
+ }
+
for (const user of users) {
data.users[user.user_id] = user
}