X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=js%2Fmain.js;h=885e042aa34b5e0e8f9e11bbcbc141c5cf365aae;hb=eb3bbd9081b384d1e1e503d8019eadc9f151edeb;hp=ac238bf6aa65d568702491da2a8b46cf359c5864;hpb=9663299da1be50eef4327778fae619fc6f9edef4;p=friendica.git diff --git a/js/main.js b/js/main.js index ac238bf6aa..885e042aa3 100644 --- a/js/main.js +++ b/js/main.js @@ -73,7 +73,16 @@ setupFieldRichtext(); /* popup menus */ + function close_last_popup_menu() { + if(last_popup_menu) { + last_popup_menu.hide(); + last_popup_button.removeClass("selected"); + last_popup_menu = null; + last_popup_button = null; + } + } $('a[rel^=#]').click(function(e){ + close_last_popup_menu(); menu = $( $(this).attr('rel') ); e.preventDefault(); e.stopPropagation(); @@ -90,12 +99,7 @@ return false; }); $('html').click(function() { - if(last_popup_menu) { - last_popup_menu.hide(); - last_popup_button.removeClass("selected"); - last_popup_menu = null; - last_popup_button = null; - } + close_last_popup_menu(); }); // fancyboxes @@ -113,6 +117,9 @@ /* nav update event */ $('nav').bind('nav-update', function(e,data){; + var invalid = $(data).find('invalid').text(); + if(invalid == 1) { window.location.href=window.location.href } + var net = $(data).find('net').text(); if(net == 0) { net = ''; $('#net-update').removeClass('show') } else { $('#net-update').addClass('show') } $('#net-update').html(net); @@ -207,7 +214,8 @@ function NavUpdate() { if(! stopped) { - $.get("ping",function(data) { + var pingCmd = 'ping' + ((localUser != 0) ? '?f=&uid=' + localUser : ''); + $.get(pingCmd,function(data) { $(data).find('result').each(function() { // send nav-update event $('nav').trigger('nav-update', this);