From 978ceeb590c385945643e195d273f19c9df248aa Mon Sep 17 00:00:00 2001 From: aleth Date: Thu, 4 Dec 2014 10:00:28 +0100 Subject: [PATCH] Bug 955312 - Add date to message tooltips. r=clokep a=aleth on CLOSED TREE --HG-- extra : amend_source : 6008026fd86b9d13f405153063286cce501b29f9 --- chat/modules/imThemes.jsm | 12 ++++++++++++ im/themes/messages/bubbles/Incoming/Content.html | 2 +- im/themes/messages/bubbles/Incoming/Context.html | 2 +- im/themes/messages/bubbles/Incoming/NextContent.html | 2 +- im/themes/messages/dark/Incoming/Content.html | 2 +- im/themes/messages/dark/Incoming/Context.html | 2 +- im/themes/messages/dark/Incoming/NextContent.html | 2 +- im/themes/messages/dark/Incoming/NextContext.html | 2 +- im/themes/messages/papersheets/Incoming/Content.html | 2 +- im/themes/messages/papersheets/Incoming/Context.html | 2 +- .../messages/papersheets/Incoming/NextContent.html | 2 +- mail/components/im/messages/Incoming/Content.html | 2 +- mail/components/im/messages/Incoming/Context.html | 2 +- .../components/im/messages/Incoming/NextContent.html | 2 +- 14 files changed, 25 insertions(+), 13 deletions(-) diff --git a/chat/modules/imThemes.jsm b/chat/modules/imThemes.jsm index 8f97f72e0f..fdaba6dd7e 100644 --- a/chat/modules/imThemes.jsm +++ b/chat/modules/imThemes.jsm @@ -41,6 +41,10 @@ XPCOMUtils.defineLazyGetter(this, "TXTToHTML", function() { return function(aTXT) cs.scanTXT(aTXT, cs.kEntities); }); +XPCOMUtils.defineLazyServiceGetter(this, "ScriptableDateFormat", + "@mozilla.org/intl/scriptabledateformat;1", + "nsIScriptableDateFormat"); + var gCurrentTheme = null; function getChromeFile(aURI) @@ -353,6 +357,14 @@ const statusMessageReplacements = { }, timestamp: function(aMsg) aMsg.time, shortTime: function(aMsg) (new Date(aMsg.time * 1000)).toLocaleTimeString(), + datetime: function(aMsg) { + let date = new Date(aMsg.time * 1000); + let sdf = ScriptableDateFormat; + return sdf.FormatDateTime("", sdf.dateFormatShort, + sdf.timeFormatNoSeconds, date.getFullYear(), + date.getMonth() + 1, date.getDate(), + date.getHours(), date.getMinutes(), 0); + }, messageClasses: function(aMsg) { let msgClass = []; diff --git a/im/themes/messages/bubbles/Incoming/Content.html b/im/themes/messages/bubbles/Incoming/Content.html index f6d1e7649a..c330c9964e 100644 --- a/im/themes/messages/bubbles/Incoming/Content.html +++ b/im/themes/messages/bubbles/Incoming/Content.html @@ -1,7 +1,7 @@

%sender% - %time{%H:%M}%

-

%message%

+

%message%

diff --git a/im/themes/messages/bubbles/Incoming/Context.html b/im/themes/messages/bubbles/Incoming/Context.html index 3d15c1d214..c542d42e84 100644 --- a/im/themes/messages/bubbles/Incoming/Context.html +++ b/im/themes/messages/bubbles/Incoming/Context.html @@ -1,7 +1,7 @@

%sender% - %time{%H:%M}%

-

%message%

+

%message%

diff --git a/im/themes/messages/bubbles/Incoming/NextContent.html b/im/themes/messages/bubbles/Incoming/NextContent.html index 693ff3802a..203072c27d 100644 --- a/im/themes/messages/bubbles/Incoming/NextContent.html +++ b/im/themes/messages/bubbles/Incoming/NextContent.html @@ -1,3 +1,3 @@
-

%message%

+

%message%

diff --git a/im/themes/messages/dark/Incoming/Content.html b/im/themes/messages/dark/Incoming/Content.html index 58752c4a74..8eac5bed7f 100644 --- a/im/themes/messages/dark/Incoming/Content.html +++ b/im/themes/messages/dark/Incoming/Content.html @@ -1,2 +1,2 @@ -

%sender% %message%

+

%sender% %message%

diff --git a/im/themes/messages/dark/Incoming/Context.html b/im/themes/messages/dark/Incoming/Context.html index d14d3d86e2..995e7b4fed 100644 --- a/im/themes/messages/dark/Incoming/Context.html +++ b/im/themes/messages/dark/Incoming/Context.html @@ -1,2 +1,2 @@ -

%sender% %message%

+

%sender% %message%

diff --git a/im/themes/messages/dark/Incoming/NextContent.html b/im/themes/messages/dark/Incoming/NextContent.html index f0284ee2eb..5688a2e9e0 100644 --- a/im/themes/messages/dark/Incoming/NextContent.html +++ b/im/themes/messages/dark/Incoming/NextContent.html @@ -1,2 +1,2 @@ -

%message%

+

%message%

diff --git a/im/themes/messages/dark/Incoming/NextContext.html b/im/themes/messages/dark/Incoming/NextContext.html index 57da7c25ff..76dae6da6b 100644 --- a/im/themes/messages/dark/Incoming/NextContext.html +++ b/im/themes/messages/dark/Incoming/NextContext.html @@ -1,2 +1,2 @@ -

%message%

+

%message%

diff --git a/im/themes/messages/papersheets/Incoming/Content.html b/im/themes/messages/papersheets/Incoming/Content.html index 6c0af33b94..397eb65a22 100644 --- a/im/themes/messages/papersheets/Incoming/Content.html +++ b/im/themes/messages/papersheets/Incoming/Content.html @@ -1,4 +1,4 @@
-

%time% %sender% %message%

+

%time% %sender% %message%

diff --git a/im/themes/messages/papersheets/Incoming/Context.html b/im/themes/messages/papersheets/Incoming/Context.html index 247a9e5639..23f5f3a438 100644 --- a/im/themes/messages/papersheets/Incoming/Context.html +++ b/im/themes/messages/papersheets/Incoming/Context.html @@ -1,4 +1,4 @@
-

%time% %sender% %message%

+

%time% %sender% %message%

diff --git a/im/themes/messages/papersheets/Incoming/NextContent.html b/im/themes/messages/papersheets/Incoming/NextContent.html index 8bba392803..b3f531cf29 100644 --- a/im/themes/messages/papersheets/Incoming/NextContent.html +++ b/im/themes/messages/papersheets/Incoming/NextContent.html @@ -1,3 +1,3 @@
-

%time% %message%

+

%time% %message%

diff --git a/mail/components/im/messages/Incoming/Content.html b/mail/components/im/messages/Incoming/Content.html index a2b1793722..75273da9c9 100644 --- a/mail/components/im/messages/Incoming/Content.html +++ b/mail/components/im/messages/Incoming/Content.html @@ -1 +1 @@ -
%time%
%sender%
%message%
+
%time%
%sender%
%message%
diff --git a/mail/components/im/messages/Incoming/Context.html b/mail/components/im/messages/Incoming/Context.html index b4817c49e0..340f3c1f54 100644 --- a/mail/components/im/messages/Incoming/Context.html +++ b/mail/components/im/messages/Incoming/Context.html @@ -1 +1 @@ -
%time%
%sender%
%message%
+
%time%
%sender%
%message%
diff --git a/mail/components/im/messages/Incoming/NextContent.html b/mail/components/im/messages/Incoming/NextContent.html index bfb197d7b8..364a9bb001 100644 --- a/mail/components/im/messages/Incoming/NextContent.html +++ b/mail/components/im/messages/Incoming/NextContent.html @@ -1 +1 @@ -
%time%
%message%
+
%time%
%message%