Bug 955312 - Add date to message tooltips: Don't show the date on today's messages and use imTooltip instead of message style replacements. r=florian a=aleth

This commit is contained in:
aleth 2014-12-05 22:50:31 +01:00
Родитель a866506fb9
Коммит 924830cd08
17 изменённых файлов: 46 добавлений и 28 удалений

Просмотреть файл

@ -456,6 +456,32 @@
return updateTooltipFromConversation(conv);
}
// Are we over a message?
for (let node = elt; node; node = node.parentNode) {
if (!node._originalMsg)
continue;
// It's a message, so add a date/time tooltip.
let date = new Date(node._originalMsg.time * 1000);
let text;
if ((new Date()).toDateString() == date.toDateString()) {
text = date.toLocaleTimeString();
}
else {
let sdf =
Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
.getService(Ci.nsIScriptableDateFormat);
text = sdf.FormatDateTime("", sdf.dateFormatShort,
sdf.timeFormatSeconds, date.getFullYear(),
date.getMonth() + 1, date.getDate(),
date.getHours(), date.getMinutes(), date.getSeconds());
}
// Setting the attribute on this node means that if the element
// we are pointing at carries a title set by the prpl,
// that title won't be overridden.
node.setAttribute("title", text);
break;
}
// Use the default content tooltip.
largeTooltip.hidden = true;
return fillInPageTooltip(elt);

Просмотреть файл

@ -41,10 +41,6 @@ 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)
@ -357,14 +353,6 @@ 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 = [];

Просмотреть файл

@ -5,3 +5,7 @@
#findbar .findbar-closebutton {
display: none;
}
tooltip[type="im"] {
-moz-binding: url("chrome://chat/content/imtooltip.xml#tooltip");
}

Просмотреть файл

@ -86,7 +86,7 @@
</stringbundleset>
<popupset id="mainPopupSet">
<tooltip id="aHTMLTooltip" page="true"/>
<tooltip id="imTooltip" type="im"/>
<menupopup id="contentAreaContextMenu">
<menuitem id="context-copy"
label="&copyCmd.label;"
@ -113,11 +113,11 @@
<vbox flex="1">
<deck flex="1" id="browserDeck" selectedIndex="0">
<browser id="text-browser" type="content"
context="contentAreaContextMenu" tooltip="aHTMLTooltip"
context="contentAreaContextMenu" tooltip="imTooltip"
disablehistory="true" src="about:blank" flex="1"/>
<vbox flex="1">
<browser id="conv-browser" type="content-conversation" flex="1"
context="contentAreaContextMenu" tooltip="aHTMLTooltip"/>
context="contentAreaContextMenu" tooltip="imTooltip"/>
<progressmeter id="browserProgress" hidden="true"/>
</vbox>
<vbox flex="1" id="corruptLogScreen" align="center" pack="center">

Просмотреть файл

@ -1,7 +1,7 @@
<div class="bubble %messageClasses%" senderColor="%senderColor%">
<div class="indicator">
<p class="pseudo">%sender%<span class="time"> - %time{%H:%M}%</span></p>
<p class="%messageClasses%" title="%datetime%">%message%</p>
<p class="%messageClasses%">%message%</p>
<div id="insert"></div>
</div>
</div>

Просмотреть файл

@ -1,7 +1,7 @@
<div class="bubble context %messageClasses%" senderColor="%senderColor%">
<div class="indicator">
<p class="pseudo">%sender%<span class="time"> - %time{%H:%M}%</span></p>
<p class="%messageClasses%" title="%datetime%">%message%</p>
<p class="%messageClasses%">%message%</p>
<div id="insert"></div>
</div>
</div>

Просмотреть файл

@ -1,3 +1,3 @@
<hr/>
<p class="%messageClasses%" title="%datetime%">%message%</p>
<p class="%messageClasses%">%message%</p>
<div id="insert"></div>

Просмотреть файл

