aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
Diffstat (limited to 'view')
-rw-r--r--view/js/main.js54
-rw-r--r--view/js/mod_photos.js13
-rw-r--r--view/tpl/notifications_widget.tpl47
-rw-r--r--view/tpl/photos_upload.tpl9
4 files changed, 60 insertions, 63 deletions
diff --git a/view/js/main.js b/view/js/main.js
index f427df8ad..9f794c2ea 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -548,8 +548,10 @@ function markRead(notifType) {
$('#nav-' + notifType + '-menu').html('');
$('#nav-' + notifType + '-sub').removeClass('show');
sessionStorage.removeItem('notification_open');
- sse_setNotificationsStatus();
+ $(document).trigger('hz:sse_setNotificationsStatus');
});
+
+
}
function markItemRead(itemId) {
@@ -717,52 +719,18 @@ function updateConvItems(mode,data) {
}
}
- // take care of the notifications count updates
- var nmids = $(this).data('b64mids');
-
- nmids.forEach(function(nmid, index) {
-
- sse_rmids.push(nmid);
-
- if($('.notification[data-b64mid=\'' + nmid + '\']').length) {
- $('.notification[data-b64mid=\'' + nmid + '\']').each(function() {
- var n = this.parentElement.id.split('-');
- return sse_updateNotifications(n[1], nmid);
- });
- }
-
- // 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();
+ $(document).trigger('hz:sse_setNotificationsStatus', [$(this).data('b64mids')]);
});
$(window).scrollTop(scroll_position);
- if(followUpPageLoad)
- sse_bs_counts();
- else
- sse_bs_init();
+ if(followUpPageLoad) {
+ $(document).trigger('hz:sse_bs_counts');
+ }
+ else {
+ $(document).trigger('hz:sse_bs_init');
+ }
if(commentBusy) {
commentBusy = false;
@@ -902,7 +870,7 @@ function updateInit() {
liveUpdate();
}
else {
- sse_bs_init();
+ $(document).trigger('hz:sse_bs_init');
}
if($('#live-photos').length || $('#live-cards').length || $('#live-articles').length ) {
diff --git a/view/js/mod_photos.js b/view/js/mod_photos.js
index 41b8ed560..1ce410a1b 100644
--- a/view/js/mod_photos.js
+++ b/view/js/mod_photos.js
@@ -8,24 +8,11 @@ $(document).ready(function() {
UploadInit();
}
- //$("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
- //$("#photo-edit-newtag").val('@' + data.name);
- //});
-
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
$('textarea').editor_autocomplete(baseurl+"/acl");
$('textarea').bbco_autocomplete('bbcode');
- showHideBodyTextarea();
-
});
-function showHideBodyTextarea() {
- if( $('#id_visible').is(':checked'))
- $('#body-textarea').slideDown();
- else
- $('#body-textarea').slideUp();
-}
-
// initialize
function UploadInit() {
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index 5cbfcc214..268c2b38c 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -139,6 +139,18 @@
});
+ $(document).on('hz:sse_setNotificationsStatus', function(e, data) {
+ sse_setNotificationsStatus(data);
+ });
+
+ $(document).on('hz:sse_bs_init', function() {
+ sse_bs_init();
+ });
+
+ $(document).on('hz:sse_bs_counts', function() {
+ sse_bs_counts();
+ });
+
{{foreach $notifications as $notification}}
{{if $notification.filter}}
$(document).on('click', '#tt-{{$notification.type}}-only', function(e) {
@@ -421,7 +433,7 @@
}
- function sse_setNotificationsStatus() {
+ function sse_setNotificationsStatus(data) {
var primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
var secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
var all_notifications = primary_notifications.concat(secondary_notifications);
@@ -458,6 +470,39 @@
$('#notifications').hide();
}
+ if (typeof data !== typeof undefined) {
+ data.forEach(function(nmid, index) {
+
+ sse_rmids.push(nmid);
+
+ if($('.notification[data-b64mid=\'' + nmid + '\']').length) {
+ $('.notification[data-b64mid=\'' + nmid + '\']').each(function() {
+ var n = this.parentElement.id.split('-');
+ return sse_updateNotifications(n[1], nmid);
+ });
+ }
+
+ // 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();
+ }
+ });
+ });
+ }
+
}
function sse_fallback() {
diff --git a/view/tpl/photos_upload.tpl b/view/tpl/photos_upload.tpl
index ea173049b..0565a0a35 100644
--- a/view/tpl/photos_upload.tpl
+++ b/view/tpl/photos_upload.tpl
@@ -20,10 +20,8 @@
<input id="photos-upload-choose" type="file" name="userfile" />
</div -->
{{include file="field_input.tpl" field=$caption}}
- {{include file="field_checkbox.tpl" field=$visible}}
- <div id="body-textarea">
{{include file="field_textarea.tpl" field=$body}}
- </div>
+ {{include file="field_checkbox.tpl" field=$visible}}
<div class="pull-right btn-group">
<div class="btn-group">
{{if $lockstate}}
@@ -40,10 +38,9 @@
{{if $uploader}}
{{include file="field_input.tpl" field=$caption}}
- {{include file="field_checkbox.tpl" field=$visible}}
- <div id="body-textarea">
{{include file="field_textarea.tpl" field=$body}}
- </div>
+ {{include file="field_checkbox.tpl" field=$visible}}
+
<div id="photos-upload-perms" class="btn-group pull-right">
{{if $lockstate}}
<button class="btn btn-outline-secondary btn-sm" data-toggle="modal" data-target="#aclModal" onclick="return false;">