From 624dbe42457659128d16c1363aa8b65c7435a741 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 27 Nov 2014 16:13:37 +0100 Subject: [PATCH] Added a visual separator for new notifications --- wcfsetup/install/files/js/WCF.User.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.User.js b/wcfsetup/install/files/js/WCF.User.js index f62c0ed02d..aa03774b83 100644 --- a/wcfsetup/install/files/js/WCF.User.js +++ b/wcfsetup/install/files/js/WCF.User.js @@ -1426,13 +1426,7 @@ WCF.Notification.UserPanel = WCF.UserPanel.extend({ var $dropdownMenu = WCF.Dropdown.getDropdownMenu(this._container.wcfIdentify()); // check if there is at least one unconfirmed item - var $count = 0; - $dropdownMenu.children('li.jsNotificationItem').each(function() { - if (!$(this).data('isConfirmed')) { - $count++; - } - }); - + var $count = $dropdownMenu.children('li.notificationUnconfirmed').length; if (!$count && $count != $badge.text() && !$dropdownMenu.is(':visible')) { this._resetList(); @@ -1451,6 +1445,7 @@ WCF.Notification.UserPanel = WCF.UserPanel.extend({ _after: function(dropdownMenu) { var $items = WCF.Dropdown.getDropdownMenu(this._container.wcfIdentify()).children('li.jsNotificationItem'); + var $insertAfter = null; $items.each((function(index, item) { var $item = $(item); @@ -1464,12 +1459,23 @@ WCF.Notification.UserPanel = WCF.UserPanel.extend({ $markAsConfirmed.click($.proxy(this._markAsConfirmed, this)); } + if (!$item.data('isConfirmed')) { + $insertAfter = $item; + } + $item.click(function(event) { if (event.target.tagName !== 'A') { window.location = $item.data('link'); } }); }).bind(this)); + + if ($insertAfter !== null) { + // check if it is followed by a confirmed item + if ($insertAfter.next('.notificationItem').length) { + $('