@ -1,2 +1,2 @@
<p class="%messageClasses%" title="%datetime%" senderColor="%senderColor%"><span class="pseudo">%sender%</span> <span class="message-style">%message%</span></p>
<p class="%messageClasses%" senderColor="%senderColor%"><span class="pseudo">%sender%</span> <span class="message-style">%message%</span></p>
<div id="insert"/>

Просмотреть файл

@ -1,2 +1,2 @@
<p class="context %messageClasses%" title="%datetime%" senderColor="%senderColor%"><span class="pseudo">%sender%</span> <span class="message-style">%message%</span></p>
<p class="context %messageClasses%" senderColor="%senderColor%"><span class="pseudo">%sender%</span> <span class="message-style">%message%</span></p>
<div id="insert"/>

Просмотреть файл

@ -1,2 +1,2 @@
<p class="%messageClasses%" title="%datetime%" senderColor="%senderColor%"><span class="message-style">%message%</span></p>
<p class="%messageClasses%" senderColor="%senderColor%"><span class="message-style">%message%</span></p>
<div id="insert"/>

Просмотреть файл

@ -1,2 +1,2 @@
<p class="context %messageClasses%" title="%datetime%" senderColor="%senderColor%"><span class="message-style">%message%</span></p>
<p class="context %messageClasses%" senderColor="%senderColor%"><span class="message-style">%message%</span></p>
<div id="insert"/>

Просмотреть файл

@ -1,4 +1,4 @@
<div class="messages-group %messageClasses%" senderColor="%senderColor%">
<p class="%messageClasses%" title="%datetime%"><span class="date">%time%</span> <span class="pseudo" style="%senderColor%">%sender%</span> <span class="message-style">%message%</span></p>
<p class="%messageClasses%"><span class="date">%time%</span> <span class="pseudo" style="%senderColor%">%sender%</span> <span class="message-style">%message%</span></p>
<div id="insert"/>
</div>

Просмотреть файл

@ -1,4 +1,4 @@
<div class="messages-group context %messageClasses%" senderColor="%senderColor%">
<p class="%messageClasses%" title="%datetime%"><span class="date">%time%</span> <span class="pseudo" style="%senderColor%">%sender%</span> <span class="message-style">%message%</span></p>
<p class="%messageClasses%"><span class="date">%time%</span> <span class="pseudo" style="%senderColor%">%sender%</span> <span class="message-style">%message%</span></p>
<div id="insert"/>
</div>

Просмотреть файл

@ -1,3 +1,3 @@
<hr/>
<p class="%messageClasses%" title="%datetime%"><span class="date date-next">%time%</span> <span class="message-style">%message%</span></p>
<p class="%messageClasses%"><span class="date date-next">%time%</span> <span class="message-style">%message%</span></p>
<div id="insert"/>

Просмотреть файл

@ -1 +1 @@
<div class="%messageClasses%" prpl="%service%" title="%date%"><img src="%userIconPath%" class="usericon"/><div class="date">%time%</div><div class="pseudo" style="%senderColor%">%sender%</div>%message%</div>
<div class="%messageClasses%" prpl="%service%"><img src="%userIconPath%" class="usericon"/><div class="date">%time%</div><div class="pseudo" style="%senderColor%">%sender%</div>%message%</div>

Просмотреть файл

@ -1 +1 @@
<div class="context %messageClasses%" prpl="%service%" title="%date%"><img src="%userIconPath%" class="usericon"/><div class="date">%time%</div><div class="pseudo" style="%senderColor%">%sender%</div>%message%</div>
<div class="context %messageClasses%" prpl="%service%"><img src="%userIconPath%" class="usericon"/><div class="date">%time%</div><div class="pseudo" style="%senderColor%">%sender%</div>%message%</div>

Просмотреть файл

@ -1 +1 @@
<div class="%messageClasses%" prpl="%service%" title="%date%"><img src="%userIconPath%" class="usericon"/><div class="date">%time%</div><div class="pseudo next" style="%senderColor%">%sender%</div>%message%</div>
<div class="%messageClasses%" prpl="%service%"><img src="%userIconPath%" class="usericon"/><div class="date">%time%</div><div class="pseudo next" style="%senderColor%">%sender%</div>%message%</div>