From 72ba0201e5741bed4ae1d51ce156956b2ed2ec28 Mon Sep 17 00:00:00 2001 From: Ben Holden-Crowther Date: Wed, 23 Aug 2017 17:38:19 +0100 Subject: [PATCH 1/3] Update license date to 2017 --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 9ad5621f..30b4fcb6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013-2015 Miguel Freitas, Lucas Leal and twister project developers. +Copyright (c) 2013-2017 Miguel Freitas, Lucas Leal and twister project developers. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From d1f7f65373d0a3e9c471df67c31c2b318a6e1192 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sun, 14 Jan 2018 01:19:45 +0500 Subject: [PATCH 2/3] add localized timestamps --- js/interface_common.js | 27 ++++++++++++++++++++++++++- js/options.js | 6 ++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/js/interface_common.js b/js/interface_common.js index d2ea20c7..03476590 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -19,6 +19,11 @@ var twister = { modal: {}, res: {}, // reses for various reqs are cached here var: { + dateFormatter: { + format: function (req) { + return req.toString().replace(/GMT.*/g, ''); + } + }, localAccounts: [], updatesCheckClient: {} } @@ -406,7 +411,26 @@ function timeGmtToText(t) { if (t == 0) return '-'; var d = new Date(0); d.setUTCSeconds(t); - return d.toString().replace(/GMT.*/g, ''); + return twister.var.dateFormatter.format(d); +} + +function setupTimeGmtToText(lang) { + if (typeof window.Intl !== 'object' || typeof window.Intl.DateTimeFormat !== 'function') + return; + + twister.var.dateFormatter = new Intl.DateTimeFormat( + knownLanguages.indexOf(lang) !== -1 ? lang : undefined, + { + hour12: false, + weekday: 'short', + year: 'numeric', + month: 'short', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + second: 'numeric' + } + ); } function timeSincePost(t) { @@ -2889,6 +2913,7 @@ function setTextcompleteDropdownListPos(position) { } $(document).ready(function () { + setupTimeGmtToText($.Options.locLang.val); if ($.localStorage.isSet('twistaURIs')) twister.URIs = $.localStorage.get('twistaURIs'); twister.html.blanka.appendTo('body').hide(); diff --git a/js/options.js b/js/options.js index 0eac0a14..f36c5622 100644 --- a/js/options.js +++ b/js/options.js @@ -7,6 +7,12 @@ function twisterOptions() { if (elem.value !== 'auto') twisterRpc('setpreferredspamlang', [elem.value]); location.reload(); + /* + if (elem.value !== 'auto') { + setupTimeGmtToText(elem.value); + TODO redraw all timestamps + } + */ }, tickNotOnInit: 1 }); From 80fb930ce10494c51e7b745c626ea25d278227f3 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sun, 14 Jan 2018 01:31:36 +0500 Subject: [PATCH 3/3] update license date --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 30b4fcb6..29e785e0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013-2017 Miguel Freitas, Lucas Leal and twister project developers. +Copyright (c) 2013-2018 Miguel Freitas, Lucas Leal and twister project developers. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal