Bug 1519799 - Improve the default message style UI and show the OTR encryption status of individual messages. r=clokep

This commit is contained in:
Alessandro Castellani 2020-04-18 13:47:26 +03:00
Родитель f1a5b8b3e7
Коммит 947382a8dc
20 изменённых файлов: 145 добавлений и 139 удалений

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

@ -67,6 +67,8 @@ interface prplIMessage: nsISupports {
readonly attribute boolean noLinkification; readonly attribute boolean noLinkification;
/* Do not collapse the message. */ /* Do not collapse the message. */
readonly attribute boolean noCollapse; readonly attribute boolean noCollapse;
/* Message is encrypted */
readonly attribute boolean isEncrypted;
/** /**
* Get an array of actions the user may perform on this message. * Get an array of actions the user may perform on this message.

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

@ -117,6 +117,9 @@ imMessage.prototype = {
get noCollapse() { get noCollapse() {
return this.prplMessage.noCollapse; return this.prplMessage.noCollapse;
}, },
get isEncrypted() {
return this.prplMessage.isEncrypted;
},
get originalMessage() { get originalMessage() {
return this.prplMessage.originalMessage; return this.prplMessage.originalMessage;
}, },

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

@ -330,6 +330,7 @@ LogWriter.prototype = {
"containsImages", "containsImages",
"notification", "notification",
"noLinkification", "noLinkification",
"isEncrypted",
].filter(f => aMessage[f]), ].filter(f => aMessage[f]),
}; };
let alias = aMessage.alias; let alias = aMessage.alias;

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

@ -78,3 +78,8 @@ messenger.conversations.selections.ellipsis=[…]
messenger.conversations.selections.systemMessagesTemplate=%time% - %message% messenger.conversations.selections.systemMessagesTemplate=%time% - %message%
messenger.conversations.selections.contentMessagesTemplate=%time% - %sender%: %message% messenger.conversations.selections.contentMessagesTemplate=%time% - %sender%: %message%
messenger.conversations.selections.actionMessagesTemplate=%time% * %sender% %message% messenger.conversations.selections.actionMessagesTemplate=%time% * %sender% %message%
# LOCALIZATION NOTE (message.status):
# This is used as title attribute for the visible lock icon in case a message
# was sent encrypted through the OTR protocol.
message.status=Message encrypted

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

@ -51,6 +51,10 @@ XPCOMUtils.defineLazyGetter(this, "gTimeFormatter", () => {
}); });
}); });
XPCOMUtils.defineLazyGetter(this, "bundle", () =>
Services.strings.createBundle("chrome://chat/locale/conversations.properties")
);
ChromeUtils.defineModuleGetter( ChromeUtils.defineModuleGetter(
this, this,
"ToLocaleFormat", "ToLocaleFormat",
@ -480,6 +484,12 @@ var statusMessageReplacements = {
return msgClass.join(" "); return msgClass.join(" ");
}, },
encryptedClass(aMsg) {
return aMsg.encrypted ? "show" : "";
},
encryptedMessage(aMsg) {
return bundle.GetStringFromName("message.status");
},
}; };
function formatSender(aName) { function formatSender(aName) {

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

@ -594,6 +594,7 @@ var GenericMessagePrototype = {
notification: false, notification: false,
noLinkification: false, noLinkification: false,
noCollapse: false, noCollapse: false,
isEncrypted: false,
getActions() { getActions() {
return []; return [];

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

@ -8,7 +8,7 @@
} }
.ib-img-smile { .ib-img-smile {
vertical-align: text-bottom; vertical-align: middle;
} }
*:any-link .ib-img-smile { *:any-link .ib-img-smile {

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

@ -25,10 +25,6 @@ messenger.jar:
content/messenger/chat/chat-conversation-info.js (content/chat-conversation-info.js) content/messenger/chat/chat-conversation-info.js (content/chat-conversation-info.js)
content/messenger/chat/toolbarbutton-badge-button.js (content/toolbarbutton-badge-button.js) content/messenger/chat/toolbarbutton-badge-button.js (content/toolbarbutton-badge-button.js)
% skin messenger-messagestyles classic/1.0 %skin/classic/messenger/messages/ % skin messenger-messagestyles classic/1.0 %skin/classic/messenger/messages/
skin/classic/messenger/messages/mail/Bitmaps/minus-hover.png (messages/mail/Bitmaps/minus-hover.png)
skin/classic/messenger/messages/mail/Bitmaps/minus.png (messages/mail/Bitmaps/minus.png)
skin/classic/messenger/messages/mail/Bitmaps/plus-hover.png (messages/mail/Bitmaps/plus-hover.png)
skin/classic/messenger/messages/mail/Bitmaps/plus.png (messages/mail/Bitmaps/plus.png)
skin/classic/messenger/messages/mail/Footer.html (messages/mail/Footer.html) skin/classic/messenger/messages/mail/Footer.html (messages/mail/Footer.html)
skin/classic/messenger/messages/mail/Incoming/buddy_icon.png (messages/mail/Incoming/buddy_icon.png) skin/classic/messenger/messages/mail/Incoming/buddy_icon.png (messages/mail/Incoming/buddy_icon.png)
skin/classic/messenger/messages/mail/Outgoing/buddy_icon.png (messages/mail/Incoming/buddy_icon.png) skin/classic/messenger/messages/mail/Outgoing/buddy_icon.png (messages/mail/Incoming/buddy_icon.png)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 620 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 619 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 615 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 614 B

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

@ -3,33 +3,32 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<script> <script>
function checkNewText(target) {
function checkNewText(target) { if (target.className == "event-row") {
if (target.tagName == "P" && target.className == "event") { let parent = target.closest(".event");
let parent = target.parentNode; // We need to start a group with this element if there are at least 4
// We need to start a group with this element if there are at least 4 // system messages and they aren't already grouped.
// system messages and they aren't already grouped. if (!parent.grouped && parent.querySelector(".event-row:nth-of-type(4)")) {
if (!parent.grouped && parent.querySelector("p.event:nth-of-type(4)")) { let toggle = document.createElement("div");
var p = document.createElement("p"); toggle.className = "eventToggle";
p.className = "eventToggle"; toggle.addEventListener("click", event => {
p.addEventListener("click", event => toggle.closest(".event").classList.toggle("hide-children");
event.target.parentNode.classList.toggle("hide-children")); });
parent.insertBefore(p, parent.querySelector("p.event:nth-of-type(2)")); parent.insertBefore(toggle, parent.querySelector(".event-row:nth-of-type(2)"));
parent.classList.add("hide-children"); parent.classList.add("hide-children");
parent.grouped = true; parent.grouped = true;
}
}
}
new MutationObserver(function(aMutations) {
for (let mutation of aMutations) {
for (let node of mutation.addedNodes) {
if (node instanceof HTMLElement) {
checkNewText(node);
} }
} }
} }
}).observe(document.getElementById("ibcontent"),
{childList: true, subtree: true});
new MutationObserver(function(aMutations) {
for (let mutation of aMutations) {
for (let node of mutation.addedNodes) {
if (node instanceof HTMLElement) {
checkNewText(node);
}
}
}
}).observe(document.getElementById("ibcontent"),
{childList: true, subtree: true});
</script> </script>

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

@ -1 +1 @@
<div class="%messageClasses%" data-prpl="%service%"><img src="%userIconPath%" class="usericon"/><div class="date">%time%</div><div class="pseudo" style="%senderColor%">%sender%</div>%message%</div> <div class="%messageClasses%" data-prpl="%service%"><div class="sidebar"><img src="%userIconPath%" class="usericon"/><label title="%encryptedMessage%" class="encrypted %encryptedClass%"></label><div class="date">%time{%H:%M}%</div></div><div class="body"><div class="pseudo" style="%senderColor%">%sender%</div>%message%</div></div>

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

@ -1 +1 @@
<div class="context %messageClasses%" data-prpl="%service%"><img src="%userIconPath%" class="usericon"/><div class="date">%time%</div><div class="pseudo" style="%senderColor%">%sender%</div>%message%</div> <div class="context %messageClasses%" data-prpl="%service%"><div class="sidebar"><img src="%userIconPath%" class="usericon"/><div class="date">%time{%H:%M}%</div></div><div class="body"><div class="pseudo" style="%senderColor%">%sender%</div>%message%</div></div>

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

@ -1 +1 @@
<div class="%messageClasses%" data-prpl="%service%"><img src="%userIconPath%" class="usericon"/><div class="date">%time%</div><div class="pseudo next" style="%senderColor%">%sender%</div>%message%</div> <div class="%messageClasses%" data-prpl="%service%"><div class="sidebar"><label title="%encryptedMessage%" class="encrypted %encryptedClass%"></label><div class="date">%time{%H:%M}%</div></div><div class="body">%message%</div></div>

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

@ -1,2 +1 @@
<p class="%messageClasses%"><span class="date">%time%</span>%message%</p> <div class="event-row"><div class="sidebar"><div class="date">%time{%H:%M}%</div></div><div class="body"><p class="event-paragraph">%message%</p></div></div><span id="insert"/>
<div id="insert"/>

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

@ -1,4 +1 @@
<div class="%messageClasses%"> <div aria-live="polite" class="%messageClasses%"><div class="event-row"><div class="sidebar"><div class="date">%time{%H:%M}%</div></div><div class="body"><p class="event-paragraph">%message%</p></div></div><span id="insert"/></div>
<p aria-live="polite" class="%messageClasses%"><span class="date">%time%</span>%message%</p>
<div id="insert"/>
</div>

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

@ -7,31 +7,73 @@
} }
/* The "#chat " is required to override "#Chat *" from conv.css */ /* The "#chat " is required to override "#Chat *" from conv.css */
#Chat .pseudo {
overflow-x: hidden !important;
}
.message { .message {
clear: both; display: flex;
align-items: flex-start;
margin-block: 5px;
padding: 5px 6px;
border-radius: 4px;
}
#Chat .event {
display: flex;
flex-direction: column;
margin-left: 0;
clear: none;
padding-inline: 6px;
}
.event-row {
display: flex;
align-items: start;
}
#Chat .event p {
margin: 0;
margin-block-end: 5px;
color: GrayText;
}
#Chat #unread-ruler {
margin: 4px;
border-top: 1px solid #30e60b;
}
.message:hover,
.message:focus {
background-color: rgba(0, 0, 0, 0.03);
}
.sidebar {
display: flex;
justify-content: end;
margin-inline-end: 10px;
margin-block-start: 2px;
width: 4.5em;
flex-wrap: wrap;
text-align: right;
}
.body {
display: flex;
flex-direction: column;
flex: 1;
} }
.pseudo { .pseudo {
font-size: 0.9em;
font-weight: bold; font-weight: bold;
float: inline-start; letter-spacing: 0.01em;
width: calc(15% - 3px); margin-block-end: 0;
text-align: right;
padding-bottom: 5px;
display: block;
text-overflow: ellipsis;
white-space: nowrap;
} }
.outgoing > .pseudo { .outgoing .pseudo {
color: rgb(80, 80, 200); color: #0060DF;
} }
.incoming > .pseudo { .incoming .pseudo {
color: rgb(200, 80, 80); color: #B5007F;
} }
.message:not(.action) > .next { .message:not(.action) > .next {
@ -39,32 +81,37 @@
} }
.date { .date {
font-size: 0.75em;
text-transform: uppercase;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
float: inline-end;
color: GrayText; color: GrayText;
white-space: nowrap;
} }
.message > .ib-msg-txt, .encrypted {
.event { display: none;
display: block; width: 11px;
margin-left: 15%; height: 11px;
padding-bottom: 5px; opacity: 0.35;
background: url("chrome://messenger/skin/icons/connection-secure.svg") no-repeat center;
background-size: contain;
margin-top: 1px;
margin-inline-end: 2px;
} }
p.event { .encrypted:hover {
margin-left: 0; opacity: 0.75;
}
.encrypted.show {
display: inline-block;
} }
.usericon { .usericon {
display: none; display: none;
} }
.event {
color: GrayText;
clear: both;
}
.nick { .nick {
font-weight: bold; font-weight: bold;
} }
@ -85,10 +132,6 @@ p.event {
opacity: 0.7; opacity: 0.7;
} }
p {
margin: 0px auto;
}
p *:any-link img { p *:any-link img {
margin-bottom: 1px; margin-bottom: 1px;
border-bottom: solid 1px; border-bottom: solid 1px;
@ -98,86 +141,44 @@ p *:any-link img {
margin: 8px 0 12px; margin: 8px 0 12px;
width: 100%; width: 100%;
border: none; border: none;
border-top: 1px dashed GrayText; border-top: 1px solid ThreeDDarkShadow;
} }
/* used by javascript */ /* used by javascript */
.eventToggle { .eventToggle {
cursor: pointer; background: url("chrome://global/skin/icons/twisty-expanded.svg") no-repeat left center;
min-height: 22px;
margin-inline-start: -20px;
padding-inline-start: 20px;
background: url('Bitmaps/minus.png') no-repeat left center;
margin-bottom: -22px; margin-bottom: -22px;
width: 0px; cursor: pointer;
height: 22px;
width: 20px;
z-index: 1;
opacity: 0.5;
} }
.eventToggle:hover { .eventToggle:hover {
background: url('Bitmaps/minus-hover.png') no-repeat left center; opacity: 1;
} }
.hide-children > .eventToggle { .hide-children > :-moz-any(p.event.row, hr):not(:first-of-type):not(:last-of-type):not(.no-collapse) {
width: 100%;
margin-bottom: -5px;
background-image: url('Bitmaps/plus.png');
}
.hide-children > .eventToggle:hover {
background-image: url('Bitmaps/plus-hover.png');
}
.hide-children > .eventToggle:after {
content: "\2026"; /* &hellip; */
color: GrayText;
}
.hide-children > :-moz-any(p.event, hr):not(:first-of-type):not(:last-of-type):not(.no-collapse) {
display: none; display: none;
} }
/* We style Twitter differently from other types of chat */ /* We style Twitter differently from other types of chat */
.message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) { .message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) {
background-color: hsl(0, 0%, 99%); background-color: rgba(69, 161, 255, 0.1);
border-radius: 5px; border: 1px solid #45a1ff;
border: 1px solid hsl(0, 0%, 85%); margin-bottom: 10px;
min-height: 48px;
padding: 6px;
margin-left: 0px;
margin-bottom: 6px;
} }
.message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) > .pseudo { .message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) .next {
float: none;
text-align: left;
display: block;
width: auto;
padding-left: 64px;
}
.message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) > .next {
visibility: visible; visibility: visible;
} }
.message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) > .ib-msg-txt { .message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) .usericon {
margin-left: 0px;
padding-left: 64px;
}
.message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) > .usericon {
position: absolute;
display: block; display: block;
max-width: 48px; max-width: 42px;
max-height: 48px; max-height: 42px;
margin-right: 6px; border-radius: 9999px;
border-radius: 5px; margin-block-end: 8px;
}
.message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) ~ .event {
margin-left: 71px;
}
.message:-moz-any([data-prpl="Twitter"], [data-prpl="twitter"]) ~ .event > .date {
margin-right: 7px;
} }

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

