diff options
author | mrjive <mrjive@mrjive.it> | 2018-01-30 16:13:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-30 16:13:30 +0100 |
commit | 7ac4b477020689572a50dbc777c968263e86f6c4 (patch) | |
tree | 470336bcbdf0f989d48fb2c3349bd0ac0513da42 /view/js/main.js | |
parent | c2abbe2c238fa4d66e8a088c7d271acaa7e20876 (diff) | |
parent | d24cf0b85b24cb8d6d10e9fe66fed568f9fb08b2 (diff) | |
download | volse-hubzilla-7ac4b477020689572a50dbc777c968263e86f6c4.tar.gz volse-hubzilla-7ac4b477020689572a50dbc777c968263e86f6c4.tar.bz2 volse-hubzilla-7ac4b477020689572a50dbc777c968263e86f6c4.zip |
Merge pull request #13 from redmatrix/dev
Dev
Diffstat (limited to 'view/js/main.js')
-rw-r--r-- | view/js/main.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/view/js/main.js b/view/js/main.js index 8eb02156b..02b0f125c 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -70,11 +70,19 @@ $(document).ready(function() { if(! $('#nav-' + notifyType + '-sub').hasClass('show')) { loadNotificationItems(notifyType); + sessionStorage.setItem('notification_open', notifyType); + } + else { + sessionStorage.removeItem('notification_open'); } - - $(this).data('clicked', true); }); + if(sessionStorage.getItem('notification_open') !== null) { + var notifyType = sessionStorage.getItem('notification_open'); + $('#nav-' + notifyType + '-sub').addClass('show'); + loadNotificationItems(notifyType); + } + // Allow folks to stop the ajax page updates with the pause/break key $(document).keydown(function(event) { if(event.keyCode == '8') { @@ -446,11 +454,7 @@ function handleNotificationsItems(notifyType, data) { notify_menu.append(html); }); - $(".dropdown-menu img[data-src], .notification img[data-src]").each(function(i, el){ - // Replace data-src attribute with src attribute for every image - $(el).attr('src', $(el).data("src")); - $(el).removeAttr("data-src"); - }); + datasrc2src('#notifications .notification img[data-src]'); if($('#tt-' + notifyType + '-only').hasClass('active')) $('#nav-' + notifyType + '-menu [data-thread_top=false]').hide(); @@ -824,7 +828,7 @@ function liveUpdate(notify_id) { // else data was valid - reset the recursion counter liveRecurse = 0; - if(typeof notify_id !== 'undefined') { + if(typeof notify_id !== 'undefined' && notify_id !== 'undefined') { $.post( "hq", { @@ -932,9 +936,11 @@ function loadNotificationItems(notifyType) { var pingExCmd = 'ping/' + notifyType + ((localUser != 0) ? '?f=&uid=' + localUser : ''); var clicked = $('[data-type=\'' + notifyType + '\']').data('clicked'); + if((clicked === undefined) && (sessionStorage.getItem(notifyType + '_notifications_cache') !== null)) { var cached_data = JSON.parse(sessionStorage.getItem(notifyType + '_notifications_cache')); handleNotificationsItems(notifyType, cached_data); + $('[data-type=\'' + notifyType + '\']').data('clicked',true); console.log('updating ' + notifyType + ' notifications from cache...'); } else { |