summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/chat.pug62
-rw-r--r--views/forum_post.pug6
-rw-r--r--views/join.pug10
-rw-r--r--views/message_outbox.pug4
-rw-r--r--views/message_read.pug6
5 files changed, 44 insertions, 44 deletions
diff --git a/views/chat.pug b/views/chat.pug
index 15d99df..3fb9b35 100644
--- a/views/chat.pug
+++ b/views/chat.pug
@@ -38,56 +38,56 @@ html
p: a(href="/chat/all") All messages
script.
- let chat_data = !{ JSON.stringify(chat).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;") };
- let page_size = !{ page_size };
- let me = !{ JSON.stringify(user.name) };
- let table = document.querySelector("tbody");
- let foot = document.querySelector("#foot");
- let chat_lines = [];
+ let chat_data = !{ JSON.stringify(chat).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;") }
+ let page_size = !{ page_size }
+ let me = !{ JSON.stringify(user.name) }
+ let table = document.querySelector("tbody")
+ let foot = document.querySelector("#foot")
+ let chat_lines = []
function add(tr,text,link) {
- let td = document.createElement("td");
+ let td = document.createElement("td")
if (link) {
- let a = document.createElement("a");
- a.href = link;
- a.textContent = text;
- td.appendChild(a);
+ let a = document.createElement("a")
+ a.href = link
+ a.textContent = text
+ td.appendChild(a)
} else {
- td.textContent = text;
+ td.textContent = text
}
- tr.appendChild(td);
+ tr.appendChild(td)
}
function format_date(date) {
- let t = date.toISOString();
- return t.substring(0,10) + " " + t.substring(11,19);
+ let t = date.toISOString()
+ return t.substring(0,10) + " " + t.substring(11,19)
}
for (let [game_id,time,user,message] of chat_data) {
- let tr = document.createElement("tr");
- if (user === me) tr.className = "me";
- add(tr,game_id,"/join/"+game_id);
- add(tr,format_date(new Date(time+"Z")));
- add(tr,user,"/user/"+user);
- add(tr,message);
- chat_lines.push(tr);
+ let tr = document.createElement("tr")
+ if (user === me) tr.className = "me"
+ add(tr,game_id,"/join/"+game_id)
+ add(tr,format_date(new Date(time+"Z")))
+ add(tr,user,"/user/"+user)
+ add(tr,message)
+ chat_lines.push(tr)
}
function next() { if (page > 0) --page; update(); }
function back() { if (page < page_count-1) ++page; update(); }
function newest() { page=0; update(); }
function oldest() { page=page_count-1; update(); }
- let chat_size = chat_lines.length;
- let page_count = Math.ceil(chat_size / page_size);
- let page = 0;
+ let chat_size = chat_lines.length
+ let page_count = Math.ceil(chat_size / page_size)
+ let page = 0
function update() {
- table.innerHTML = "";
+ table.innerHTML = ""
for (let i = 0; i < page_size; ++i) {
- let k = page * page_size + ( page_size - i - 1);
+ let k = page * page_size + ( page_size - i - 1)
if (k >= 0 && k < chat_size)
- table.appendChild(chat_lines[k]);
- foot.textContent = `${page_count-page} / ${page_count}`;
+ table.appendChild(chat_lines[k])
+ foot.textContent = `${page_count-page} / ${page_count}`
}
}
if (page_size > 0) {
- newest();
+ newest()
} else {
for (let i = chat_size-1; i >= 0; --i)
- table.appendChild(chat_lines[i]);
+ table.appendChild(chat_lines[i])
}
diff --git a/views/forum_post.pug b/views/forum_post.pug
index d3c0e80..a0ff207 100644
--- a/views/forum_post.pug
+++ b/views/forum_post.pug
@@ -9,10 +9,10 @@ html
script.
function next(event,sel) {
if (event.keyCode === 13) {
- document.querySelector(sel).focus();
- return false;
+ document.querySelector(sel).focus()
+ return false
}
- return true;
+ return true
}
body
include header
diff --git a/views/join.pug b/views/join.pug
index bc1567a..8a19a09 100644
--- a/views/join.pug
+++ b/views/join.pug
@@ -14,11 +14,11 @@ html
td a { text-decoration: underline; color: blue; }
.hide { display: none; }
script.
- let game = !{ JSON.stringify(game) };
- let roles = !{ JSON.stringify(roles) };
- let players = !{ JSON.stringify(players) };
- let user_id = !{ user.user_id };
- let ready = !{ ready };
+ let game = !{ JSON.stringify(game) }
+ let roles = !{ JSON.stringify(roles) }
+ let players = !{ JSON.stringify(players) }
+ let user_id = !{ user.user_id }
+ let ready = !{ ready }
script(src="/join.js")
body
include header
diff --git a/views/message_outbox.pug b/views/message_outbox.pug
index 57d6d60..5da84c6 100644
--- a/views/message_outbox.pug
+++ b/views/message_outbox.pug
@@ -8,9 +8,9 @@ html
td a { display: block }
script.
function delete_all() {
- let warning = "Are you sure you want to delete ALL the messages?";
+ let warning = "Are you sure you want to delete ALL the messages?"
if (window.confirm(warning))
- window.location.href = "/outbox/delete";
+ window.location.href = "/outbox/delete"
}
body
include header
diff --git a/views/message_read.pug b/views/message_read.pug
index db43423..f02c2f7 100644
--- a/views/message_read.pug
+++ b/views/message_read.pug
@@ -8,12 +8,12 @@ html
.head {white-space:pre-wrap}
script.
function delete_message(id) {
- let warning = "Are you sure you want to DELETE this message?";
+ let warning = "Are you sure you want to DELETE this message?"
if (window.confirm(warning))
- window.location.href = "/message/delete/" + id;
+ window.location.href = "/message/delete/" + id
}
function reply_message(id) {
- window.location.href = "/message/reply/" + id;
+ window.location.href = "/message/reply/" + id
}
body
include header