var unreadNum=0; var oldTitle=document.title; document.documentElement.style.overflow="hidden"; function readNotification(){ unreadNum=0; if(document.title) document.title=oldTitle; $(this).parent().fadeOut(200); $("#xss_panel_tab").tab('show'); //重新载入数据 $('#panelGrid').jqxGrid('updatebounddata'); } function showNotification(newUnreadNum,lastedID,interval){ unreadNum+=newUnreadNum; $.ajax({ url: urlbase+"?cmd=get&id="+lastedID, dataType: "json", timeout : interval, success: function(data) { if(document.title) document.title='【收到'+unreadNum+"封消息】"+oldTitle; var notificationHTML='
'; $("#webpushtipcontainer").remove(); $("#notifications-bottom-right").append(notificationHTML); $("#webpushtipcontainer").addClass('animated bounceInUp'); $('#webpushtip1close').click(function(event){$(this).parent().parent().fadeOut(200);event.stopPropagation();}); $("#newNotification").click(readNotification); $('#unreadNum').text(unreadNum); $('.notify_location').text(data.location); $('.notify_title').text(data.user_IP); $('.notify_digest').text("GET:"+Object.keys(data.get_data).length+"个 POST:"+Object.keys(data.post_data).length+"个 Cookie:"+Object.keys(data.cookie_data).length+"个"); $("#notifications-bottom-right").addClass('animated bounceInUp'); }, complete : function(XMLHttpRequest,status){ if(status=='timeout'){ var notificationHTML=''; $("#webpushtipcontainer").remove(); $("#notifications-bottom-right").append(notificationHTML); $("#webpushtipcontainer").addClass('animated bounceInUp'); $('#webpushtip1close').click(function(event){$(this).parent().parent().fadeOut(200);event.stopPropagation();}); $("#newNotification").click(readNotification); $('#unreadNum').text(unreadNum); $("#notifications-bottom-right").addClass('animated bounceInUp'); } } }); }