diff options
Diffstat (limited to 'view')
-rw-r--r-- | view/js/main.js | 28 | ||||
-rwxr-xr-x | view/tpl/direntry.tpl | 3 | ||||
-rw-r--r-- | view/tpl/notifications_widget.tpl | 2 |
3 files changed, 29 insertions, 4 deletions
diff --git a/view/js/main.js b/view/js/main.js index 1baf1ca1f..84fa44d4a 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -696,11 +696,11 @@ function updateConvItems(mode,data) { // take care of the notifications count updates $('.thread-wrapper', data).each(function() { - //var nmid = $(this).data('b64mid'); var nmids = $(this).data('b64mids'); nmids.forEach(function(nmid, index) { sse_mids.push(nmid); + if($('.notification[data-b64mid=\'' + nmid + '\']').length) { $('.notification[data-b64mid=\'' + nmid + '\']').each(function() { var n = this.parentElement.id.split('-'); @@ -708,6 +708,27 @@ function updateConvItems(mode,data) { }); sse_mids = []; } + + // special handling for forum notifications + $('.notification-forum').filter(function() { + var fmids = decodeURIComponent($(this).data('b64mids')); + var n = this.parentElement.id.split('-'); + if(fmids.indexOf(nmid) > -1) { + var fcount = Number($('.' + n[1] + '-update').html()); + fcount--; + $('.' + n[1] + '-update').html(fcount); + if(fcount < 1) + $('.' + n[1] + '-button').fadeOut(); + + var count = Number($(this).find('.badge-secondary').html()); + count--; + $(this).find('.badge-secondary').html(count); + if(count < 1) + $(this).remove(); + } + }); + + }); sse_setNotificationsStatus(); @@ -1743,7 +1764,7 @@ function sse_handleNotifications(obj, replace, followup) { } function sse_handleNotificationsItems(notifyType, data, replace, followup) { - var notifications_tpl = ((notifyType == 'forums') ? unescape($("#nav-notifications-forums-template[rel=template]").html()) : unescape($("#nav-notifications-template[rel=template]").html())); + var notifications_tpl = ((notifyType == 'forums') ? decodeURIComponent($("#nav-notifications-forums-template[rel=template]").html()) : decodeURIComponent($("#nav-notifications-template[rel=template]").html())); var notify_menu = $("#nav-" + notifyType + "-menu"); var notify_loading = $("#nav-" + notifyType + "-loading"); var notify_count = $("." + notifyType + "-update"); @@ -1757,7 +1778,8 @@ function sse_handleNotificationsItems(notifyType, data, replace, followup) { if(sse_mids.indexOf(this.b64mid) >= 0) { return sse_updateNotifications(notifyType, this.b64mid, false); } - html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.addr,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum); + + html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.addr,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum, encodeURIComponent(this.mids)); notify_menu.append(html); }); diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl index f7ec7db23..175d813c5 100755 --- a/view/tpl/direntry.tpl +++ b/view/tpl/direntry.tpl @@ -7,6 +7,9 @@ {{if $entry.ignlink}} <a class="directory-ignore btn btn-warning btn-sm" href="{{$entry.ignlink}}"> {{$entry.ignore_label}}</a> {{/if}} + {{if $entry.censor}} + <a class="directory-censor btn btn-danger btn-sm" href="{{$entry.censor}}"> {{$entry.censor_label}}</a> + {{/if}} {{if $entry.connect}} <a class="btn btn-success btn-sm" href="{{$entry.connect}}"><i class="fa fa-plus connect-icon"></i> {{$entry.conn_label}}</a> {{/if}} diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 057d5b491..9191c2470 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -143,7 +143,7 @@ </a> </div> <div id="nav-notifications-forums-template" rel="template"> - <a class="list-group-item clearfix notification notification-forum" href="{0}" title="{4} - {3}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}"> + <a class="list-group-item clearfix notification notification-forum" href="{0}" title="{4} - {3}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}" data-b64mids='{12}'> <span class="float-right badge badge-secondary">{10}</span> <img class="menu-img-1" src="{1}"> <span class="">{2}</span> |