add fallback avatar handling
This commit is contained in:
parent
f456ab4798
commit
e1de6895a9
14
js/posts.js
14
js/posts.js
@ -149,8 +149,10 @@ async function createPost(username,text,time,specialtext,postid,isbot,reply_id,a
|
|||||||
avatar.width=25;
|
avatar.width=25;
|
||||||
avatar.height=25;
|
avatar.height=25;
|
||||||
avatar.classList.add("avatar")
|
avatar.classList.add("avatar")
|
||||||
|
if(avatar_src)avatar.src = "/avatars/"+avatar_src
|
||||||
avatar.src = avatar_src
|
else {
|
||||||
|
avatar.src = "/images/default_avatar.png"
|
||||||
|
}
|
||||||
|
|
||||||
newA.appendChild(avatar)
|
newA.appendChild(avatar)
|
||||||
newA.appendChild(newUsername)
|
newA.appendChild(newUsername)
|
||||||
@ -183,7 +185,11 @@ async function createPost(username,text,time,specialtext,postid,isbot,reply_id,a
|
|||||||
replyAvatar.width=10;
|
replyAvatar.width=10;
|
||||||
replyAvatar.height=10;
|
replyAvatar.height=10;
|
||||||
replyAvatar.classList.add("avatar")
|
replyAvatar.classList.add("avatar")
|
||||||
replyAvatar.src = "/avatars/"+reply_obj.User_Avatar
|
|
||||||
|
if(reply_obj.User_Avatar)replyAvatar.src = "/avatars/"+reply_obj.User_Avatar
|
||||||
|
else {
|
||||||
|
replyAvatar.src = "/images/default_avatar.png"
|
||||||
|
}
|
||||||
|
|
||||||
replyA.appendChild(replyAvatar)
|
replyA.appendChild(replyAvatar)
|
||||||
replyA.appendChild(reply_username_text)
|
replyA.appendChild(reply_username_text)
|
||||||
@ -242,7 +248,7 @@ async function main(){
|
|||||||
highest_id = all_posts[0].post_id
|
highest_id = all_posts[0].post_id
|
||||||
for(i in all_posts) {
|
for(i in all_posts) {
|
||||||
let item = all_posts[i]
|
let item = all_posts[i]
|
||||||
await createPost(decURIComp(item.post_user_name),decURIComp(item.post_text),item.post_time,item.post_special_text,item.post_id,item.post_from_bot,item.post_reply_id,false,"/avatars/"+item.User_Avatar)
|
await createPost(decURIComp(item.post_user_name),decURIComp(item.post_text),item.post_time,item.post_special_text,item.post_id,item.post_from_bot,item.post_reply_id,false,item.User_Avatar)
|
||||||
}
|
}
|
||||||
|
|
||||||
let links = document.getElementsByClassName("insertedlink")
|
let links = document.getElementsByClassName("insertedlink")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user