add channel list to posts

This commit is contained in:
Mystikfluu
2022-07-12 15:04:45 +02:00
parent ed25dffea3
commit aa42afe092
4 changed files with 40 additions and 6 deletions
+24 -4
View File
@@ -220,8 +220,6 @@ function unreply() {
reply_id = 0
}
main()
var cansendNoti = false
async function askNotiPerms() {
@@ -234,8 +232,6 @@ async function firstAsk() {
}
}
firstAsk()
async function mainNoti(user) {
if(Notification.permission === 'denied' || Notification.permission === 'default') {
await askNotiPerms()
@@ -262,3 +258,27 @@ if(window.location.href.includes("mention=")) {
if(window.location.href.includes("message=")) {
document.getElementById("post-text").innerText = `${decodeURIComponent(window.location.href.split("message=")[1])} `
}
async function loadChannels() {
// <!-- <p class="channel">- Channel Name -</p> -->
let channels = await (await fetch("/api/getChannels")).json()
let tab = document.getElementById("channelTab")
tab.innerHTML = ""
for (let i = 0; i < channels.length; i++) {
let channelname = channels[i].post_receiver_name
let channelp = document.createElement("p")
channelp.classList.add("channel")
let textnode = document.createTextNode(channelname)
channelp.appendChild(textnode)
tab.appendChild(channelp)
}
}
function init() {
main()
firstAsk()
loadChannels()
}
init()