From 64d073f03c69589be835e431081473070b178b96 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Thu, 18 May 2017 01:21:57 +0200 Subject: [PATCH] No hour on short and Hour on comments So reverted modif from date-short Added new date-comments to have hours on them (when screen is big enough) Edited the view for displaying date comments, they were displayed on the border (even with old date-short) --- public/js/main.js | 9 ++++++++- templates/view.html | 30 +++++++++++++----------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/public/js/main.js b/public/js/main.js index 9a0b1bb1..baaa62a9 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -18,7 +18,7 @@ function toggleLayer(elem) { // Date formatting var lang = $("html").attr("lang"); -var shortOpt = { year: "numeric", month: "short", day: "numeric", hour:"numeric", minute:"numeric" }; +var shortOpt = { year: "numeric", month: "short", day: "numeric" }; var list = document.getElementsByClassName("date-short"); for(var i in list) { @@ -34,6 +34,13 @@ for(var i in list) { e.innerText = new Date(e.innerText).toLocaleString(lang); } +var list = document.getElementsByClassName("date-comments"); +for(var i in list) { + var e = list[i]; + e.title = e.innerText; + e.innerText = new Date(e.title).toLocaleDateString(lang, { year: "numeric", month: "short", day: "numeric"}) + " "; + $(e).append($('').text(new Date(e.title).toLocaleTimeString(lang, { hour:"numeric", minute:"numeric" }))) +} /*Fixed-Navbar offset fix*/ window.onload = function() { var shiftWindow = function() { scrollBy(0, -70) }; diff --git a/templates/view.html b/templates/view.html index 9674140e..8a7bf30f 100644 --- a/templates/view.html +++ b/templates/view.html @@ -131,23 +131,19 @@
-
-
- {{if eq .UserID -1}} - #{{inc $index}} by {{.Username}} - {{else}} - #{{inc $index}} - by {{.Username}} - {{end}} -
-
- - - {{ formatDateRFC .Date }} - {{/* JS will format the date as always */}} - - -
+ + + {{ formatDateRFC .Date }} + {{/* JS will format the date as always */}} + + +
+ {{if eq .UserID -1}} + #{{inc $index}} by {{.Username}} + {{else}} + #{{inc $index}} + by {{.Username}} + {{end}}