move document.createElement to createElement
reduces filesize and increases the readability slightly
This commit is contained in:
parent
87b81cef81
commit
32b06779b0
28
js/posts.js
28
js/posts.js
@ -10,6 +10,8 @@ var highest_id
|
|||||||
|
|
||||||
var currentChannel = sessionStorage.getItem("lastchannel") || "everyone"
|
var currentChannel = sessionStorage.getItem("lastchannel") || "everyone"
|
||||||
|
|
||||||
|
const createElement = document.createElement
|
||||||
|
|
||||||
let socket = new WebSocket(wss_URI);
|
let socket = new WebSocket(wss_URI);
|
||||||
socket.addEventListener("message", async function (event) {
|
socket.addEventListener("message", async function (event) {
|
||||||
if(wss_server == event.origin) {
|
if(wss_server == event.origin) {
|
||||||
@ -123,19 +125,19 @@ async function reply_link_clicked(reply_channel,reply_id) {
|
|||||||
|
|
||||||
async function createPost(username,text,time,specialtext,postid,isbot,reply_id,add_on_top) {
|
async function createPost(username,text,time,specialtext,postid,isbot,reply_id,add_on_top) {
|
||||||
if(!specialtext)specialtext=""
|
if(!specialtext)specialtext=""
|
||||||
const newDiv = document.createElement("div");
|
const newDiv = createElement("div");
|
||||||
const newP = document.createElement("p");
|
const newP = createElement("p");
|
||||||
const newA = document.createElement("a");
|
const newA = createElement("a");
|
||||||
const newSpan2 = document.createElement("span");
|
const newSpan2 = createElement("span");
|
||||||
const newSpan3 = document.createElement("span");
|
const newSpan3 = createElement("span");
|
||||||
const avatar = document.createElement("img");
|
const avatar = createElement("img");
|
||||||
const boticon = document.createElement("img");
|
const boticon = createElement("img");
|
||||||
|
|
||||||
const replyDiv = document.createElement("div");
|
const replyDiv = createElement("div");
|
||||||
const replyA = document.createElement("a");
|
const replyA = createElement("a");
|
||||||
const replyAvatar = document.createElement("img");
|
const replyAvatar = createElement("img");
|
||||||
const replySpan = document.createElement("span");
|
const replySpan = createElement("span");
|
||||||
const replyBr = document.createElement("br");
|
const replyBr = createElement("br");
|
||||||
|
|
||||||
boticon.src = "/images/bot.png"
|
boticon.src = "/images/bot.png"
|
||||||
boticon.height = 25
|
boticon.height = 25
|
||||||
@ -343,7 +345,7 @@ async function loadChannels() {
|
|||||||
for (let i = 0; i < channels.length; i++) {
|
for (let i = 0; i < channels.length; i++) {
|
||||||
let channelname = decodeURIComponent(channels[i].post_receiver_name)
|
let channelname = decodeURIComponent(channels[i].post_receiver_name)
|
||||||
if(channelname == "")continue;
|
if(channelname == "")continue;
|
||||||
let channelp = document.createElement("p")
|
let channelp = createElement("p")
|
||||||
channelp.classList.add("channel")
|
channelp.classList.add("channel")
|
||||||
let textnode = document.createTextNode(channelname)
|
let textnode = document.createTextNode(channelname)
|
||||||
channelp.appendChild(textnode)
|
channelp.appendChild(textnode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user