Selaa lähdekoodia

Make the `:last-child` selector more specific

otherwise deeper leaf-nodes get returned
JC Brand 7 vuotta sitten
vanhempi
commit
3cf7fefaa8
4 muutettua tiedostoa jossa 5 lisäystä ja 5 poistoa
  1. 1 1
      src/converse-muc.js
  2. 1 1
      src/templates/info.html
  3. 1 1
      src/templates/message.html
  4. 2 2
      src/utils.js

+ 1 - 1
src/converse-muc.js

@@ -1827,7 +1827,7 @@
                 displayJoinNotification (stanza) {
                     const nick = Strophe.getResourceFromJid(stanza.getAttribute('from'));
                     const stat = stanza.querySelector('status');
-                    const last_el = this.content.querySelector(':last-child');
+                    const last_el = this.content.querySelector('.message:last-child');
                     if (_.includes(_.get(last_el, 'classList', []), 'chat-info') &&
                             _.get(last_el, 'dataset', {}).leave === `"${nick}"`) {
                         last_el.outerHTML = 

+ 1 - 1
src/templates/info.html

@@ -1 +1 @@
-<div class="chat-info" {{{o.data}}}>{{{o.message}}}</div>
+<div class="message chat-info" {{{o.data}}}>{{{o.message}}}</div>

+ 1 - 1
src/templates/message.html

@@ -1,4 +1,4 @@
-<div class="chat-message {{{o.extra_classes}}}" data-isodate="{{{o.isodate}}}" data-msgid="{{{o.msgid}}}">
+<div class="message chat-message {{{o.extra_classes}}}" data-isodate="{{{o.isodate}}}" data-msgid="{{{o.msgid}}}">
     <span class="chat-msg-author chat-msg-{{{o.sender}}}">{{{o.time}}} {{{o.username}}}:&nbsp;</span>
     <span class="chat-msg-content"><!-- message gets added here via renderMessage --></span>
 </div>

+ 2 - 2
src/utils.js

@@ -169,7 +169,7 @@
         return _.includes(el.classList, className);
     };
 
-    u.slideOut = function (el, duration=250) {
+    u.slideOut = function (el, duration=200) {
         /* Shows/expands an element by sliding it out of itself
          *
          * Parameters:
@@ -233,7 +233,7 @@
         });
     };
 
-    u.slideIn = function (el, duration=250) {
+    u.slideIn = function (el, duration=200) {
         /* Hides/collapses an element by sliding it into itself. */
         return new Promise((resolve, reject) => {
             if (_.isNil(el)) {