"use strict";var _debug=!0,_AvailablePlugins={},_PluginUrl="/res/js/plugins/",_AvailableContexts={main:[],meteo:[],dcf77:[],live:["modal","liveview"],viewlog:["logview"],logs:["modal","logs"],events:["logview"],contact:["contact","modal"]},MainApp=function(n){n!=null&&n!=""&&(this._CurrentContext=n);this.Initialize()},_MainApplication;MainApp.prototype={_CurrentContext:"main",_Plugins:{},Initialize:function(){var t=_AvailableContexts[this._CurrentContext],n;if(t!=null)for(n=0;n<t.length;n++)this._Plugins[t[n]]=new _AvailablePlugins[t[n]]}};_MainApplication=null;$(function(){var n=$("#jsCtx").data("context");_MainApplication=new MainApp(n);$(".button-collapse").sideNav()});_AvailablePlugins.contact=function(){var n=this;this._Form=$("#frmContact").on("submit",function(t){n.Validate(t)});this.Initialize()};_AvailablePlugins.contact.prototype={_Form:{},_Enabled:!1,_CaptchaResult:null,_PostData:null,_Fields:{Name:$("#_frm-name"),EMailA:$("#_frm-email-a"),EMailC:$("#_frm-email-c"),Subject:$("#_frm-subject"),Text:$("#_frm-text")},_SubmitProgress:!1,_Key:null,_Urls:{Captcha:"https://www.google.com/recaptcha/api.js?render=explicit&onload=EnableForm",Config:"/ajax/conf/captcha",Contact:"/ajax/contact"},GetMailAddress:function(){return atob("bWFpbEBkY2Y3N2xvZ3MuZGU=")},_GetSalutation:function(){return $("input:radio[name = 'salutation']:checked").val()},LoadCaptcha:function(){$("#_frm-captcha").attr("data-sitekey",this._Key);$.getScript(this._Urls.Captcha)},EnableForm:function(){var n=this;grecaptcha.render($("#_frm-captcha-chall")[0],{sitekey:this._Key,size:"invisible",callback:function(t){n._CaptchaResult=t;n._SubmitProgress&&n.SubmitForm()},"expired-callback":function(){n._CaptchaResult=null}});$("[id^=_frm-]").removeClass("disabled").prop("disabled",!1);this._Enabled=!0},Initialize:function(){var n=this;n._Form.length!=0&&$.ajax({url:this._Urls.Config,method:"GET",dataType:"json",success:function(t){t!=null&&t.Success?t.Enabled?(n._Key=t.Key,n.LoadCaptcha(),window.EnableForm=function(){n.EnableForm()}):n.EnableForm():Modal.Show("Fehler","Fehler beim Laden der Formulardaten. Bitte versuche es später noch einmal.")},error:function(){Modal.Show("Fehler","Fehler beim Laden der Formulardaten. Die Verbindung zum Server konnte nicht hergestellt werden.<br>Bitte prüfe die Verbindung oder versuche es später noch einmal.")}})},Validate:function(n){n.preventDefault();var t=this._Fields,i={Salutation:this._GetSalutation(),Name:t.Name.val(),EMailA:t.EMailA.val(),EMailC:t.EMailC.val(),Subject:t.Subject.val(),Text:t.Text.val(),CaptchaResult:this._CaptchaResult};if(i.Salutation==""||i.Salutation==null){Modal.Show("Hinweis","Bitte Anrede auswählen.");return}if(i.EMailC!=i.EMailA){t.EMailC.addClass("invalid").focus();return}if(this._PostData=i,this._CaptchaResult==null){this._SubmitProgress=!0;try{grecaptcha.execute()}catch(r){Modal.Show("Fehler","Bitte den Haken bei &quot;Ich bin kein Roboter.&quot; Setzen.<br>Dieses dient lediglich dem Schutz vor Spam.")}}else this.SubmitForm()},SubmitForm:function(){this._SubmitProgress=!1;var n=this;this._PostData!=null&&(this._PostData.CaptchaResult=this._CaptchaResult,$.ajax({url:this._Urls.Contact,method:"POST",dataType:"json",data:JSON.stringify(this._PostData),success:function(t){grecaptcha.reset();n._CaptchaResult=null;t!=null&&t.Success?n.CloseForm():t.CaptchaOk!=null&&t.CaptchaOk==!1?Modal.Show("Fehler","Fehler beim Absenden des Formulars. Die Sicherheitsprüfung ist fehlgeschlagen.<br />Versuche es bitte noch einmal.<br />Sollte es weiterhin Schwierigkeiten geben, versuche es später noch einmal oder sende deine Anfrage per E-Mail an<br /><br /><b>"+n.GetMailAddress()+"<\/b><br><br>Ich möchte mich für die Unannehmlichkeiten entschuldigen."):Modal.Show("Fehler","Fehler beim Absenden des Formulars, bitte prüfe deine Eingaben oder versuche es später erneut.")},error:function(){Modal.Show("Fehler","Fehler beim Absenden des Formulars. Die Verbindung zum Server konnte nicht hergestellt werden.<br>Bitte prüfe die Verbindung oder versuche es später noch einmal.");n._CaptchaResult=null;grecaptcha.reset()}}))},CloseForm:function(){$("#_frm-email-v").text(this._PostData.EMailA);$("#_frm-info").removeClass("hide");$(this._Form).addClass("hide")}};_AvailablePlugins.liveview=function(){var n=this;$(function(){n.Initialize()})};_AvailablePlugins.liveview.prototype={_Ws:null,_ReconnectTry:0,_Timer:null,_PopupTimer:null,_PopupTime:5e3,_KaTimeout:null,_NoPcktTimeout:null,_PhUsersOnline:null,_Config:{Logs:!1,MTime:!1,MDec:!1,Sync:!1,MDecDesc:null},_Console:{Pause:null,Pulse:null,Period:null,Second:null,Current:null,CntAll:null,CntSuc:null,CntOk:null,CntBad:null,Last:null,Dec:null,Wd:null,Call:null,DstA:null,Leap:null,Tz:null,State:null,Sync:null,LogDec:null,LogBin:null,BinClear:null,Temp:null,FcDay:null,FcNight:null,DecState:null,R1:null,R2:null,R3:null,R4:null,Cipher:null,Key:null,BlockReg2:null,CntWall:null,CntWok:null,BlockLog:null,BlockMeteo:null,Popup:null,PopupTitle:null,PopupContent:null,InnerConsole:null},_Lookup:{Weekday:["--","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag","Sonntag"],CallSign:["Inaktiv","Aktiv"],LeapSecond:["Nein","Angekündigt"],DstA:["Nein","Angekündigt"],Dst:["--","MESZ","MEZ","--"]},_Color:{Black:"#000000",DarkBlue:"#000080",DarkGreen:"#008000",DarkCyan:"#008080",DarkRed:"#800000",DarkMagenta:"#800080",DarkYellow:"#808000",Gray:"#C0C0C0",DarkGray:"#808080",Blue:"#0000FF",Green:"#00ff00",Cyan:"#00ffff",Red:"#ff0000",Magenta:"#ff00ff",Yellow:"#ffff00",White:"#ffffff"},_ForeCast:["--","klar","leicht bewölkt","vorwiegend bewölkt","bedeckt","Wärmegewitter","starker Regen","Schneefall","Nebel","Schneeregen","Regenschauer","leichter Regen","Schneeschauer","Frontengewitter","Hochnebel","Schneeregenschauer","sonnig"],_DecState:[],Initialize:function(){this._DecState=[["fehlerhaft",this._Color.Red],["fehlerfrei",this._Color.Green],["unbekannt",this._Color.White],["korrigiert",this._Color.Yellow],];var n=window.location.host+"/ajax/liveview";this._PhUsersOnline=$("#_Online span");this._Console.InnerConsole=$("#_InnerConsole");this._Console.Popup=$("#_Popup");this._Console.PopupContent=$("#_PopupContent");this._Console.PopupTitle=$("#_PopupTitle");this._Console.BlockLog=$("#_BlockLog");this._Console.BlockMeteo=$("#_BlockMeteo");this._Console.Pulse=$("#_Pulse span");this._Console.Pause=$("#_Pause span");this._Console.Period=$("#_Period span");this._Console.Second=$("#_Second span");this._Console.Current=$("#_Current span");this._Console.CntAll=$("#_CntAll span");this._Console.CntBad=$("#_CntBad span");this._Console.CntOk=$("#_CntOk span");this._Console.CntSuc=$("#_CntSuc span");this._Console.Last=$("#_Last span");this._Console.Dec=$("#_Dec span");this._Console.Wd=$("#_Wd span");this._Console.Call=$("#_Call span");this._Console.DstA=$("#_DstA span");this._Console.Leap=$("#_Leap span");this._Console.Dst=$("#_Dst span");this._Console.State=$("#_State span");this._Console.Sync=$("#_Sync span");this._Console.LogBin=$("#_LogBin span");this._Console.LogDec=$("#_LogDec span");this._Console.BinClear=$("#_BinClear span");this._Console.CntWall=$("#_CntWall span");this._Console.CntWok=$("#_CntWok span");this._Console.Temp=$("#_Temp span");this._Console.FcDay=$("#_FcDay span");this._Console.FcNight=$("#_FcNight span");this._Console.DecState=$("#_DecState span");this._Console.R1=$("#_R1 span");this._Console.R2=$("#_R2 span");this._Console.R3=$("#_R3 span");this._Console.R4=$("#_R4 span");this._Console.Cipher=$("#_Cipher span");this._Console.Key=$("#_Key span");this._Console.BlockReg2=$("#_BlockReg2");typeof String.prototype.padStart=="undefined"&&(String.prototype.padStart=function(n,t){for(var i=this;i.length<n;)i=t+i;return i});typeof WebSocket!="undefined"&&document.location.hash!=="#poll"?this.InitializeSocket(n):this.InitializePolling(n)},InitializePolling:function(n){n=window.location.protocol+"//"+n;$("#_FallbackHint").removeClass("hide");this.PollData(n);var t=this;this._Timer=window.setInterval(function(){t.PollData(n)},1e3)},InitializeSocket:function(n){n=(window.location.protocol[4]==="s"?"wss://":"ws://")+n;var t=this;try{this._Ws=new WebSocket(n);this._Ws.onmessage=function(n){t.HandleWsMessage(n)};this._Ws.onerror=function(n){t.HandleWsError(n)};this._Ws.onopen=function(n){t.HandleWsOpen(n)}}catch(i){console.log(i);this.TryReconnect()}},TryReconnect:function(){if(clearInterval(this._KaTimeout),clearInterval(this._NoPcktTimeout),this._Ws.readyState<=1&&this._Ws.close(),this._ReconnectTry<2)this._ReconnectTry++,this.Initialize();else{var n=this;Modal.Show("Fehler","Die Verbindung zur Live-Ansicht konnte nicht aufgebaut werden<br>Überprüfe bitte deine Internetverbindung.<br><br>Soll der Verbindungsaufbau noch einmal versucht werden?",function(t){t===!0?(n._ReconnectTry=0,n.TryReconnect()):n.EndMessage()},!0)}},HandleWsError:function(){this.TryReconnect()},HandleWsMessage:function(n){this.WorkPacket(JSON.parse(n.data))},HandleWsOpen:function(){this._ReconnectTry=0;this._NoPcktTimeout=window.setTimeout(function(){me.PacketTimeout()},2500)},PollData:function(n){var t=this;this._ReconnectTry>10&&(clearInterval(this._Timer),Modal.Show("Fehler","Die Live-Daten konnten häufiger nicht abgerufen werden. Bitte überprüfe deine Verbindung.<br><br>Soll der Abruf weiterhin versucht werden?",function(n){n===!0?(t._ReconnectTry=0,t.Initialize()):t.EndMessage()},!0));$.ajax({url:n,dataType:"json",success:function(n){if(n!==null&&n!==undefined&&n.Success)for(var i=0;i<n.Data.length;i++)t.WorkPacket(n.Data[i]);else t._ReconnectTry++},error:function(){t._ReconnectTry++}})},WorkPacket:function(n){var t=this;window.clearTimeout(this._NoPcktTimeout);this._NoPcktTimeout=window.setTimeout(function(){t.PacketTimeout()},2500);switch(n.Type){case 0:this._Config=n;this._Configure();break;case 1:this._UpdateSignalInfo(n);break;case 2:this._UpdateSecond(n);break;case 3:this._UpdateCurrentDcf(n);break;case 4:this._UpdateLastDcf(n);break;case 5:this._UpdateMeteo(n);break;case 6:this._ShowPopup(n);break;case 7:this._HidePopup(n);break;case 100:this._UpdateUsersOnline(n);break;case 101:clearTimeout(this._KaTimeout);break;case 200:console.log("Generic Error:",n);break;case 201:console.log("Unknown Command from Server:",n);break;default:console.log("Unknown packet:",n)}},_Configure:function(){this._Console.BlockLog.toggleClass("hide",!this._Config.Logs);this._Console.BlockMeteo.toggleClass("hide",!this._Config.MTime)},_ShowPopup:function(n){if(this._Console.InnerConsole.toggleClass("blurry",!0),this._Console.Popup.toggleClass("hide",!1),this._Console.PopupContent.append($("<div>").text(n.Msg)),this._Console.PopupContent.children().length>5&&this._Console.PopupContent.children().first().remove(),this._Console.PopupTitle.scrollTop(this._Console.PopupTitle[0].scrollHeight),this._Console.PopupTitle.text(n.Title),n.Hide){var t=this;setTimeout(function(){t._HidePopup()},this._PopupTime)}},_HidePopup:function(){this._Console.InnerConsole.toggleClass("blurry",!1);this._Console.Popup.toggleClass("hide",!0)},_UpdateUsersOnline:function(n){this._PhUsersOnline.parent().removeClass("hide");n.Online<2?this._PhUsersOnline.text("ein"):this._PhUsersOnline.text(n.Online)},_UpdateSignalInfo:function(n){this._Console.Pulse.text(n.Pulse);this._Console.Pause.text(n.Pause);this._Console.Period.text(n.Pause+n.Pulse)},_UpdateSecond:function(n){var t=n.Second===-1,i=t?"--":(""+n.Second).padStart(2,"0");this._Console.Second.toggleClass("est",n.Est&&!t);this._Console.Second.text(i)},_UpdateCurrentDcf:function(n){n.Data!==null?this._Console.Current.text(this.DcfDataToString(n.Data,"-")):this._Console.Current.text("Warte auf Minutenmarke...")},_UpdateLastDcf:function(n){var r,t,i;if(this._Console.CntAll.text(n.Bad+n.Good),this._Console.CntBad.text(n.Bad),this._Console.CntOk.text(n.Ok),this._Console.CntSuc.text(n.Good),r=this._Color.White,t="",n.Data!==null)if(this._Config.Logs&&(this._Console.LogBin.text(this.DcfDataToString(n.Data," ")),this._Console.LogDec.text(n.Log)),this._Console.Last.text(this.DcfDataToString(n.Data,"-")),i=this.DcfDataToInt(n.Data,42,3,0),this._Console.Wd.text(this._Lookup.Weekday[i]),i=this.DcfDataToInt(n.Data,15,1,0),this._Console.Call.text(this._Lookup.CallSign[i]),i=this.DcfDataToInt(n.Data,16,1,0),this._Console.DstA.text(this._Lookup.DstA[i]),i=this.DcfDataToInt(n.Data,19,1,0),this._Console.Leap.text(this._Lookup.LeapSecond[i]),i=this.DcfDataToInt(n.Data,17,2,0),this._Console.Dst.text(this._Lookup.Dst[i]),n.Faulty?this._Console.State.css({color:this._Color.Red}).text("fehlerhaft"):this._Console.State.css({color:this._Color.Green}).text("fehlerfrei"),this._Config.Sync)if(n.Faulty)t="Nein, Daten fehlerhaft";else switch(n.Sync){case 0:r=this._Color.Gray;t="deaktiviert";break;case 1:r=this._Color.Green;t="Erfolgt ("+n.Offset/1e3+"s)";break;case 2:r=this._Color.Red;t="Fehler ("+n.Offset/1e3+"s)";break;case 3:t="Nein, Abw. < 1s";break;case 4:t="Läuft... ("+n.RecForSync+"/"+n.ReqToSync+")";break;case 5:t="Nein, Abw. > 4h"}else t="deaktiviert",this._Color.Gray;else this._Config.Logs&&(this._Console.LogBin.text(""),this._Console.LogDec.text(n.Log)),this._Console.Last.text("Noch keine Daten empfangen."),this._Console.Wd.text("--"),this._Console.Call.text("--"),this._Console.DstA.text("--"),this._Console.Leap.text("--"),this._Console.Dst.text("--"),this._Console.State.css({color:this._Color.White}).text("--"),this._Config.Sync?t="--":(t="deaktiviert",this._Color.Gray);this._Console.Dec.text(n.Dec);this._Console.Sync.css({color:r}).text(t)},_UpdateMeteo:function(n){var i=this._Color.White,r="--",u=this._Color.White,f="--",t,e;this._Console.CntWall.text(n.All);this._Console.CntWok.text(n.Ok);n.Data===null?(this._Console.BinClear.text(this._Config.MDec?"Noch keine Daten entschlüsselt":"Kein Dekoder vorhanden."),this._Console.FcDay.text("--"),this._Console.FcNight.text("--"),this._Console.R1.text("--"),this._Console.R2.text(""),this._Console.Cipher.text("--"),this._Console.Key.html("&nbsp;"),this._Console.BlockReg2.toggleClass("hide",!0)):(this._Console.BinClear.text(this.MeteoClearToString(n.Clear)),t=this.MeteoClearToInt(n.Clear,0,4),t=t==1?16:t,this._Console.FcDay.text(this._ForeCast[t]),t=this.MeteoClearToInt(n.Clear,4,4),this._Console.FcNight.text(this._ForeCast[t]),this._Console.R1.text(n.Regions[0]),this._Console.R2.text(n.Regions[1]),this._Console.BlockReg2.toggleClass("hide",n.Regions[2]==="--"),this._Console.R3.text(n.Regions[2]),this._Console.R4.text(n.Regions[3]),this._Console.Cipher.empty(),e=this,$.each(this.MeteoDataToString(n.Data,!1),function(n,t){e._Console.Cipher.append($("<span>").text(t)).append(" ")}),this._Console.Key.html(this.MeteoDataToString(n.Data,!0)),t=this.MeteoClearToInt(n.Clear,16,6),t+=-22,r=t+"°C",t==-22?(i=this._Color.Magenta,r="<-21°C"):t>=-21&&t<=-9?i=this._Color.DarkBlue:t>=-8&&t<=-3?i=this._Color.Blue:t>=-2&&t<=3?i=this._Color.Cyan:t>=4&&t<=15?i=this._Color.White:t>=16&&t<=27?i=this._Color.Yellow:t>=28&&t<=40?i=this._Color.Red:t==41&&(i=this._Color.DarkRed,r=">40°C"),t=this.MeteoClearToInt(n.Clear,22,2),t=this._DecState[t],f=t[0],u=t[1]);this._Console.Temp.text(r).css({color:i});this._Console.DecState.text(f).css({color:u})},DcfDataToString:function(n,t){for(var u=n[8],r="",i=0;i<60;i++){switch(i){case 1:case 15:case 21:case 29:case 36:case 42:case 45:case 50:r+=t}r+=i>=u?i===59?" ":"_":n[i>>3]&1<<(i&7)?"1":"0"}return r},DcfDataToInt:function(n,t,i,r){var o=n[8],u,f,e;if(t+i>=o)return r;for(f=1,e=0,u=t;u<t+i;u++)e|=n[u>>3]&1<<(u&7)?f:0,f<<=1;return e},MeteoClearToString:function(n){for(var i="",t=0;t<24;t++)i+=n&1<<t?"1":"0";return i},MeteoClearToInt:function(n,t,i){if(t+i>24)return-1;for(var u=1,f=0,r=t;r<t+i;r++)f|=n&1<<r?u:0,u<<=1;return f},MeteoDataToString:function(n,t){var i,u,f=[],r="";for(t?(i=40,u=80):(i=0,u=40);i<u;i++){switch(i){case 0:case 6:r+="0";break;case 12:case 26:f.push(r);r=""}r+=n[i>>3]&1<<(i&7)?"1":"0"}return t?r:(f.push(r),f)},PacketTimeout:function(){var n=this;this._Ws.readyState===1?(this._KaTimeout=window.setTimeout(function(){n.KeepAliveTimeout()},5e3),this._Ws.send("ka")):this.TryReconnect()},KeepAliveTimeout:function(){this.TryReconnect()},EndMessage:function(){this._ShowPopup({Hide:!1,Title:"Verbindung getrennt",Msg:"Die Verbindung wurde getrennt. Um die Liveansicht erneut zu starten, aktualisiere bitte diese Seite."});this._PhUsersOnline.parent().addClass("hide")}};_AvailablePlugins.logs=function(){this.Initialize()};_AvailablePlugins.logs.prototype={_PaginationTop:[],_PaginationBot:[],_LogTable:[],_AllPh:[],_Elems:25,_FileCount:0,_CurrentPage:1,_Events:!1,Initialize:function(){var r,f,t,n,i,u;this._AllPh=$("#_PhLogTable");this._AllPh.length>0?(r=this._AllPh,r.data("type")=="events"&&(this._Events=!0),f=this._Events,r.empty(),t=$("<div>",{"class":"row"}).appendTo(r),n=$("<div>",{"class":"col s12"}).appendTo(t),i=$("<ul>",{"class":"pagination center-align",id:"_PagiTop"}).appendTo(n),this._PaginationTop=i,t=$("<div>",{"class":"row hide-on-med-and-up"}).appendTo(r),n=$("<div>",{"class":"col s12"}).appendTo(t),i=$("<h5>",{"class":"light"}).appendTo(n).text(f?"Ereignisse:":"Dateiliste:"),t=$("<div>",{"class":"row hide-on-small-only list-head"}).appendTo(r),n=$("<div>",{"class":"col s11 m3 l3"}).appendTo(t).text(f?"Ereignis":"Datei"),n=$("<div>",{"class":"col s1 tooltipped","data-position":"top","data-delay":50,"data-tooltip":"Kommentar vorhanden"}).appendTo(t),i=$("<i>",{"class":"material-icons"}).appendTo(n).text("comment"),n=$("<div>",{"class":"col s12 m6 l6"}).appendTo(t).text("Zeitraum"),n=$("<div>",{"class":"col s12 m1 l1 tooltipped","data-position":"top","data-delay":50,"data-tooltip":"Wetterdaten vorhanden"}).appendTo(t),i=$("<i>",{"class":"fa fa-thermometer-3"}).appendTo(n),n=$("<div>",{"class":"col s12 m1 l1 tooltipped","data-position":"top","data-delay":50,"data-tooltip":"Download"}).appendTo(t),i=$("<i>",{"class":"material-icons"}).appendTo(n).text("file_download"),i=$("<div>",{"class":"loglist",id:"_LogTbl"}).appendTo(r),this._LogTable=i,t=$("<div>",{"class":"row"}).appendTo(r),n=$("<div>",{"class":"col s12"}).appendTo(t),i=$("<ul>",{"class":"pagination center-align",id:"_PagiBot"}).appendTo(n),this._PaginationBot=i,$(".tooltipped",r).tooltip(),this.SetError(!0),this.SetPage(1)):(this._PaginationTop=$("#_PagiTop"),this._PaginationBot=$("#_PagiBot"),this._LogTable=$("#_LogTbl"),u=$("#_TblParams"),this._FileCount=parseInt(u.data("count")),this._Elems=parseInt(u.data("epp")),u.data("type")=="events"&&(this._Events=!0),$("a",this._PaginationTop).click(this,this.HandlePageChange),$("a",this._PaginationBot).click(this,this.HandlePageChange))},SetPage:function(n){var t=this,i,u,r;this._CurrentPage=n;i=t._LogTable;i.hasClass("loading")||(i.addClass("loading"),$(".row",i).addClass("blurry"),u=$("<div>").prependTo(i),u.css({position:"relative",width:"100%",height:0,"z-index":100}),r=$("<div>"),r.css({width:"100%",height:i.height()*.67,display:"flex","align-items":"center","justify-content":"center"}),r.appendTo(u),r.append($("<div>",{"class":"preloader-wrapper big active"}).append($("<div>",{"class":"spinner-layer spinner-green-only"}).append($("<div>",{"class":"circle-clipper left"}).append($("<div>",{"class":"circle"}))).append($("<div>",{"class":"gap-patch"}).append($("<div>",{"class":"circle"}))).append($("<div>",{"class":"circle-clipper right"}).append($("<div>",{"class":"circle"}))))));$.ajax({url:"/ajax/logtable/"+(this._Events?"events/":"logs/")+this._Elems+"/"+n,dataType:"json",success:function(n){n==null||n.Success==!1?(Modal.Show("Fehler","Dateiliste konnte nicht abgerufen werden."+(n!=null?"<br>"+n.Reason:"")),t.SetError(!1)):n.CurPage==t._CurrentPage&&(t._Elems=n.EPerPage,t._FileCount!=n.ElemCount&&(t._FileCount=n.ElemCount,t.RenderPagination()),t._LogTable.removeClass("loading"),t._LogTable.html(n.Html))},error:function(n,i){Modal.Show("Fehler","Dateiliste konnte nicht abgerufen werden.<br>"+i);t.SetError(!1)}})},SetError:function(n){var t,i,r,u;for(this._LogTable.removeClass("loading"),this._LogTable.empty(),r=0;r<this._Elems;r++)t=$("<div>",{"class":"row file-entry"}).appendTo(this._LogTable),i=$("<div>",{"class":"col s10 m3"}).appendTo(t).html(n?"DcfLog_00000000":"&nbsp;"),i=$("<div>",{"class":"col s2 m1"}).appendTo(t).html("&nbsp;"),u=n?"01.01.2017 00:00 - 01.01.2017 23:59":r==0?"Fehler beim Laden der Liste":"&nbsp;",i=$("<div>",{"class":"col s9 m6"}).appendTo(t).append(u),i=$("<div>",{"class":"col s1"}).appendTo(t).html("&nbsp;"),i=$("<div>",{"class":"col s1"}).appendTo(t).append($("<i>",{"class":"material-icons"}).html("file_download"))},RenderPagination:function(){var f=3,n=this._PaginationTop,u,e,o,s;n.empty();var h=this._FileCount,r=Math.ceil(h/this._Elems),c=$("<li>",{"class":"waves-effect"}),t=1,i=r;for(i-t>f*2&&(t=this._CurrentPage-f,i=this._CurrentPage+f,t<1&&(t=1,i=t+f*2),i>r&&(i=r,t=i-f*2)),t>2&&n.append(this.GetPageBtn(!0,1,-2,null)),this._CurrentPage>1&&n.append(this.GetPageBtn(!0,this._CurrentPage-1,-1,null)),u=t;u<=i;u++)e=Math.abs(u-this._CurrentPage),o=null,(e>=2&&this._CurrentPage<9||e>=1&&this._CurrentPage>=9)&&(o="hide-on-small-only"),n.append(this.GetPageBtn(u==this._CurrentPage,u,0,o));this._CurrentPage<r&&n.append(this.GetPageBtn(!0,this._CurrentPage+1,1,null));i<r&&n.append(this.GetPageBtn(!0,r,2,null));$("a",n).click(this,this.HandlePageChange);s=n.html();n=this._PaginationBot;n.empty();n.html(s);$("a",n).click(this,this.HandlePageChange)},GetPageBtn:function(n,t,i,r){var h=this._Events,f="waves-effect",u,e,o,s;return i==-2?u=$("<i>",{"class":"material-icons"}).text("first_page"):i==-1?u=$("<i>",{"class":"material-icons"}).text("chevron_left"):i==1?u=$("<i>",{"class":"material-icons"}).text("chevron_right"):i==2?u=$("<i>",{"class":"material-icons"}).text("last_page"):(n&&(f+=" active"),u=t),r!=null&&r!=""&&(f+=" "+r),e=$("<li>",{"class":f}),s=n^i==0?(h?"/ereignisse":"/logs")+"/seiten/"+this._Elems+"/"+t:"",o=$("<a>",{href:s}).appendTo(e),o.append(u),e},HandlePageChange:function(n){var r=n.data,u,t,f,i;n.preventDefault();u=$(n.currentTarget);t=u.attr("href");t!=null&&t!=""&&(f=t.split("/"),i=parseInt(f[4]),isNaN(i)||(r.SetPage(i),r.RenderPagination()))}};_AvailablePlugins.logview=function(){var n=this;$(function(){n.Initialize()})};_AvailablePlugins.logview.prototype={_pseudo:$("<div>"),_scroll2:$("<div>"),_real:$("<div>"),_scroll1:$("<div>"),Initialize:function(){var n=this,t;(this._pseudo=$("#pseudoContent"),this._scroll2=$("#logScrollbar"),this._real=$("#logContent pre"),this._scroll1=$("#logContent"),this._real.length==1)&&(t=this._real[0].scrollWidth,this._pseudo.height(5),this._pseudo.width(t),this._scroll1.scroll({s1:this._scroll1,s2:this._scroll2},this.ScrollHandler),this._scroll2.scroll({s2:this._scroll1,s1:this._scroll2},this.ScrollHandler),$(window).resize(function(){n.ResizeHandler()}),$(window).scroll(function(){n.ResizeHandler()}),this.ResizeHandler())},ScrollHandler:function(n){n.data.s2.scrollLeft(n.data.s1.scrollLeft())},ResizeHandler:function(){var n=this._scroll1.offset().top+this._scroll1[0].scrollHeight,t=0-(n-window.scrollY-window.innerHeight)-this._scroll2.height()+this._scroll2[0].clientHeight;this._scroll2.css({display:t>0?"none":"block",left:this._scroll1.position.left+"px",width:this._scroll1.width()+"px"})}};_AvailablePlugins.modal=function(n){this.lang={yes:"ja",no:"nein",cancel:"Abbrechen"};typeof n!="undefined"&&(this.lang=$.extend(this.lang,n));this.prepare();window.Modal=this};_AvailablePlugins.modal.prototype={result:null,visible:!1,prep:!1,modals:[],elems:{},currentIdx:0,Show:function(n,t,i,r){typeof r=="undefined"&&(r=!1);typeof i=="undefined"&&(i=function(){});var u={t:n,m:t,cb:i,yn:r,res:null};this.modals.push(u);this.showNextModal()},showNextModal:function(){if(!this.visible){this.visible=!0;var n=this.modals[0];this.elems.title.empty();this.elems.title.append(n.t);this.elems.body.empty();this.elems.body.append(n.m);n.yn?(this.elems.yesno.removeClass("hide"),this.elems.ok.addClass("hide")):(this.elems.ok.removeClass("hide"),this.elems.yesno.addClass("hide"));this.box.modal("open")}},prepare:function(){var r,u,f,t,e,o,s,h,c;if(!this.prep){this.prep=!0;var n=this,l=$("<div>").prependTo($(document.body)),i=$("<div>",{"class":"modal",id:"modalbox"}).appendTo(l);this.box=i;r=$("<div>",{"class":"modal-content"}).appendTo(i);this.elems.title=$("<h4>").appendTo(r);u=$("<p>").appendTo(r);f=$("<div>",{"class":"modal-footer"}).appendTo(i);this.elems.title.text(this.title);this.elems.body=u;u.append(this.msg);t=$("<div>",{"class":"hide"}).appendTo(f);e=$("<div>",{"class":"hide"}).appendTo(f);this.elems.yesno=t;this.elems.ok=e;o=$("<a>",{"class":"modal-action modal-close waves-effect waves-green btn-flat",href:"#!"}).appendTo(t);o.text(this.lang.yes);o.click(function(){n.setCurrentResult(!0)});s=$("<a>",{"class":"modal-action modal-close waves-effect waves-red btn-flat",href:"#!"}).appendTo(t);s.text(this.lang.no);s.click(function(){n.setCurrentResult(!1)});h=$("<a>",{"class":"modal-action modal-close waves-effect btn-flat",href:"#!"}).appendTo(t);h.text(this.lang.cancel);h.click(function(){n.setCurrentResult(null)});c=$("<a>",{"class":"modal-action modal-close waves-effect waves-orange btn-flat",href:"#!"}).appendTo(e);c.text("OK");c.click(function(){n.setCurrentResult(null)});this.box.modal({complete:function(){n.runCleanup()}})}},setCurrentResult:function(n){var t=this.modals[0];t.res=n},runCleanup:function(){var n=this.modals[0];try{n.cb(n.res)}catch(t){console.log(t)}this.modals.shift();this.visible=!1;this.modals.length>0&&this.showNextModal()}}