load notifications links to /display via ajax if we are already in /display
This commit is contained in:
parent
cf4e2b2953
commit
28c85cf3ae
@ -799,6 +799,7 @@ class Enotify {
|
|||||||
'photo' => $item['author']['xchan_photo_s'],
|
'photo' => $item['author']['xchan_photo_s'],
|
||||||
'when' => relative_date($item['created']),
|
'when' => relative_date($item['created']),
|
||||||
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
|
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
|
||||||
|
'b64mid' => 'b64.' . base64url_encode($item['mid']),
|
||||||
'message' => strip_tags(bbcode($itemem_text))
|
'message' => strip_tags(bbcode($itemem_text))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ class Notifications {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$o = replace_macros(get_markup_template('notifications_widget.tpl'), array(
|
$o = replace_macros(get_markup_template('notifications_widget.tpl'), array(
|
||||||
|
'$module' => \App::$module,
|
||||||
'$notifications' => $notifications,
|
'$notifications' => $notifications,
|
||||||
'$loading' => t('Loading...')
|
'$loading' => t('Loading...')
|
||||||
));
|
));
|
||||||
|
@ -750,6 +750,7 @@ function collapseHeight() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function liveUpdate() {
|
function liveUpdate() {
|
||||||
|
|
||||||
if(typeof profile_uid === 'undefined') profile_uid = false; /* Should probably be unified with channelId defined in head.tpl */
|
if(typeof profile_uid === 'undefined') profile_uid = false; /* Should probably be unified with channelId defined in head.tpl */
|
||||||
if((src === null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
|
if((src === null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
|
||||||
if(($('.comment-edit-text.expanded').length) || (in_progress)) {
|
if(($('.comment-edit-text.expanded').length) || (in_progress)) {
|
||||||
@ -791,7 +792,6 @@ function liveUpdate() {
|
|||||||
var orgHeight = $("#region_2").height();
|
var orgHeight = $("#region_2").height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var dstart = new Date();
|
var dstart = new Date();
|
||||||
console.log('LOADING data...');
|
console.log('LOADING data...');
|
||||||
$.get(update_url, function(data) {
|
$.get(update_url, function(data) {
|
||||||
@ -959,9 +959,9 @@ function notify_popup_loader(notifyType) {
|
|||||||
$("." + notifyType + "-update").html(data.notify.length);
|
$("." + notifyType + "-update").html(data.notify.length);
|
||||||
|
|
||||||
$(data.notify).each(function() {
|
$(data.notify).each(function() {
|
||||||
html = navbar_notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass);
|
html = navbar_notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,notifyType == 'pubs' ? 'undefined' : this.b64mid);
|
||||||
$("#navbar-" + notifyType + "-menu").append(html);
|
$("#navbar-" + notifyType + "-menu").append(html);
|
||||||
html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass);
|
html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,notifyType == 'pubs' ? 'undefined' : this.b64mid);
|
||||||
$("#nav-" + notifyType + "-menu").append(html);
|
$("#nav-" + notifyType + "-menu").append(html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* redbasic theme specific JavaScript
|
* redbasic theme specific JavaScript
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var notifications_parent;
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// CSS3 calc() fallback (for unsupported browsers)
|
// CSS3 calc() fallback (for unsupported browsers)
|
||||||
@ -82,7 +84,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var notifications_parent = $('#notifications_wrapper')[0].parentElement.id;
|
notifications_parent = $('#notifications_wrapper')[0].parentElement.id;
|
||||||
$('#notifications-btn').click(function() {
|
$('#notifications-btn').click(function() {
|
||||||
if($('#notifications_wrapper').hasClass('fs'))
|
if($('#notifications_wrapper').hasClass('fs'))
|
||||||
$('#notifications_wrapper').prependTo('#' + notifications_parent);
|
$('#notifications_wrapper').prependTo('#' + notifications_parent);
|
||||||
|
@ -26,11 +26,36 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
{{if $module == 'display'}}
|
||||||
|
<script>
|
||||||
|
$(document).on('click', '.notification', function(e) {
|
||||||
|
var b64mid = $(this).data('b64mid');
|
||||||
|
|
||||||
|
console.log(b64mid);
|
||||||
|
|
||||||
|
if(b64mid !== 'undefined') {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
$('.thread-wrapper').remove();
|
||||||
|
$(this).fadeOut();
|
||||||
|
bParam_mid = b64mid;
|
||||||
|
mode = 'replace';
|
||||||
|
page_load = true;
|
||||||
|
liveUpdate();
|
||||||
|
|
||||||
|
if($('#notifications_wrapper').hasClass('fs'))
|
||||||
|
$('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs'); //var notifications_parent is defined in redbasic.js
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{if $notifications}}
|
{{if $notifications}}
|
||||||
<div id="notifications_wrapper">
|
<div id="notifications_wrapper">
|
||||||
<div id="notifications" class="navbar-nav" data-children=".nav-item">
|
<div id="notifications" class="navbar-nav" data-children=".nav-item">
|
||||||
<div id="nav-notifications-template" rel="template">
|
<div id="nav-notifications-template" rel="template">
|
||||||
<a class="list-group-item clearfix notification {5}" href="{0}" title="{2} {3}">
|
<a class="list-group-item clearfix notification {5}" href="{0}" title="{2} {3}" data-b64mid="{6}">
|
||||||
<img class="menu-img-3" data-src="{1}">
|
<img class="menu-img-3" data-src="{1}">
|
||||||
<span class="contactname">{2}</span>
|
<span class="contactname">{2}</span>
|
||||||
<span class="dropdown-sub-text">{3}<br>{4}</span>
|
<span class="dropdown-sub-text">{3}<br>{4}</span>
|
||||||
|
Reference in New Issue
Block a user