javascript 질문입니다. 0 0 1,305

by 재히루 [2016.05.16 17:27:33]


(function($)
    {var desktopNotification=function()
        {var showAlarmsNotifi=function(count)
            {var alarms;
            try{alarms=window.localStorage.getItem("newalarmcount")}catch(err){alarms=0}
    if(alarms>=0&&count>0&&alarms<count){
        if("Notification"in window)if(Notification.permission==="granted")PrintAlarmStringAsDesktopNotification();
        window.localStorage.setItem("newalarmcount",count)}};
        var requestPermission=function(callback){
            if(Notification&&Notification.requestPermission!==0)Notification.requestPermission(function(){callback&&callback()})};
        return{showAlarms:showAlarmsNotifi,requestPermission:requestPermission,___:"_Prtg.desktopNotification"}};
        $.extend(true,window,{_Prtg:{desktopNotification:desktopNotification()}});
        function PrintAlarmStringAsDesktopNotification(){var notificationText;$.getJSON("/api/getstatus.htm?id=0").done(function(response){
            if(response.Alarms!=="")notificationText=_Prtg.Lang.desktopNotifications.strings.down+": "+response.Alarms;
            if(response.PartialAlarms!==""){
                if(notificationText.length>0)notificationText=notificationText+" / ";
                notificationText=notificationText+_Prtg.Lang.desktopNotifications.strings.downPartial+": "+response.PartialAlarms}
                if(response.WarnSens!==""){
                    if(notificationText.length>0)notificationText=notificationText+" / ";
                    notificationText=notificationText+_Prtg.Lang.desktopNotifications.strings.warning+": "+response.WarnSens}
                    if(response.AckAlarms!==""){
                        if(notificationText.length>0)notificationText=notificationText+" / ";
                        notificationText=notificationText+_Prtg.Lang.desktopNotifications.strings.downAck+": "+response.AckAlarms}
        if(response.UpSens!==""){
            if(notificationText.length>0)notificationText=notificationText+" / ";
            notificationText=notificationText+_Prtg.Lang.desktopNotifications.strings.up+": "+response.UpSens}
            if(response.PausedSens!==""){
                if(notificationText.length>0)notificationText=notificationText+" / ";
                notificationText=notificationText+_Prtg.Lang.desktopNotifications.strings.paused+": "+response.PausedSens}
                if(response.UnusualSens!==""){
                    if(notificationText.length>0)notificationText=notificationText+" / ";
            notificationText=notificationText+_Prtg.Lang.desktopNotifications.strings.unusual+": "+response.UnusualSens}
            if(response.UnknownSens!==""){
                if(notificationText.length>0)notificationText=notificationText+" / ";
                notificationText=notificationText+_Prtg.Lang.desktopNotifications.strings.unknown+": "+response.UnknownSens}
                var date=new Date;
                var dateString=date.toLocaleTimeString();
                var options={body:notificationText,tag:dateString,icon:"/icons/led_red_big.png"};
                var notification=new Notification("("+dateString+") "+"PRTG - New Alarms: "+response.NewAlarms,options);
            notification.onclick=function(){window.location.href="alarms.htm?filter_status=5&filter_status=4&filter_status=10&filter_status=13&filter_status=14";
            $.ajax({url:"/api/resetnewmessagestimestamp.htm",dataType:"text",type:"GET",beforeSend:function(jqXHR){jqXHR.ignoreManager=true},success:function(){try{window.localStorage.setItem("newalarmcount",0)}catch(err){}}});notification.close()}})}})(jQuery);

 

지금 문장들이 나타내주는것은 count를 세서 alarm을 울리는데 count말고

그 안의 내용들을 보여주려면 어떻게 바꿔야 할까요??

참고로 _Prtg.DesktopNotifications.lang.js는

 


_Prtg.Lang = _Prtg.Lang || {
  ___: '_Prtg.Lang'
};
$.extend(true, _Prtg.Lang, {
  desktopNotifications: {
    strings: {
      "down": '<#langjs key="common.strings.nodestates.onsDown" default="Down">',
      "downPartial": '<#langjs key="common.strings.nodestates.onsPartialDown" default="Down (Partial)">',
      "warning": '<#langjs key="common.strings.nodestates.onsWarning" default="Warning">',
      "downAck": '<#langjs key="common.strings.nodestates.onsDownAck" default="Down (Acknowledged)">',
      "up": '<#langjs key="common.strings.nodestates.onsUp" default="Up">',
      "paused": '<#langjs key="common.strings.nodestates.onsPausedUser" default="Paused">',
      "unusual": '<#langjs key="common.strings.nodestates.onsUnusual" default="Unusual">',
      "unknown": '<#langjs key="common.strings.nodestates.onsUnknown" default="Unknown">'
    }
  }
});

이렇게 구성되어있습니다.

 

 

댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입