diff options
author | zotlabs <mike@macgirvin.com> | 2017-11-21 17:32:09 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-11-21 17:32:09 -0800 |
commit | 2cb3ccbf1462e89f63e9b804f438c95d9d22d72a (patch) | |
tree | 489e1bf3a3ed092bb66412abdb9b150cbe3a6e0a /view/tpl | |
parent | fb1e3cba8b7a2d5f56a22eebe80314811e4add65 (diff) | |
parent | d942818bd9d9e90db7a3083bfe33a54732f6184d (diff) | |
download | volse-hubzilla-2cb3ccbf1462e89f63e9b804f438c95d9d22d72a.tar.gz volse-hubzilla-2cb3ccbf1462e89f63e9b804f438c95d9d22d72a.tar.bz2 volse-hubzilla-2cb3ccbf1462e89f63e9b804f438c95d9d22d72a.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
Diffstat (limited to 'view/tpl')
-rw-r--r-- | view/tpl/notifications_widget.tpl | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 8168866ad..8ab9a79a0 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -1,5 +1,6 @@ <script> var notifications_parent; + $(document).ready(function() { notifications_parent = $('#notifications_wrapper')[0].parentElement.id; $('.notifications-btn').click(function() { @@ -13,6 +14,11 @@ $('#navbar-collapse-2').removeClass('show'); } }); + + window.onpopstate = function(e) { + if(e.state !== null) + getData(e.state.b64mid, ''); + }; }); {{if $module == 'display' || $module == 'hq'}} @@ -20,8 +26,14 @@ var b64mid = $(this).data('b64mid'); var notify_id = $(this).data('notify_id'); var path = $(this)[0].pathname.substr(1,7); + var stateObj = { b64mid: b64mid }; - console.log(path); + {{if $module == 'display'}} + history.pushState(stateObj, '', 'display/' + b64mid); + {{/if}} + {{if $module == 'hq'}} + history.pushState(stateObj, '', 'hq/' + b64mid); + {{/if}} {{if $module == 'hq'}} if(b64mid !== 'undefined' && path !== 'pubstre') { @@ -31,25 +43,29 @@ e.preventDefault(); e.stopPropagation(); - $('.thread-wrapper').remove(); - - if(! page_load) + if(! page_load) { $(this).fadeOut(); - - bParam_mid = b64mid; - mode = 'replace'; - page_load = true; - {{if $module == 'hq'}} - hqLiveUpdate(notify_id); - {{else}} - liveUpdate(); - {{/if}} + getData(b64mid, notify_id); + } if($('#notifications_wrapper').hasClass('fs')) $('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs'); } }); {{/if}} + + function getData(b64mid, notify_id) { + $('.thread-wrapper').remove(); + bParam_mid = b64mid; + mode = 'replace'; + page_load = true; + {{if $module == 'hq'}} + hqLiveUpdate(notify_id); + {{/if}} + {{if $module == 'display'}} + liveUpdate(); + {{/if}} + } </script> |