diff --git a/client/css/style.css b/client/css/style.css index 9f731c39..65f3f206 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -901,8 +901,7 @@ kbd { #chat .time { color: #ddd; - text-align: right; - width: 46px; + padding-left: 10px; } #chat .from { diff --git a/client/index.html b/client/index.html index 8d1cbcc1..4692d921 100644 --- a/client/index.html +++ b/client/index.html @@ -249,6 +249,12 @@ Show quits +
+ +

Visual Aids

diff --git a/client/js/constants.js b/client/js/constants.js index 5c5811fd..c001cbaf 100644 --- a/client/js/constants.js +++ b/client/js/constants.js @@ -54,7 +54,13 @@ const commands = [ "/whois" ]; +const timeFormats = { + msgDefault: "HH:mm", + msgWithSeconds: "HH:mm:ss" +}; + module.exports = { colorCodeMap: colorCodeMap, + timeFormats: timeFormats, commands: commands }; diff --git a/client/js/libs/handlebars/tz.js b/client/js/libs/handlebars/tz.js index 77feaaff..2e807d52 100644 --- a/client/js/libs/handlebars/tz.js +++ b/client/js/libs/handlebars/tz.js @@ -1,7 +1,10 @@ "use strict"; const moment = require("moment"); +const constants = require("../../constants"); module.exports = function(time) { - return moment(time).format("HH:mm"); + const options = require("../../options"); + const format = options.showSeconds ? constants.timeFormats.msgWithSeconds : constants.timeFormats.msgDefault; + return moment(time).format(format); }; diff --git a/client/js/options.js b/client/js/options.js index 81f81e2b..cbc79653 100644 --- a/client/js/options.js +++ b/client/js/options.js @@ -3,6 +3,7 @@ const $ = require("jquery"); const settings = $("#settings"); const userStyles = $("#user-specified-css"); const storage = require("./localStorage"); +const tz = require("./libs/handlebars/tz"); const windows = $("#windows"); const chat = $("#chat"); @@ -19,6 +20,7 @@ const options = $.extend({ notifyAllMessages: false, part: true, quit: true, + showSeconds: false, theme: $("#theme").attr("href").replace(/^themes\/(.*).css$/, "$1"), // Extracts default theme name, set on the server configuration thumbnails: true, userStyles: userStyles.text(), @@ -83,6 +85,10 @@ settings.on("change", "input, select, textarea", function() { // otherwise, users get notifications for everything return h !== ""; }); + } else if (name === "showSeconds") { + chat.find(".msg > .time").each(function() { + $(this).text(tz($(this).parent().data("time"))); + }); } }).find("input") .trigger("change");