remove @everyone, @here, check for replies
This commit is contained in:
parent
825ca879dd
commit
ab2834010e
21
js/posts.js
21
js/posts.js
@ -155,18 +155,12 @@ async function main(){
|
|||||||
|
|
||||||
let all_posts = await (await fetch(`/api/getPosts`)).json()
|
let all_posts = await (await fetch(`/api/getPosts`)).json()
|
||||||
if(!all_posts)return;
|
if(!all_posts)return;
|
||||||
let old_posts = document.getElementById("posts")
|
document.getElementById("post").innerHTML = ""
|
||||||
old_posts.id = "old_posts"
|
|
||||||
let posts = document.createElement("div")
|
|
||||||
posts.id = "posts"
|
|
||||||
posts.classList.add("posts")
|
|
||||||
for(i in all_posts) {
|
for(i in all_posts) {
|
||||||
let item = all_posts[i]
|
let item = all_posts[i]
|
||||||
await createPost(decodeURIComponent(item.post_user_name),decodeURIComponent(item.post_text),item.post_time,item.post_special_text,item.post_id,item.post_from_bot,item.post_reply_id)
|
await createPost(decodeURIComponent(item.post_user_name),decodeURIComponent(item.post_text),item.post_time,item.post_special_text,item.post_id,item.post_from_bot,item.post_reply_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
old_posts.outerHTML = ""
|
|
||||||
|
|
||||||
let links = document.getElementsByClassName("insertedlink")
|
let links = document.getElementsByClassName("insertedlink")
|
||||||
for (let i = 0; i < links.length; i++) {
|
for (let i = 0; i < links.length; i++) {
|
||||||
links[i].innerText = links[i].innerText.split("\/\/")[1].split("\/")[0]
|
links[i].innerText = links[i].innerText.split("\/\/")[1].split("\/")[0]
|
||||||
@ -179,17 +173,6 @@ async function main(){
|
|||||||
mentions[i].classList.remove("mention");
|
mentions[i].classList.remove("mention");
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
if(mentions[i]!=undefined && (mentions[i].innerText == "@everyone" || mentions[i].innerText == "@here")) {
|
|
||||||
mentions[i].classList.add("everyone-mention");
|
|
||||||
mentions[i].classList.remove("mention");
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let replies = document.getElementsByClassName("reply")
|
|
||||||
for (let i = 0; i < replies.length; i++) {
|
|
||||||
if(replies[i]!=undefined && replies[i].innerText == username) {
|
|
||||||
replies[i].style="color: red;"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById("loading").style="display:none;"
|
document.getElementById("loading").style="display:none;"
|
||||||
@ -229,7 +212,7 @@ async function mainNoti(user) {
|
|||||||
await askNotiPerms()
|
await askNotiPerms()
|
||||||
} else {
|
} else {
|
||||||
if(cansendNoti) {
|
if(cansendNoti) {
|
||||||
let notification = new Notification('ZTH Board', { body: "new message posted from " + user });
|
let notification = new Notification('IPost', { body: "new message posted from " + user });
|
||||||
notification = await notification
|
notification = await notification
|
||||||
console.log(notification);
|
console.log(notification);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user