1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00
This commit is contained in:
DanieL 2022-08-18 12:00:24 -03:00
parent 69457c1c8e
commit d68d17649e
2 changed files with 17 additions and 11 deletions

View file

@ -2,7 +2,7 @@
<li class="dropdown" id="topMenuUserNotifications" data-toggle="tooltip" title="<?php echo __('Notifications'); ?>" data-placement="bottom"> <li class="dropdown" id="topMenuUserNotifications" data-toggle="tooltip" title="<?php echo __('Notifications'); ?>" data-placement="bottom">
<a href="#" class="faa-parent animated-hover btn btn-default btn-light navbar-btn" data-toggle="dropdown" data-toggle="tooltip" title="<?php echo __('Notifications'); ?>" data-placement="bottom" > <a href="#" class="faa-parent animated-hover btn btn-default btn-light navbar-btn" data-toggle="dropdown" data-toggle="tooltip" title="<?php echo __('Notifications'); ?>" data-placement="bottom" >
<i class="fas fa-bell faa-ring"></i> <i class="fas fa-bell faa-ring"></i>
<span class="badge badge-notify animate_animated animate__bounceIn">0</span> <span class="badge animate_animated animate__bounceIn">0</span>
<b class="caret"></b> <b class="caret"></b>
</a> </a>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">

View file

@ -111,15 +111,17 @@ function updateUserNotificationCount() {
_updateUserNotificationCountTimeout = setTimeout(function () { _updateUserNotificationCountTimeout = setTimeout(function () {
var valueNow = parseInt($('#topMenuUserNotifications a > span.badge-notify').text()); var valueNow = parseInt($('#topMenuUserNotifications a > span.badge-notify').text());
var total = $('#topMenuUserNotifications > ul .list-group a').length; var total = $('#topMenuUserNotifications > ul .list-group a').length;
if (total != valueNow) { if (total <= 0) {
//Avoid dropdown menu close on click inside $('#topMenuUserNotifications .dropdown-menu').addClass('hidden');
$(document).on('click', '#topMenuUserNotifications .dropdown-menu', function (e) { $('#topMenuUserNotifications > a > span.badge').removeClass('badge-notify');
e.stopPropagation(); $('#topMenuUserNotifications > a > span.badge').text(0);
}); } else if (total != valueNow) {
$('#topMenuUserNotifications .dropdown-menu').removeClass('hidden');
$('#topMenuUserNotifications > a > span.badge').addClass('badge-notify');
animateChilds('#topMenuUserNotifications .dropdown-menu .list-group .priority', 'animate__bounceInRight', 0.05); animateChilds('#topMenuUserNotifications .dropdown-menu .list-group .priority', 'animate__bounceInRight', 0.05);
$('#topMenuUserNotifications a > span.badge-notify').hide(); $('#topMenuUserNotifications > a > span.badge').hide();
setTimeout(function () { setTimeout(function () {
var selector = '#topMenuUserNotifications a > span.badge-notify'; var selector = '#topMenuUserNotifications > a > span.badge';
countToOrRevesrse(selector, total); countToOrRevesrse(selector, total);
$(selector).show(); $(selector).show();
}, 1); }, 1);
@ -267,5 +269,9 @@ function deleteAllNotifications() {
} }
$(document).ready(function () { $(document).ready(function () {
//Avoid dropdown menu close on click inside
$(document).on('click', '#topMenuUserNotifications .dropdown-menu', function (e) {
e.stopPropagation();
});
getUserNotification(); getUserNotification();
}); });