@ -22,14 +22,6 @@ chrome/messenger/content/messenger/extension.svg
chrome/messenger/skin/classic/messenger/messages/simple/Variants/Normal.css chrome/messenger/skin/classic/messenger/messages/simple/Variants/Normal.css
chrome/messenger/skin/classic/messenger/messages/simple/Incoming/Context.html chrome/messenger/skin/classic/messenger/messages/simple/Incoming/Context.html
chrome/messenger/skin/classic/messenger/messages/simple/Incoming/NextContext.html chrome/messenger/skin/classic/messenger/messages/simple/Incoming/NextContext.html
chrome/messenger/skin/classic/messenger/messages/bubbles/Bitmaps/plus.png
chrome/messenger/skin/classic/messenger/messages/mail/Bitmaps/plus.png
chrome/messenger/skin/classic/messenger/messages/bubbles/Bitmaps/plus-hover.png
chrome/messenger/skin/classic/messenger/messages/mail/Bitmaps/plus-hover.png
chrome/messenger/skin/classic/messenger/messages/bubbles/Bitmaps/minus.png
chrome/messenger/skin/classic/messenger/messages/mail/Bitmaps/minus.png
chrome/messenger/skin/classic/messenger/messages/bubbles/Bitmaps/minus-hover.png
chrome/messenger/skin/classic/messenger/messages/mail/Bitmaps/minus-hover.png
chrome/messenger/skin/classic/messenger/messages/mail/Incoming/buddy_icon.png chrome/messenger/skin/classic/messenger/messages/mail/Incoming/buddy_icon.png
chrome/messenger/skin/classic/messenger/messages/mail/Outgoing/buddy_icon.png chrome/messenger/skin/classic/messenger/messages/mail/Outgoing/buddy_icon.png
chrome/devtools/modules/devtools/client/themes/splitters.css chrome/devtools/modules/devtools/client/themes/splitters.css