Added support for like badge in .messageStatus
authorAlexander Ebert <ebert@woltlab.com>
Mon, 8 Feb 2016 12:37:15 +0000 (13:37 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 8 Feb 2016 12:37:15 +0000 (13:37 +0100)
wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js

index 81ac286b047b91eba515cb30a831cc3906b10e6f..d0d8d09e49b1d6bebcf3a578f2c7910ec2c07a86 100644 (file)
@@ -141,14 +141,22 @@ define(
                        }
                        
                        // cumulative likes
-                       var badge, badgeContainer = elBySel(this._options.badgeContainerSelector, element);
+                       var badge, badgeContainer = elBySel(this._options.badgeContainerSelector, element), listItem;
                        if (badgeContainer !== null) {
                                badge = elCreate('a');
                                badge.href = '#';
                                badge.className = 'wcfLikeCounter jsTooltip' + (this._options.badgeClassNames ? ' ' + this._options.badgeClassNames : '');
                                badge.addEventListener('click', this._showSummary.bind(this, element));
                                
-                               badgeContainer.appendChild(badge);
+                               if (badgeContainer.nodeName === 'OL' || badgeContainer.nodeName === 'UL') {
+                                       listItem = elCreate('li');
+                                       listItem.appendChild(badge);
+                                       badgeContainer.appendChild(listItem);
+                               }
+                               else {
+                                       badgeContainer.appendChild(badge);
+                               }
+                               
                                elementData.badge = badge;
                                
                                this._updateBadge(element);