').append( $("#nav-" + notifyType + "-mark-all").clone() ).html()); //outerHtml hack
+ //var notifications_tt_only = unescape($('
').append( $("#tt-" + notifyType + "-only").clone() ).html()); //outerHtml hack
+ //var notifications_cn_only = unescape($('
').append( $("#cn-" + notifyType + "-only").clone() ).html()); //outerHtml hack
+ //var notifications_empty = unescape($("#nav-" + notifyType + "-menu").html());
var notify_menu = $("#nav-" + notifyType + "-menu");
@@ -895,11 +896,13 @@ function notify_popup_loader(notifyType) {
window.location.href=window.location.href;
}
- $("#navbar-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only);
- $("#nav-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only);
+ //$("#navbar-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only + notifications_cn_only);
+ //$("#nav-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only + notifications_cn_only);
$("." + notifyType + "-update").html(data.notify.length);
+ notify_menu.html('');
+
$(data.notify).each(function() {
html = navbar_notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top);
$("#navbar-" + notifyType + "-menu").append(html);
@@ -915,11 +918,23 @@ function notify_popup_loader(notifyType) {
if($('#tt-' + notifyType + '-only').hasClass('active'))
$('#nav-' + notifyType + '-menu [data-thread_top=false]').hide();
+
+ var filter = $('#cn-' + notifyType + '-input').val();
+
+ if(filter) {
+ $('#nav-' + notifyType + '-menu .notification').each(function(i, el){
+ var cn = $(el).data('contact_name').toLowerCase();
+ if(cn.indexOf(filter) === -1)
+ $(this).addClass('d-none');
+ else
+ $(this).removeClass('d-none');
+ });
+ }
});
setTimeout(function() {
- if(notify_menu.hasClass('show')) {
+ if($('#nav-' + notifyType + '-sub').hasClass('show')) {
console.log('updating ' + notifyType + ' notifications...');
setTimeout(notify_popup_loader, updateInterval, notifyType);
}
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index 9d2e08c41..9489e850c 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -65,6 +65,23 @@
$('#nav-{{$notification.type}}-menu [data-thread_top=false]').toggle();
$(this).toggleClass('active sticky-top');
});
+ $(document).on('keyup', '#cn-{{$notification.type}}-input', function(e) {
+ var val = $('#cn-{{$notification.type}}-input').val().toLowerCase();
+
+ if(val)
+ $('#cn-{{$notification.type}}-only').addClass('active sticky-top');
+ else
+ $('#cn-{{$notification.type}}-only').removeClass('active sticky-top');
+
+ $("#nav-{{$notification.type}}-menu .notification").each(function(i, el){
+ var cn = $(el).data('contact_name').toLowerCase();
+
+ if(cn.indexOf(val) === -1)
+ $(this).addClass('d-none');
+ else
+ $(this).removeClass('d-none');
+ });
+ });
{{/if}}
{{/foreach}}
@@ -90,7 +107,7 @@
{{foreach $notifications as $notification}}