mirror of
https://github.com/thelounge/thelounge
synced 2024-11-10 22:54:15 +00:00
Show seconds in timestamp
This commit is contained in:
parent
691f628e48
commit
fd983a7f6b
5 changed files with 23 additions and 3 deletions
|
@ -901,8 +901,7 @@ kbd {
|
|||
|
||||
#chat .time {
|
||||
color: #ddd;
|
||||
text-align: right;
|
||||
width: 46px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#chat .from {
|
||||
|
|
|
@ -249,6 +249,12 @@
|
|||
Show quits
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="opt">
|
||||
<input type="checkbox" name="showSeconds">
|
||||
Show seconds in timestamp
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<h2>Visual Aids</h2>
|
||||
</div>
|
||||
|
|
|
@ -54,7 +54,13 @@ const commands = [
|
|||
"/whois"
|
||||
];
|
||||
|
||||
const timeFormats = {
|
||||
msgDefault: "HH:mm",
|
||||
msgWithSeconds: "HH:mm:ss"
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
colorCodeMap: colorCodeMap,
|
||||
timeFormats: timeFormats,
|
||||
commands: commands
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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(),
|
||||
|
@ -80,6 +82,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");
|
||||
|
|
Loading…
Reference in a new issue