summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2018-02-16 18:59:40 +0100
committerhorchi <vdr@jwendel.de>2018-02-16 18:59:40 +0100
commitb2fb1c3c3b33ce7d7e4e88e02f29bb6aabad5d00 (patch)
treea5f36fe231022a7954f2edbd7cf0eec37ddac19b
parentf91afbf2343fb96ce30628243e97c4a99bfee6da (diff)
parent53d4aa03a6190d5fd9e055c9814374edae0fafe7 (diff)
downloadvdr-epg-daemon-b2fb1c3c3b33ce7d7e4e88e02f29bb6aabad5d00.tar.gz
vdr-epg-daemon-b2fb1c3c3b33ce7d7e4e88e02f29bb6aabad5d00.tar.bz2
Merge branch 'master' of projects.vdr-developer.org:vdr-epg-daemon
* 'master' of projects.vdr-developer.org:vdr-epg-daemon: updated configs/eventsview-ck.sql 2018-02-14: version 1.1.134 (horchi)\n - bugfix: Fixed handling of timer type change by WEBIF\n\n 2018-02-14: version 1.1.133 (horchi)\n - bugfix: Fixed display of external timer in WEBIF lists\n\n 2018-02-10: version 1.1.132 (rechner)\n - chanhed: text for swichtimer and highlight recIcon on success\n\n
-rw-r--r--HISTORY.h13
-rw-r--r--configs/eventsview-ck.sql13
-rw-r--r--http/src/js/eventDetail.js12
-rw-r--r--http/src/lang/de.js1
-rw-r--r--http/www/epgd.js2
-rw-r--r--httpd.c2
-rw-r--r--webdo.c4
-rw-r--r--webstore.c7
8 files changed, 31 insertions, 23 deletions
diff --git a/HISTORY.h b/HISTORY.h
index bf30850..83f2b84 100644
--- a/HISTORY.h
+++ b/HISTORY.h
@@ -4,8 +4,8 @@
* -----------------------------------
*/
-#define _VERSION "1.1.131"
-#define VERSION_DATE "10.02.2018"
+#define _VERSION "1.1.134"
+#define VERSION_DATE "14.02.2018"
#define DB_API 6
#ifdef GIT_REV
@@ -18,6 +18,15 @@
* ------------------------------------
*
+2018-02-14: version 1.1.134 (horchi)
+ - bugfix: Fixed handling of timer type change by WEBIF
+
+2018-02-14: version 1.1.133 (horchi)
+ - bugfix: Fixed display of external timer in WEBIF lists
+
+2018-02-10: version 1.1.132 (rechner)
+ - change: text for swichtimer and highlight recIcon on success
+
2018-02-10: version 1.1.131 (horchi)
- added: Support delete for switch timer
- added: Table for recording images (still under development)
diff --git a/configs/eventsview-ck.sql b/configs/eventsview-ck.sql
index 89debde..2bb3800 100644
--- a/configs/eventsview-ck.sql
+++ b/configs/eventsview-ck.sql
@@ -1,16 +1,5 @@
CREATE VIEW eventsview as select cnt_useid useid, cnt_eventid eventid, cnt_channelid channelid, cnt_source source, all_updsp updsp, cnt_updflg updflg, cnt_delflg delflg, cnt_fileref fileref, cnt_tableid tableid, cnt_version version, sub_title title,
-case when sub_shorttext is null then
- concat(
- case when length(ifnull(sub_genre,'')) > 0 then sub_genre else '' end,
- case when length(ifnull(sub_genre,'')) > 0 and length(ifnull(sub_country,'')) + length(ifnull(sub_year,'')) > 0 then ' (' else '' end,
- case when length(ifnull(sub_country,'')) > 0 then sub_country else '' end,
- case when length(ifnull(sub_country,'')) > 0 and length(ifnull(sub_year,'')) > 0 then ' ' else '' end,
- case when length(ifnull(sub_year,'')) > 0 then sub_year else '' end,
- case when length(ifnull(sub_genre,'')) > 0 and length(ifnull(sub_country,'')) + length(ifnull(sub_year,'')) > 0 then ')' else '' end
- )
-else
- sub_shorttext
-end shorttext,
+case when sub_shorttext is null or sub_compshorttext = sub_comptitle then '' else sub_shorttext end shorttext,
case when sub_longdescription is Null then
cnt_longdescription
else
diff --git a/http/src/js/eventDetail.js b/http/src/js/eventDetail.js
index 6574aab..d206dcd 100644
--- a/http/src/js/eventDetail.js
+++ b/http/src/js/eventDetail.js
@@ -68,8 +68,9 @@ epgd.eventDetail.prototype.doPlay = function (checkAvail) {
var t = parseInt(epgd.utils.now().getTime() / 1000, 10) - this.data.starttime;
if (t > this.data.duration)
return false;
- if (checkAvail) return !!epgd.vdrs.current.uuid;
+ if (checkAvail) return !epgd.vdrs.current.uuid ? false : (t < 0 ? epgd.tr.pages.timerList.newTimer + ': ' : '') + epgd.tr.pages.eventDetail.ch_switch;
if (t < 0 ){ // Umschalttimer
+ t= this.win.$rec;
epgd.pages.timerList.save({
type: 'V',
active: 1,
@@ -77,6 +78,8 @@ epgd.eventDetail.prototype.doPlay = function (checkAvail) {
eventid: this.data.id,
channelid: this.data.channelid,
title: this.data.title
+ },null,null,function(){
+ t.addClass("hasTimer")
});
} else
epgd.vdrs.current.switchChannel(this.data.channelid);
@@ -149,7 +152,7 @@ epgd.eventDetail.win.prototype._create = function () {
toolbar = this.$win.find('.toolbar')[0];
this.$rec= $('<button class="iAsButton i-record"/>').css('float', 'left').appendTo(toolbar).click(function () { win.detail.doRecord() });
$('<button class="iAsButton i-buffer" title="' + tr.repeat + '" />').css('float', 'left').appendTo(toolbar).click(function () { win.detail.doRepeat() });
- this.$play = $('<button class="iAsButton i-tv" title="' + tr.ch_switch + '" />').css('float', 'left').appendTo(toolbar).click(function () { win.detail.doPlay() });
+ this.$play = $('<button class="iAsButton i-tv" />').css('float', 'left').appendTo(toolbar).click(function () { win.detail.doPlay() });
this.$prev = $('<button class="iAsButton i-rewind" title="' + tr.eventPrev + '" />').appendTo(toolbar).click(function () { win.detail.doPrev() });
this.$next = $('<button class="iAsButton i-forward" title="' + tr.eventNext + '" />').appendTo(toolbar).click(function () { win.detail.doNext() });
$('<button class="iAsButton i-cancel" title="' + epgd.tr.close + '" />').css('float', 'right').appendTo(toolbar).click(function () { $(window).trigger("epgd_close.eventDetail"); });
@@ -427,7 +430,8 @@ epgd.eventDetail.win.prototype.render = function (detail) {
}
});
this.$rec.toggleClass("hasTimer", !!e.timerid).prop("title", this.detail.doRecord(true));
- this.$play.toggle(this.detail.doPlay(true));
+ i= this.detail.doPlay(true);
+ this.$play.toggle(!!i).prop("title", i);
this.$prev.toggle(this.detail.doPrev(true));
this.$next.toggle(this.detail.doNext(true));
this.$con.find('.channel .i-tv').click(function () { epgd.vdrs.current.switchChannel(this.parentNode.id); });
@@ -468,7 +472,7 @@ epgd.recordDetail.prototype.doRecord = function (eData) {
epgd.eventDetail.prototype.doRecord.call(this, eData);
}
epgd.recordDetail.prototype.doPlay = function (checkAvail) {
- if (checkAvail) return true;
+ if (checkAvail) return epgd.tr.pages.eventDetail.play;
epgd.ajax({ url: epgd.login.url + 'data/replayrecording?vdruuid=' + ( !epgd.vdrs.list[this.data.vdruuid].usecommonrecfolder ? this.data.vdruuid : epgd.vdrs.current.uuid ) + '&starttime=' + this.data.starttime + '&md5path=' + this.data.md5path + '&owner=' + (this.data.owner || ''), cache: false }, function (data) {
epgd.utils.popup(data.result.message, { title: 'VDR', autoClose: 5000 });
});
diff --git a/http/src/lang/de.js b/http/src/lang/de.js
index 4d8a631..5ba75b7 100644
--- a/http/src/lang/de.js
+++ b/http/src/lang/de.js
@@ -133,6 +133,7 @@ epgd.tr = {
record: "Aufnehmen",
repeat: "Wiederholungen",
ch_switch: "umschalten",
+ play: "abspielen",
eventNext: "nachfolgend",
eventPrev: "vorher",
parentalrating: 'ab ',
diff --git a/http/www/epgd.js b/http/www/epgd.js
index 4d2c66f..79bebb8 100644
--- a/http/www/epgd.js
+++ b/http/www/epgd.js
@@ -1 +1 @@
-var epgd={};epgd.tr={oClock:"Uhr",minutes:"min",save:"speichern",copy:"kopieren",apply:"übernehmen",close:"schließen",clear:"löschen",yes:"ja",no:"nein",edit:"bearbeiten",cancel:"abbrechen",del:"löschen",test:"testen",reload:"neu laden",advanced:"erweitert",markAll:"alle markieren",markNone:"keinen markieren",markToggle:"Markierung umdrehen",confirmDelete:"Willst du wirklich löschen?",dataSaved:"Daten wurden gespeichert",dataDeleted:"Daten wurden gelöscht",dataSend:"Daten wurden gesendet",channel:"Kanal",date:"Datum",entries:" Einträge",error:{error:"Fehler",common:"Es ist ein allgemeiner Fehler aufgetreten",serverNotResponse:"Der Server konnte nicht erreicht werden!",notImplemented:"Dieses Feature ist zur Zeit noch nicht implementiert",forbidden:"Zugriff verweigert!",noData:"Für diese Anfrage konnten keine Daten ermittelt werden!",emptyField:"Bitte fülle das Feld $field$ aus!",invalid:"Der eingegebene Wert ist ungültig!"},menu:{now:"Programm",magazine:"Magazin",timer:"Timer",records:"Aufnahmen",search:"Suche",options:"Einstellungen",help:"Hilfe"},pages:{now:{at:"am"},timer:{timerList:"Timer",searchTimerList:"Suchtimer",timersDone:"kürzliche Aufträge",timerListDone:"Auftragshistorie",timerJobList:"asynchrone Aufträge",messageList:"Systemmeldungen"},timerList:{empty:"Keine Timer vorhanden!",startTime:"Anfang",endTime:"Ende",folder:"Verzeichnis",file:"Dateiname",recordTime:"Aufnahmezeit",lifetime:"Lebenszeit",prio:"Priorität",inactive:"Inaktiv",newTimer:"Neuen Timer anlegen",namingMode:"Ermittlung des Dateinamens",namingModes:["VDR","Auto","Constable","Serie","Kategorisiert","Usermode","Template"],template:"Template",templateFields:{"%title%":": Titel (EPG)","%shorttext%":": Untertitel (EPG)","%starttime%":": Startzeit (EPG)","%year%":": Jahr (EPG)","%category%":": Kategorie (EPG)","%episodname%":": Titel der Serie (constabel)","%shortname%":": Kurz-Titel der Serie (constabel, optional)","%partname%":": Name der Folge (constabel)","%season%":": Staffel (constabel)","%part%":": Teil der Staffel (constabel)","%number%":": Nummer über alle Staffeln (constabel)","%extracol1%":": Zusätzliche Angaben z.B. bei Tatort die Ermittler (constabel, optional)","%extracol2%":": ... z.B. bei Tatort der Ort (constabel, optional)","%extracol3%":": ... z.B. bei Tatort der Sender (constabel, optional)"},episode:"Serientitel",noEpgMatch:"Ignoriere fehlende EPG Info",noRepeat:"Wiederholungen vermeiden",searchTimerReload:"Suchtimer updaten",chInclude:"Auf Kanäle einschränken",chExclude:"Kanäle ausschließen",nextDays:"innerhalb der nächsten $field$ Tage",confirmSaveBigResult:"Die Suche ergibt $cnt$ Treffer, trotzdem speichern?",timerStates:{D:"gelöscht",E:"Fehler",F:"Aufnahme erfolgreich",P:"wartet auf Start",R:"nimmt gerade auf...",U:"unbekannt"},timerActions:{C:"Timer wurde erstellt und muss noch von einem VDR übernommen werden",D:"Timer wurde gelöscht und muss noch im VDR gelöscht werden",F:"Zuweisung Timer an VDR fehlgeschlagen",M:"Timer wurde verändert und muss noch vom VDR verarbeitet werden"},doneStates:{f:"Timer konnte nicht erstellt werden",C:"Timer bereits erstellt",D:"Timer gelöscht",F:"Aufnahme fehlgeschlagen",Q:"Timer in Vorbereitung",R:"Aufnahme fertig"},messageStates:{N:"Neu",R:"gelesen"},messageTypes:{I:"Information",W:"Warnung",E:"Fehler",F:"Fataler Fehler"},chFormat:"bevorzugtes Sendeformat"},eventDetail:{record:"Aufnehmen",repeat:"Wiederholungen",ch_switch:"umschalten",eventNext:"nachfolgend",eventPrev:"vorher",parentalrating:"ab ",mergeSrc:"Quelle ",genre:"Genre",category:"Kategorie",country:"Land",year:"Jahr",season:"Staffel",part:"Folge",number:"Folge Insgesamt",extentedInfo:"weitere Informationen",scrapperMovieInfo:"Filminformation",scrapperSerieInfo:"Serieninformation",constabelInfo:"Constabel Episodenliste",addConstableLink:"Link erzeugen",loginConstable:"Login",title:"Titel",original_title:"Originaltitel",runtime:"Laufzeit",lang:"Sprache",release_date:"Erscheinungsdatum",actors:"Schauspieler",network:"Netzwerk",seriesstatus:"Status",gueststars:"Gäste",homepage:"Webseite",popularity:"Beliebtheit",vote_average:"&oslash; Bewertung",extInfo:{director:"Regie",camera:"Kamera",screenplay:"Drehbuch",producer:"Produktion",music:"Musik",moderator:"Moderator",commentator:"Kommentator",guest:"Gäste",info:"Info",other:"Sonstige"}},options:{profile:"allgemein",editChannels:"Kanäle bearbeiten",editUser:"Benutzer bearbeiten"},editChannels:{menu:{channelList:"Kanalliste",referenceList:"Referenzliste",insertAsText:"als Text einfügen",extentEmptyChannelNames:"leere Kanalnamen ergänzen",applyAllChannelNames:"Alle Kanalnamen übernehmen",applyChannelSort:"Kanalsortierung übernehmen"},headline:"Sortierung der Kanäle durch drag und drop, Blockmarkierung durch zus. gedrückter shift-Taste",checkWeb:"Kanal in Webansicht anzeigen",checkVDR:"Kanal zum VDR übertragen",desc_insertList:"Kopiere den Inhalt einer channels.conf in das Textfeld unten. Eine vollständige Liste gibt es beispielsweise hier:"},editUser:{user:"Benutzer",sel:"auswählen",add:"neu anlegen",active:"Aktiv",inActive:"Inaktiv",rights:{label:"Rechte",umConfig:"Konfiguration lesen",umConfigEdit:"Konfiguration ändern",umConfigUsers:"Benutzer konfigurieren",umTimer:"Timer lesen",umTimerEdit:"Timer bearbeiten",umSearchTimer:"Suchtimer lesen",umSearchTimerEdit:"Suchtimer bearbeiten",umFsk:"FSK",umRecordings:"Aufnahmen lesen",umRecordingsEdit:"Aufnahmen editieren"}},help:{url:"lang/hilfe.html",noHelp:"Hierzu konnte kein Hilfstext gefunden werden"},search:{search:"suchen",searchName:"Name",searchExpression:"Suchausdruck",caseSensitive:"Klein-/Großschreibung",searchModes:["exakte Übereinstimmung","regulärer Ausdruck","Muster","enthalten in"],searchFields:["Titel","Kurztext","Beschreibung"],empty:"Leider nichts gefunden.",matchdensity:"Treffergenauigkeit"},login:{label:"Login",userName:"Benutzername",password:"Passwort",loggedAlwaysIn:"angemeldet bleiben",logout:"Abmelden",error:"Fehler beim Anmelden!",logoutMessage:"Du wurdest abgemeldet!",needLogin:"Login erforderlich"},records:{ddLabel:"Drag und Drop",refreshMessage:"Aufnahmelisten werden neu geladen, Seite lädt in $sec$ Sekunden neu",moveMessage:"Aufnahme verschieben von \n$src$\nnach",notFoundMessage:"Aufnahme nicht gefunden, ggf einmal aktualisieren",deleteMessage:"Soll die Aufnahme $src$ wirklich gelöscht werden?",available:"Verfügbar",commonRecFolder:"gemeinsame Aufnahmen",similarTimer:"ähnliche Sendung aufnehmen"},profile:{mailReceiver:"eMail",sendTCC:"sende Mail bei Timerkonflikten",sendMessages:"sende Mail bei Systemmeldungen",magazinePan:"Scrollgeschwindigkeit in Minuten<br />(0 = aus)",magazinePanDelay:"Auslöseverzögerung",maxListEntries:"maximal Anzahl Einträge, die auf einmal vom Server geladen werden sollen, z.B. bei Suchen, Suchtimern usw.",system:{label:"epgd Backend"},vdr:{startWithSched:"EPG Menü startet mit Schedule"},record:{subFolderSort:"Sortierung der Unterordner"}}},dateTimePicker:{monthNames:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthNamesShort:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],dayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],dayNamesShort:["So","Mo","Di","Mi","Do","Fr","Sa"],dayNamesMin:["So","Mo","Di","Mi","Do","Fr","Sa"],weekHeader:"KW",timeOnlyTitle:"Zeit wählen",timeText:"Sendungsbeginn",timeTextBetween:"zwischen",prevText:"&#x3C;Zurück",nextText:"Vor&#x3E;",currentText:"Jetzt",closeText:"Fertig",hourText:"Stunde",minuteText:"Minute",secondText:"Sekunde",millisecText:"Millisekunde",microsecText:"Mikrosekunde",timezoneText:"Zeitzone",timeFormat:"HH:mm",dateFormat:"D, dd.mm.yy",amNames:["vorm.","AM","A"],pmNames:["nachm.","PM","P"],isRTL:false,showMonthAfterYear:false,yearSuffix:""}};epgd.profile={needLogin:-1,channelLogoPath:"data/channellogo",eventImgPath:"data/eventimg",movieMediaPath:"data/moviemedia",serieImgPath:"data/seriesmedia",movieActorPath:"http://www.themoviedb.org/person/",serieSeasonPath:"http://www.thetvdb.com/?tab=seasonall&id=",constabelEditPath:"https://www.eplists.de/eplist.cgi?action=edit&back=&file=",constabelLinkPath:"https://www.eplists.de/eplist.cgi?action=show_form_redir&linkname=",minEventTime:0,maxEventTime:0,logoShowName:0};epgd.userProfile_defaults={defaultVDRuuid:"",constabelLoginPath:false,pickerFirstDay:"6",quickTimes:"",startWithSched:0,startPage:"menu_options",namingModeSerie:"0",namingModeSearchSerie:"0",namingModeMovie:"0",namingModeSearchMovie:"0",namingModeSerieTemplate:"",namingModeSearchSerieTemplate:"",namingModeMovieTemplate:"",namingModeSearchMovieTemplate:"",chFormat:"",timerDefaultVDRuuid:"",searchAdv:"0",mailReceiver:"",messageMailTypes:"",magazinePan:10,magazinePanDelay:400,maxListEntries:100,ratings:"",recordSubFolderSort:1};epgd.profile_load=function(b){var a=$.extend(epgd.profile,epgd.userProfile_defaults);epgd.ajax({url:epgd.login.url+"data/parameters",async:false,cache:false,dataType:"json"},function(l){var m,g,d,c,e,h={};for(g in l.parameters){m=l.parameters[g];c=a[m.name];if(c!=undefined&&c!=m.value){a[m.name]=m.type===0?parseInt(m.value,10):m.value;h[m.name]=c;if(m.name.indexOf("logo")==0){epgd.channels.isDirty=true}}}if(epgd.utils.timeOffset==null){epgd.utils.timeOffset=(l.timezone-new Date().getTimezoneOffset()*60)*1000;e=epgd.utils.now();epgd.$dtPicker.datetimepicker("setDate",new Date(e.setMinutes(parseInt(e.getMinutes()/15,10)*15)))}if(!a.minEventTime){e=epgd.utils.now();a.minEventTime=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0).getTime()/1000;h.minEventTime=0}if(!a.maxEventTime){a.maxEventTime=a.minEventTime+8*24*60*60-60;h.maxEventTime=0}for(d in h){$(window).trigger("profile_updated",h);break}epgd.channels.isDirty&&epgd.channels.load()})};epgd.pages={};epgd.login={user:"",session:"",rights:-1,url:""};epgd.rights={umConfig:2,umConfigEdit:4+2,umConfigUsers:8,umTimer:64,umTimerEdit:128+64,umSearchTimer:256+64,umSearchTimerEdit:512+256+128+64,umFsk:4096,umRecordings:32768,umRecordingsEdit:65536+32768};epgd.utils={timeOffset:null,now:function(){return new Date(new Date().getTime()-this.timeOffset)},date:function(a){return new Date(a*1000-this.timeOffset)},unixTime:function(a){return a?parseInt((a.getTime()+this.timeOffset)/1000,10):0},formatTime:function(a){var b=new Date(a*1000-this.timeOffset);return new String(100+b.getHours()).slice(1)+":"+new String(100+b.getMinutes()).slice(1)},formatDateTime:function(b,a){var c=new Date(b*1000-this.timeOffset);return $.datepicker.formatDate((a||epgd.tr.dateTimePicker.dateFormat),c)+" "+new String(100+c.getHours()).slice(1)+":"+new String(100+c.getMinutes()).slice(1)},formatDate:function(b,a){var c=new Date(b*1000-this.timeOffset);return $.datepicker.formatDate((a||epgd.tr.dateTimePicker.dateFormat),c)},popup:function(b,c){var d=$(window),a;c=$.extend({autoOpen:true,dialogClass:"popup",show:{effect:"blind",duration:1000},hide:{effect:"explode",duration:1000},width:400,height:200,maxWidth:d.width()*0.8,maxHeight:d.height()*0.7},c);a=$('<div class="epgPopUp"><p>'+b+"</p></div>").dialog(c);c.autoClose&&window.setTimeout(function(){a.dialog("close").dialog("destroy")},c.autoClose);return a},confirm:function(a,c){var b={modal:true,buttons:{}};b.buttons[epgd.tr.yes]=function(){$(this).dialog("close");c(true)};b.buttons[epgd.tr.no]=function(){$(this).dialog("close");c(false)};this.popup(a,b)},topInfo:function(b,c){var e=c&&c.isError,d,a;c=$.extend({autoClose:e?0:3000,className:"ui-state-"+(e?"error":"highlight")},c);a=(c.autoClose||3000)/2;d=$('<div class="topInfo ui-corner-all '+c.className+'">'+b+'<button onclick="$(this).parent().remove();" class="iAsButton i-cancel" title="'+epgd.tr.close+'"></button></div>').appendTo(epgd.$menu).animate({opacity:0.4},a,function(){d.animate({opacity:1},a)});c.autoClose&&window.setTimeout(function(){d.remove()},c.autoClose)},sendMail:function(c,a,b,d){epgd.ajax({url:epgd.login.url+"data/sendmail",type:"post",data:JSON.stringify({receiver:(d||epgd.profile.mailReceiver),subject:c,body:a,mimetype:b})},function(e){e=e.result;if(e&&e.state==200){epgd.utils.topInfo(epgd.tr.dataSend)}else{epgd.utils.topInfo(e.message,{isError:1})}epgd.profile_load()})},loader:{$win:$('<div style="position:absolute;z-index:9999;width:100%;height:100%;position:fixed;left:0px;top:0px;background:url(images/loader.png) no-repeat 50% 50%"></div>'),cnt:0,process:function(b,c){var a=this;this.cnt++;this.$win.appendTo(document.body).stop().animate({opacity:0.7},{always:function(){try{b()}catch(d){epgd.utils.log((d.message||"common error")+"\n"+(d.stack||""),0);a.close()}!c&&a.close()}},200)},close:function(){if(this.cnt>0){this.cnt--;this.cnt==0&&this.$win.remove()}}},addAutoComplete:function(d,b){var c=$(d),e=c[0].className,a=c[0].style.width||"";$(d).autocomplete($.extend({minLength:0,multiselect:false,create:function(i,m){var l=$(this).autocomplete("instance"),n=l.options,k,h;l.selectedItems={};if(n.multiselect){l.multiselect=$("<div></div>").addClass("ui-autocomplete-multiselect ui-state-default ui-widget "+e).css("width",a).insertBefore(l.element).append(l.element).bind("click.autocomplete",function(){l.element.focus()});l.menu.element.css({height:"300px","overflow-y":"auto"});k=parseInt(l.element.css("fontSize")||10,10);function g(p){var o=$(this);o.width(1).width(this.scrollWidth+k-1)}h=$.ui.keyCode;l.element.bind({"keydown.autocomplete":function(p){if((this.value==="")&&(p.keyCode==h.BACKSPACE)){var o=l.element.prev();delete l.selectedItems[o.text()];o.remove()}},"focus.autocomplete blur.autocomplete":function(){l.multiselect.toggleClass("ui-state-active")},"keypress.autocomplete change.autocomplete focus.autocomplete blur.autocomplete":g}).trigger("change");n.select=n.select||function(p,o){if(!l.selectedItems[o.item.label]){$("<div></div>").addClass("ui-autocomplete-multiselect-item").text(o.item.label).append($("<span></span>").addClass("ui-icon ui-icon-close").click(function(){var q=$(this).parent();delete l.selectedItems[q.text()];q.remove()})).insertBefore(l.element);l.selectedItems[o.item.label]=o.item}l._value("");return false}}else{n.select=n.select||function(p,o){l.selectedItems[0]=o.item;l._value(o.item.label);return false}}}},b)).focus(function(){$(this).autocomplete("search","")})},getAutoCompleteValues:function(i,c){c=c||"";var b="",a=","+c,g,d;try{g=$(i).autocomplete("instance").selectedItems;for(d in g){b+=a+g[d].value+c}}catch(h){}return b.slice(1)},setAutoCompleteValues:function(g,a){var d=$(g).autocomplete("instance"),c,b,e;d.multiselect&&d.multiselect.find(">div").remove();d.selectedItems={};if(a){for(b=0;b<a.length;b++){c=null;e=new RegExp($.ui.autocomplete.escapeRegex(a[b]),"i");$.each(d.options.source,function(){if(e.test(this.value||this.label||this)){return !(c=this)}});if(c){d._trigger("select",null,{item:c.label?c:{label:c,value:c}})}}}},addPlaceholders:function(g,d,a){var b=$(g)[0],c='<ul class="placeholders ui-menu ui-widget ui-widget-content">',e;for(e in a){c+='<li class="ui-menu-item"><b>'+e+"</b>"+a[e]+"</li>"}b.$placeholders=$(c+"</ul>").hide().insertAfter(b).click(function(i){var k=i.target.nodeName=="B"?$(i.target).text():i.target.nodeName=="LI"?$(i.target.firstChild).text():null,l=$(b).prop("selectionStart"),h=$(b).val();if(k){$(b).val(h.substring(0,l)+k+h.substring(l,h.length)).focus();l+=k.length;if(b.setSelectionRange){b.setSelectionRange(l,l)}else{if(b.createTextRange){h=b.createTextRange();h.collapse(true);h.moveEnd("character",l);h.moveStart("character",l);h.select()}}}$(this).hide()});$(b).keydown(function(h){if(h.key==d){$(document).one("click",function(){b.$placeholders.hide()});b.blur();return !b.$placeholders.show().position({my:"left top",at:"left bottom",of:b})}})},inherits:function(a,c){var b=function(){};b.prototype=c.prototype;a.prototype=new b();a.prototype.constructor=a;a.base=c.prototype;return a},log:function(a,c){console.log("error:"+a);try{$.ajax({url:"data/log",type:"get",async:true,cache:false,data:"level="+(c||0)+"&message="+escape(a)})}catch(b){}}};epgd.init=function(){epgd.$con=$('<div id="content"></div>').appendTo(document.body);$.datepicker.setDefaults(epgd.tr.dateTimePicker);$.datepicker.setDefaults({showOtherMonths:true,selectOtherMonths:true});$.timepicker.setDefaults(epgd.tr.dateTimePicker);$.timepicker.setDefaults({timeInput:true,controlType:{create:function(b,g,e,h,c,a,d){if(e=="hour"){if(!b.inst.settings.timeOnly){$("#ui-datepicker-div").width(($(window).width()>500?430:230)+"px")}$("<span><u>0</u><u>2</u><u>4</u><u>6</u><u>8</u><u>10</u><br /><u>12</u><u>14</u><u>16</u><u>18</u><u>20</u><u>22</u><span>").appendTo(g).bind("click",{tp_inst:b,obj:g,unit:e},$.timepicker.quicklink)}else{if(e=="minute"){$("<span><u>0</u><u>15</u><u>30</u><u>45</u><span>").appendTo(g).bind("click",{tp_inst:b,obj:g,unit:e},$.timepicker.quicklink)}else{if(e=="second"&&epgd.profile.quickTimes){g.closest("dl").find(".ui_tpicker_time").removeClass().bind("click",{tp_inst:b,obj:g,unit:"time"},$.timepicker.quicklink).html('<i><u title="'+epgd.profile.quickTimes.replace(/[^=~]+=@[a-z]+/gi,"").replace(/~{2,}/g,"~").replace(/=!?/g,'">').replace(/~/g,'</u></i><i><u title="')+"</u></i>");if(b.inst.settings.alwaysSetTime){epgd.pages.help.initButtons(b.inst.dpDiv.find(".ui-datepicker-buttonpane").append(epgd.pages.help.getButton("datepicker")))}else{$('<button class="iAsButton i-cancel" role="button">'+epgd.tr.clear+"</button>").appendTo(b.inst.dpDiv.find(".ui-datepicker-buttonpane")).click(function(){b.$input.val("");$.datepicker._hideDatepicker()})}return g}else{return g}}}$('<input class="ui-timepicker-input" value="'+h+'" style="width:20px">').prependTo(g).spinner({min:c,max:a,step:d,change:function(k,i){if(k.originalEvent!==undefined){b._onTimeChange()}b._onSelectHandler()},spin:function(k,i){b.control.value(b,g,e,i.value);b._onTimeChange();b._onSelectHandler()}});return g},options:function(a,d,c,b,e){if(typeof(b)=="string"&&e!==undefined){return d.find(".ui-timepicker-input").spinner(b,e)}return d.find(".ui-timepicker-input").spinner(b)},value:function(a,d,b,g){try{if(g!==undefined){return d.find(".ui-timepicker-input").spinner("value",g)}return d.find(".ui-timepicker-input").spinner("value")}catch(c){return false}}}});epgd.$menu=$('<nav id="menu-top"><ul id="ui-menu-top"><li id="menu_login"><a href="#menu_login">'+epgd.tr.pages.login.label+"</a></li></ul></nav>").appendTo(document.body).find("ul").hide();epgd.$menu.$maxBut=$('<span class="maxi i-menu" />').insertBefore(epgd.$menu).click(function(){epgd.$menu.parent().toggleClass("open")});epgd.$menu.checkMenuSize=function(a,b){if(window.wrm_i){if(window.wrm_w==$(window).width()){window.clearInterval(window.wrm_i);delete window.wrm_i;epgd.$menu.parent().removeClass("mini").width(window.wrm_w).offset({left:$(window).scrollLeft()});epgd.$menu.checkMenuSize(null,b)}else{window.wrm_w=$(window).width()}return}if(a){window.wrm_w=$(window).width();if(!window.wrm_i){window.wrm_i=window.setInterval(epgd.$menu.checkMenuSize,200,null,b)}}else{if(epgd.$menu.height()>40){epgd.$menu.parent().addClass("mini")}window.setTimeout(function(){document.body.style.paddingTop=(epgd.$menu.parent().height()+10)+"px";b&&window.setTimeout(b,200)},200)}};$(window).bind("resize",epgd.$menu.checkMenuSize);epgd.$dtPicker=$('<input type="text" id="selDate" readonly style="z-index:199;position:relative" />').appendTo(document.body).hide().bind("click",function(){$(this).datepicker("show");return false});epgd.$dtPicker.datetimepicker({beforeShow:function(){this.$overlay=$("<div />").addClass("ui-widget-overlay ui-front").appendTo(document.body)},onClose:function(){this.$overlay.remove();$(window).trigger("datepicker")},calendarStart:function(){var a=new Date(epgd.profile.minEventTime*1000);leadDays=(a.getDay()-parseInt(epgd.profile.pickerFirstDay,10)+7)%7;a.setHours(12,0);a.setDate(a.getDate()-leadDays);return a}});epgd.$menu.menu({position:{at:"left bottom"},select:function(a,b){var c=b.item.attr("id");if(!c||c.indexOf("menu_")!=0||(a.originalEvent&&a.originalEvent.target.nodeName!="A"&&a.originalEvent.target.nodeName!="LI")){return false}$(window).trigger("epgd_close");epgd.$menu.parent().removeClass("open");$(".menu-active",this).removeClass("menu-active");$(document.body).append(epgd.$dtPicker.hide());epgd.$menu.checkMenuSize(null,function(){try{b.item.addClass("menu-active").parent().parent(".ui-menu-item").addClass("menu-active");epgd.pages[c.slice(5)].render()}catch(d){epgd.utils.popup(epgd.tr.error.common,{title:epgd.tr.error.error});epgd.utils.log((d.message||"common error")+"\n"+(d.stack||""),2)}})}});$(window).bind("epgd_close",function(){$(".epgPopUp").dialog("destroy")}).bind("profile_updated",function(b,a){if(a.minEventTime!=undefined){epgd.$dtPicker.datetimepicker("option",{minDateTime:new Date((epgd.profile.minEventTime=parseInt(epgd.profile.minEventTime,10))*1000),minDate:new Date(epgd.profile.minEventTime*1000)})}if(a.maxEventTime!=undefined){epgd.$dtPicker.datetimepicker("option",{maxDateTime:new Date((epgd.profile.maxEventTime=parseInt(epgd.profile.maxEventTime,10))*1000),maxDate:new Date(epgd.profile.maxEventTime*1000)})}if(a.pickerFirstDay!=undefined){epgd.$dtPicker.datetimepicker("option",{firstDay:epgd.profile.pickerFirstDay})}if(a.defaultVDRuuid!=undefined){$("#menu_vdrs > select").val(epgd.profile.defaultVDRuuid)}if(a.quickTimes!=undefined){epgd.pages.magazine.initQT()}if(a.needLogin!=undefined){epgd.pages.login.doLogin()}}).bind("login_changed",function(a,b){epgd.$menu.html("").hide();epgd.$con.html("");if(epgd.login.rights){epgd.$menu.append('<li id="menu_now"><a href="#menu_now">'+epgd.tr.menu.now+"</a></li>");epgd.$menu.append('<li id="menu_magazine"><a href="#menu_magazine">'+epgd.tr.menu.magazine+"</a></li>");(epgd.login.rights&epgd.rights.umTimer)==epgd.rights.umTimer&&epgd.$menu.append("<li><a>"+epgd.tr.menu.timer+'</a><ul><li id="menu_timerList"><a href="#menu_timerList">'+epgd.tr.pages.timer.timerList+"</a></li>"+((epgd.login.rights&epgd.rights.umSearchTimer)==epgd.rights.umSearchTimer?'<li id="menu_searchTimerList"><a href="#menu_searchTimerList">'+epgd.tr.pages.timer.searchTimerList+"</a></li>":"")+'<li id="menu_timersDone"><a href="#menu_timersDone">'+epgd.tr.pages.timer.timersDone+'</a></li><li id="menu_timerListDone"><a href="#menu_timerListDone">'+epgd.tr.pages.timer.timerListDone+'</a></li><li id="menu_timerJobList"><a href="#menu_timerJobList">'+epgd.tr.pages.timer.timerJobList+'</a></li><li id="menu_messageList"><a href="#menu_messageList">'+epgd.tr.pages.timer.messageList+"</a></li></ul></li>");(epgd.login.rights&epgd.rights.umRecordings)==epgd.rights.umRecordings&&epgd.$menu.append('<li id="menu_records"><a href="#menu_records">'+epgd.tr.menu.records+"</a></li>");epgd.$menu.append('<li id="menu_search"><a href="#menu_search">'+epgd.tr.menu.search+"</a></li>");epgd.$menu.append("<li><a>"+epgd.tr.menu.options+'</a><ul><li id="menu_profile"><a href="#menu_profile">'+epgd.tr.pages.options.profile+"</a></li>"+((epgd.login.rights&epgd.rights.umConfigEdit)==epgd.rights.umConfigEdit?'<li id="menu_editChannels"><a href="#menu_editChannels">'+epgd.tr.pages.options.editChannels+"</a></li>":"")+((epgd.login.rights&epgd.rights.umConfigUsers)==epgd.rights.umConfigUsers?'<li id="menu_editUser"><a href="#menu_editUser">'+epgd.tr.pages.options.editUser+"</a></li>":"")+"</ul></li>");epgd.$menu.append('<li id="menu_help"><a href="#menu_help">'+epgd.tr.menu.help+"</a></li>");epgd.$menu.append('<li id="menu_vdrs"><a href="#menu_vdrs">VDR</a><select></select><span><a id="osd2web">-&gt;OSD</a></span></li>')}epgd.profile.needLogin=="1"&&epgd.$menu.append('<li id="menu_login"><a href="#menu_login">'+(epgd.login.session?epgd.login.user+" "+epgd.tr.pages.login.logout:epgd.tr.pages.login.label)+"</a></li>");if(epgd.login.user!=b.user){epgd.profile_load();epgd.channels.isDirty=true;epgd.vdrs.list=null}epgd.channels.load();epgd.vdrs.load();epgd.$menu.show().menu("refresh");epgd.$menu.menu("select",{target:$(epgd.login.rights?(location.hash||"#"+epgd.profile.startPage||"#menu_profile"):"#menu_login")})}).bind("vdrs_load",function(){html="";for(var a in epgd.vdrs.list){html+='<option value="'+a+'"'+(a==epgd.vdrs.current.uuid?"selected":"")+">"+epgd.vdrs.list[a].name+"</option>"}$("<select>"+html+"</select>").replaceAll("#menu_vdrs > select").show().change(function(){var b=epgd.vdrs.current=this.selectedIndex>=0?epgd.vdrs.get(this[this.selectedIndex].value):{};if(b&&b.osd2webp){$("#osd2web").prop("target","osd2web_"+b.name).prop("href","http://"+b.ip+":"+b.osd2webp).click(function(c){c.stopPropagation();return true}).show()}else{$("#osd2web").hide()}}).mousedown(function(b){b.stopPropagation();return true}).click(function(b){return false}).change()}).bind("unload",function(){if(epgd.login.session){epgd.pages.login.doLogin("logout")}});epgd.pages.now.init();epgd.pages.magazine.init();epgd.profile_load();if(epgd.profile.needLogin==-1){epgd.profile.needLogin=0;epgd.pages.login.doLogin()}window.setInterval(epgd.profile_load,3600000)};window.onerror=function(i,g,b,d,c){var a=!d?"":"\ncolumn: "+d;a+=!c?"":"\nerror: "+c.stack;try{epgd.utils.log(i+"\nline: "+b+a,2)}catch(h){}return true};$.widget("custom.catcomplete",$.ui.autocomplete,{_create:function(){this._super();this.widget().menu("option","items","> :not(.ui-autocomplete-category)")},_renderMenu:function(c,b){var d=this,a="";$.each(b,function(g,h){var e;if(h.category!=a){c.append("<li class='ui-autocomplete-category'>"+h.category+"</li>");a=h.category}e=d._renderItemData(c,h);if(h.category){e.attr("aria-label",h.category+" : "+h.label)}})}});$.datepicker._gotoToday=function(c){var b=this._getInst($(c)[0]),a=epgd.utils.now();this._base_gotoToday(c);this._setTime(b,a);this._setDate(b,a);this._hideDatepicker()};$.timepicker.quicklink=function(b){var g=b.target.nodeName=="I"?b.target.firstChild:b.target,a,i=null,h=false;try{a=b.data.tp_inst||$.datepicker._getInst(epgd.$dtPicker[0]).settings.timepicker}catch(c){epgd.utils.log((c.message||"common error")+"\n"+(c.stack||""),2);return false}if(g.nodeName=="U"){if(b.data.unit=="time"){i=$.datepicker.parseTime(a._defaults.timeFormat,g.innerHTML,a._defaults)}else{if(b.data.unit=="hour"){i={hour:parseInt(g.innerHTML,10),minute:a.minute}}}if(i){if(i.hour<a.hour-1){h=true}else{a.control.value(a,a.hour_slider,"hour",i.hour);a._onTimeChange();if(a.hour!=i.hour){h=true}}if(h){h=new Date(a.inst.selectedYear,a.inst.selectedMonth,a.inst.selectedDay+1,i.hour,i.minute);$.datepicker._setDate(a.inst,h);$.datepicker._setTime(a.inst,h);$.datepicker._updateDatepicker(a.inst)}else{a.control.value(a,a.minute_slider,"minute",i.minute)}}else{a.control.value(a,b.data.obj,b.data.unit,parseInt(g.innerHTML,10))}a._onTimeChange();a._onSelectHandler();if(b.target.nodeName=="I"){$.datepicker._hideDatepicker()}}};epgd.ajax=function(b,d,a){var c=$.extend({dataType:"json",contentType:"application/json; charset=utf-8"},b);return $.ajax(c).fail(function(h,g){epgd.utils.loader.close();if(h.status==401){epgd.pages.login.doLogin(null,null,function(){if(epgd.login.rights){c.url=c.url.replace(/sid[^\/]+\//,epgd.login.url);$.ajax(c).done(d).fail(function(){epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})})}else{epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}})}else{if(h.status==403){epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}else{if(h.status==501){epgd.utils.popup(epgd.tr.error.notImplemented,{title:epgd.tr.error.error})}else{if(a&&a.call(this,h,g)){return}var i="";try{if(h.responseJSON){i=h.responseJSON.result.message}}catch(g){i="";epgd.utils.log((g.message||"common error")+"\n"+(g.stack||"")+"\n options:"+JSON.stringify(b)+"\n jqhr:"+JSON.stringify(h),3)}epgd.utils.popup(i||h.responseText||epgd.tr.error.serverNotResponse,{title:epgd.tr.error.error})}}}}).done(d)};epgd.timerDialogBase=function(a){this.$win=null;this.list=null;if(a){this.options=$.extend({},this.options,a)}};epgd.timerDialogBase.prototype={options:{id:"baseDialog",modal:true,draggable:true,resizable:true,autoOpen:false,width:"auto",maxHeight:$(window).height(),close:function(){this.list.dialog.form.reset();$(this.list.dialog.form).next().remove()},buttons:[{text:epgd.tr.del,icons:{primary:"ui-icon-trash"},id:"tBDel",click:function(){$(this).dialog("close");this.list.del(this.list.dialog.form.tID.value)}},{text:epgd.tr.cancel,icons:{primary:"ui-icon-close"},click:function(){$(this).dialog("close")}},{text:epgd.tr.save,icons:{primary:"ui-icon-disk"},click:function(){this.list.dialog.save()}}]},save:function(d,b,a,c){this.list.save(d||this.getData(),b,a,c)&&!this.options.embed&&this.$win.dialog("close")},showError:function(b,a){epgd.utils.popup((a&&a.id?"<b>"+$('label[for="'+a.id+'"]').text()+"</b>":"")+"<div>"+b+"</div>",{autoClose:3000});a&&a.focus();return false},loadFolder:function(){var a=this;epgd.ajax({url:epgd.login.url+"data/recordingdirs"},function(d){if(d.recordingdirs.length){var b=[],c=epgd.vdrs.list,e;$.each(d.recordingdirs,function(h,g){e=c[g.vdruuid];b.push({value:g.directory,category:e?e.name:"-"})});$(a.form.tFolder).catcomplete("option","source",b)}})},close:function(){if(this.$win){this.$win.dialog("close")}},create:function(){var d=this.options,c=epgd.tr.pages.timerList,b="",a;for(a=1;a<epgd.tr.dateTimePicker.dayNamesShort.length;a++){b+='<input name="tWeek" type="checkbox" />'+epgd.tr.dateTimePicker.dayNamesShort[a]}b+='<input name="tWeek" type="checkbox" />'+epgd.tr.dateTimePicker.dayNamesShort[0];this.$win=$('<div id="'+d.id+'" class="searchDialog"><form><div class="colBlock"><div><label>&nbsp;</label><select id="tType"><option value="R">'+epgd.tr.pages.eventDetail.record+'</option><option value="V">'+epgd.tr.pages.eventDetail.ch_switch+'</option></select></div><div><label for="tSName">'+epgd.tr.pages.search.searchName+'</label><input type="text" id="tSName" /></div><div><label for="tInactive">'+c.inactive+'</label><input type="checkbox" id="tInactive" /></div></div><div class="ui-corner-all week">'+b+'</div><div class="onlyTypeR"><label for="tNameMode">'+c.namingMode+epgd.pages.help.getIcon("sTNameMode")+'</label><br /><select id="tNameMode"><option>'+c.namingModes.join("</option><option>")+'</option></select></div><div class="onlyTypeR"><label for="tTemplate">'+c.template+'</label><input class="full" id="tTemplate" type="text" value="" /></div><div class="onlyTypeR"><label for="tFolder">'+c.folder+'</label><input class="full" type="text" id="tFolder" /></div><div class="colBlock"><div class="noTypeS"><label for="tVdr">VDR</label><select id="tVdr"><option value="">Auto</option>'+$("#menu_vdrs").find("select").html()+'</select></div><div class="onlyTypeR"><label for="tPrio">'+c.prio+'</label><input type="number" placeholder="..." min="0" max="99" id="tPrio" style="width:40px" /></div><div class="onlyTypeR"><label for="tLife">'+c.lifetime+'</label><input type="number" placeholder="..." min="0" max="99" style="width:40px" id="tLife"/></div><div class="onlyTypeR"><label for="tVPS">VPS</label><input type="checkbox" id="tVPS" /></div></div><input type="hidden" id="tID" /><br clear="all" /></form></div>');!d.embed&&this.$win.appendTo(document.body).dialog(d);this.$win[0].list=this.list;this.form=this.$win.find("form")[0];$(this.form.tFolder).catcomplete({minLength:0,maxHeight:300}).focus(function(){$(this).catcomplete("search","")});$(this.form.tType).change(function(){if(this.selectedIndex<0){this.selectedIndex=0}this.form.className=this.form.className.replace(/ ?type./,"")+" type"+this[this.selectedIndex].value});$(this.form.tNameMode).change(function(){this.form.tTemplate.parentNode.style.display=(this.selectedIndex==6)?"block":"none"});epgd.utils.addPlaceholders(this.form.tTemplate,"%",c.templateFields);this.loadFolder()},render:function(b){b=b||{};if(!this.$win){this.create()}!this.options.embed&&this.$win.dialog("open").dialog("moveToTop");var c=this.form,e,a;c.tSName.focus();if(b.id){c.tID.value=b.id;this.$win.parent().find("#tBDel").show();this.$win.parent().find("#tBToggle").hide()}else{c.tID.value="";this.$win.parent().find("#tBDel").hide();this.$win.parent().find("#tBToggle").show()}$(c.tType).val(b.type||"R").change();$(c.tVdr).val(b.vdruuid||epgd.profile.timerDefaultVDRuuid);e=b.weekdays||0;for(a=0,f=1;a<c.tWeek.length;a++,f*=2){c.tWeek[a].checked=(e&f)}c.tPrio.value=b.priority||"";c.tLife.value=b.lifetime||"";c.tVPS.checked=b.vps==1;c.tInactive.checked=b.active===0;c.tFolder.value=b.directory||"";c.tSName.value=b.name||"";epgd.pages.help.initButtons(this.$win);this.resize()},resize:function(){this.$win.dialog("option","maxHeight",$(window).height())}};epgd.timerDialog=epgd.utils.inherits(function(){epgd.timerDialogBase.call(this,{id:"timerDialog",title:epgd.tr.pages.timer.timerList+" "+epgd.tr.edit,buttons:[{text:epgd.tr.pages.timer.searchTimerList,icons:{primary:"ui-icon-transferthick-e-w"},id:"tBToggle",click:function(){var a=this.list.dialog.getData(true);if(a){$(this).dialog("close");if(a.title){a.expression=a.title;a.searchfields=1}epgd.pages.searchTimerList.dialog.render(a)}}}].concat(epgd.timerDialog.base.options.buttons)})},epgd.timerDialogBase);epgd.timerDialog.prototype.create=function(){epgd.timerDialog.base.create.call(this);var b=epgd.tr.pages.timerList,a=this.form;$(a).prepend('<input type="hidden" id="tEvID" /><div id="tTitle"></div>');$(a.tWeek[0]).parent().before('<div><label for="tStart">'+b.recordTime+'</label><br /><span id="tEvTime"></span>&nbsp;<input type="text" id="tStart" style="width:165px" /> - <input type="text" id="tEnd" style="width:40px" /></div>');$(a.tNameMode).after('&nbsp;<span id="tFile"></span>');$(a.tFolder).parent().after('<div><label for="tChannels">'+epgd.tr.channel+'</label><input id="tChannel" type="text" class="full"/></div>');$(this.form.tStart).datetimepicker({minDateTime:epgd.utils.now()});$(this.form.tEnd).timepicker({});epgd.utils.addAutoComplete(a.tChannel,{source:epgd.channels.autoCompleteData});a.tFile=$(a).find("#tFile")[0];a.tEvTime=$(a).find("#tEvTime")[0];a.tTitle=$(a).find("#tTitle").click(function(){if(a.tEvID.value){epgd.utils.loader.process(function(){new epgd.eventDetail(a.tEvID.value).render()})}})[0]};epgd.timerDialog.prototype.render=function(a){a=a||{};epgd.timerDialog.base.render.call(this,a);var b=this.form,c;b.tFile.innerHTML=a.file||"...";b.tEvID.value=a.eventid||"";epgd.utils.setAutoCompleteValues(b.tChannel,a.channelid?[a.channelid]:null);b.tTitle.innerHTML=a.title||"";b.tEvTime.innerHTML=a.evStartTime?epgd.utils.formatDateTime(a.evStartTime)+" - "+epgd.utils.formatTime(a.evStartTime+a.evDuration):"";$([b.tStart,b.tEnd]).datetimepicker("option","disabled",!!a.eventid);if(a.day||!a.evStartTime){if(a.starttime){c=epgd.utils.date((a.day+parseInt(a.starttime/100,10)*60*60+(a.starttime%100)*60))}else{if(a.day){c=epgd.utils.date(a.day)}else{c=epgd.utils.now()}}$(b.tStart).datetimepicker("setDate",c);$(b.tStart).datetimepicker("setTime",c);if(a.endtime){c=epgd.utils.date((a.day+parseInt(a.endtime/100,10)*60*60+(a.endtime%100)*60))}else{c=new Date(c.getTime()+2*60*60000)}$(b.tEnd).datetimepicker("setTime",c)}else{$([b.tStart,b.tEnd]).val("...")}b.tNameMode.selectedIndex=typeof a.namingmode=="undefined"?parseInt(a.category=="Serie"?epgd.profile.namingModeSerie:epgd.profile.namingModeMovie,10):a.namingmode;b.tTemplate.value=a.template||(a.category=="Serie"?epgd.profile.namingModeSerieTemplate:epgd.profile.namingModeMovieTemplate);$(b.tNameMode).change()};epgd.timerDialog.prototype.getData=function(g){var b=this.form,e,a,c={};if(b.tEvID.value){c.eventid=parseInt(b.tEvID.value,10)}c.active=b.tInactive.checked?0:1;if(b.tID.value){c.id=parseInt(b.tID.value,10)}if(b.tStart.value&&b.tStart.value!="..."){e=$(b.tStart).datepicker("getDate");c.starttime=e.getHours()*100+e.getMinutes();e.setHours(0);e.setMinutes(0);c.day=parseInt(e.getTime()/1000,10);c.endtime=parseInt(b.tEnd.value.replace(":",""),10)}else{if(!c.eventid&&!g){return this.showError(epgd.tr.error.emptyField.replace("$field$",epgd.tr.pages.timerList.recordTime),b.tStart)}}c.weekdays=0;for(a=0,f=1;a<b.tWeek.length;a++,f*=2){if(b.tWeek[a].checked){c.weekdays+=f}}c.vps=b.tVPS.checked?1:0;if(b.tPrio.value){c.priority=parseInt(b.tPrio.value,10)}if(b.tLife.value){c.lifetime=parseInt(b.tLife.value,10)}c.channelid=epgd.utils.getAutoCompleteValues(b.tChannel);if(!c.channelid&&!g){return this.showError(epgd.tr.error.emptyField.replace("$field$",epgd.tr.channel),b.tChannel)}c.type=$(b.tType).val();e=$(b.tVdr).val();if(!e&&c.type=="V"){e=epgd.vdrs.current.uuid||""}if(e){c.vdruuid=e}c.namingmode=b.tNameMode.selectedIndex;c.template=b.tTemplate.value;if(c.type=="V"&&!e&&!g){return this.showError(epgd.tr.error.emptyField.replace("$field$","VDR"),b.tVdr)}c.directory=b.tFolder.value;c.title=b.tTitle.innerHTML||"";c.name=b.tSName.value;return c};epgd.searchTimerDialog=epgd.utils.inherits(function(a){this.searchResultList=null;epgd.timerDialogBase.call(this,$.extend({},{id:"searchTimerDialog",width:530,title:epgd.tr.pages.timer.searchTimerList+" "+epgd.tr.edit,buttons:[{text:epgd.tr.pages.timer.timerList,icons:{primary:"ui-icon-transferthick-e-w"},id:"tBToggle",click:function(){var b=this.list.dialog.getData(true);if(b){$(this).dialog("close");b.channelids&&(b.channelid=b.channelids.split(",")[0]);b.expression&&(b.title=b.expression);epgd.pages.timerList.dialog.render(b)}}},{text:epgd.tr.test,click:function(){this.list.dialog.search()}}].concat(epgd.searchTimerDialog.base.options.buttons,{text:epgd.tr.copy,icons:{primary:"ui-icon-copy"},id:"tBCopy",click:function(b){$(b.currentTarget).hide();this.list.dialog.form.tID.value="";this.list.dialog.form.tSName.value+=" copy";this.list.dialog.form.tSName.select()}})},a))},epgd.timerDialogBase);epgd.searchTimerDialog.prototype.search=function(a,b){if(!this.searchResultList){this.searchResultList=new epgd.searchResultList(null)}if(!this.searchResultList.$con||(a&&a[0]!=this.searchResultList.$con[0])){this.searchResultList.render(a||($('<div style="border-top:1px solid #ccc"></div>').insertAfter(this.form)))}else{this.searchResultList.$con.find("tbody").empty()}if(!this.searchResultList.$con.parent().length){this.searchResultList.$con.insertAfter(this.form);this.searchResultList.init()}this.searchResultList.update(b||this.getData());this.searchResultList.$con[0].scrollIntoView(true)};epgd.searchTimerDialog.prototype.create=function(){epgd.searchTimerDialog.base.create.call(this);var c=epgd.tr.pages.timerList,e=epgd.tr.pages.search,d="",b=this.form,a;for(a in e.searchModes){d+='<option value="'+(parseInt(a,10)+1)+'">'+e.searchModes[a]+"</option>"}if(!epgd.categories){epgd.categories=[];epgd.ajax({url:"data/categories",async:false},function(g){epgd.categories=g.categories})}if(!epgd.genres){epgd.genres=[];epgd.ajax({url:"data/genres",async:false},function(g){epgd.genres=g.genres})}$(b.tSName).parent().parent().after('<div><label for="tExpr">'+e.searchExpression+epgd.pages.help.getIcon("sExpr")+'</label> <input type="text" id="tExpr" style="width:300px" /></div><div class="full"><select id="tSMode" style="width:auto">'+d+'</select>&nbsp;&nbsp;<input type="checkbox" id="tCaseSens" />&nbsp;<label for="tCaseSens">'+e.caseSensitive+'</label></div><div class="ui-corner-all week">'+[""].concat(e.searchFields).join('<input type="checkbox" name="tSFields" />')+'</div><div><label for="tAdv"><input type="checkbox" id="tAdv" />&nbsp;'+epgd.tr.advanced+epgd.pages.help.getIcon("sTAdv")+'</label><div class="ui-corner-all week"><span>'+c.episode+'</span><input type="text" id="tSFEpisode" style="width:200px" /> <span>'+epgd.tr.pages.eventDetail.season+'</span><input type="text" id="tSFSeason" style="width:40px" /> <span>'+epgd.tr.pages.eventDetail.part+'</span><input type="text" id="tSFSPart" style="width:40px" /> <br /><span>'+epgd.tr.pages.eventDetail.category+'</span><input type="text" id="tSFCat" style="width:300px" /> <br /><span>'+epgd.tr.pages.eventDetail.genre+'</span><input type="text" id="tSFGenre" style="width:300px" /> <br /><input type="checkbox" name="tSFTip" value="GoldTipp" />GoldTipp<input type="checkbox" name="tSFTip" value="TagesTipp" />TagesTipp<input type="checkbox" name="tSFTip" value="TopTipp" />TopTipp<br /><span>'+epgd.tr.pages.eventDetail.year+'</span><input type="text" id="tSFYear" style="width:70px" /><br /><input type="checkbox" id="tSFNoEpgMatch" />'+c.noEpgMatch+'</div></div><div class="noTypeS"><div><label for="tRepeat"><input type="checkbox" id="tRepeat" />&nbsp;'+c.noRepeat+epgd.pages.help.getIcon("sTRepeat")+'</label><div class="ui-corner-all week">'+[""].concat(e.searchFields).join('<input type="checkbox" name="tRFields" />')+'</div></div></div><div><input type="radio" name="tChExclude" value="1" id="tChExclude0" /><label for="tChInclude">'+c.chInclude+"</label>"+epgd.pages.help.getIcon("sTChannels")+'<input type="radio" name="tChExclude" value="0" id="tChExclude1" /><label for="tChExclude">'+c.chExclude+'</label></div><input type="text" id="tChannels" class="full"/><div class="noTypeS"><label for="tChFormat">'+c.chFormat+epgd.pages.help.getIcon("sTChFormat")+'</label><input id="tChFormat" readonly onclick="epgd.timerEditChFormat(this)" /></div><div><label for="tTime"><input type="checkbox" id="tTime" />&nbsp;'+epgd.tr.dateTimePicker.timeText+epgd.pages.help.getIcon("sTime")+"</label></div>");$(b.tWeek[0]).before("<span>"+epgd.tr.dateTimePicker.timeTextBetween+' <input type="text" id="tStart" style="width:40px" /> - <input type="text" id="tEnd" style="width:40px" /></span>').parent().append('<br /><span class="onlyTypeS">'+c.nextDays.replace("$field$",'<input style="width:40px" type="text" id="tNextDays" />')+"</span>").insertAfter(b.tTime.parentNode);$([b.tStart,b.tEnd]).timepicker({alwaysSetTime:false});$([b.tTime,b.tRepeat,b.tAdv]).change(function(){$(this).parent().next().toggle(this.checked)});$([b.tSFSeason,b.tSFSPart,b.tSFYear]).change(function(){this.value=this.value.replace(/[^0-9-]/g,"");if(this.value.length==1&&this.value=="-"){this.value=""}});$(b.tType).append('<option value="S">'+epgd.tr.menu.search+"</option>");epgd.utils.addAutoComplete(b.tChannels,{source:epgd.channels.autoCompleteData,multiselect:true});epgd.utils.addAutoComplete(b.tSFCat,{source:epgd.categories,multiselect:true});epgd.utils.addAutoComplete(b.tSFGenre,{source:epgd.genres,multiselect:true})};epgd.searchTimerDialog.prototype.render=function(b){b=b||{searchfields:1};epgd.searchTimerDialog.base.render.call(this,b);var c=this.form,e,a;c.tExpr.value=b.expression||"";$(c.tSMode).val(b.searchmode||4);c.tCaseSens.checked=b.casesensitiv==1;e=b.searchfields||0;for(a=0,f=1;a<c.tSFields.length;a++,f*=2){c.tSFields[a].checked=(e&f)}if(b.starttime||b.endtime||b.weekdays||b.nextdays){c.tTime.checked=true;b.starttime?$(c.tStart).datetimepicker("setTime",new Date(0,0,0,parseInt(b.starttime/100,10),(b.starttime%100))):c.tStart.value="";b.endtime?$(c.tEnd).datetimepicker("setTime",new Date(0,0,0,parseInt(b.endtime/100,10),(b.endtime%100))):c.tEnd.value;c.tNextDays.value=b.nextdays||""}else{c.tTime.checked=false}$(c.tTime).change();e=b.repeatfields||0;for(a=0,f=1;a<c.tRFields.length;a++,f*=2){c.tRFields[a].checked=(e&f)}c.tRepeat.checked=e>0;$(c.tRepeat).change();c.tSFEpisode.value=b.episodename||"";c.tSFSeason.value=b.season||"";c.tSFSPart.value=b.seasonpart||"";c.tSFYear.value=b.year||"";epgd.utils.setAutoCompleteValues(c.tSFCat,new String(b.category).replace(/'/g,"").split(","));epgd.utils.setAutoCompleteValues(c.tSFGenre,new String(b.genre).replace(/'/g,"").split(","));e=b.tipp||"";for(a=0;a<c.tSFTip.length;a++){c.tSFTip[a].checked=e.indexOf("'"+c.tSFTip[a].value+"'")>=0}c.tSFNoEpgMatch.checked=b.noepgmatch==1;c.tAdv.checked=b.episodename||b.season||b.seasonpart||b.year||b.category||b.genre||b.tipp||b.noepgmatch;$(c.tAdv).change();epgd.utils.setAutoCompleteValues(c.tChannels,new String(b.channelids).split(","));if(b.chexclude){c.tChExclude1.checked=1}else{c.tChExclude0.checked=1}c.tChFormat.value=b.chformat||(b.id?"":epgd.profile.chFormat);c.tNameMode.defaultIndex=parseInt(b.category=="Serie"?epgd.profile.namingModeSearchSerie:epgd.profile.namingModeSearchMovie,10);c.tNameMode.selectedIndex=typeof b.namingmode=="undefined"?c.tNameMode.defaultIndex:b.namingmode;c.tTemplate.value=typeof b.template=="undefined"?(b.category=="Serie"?epgd.profile.namingModeSearchSerieTemplate:epgd.profile.namingModeSearchMovieTemplate):b.template;$(c.tNameMode).change();this.$win.parent().find("#tBCopy").toggle(!!b.id)};epgd.searchTimerDialog.prototype.getData=function(g){var b=this.form,e,a,c={expression:b.tExpr.value};if(b.tSFSeason.value){c.season=b.tSFSeason.value}if(b.tSFSPart.value){c.seasonpart=b.tSFSPart.value}if(b.tSFYear.value){c.year=b.tSFYear.value}if(!g){if(!c.expression){return this.showError(epgd.tr.error.emptyField.replace("$field$",epgd.tr.pages.search.searchExpression),b.tExpr)}if(c.season&&!/^[0-9]{0,3}-?[0-9]{0,3}$/.test(c.season)){return this.showError(epgd.tr.error.invalid,b.tSFSeason)}if(c.seasonpart&&!/^[0-9]{0,3}-?[0-9]{0,3}$/.test(c.seasonpart)){return this.showError(epgd.tr.error.invalid,b.tSFSPart)}if(c.year&&!/^((19|20)[0-9]{2})?(-|-(19|20)[0-9]{2})?$/.test(c.year)){return this.showError(epgd.tr.error.invalid,b.tSFYear)}}if(b.tID.value){c.id=parseInt(b.tID.value,10)}if(b.tSFEpisode.value){c.episodename=b.tSFEpisode.value}c.category=epgd.utils.getAutoCompleteValues(b.tSFCat,"'");c.genre=epgd.utils.getAutoCompleteValues(b.tSFGenre,"'");e="";for(a=0;a<b.tSFTip.length;a++){if(b.tSFTip[a].checked){e+=",'"+b.tSFTip[a].value+"'"}}c.tipp=e.slice(1);c.noepgmatch=b.tSFNoEpgMatch.checked?1:0;c.searchmode=parseInt($(b.tSMode).val(),10);c.searchfields=0;for(a=0,f=1;a<b.tSFields.length;a++,f*=2){if(b.tSFields[a].checked){c.searchfields+=f}}c.casesensitiv=b.tCaseSens.checked?1:0;c.repeatfields=0;if(b.tRepeat.checked){for(a=0,f=1;a<b.tRFields.length;a++,f*=2){if(b.tRFields[a].checked){c.repeatfields+=f}}}c.active=b.tInactive.checked?0:1;c.channelids=epgd.utils.getAutoCompleteValues(b.tChannels);c.chformat=b.tChFormat.value;c.chexclude=b.tChExclude1.checked?1:0;if(b.tTime.checked){c.starttime=parseInt(b.tStart.value.replace(":",""),10);c.endtime=parseInt(b.tEnd.value.replace(":",""),10);c.weekdays=0;for(a=0,f=1;a<b.tWeek.length;a++,f*=2){if(b.tWeek[a].checked){c.weekdays+=f}}}c.vps=b.tVPS.checked?1:0;if(b.tPrio.value){c.priority=parseInt(b.tPrio.value,10)}if(b.tLife.value){c.lifetime=parseInt(b.tLife.value,10)}c.directory=b.tFolder.value;e=$(b.tVdr).val();if(e){c.vdruuid=e}c.namingmode=b.tNameMode.selectedIndex;c.template=b.tTemplate.value;c.type=$(b.tType).val();if(c.type=="V"&&!e&&!g){return this.showError(epgd.tr.error.emptyField.replace("$field$","VDR"),b.tVdr)}c.name=b.tSName.value;if(b.tNextDays.value){c.nextdays=parseInt(b.tNextDays.value,10)}return c};epgd.searchTimerDialog.prototype.save=function(h,e,c,g){h=h||this.getData();var a=this,i=h.id,b=h.name;h.max=0;h.id&&delete h.id;h.name&&delete h.name;epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/search",type:"post",data:JSON.stringify(h)},function(d){h.id=i;h.name=b;if(d.count>50){epgd.utils.confirm(epgd.tr.pages.timerList.confirmSaveBigResult.replace("$cnt$",d.count),function(k){k&&epgd.searchTimerDialog.base.save.call(a,h)})}else{epgd.searchTimerDialog.base.save.call(a,h,e,c,g)}epgd.utils.loader.close()})},true)};epgd.searchDialog=epgd.utils.inherits(function(){epgd.searchTimerDialog.call(this,{id:"search",embed:true,buttons:null});this.searchResultList=new epgd.searchResultList({empty:epgd.tr.pages.search.empty},this)},epgd.searchTimerDialog);epgd.searchDialog.prototype.create=function(){epgd.searchDialog.base.create.call(this);var c=this.form,b=this,a=$('<div id="searchResult"></div>').appendTo(this.$win);$('<button type="submit" id="sSearch" class="iAsButton i-search">'+epgd.tr.pages.search.search+"</button>").insertAfter(c.tExpr).after(' <input type="checkbox" id="sAdv" />&nbsp;<label for="sAdv">'+epgd.tr.advanced+"</label>");$(c.tType).parent().hide().parent().css("border-top","1px solid #ccc").insertAfter($(c.tVdr.parentNode.parentNode).hide());$('<input type="button" class="iAsButton" id="tCopy" value="'+epgd.tr.copy+'" />').insertAfter(c.tSName).click(function(){b.form.tID.value="";b.form.tSName.value+=" copy";b.form.tSName.select()}).prop("disabled",true);$('<input type="button" class="iAsButton" id="tDel" value="'+epgd.tr.del+'" />').insertAfter(c.tSName).click(function(){b.list.del(this.form.tID.value,function(){b.form.tID.value="";b.loadSavedSearch()})}).prop("disabled",true);$('<input type="button" class="iAsButton" value="'+epgd.tr.save+'" />').insertAfter(c.tSName).click(function(){var e=b.getData();if(!e.name){return this.showError(epgd.tr.error.invalid,c.tSName)}b.save(e,null,null,function(){b.loadSavedSearch()})});$(c).submit(function(){b.search(a);return false});this.$win.find("#sExpr").keyup(function(d){if(d.keyCode==13){this.form.sSearch.click();$(this).blur()}}).focus();this.$win.find("#sAdv").change(function(){$(c).toggleClass("noAdv",!this.checked);b.resize()}).prop("checked",epgd.profile.searchAdv=="1").change();$(c.tSName).autocomplete({minLength:0,maxHeight:300,source:function(){return false},select:function(e,g){var h=g.item.data||{id:""};if(h.id){b.render(h);b.form.sSearch.click();$([c.tDel,c.tCopy,c.tInactive]).prop("disabled",false);return false}else{c.tID.value="";$([c.tDel,c.tCopy,c.tInactive]).prop("disabled",true)}}}).focus(function(){$(this).autocomplete("search","")});this.loadSavedSearch()};epgd.searchDialog.prototype.loadSavedSearch=function(){var a=this.form;epgd.ajax({url:epgd.login.url+"data/searchtimers?type=S"},function(c){var b=[];$.each(c.searchtimers,function(e,d){b.push({value:d.name||d.expression,label:d.name||d.expression,data:d})});$(a.tSName).autocomplete("option","source",b)})};epgd.searchDialog.prototype.resize=function(){var a=this.$win.find("#searchResult"),b=$(window).height()-a.offset().top-20;if(b<100){a.css({height:"auto","overflow-y":"visible"})}else{a.css({height:b+"px","overflow-y":"auto"})}};epgd.searchDialog.prototype.render=function(a){if(!epgd.$con.find("#search").length){$("#menu_search").addClass("menu-active");this.create();epgd.$con.html("");this.$win.appendTo(epgd.$con)}a=a||{searchfields:1};a.type="S";epgd.searchDialog.base.render.call(this,a)};epgd.searchDialog.prototype.close=function(){};epgd.channels={list:null,autoCompleteData:null,isDirty:false,selBox:$('<select id="selChannel"></select>')[0],load:function(){if(!this.list||this.isDirty){epgd.ajax({url:epgd.login.url+"data/channels",async:false,cache:false},function(d){var b=(epgd.profile.channelLogoPath?epgd.profile.channelLogoPath+"?maxW=70&maxH=50&id=":false),e="",c={},a=[];d.channels&&$.each(d.channels,function(g,h){var k=h.channelid||g;if(h.name){h.html='<div class="channel" id="'+k+'">'+(b?'<img src="'+b+k+'" alt="'+h.name+'" /><i class="i-tv" title="'+epgd.tr.pages.eventDetail.ch_switch+'" />'+(epgd.profile.logoShowName=="1"?h.name:""):h.name)+"</div>";h.visible&1&&(e+='<option value="'+k+'">'+h.name+"</option>")}else{h.html='<div class="channel" id="'+k+'"><i class="i-tv" title="'+epgd.tr.pages.eventDetail.ch_switch+'" />'+k+"</div>";h.visible&1&&(e+='<option value="'+k+'">'+k+"</option>")}c[k]=h;a.push({label:h.name,value:k})});epgd.channels.list=c;epgd.channels.autoCompleteData=a;$(epgd.channels.selBox).html(e);$(window).trigger("channels_load");this.dirty=false})}},getHtml:function(b){var a=this.list[b];return a?a.html:'<div class="channel" id="'+b+'"><i class="i-tv" title="'+epgd.tr.pages.eventDetail.ch_switch+'" />'+b+"</div>"},getName:function(b){var a=this.list[b];return a?a.name:b}};epgd.eventDetail=function(a){this.id=a;this.data=null;this.expire=0};epgd.eventDetail.prototype.imgPath=false;epgd.eventDetail.prototype.load=function(b,c){var a=this;epgd.ajax({url:epgd.login.url+"data/event?"+(b&&c?"channelid="+b+"&time="+c:"id="+this.id),async:false,cache:false},function(d){a.data=d.event;a.id=d.id;a.expire=epgd.utils.now().getTime()+900000});return this};epgd.eventDetail.prototype.render=function(){if(this.expire<epgd.utils.now().getTime()){this.load()}if(!this.data){return""}this.win.render(this)};epgd.eventDetail.prototype.doRecord=function(a){if(a===true){return epgd.tr.pages.eventDetail.record}a=a||this.data;var b={id:a.timerid,eventid:a.id,channelid:a.channelid,title:a.title,evStartTime:a.starttime,evDuration:a.duration,category:a.category,shorttext:a.shorttext,expression:a.title};if(b.eventid){epgd.pages.timerList.dialog.render(b)}else{epgd.pages.searchTimerList.dialog.render(b)}};epgd.eventDetail.prototype.doRepeat=function(c){if(c){return true}var d=this.win,a=d.$con.find(".repeat"),b;if(!a.length){if(!this.searchResultList){this.searchResultList=new epgd.searchResultList(null,{resize:function(){d.$con.last().find('td[data-evId="'+d.detail.data.id+'"]').parent().remove();d.$con.accordion("refresh");a.click()}})}a=$('<h3 class="repeat">'+epgd.tr.pages.eventDetail.repeat+"</h3>").appendTo(d.$con);b={searchfields:1,expression:this.data.title,searchmode:1,casesensitiv:1,fromEventDetail:true};if(this.data.shorttext){b.searchfields1=2;b.expression1=this.data.shorttext}epgd.pages.search.search.call(this,$('<div class="desc"></div>').appendTo(d.$con),b)}else{a.click()}};epgd.eventDetail.prototype.doPlay=function(b){var a=parseInt(epgd.utils.now().getTime()/1000,10)-this.data.starttime;if(a>this.data.duration){return false}if(b){return !!epgd.vdrs.current.uuid}if(a<0){epgd.pages.timerList.save({type:"V",active:1,vdruuid:epgd.vdrs.current.uuid,eventid:this.data.id,channelid:this.data.channelid,title:this.data.title})}else{epgd.vdrs.current.switchChannel(this.data.channelid)}};epgd.eventDetail.prototype.doPrev=function(c){var b=this.data.starttime-500,a=this;if(b<epgd.profile.minEventTime){return false}if(c){return true}epgd.utils.loader.process(function(){new epgd.eventDetail().load(a.data.channelid,b).render()})};epgd.eventDetail.prototype.doNext=function(c){var b=this.data.starttime+this.data.duration+500,a=this;if(b>epgd.profile.maxEventTime){return false}if(c){return true}epgd.utils.loader.process(function(){new epgd.eventDetail().load(a.data.channelid,b).render()})};epgd.eventDetail.win=function(){this._create();this.closed=true;this.detail=null;var a=this;$(window).bind("epgd_close.eventDetail",function(){if(!a.closed){a.$win.css("z-Index","");a.$win.hide();$(document).unbind("keyup.eventDetail");a.closed=true;a.$openDialogs&&a.$openDialogs.removeClass("ui-state-disabled")}});$(window).bind("resize.eventDetail",function(b){if(!a.closed){try{a.$win.css("max-width",$(window).width());a.$win.show().position({of:window});a.$con.accordion("refresh")}catch(c){}if(parseInt(a.$win.css("top"),10)<69){a.$win.css("top","69px")}}})};epgd.eventDetail.win.prototype._create=function(){this.imgPath=epgd.profile.eventImgPath?epgd.profile.eventImgPath+"?no=0&maxW=270&maxH=146&id=":false;this.movieImgPath=epgd.profile.movieMediaPath?epgd.profile.movieMediaPath+"?actor_id=0&movie_id=":false;this.movieActorImgPath=epgd.profile.movieMediaPath?epgd.profile.movieMediaPath+"?maxW=60&maxH=90&media_type=4&actor_id=":false;this.serieImgPath=epgd.profile.serieImgPath?epgd.profile.serieImgPath+"?actor_id=0&series_id=":false;this.serieActorImgPath=epgd.profile.serieImgPath?epgd.profile.serieImgPath+"?maxW=60&maxH=90&season_number=0&episode_id=0&media_type=11&actor_id=":false;this.$win=$('<div id="eventDetail" class="ui-front"><div class="ui-front ui-widget ui-widget-content ui-corner-all" style="position:absolute;width:100%;height:100%"><div class="toolbar ui-widget-header ui-corner-all"></div><div></div></div><div class="ui-widget ui-widget-shadow ui-corner-all" style="position:absolute;width:100%;height:100%"></div></div>').appendTo(document.body);this.$con=this.$win.find(":first :last");var c=this,b=epgd.tr.pages.eventDetail,a=this.$win.find(".toolbar")[0];this.$rec=$('<button class="iAsButton i-record"/>').css("float","left").appendTo(a).click(function(){c.detail.doRecord()});$('<button class="iAsButton i-buffer" title="'+b.repeat+'" />').css("float","left").appendTo(a).click(function(){c.detail.doRepeat()});this.$play=$('<button class="iAsButton i-tv" title="'+b.ch_switch+'" />').css("float","left").appendTo(a).click(function(){c.detail.doPlay()});this.$prev=$('<button class="iAsButton i-rewind" title="'+b.eventPrev+'" />').appendTo(a).click(function(){c.detail.doPrev()});this.$next=$('<button class="iAsButton i-forward" title="'+b.eventNext+'" />').appendTo(a).click(function(){c.detail.doNext()});$('<button class="iAsButton i-cancel" title="'+epgd.tr.close+'" />').css("float","right").appendTo(a).click(function(){$(window).trigger("epgd_close.eventDetail")})};epgd.eventDetail.win.prototype.render=function(v){this.detail=v;var t=v.data,b=epgd.tr.pages.eventDetail,g=((parseInt(epgd.utils.now().getTime()/1000,10)-t.starttime)/t.duration*100),d="",x=t.episode||{},s=t.longdescription?'<div title="longdescription">'+t.longdescription+"</div>":"",u="",w=null,p=(this.imgPath&&t.imagecount?this.imgPath+t.id:""),o=null,m=x.episodename||t.title,n=$(window).width()<500,l,q,a,c,k,h,r="";if(t.cntlongdescription){s+='<hr><div title="cntlongdescription">'+t.cntlongdescription+"</div>"}if(t.rating){l=t.rating.slice(t.rating.indexOf("/")).split(" ");for(q=1;q<l.length;q+=3){d+=l[q]+'<div class="stars'+l[q+1].length+'"> </div>'}}u="";for(q in b.extInfo){if(t[q]){u+="<tr><th>"+b.extInfo[q]+"</th><td>"+t[q]+"</td></tr>"}}if(t.scraper&&(a=t.scraper.movie||t.scraper.serie)){a.media=a.media||[];if(a.actors){w="";for(q in a.actors){c=a.actors[q];w+="<div>"+(this.movieActorImgPath&&c.actorid?'<img src="'+this.movieActorImgPath+c.actorid+'" />':"")+'<a href="'+epgd.profile.movieActorPath+c.actorid+'" target="_blank">'+c.actorname+"</a>"+(c.actorrole||"")+"</div>"}}if(t.scraper.movie){a.isMovie=true;if(a.media&&this.movieImgPath){if(!p&&a.media["1"]){p=this.movieImgPath+a.movieid+"&media_type=1&maxW=270&maxH=146"}if(a.media["3"]){o=this.movieImgPath+a.movieid+"&media_type=3&maxW=400&maxH=999"}else{if(a.media["1"]){o=this.movieImgPath+a.movieid+"&media_type=1&maxW=400&maxH=999"}}}if(a.actors){w="";for(q in a.actors){c=a.actors[q];w+="<div>"+(this.movieActorImgPath?'<img src="'+this.movieActorImgPath+q+'" />':"")+'<a href="'+epgd.profile.movieActorPath+q+'" target="_blank">'+c.actorname+"</a>"+(c.actorrole||"")+"</div>"}}if(a.overview){s='<div title="overview">'+a.overview+"</div><hr />"+s}u="<h3><span>"+b.scrapperMovieInfo+'</span></h3><div><table class="colFull">'+(a.media["1"]&&this.movieImgPath?'<tr><th colspan="2"><img src="'+this.movieImgPath+a.movieid+'&media_type=1&maxW=397&maxH=400" /></th></tr>':"")+(a.title?"<tr><th>"+b.title+"</th><td>"+a.title+"</td></tr>":"")+(a.originaltitle?"<tr><th>"+b.original_title+"</th><td>"+a.originaltitle+"</td></tr>":"")+(a.runtime?"<tr><th>"+b.runtime+"</th><td>"+a.runtime+" "+epgd.tr.minutes+"</td></tr>":"")+(a.movie_release_date?"<tr><th>"+b.release_date+"</th><td>"+a.movie_release_date+"</td></tr>":"")+(a.genres?"<tr><th>"+b.genre+"</th><td>"+a.genres.replace(/^\||\|$/g,"").replace(/ ?\| ?/g,", ")+"</td></tr>":"")+(a.voteaverage?"<tr><th>"+b.vote_average+'</th><td class="stars"><div class="stars5" style="width:'+parseInt(a.voteaverage*8,10)+'px"></div> ('+a.voteaverage.toFixed(1)+" / 10)</td></tr>":"")+(a.popularity?"<tr><th>"+b.popularity+"</th><td>"+a.popularity.toFixed(1)+"</td></tr>":"")+u+(a.budget?"<tr><th>Budget</th><td>$"+a.budget+"</td></tr>":"")+(a.revenue?"<tr><th>Einnahmen</th><td>$"+a.revenue+"</td></tr>":"")+(a.homepage?"<tr><th>"+b.homepage+'</th><td><a href="'+a.homepage+'">'+a.homepage+"</a></td></tr>":"")+"</table>"+(a.media["0"]&&this.movieImgPath?'<img class="poster" src="'+this.movieImgPath+a.movieid+'&media_type=0&maxW=390&maxh=999" />':"")}else{a.isSerie=true;if(a.actors){w="";for(q in a.actors){c=a.actors[q];w+="<div>"+(this.serieActorImgPath?'<img src="'+this.serieActorImgPath+q+"&series_id="+a.seriesid+'" />':"")+"<a>"+c.actorname+"</a>"+(c.actorrole?c.actorrole.replace(/\|/g,"<br />"):"")+"</div>"}}l=a.episode;if(l){if(l.episodeoverview){if(t.longdescription&&l.episodeoverview.length>t.longdescription.length){s=s.replace(/^<div.+<\/div>/i,"")}s='<div title="episodeoverview">'+l.episodeoverview+"</div>"+s}s="<h5>"+l.episodename+"</h5>"+s;if(l.episodegueststars){w+='</div><div class="colFull actors"><h5>'+b.gueststars+"</h5><br />"+l.episodegueststars.replace(/^\||\|$/g,"").replace(/\|/g,"<br />")}}if(!p&&a.media["10"]&&this.serieImgPath){p=this.serieImgPath+a.seriesid+"&season_number="+l.seasonnumber+"&episode_id="+l.episodeid+"&media_type=10&maxW=270&maxH=146"}if(a.media["7"]){o=this.serieImgPath+a.seriesid+"&season_number=0&episode_id=0&media_type=7&maxW=400&maxh=999"}if(a.seriesoverview){s+=s?'<hr /><a href="#" onclick="return !$(this).next().toggle()">Serienbeschreibung</a><div style="display:none" title="seriesoverview">'+a.seriesoverview+"</div>":"<div>"+a.seriesoverview+"</div>"}u="<h3><span>"+b.scrapperSerieInfo+'</span></h3><div><table class="colFull">'+(a.media["1"]&&this.serieImgPath?'<tr><th colspan="2"><img src="'+this.serieImgPath+a.seriesid+'&season_number=0&episode_id=0&media_type=1&maxW=397&maxH=250" /></th></tr>':"")+(a.media["10"]&&this.serieImgPath?'<tr><th colspan="2"><img src="'+this.serieImgPath+a.seriesid+"&season_number="+l.seasonnumber+"&episode_id="+l.episodeid+'&media_type=10&maxW=397&maxH=400" /></th></tr>':"")+(a.seriesname?"<tr><th>"+b.title+"</th><td>"+a.seriesname+"</td></tr>":"")+(a.seriesnetwork?"<tr><th>"+b.network+"</th><td>"+a.seriesnetwork+"</td></tr>":"")+(a.seriesstatus?"<tr><th>"+b.seriesstatus+"</th><td>"+a.seriesstatus+"</td></tr>":"")+(a.seriesfirstaired?"<tr><th>"+b.release_date+"</th><td>"+a.seriesfirstaired+"</td></tr>":"")+(a.seriesgenre?"<tr><th>"+b.genre+"</th><td>"+a.seriesgenre.replace(/^\||\|$/g,"").replace(/ ?\| ?/g,", ")+"</td></tr>":"")+(a.seriesrating?"<tr><th>"+b.vote_average+'</th><td class="stars"><div class="stars5" style="width:'+parseInt(a.seriesrating*8,10)+'px"></div> ('+a.seriesrating.toFixed(1)+" / 10)</td></tr>":"")+u+(epgd.profile.serieSeasonPath?'<tr><td colspan="2"><a href="'+epgd.profile.serieSeasonPath+a.seriesid+'" target="_blank">'+b.homepage+"</a></td></tr>":"")+"</table>"+(a.media["6"]&&this.serieImgPath?'<img class="poster" src="'+this.serieImgPath+a.seriesid+"&season_number="+l.seasonnumber+'&episode_id=0&media_type=6&maxW=390&maxh=999" />':"")+(a.media["3"]&&this.serieImgPath?'<img class="poster" src="'+this.serieImgPath+a.seriesid+'&season_number=0&episode_id=0&media_type=3&maxW=390&maxh=999" />':"")}}else{a={};u="<h3><span>"+b.extentedInfo+'</span></h3><div><table class="colFull"><tr><th>'+b.title+"</th><td>"+t.title+"</td></tr>"+(x.partname?"<tr><th>"+b.part+"</th><td>"+x.partname+"</td></tr>":"")+(t.year?"<tr><th>"+b.release_date+"</th><td>"+t.year+"</td></tr>":"")+(x.lang?"<tr><th>"+b.lang+"</th><td>"+x.lang+"</td></tr>":"")+u+"</table>"}if(!w&&t.actor){w=t.actor.replace(/, /g,"<br />")}w&&(u+='<div class="colFull actors"><h5>'+b.actors+"</h5>"+w+"</div>");u&&(u+="</div>");k=(t.path?epgd.tr.pages.timerList.folder+"<br />"+t.path.replace(/\//g," / ")+"<br />":"")+(t.genre?(b.genre+"<b>"+t.genre+"</b><br />"):"")+(t.category?b.category+"<b>"+t.category+"</b><br />":"")+(t.country?b.country+"<b>"+t.country+"</b><br />":"")+(t.year?b.year+"<b>"+t.year+"</b><br />":"");h=(x.part?b.part+"<b>"+x.part+(x.parts?" / "+x.parts+"":"")+"</b><br />":"")+(x.season?b.season+"<b>"+x.season+"</b><br />":"")+(x.number?b.number+"<b>"+x.number+"</b><br />":"")+(x.extracol1?x.extracol1+"<br />":"")+(x.extracol2?x.extracol2+"<br />":"")+(x.extracol3?x.extracol3+"<br />":"");if(t.recordings){for(q in t.recordings){l=t.recordings[q];r+='<div class="rec" data-start="'+l.starttime+'" data-owner="'+(l.owner||"")+'" data-md5="'+l.md5path+'" data-path="'+l.path+'"><em>'+epgd.utils.formatDateTime(l.starttime)+"</em><u>"+parseInt(l.duration/60,10)+" "+epgd.tr.minutes+'</u><b onclick="new epgd.recordDetail(this.parentNode).render()"><div class="progress" title="'+l.matchdensitytitle+"% "+epgd.tr.pages.search.matchdensity+'"><div style="width:'+l.matchdensitytitle+'%" ></div></div>'+l.title+(l.shorttext?'<i><div class="progress" title="'+l.matchdensityshorttext+"% "+epgd.tr.pages.search.matchdensity+'"><div style="width:'+l.matchdensityshorttext+'%" ></div></div>'+l.shorttext+"</i>":"")+"</b></div>"}}this.$con=$('<div><h3><div class="date">'+$.datepicker.formatDate(n?"d. M y":"d. MM yy",epgd.utils.date(t.starttime))+"</div>"+(n?"":t.title)+'<div class="time"><b>'+epgd.utils.formatTime(t.starttime)+"</b>&nbsp;&ndash;&nbsp;"+epgd.utils.formatTime(t.starttime+t.duration)+" "+epgd.tr.oClock+"&nbsp;|&nbsp;"+parseInt(t.duration/60,10)+" "+epgd.tr.minutes+'</div></h3><div><div class="colFull"><div class="imgBox">'+(p?'<img src="'+p+'" />':"")+'</div><div class="chPrFl">'+epgd.channels.getHtml(t.channelid)+(g>0&&g<=100?'<div class="progress"><div style="width: '+g+'%"></div></div>':"")+'<div class="audio">'+(t.flags&&t.flags.indexOf("16:9")>0?'<span class="a-169"></span>':"")+(t.audio&&t.audio.indexOf("DolbyDigital")>=0?'<span class="a-dd" title="DolbyDigital"></span>':"")+(t.flags&&t.flags.indexOf("Live")>0?"Live":"")+(t.parentalrating?'<div class="parRate'+t.parentalrating+'">'+b.parentalrating+t.parentalrating+"</div>":"")+"</div>"+(t.merge?"<div>"+b.mergeSrc+t.merge+"</div>":"")+"</div>"+(d?'<div class="stars">'+d+"</div>":"")+'<div class="col2">'+t.title+(x.partname?"<br /><i>"+x.partname+"</i>":(t.shorttext?"<br /><i>"+t.shorttext+"</i>":""))+'</div><div class="col2 rate rate'+(t.numrating||"0")+'">'+(t.tipp?'<b class="tipp">'+t.tipp+"</b>":"")+(t.txtrating?"<span>"+t.txtrating+"</span>":"")+(t.shortreview||"")+"</div>"+(k?'<div class="info">'+k+"</div>":"")+(h?'<div class="info">'+h+"</div>":"")+(o?'<img src="'+o+'" />':"")+'</div><div class="colFull desc">'+(s?s.replace(/\n/g,"<br />"):"")+"</div></div>"+u+(t.category=="Serie"||a.isSerie||x.episodename?'<h3 data-conti="'+m+'"><span>'+b.constabelInfo+'</span></h3><div class="desc"><a class="iAsButton i-edit" href="'+epgd.profile.constabelEditPath+encodeURIComponent(m)+'.episodes" target="constabel">'+epgd.tr.edit+'</a><a class="iAsButton i-link-ext" href="'+epgd.profile.constabelLinkPath+encodeURIComponent(m)+'" target="constabel">'+epgd.tr.pages.eventDetail.addConstableLink+"</a>"+epgd.pages.help.getButton("constabel",true)+(epgd.profile.constabelLoginPath?'<a class="iAsButton i-login" href="'+epgd.profile.constabelLoginPath+'" target="constabel">'+epgd.tr.pages.eventDetail.loginConstable+"</a>":"")+'<pre id="cRaw"></pre></div>':"")+(r?"<h3><span>"+epgd.tr.menu.records+'</span></h3><div class="recordings">'+r+"</div>":"")+"</div>").replaceAll(this.$con);this.$con.accordion({heightStyle:"fill",header:"h3",active:0,beforeActivate:function(e,i){if(i.newHeader.attr("data-conti")){epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/proxy?id=constabel&title="+encodeURIComponent(encodeURIComponent(i.newHeader.attr("data-conti")))+"&_"+new Date().getTime(),dataType:"html",contentType:"text/plain; charset=utf-8"},function(E){if(E.indexOf("Error:")==-1){var F=i.newPanel.find("#cRaw"),D="<thead><tr><th>"+b.season+"</th><th>"+b.part+"</th><th>"+b.number+"</th><th>"+b.title+"</th>",B="<tbody>",A=E.split(/\r?\n/),z,y,C;for(C=0;C<A.length;C++){z=A[C];if(z.charAt(0)=="#"){y=z.match(/EXTRACOL[0-9] (.+)/i);if(y){D+="<th>"+y[1]+"</th>"}}else{y=z.split(/\t/);if(y.length>3){B+="<tr><td>"+y.join("</td><td>")+"</td></tr>"}}}F.html(E).hide().before('<a href="#" onclick="return !!$(\'#cRaw\').toggle()[0].scrollIntoView()">Raw</a>');F.before("<table>"+D+"</thead>"+B+"</tbody></table>")}else{i.newPanel.find("#cRaw").html(epgd.tr.error.noData)}epgd.utils.loader.close()});i.newHeader.removeAttr("data-conti")},true)}}});this.$rec.toggleClass("hasTimer",!!t.timerid).prop("title",this.detail.doRecord(true));this.$play.toggle(this.detail.doPlay(true));this.$prev.toggle(this.detail.doPrev(true));this.$next.toggle(this.detail.doNext(true));this.$con.find(".channel .i-tv").click(function(){epgd.vdrs.current.switchChannel(this.parentNode.id)});this.closed=false;q=Math.max.apply(null,this.$win.siblings(".ui-front:visible").map(function(){return +$(this).css("z-index")}).get());if(q>=+this.$win.css("z-index")){this.$win.css("z-index",q+1)}$(window).trigger("resize.eventDetail");this.$openDialogs=$(".ui-dialog:visible:not(.ui-state-disabled)").addClass("ui-state-disabled");$(document).bind("keyup.eventDetail",function(i){if(i.keyCode==27){$(window).trigger("epgd_close.eventDetail")}});epgd.pages.help.initButtons(this.$con)};epgd.recordDetail=epgd.utils.inherits(function(a){this.elem=a;return epgd.eventDetail.call(this)},epgd.eventDetail);epgd.recordDetail.prototype.load=function(){var a=this;epgd.ajax({url:epgd.login.url+"data/recording?starttime="+this.elem.getAttribute("data-start")+"&md5path="+this.elem.getAttribute("data-md5")+"&owner="+this.elem.getAttribute("data-owner"),async:false},function(b){a.data=b.recording});return this};epgd.recordDetail.prototype.doRecord=function(a){if(a===true){return epgd.tr.pages.records.similarTimer}epgd.eventDetail.prototype.doRecord.call(this,a)};epgd.recordDetail.prototype.doPlay=function(a){if(a){return true}epgd.ajax({url:epgd.login.url+"data/replayrecording?vdruuid="+(!epgd.vdrs.list[this.data.vdruuid].usecommonrecfolder?this.data.vdruuid:epgd.vdrs.current.uuid)+"&starttime="+this.data.starttime+"&md5path="+this.data.md5path+"&owner="+(this.data.owner||""),cache:false},function(b){epgd.utils.popup(b.result.message,{title:"VDR",autoClose:5000})})};epgd.recordDetail.prototype.doPrev=function(b){var a=$(this.elem).prev(".rec");if(!a.length){return false}if(b){return true}a.find("B").click()};epgd.recordDetail.prototype.doNext=function(b){var a=$(this.elem).next(".rec");if(!a.length){return false}if(b){return true}a.find("B").click()};epgd.doneTimerDetail=epgd.utils.inherits(function(a){this.tr=a;return epgd.eventDetail.call(this)},epgd.eventDetail);epgd.doneTimerDetail.prototype.load=function(){var a=this;epgd.ajax({url:epgd.login.url+"data/donetimer?id="+this.tr.tData.id,async:false,cache:false},function(c){var b=c.donetimer;if(b.state){b.cntlongdescription=epgd.pages.timerListDone.stateIcons[b.state]}b.episode={lang:b.episodelang,season:b.episodeseason,part:b.episodepart};a.id=c.id;a.expire=epgd.utils.now().getTime()+900000;delete b.timerid;delete b.id;a.data=b});return this};epgd.doneTimerDetail.prototype.doRecord=function(a){if(a===true){return epgd.tr.pages.records.similarTimer}epgd.eventDetail.prototype.doRecord.call(this,a)};epgd.doneTimerDetail.prototype.doPlay=function(a){return false};epgd.doneTimerDetail.prototype.doPrev=function(b){var a=$(this.tr).prev("tr");if(!a.length){return false}if(b){return true}a.find("td").click()};epgd.doneTimerDetail.prototype.doNext=function(b){var a=$(this.tr).next("tr");if(!a.length){return false}if(b){return true}a.find("td").click()};$(document).ready(function(){epgd.eventDetail.prototype.win=new epgd.eventDetail.win()});epgd.pages.editChannels={render:function(){if(!(epgd.login.rights&epgd.rights.umConfigEdit)==epgd.rights.umConfigEdit){return epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}var i=epgd.tr.pages.editChannels,m=epgd.$con,e,l="",h="",k,c,d,g,b,a;for(d in epgd.channels.list){a=epgd.channels.list[d];k=[];for(g in a.sources){c=a.sources[g];k[c.merge]="<li><u>"+g+'</u> <input type="text" readonly value="'+c.extid+'" /></li>'}l+='<li><em class="i-check'+(a.visible&1?"":"-empty")+'"></em><em style="display:none" class="i-check'+(a.visible&2?"":"-empty")+'"></em><span>'+d+'</span><input type="text" value="'+(a.name||"")+'" /></li>'}for(b in epgd.vdrs.list){h+='<li data-url="vdr&uuid='+b+'">'+epgd.vdrs.list[b].name+"</li>"}e=m.html('<div class="ui-widget"><div class="ui-state-highlight ui-corner-all" style="padding: 0.3em 0.7em; font-size:0.9em"><button class="iAsButton i-down-dir">'+i.menu.channelList+'</button> <span class="i-info-circled" style="display:inline-block"></span>'+epgd.tr.pages.editChannels.headline+'</div></div><div class="pageEditChannels" id="pageEditChannelsHead"><div class="selMarkBlock"><b title="'+epgd.tr.markAll+'" class="selected" data-t="1"></b><b title="'+epgd.tr.markNone+'" data-t="0"></b><b title="'+epgd.tr.markToggle+'"><b class="selected"></b></b></div><div class="selMarkBlock" data-index="0" title="'+epgd.tr.pages.editChannels.checkWeb+'">Web<em title="'+epgd.tr.markAll+'" class="iAsButton i-check"></em><em title="'+epgd.tr.markNone+'" class="iAsButton i-check-empty"></em></div><span><input type="text"/>channel-id</span><span><input type="text"/>channel-name</span></div>').find("button");e.click(function(){var n=this.$menu.show();$(document).bind("click.ui_menu",function(o){if(!$(o.target).closest(".ui-menu").length){n.hide();$(this).unbind("click.ui_menu")}});return false})[0].$menu=$('<ul style="font-size:0.8em; width:200px;position:absolute"><li data-id="loadList"><a>'+i.menu.referenceList+'</a><ul style="width:100px"><li data-id="channelpedia"><a>channelpedia</a></li>'+(h?"<li><a>VDR</a><ul>"+h+"</ul></li>":"")+'<li data-id="insertList"><a>'+i.menu.insertAsText+'</a></li></ul></li><li data-id="getChannelNames"><a>'+i.menu.extentEmptyChannelNames+'</a></li><li data-id="getAllChannelNames"><a>'+i.menu.applyAllChannelNames+'</a></li><li data-id="getOrder"><a>'+i.menu.applyChannelSort+"</a></li></ul>").hide().insertAfter(e).menu({select:function(p,q){var s=q.item,n,r,o="";if(!s.attr("data-id")){s=s.parents("li[data-id]:first")}switch(s.attr("data-id")){case"getChannelNames":o='[value=""]';case"getAllChannelNames":epgd.utils.loader.process(function(){var t=[];$("#pageEditChannelsSource li").each(function(){t[this.lastChild.innerHTML]=this.firstChild.innerHTML});$("#pageEditChannels > li > input"+o).each(function(){this.value=t[this.previousSibling.innerHTML]||this.value})});break;case"getOrder":epgd.utils.loader.process(function(){var u=$("#pageEditChannels"),t;$($("#pageEditChannelsSource span").get().reverse()).each(function(){t=u.find("> li > span:contains("+this.innerHTML+")");if(t.length){t.parent().prependTo(u)}})});break;case"insertList":$('<div title="channel.conf"><p>'+i.desc_insertList+' <a href="http://channelpedia.yavdr.com/gen/DVB-S/S19.2E/S19.2E_complete_sorted_by_groups.channels.conf" target="forList">channelpedia.yavdr.com</p><textarea style="width:100%; height:60%"></textarea><button>ok</button></div>').dialog({modal:true,width:500,height:400}).find("textarea").change(function(){epgd.pages.editChannels.insertReferenceList(this.value);$(this).parent().dialog("destroy")});break;case"loadList":if(q.item.attr("data-url")){epgd.ajax({url:epgd.login.url+"data/proxy?id="+q.item.attr("data-url"),dataType:"html",contentType:"text/plain; charset=utf-8"},epgd.pages.editChannels.insertReferenceList);break}case"channelpedia":n=$('<ul style="width:100px" />').appendTo(q.item)[0];epgd.ajax({url:epgd.login.url+"data/proxy?id=channelpedia",dataType:"html",contentType:"text/plain; charset=utf-8"},function(u){s.attr("data-id","");var t=$(u.replace(/<img [^>]+>/g,"")).find(".entryMenu > ul:first");t.find("br").remove();t.find("a").each(function(){this.parentNode.setAttribute("data-url",this.getAttribute("href"));this.removeAttribute("href")});t.find(">li").each(function(){$('<li data-id="channelpediaList"><a>'+this.firstChild.innerHTML+"</a></li>").append($(this).next("ul").width(400)).appendTo(n)});$(p.target).menu("refresh").menu("expand")});return true;case"channelpediaList":r=q.item.attr("data-url");s.attr("data-id","loadList");q.item.removeAttr("data-url");epgd.ajax({url:epgd.login.url+"data/proxy?id=channelpedia&path="+r,dataType:"html",contentType:"text/plain; charset=utf-8"},function(u){var t=$("<ul />");$(u).find('.singleSourceMainMenu li:contains("channels.conf")').each(function(){var v=$(this);$('<li title="'+v.find(".description").text()+'" data-url="channelpedia&path='+r+v.find(".button a").attr("href")+'"><a>'+v.find(".caption").text()+"</a></li>").appendTo(t)});t.appendTo(q.item);$(p.target).menu("refresh").menu("expand")});return true;default:return false}$(document).trigger("click.ui_menu")}}).position({my:"left top",at:"left bottom",of:e[0]});$('<button class="iAsButton i-save">'+epgd.tr.save+"</button>").insertAfter(e).click(function(){var n={};$("#pageEditChannels > li").each(function(p){var q=$(this),o={};k={};q.find(">ol>li").each(function(s){var t=$(this),r=t.find("input").val();o[t.find("u").text()]=k={merge:s};if(r){k.extid=r}});n[q.find("span").text()]={name:q.find("input").val(),visible:q.find("em:eq(0)").hasClass("i-check")*1+q.find("em:eq(1)").hasClass("i-check")*2,order:p+1,sources:o}});epgd.ajax({url:epgd.login.url+"data/save-channels",type:"post",data:JSON.stringify({channels:n})},function(o){o=o.result;if(o.state==200){epgd.utils.popup(epgd.tr.dataSaved);epgd.channels.isDirty=true}else{epgd.utils.popup(o.message)}})});$('<ol id="pageEditChannels" class="pageEditChannels">'+l+"</ol>").appendTo(m).sortable({revert:"invalid",handle:":not(em)"}).click(function(o){if(o.target.nodeName=="EM"){$(o.target).toggleClass("i-check i-check-empty")}else{$li=$(o.target).closest("li");if($li.parent("#pageEditChannels").length){$li.toggleClass("selected");if(o.shiftKey&&this.lastSel){var n=$(this.lastSel),p=$li.index()-n.index();if(p>0){n.nextAll(":lt("+p+"):not(.filterHide)").toggleClass("selected",n.hasClass("selected"))}else{n.prevAll(":lt("+-p+"):not(.filterHide)").toggleClass("selected",n.hasClass("selected"))}}else{this.lastSel=$li[0]}}}});$('<ol id="pageEditChannelsSource" class="pageEditChannels"></ol>').appendTo(m).sortable({connectWith:"#pageEditChannels",revert:"invalid",remove:function(o,n){$('<li><em class="i-check"></em><span>'+n.item.find("span").text()+'</span><input type="text" value="'+n.item.find("i").text()+'" /></li>').insertAfter(n.item);return false}}).hide();m.append('<br clear="all" />');$(window).bind("resize.editChannels",function(){var n=$(window).height()-$("#pageEditChannels").offset().top-20;if($("#pageEditChannelsSource:visible").length==0||(m.width()-$("#pageEditChannels").width()-$("#pageEditChannelsSource").width()-80)>0){$("#pageEditChannels,#pageEditChannelsSource").css({height:n})}else{$("#pageEditChannels").height(n*0.66);$("#pageEditChannelsSource").height(n*0.33)}}).trigger("resize");$(window).bind("epgd_close.editChannels",function(){$(window).unbind(".editChannels");epgd.channels.load()});$("#pageEditChannelsHead em").click(function(){var p=null,n;try{p=$(window.getSelection().getRangeAt(0).cloneContents()).children()}catch(o){p=null}if(!p||!p.length){n=$("#pageEditChannels > li");p=n.filter(".selected");if(!p.length){p=n}}p.find("> em:eq("+this.parentNode.getAttribute("data-index")+").i-check"+(this.className.indexOf("i-check-empty")>0?"":"-empty")).toggleClass("i-check i-check-empty")});$("#pageEditChannelsHead b").click(function(){var n=this.getAttribute("data-t");$("#pageEditChannels > li").toggleClass("selected",n==1?true:n==0?false:undefined);return false});this.inp_ChID=$("#pageEditChannelsHead input:eq(0)").keyup(this.filter)[0];this.inp_ChName=$("#pageEditChannelsHead input:eq(1)").keyup(this.filter)[0]},filter:function(){var b=epgd.pages.editChannels.inp_ChID.value.toLowerCase(),a=epgd.pages.editChannels.inp_ChName.value.toLowerCase();$("#pageEditChannels > li").each(function(){var c=$(this);if((!b||c.find("span").text().toLowerCase().indexOf(b)>=0)&&(!a||c.find("input").val().toLowerCase().indexOf(a)>=0)){c.removeClass("filterHide")}else{c.addClass("filterHide")}})},insertReferenceList:function(c){var a="",b;$(c.split("\n")).each(function(){b=this.split(":");if(b[0]){a+="<li><i>"+b[0].split(/,|;/)[0]+"</i><span>"+b[3]+"-"+b[10]+"-"+b[11]+"-"+b[9]+"</span></li>"}});$("#pageEditChannelsSource").show().html(a);$(window).trigger("resize.editChannels")}};epgd.pages.editUser={cur:null,render:function(){if(!(epgd.login.rights&epgd.rights.umConfigUsers)==epgd.rights.umConfigUsers){return epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}var b=epgd.tr.pages.editUser,a=$("<form></form>"),c=$('<select size="10"></select>').change(function(){epgd.pages.editUser.showUser(this[this.selectedIndex].data,a,epgd.pages.editUser.render)});$("<option>"+b.add+"</option>").appendTo(c)[0];epgd.$con.html('<div id="page_editUser"><div><h2>'+b.user+"</h2></div></div>");epgd.ajax({url:epgd.login.url+"data/users",cache:false},function(d){for(var e in d.users){$("<option>"+e+"</option>").appendTo(c)[0].data=d.users[e]}});epgd.$con.find("#page_editUser").append(a).children().first().append(c)},showUser:function(a,d,i){epgd.pages.editUser.cur=a||{user:"",active:1,rights:epgd.login.rights};var h=epgd.tr.pages.editUser,g=epgd.pages.editUser.cur,c="",e;for(e in epgd.rights){c+='<div><input type="checkbox"'+((g.rights&epgd.rights[e])==epgd.rights[e]?' checked="checked"':"")+' name="uRights" id="uR'+e+'" value="'+epgd.rights[e]+'"/><label for="uR'+e+'">'+(h.rights[e]||e)+"</label></div>"}d.html((!g.user?"<h2>"+epgd.tr.pages.login.userName+'</h2><div><input type="text" id="uName" value="" /></div><br />':"")+'<div><input type="radio"'+(g.active=="1"?' checked="checked"':"")+' name="uActive" value="1" id="uActive"/><label for="uActive">'+h.active+'</label> <input type="radio"'+(g.active=="0"?' checked="checked"':"")+' name="uActive" value="0" id="uInactive" /><label for="uInActive">'+h.inActive+"</label>"+(g.user&&' <input type="radio" name="uActive" value="-1" id="uDel"/><label for="uDel">'+epgd.tr.del+"</label>")+"</div><h2>"+epgd.tr.pages.login.password+'</h2><div><input type="password" id="uPass" /></div><h2>'+h.rights.label+"</h2><div>"+c+'</div><div><br /><button class="iAsButton i-save">'+epgd.tr.save+"</button></div>");d.find("button").click(function(){return epgd.pages.editUser.save(this.form,i)});$uRights=$(d[0].uRights).each(function(){this.r=parseInt(this.value,10)});function b(){var k=this.r;if(this.checked){$uRights.each(function(){if(this.r<k&&(k&this.r)==this.r){this.checked=this.disabled=true}})}else{$uRights.each(function(){if(this.r<k&&(k&this.r)==this.r){this.disabled=false;var l=this;$uRights.each(function(){if(this.checked&&this.r>l.r&&(this.r&l.r)==l.r){l.checked=l.disabled=true}})}})}}$uRights.each(b).click(b)},save:function(b,d){var a={rights:1},c=epgd.pages.editUser.cur;$(b.uRights).each(function(){if(this.checked){a.rights|=this.r}});a.active=parseInt(b.uActive.value,10);if(c.user){a.user=c.user;if(a.active==-1){delete a.active;a.state="D"}else{a.state="M";if(a.active==c.active){delete a.active}if(a.rights==c.rights){delete a.rights}if(b.uPass.value){a.passwd=YaMD5.hashStr(a.user+b.uPass.value)}}}else{a.state="C";a.user=b.uName.value;if(!a.user){return !epgd.utils.topInfo(epgd.tr.error.emptyField.replace("$field$",epgd.tr.pages.login.userName),{isError:1})}a.passwd=YaMD5.hashStr(a.user+b.uPass.value)}epgd.ajax({url:epgd.login.url+"data/save-users",type:"post",data:JSON.stringify({users:[a]})},function(e){if(e.Error||e.result.state!=200){return epgd.utils.topInfo(e.Error||e.result.message,{isError:1})}(a.user==epgd.login.user)&&$(window).trigger("login_changed",a);if($.isFunction(d)){d(e)}});return false}};epgd.pages.help={$con:null,render:function(){$("#menu_help").addClass("menu-active");if(!this.$con){this.load()}epgd.$con.html(this.$con);this.init()},getButton:function(b,a){return(a?"<a":"<button")+' id="bh_'+b+'" class="help iAsButton i-help" role="button">'+epgd.tr.menu.help+"</"+(a?"a>":"button>")},getIcon:function(a){return'<a id="bh_'+a+'" class="help iAsIcon i-help" />'},initButtons:function(a){if(!a){a=epgd.$con}a.tooltip({items:".help",tooltipClass:"quickInfo",content:function(){return epgd.pages.help.getQuickInfo(this.id.slice(3))},open:function(b,c){$(c.tooltip).position({of:b.toElement,my:"left top"});b.preventDefault()}})},getQuickInfo:function(b){var a=epgd.pages.help;if(!a.$con){a.load()}return a.$con.find("#h_"+b).html()||epgd.tr.pages.help.noHelp},load:function(){var a=this;epgd.ajax({url:epgd.tr.pages.help.url,async:false,dataType:"html",contentType:"text/plain; charset=utf-8"},function(b){a.$con=$($(b).filter("#help")[0]);$(b).filter("#help_js").appendTo(document.body)})}};epgd.pages.login={useCookie:document.cookie.match(/login=([^;]+)/),render:function(){if(epgd.login.session){this.doLogin("logout")}this.showForm()},showForm:function(c){var b=epgd.tr.pages.login,a=$("#login");if(!a.length){a=$('<div id="login" title="'+b.label+'" class="searchDialog ui-dialog" style="margin:5% auto"><form class="ui-dialog-content ui-widget-content"><table cellpadding="5"><tr><td>'+b.userName+'</td><td><input type="text" id="lUser" /></td></tr><tr><td>'+b.password+'</td><td><input type="password" id="lPass" /></td></tr><tr><td colspan="2"><input type="checkbox" id="lAlways" /> <label for="lAlways">'+b.loggedAlwaysIn+"</label></td></tr></table></form></div>");a.dialog({modal:true,width:"auto",closeOnEscape:false,buttons:[{text:b.label,icons:{primary:"ui-icon-unlocked"},click:function(){var d=a.find("form")[0];if(!d.lUser.value){return !!epgd.utils.topInfo(epgd.tr.error.emptyField.replace("$field$",b.userName),{isError:1})}$(this).dialog("close");epgd.pages.login.useCookie=d.lAlways.checked?[]:null;epgd.pages.login.doLogin(d.lUser.value,d.lPass.value,c)}}]}).keypress(function(d){if(d.keyCode==13){$(this).parent().find(".ui-dialog-buttonpane button:eq(0)").trigger("click")}}).parent().find(".ui-dialog-titlebar-close").remove()}else{a.dialog("open")}},doLogin:function(c,g,i){var d=epgd.login,b="",h=sessionStorage;try{h.setItem("_storagetest_",1);h.removeItem("_storagetest_")}catch(e){h={removeItem:function(){},setItem:function(){},getItem:function(){return null}}}function a(){if(epgd.login.user!=d.user||epgd.login.rights!=d.rights){if(!epgd.login.session){if(epgd.pages.login.useCookie){epgd.pages.login.useCookie[1]=null;document.cookie="login=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}h.removeItem("login");epgd.login.url=""}else{if(epgd.pages.login.useCookie){epgd.pages.login.useCookie[1]=b;var k=new Date();k.setTime(k.getTime()+365*24*60*60*1000);document.cookie="login="+b+"; expires="+k.toUTCString()}h.setItem("login",b);epgd.login.url="sid"+epgd.login.session+"/"}$(window).trigger("login_changed",d)}epgd.login.url=epgd.login.session?"sid"+epgd.login.session+"/":"";if($.isFunction(i)){i()}}if(c!="logout"){if(d.session){$.ajax({url:d.url+"data/login",data:JSON.stringify({key:""}),type:"post",contentType:"application/json; charset=utf-8",dataType:"json"});epgd.login.url=""}if(epgd.profile.needLogin=="0"){epgd.login={user:"",session:"",rights:4294967295,url:""};return a()}if(c){b=YaMD5.hashStr(c+g)}else{b=h.getItem("login");if(!b&&epgd.pages.login.useCookie){b=epgd.pages.login.useCookie[1]}if(!b){return this.showForm(i)}}}$.ajax({url:epgd.login.url+"data/login",data:JSON.stringify({key:b}),type:"post",contentType:"application/json; charset=utf-8",dataType:"json"}).done(function(l){var k=epgd.tr.pages.login;epgd.login=l.login||{user:"",session:"",rights:0,url:""};if(!epgd.login.session){if(c=="logout"){epgd.utils.topInfo(k.logoutMessage)}else{epgd.utils.topInfo(k.error,{isError:1})}$("#menu_login a").text(k.label)}else{$("#menu_login a").text(epgd.login.user+" "+k.logout);if(location.hash=="#menu_login"||location.hash=="#"){location.hash=""}}return a()})}};epgd.pages.magazine={startTime:null,endTime:null,$head:null,$con:null,list:[],viewCnt:0,scrollStart:0,timeLineL:null,timeLineR:null,qt:{},imgPath:epgd.profile.eventImgPath?epgd.profile.eventImgPath+"?no=0&maxW=100&maxH=70&id=":false,init:function(){this.select=epgd.channels.selBox;$(window).bind("channels_load",function(){var a=epgd.pages.magazine,b;if(!a.$head){return}a.$head.empty();for(b in a.list){a.list[b].index=-1}a._initChannels();for(b in a.list){if(a.list[b].index==-1){a.preTime.removeChild(a.list[b].col);delete a.list[b]}}})},initQT:function(){var a={};epgd.profile.quickTimes.replace(/=([0-9]{1,2}):([0-9]{1,2})/g,function(c,d,b){a[parseInt(d,10)]="<p"+(b?' style="margin-top:'+(b*2)+'px"':"")+"> </p>"});this.qt=a},_initChannels:function(){var b,a;for(a=0;a<this.select.length;a++){b=this.list[this.select[a].value];if(!b){b=new epgd.pages.magazine.channel(this.select[a].value,a,$('<div class="ui-widget-content"/>')[0]);this.list[b.id]=b}else{b.index=a}this.preTime.appendChild(b.col);this.select[a].ch=b;this.$head.append('<div class="ui-widget-content ui-corner-top">'+epgd.channels.getHtml(b.id)+"</div>")}this.$head.css("width",(208*this.select.length+55)+"px")},_initWinBindings:function(){$(window).bind("epgd_close.pages_magazine",function(){epgd.$dtPicker.hide();$(window).unbind(".pages_magazine");clearInterval(this.pages_magazine.timeInterval);delete this.pages_magazine}).bind("resize.pages_magazine",function(){var b=$(window).width(),a=$(this).scrollLeft();this.pages_magazine.$nav.width(b+"px");this.pages_magazine.$con.css("height",($(window).height()-10-$("#magazine").offset().top)+"px");this.pages_magazine.viewCnt=parseInt((b-110)/208,10);if(this.pages_magazine.viewCnt<5){this.pages_magazine.timeLineR.style.left="-50px";this.pages_magazine.$con.css("width",(208*this.pages_magazine.select.length+25)+"px")}else{if(this.pages_magazine.viewCnt>=this.pages_magazine.select.length){this.pages_magazine.viewCnt=this.pages_magazine.select.length;this.pages_magazine.timeLineR.style.left="-50px";b=this.pages_magazine.viewCnt*208+55;this.pages_magazine.$con.css("width",(b-30)+"px")}else{this.pages_magazine.timeLineR.style.left=(a+b-52)+"px";this.pages_magazine.$con.css("width",(208*this.pages_magazine.select.length+150)+"px")}}this.pages_magazine.lineNow.style.width=(b-10)+"px";epgd.$menu.parent().offset({left:a});this.pages_magazine.$nav.offset({left:a});this.pages_magazine.update()}).bind("scroll.pages_magazine",function(){this.pages_magazine.timeLineL.style.left="-50px";this.pages_magazine.timeLineR.style.left="-50px"}).bind("scrollstop.pages_magazine",function(){var a=$(this).scrollLeft();this.pages_magazine.timeLineL.style.left=this.pages_magazine.lineNow.style.left=a+"px";if(this.pages_magazine.viewCnt>=5&&this.pages_magazine.viewCnt<this.pages_magazine.select.length){this.pages_magazine.timeLineR.style.left=(a+$(window).width()-52)+"px"}this.pages_magazine.nextMain=parseInt((a+104)/208,10);if(this.pages_magazine.select.selectedIndex!=this.pages_magazine.nextMain){this.pages_magazine.setMain(0,this.pages_magazine.nextMain,true)}epgd.$menu.parent().offset({left:a});this.pages_magazine.$nav.offset({left:a});return false}).bind("datepicker.pages_magazine",function(){this.pages_magazine.setTime(epgd.utils.unixTime(epgd.$dtPicker.datetimepicker("getDate")||epgd.utils.now()),true)})[0].pages_magazine=this;this.$con.bind("scrollstop.pages_magazine",function(){var a=$(this).scrollTop();if(a>this.pages_magazine.scrollEnd){this.pages_magazine.setTime(a*30+epgd.profile.minEventTime)}else{if(a<this.pages_magazine.scrollStart){this.pages_magazine.setTime(Math.max(this.pages_magazine.startTime-43200,epgd.profile.minEventTime))}}});this._setLineNow();this.timeInterval=setInterval(this._setLineNow,60000)},_setLineNow:function(){var a=window.pages_magazine,b=new Date().getTime()/1000;if(b>a.endTime||(a.startTime-epgd.profile.minEventTime)<-3600){$(window).trigger("epgd_close");$('<div class="ui-widget-overlay ui-front"></div>').click(function(){epgd.profile.minEventTime=epgd.utils.now().getTime()/1000-10800;$(window).trigger("profile_updated",{minEventTime:true});epgd.$dtPicker.datetimepicker("setDate",epgd.utils.now());a.$con.empty();a.render();$(this).remove()}).appendTo(document.body);return}a.lineNow.style.top=((b-a.startTime)/30+a.scrollStart)+"px";a.lineNow.innerHTML=epgd.utils.formatTime(b)},render:function(b){$("#menu_magazine").addClass("menu-active").append(epgd.$dtPicker.show());var a=epgd.utils.unixTime(epgd.utils.now()),c;if(this.startTime&&(this.startTime-epgd.profile.minEventTime)<-3600){this.startTime=null;this.list=[]}if(!this.startTime){$(window).trigger("epgd_close");$(this.select).appendTo(epgd.$menu.find("#menu_magazine")).mousedown(function(d){d.stopPropagation();return true}).click(function(d){return false}).change(function(){epgd.pages.magazine.render($(this).val())});if(this.select.selectedIndex<0){this.select.selectedIndex=0}this.$nav=$('<div id="magazine-nav"><div class="ui-widget-content ui-corner-top left"><div class="ui-widget-content ui-corner-top"><span class="iAsButton i-left-dir"></span><span class="iAsButton i-rewind"></span></div></div><div class="ui-widget-content ui-corner-top right"><div class="ui-widget-content ui-corner-top"><span class="iAsButton i-right-dir"></span><span class="iAsButton i-forward"></span></div></div></div>');this.$head=$('<div id="magazine-head"></div>');this.$con=$('<div id="magazine"></div>');this.$con[0].pages_magazine=this;this.preTime=$('<div style="height:'+parseInt((epgd.profile.maxEventTime-epgd.profile.minEventTime)/30,10)+'px"></div>').appendTo(this.$con)[0];this.timeLineL=$('<div class="ui-widget-content timeLine"></div>').appendTo(this.preTime)[0];this.timeLineR=$('<div class="ui-widget-content timeLine tlr"></div>').appendTo(this.preTime)[0];this.lineNow=$('<p class="timeNow"></p>').appendTo(this.preTime)[0];this._initChannels();this.startTime=a+3600;c=new Date(this.startTime*1000);if(c.getMinutes()>0){c.setMinutes(0);this.startTime=c.getTime()/1000}this.endTime=this.startTime;this.setTime(this.startTime-7200)}if(!window.pages_magazine){this._initWinBindings();epgd.$con.empty();this.$nav.appendTo(epgd.$con).bind("click",this.actionHead);this.$head.appendTo(epgd.$con).bind("click",function(d){if(d.target.className=="i-tv"){epgd.vdrs.current.switchChannel(d.target.parentNode.id)}});this.$con.appendTo(epgd.$con).bind("click",this.actionCon).bind("touchend",this.actionConOpen);if(!$.support.touch&&epgd.profile.magazinePan>0){this._pan()}}$(window).trigger("resize.pages_magazine");if(b){this.setChannel(b)}if(a<this.startTime||a>this.endTime){this.setTime(a)}this.$con.scrollTop((a-epgd.profile.minEventTime)/30-15);$(window).trigger("resize.pages_magazine")},_pan:function(){var b=false,a=$('<div style="width:90%; height:35px; margin-top:15px; position:fixed;z-index:99;left:5%"></div>').prependTo(epgd.$con)[0],c=$('<div style="width:90%; height:35px; position:fixed;z-index:99;bottom:0;left:5%"></div>').appendTo(epgd.$con)[0];this.timeLineL.pan=-1;this.timeLineR.pan=1;a.pan=epgd.profile.magazinePan*-30;c.pan=epgd.profile.magazinePan*30;window.tp=a;window.bp=c;window.p=b;$([this.timeLineL,this.timeLineR,a,c]).mouseover(function(d){if(b){return}b=this.pan;window.setTimeout(function(){if(b){var e=window.setInterval(function(){if(!b||!window.pages_magazine){return window.clearInterval(e)}if(b<-1||b>1){window.pages_magazine.setTime((window.pages_magazine.$con.scrollTop()+15)*30+epgd.profile.minEventTime+b,true)}else{window.pages_magazine.setMain(b)}},(b<-1||b>1?100:1200))}},epgd.profile.magazinePanDelay)}).mouseout(function(){b=false})},setChannel:function(b){if(this.list.lengt>0){this.setMain(0,this.list[b].index)}else{var a=this;$(window).one("resize.pages_magazine",function(){a.setMain(0,a.list[b].index)})}},setMain:function(e,a,d){var b=this.select,c=isNaN(a)?b.selectedIndex:a;c+=e;if(c<0){c=0}else{if(c>=b.length-this.viewCnt){c=b.length-this.viewCnt}}b.selectedIndex=c;this.update();!d&&$(window).scrollLeft(c*208)},setTime:function(g,a){var b,e="",c,d=g+43200;if(g<this.startTime){do{this.startTime-=3600;b=epgd.utils.formatTime(this.startTime);c=parseInt(b,10);if(c%4==0){b+=$.datepicker.formatDate("<br />D,<br />dd<br />MM<br />yy",new Date(this.startTime*1000))}e=(this.qt[c]||"")+"<dfn>"+b+"</dfn>"+e}while(this.startTime>g);$(this.timeLineL).prepend(e);$(this.timeLineR).prepend(e);this.scrollStart=(this.startTime-epgd.profile.minEventTime)/30;if(this.scrollStart<0){this.scrollStart=0;this._setLineNow()}this.preTime.style.paddingTop=this.scrollStart+"px"}if(this.endTime<d){e="";d=Math.max(d,this.endTime+43200);for(;this.endTime<d;this.endTime+=3600){b=epgd.utils.formatTime(this.endTime);c=parseInt(b,10);if(c%4==0){b+=$.datepicker.formatDate("<br />D,<br />dd<br />M<br />yy",new Date(this.endTime*1000))}e+=(this.qt[c]||"")+"<dfn>"+b+"</dfn>"}$(this.timeLineL).append(e);$(this.timeLineR).append(e);this.scrollEnd=(this.endTime-epgd.profile.minEventTime-43200)/30}e&&this.update();a&&this.$con.scrollTop((g-epgd.profile.minEventTime)/30-15)},actionHead:function(b){var a=epgd.pages.magazine,d;if(b.target.nodeName=="SPAN"){d=b.target.className;if(d.indexOf("i-left-dir")>-1){a.setMain(-1)}else{if(d.indexOf("i-rewind")>-1){a.setMain(-a.viewCnt)}else{if(d.indexOf("i-right-dir")>-1){a.setMain(1)}else{if(d.indexOf("i-forward")>-1){a.setMain(a.viewCnt)}}}}}},actionConOpen:function(b){var a=$(b.target).closest("dt")[0];if(a){a.firstOpen=(a.clientHeight!=a.scrollHeight)}},actionCon:function(b){var a=$(b.target).closest("dt")[0];if(a){if(a.firstOpen){return false}if(!a.eventDetail){a.eventDetail=new epgd.eventDetail(a.title)}epgd.utils.loader.process(function(){a.eventDetail.render()})}},update:function(){var a=this,b;for(b=0,j=this.select.selectedIndex;b<this.viewCnt&&j<this.select.length;b++){this.select[j++].ch.updateTime()}window.setTimeout(function(){for(var d=0,c=a.select.selectedIndex+a.viewCnt;d<a.viewCnt&&c<a.select.length;d++){a.select[c++].ch.updateTime()}},500)}};epgd.pages.magazine.channel=function(c,b,a){this.id=c;this.index=b;this.col=a;this.startTime;this.endTime};epgd.pages.magazine.channel.prototype={updateTime:function(){if(!this.startTime){this.startTime=epgd.pages.magazine.startTime;this.endTime=epgd.pages.magazine.endTime;this.loadData(epgd.pages.magazine.startTime,epgd.pages.magazine.endTime)}else{if(epgd.pages.magazine.startTime<this.startTime){this.loadData(epgd.pages.magazine.startTime,this.startTime)}if(epgd.pages.magazine.endTime>this.endTime){this.loadData(this.endTime,epgd.pages.magazine.endTime)}}},loadData:function(c,b){var a=this,d=(a.endTime<b);if(d){a.endTime=b}else{a.startTime=c}epgd.ajax({url:epgd.login.url+"data/events?time="+c+"&endtime="+b+"&channelid="+this.id},function(k){var g="",n=k.events[0],l,e,s=null,r=$(a.col),o,m,p,q;if(n){if(d){s=r.find("dt:last");q=s[0].eTime;if(s.attr("title")==n.id){delete k.events[0]}}else{q=n.starttime;s=r.find("dt:first");if(s.attr("title")==k.events[k.events.length-1].id){delete k.events[k.events.length-1]}}for(l=0;l<k.events.length;l++){e=k.events[l];o=e.shortdescription||e.shorttext;m=e.duration;p=parseInt(m/60,10);m+=(e.starttime-q);m=m<600?20:parseInt(m/30,10);q+=m*30;g+='<dt title="'+e.id+'" style="height:'+m+"px;min-height:"+m+'px"><div class="title">'+e.title+"</div>"+(epgd.pages.magazine.imgPath&&e.imagecount?'<img src="'+epgd.pages.magazine.imgPath+e.id+'" />':"")+'<div class="time'+(e.timerid?" hasTimer":"")+'"><u>'+epgd.utils.formatTime(e.starttime)+"</u><i>"+p+"&nbsp;"+epgd.tr.minutes+"</i></div>"+(e.numrating?'<span class="rate rate'+e.numrating+'"> </span>':"")+(e.tipp?'<b class="tipp">'+e.tipp+"</b>":"")+'<div class="desc">'+(e.genre?"<span>"+e.genre+"</span> ":"")+(o?o.replace(/\n/g,"<br />"):"")+"</div></dt>"}}else{m=(b-c)/30;g='<div style="height:'+m+"px;min-height:"+m+'px"></div>';n={starttime:c};q=c}if(d){r.append(g);r.find("dt:last")[0].eTime=q}else{r.prepend(g);if(s&&s.length){s.css("margin-top","");m=s[0].starttime-q;if(m){m=parseInt(m/30,10)+parseInt(s.css("min-height"),10);s.css({height:m+"px","min-height":m+"px"})}}else{r.find("dt:last")[0].eTime=q}r.find("dt:first").css("margin-top",parseInt((n.starttime-c)/30,10))[0].starttime=n}})}};epgd.pages.now={$ul:null,timestamp_min:-1,timestamp_max:0,timestamp_cur:0,init:function(){$(window).bind("channels_load",function(){epgd.pages.timestamp_max=0})},render:function(){if(!window.pages_now){this.$search=$('<div style="float:left;margin-left:5px"></div>').appendTo($("#menu_now")).click(function(){if(this.curType=="@Now"){window.pages_now.setTime(null,"@Now")}});var a=this.$searchMenu=$('<ul class="ui-menu ui-widget ui-widget-content"></ul>').appendTo($("#menu_now")).hide();epgd.profile.quickTimes&&epgd.profile.quickTimes.replace(/([^=]+)=!?([^~]+)~?/g,function(c,b,d){a.append('<li data-type="'+d+'" class="ui-menu-item '+(d.indexOf("@")==0&&d!="@Next"&&d!="@Now"?"i-search":"i-clock")+'">'+b+"</li>")});if(!a.find('li[data-type="@Next"]').length){a.prepend('<li data-type="@Next" class="ui-menu-item">'+epgd.tr.pages.eventDetail.eventNext+"</li>")}if(!a.find('li[data-type="@Now"]').length){a.prepend('<li data-type="@Now" class="ui-menu-item">'+epgd.tr.pages.dateTimePicker.currentText+"</li>")}this.$searchMenu.click(function(b){if(b.target.getAttribute("data-type")){window.pages_now.setTime(null,b.target.getAttribute("data-type"));a.hide()}});$(window).bind("epgd_close.pages_now",function(){if(window.pages_now){epgd.$dtPicker.hide();window.pages_now.$searchMenu.remove();window.pages_now.$search.remove();delete window.pages_now}$(window).unbind(".pages_now");$("#menu_now").unbind(".pages_now")}).bind("datepicker.pages_now",function(){this.pages_now.setTime(epgd.utils.unixTime(epgd.$dtPicker.datetimepicker("getDate")))})[0].pages_now=this;this.$ul=epgd.$con.html('<div id="pageNow"><ul class="teaserList"></ul></div>').find("ul").click(function(c){if($(c.target).closest(".channel").length){$(window).trigger("epgd_close.eventDetail");if(c.target.className=="i-tv"){epgd.vdrs.current.switchChannel(c.target.parentNode.id)}else{epgd.$menu.menu("select",{target:"#menu_magazine"});epgd.pages.magazine.setChannel($(c.target).closest(".channel").attr("id"))}return}var b=$(c.target).closest("li")[0];if(!b){return}if(!b.eventDetail){b.eventDetail=new epgd.eventDetail(b.title)}epgd.utils.loader.process(function(){b.eventDetail.render()})});this.setTime(null,"@Now")}$("#menu_now").addClass("menu-active").bind("click.pages_now",function(b){if((b.target==this||b.target.nodeName=="A")&&window.pages_now){window.pages_now.$searchMenu.show();b.preventDefault()}return false}).append(epgd.$dtPicker.show())},setTime:function(c,b){b=b||"@time";var a=" "+epgd.tr.pages.now.at;if(b=="@Now"||b=="@time"){this.timestamp_cur=c||epgd.utils.unixTime(epgd.utils.now());this.load("data/events?time="+this.timestamp_cur);epgd.$dtPicker.datetimepicker("setDate",epgd.utils.date(this.timestamp_cur))}else{if(b=="@Next"){this.load("data/events?next=1&time="+this.timestamp_cur)}else{if(b[0]=="@"){a=" "+epgd.tr.menu.search;this.load("data/search","post",JSON.stringify({autotimername:b.slice(1)}))}else{$.timepicker.quicklink({target:{nodeName:"U",innerHTML:b},data:{unit:"time"}});$(window).trigger("datepicker")}}}this.$search[0].curType=b;this.$search.text(this.$searchMenu.find('li[data-type="'+b+'"]').text()+a)},load:function(a,b,c){epgd.utils.loader.process(function(){pages_now.$ul.empty();epgd.ajax({url:epgd.login.url+a,async:false,cache:false,type:b,data:c},function(h){if(!h.events||!h.events.length){epgd.utils.loader.close();return epgd.utils.popup(epgd.tr.error.noData)}var i=epgd.profile.eventImgPath?epgd.profile.eventImgPath+"?no=0&maxW=100&maxH=70&id=":false,g=0,d=2000000000,e=epgd.tr.dateTimePicker.dateFormat.replace(/\.?y+/,"");now=parseInt(epgd.utils.now().getTime()/1000,10);$.each(h.events,function(o,m){var k=m.starttime+m.duration,l=((now-m.starttime)/m.duration*100),n=m.shortdescription||m.shorttext;if(m.starttime>g){g=m.starttime}if(k<d){d=k}$('<li title="'+m.id+'" class="ui-widget-content ui-corner-all">'+epgd.channels.getHtml(m.channelid)+'<div class="time'+(m.timerid?" hasTimer":"")+'"><b>'+epgd.utils.formatTime(m.starttime)+"</b>&nbsp;&ndash;&nbsp;"+epgd.utils.formatTime(k)+" "+epgd.tr.oClock+(m.tipp?'<b class="tipp">'+m.tipp+"</b>":"")+"</div>"+(l>0&&l<=100?'<div class="progress"><div style="width: '+l+'%"></div></div>':'<div class="date">'+epgd.utils.formatDate(m.starttime,e)+"</div>")+'<div class="desc">'+(i&&m.imagecount?'<img src="'+i+m.id+'" />':"")+'<div class="title">'+m.title+(m.numrating?'<span class="rate rate'+m.numrating+'"> </span>':"")+"</div>"+(m.genre?"<span>"+m.genre+"</span> ":"")+(n?n.replace(/\n/g,"<br />"):"")+"</div></li>").appendTo(pages_now.$ul)});epgd.pages.now.timestamp_min=g;epgd.pages.now.timestamp_max=d;epgd.utils.loader.close()})},true)}};epgd.pages.profile={render:function(){var b=epgd.profile.startPage.slice(5),c="<option>"+epgd.tr.pages.timerList.namingModes.join("</option><option>")+"</option>",a='<form id="page_profile"><h3>Interface</h3><div><table><tr><td>startpage</td><td><select id="startPage">'+jQuery.map(epgd.tr.menu,function(e,d){return'<option value="menu_'+d+(b==d?'" selected="selected">':'">')+e+"</option>"}).join("")+'</select></td></tr><tr><td>default VDR</td><td><select id="defaultVDRuuid">'+$("#menu_vdrs").find("select").html()+'</select></td></tr><tr><td>datepicker first day</td><td><select id="pickerFirstDay"><option>'+epgd.tr.dateTimePicker.dayNames.join("</option><option>")+'</option></select></td></tr><tr><td>quicklinks</td><td><textarea rows="5" style="float:left;width:50%; margin-right:10px" id="quickTimes" onchange="epgd.pages.profile.validate.quickTimes(this)">'+epgd.profile.quickTimes.replace(/~/g,"\n")+'</textarea><span>enter in each line label=hh:mm(24h), eg:<br />prime time=20:15 or prime time=!20:15 (this time will not be highlighted in magazine)<br />now=@Now or next=@Next<br />tip=@searchtimerName</span></td></tr><tr><td>constabel-login</td><td><input type="text" class="full" id="constabelLoginPath" value="'+(epgd.profile.constabelLoginPath||"")+'" /><br />e.g.https://www.eplists.de/eplist.cgi?action=login&login=[username]&secret=[password]</td></tr><tr><td>'+epgd.tr.pages.profile.maxListEntries+'</td><td><input type="text" id="maxListEntries" value="'+epgd.profile.maxListEntries+'" data-valexp="^[1-9]{0,3}$" /></td></tr><tr><th colspan="2">'+epgd.tr.menu.magazine+"</th><tr><tr><td>"+epgd.tr.pages.profile.magazinePan+'</td><td><input type="text" id="magazinePan" value="'+epgd.profile.magazinePan+'" data-valexp="^[0-9]{1,2}$" /></td></tr><tr><td>'+epgd.tr.pages.profile.magazinePanDelay+'</td><td><input type="text" id="magazinePanDelay" value="'+epgd.profile.magazinePanDelay+'" data-valexp="^[1-9][0-9]{2,3}$" /></td></tr><tr><th colspan="2">'+epgd.tr.pages.timer.timerList+"</th><tr><tr><td>"+epgd.tr.pages.timerList.namingMode+"</td><td><b>"+epgd.tr.pages.eventDetail.scrapperSerieInfo+"</b><div>"+epgd.tr.pages.timer.timerList+': <select id="namingModeSerie">'+c+'</select><input id="namingModeSerieTemplate" value="'+epgd.profile.namingModeSearchSerieTemplate+'" type="text" style="width:90%" /></div><div>'+epgd.tr.pages.timer.searchTimerList+': <select id="namingModeSearchSerie">'+c+'</select><input id="namingModeSearchSerieTemplate" value="'+epgd.profile.namingModeSearchSerieTemplate+'" type="text" style="width:90%" /></div><b style="text-decoration:line-through">'+epgd.tr.pages.eventDetail.scrapperSerieInfo+"</b><div>"+epgd.tr.pages.timer.timerList+': <select id="namingModeMovie">'+c+'</select><input id="namingModeMovieTemplate" value="'+epgd.profile.namingModeMovieTemplate+'" type="text" style="width:90%" /></div><div>'+epgd.tr.pages.timer.searchTimerList+': <select id="namingModeSearchMovie">'+c+'</select><input id="namingModeSearchMovieTemplate" value="'+epgd.profile.namingModeSearchMovieTemplate+'" type="text" style="width:90%" /></div></td></tr><tr><td>'+epgd.tr.pages.timerList.chFormat+'</td><td><input id="chFormat" readonly onclick="epgd.timerEditChFormat(this)" value="'+epgd.profile.chFormat+'" /></td></tr><tr><td>VDR</td><td><select id="timerDefaultVDRuuid"><option value="">Auto</option>'+$("#menu_vdrs").find("select").html()+"</select></td></tr><tr><td>"+epgd.tr.pages.profile.mailReceiver+'</td><td><input type="mail" value="'+(epgd.profile.mailReceiver||"")+"\" id=\"mailReceiver\" /><button onclick=\"epgd.utils.sendMail('checkMailAddress','it works','',$(form.mailReceiver).val())\">"+epgd.tr.test+"</button></td></tr><tr><td>"+epgd.tr.pages.profile.sendMessages+"</td><td>"+jQuery.map(epgd.tr.pages.timerList.messageTypes,function(e,d){return'<input type="checkbox" value="'+d+'" name="messageMailTypes"'+(epgd.profile.messageMailTypes.indexOf(d)>=0?' checked="checked"':"")+" />"+e}).join("&nbsp;&nbsp;")+'</td></tr><tr><th colspan="2">'+epgd.tr.menu.search+"</th><tr><tr><td>"+epgd.tr.advanced+'</td><td><input type="checkbox" id="searchAdv" /></td></tr><tr><th colspan="2">VDR OSD</th><tr><tr><td>'+epgd.tr.pages.profile.vdr.startWithSched+'</td><td><input type="checkbox" id="startWithSched"'+(epgd.profile.startWithSched=="1"?' checked="checked"':"")+' /></td></tr><tr><th colspan="2">'+epgd.tr.menu.records+"</th><tr><tr><td>"+epgd.tr.pages.profile.record.subFolderSort+'</td><td><select id="recordSubFolderSort"><option value="1">'+epgd.tr.pages.eventDetail.title+' up</option><option value="2">'+epgd.tr.pages.eventDetail.title+' down</option><option value="3">'+epgd.tr.pages.timerList.folder+' up</option><option value="4">'+epgd.tr.pages.timerList.folder+' down</option><option value="5">'+epgd.tr.pages.timerList.recordTime+' up</option><option value="6">'+epgd.tr.pages.timerList.recordTime+" down</option></select></td></tr></table></div>";if((epgd.login.rights&epgd.rights.umConfigEdit)==epgd.rights.umConfigEdit){a+="<h3>System</h3><div></div>"}epgd.$con.html(a+'</form><br /><input type="button" value="'+epgd.tr.save+'" onclick="epgd.pages.profile.save()" class="ui-button ui-widget ui-state-default ui-corner-all">');this.form=$("#page_profile").tooltip().accordion({headers:"<h3>",collapsible:true,heightStyle:"content",activate:function(e,g){var d=g.newPanel[0];if(d&&!d.hasLoaded){d.hasLoaded=true;if(g.newHeader.text()=="System"){$(d).html('<table><tr><th colspan="2">'+epgd.tr.pages.login.label+"</th></tr><tr><td>"+epgd.tr.pages.login.needLogin+'</td><td><input type="checkbox" id="needLogin" /></td></tr></table>').find("#needLogin").click(function(){if(this.checked&&!this.hasUsers){this.checked=false;var h=this;epgd.ajax({url:epgd.login.url+"data/users",cache:false},function(l){var i=null,k,m;for(m in l.users){i=l.users[m];if(i.active){return(h.hasUsers=h.checked=true)}}k=$('<form title="'+epgd.tr.pages.editUser.user+" "+(i?i.user:epgd.tr.pages.editUser.add)+'"></form>');epgd.pages.editUser.showUser(i,k,function(){k.dialog("close");if(!i){h.hasUsers=h.checked=true}else{$(h).click()}});k.dialog({modal:true,width:"auto"})})}}).prop("checked",epgd.profile.needLogin=="1");epgd.ajax({url:epgd.login.url+"data/parameters",async:true,cache:false,dataType:"json"},function(n){var l="",k,q,r,m=epgd.tr.pages.profile.system,o=1,h=2;for(k in n.parameters){q=n.parameters[k];if(q.owner=="epgd"){l+="<tr><td>"+(m[q.name]||q.name)+"</td><td>";r=typeof q.value=="undefined"?q["default"]:q.value;if(q.type==o){r=epgd.utils.formatDateTime(r)}if(q.readonly){l+=r}else{l+='<input data-value="'+r+'" data-valexp="'+(q.valexp||"")+'" id="'+q.name+'"';if(q.type==h){l+=' type="checkbox"'+(r=="1"?" checked":"")}else{l+=' type="text" class="full" value="'+r+'"'}l+=" /></td></tr>"}}}l&&$(d).find("table").append('<tbody id="pSystem"><tr><th>'+m.label+'</th><th style="min-width:300px"></th></tr>'+l+"</tbody>")})}}}})[0];this.form.namingModeSerie.selectedIndex=epgd.profile.namingModeSerie;this.form.namingModeSearchSerie.selectedIndex=epgd.profile.namingModeSearchSerie;this.form.namingModeMovie.selectedIndex=epgd.profile.namingModeMovie;this.form.namingModeSearchMovie.selectedIndex=epgd.profile.namingModeSearchMovie;$([this.form.namingModeSerie,this.form.namingModeSearchSerie,this.form.namingModeMovie,this.form.namingModeSearchMovie]).change(function(){this.nextSibling.style.display=(this.selectedIndex==6)?"block":"none"}).change();epgd.utils.addPlaceholders(this.form.namingModeSerieTemplate,"%",epgd.tr.pages.timerList.templateFields);epgd.utils.addPlaceholders(this.form.namingModeSearchSerieTemplate,"%",epgd.tr.pages.timerList.templateFields);epgd.utils.addPlaceholders(this.form.namingModeMovieTemplate,"%",epgd.tr.pages.timerList.templateFields);epgd.utils.addPlaceholders(this.form.namingModeSearchMovieTemplate,"%",epgd.tr.pages.timerList.templateFields);$(this.form.quickTimes).one("focus",function(){var d=this;epgd.ajax({url:epgd.login.url+"data/searchtimers?type=S"},function(g){var e={"@Now":": current time","@Next":": next event"};$.each(g.searchtimers,function(i,h){e["@"+h.name||h.expression]=": saved timer"});epgd.utils.addPlaceholders(d,"@",e)})});this.form.searchAdv.checked=epgd.profile.searchAdv=="1";epgd.profile.defaultVDRuuid&&$(this.form.defaultVDRuuid).val(epgd.profile.defaultVDRuuid);$(this.form.timerDefaultVDRuuid).val(epgd.profile.timerDefaultVDRuuid);$(this.form.recordSubFolderSort).val(epgd.profile.recordSubFolderSort);this.form.pickerFirstDay.selectedIndex=(epgd.profile.pickerFirstDay||epgd.tr.dateTimePicker.firstDay)},save:function(){var d=epgd.profile,g=[],e=this.form,a="@"+epgd.login.user,b;function c(h){if(d[h.name]!=h.value){g.push(h)}}if(!this.validate.quickTimes(e.quickTimes)||!this.validate.checkRegex(e.magazinePan)||!this.validate.checkRegex(e.magazinePanDelay)){return false}c({name:"defaultVDRuuid",value:$(e.defaultVDRuuid).val()||"",owner:a});c({name:"quickTimes",value:e.quickTimes.value.replace(/\n/g,"~"),owner:a});c({name:"startWithSched",value:$(e.startWithSched).prop("checked")?"1":"0",owner:a});c({name:"pickerFirstDay",value:new String(e.pickerFirstDay.selectedIndex),owner:a});c({name:"startPage",value:$(e.startPage).val()||"",owner:a});c({name:"namingModeSerie",value:new String(this.form.namingModeSerie.selectedIndex),owner:a});c({name:"namingModeSearchSerie",value:new String(this.form.namingModeSearchSerie.selectedIndex),owner:a});c({name:"namingModeMovie",value:new String(this.form.namingModeMovie.selectedIndex),owner:a});c({name:"namingModeSearchMovie",value:new String(this.form.namingModeSearchMovie.selectedIndex),owner:a});c({name:"namingModeSerieTemplate",value:new String(this.form.namingModeSerieTemplate.value),owner:a});c({name:"namingModeSearchSerieTemplate",value:new String(this.form.namingModeSearchSerieTemplate.value),owner:a});c({name:"namingModeMovieTemplate",value:new String(this.form.namingModeMovieTemplate.value),owner:a});c({name:"namingModeSearchMovieTemplate",value:new String(this.form.namingModeSearchMovieTemplate.value),owner:a});c({name:"timerDefaultVDRuuid",value:$(e.timerDefaultVDRuuid).val()||"",owner:a});c({name:"constabelLoginPath",value:$(e.constabelLoginPath).val()||"",owner:a});c({name:"chFormat",value:$(e.chFormat).val()||"",owner:a});c({name:"searchAdv",value:$(e.searchAdv).prop("checked")?"1":"0",owner:a});c({name:"messageMailTypes",value:$(e.messageMailTypes).map(function(){return this.checked?this.value:""}).toArray().join(""),owner:a});c({name:"mailReceiver",value:$(e.mailReceiver).val()||"",owner:a});c({name:"magazinePan",value:$(e.magazinePan).val()||"",owner:a});c({name:"magazinePanDelay",value:$(e.magazinePanDelay).val()||"",owner:a});c({name:"maxListEntries",value:$(e.maxListEntries).val()||"",owner:a});c({name:"recordSubFolderSort",value:$(e.recordSubFolderSort).val()||"1",owner:a});b=$("#pSystem").parent().parent()[0];if(b&&b.hasLoaded){c({name:"needLogin",value:$(e.needLogin).prop("checked")?"1":"0",owner:"webif"});$("#pSystem input").each(function(){if(this.type=="checkbox"){if(this.checked!=(this.getAttribute("data-value")=="1")){g.push({name:this.id,value:(this.checked?"1":"0"),owner:"epgd",valexp:this.getAttribute("data-valexp")})}}else{if(this.getAttribute("data-value")!=this.value){if(epgd.pages.profile.validate.checkRegex(this)){g.push({name:this.id,value:this.value,owner:"epgd"})}else{g=[];return false}}}})}if(g.length){if(b){b.hasLoaded=false}b=$("#page_profile").accordion("option","active");$("#page_profile").accordion("option","active",false).accordion("option","active",b);epgd.ajax({url:epgd.login.url+"data/save-parameters",type:"post",data:JSON.stringify({parameters:g})},function(h){h=h.result;if(h&&h.state==200){epgd.utils.topInfo(epgd.tr.dataSaved)}else{epgd.utils.topInfo(h.message,{isError:1})}epgd.profile_load()},function(k){try{var i="";$(k.responseJSON.result.failed).each(function(){i+="<li>"+e[g[this].name].parentNode.previousSibling.innerHTML+"</li>"});if(i){epgd.utils.popup("<ol>"+i+"</ol>",{title:epgd.tr.error.invalid});return true}}catch(h){}return false})}},validate:{quickTimes:function(a){a.value=a.value.replace(/\n{2,}/g,"\n").replace(/^\n+|\n+$/g,"");if(!/^(\n?[^=]+=!?(([0-1]?[0-9]|2[0-4]):[0-5]?[0-9]|@Now|@Next|@[A-Za-z0-9]*))*$/.test(a.value)){a.focus();epgd.utils.popup(epgd.tr.error.invalid);return false}return true},checkRegex:function(a){if(a.getAttribute("data-valexp")&&!new RegExp(a.getAttribute("data-valexp")).test(a.value)){a.focus();epgd.utils.popup(epgd.tr.error.invalid);return false}return true}}};epgd.pages.records={render:function(){if(!(epgd.login.rights&epgd.rights.umRecordings)==epgd.rights.umRecordings){return epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}if(!epgd.profile.recordSubFolderSort){epgd.profile.recordSubFolderSort=1}$("#menu_records").addClass("menu-active");var a=epgd.tr.pages.records;if(!this.$bar){this.$bar=$('<div class="ui-widget ui-state-highlight ui-corner-all" style="padding:3px 10px"><button class="iAsButton i-trash" title="'+epgd.tr.del+'"/><div id="recBar"><button class="iAsButton i-refresh" onclick="epgd.pages.records.update()">'+epgd.tr.reload+"</button>"+epgd.pages.help.getIcon("recRefresh")+"&nbsp;&nbsp; "+epgd.tr.pages.search.search+epgd.pages.help.getIcon("recSearch")+'<button class="iAsButton" onclick="this.checked = !this.checked; $(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();">&nbsp;&#8727;</button><input id="rSVal" type="text" onkeyup="epgd.pages.records.search(this.value)" /><button class="iAsButton" onclick="this.checked = !this.checked;$(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();">&#8727;&nbsp;</button><span style="display:none"><button class="iAsButton i-rewind" onclick="epgd.pages.records.searchMove(1)"></button><span id="rSCnt">0</span><button class="iAsButton i-forward" onclick="epgd.pages.records.searchMove(-1)"></button></span>&nbsp;&nbsp; <input type="checkbox" id="dragdrop"'+($.support.touch?"":' checked="checked"')+' onchange="epgd.pages.records.dd(this.checked)" />'+a.ddLabel+epgd.pages.help.getIcon("recDD")+"</div></div>");this.$trash=this.$bar.find(".i-trash");this.curSearch={pattern:"",searchValue:"",hits:$(),cur:0,$count:this.$bar.find("#rSCnt"),fromStart:this.$bar.find("#rSVal").prev("button")[0],toEnd:this.$bar.find("#rSVal").next("button")[0]}}this.$bar.insertAfter(epgd.$menu);this.$trash.droppable({accept:".rec",hoverClass:"ui-state-hover",tolerance:"pointer",drop:function(c,d){var b=d.helper.context;epgd.utils.confirm(epgd.tr.pages.records.deleteMessage.replace("$src$",b.getAttribute("data-path")),function(e){e&&epgd.pages.records.del(b)});return false}}).click(function(){var b=$("#records").find(".rec.selected");b.length&&epgd.utils.confirm(epgd.tr.confirmDelete+(b.length>1?"<br />"+b.length+epgd.tr.entries:""),function(c){c&&b.each(function(){epgd.pages.records.del(this)})})});epgd.pages.help.initButtons(this.$bar);epgd.$menu.checkMenuSize();$(window).bind("epgd_close.records",function(){epgd.pages.records.$bar.remove();epgd.$menu.checkMenuSize();$(window).unbind(".records")});epgd.$con.html('<div id="records"></div>');epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/recordings",cache:false},function(x){var b=x.recordings,g,y,o,l,n,r,m={f:{},r:[]},d={},s,k,h="",q=" "+epgd.tr.minutes,u,e=epgd.profile.recordSubFolderSort==6?function(p,i){return p.starttime>i.starttime?-1:1}:epgd.profile.recordSubFolderSort==5?function(p,i){return p.starttime>i.starttime?1:-1}:epgd.profile.recordSubFolderSort==4?function(p,i){return p.path>i.path?-1:1}:epgd.profile.recordSubFolderSort==3?function(p,i){return p.path>i.path?1:-1}:epgd.profile.recordSubFolderSort==2?function(p,i){return p.tit>i.tit?-1:1}:function(p,i){return p.tit>i.tit?1:-1};for(s in epgd.vdrs.list){k=epgd.vdrs.list[s];if(!k.usecommonrecfolder){d[s]={f:{},r:[]}}h+="<div>VDR - "+k.name+": "+k.videodir+" - "+parseInt(k.videofree/1000,10)+" GB "+a.available+" / "+parseInt(k.videototal/1000,10)+" GB</div>"}if(!$("#dragdrop").parent().length){return false}epgd.$con.find("#records").before(h);h="";for(r in b){g=b[r];l=d[g.vdruuid]||m;o=g.path.split("/");o.pop();for(n=0;n<o.length;n++){y=o[n].replace(/_/g," ");l=l.f[y]||(l.f[y]={f:{},r:[]})}l.r.push(g)}function w(z){var i=false,v,p;z.cnt=0;for(v in z.f){p=z.f[v];if(p.r.length==1){z.r.push(p.r.pop())}w(p);if(w(p)){i=true;z.cnt+=p.cnt}else{delete z.f[v]}}if(!i){delete z.f}z.cnt+=z.r.length;return i||z.r.length>0}function c(i){Object.keys(i.f).sort().forEach(function(v){var t=i.f[v],p;h+=v?'<div class="folder"><h4><span class="i-folder-closed">('+(t.cnt)+')</span><m class="i-"/>'+v+"</h4>":"<div>";t.f&&c(t);if(t.r.length){for(p in t.r){g=t.r[p];g.tit=((g.name!=v?g.name:"")+(v!=g.title&&(g.title!=g.name)?"<br />"+g.title:"")+(g.shorttext&&(g.shorttext!=g.name)?"<i>"+g.shorttext+"</i>":""))||v;g.html='<div class="rec" data-start="'+g.starttime+'" data-owner="'+(g.owner||"")+'" data-md5="'+g.md5path+'" data-path="'+g.path+'"><em>'+epgd.utils.formatDateTime(g.starttime)+"</em><u>"+parseInt(g.duration/60,10)+q+"</u><b>"+g.tit+"</b></div>"}t.r.sort(e);for(p in t.r){h+=t.r[p].html}}h+="</div>"})}n={};if(w(m)){n[a.commonRecFolder]=m}for(s in d){l=d[s];if(w(l)){n["VDR - "+epgd.vdrs.list[s].name]=l}}c({f:n});u=epgd.$con.find("#records").html(h);if(!u.length){return false}u=u.click(epgd.pages.records.action).find(">div");if(u.length==1){u.first().toggleClass("open")}epgd.pages.records.$menu=$('<ul class="ui-menu ui-widget ui-widget-content" style="position:absolute"><li class="ui-menu-item" data-type="title"><a class="iAsButton i-sort-name-up" data-sort="1"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="2"></a>&nbsp;'+epgd.tr.pages.eventDetail.title+'</li><li class="ui-menu-item" data-type="path"><a class="iAsButton i-sort-name-up" data-sort="3"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="4"></a>&nbsp;'+epgd.tr.pages.timerList.folder+'</li><li class="ui-menu-item" data-type="start"><a class="iAsButton i-sort-name-up" data-sort="5"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="6"></a>&nbsp;'+epgd.tr.pages.timerList.recordTime+"</li></ul>").hide().appendTo(epgd.$con);$("#dragdrop").change();epgd.pages.records.curSearch.$recs=null;epgd.utils.loader.close()})},true)},search:function(e){var c=this.curSearch,h,b,d,a=c.fromStart.checked,g=c.toEnd.checked;if(!c.$recs){c.$recs=epgd.$con.find("#records .rec,h4")}if(typeof e=="string"){c.searchValue=e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}d=(a?">"+c.searchValue:c.searchValue).toLowerCase()+(g?"<":"");if(d==c.pattern){return}h=c.searchValue.length;b=c.$recs;if(c.hits.length){$(c.hits).each(function(){this.innerHTML=this.innerHTML.replace(/<mark>([^<]+)<\/mark>/gi,"$1")}).parents(".tmp-open").removeClass("tmp-open");if(d.indexOf(c.pattern)==0){b=$(c.hits)}else{c.cur=0}c.hits=[]}else{c.cur=0}c.pattern=d;if(h>2){b.each(function(){var i=this.innerHTML.toLowerCase().indexOf(d);if(i>0){c.hits.push(this);$(this).parents(".folder").addClass("tmp-open");do{if(a){i++}this.innerHTML=this.innerHTML.slice(0,i)+"<mark>"+c.searchValue+"</mark>"+this.innerHTML.slice(i+h)}while((i=this.innerHTML.toLowerCase().indexOf(d,i+13))>0)}});c.$count.text(c.hits.length).parent().show();this.searchMove(0)}else{c.$count.parent().hide()}},searchMove:function(a){this.curSearch.cur+=a;var b=this.curSearch.hits[this.curSearch.cur];if(!b){this.curSearch.cur=a<0?this.curSearch.hits.length-1:0;b=this.curSearch.hits[this.curSearch.cur]}if(b){b.scrollIntoView(false);$(b).css({"background-color":"green"});window.setTimeout(function(){$(b).css({"background-color":""})},1500)}},action:function(b){var a=b.target;if(a.nodeName=="MARK"){a=a.parentNode}if(a.nodeName=="M"){epgd.pages.records.$menu.show().position({my:"left top",at:"left bottom",of:a}).find("a").removeClass("ui-state-highlight");epgd.pages.records.$menu.find("a[data-sort="+(a.curSort||epgd.profile.recordSubFolderSort)+"]").addClass("ui-state-highlight");$(document).one("click.recmenu",function(d){if(d.target.nodeName=="A"){var c=d.target.parentNode.getAttribute("data-type");if(c){a.curSort=d.target.getAttribute("data-sort");epgd.pages.records.sort(a.parentNode.parentNode,a.curSort)}}epgd.pages.records.$menu.hide();$(document).unbind(".recmenu")}).bind("keyup.recmenu",function(c){if(c.keyCode==27){$(document).trigger("click.recmenu")}});return false}if(a.nodeName=="I"||a.nodeName=="SPAN"){a=a.parentNode}if(a.nodeName=="B"){a=a.parentNode;if(!a.recDetail){a.recDetail=new epgd.recordDetail(a)}epgd.utils.loader.process(function(){a.recDetail.render()})}else{if(a.nodeName=="H4"){a=a.parentNode;if(a.nodeName=="DIV"&&a.className.indexOf("folder")>=0){if(a.className.indexOf("open")==-1){if($(window).width()<500){$(a).siblings(".open").removeClass("open");document.body.scrollTop=$(a).offset().top-35}$(a).addClass("open")}else{$(a).removeClass("open")}}}else{$(a).closest(".rec").toggleClass("selected")}}},dd:function(b){var c=$("#records"),a=c.find(".rec").has(".ui-draggable");if(b&&a.length==0){c.find("h4").droppable(this.__dropSettings);a.end().draggable({cancle:"b",revert:"invalid",distance:15,helper:function(){return $(this).clone().css("display","block")},appendTo:"body",cursor:"pointer",cursorAt:{left:-15,top:5},start:function(d,e){$(document).trigger("click.recmenu");$(document.body).addClass("dd-open");document.body.style.paddingTop=epgd.pages.records.$bar.height()+"px";document.body.scrollTop-=d.pageY-$(d.delegateTarget).closest(".folder").offset().top},stop:function(d,e){$(document.body).removeClass("dd-open");epgd.$menu.checkMenuSize()}})}else{if(a.length){a.draggable(b?"enable":"disable")}}},__dropSettings:{accept:".rec",hoverClass:"ui-state-hover",tolerance:"pointer",drop:function(b,c){console.log("Dropped!",b,c);var a=$(b.target),d="";do{d=a.text().replace(/^\(.*\)/,"")+"/"+d;a=a.parent()}while((a=a.prevAll("h4")).length);epgd.pages.records.move(c.draggable.context,d.slice(d.indexOf("/",2)+1).replace(/ /g,"_"),b.target.parentNode);return false}},update:function(){epgd.ajax({url:epgd.login.url+"data/updaterecordings"},function(a){epgd.utils.topInfo(epgd.tr.pages.records.refreshMessage.replace("$sec$",5),{autoClose:5000});$(window).trigger("epgd_close.records");window.setTimeout(function(){epgd.pages.records.render()},5000)})},move:function(e,h,d){var g=e.getAttribute("data-path").split("/"),b=g.pop(),c,a=0;g=g.join("/")+"/";for(c=0;c<Math.min(h.length,g.length)&&h[c]==g[c];c++){if(h[c]=="/"){a=c}}g=window.prompt(epgd.tr.pages.records.moveMessage.replace("$src$",g),h.concat(g.slice(a)).replace(/\/{2,}/g,"/").replace(/\/$/,""));if(g){epgd.ajax({url:epgd.login.url+"data/renamerecording?starttime="+e.getAttribute("data-start")+"&md5path="+e.getAttribute("data-md5")+"&owner="+e.getAttribute("data-owner")+"&name="+g.replace(/\//g,"~"),async:true},function(n){n=n.result;if(n&&n.state==200){var k=$(e),p=k.prevAll("h4").find("span"),o=$(d),m=g.split("/"),l;k.attr("data-path",g+"/"+b);k.attr("data-md5","").draggable("disable").addClass("ui-state-disabled");m.shift();k.parents(".folder:not(:last)").find(">h4>span").each(function(){this.innerHTML="("+(parseInt(this.innerHTML.slice(1,-1),10)-1)+")"});p=o.find("span");p.text("("+(parseInt(p.text().slice(1,-1),10)+1)+")");for(l=0;l<m.length;l++){if(o.find(">.folder>h4").each(function(){if(this.lastChild.nodeValue==m[l]){o=$(this.parentNode);p=o.find("span");p.text("("+(parseInt(p.text().slice(1,-1),10)+1)+")");return true}else{return false}}).length==0){for(;l<m.length;l++){o=$('<h4><span class="i-folder-closed">(1)</span><m class="i-"/>'+m[l]+"</h4></div>").droppable(epgd.pages.records.__dropSettings).wrap('<div class="folder open"></div>').parent().appendTo(o)}}}k.appendTo(o);epgd.pages.records.sort(d);epgd.utils.topInfo(epgd.tr.dataSaved);epgd.pages.records.__updateRec(e)}else{epgd.utils.topInfo(n.message,{isError:1});return false}})}return !!g},__updateRec:function(b,a){epgd.ajax({url:epgd.login.url+"data/recording?starttime="+b.getAttribute("data-start")+"&path="+b.getAttribute("data-path")+"&owner="+b.getAttribute("data-owner")+"&"+a,async:true},function(c){$(b).attr("data-md5",c.recording.md5path).draggable("enable").removeClass("ui-state-disabled")},function(d,c){if(!a){a=0}else{if(a>=5){return epgd.utils.popup(epgd.tr.pages.records.notFoundMessage,{title:epgd.tr.error.error})}}window.setTimeout(epgd.pages.records.__updateRec,3000,b,++a);return true})},del:function(a){epgd.ajax({url:epgd.login.url+"data/deleterecording?starttime="+a.getAttribute("data-start")+"&md5path="+a.getAttribute("data-md5")+"&owner="+a.getAttribute("data-owner"),async:true},function(b){b=b.result;if(b&&b.state==200){epgd.utils.topInfo(a.getAttribute("data-path")+"<br />"+epgd.tr.dataSaved);$(a).parents(".folder:not(:last)").find(">h4>span").each(function(){this.innerHTML="("+(parseInt(this.innerHTML.slice(1,-1),10)-1)+")"});$(a).remove()}else{epgd.utils.topInfo(a.getAttribute("data-path")+"<br />"+b.message,{isError:1})}})},sort:function(a,d){var e=$(a).find(">div.rec"),b=d%2?1:-1,c;if(!d){d=$(">h4>m",a)[0].curSort||epgd.profile.recordSubFolderSort}if(d<3){e.sort(function(h,g){return h.lastChild.innerHTML>g.lastChild.innerHTML?b:-b}).appendTo(a)}else{c=d<5?"data-path":"data-start";e.sort(function(h,g){return h.getAttribute(c)>g.getAttribute(c)?b:-b}).appendTo(a)}$(a).find(">div.folder").each(function(){epgd.pages.records.sort(this,d)})}};epgd.sortTable=function(a){this.o=$.extend({conSel:epgd.$con,empty:"",right:1},a)};epgd.sortTable.prototype={sortIcons:'<span class="iAsButton i-sort-name-down sort"></span><span class="iAsButton i-sort-name-up sort"></span>',update:function(){},hideHead:function(){var a=this.$con.find("thead:first").hide().find(">tr>th");this.$con.find("tbody:first").html('<tr><td colspan="'+a.length+'">'+this.o.empty+(a.last().find(".i-doc-new").wrapAll("<div />").parent().html()||"")+"</td></tr>")},showHead:function(){this.$con.find(">table>thead").show();this.filter();this.sort()},getTable:function(){},action:function(a,c,b){switch(c){case"refresh":this.update();break;case"detail":if(!a[0].eventDetail){a[0].eventDetail=new epgd.eventDetail(b)}epgd.utils.loader.process(function(){a[0].eventDetail.render()});break}},render:function(a,b){this.trs=[];this.$con=a||$(this.o.conSel);this.$con.empty();if(!(epgd.login.rights&this.o.right)==this.o.right){return epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}this.$con.html(this.getTable());this.init();this.update(b)},init:function(){var b=this,a=0;this.$con.find(">table").click(function(h){var e=$(h.target),g=e[0],i=g.getAttribute("data-evId"),k,c;if(i){b.action(e,"detail",i)}else{if(h.target.className=="i-tv"){epgd.vdrs.current.switchChannel(h.target.parentNode.id)}else{e=e.closest("span.sort");if(e.length){e.parent().parent().find(".ui-state-highlight").removeClass("ui-state-highlight");e.addClass("ui-state-highlight");b.sort(e)}else{e=$(g).closest("span.edit");if(e.length){b.action(e,e[0].className.match(/i-([a-z0-9-]+)/)[1])}if(b.o.selectable){if(g.nodeName=="TD"){e=$(g).parent().toggleClass("selected");if(h.shiftKey&&this.lastSel){c=$(this.lastSel);k=e.index()-c.index();if(k>0){c.nextAll(":lt("+k+"):visible").toggleClass("selected",c.hasClass("selected"))}else{c.prevAll(":lt("+-k+"):visible").toggleClass("selected",c.hasClass("selected"))}}else{this.lastSel=e[0]}}else{if(g.nodeName=="B"){k=g.getAttribute("data-t");$(b.trs).filter(":visible").toggleClass("selected",k==1?true:k==0?false:undefined);return false}}}}return false}}}).find(">thead>tr").find(">th").each(function(){this.cIndex=a;a+=this.colSpan}).end().find('[data-defaultSort="1"]>span.sort:last,[data-defaultSort="-1"]>span.sort:first').addClass("ui-state-highlight");this.$con.find(">table>thead input.filter").keyup(function(){b.filter()}).each(function(){if(!this.result){this.result=$('<i style="padding-left:5px;font-weight:normal"></i>').insertAfter(this)[0]}})},sort:function(e){e=e||this.$con.find(">table>thead .ui-state-highlight");if(!e.length){return}var c=e.parent()[0],g=(e.hasClass("i-sort-name-down")?-1:1),a=this.trs,b,h;if(!c.sortInfo){c=c.cIndex;for(b=0;b<a.length;b++){h=a[b].cells[c];h.sort=h.getAttribute("data-sort")||$(h).text().toLowerCase()}}else{c=c.cIndex}a.sort(function(i,d){var l=i.cells[c].sort,k=d.cells[c].sort;return(l>k?1*g:l==k?0:-1*g)});this.$con.find(">table>tbody").append(a.slice())},filter:function(){var b={},a,d,e,c;this.$con.find(">table>thead input.filter").each(function(){if(this.value){b[this.parentNode.cIndex]=[this.value.toLowerCase(),0,this.result||{}]}else{if(this.result){this.result.innerHTML=""}}});for(a=0;a<this.trs.length;a++){e=this.trs[a];c="";for(d in b){if(e.cells[d].innerHTML.toLowerCase().indexOf(b[d][0])==-1){c="none"}else{b[d][1]++}}e.style.display=c}for(d in b){if(b[d][2].innerHTML=b[d][1]){}}}};epgd.timerEditChFormat=function(c){var a=",SD,HD,3D",b=c.value,d;if(b){b=b.split(",");for(d=0;d<b.length;d++){a=a.replace(","+b[d]+",",",")}}$('<div title="'+epgd.tr.pages.timerList.chFormat+'"><ol style="float:left; border:2px inset #ddd; min-height:50px; margin-right:20px;">'+(b.length?"<li>"+b.join("</li><li>")+"</li>":"")+'</ol><ul style="float:left; border:2px inset #ddd; min-height:50px;list-style-type:none">'+(a.length>1?"<li>"+a.slice(1).replace(/,/g,"</li><li>")+"</li>":"")+"</div>").dialog({modal:true,buttons:[{text:epgd.tr.apply,click:function(){var e="";$(this).find("ol > li").each(function(){e+=","+this.innerHTML});c.value=e.slice(1);$(this).dialog("close")}},{text:epgd.tr.cancel,click:function(){$(this).dialog("close")}}]}).find("ul,ol").sortable({connectWith:"ul,ol"}).disableSelection()};epgd.timerListBase=epgd.utils.inherits(function(a,b){this.dialog=b;if(this.dialog){this.dialog.list=this}if(!a.conSel){a.conSel="#content"}if(!a.empty){a.empty=epgd.tr.pages.timerList.empty}epgd.sortTable.call(this,a)},epgd.sortTable);epgd.timerListBase.prototype.getTable=function(){var a=epgd.tr.pages.timerList;return'<table id="timerList" class="timerTable"><thead><tr><th style="min-width:120px">'+epgd.tr.channel+this.sortIcons+'</th><th></th><th data-defaultSort="1" colspan="2">'+a.startTime+this.sortIcons+' <input type="text" class="filter" style="width:50px" /></th><th>'+a.endTime+'</th><th style="min-width:120px">'+epgd.tr.pages.eventDetail.title+this.sortIcons+' <input type="text" class="filter" style="width:100px" /></th><th style="min-width:120px">VDR'+this.sortIcons+' <input type="text" class="filter" style="width:50px" /></th><th style="min-width:130px">'+this.sortIcons+(this.o.addNew?'<span class="iAsButton i-doc-new edit" title="'+a.newTimer+'"></span><span class="iAsButton i-refresh edit" title="'+epgd.tr.reload+'"></span>':"")+(this.o.selectable?'<br clear="all" /><span style="margin-top:3px" class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span><div class="selMarkBlock" style="width:auto"><b title="'+epgd.tr.markAll+'" class="selected" data-t="1"></b><b title="'+epgd.tr.markNone+'" data-t="0"></b><b title="'+epgd.tr.markToggle+'"><b class="selected"></b></b></div>':"")+"</th></tr></thead><tbody></tbody></table>"};epgd.timerListBase.prototype.update=function(){var a=this;epgd.utils.loader.process(function(){a.$con.find("tbody").empty();epgd.ajax({url:epgd.login.url+a.o.updateUrl,async:false,cache:false},function(h){if(!h.timers.length){a.hideHead()}else{var b=[],k=a.editIcons,i="DF",g={D:'<div class="i-trash">'+epgd.tr.pages.timerList.timerStates.D+"</div>",E:'<div class="i-warning">'+epgd.tr.pages.timerList.timerStates.E+"</div>",F:'<div class="i-ok">'+epgd.tr.pages.timerList.timerStates.F+"</div>",R:'<div class="i-progress">'+epgd.tr.pages.timerList.timerStates.R+"</div>",P:'<div class="i-clock">'+epgd.tr.pages.timerList.timerStates.P+"</div>",U:'<div class="i-help">'+epgd.tr.pages.timerList.timerStates.U+"</div>"},d={V:"i-tv",R:"i-record",S:"i-search"},e=epgd.tr.pages.timerList.timerActions,c='<span class="iAsButton i-flashlight edit" title="'+epgd.tr.pages.timer.searchTimerList+" "+epgd.tr.edit+'" data-id="$id$">$title$</span>';$.each(h.timers,function(o,l){l.action=l.action?l.action.toUpperCase():"A";l.state=l.state?l.state.toUpperCase():"U";var n=epgd.vdrs.list[l.vdruuid]||{name:"--"},m=$("<tr"+(l.active?"":' class="ui-state-disabled"')+"><td>"+epgd.channels.getHtml(l.channelid)+"</td><td>"+(l.action!="A"?'<div class="i-wait">'+e[l.action]+"</div>":g[l.state])+(l.info||"")+'</td><td data-sort="'+new String(l.day)+new String(10000+l.starttime).slice(1)+'">'+(l.day?epgd.utils.formatDate(l.day):"-")+"</td><td>"+new String(100+parseInt(l.starttime/100,10)).slice(1)+":"+new String(100+parseInt(l.starttime%100,10)).slice(1)+"</td><td>"+new String(100+parseInt(l.endtime/100,10)).slice(1)+":"+new String(100+parseInt(l.endtime%100,10)).slice(1)+"</td><td"+(l.eventid?' data-evId="'+l.eventid+'" class="'+d[l.type]+'">'+(l.title||"")+"<br />"+(l.shorttext||""):">")+"</td><td>"+n.name+"<br />"+(l.directory?l.directory+"~":"")+(l.file||"")+"</td><td>"+(l.autotimerid?c.replace("$id$",l.autotimerid).replace("$title$",l.autotimername||l.expression||epgd.tr.pages.timer.searchTimerList):"")+(i.indexOf(l.state)==-1?k:"")+"</td></tr>")[0];m.tData=l;b.push(m)});a.trs=b;a.showHead()}epgd.utils.loader.close();$(window).trigger("timerlist_updated",a)})},true)};epgd.timerListBase.prototype.action=function(a,d,b){var c;switch(d){case"edit":case"doc-new":this.dialog.render(a.closest("tr")[0].tData);break;case"trash":this.del(this.getSelectedIds(a));break;case"flashlight":c=a.attr("data-id"),list=this;$(window).one("searchTimerList_updated",function(){list.$con.find("tbody>tr").each(function(){if(this.tData.id==c){epgd.pages.searchTimerList.dialog.render(this.tData);return false}})});epgd.$menu.menu("select",{target:"#menu_searchTimerList"});break;default:epgd.sortTable.prototype.action.call(this,a,d,b)}};epgd.timerListBase.prototype.editIcons='<span class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span><span class="iAsButton i-edit edit" title="'+epgd.tr.edit+'"></span>';epgd.timerListBase.prototype.getSelectedIds=function(a){var b=[];if(a[0].parentNode.nodeName=="TH"){$(this.trs).filter(".selected:visible").each(function(){b.push(this.tData.id)})}else{b.push(a.closest("tr")[0].tData.id)}return b};epgd.timerListBase.prototype.del=function(c,d,e){var b=this,a=$.isArray(c)?c:[parseInt(c,10)];c&&a.length&&epgd.utils.confirm(epgd.tr.confirmDelete+(a.length>1?"<br />"+a.length+epgd.tr.entries:""),function(g){g&&b.saveArray(a,e||"delete",d)})};epgd.timerListBase.prototype.saveArray=function(c,g,e){var b=this,a=$.isArray(c)?c:[parseInt(c,10)],d={};d[g]=a;c&&a.length&&this.save(d,null,function(k){try{var h=",";$(k.responseJSON.result.failed).each(function(){h+=a[this]+","});if(h.length>1){$(b.trs).each(function(){if(h.indexOf(","+this.tData.id+",")>=0){this.style.backgroundColor="red"}})}}catch(i){}return false},e)};epgd.timerListBase.prototype.save=function(d,b,a,c){if(!d){return false}var e=this;epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+(b||e.o.saveUrl),type:"post",data:JSON.stringify(d)},function(g){g=g.result;if(g.state==200){epgd.utils.topInfo(epgd.tr.dataSaved)}else{epgd.utils.topInfo(g.message,{isError:1})}epgd.utils.loader.close();e.$con&&e.$con.parent().length&&e.update();c&&c.call(e)},a)},true);return true};epgd.searchResultList=epgd.utils.inherits(function(a,b){epgd.timerListBase.call(this,$.extend({saveUrl:"data/save-searchtimer"},a),b)},epgd.timerListBase);epgd.searchResultList.prototype.getTable=function(){var a=epgd.tr.pages.timerList;return'<table id="searchResultList" class="timerTable"><thead><tr><th style="min-width:120px">'+epgd.tr.channel+this.sortIcons+'</th><th data-defaultSort="1" colspan="2">'+a.startTime+this.sortIcons+"</th><th>"+a.endTime+"</th><th>"+epgd.tr.pages.eventDetail.title+this.sortIcons+"</th><th></th></tr></thead><tbody></tbody></table>"};epgd.searchResultList.prototype.update=function(b){if(!b){return false}var a=this;b.id&&delete b.id;b.name&&delete b.name;b.max=epgd.profile.maxListEntries;epgd.utils.loader.process(function(){a.$con.find("tbody").empty();epgd.ajax({url:epgd.login.url+"data/search",type:"post",data:JSON.stringify(b)},function(e){var c=[],d;if(!e.events||!e.events.length){a.hideHead()}else{e.count>b.max&&epgd.utils.popup("Achtung! Es wurden "+e.count+" Ergebnisse gefunden. Angezeigt werden aber nur "+b.max+".<br /> Das Nachladen ist noch nicht implementiert! Der Wert kann in den Einstellungen angepasst werden");$.each(e.events,function(l,h){var k="",g="",i;if(h.dones){for(d in h.dones){i=h.dones[d];g+='<span class="iAsButton" title="'+epgd.tr.pages.timerList.doneStates[i.state]+" data-id="+i.id+'">'+i.state+"</span>";if(i.state=="R"){k=' class="ui-state-disabled"'}}}c.push($("<tr"+k+"><td>"+epgd.channels.getHtml(h.channelid)+'</td><td data-sort="'+h.starttime+'">'+epgd.utils.formatDate(h.starttime)+"</td><td>"+epgd.utils.formatTime(h.starttime)+"</td><td>"+epgd.utils.formatTime(h.starttime+h.duration)+'</td><td data-evId="'+h.id+'">'+h.title+"<br />"+(h.shorttext||"")+"</td><td>"+g+"</td></tr>").tooltip()[0])});a.trs=c;a.showHead()}epgd.utils.loader.close();a.dialog&&a.dialog.resize&&window.setTimeout(function(){a.dialog.resize()},100)})},true)};epgd.searchTimerTimerList=epgd.utils.inherits(function(a,b){epgd.timerListBase.call(this,$.extend({saveUrl:"data/save-timer",updateUrl:"data/timers?state=P,R"},a),b)},epgd.timerListBase);epgd.searchTimerTimerList.prototype.getTable=function(){var a=epgd.tr.pages.timerList;return'<table class="timerTable"><thead><tr><th>'+epgd.tr.channel+this.sortIcons+'</th><th data-defaultSort="1" colspan="2">'+a.startTime+this.sortIcons+"</th><th>"+a.endTime+"</th><th>"+epgd.tr.pages.eventDetail.title+this.sortIcons+"</th><th>VDR"+this.sortIcons+"</th><th></th></tr></thead><tbody></tbody></table>"};epgd.searchTimerTimerList.prototype.update=function(b){if(!b){return false}var a=this;epgd.utils.loader.process(function(){a.$con.find("tbody").empty();epgd.ajax({url:epgd.login.url+a.o.updateUrl+"&autotimerid="+b.id,async:true,cache:false},function(d){var c=[],e='<span class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span>';if(!d.timers.length){a.hideHead()}else{$.each(d.timers,function(k,g){var i=epgd.vdrs.list[g.vdruuid]||{name:"--"},h=$("<tr"+(g.active?"":' class="ui-state-disabled"')+"><td>"+epgd.channels.getHtml(g.channelid)+'</td><td data-sort="'+new String(g.day)+new String(10000+g.starttime).slice(1)+'">'+(g.day?$.datepicker.formatDate(epgd.tr.dateTimePicker.dateFormat,epgd.utils.date(g.day)):"-")+"</td><td>"+new String(100+parseInt(g.starttime/100,10)).slice(1)+":"+new String(100+parseInt(g.starttime%100,10)).slice(1)+"</td><td>"+new String(100+parseInt(g.endtime/100,10)).slice(1)+":"+new String(100+parseInt(g.endtime%100,10)).slice(1)+"</td><td"+(g.eventid?' data-evId="'+g.eventid+'">'+g.title+"<br />"+(g.shorttext||""):">")+"</td><td>"+i.name+"<br />"+g.file+"</td><td>"+e+"</td></tr>")[0];h.tData=g;c.push(h)});a.trs=c;a.showHead()}a.dialog&&a.dialog.resize&&window.setTimeout(function(){a.dialog.resize()},100);epgd.utils.loader.close()})})};epgd.pages.timerList=new epgd.timerListBase({updateUrl:"data/timers?state=P,R",saveUrl:"data/save-timer",selectable:true,addNew:true,right:epgd.rights.umTimer},new epgd.timerDialog());epgd.pages.timersDone=new epgd.timerListBase({updateUrl:"data/timers?state=D,F,E&action=A",right:epgd.rights.umTimer});epgd.pages.timersDone.getTable=function(){return epgd.timerListBase.prototype.getTable.call(this).replace('data-defaultSort="1"','data-defaultSort="-1"')};epgd.pages.timerListDone=new epgd.timerListBase({updateUrl:"data/donetimers",saveUrl:"data/store-donetimers",selectable:true,right:epgd.rights.umTimer});epgd.pages.timerListDone.getTable=function(){return'<table id="timerListDone" class="timerTable"><thead><tr><th style="min-width:120px"><input type="text" class="filter" style="width:40px" />'+this.sortIcons+'</th><th data-defaultSort="-1" style="min-width:180px">'+epgd.tr.pages.timerList.recordTime+this.sortIcons+"</th><th>"+epgd.tr.pages.eventDetail.title+' <input type="text" class="filter" />'+this.sortIcons+'</th><th style="min-width:120px">'+epgd.tr.channel+this.sortIcons+'</th><th style="min-width:100px">'+this.sortIcons+'<span style="margin-top:3px" class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span><div class="selMarkBlock" style="width:auto"><b title="'+epgd.tr.markAll+'" class="selected" data-t="1"></b><b title="'+epgd.tr.markNone+'" data-t="0"></b><b title="'+epgd.tr.markToggle+'"><b class="selected"></b></b></div></th></tr></thead><tbody></tbody></table>'};epgd.pages.timerListDone.action=function(a,c,b){if(c=="detail"&&!a[0].eventDetail){a[0].eventDetail=new epgd.doneTimerDetail(a.parent()[0])}epgd.timerListBase.prototype.action.call(this,a,c,b)};epgd.pages.timerListDone.stateIcons={D:'<div class="i-trash">'+epgd.tr.pages.timerList.doneStates.D+"</div>",F:'<div class="i-warning">'+epgd.tr.pages.timerList.doneStates.F+"</div>",f:'<div class="i-warning">'+epgd.tr.pages.timerList.doneStates.f+"</div>",R:'<div class="i-ok">'+epgd.tr.pages.timerList.doneStates.R+"</div>",C:'<div class="i-buffer">'+epgd.tr.pages.timerList.doneStates.C+"</div>",Q:'<div class="i-clock">'+epgd.tr.pages.timerList.doneStates.Q+"</div>"};epgd.pages.timerListDone.update=function(){var a=this;epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+a.o.updateUrl,async:false,cache:false},function(h){a.$con.find("tbody").empty();if(!h.donetimers.length){a.hideHead()}else{var b=[],g,e,d,c='<span class="iAsButton i-flashlight edit" title="'+epgd.tr.pages.timer.searchTimerList+" "+epgd.tr.edit+'" data-id="$id$">$title$</span>';for(e in h.donetimers){d=h.donetimers[e];g=$("<tr><td>"+(d.state&&a.stateIcons[d.state]||"")+'</td><td data-sort="'+d.starttime+'">'+epgd.utils.formatDateTime(d.starttime)+"<br />"+parseInt(d.duration/60,10)+" "+epgd.tr.minutes+'</td><td data-evId="'+d.id+'">'+(d.title||"")+"<br />"+(d.shorttext||"")+'</td><td data-sort="'+d.channelid+'">'+epgd.channels.getHtml(d.channelid)+'</td><td><span class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span>'+(d.autotimerid?c.replace("$id$",d.autotimerid).replace("$title$",d.autotimername||d.expression||epgd.tr.pages.timer.searchTimerList):"")+"</td></tr>")[0];g.tData=d;b.push(g)}a.trs=b;a.showHead()}epgd.utils.loader.close();$(window).trigger("timerlist_updated",a)})},true)};epgd.pages.timerJobList=new epgd.timerListBase({updateUrl:"data/timers?notaction=A",saveUrl:"data/delete-timerjobs",selectable:true,right:epgd.rights.umTimer},new epgd.timerDialog());epgd.pages.searchTimerList=new epgd.timerListBase({saveUrl:"data/save-searchtimer",right:epgd.rights.umSearchTimer},new epgd.searchTimerDialog());epgd.pages.searchTimerList.getTable=function(){var a=epgd.tr.pages.timerList;return'<table id="timerSearchList" class="timerTable"><thead><tr><th data-defaultSort="1">'+epgd.tr.pages.search.searchName+"/"+epgd.tr.pages.search.searchExpression+' <input type="text" class="filter" />'+this.sortIcons+"</th><th>hits"+this.sortIcons+'</th><th style="min-width:120px">VDR'+this.sortIcons+'</th><th><span class="iAsButton i-doc-new edit" title="'+a.newTimer+'"></span><span class="iAsButton i-refresh edit" title="'+epgd.tr.reload+'"></span><span class="iAsButton i-link-ext edit" title="'+a.searchTimerReload+'"></span></th></tr></thead><tbody></tbody></table>'};epgd.pages.searchTimerList.action=function(c,e,d){epgd.timerListBase.prototype.action.call(this,c,e,d);switch(e){case"link-ext":this.triggerUpdate();break;case"down-dir":if(!c[0].tList){var b={$td:c.parent().css("position","relative"),tdHeight:c.parent().outerHeight()+10,data:c.parent().parent()[0].tData,resize:function(){var g=this.list.$con.find(">table").addClass("sub");g.width(this.$td.parent().outerWidth());this.$td.height(this.tdHeight+g.outerHeight(true)+10)},toggle:function(g){this.list.$con.toggle(g);if(g){this.$td.css("height","100px");this.list.update(this.data)}else{this.$td.css("height","auto")}}},a={conSel:$('<div style="position:absolute;z-index:5;top:'+b.tdHeight+'px" />').appendTo(document.body)};c[0].tList=b.data.type=="S"?new epgd.searchResultList(a,b):new epgd.searchTimerTimerList(a,b);c[0].tList.render();b.$td.append(b.list.$con)}c[0].tList.dialog.toggle(true);c.removeClass("i-down-dir").addClass("i-right-dir");break;case"right-dir":c.removeClass("i-right-dir").addClass("i-down-dir");if(c[0].tList){c[0].tList.dialog.toggle(false)}break}};epgd.pages.searchTimerList.update=function(){var a=this;this.$con.find("tbody").empty();epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/searchtimers",async:false,cache:false},function(d){var b=[],e=a.editIcons,c={V:"i-tv",R:"i-record",S:"i-search"};if(!d.searchtimers.length){a.hideHead()}else{$.each(d.searchtimers,function(k,g){var i=epgd.vdrs.list[g.vdruuid]||{name:"--"},h=$("<tr"+(g.active?"":' class="ui-state-disabled"')+'><td><span class="iAsButton i-down-dir edit" title="'+epgd.tr.pages.timer.timerList+'"></span><div class="'+c[g.type]+'">'+(g.name||g.expression)+"</div></td><td"+(g.type=="S"?">--":' data-sort="'+new String("00000"+g.hits).slice(-5)+'">'+g.hits)+"</td><td>"+i.name+"</td><td>"+e+"</td></tr>")[0];h.tData=g;b.push(h)});a.trs=b;a.showHead()}epgd.utils.loader.close();$(window).trigger("searchTimerList_updated",a)})})};epgd.pages.searchTimerList.triggerUpdate=function(){var a=this;epgd.ajax({url:epgd.login.url+"data/updatesearchtimer"},function(b){if(b.result.state==200){epgd.utils.topInfo(epgd.tr.dataSaved)}else{epgd.utils.topInfo(b.message,{isError:1})}a.update()})};epgd.pages.search=new epgd.searchDialog();epgd.pages.messageList=new epgd.timerListBase({saveUrl:"data/markmessages",selectable:true});epgd.pages.messageList.getTable=function(){return'<table id="messageList" class="timerTable"><thead><tr><th style="width:70px">id'+this.sortIcons+'</th><th style="width:120px">Typ <input type="text" class="filter" style="width:18px" />'+this.sortIcons+'</th><th style="width:140px">Zeit'+this.sortIcons+'</th><th style="width:100px">Titel <input type="text" class="filter" style="width:50px" />'+this.sortIcons+'</th><th style="min-width:140px">infotext <input type="text" class="filter" />'+this.sortIcons+'</th><th style="min-width:190px"><div class="selMarkBlock" style="width:auto;float: right;"><b title="'+epgd.tr.markAll+'" class="selected" data-t="1"></b><b title="'+epgd.tr.markNone+'" data-t="0"></b><b title="'+epgd.tr.markToggle+'"><b class="selected"></b></b></div>Status <input type="text" class="filter" style="width:20px" /><br />'+this.sortIcons+'<span class="iAsButton i-refresh edit" title="'+epgd.tr.reload+'"></span><span style="margin-top:3px" class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span><span style="margin-top:3px" class="iAsButton i-check edit" title="'+epgd.tr.pages.timerList.messageStates.R+'"></span><span style="margin-top:3px" class="iAsButton i-check-empty edit" title="'+epgd.tr.pages.timerList.messageStates.N+'"></span></th></tr></thead><tbody></tbody></table>'};epgd.pages.messageList.update=function(b){var a=this;epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/messages",async:false,cache:false},function(l){a.$con.find("tbody").empty();if(!l.messages.length){a.hideHead()}else{var c=[],k,h,g,e={N:'<span class="iAsButton i-check-empty edit">'+epgd.tr.pages.timerList.messageStates.N+"</span>",R:'<span class="iAsButton i-check edit">'+epgd.tr.pages.timerList.messageStates.R+"</span>"},d={E:'<div class="i-error">'+epgd.tr.pages.timerList.timerStates.E+"</div>",F:'<div class="i-flash-outline">'+epgd.tr.pages.timerList.timerStates.F+"</div>",I:'<div class="i-info">'+epgd.tr.pages.timerList.messageTypes.I+"</div>",W:'<div class="i-warning">'+epgd.tr.pages.timerList.messageTypes.W+"</div>"};for(h in l.messages){g=l.messages[h];k=$('<tr><td data-sort="'+new String("0000000"+g.id).slice(-7)+'">'+g.id+"</td><td>"+(d[g.type]||"")+'</td><td data-sort="'+g.updsp+'">'+epgd.utils.formatDateTime(g.updsp)+"</td><td>"+g.title+"</td><td>"+g.text+'</td><td data-sort="'+g.state+g.updsp+'"><span class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span>'+(e[g.state]||"")+"</td></tr>")[0];k.tData=g;c.push(k)}a.trs=c;a.$con.find(">table>tbody").append(c.sort(function(m,i){return m.tData.state==i.tData.state?m.tData.state.updsp>i.tData.state.updsp?-1:1:m.tData.state>i.tData.state}).slice());a.showHead()}epgd.utils.loader.close();$(window).trigger("messagelist_updated",a)})},true)};epgd.pages.messageList.action=function(b,g,e){var c=this.getSelectedIds(b),d=null,a;if(c){switch(g){case"check":d=b[0].parentNode.nodeName=="TH"?"R":"N";break;case"check-empty":d=b[0].parentNode.nodeName=="TH"?"N":"R";break;case"trash":d="D";break}if(d){for(a in c){c[a]={id:c[a],state:d}}d=="D"?this.del(c,null,"messages"):this.saveArray(c,"messages");return true}}return epgd.timerListBase.prototype.action.call(this,b,g,e)};epgd.vdr=function(a,b){this.uuid=a;$.extend(this,b)};epgd.vdr.prototype.switchChannel=function(a){epgd.ajax({url:epgd.login.url+"data/channelswitch?uuid="+this.uuid+"&channel="+a,cache:false},function(b){epgd.utils.popup(b.result.message,{title:"VDR",autoClose:5000})})};epgd.vdr.prototype.wol=function(){epgd.ajax({url:epgd.login.url+"data/wakeupvdr?uuid="+this.uuid,cache:false},function(a){epgd.utils.popup(a.result.message,{title:"VDR",autoClose:5000})})};epgd.vdrs={list:null,current:null,load:function(){if(!this.list){this.list={};epgd.ajax({url:epgd.login.url+"data/vdrs",async:false},function(b){var a;for(a in b.vdrs){epgd.vdrs.list[a]=new epgd.vdr(a,b.vdrs[a])}if(!epgd.vdrs.current){if(epgd.profile.defaultVDRuuid){epgd.vdrs.current=epgd.vdrs.list[epgd.profile.defaultVDRuuid];if(!epgd.vdrs.current){epgd.utils.log("the default VDR ("+epgd.profile.defaultVDRuuid+" is invalid! Please change this in Web Interface/options)")}}if(!epgd.vdrs.current){for(a in epgd.vdrs.list){epgd.vdrs.current=epgd.vdrs.list[a];break}}if(!epgd.vdrs.current){epgd.utils.log("no VDR found",2);epgd.vdrs.current=new epgd.vdr("000-missing-vdr-000",{name:"no VDR found"})}}$(window).trigger("vdrs_load")})}},get:function(a){return this.list[(a||this.current)]||{}}};epgd.pages.vdrs={render:function(){epgd.$con.html('<div><button class="iAsButton" onclick="epgd.vdrs.current.wol()">WOL</button>')}}; \ No newline at end of file
+var epgd={};epgd.tr={oClock:"Uhr",minutes:"min",save:"speichern",copy:"kopieren",apply:"übernehmen",close:"schließen",clear:"löschen",yes:"ja",no:"nein",edit:"bearbeiten",cancel:"abbrechen",del:"löschen",test:"testen",reload:"neu laden",advanced:"erweitert",markAll:"alle markieren",markNone:"keinen markieren",markToggle:"Markierung umdrehen",confirmDelete:"Willst du wirklich löschen?",dataSaved:"Daten wurden gespeichert",dataDeleted:"Daten wurden gelöscht",dataSend:"Daten wurden gesendet",channel:"Kanal",date:"Datum",entries:" Einträge",error:{error:"Fehler",common:"Es ist ein allgemeiner Fehler aufgetreten",serverNotResponse:"Der Server konnte nicht erreicht werden!",notImplemented:"Dieses Feature ist zur Zeit noch nicht implementiert",forbidden:"Zugriff verweigert!",noData:"Für diese Anfrage konnten keine Daten ermittelt werden!",emptyField:"Bitte fülle das Feld $field$ aus!",invalid:"Der eingegebene Wert ist ungültig!"},menu:{now:"Programm",magazine:"Magazin",timer:"Timer",records:"Aufnahmen",search:"Suche",options:"Einstellungen",help:"Hilfe"},pages:{now:{at:"am"},timer:{timerList:"Timer",searchTimerList:"Suchtimer",timersDone:"kürzliche Aufträge",timerListDone:"Auftragshistorie",timerJobList:"asynchrone Aufträge",messageList:"Systemmeldungen"},timerList:{empty:"Keine Timer vorhanden!",startTime:"Anfang",endTime:"Ende",folder:"Verzeichnis",file:"Dateiname",recordTime:"Aufnahmezeit",lifetime:"Lebenszeit",prio:"Priorität",inactive:"Inaktiv",newTimer:"Neuen Timer anlegen",namingMode:"Ermittlung des Dateinamens",namingModes:["VDR","Auto","Constable","Serie","Kategorisiert","Usermode","Template"],template:"Template",templateFields:{"%title%":": Titel (EPG)","%shorttext%":": Untertitel (EPG)","%starttime%":": Startzeit (EPG)","%year%":": Jahr (EPG)","%category%":": Kategorie (EPG)","%episodname%":": Titel der Serie (constabel)","%shortname%":": Kurz-Titel der Serie (constabel, optional)","%partname%":": Name der Folge (constabel)","%season%":": Staffel (constabel)","%part%":": Teil der Staffel (constabel)","%number%":": Nummer über alle Staffeln (constabel)","%extracol1%":": Zusätzliche Angaben z.B. bei Tatort die Ermittler (constabel, optional)","%extracol2%":": ... z.B. bei Tatort der Ort (constabel, optional)","%extracol3%":": ... z.B. bei Tatort der Sender (constabel, optional)"},episode:"Serientitel",noEpgMatch:"Ignoriere fehlende EPG Info",noRepeat:"Wiederholungen vermeiden",searchTimerReload:"Suchtimer updaten",chInclude:"Auf Kanäle einschränken",chExclude:"Kanäle ausschließen",nextDays:"innerhalb der nächsten $field$ Tage",confirmSaveBigResult:"Die Suche ergibt $cnt$ Treffer, trotzdem speichern?",timerStates:{D:"gelöscht",E:"Fehler",F:"Aufnahme erfolgreich",P:"wartet auf Start",R:"nimmt gerade auf...",U:"unbekannt"},timerActions:{C:"Timer wurde erstellt und muss noch von einem VDR übernommen werden",D:"Timer wurde gelöscht und muss noch im VDR gelöscht werden",F:"Zuweisung Timer an VDR fehlgeschlagen",M:"Timer wurde verändert und muss noch vom VDR verarbeitet werden"},doneStates:{f:"Timer konnte nicht erstellt werden",C:"Timer bereits erstellt",D:"Timer gelöscht",F:"Aufnahme fehlgeschlagen",Q:"Timer in Vorbereitung",R:"Aufnahme fertig"},messageStates:{N:"Neu",R:"gelesen"},messageTypes:{I:"Information",W:"Warnung",E:"Fehler",F:"Fataler Fehler"},chFormat:"bevorzugtes Sendeformat"},eventDetail:{record:"Aufnehmen",repeat:"Wiederholungen",ch_switch:"umschalten",play:"abspielen",eventNext:"nachfolgend",eventPrev:"vorher",parentalrating:"ab ",mergeSrc:"Quelle ",genre:"Genre",category:"Kategorie",country:"Land",year:"Jahr",season:"Staffel",part:"Folge",number:"Folge Insgesamt",extentedInfo:"weitere Informationen",scrapperMovieInfo:"Filminformation",scrapperSerieInfo:"Serieninformation",constabelInfo:"Constabel Episodenliste",addConstableLink:"Link erzeugen",loginConstable:"Login",title:"Titel",original_title:"Originaltitel",runtime:"Laufzeit",lang:"Sprache",release_date:"Erscheinungsdatum",actors:"Schauspieler",network:"Netzwerk",seriesstatus:"Status",gueststars:"Gäste",homepage:"Webseite",popularity:"Beliebtheit",vote_average:"&oslash; Bewertung",extInfo:{director:"Regie",camera:"Kamera",screenplay:"Drehbuch",producer:"Produktion",music:"Musik",moderator:"Moderator",commentator:"Kommentator",guest:"Gäste",info:"Info",other:"Sonstige"}},options:{profile:"allgemein",editChannels:"Kanäle bearbeiten",editUser:"Benutzer bearbeiten"},editChannels:{menu:{channelList:"Kanalliste",referenceList:"Referenzliste",insertAsText:"als Text einfügen",extentEmptyChannelNames:"leere Kanalnamen ergänzen",applyAllChannelNames:"Alle Kanalnamen übernehmen",applyChannelSort:"Kanalsortierung übernehmen"},headline:"Sortierung der Kanäle durch drag und drop, Blockmarkierung durch zus. gedrückter shift-Taste",checkWeb:"Kanal in Webansicht anzeigen",checkVDR:"Kanal zum VDR übertragen",desc_insertList:"Kopiere den Inhalt einer channels.conf in das Textfeld unten. Eine vollständige Liste gibt es beispielsweise hier:"},editUser:{user:"Benutzer",sel:"auswählen",add:"neu anlegen",active:"Aktiv",inActive:"Inaktiv",rights:{label:"Rechte",umConfig:"Konfiguration lesen",umConfigEdit:"Konfiguration ändern",umConfigUsers:"Benutzer konfigurieren",umTimer:"Timer lesen",umTimerEdit:"Timer bearbeiten",umSearchTimer:"Suchtimer lesen",umSearchTimerEdit:"Suchtimer bearbeiten",umFsk:"FSK",umRecordings:"Aufnahmen lesen",umRecordingsEdit:"Aufnahmen editieren"}},help:{url:"lang/hilfe.html",noHelp:"Hierzu konnte kein Hilfstext gefunden werden"},search:{search:"suchen",searchName:"Name",searchExpression:"Suchausdruck",caseSensitive:"Klein-/Großschreibung",searchModes:["exakte Übereinstimmung","regulärer Ausdruck","Muster","enthalten in"],searchFields:["Titel","Kurztext","Beschreibung"],empty:"Leider nichts gefunden.",matchdensity:"Treffergenauigkeit"},login:{label:"Login",userName:"Benutzername",password:"Passwort",loggedAlwaysIn:"angemeldet bleiben",logout:"Abmelden",error:"Fehler beim Anmelden!",logoutMessage:"Du wurdest abgemeldet!",needLogin:"Login erforderlich"},records:{ddLabel:"Drag und Drop",refreshMessage:"Aufnahmelisten werden neu geladen, Seite lädt in $sec$ Sekunden neu",moveMessage:"Aufnahme verschieben von \n$src$\nnach",notFoundMessage:"Aufnahme nicht gefunden, ggf einmal aktualisieren",deleteMessage:"Soll die Aufnahme $src$ wirklich gelöscht werden?",available:"Verfügbar",commonRecFolder:"gemeinsame Aufnahmen",similarTimer:"ähnliche Sendung aufnehmen"},profile:{mailReceiver:"eMail",sendTCC:"sende Mail bei Timerkonflikten",sendMessages:"sende Mail bei Systemmeldungen",magazinePan:"Scrollgeschwindigkeit in Minuten<br />(0 = aus)",magazinePanDelay:"Auslöseverzögerung",maxListEntries:"maximal Anzahl Einträge, die auf einmal vom Server geladen werden sollen, z.B. bei Suchen, Suchtimern usw.",system:{label:"epgd Backend"},vdr:{startWithSched:"EPG Menü startet mit Schedule"},record:{subFolderSort:"Sortierung der Unterordner"}}},dateTimePicker:{monthNames:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthNamesShort:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],dayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],dayNamesShort:["So","Mo","Di","Mi","Do","Fr","Sa"],dayNamesMin:["So","Mo","Di","Mi","Do","Fr","Sa"],weekHeader:"KW",timeOnlyTitle:"Zeit wählen",timeText:"Sendungsbeginn",timeTextBetween:"zwischen",prevText:"&#x3C;Zurück",nextText:"Vor&#x3E;",currentText:"Jetzt",closeText:"Fertig",hourText:"Stunde",minuteText:"Minute",secondText:"Sekunde",millisecText:"Millisekunde",microsecText:"Mikrosekunde",timezoneText:"Zeitzone",timeFormat:"HH:mm",dateFormat:"D, dd.mm.yy",amNames:["vorm.","AM","A"],pmNames:["nachm.","PM","P"],isRTL:false,showMonthAfterYear:false,yearSuffix:""}};epgd.profile={needLogin:-1,channelLogoPath:"data/channellogo",eventImgPath:"data/eventimg",movieMediaPath:"data/moviemedia",serieImgPath:"data/seriesmedia",movieActorPath:"http://www.themoviedb.org/person/",serieSeasonPath:"http://www.thetvdb.com/?tab=seasonall&id=",constabelEditPath:"https://www.eplists.de/eplist.cgi?action=edit&back=&file=",constabelLinkPath:"https://www.eplists.de/eplist.cgi?action=show_form_redir&linkname=",minEventTime:0,maxEventTime:0,logoShowName:0};epgd.userProfile_defaults={defaultVDRuuid:"",constabelLoginPath:false,pickerFirstDay:"6",quickTimes:"",startWithSched:0,startPage:"menu_options",namingModeSerie:"0",namingModeSearchSerie:"0",namingModeMovie:"0",namingModeSearchMovie:"0",namingModeSerieTemplate:"",namingModeSearchSerieTemplate:"",namingModeMovieTemplate:"",namingModeSearchMovieTemplate:"",chFormat:"",timerDefaultVDRuuid:"",searchAdv:"0",mailReceiver:"",messageMailTypes:"",magazinePan:10,magazinePanDelay:400,maxListEntries:100,ratings:"",recordSubFolderSort:1};epgd.profile_load=function(b){var a=$.extend(epgd.profile,epgd.userProfile_defaults);epgd.ajax({url:epgd.login.url+"data/parameters",async:false,cache:false,dataType:"json"},function(l){var m,g,d,c,e,h={};for(g in l.parameters){m=l.parameters[g];c=a[m.name];if(c!=undefined&&c!=m.value){a[m.name]=m.type===0?parseInt(m.value,10):m.value;h[m.name]=c;if(m.name.indexOf("logo")==0){epgd.channels.isDirty=true}}}if(epgd.utils.timeOffset==null){epgd.utils.timeOffset=(l.timezone-new Date().getTimezoneOffset()*60)*1000;e=epgd.utils.now();epgd.$dtPicker.datetimepicker("setDate",new Date(e.setMinutes(parseInt(e.getMinutes()/15,10)*15)))}if(!a.minEventTime){e=epgd.utils.now();a.minEventTime=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0).getTime()/1000;h.minEventTime=0}if(!a.maxEventTime){a.maxEventTime=a.minEventTime+8*24*60*60-60;h.maxEventTime=0}for(d in h){$(window).trigger("profile_updated",h);break}epgd.channels.isDirty&&epgd.channels.load()})};epgd.pages={};epgd.login={user:"",session:"",rights:-1,url:""};epgd.rights={umConfig:2,umConfigEdit:4+2,umConfigUsers:8,umTimer:64,umTimerEdit:128+64,umSearchTimer:256+64,umSearchTimerEdit:512+256+128+64,umFsk:4096,umRecordings:32768,umRecordingsEdit:65536+32768};epgd.utils={timeOffset:null,now:function(){return new Date(new Date().getTime()-this.timeOffset)},date:function(a){return new Date(a*1000-this.timeOffset)},unixTime:function(a){return a?parseInt((a.getTime()+this.timeOffset)/1000,10):0},formatTime:function(a){var b=new Date(a*1000-this.timeOffset);return new String(100+b.getHours()).slice(1)+":"+new String(100+b.getMinutes()).slice(1)},formatDateTime:function(b,a){var c=new Date(b*1000-this.timeOffset);return $.datepicker.formatDate((a||epgd.tr.dateTimePicker.dateFormat),c)+" "+new String(100+c.getHours()).slice(1)+":"+new String(100+c.getMinutes()).slice(1)},formatDate:function(b,a){var c=new Date(b*1000-this.timeOffset);return $.datepicker.formatDate((a||epgd.tr.dateTimePicker.dateFormat),c)},popup:function(b,c){var d=$(window),a;c=$.extend({autoOpen:true,dialogClass:"popup",show:{effect:"blind",duration:1000},hide:{effect:"explode",duration:1000},width:400,height:200,maxWidth:d.width()*0.8,maxHeight:d.height()*0.7},c);a=$('<div class="epgPopUp"><p>'+b+"</p></div>").dialog(c);c.autoClose&&window.setTimeout(function(){a.dialog("close").dialog("destroy")},c.autoClose);return a},confirm:function(a,c){var b={modal:true,buttons:{}};b.buttons[epgd.tr.yes]=function(){$(this).dialog("close");c(true)};b.buttons[epgd.tr.no]=function(){$(this).dialog("close");c(false)};this.popup(a,b)},topInfo:function(b,c){var e=c&&c.isError,d,a;c=$.extend({autoClose:e?0:3000,className:"ui-state-"+(e?"error":"highlight")},c);a=(c.autoClose||3000)/2;d=$('<div class="topInfo ui-corner-all '+c.className+'">'+b+'<button onclick="$(this).parent().remove();" class="iAsButton i-cancel" title="'+epgd.tr.close+'"></button></div>').appendTo(epgd.$menu).animate({opacity:0.4},a,function(){d.animate({opacity:1},a)});c.autoClose&&window.setTimeout(function(){d.remove()},c.autoClose)},sendMail:function(c,a,b,d){epgd.ajax({url:epgd.login.url+"data/sendmail",type:"post",data:JSON.stringify({receiver:(d||epgd.profile.mailReceiver),subject:c,body:a,mimetype:b})},function(e){e=e.result;if(e&&e.state==200){epgd.utils.topInfo(epgd.tr.dataSend)}else{epgd.utils.topInfo(e.message,{isError:1})}epgd.profile_load()})},loader:{$win:$('<div style="position:absolute;z-index:9999;width:100%;height:100%;position:fixed;left:0px;top:0px;background:url(images/loader.png) no-repeat 50% 50%"></div>'),cnt:0,process:function(b,c){var a=this;this.cnt++;this.$win.appendTo(document.body).stop().animate({opacity:0.7},{always:function(){try{b()}catch(d){epgd.utils.log((d.message||"common error")+"\n"+(d.stack||""),0);a.close()}!c&&a.close()}},200)},close:function(){if(this.cnt>0){this.cnt--;this.cnt==0&&this.$win.remove()}}},addAutoComplete:function(d,b){var c=$(d),e=c[0].className,a=c[0].style.width||"";$(d).autocomplete($.extend({minLength:0,multiselect:false,create:function(i,m){var l=$(this).autocomplete("instance"),n=l.options,k,h;l.selectedItems={};if(n.multiselect){l.multiselect=$("<div></div>").addClass("ui-autocomplete-multiselect ui-state-default ui-widget "+e).css("width",a).insertBefore(l.element).append(l.element).bind("click.autocomplete",function(){l.element.focus()});l.menu.element.css({height:"300px","overflow-y":"auto"});k=parseInt(l.element.css("fontSize")||10,10);function g(p){var o=$(this);o.width(1).width(this.scrollWidth+k-1)}h=$.ui.keyCode;l.element.bind({"keydown.autocomplete":function(p){if((this.value==="")&&(p.keyCode==h.BACKSPACE)){var o=l.element.prev();delete l.selectedItems[o.text()];o.remove()}},"focus.autocomplete blur.autocomplete":function(){l.multiselect.toggleClass("ui-state-active")},"keypress.autocomplete change.autocomplete focus.autocomplete blur.autocomplete":g}).trigger("change");n.select=n.select||function(p,o){if(!l.selectedItems[o.item.label]){$("<div></div>").addClass("ui-autocomplete-multiselect-item").text(o.item.label).append($("<span></span>").addClass("ui-icon ui-icon-close").click(function(){var q=$(this).parent();delete l.selectedItems[q.text()];q.remove()})).insertBefore(l.element);l.selectedItems[o.item.label]=o.item}l._value("");return false}}else{n.select=n.select||function(p,o){l.selectedItems[0]=o.item;l._value(o.item.label);return false}}}},b)).focus(function(){$(this).autocomplete("search","")})},getAutoCompleteValues:function(i,c){c=c||"";var b="",a=","+c,g,d;try{g=$(i).autocomplete("instance").selectedItems;for(d in g){b+=a+g[d].value+c}}catch(h){}return b.slice(1)},setAutoCompleteValues:function(g,a){var d=$(g).autocomplete("instance"),c,b,e;d.multiselect&&d.multiselect.find(">div").remove();d.selectedItems={};if(a){for(b=0;b<a.length;b++){c=null;e=new RegExp($.ui.autocomplete.escapeRegex(a[b]),"i");$.each(d.options.source,function(){if(e.test(this.value||this.label||this)){return !(c=this)}});if(c){d._trigger("select",null,{item:c.label?c:{label:c,value:c}})}}}},addPlaceholders:function(g,d,a){var b=$(g)[0],c='<ul class="placeholders ui-menu ui-widget ui-widget-content">',e;for(e in a){c+='<li class="ui-menu-item"><b>'+e+"</b>"+a[e]+"</li>"}b.$placeholders=$(c+"</ul>").hide().insertAfter(b).click(function(i){var k=i.target.nodeName=="B"?$(i.target).text():i.target.nodeName=="LI"?$(i.target.firstChild).text():null,l=$(b).prop("selectionStart"),h=$(b).val();if(k){$(b).val(h.substring(0,l)+k+h.substring(l,h.length)).focus();l+=k.length;if(b.setSelectionRange){b.setSelectionRange(l,l)}else{if(b.createTextRange){h=b.createTextRange();h.collapse(true);h.moveEnd("character",l);h.moveStart("character",l);h.select()}}}$(this).hide()});$(b).keydown(function(h){if(h.key==d){$(document).one("click",function(){b.$placeholders.hide()});b.blur();return !b.$placeholders.show().position({my:"left top",at:"left bottom",of:b})}})},inherits:function(a,c){var b=function(){};b.prototype=c.prototype;a.prototype=new b();a.prototype.constructor=a;a.base=c.prototype;return a},log:function(a,c){console.log("error:"+a);try{$.ajax({url:"data/log",type:"get",async:true,cache:false,data:"level="+(c||0)+"&message="+escape(a)})}catch(b){}}};epgd.init=function(){epgd.$con=$('<div id="content"></div>').appendTo(document.body);$.datepicker.setDefaults(epgd.tr.dateTimePicker);$.datepicker.setDefaults({showOtherMonths:true,selectOtherMonths:true});$.timepicker.setDefaults(epgd.tr.dateTimePicker);$.timepicker.setDefaults({timeInput:true,controlType:{create:function(b,g,e,h,c,a,d){if(e=="hour"){if(!b.inst.settings.timeOnly){$("#ui-datepicker-div").width(($(window).width()>500?430:230)+"px")}$("<span><u>0</u><u>2</u><u>4</u><u>6</u><u>8</u><u>10</u><br /><u>12</u><u>14</u><u>16</u><u>18</u><u>20</u><u>22</u><span>").appendTo(g).bind("click",{tp_inst:b,obj:g,unit:e},$.timepicker.quicklink)}else{if(e=="minute"){$("<span><u>0</u><u>15</u><u>30</u><u>45</u><span>").appendTo(g).bind("click",{tp_inst:b,obj:g,unit:e},$.timepicker.quicklink)}else{if(e=="second"&&epgd.profile.quickTimes){g.closest("dl").find(".ui_tpicker_time").removeClass().bind("click",{tp_inst:b,obj:g,unit:"time"},$.timepicker.quicklink).html('<i><u title="'+epgd.profile.quickTimes.replace(/[^=~]+=@[a-z]+/gi,"").replace(/~{2,}/g,"~").replace(/=!?/g,'">').replace(/~/g,'</u></i><i><u title="')+"</u></i>");if(b.inst.settings.alwaysSetTime){epgd.pages.help.initButtons(b.inst.dpDiv.find(".ui-datepicker-buttonpane").append(epgd.pages.help.getButton("datepicker")))}else{$('<button class="iAsButton i-cancel" role="button">'+epgd.tr.clear+"</button>").appendTo(b.inst.dpDiv.find(".ui-datepicker-buttonpane")).click(function(){b.$input.val("");$.datepicker._hideDatepicker()})}return g}else{return g}}}$('<input class="ui-timepicker-input" value="'+h+'" style="width:20px">').prependTo(g).spinner({min:c,max:a,step:d,change:function(k,i){if(k.originalEvent!==undefined){b._onTimeChange()}b._onSelectHandler()},spin:function(k,i){b.control.value(b,g,e,i.value);b._onTimeChange();b._onSelectHandler()}});return g},options:function(a,d,c,b,e){if(typeof(b)=="string"&&e!==undefined){return d.find(".ui-timepicker-input").spinner(b,e)}return d.find(".ui-timepicker-input").spinner(b)},value:function(a,d,b,g){try{if(g!==undefined){return d.find(".ui-timepicker-input").spinner("value",g)}return d.find(".ui-timepicker-input").spinner("value")}catch(c){return false}}}});epgd.$menu=$('<nav id="menu-top"><ul id="ui-menu-top"><li id="menu_login"><a href="#menu_login">'+epgd.tr.pages.login.label+"</a></li></ul></nav>").appendTo(document.body).find("ul").hide();epgd.$menu.$maxBut=$('<span class="maxi i-menu" />').insertBefore(epgd.$menu).click(function(){epgd.$menu.parent().toggleClass("open")});epgd.$menu.checkMenuSize=function(a,b){if(window.wrm_i){if(window.wrm_w==$(window).width()){window.clearInterval(window.wrm_i);delete window.wrm_i;epgd.$menu.parent().removeClass("mini").width(window.wrm_w).offset({left:$(window).scrollLeft()});epgd.$menu.checkMenuSize(null,b)}else{window.wrm_w=$(window).width()}return}if(a){window.wrm_w=$(window).width();if(!window.wrm_i){window.wrm_i=window.setInterval(epgd.$menu.checkMenuSize,200,null,b)}}else{if(epgd.$menu.height()>40){epgd.$menu.parent().addClass("mini")}window.setTimeout(function(){document.body.style.paddingTop=(epgd.$menu.parent().height()+10)+"px";b&&window.setTimeout(b,200)},200)}};$(window).bind("resize",epgd.$menu.checkMenuSize);epgd.$dtPicker=$('<input type="text" id="selDate" readonly style="z-index:199;position:relative" />').appendTo(document.body).hide().bind("click",function(){$(this).datepicker("show");return false});epgd.$dtPicker.datetimepicker({beforeShow:function(){this.$overlay=$("<div />").addClass("ui-widget-overlay ui-front").appendTo(document.body)},onClose:function(){this.$overlay.remove();$(window).trigger("datepicker")},calendarStart:function(){var a=new Date(epgd.profile.minEventTime*1000);leadDays=(a.getDay()-parseInt(epgd.profile.pickerFirstDay,10)+7)%7;a.setHours(12,0);a.setDate(a.getDate()-leadDays);return a}});epgd.$menu.menu({position:{at:"left bottom"},select:function(a,b){var c=b.item.attr("id");if(!c||c.indexOf("menu_")!=0||(a.originalEvent&&a.originalEvent.target.nodeName!="A"&&a.originalEvent.target.nodeName!="LI")){return false}$(window).trigger("epgd_close");epgd.$menu.parent().removeClass("open");$(".menu-active",this).removeClass("menu-active");$(document.body).append(epgd.$dtPicker.hide());epgd.$menu.checkMenuSize(null,function(){try{b.item.addClass("menu-active").parent().parent(".ui-menu-item").addClass("menu-active");epgd.pages[c.slice(5)].render()}catch(d){epgd.utils.popup(epgd.tr.error.common,{title:epgd.tr.error.error});epgd.utils.log((d.message||"common error")+"\n"+(d.stack||""),2)}})}});$(window).bind("epgd_close",function(){$(".epgPopUp").dialog("destroy")}).bind("profile_updated",function(b,a){if(a.minEventTime!=undefined){epgd.$dtPicker.datetimepicker("option",{minDateTime:new Date((epgd.profile.minEventTime=parseInt(epgd.profile.minEventTime,10))*1000),minDate:new Date(epgd.profile.minEventTime*1000)})}if(a.maxEventTime!=undefined){epgd.$dtPicker.datetimepicker("option",{maxDateTime:new Date((epgd.profile.maxEventTime=parseInt(epgd.profile.maxEventTime,10))*1000),maxDate:new Date(epgd.profile.maxEventTime*1000)})}if(a.pickerFirstDay!=undefined){epgd.$dtPicker.datetimepicker("option",{firstDay:epgd.profile.pickerFirstDay})}if(a.defaultVDRuuid!=undefined){$("#menu_vdrs > select").val(epgd.profile.defaultVDRuuid)}if(a.quickTimes!=undefined){epgd.pages.magazine.initQT()}if(a.needLogin!=undefined){epgd.pages.login.doLogin()}}).bind("login_changed",function(a,b){epgd.$menu.html("").hide();epgd.$con.html("");if(epgd.login.rights){epgd.$menu.append('<li id="menu_now"><a href="#menu_now">'+epgd.tr.menu.now+"</a></li>");epgd.$menu.append('<li id="menu_magazine"><a href="#menu_magazine">'+epgd.tr.menu.magazine+"</a></li>");(epgd.login.rights&epgd.rights.umTimer)==epgd.rights.umTimer&&epgd.$menu.append("<li><a>"+epgd.tr.menu.timer+'</a><ul><li id="menu_timerList"><a href="#menu_timerList">'+epgd.tr.pages.timer.timerList+"</a></li>"+((epgd.login.rights&epgd.rights.umSearchTimer)==epgd.rights.umSearchTimer?'<li id="menu_searchTimerList"><a href="#menu_searchTimerList">'+epgd.tr.pages.timer.searchTimerList+"</a></li>":"")+'<li id="menu_timersDone"><a href="#menu_timersDone">'+epgd.tr.pages.timer.timersDone+'</a></li><li id="menu_timerListDone"><a href="#menu_timerListDone">'+epgd.tr.pages.timer.timerListDone+'</a></li><li id="menu_timerJobList"><a href="#menu_timerJobList">'+epgd.tr.pages.timer.timerJobList+'</a></li><li id="menu_messageList"><a href="#menu_messageList">'+epgd.tr.pages.timer.messageList+"</a></li></ul></li>");(epgd.login.rights&epgd.rights.umRecordings)==epgd.rights.umRecordings&&epgd.$menu.append('<li id="menu_records"><a href="#menu_records">'+epgd.tr.menu.records+"</a></li>");epgd.$menu.append('<li id="menu_search"><a href="#menu_search">'+epgd.tr.menu.search+"</a></li>");epgd.$menu.append("<li><a>"+epgd.tr.menu.options+'</a><ul><li id="menu_profile"><a href="#menu_profile">'+epgd.tr.pages.options.profile+"</a></li>"+((epgd.login.rights&epgd.rights.umConfigEdit)==epgd.rights.umConfigEdit?'<li id="menu_editChannels"><a href="#menu_editChannels">'+epgd.tr.pages.options.editChannels+"</a></li>":"")+((epgd.login.rights&epgd.rights.umConfigUsers)==epgd.rights.umConfigUsers?'<li id="menu_editUser"><a href="#menu_editUser">'+epgd.tr.pages.options.editUser+"</a></li>":"")+"</ul></li>");epgd.$menu.append('<li id="menu_help"><a href="#menu_help">'+epgd.tr.menu.help+"</a></li>");epgd.$menu.append('<li id="menu_vdrs"><a href="#menu_vdrs">VDR</a><select></select><span><a id="osd2web">-&gt;OSD</a></span></li>')}epgd.profile.needLogin=="1"&&epgd.$menu.append('<li id="menu_login"><a href="#menu_login">'+(epgd.login.session?epgd.login.user+" "+epgd.tr.pages.login.logout:epgd.tr.pages.login.label)+"</a></li>");if(epgd.login.user!=b.user){epgd.profile_load();epgd.channels.isDirty=true;epgd.vdrs.list=null}epgd.channels.load();epgd.vdrs.load();epgd.$menu.show().menu("refresh");epgd.$menu.menu("select",{target:$(epgd.login.rights?(location.hash||"#"+epgd.profile.startPage||"#menu_profile"):"#menu_login")})}).bind("vdrs_load",function(){html="";for(var a in epgd.vdrs.list){html+='<option value="'+a+'"'+(a==epgd.vdrs.current.uuid?"selected":"")+">"+epgd.vdrs.list[a].name+"</option>"}$("<select>"+html+"</select>").replaceAll("#menu_vdrs > select").show().change(function(){var b=epgd.vdrs.current=this.selectedIndex>=0?epgd.vdrs.get(this[this.selectedIndex].value):{};if(b&&b.osd2webp){$("#osd2web").prop("target","osd2web_"+b.name).prop("href","http://"+b.ip+":"+b.osd2webp).click(function(c){c.stopPropagation();return true}).show()}else{$("#osd2web").hide()}}).mousedown(function(b){b.stopPropagation();return true}).click(function(b){return false}).change()}).bind("unload",function(){if(epgd.login.session){epgd.pages.login.doLogin("logout")}});epgd.pages.now.init();epgd.pages.magazine.init();epgd.profile_load();if(epgd.profile.needLogin==-1){epgd.profile.needLogin=0;epgd.pages.login.doLogin()}window.setInterval(epgd.profile_load,3600000)};window.onerror=function(i,g,b,d,c){var a=!d?"":"\ncolumn: "+d;a+=!c?"":"\nerror: "+c.stack;try{epgd.utils.log(i+"\nline: "+b+a,2)}catch(h){}return true};$.widget("custom.catcomplete",$.ui.autocomplete,{_create:function(){this._super();this.widget().menu("option","items","> :not(.ui-autocomplete-category)")},_renderMenu:function(c,b){var d=this,a="";$.each(b,function(g,h){var e;if(h.category!=a){c.append("<li class='ui-autocomplete-category'>"+h.category+"</li>");a=h.category}e=d._renderItemData(c,h);if(h.category){e.attr("aria-label",h.category+" : "+h.label)}})}});$.datepicker._gotoToday=function(c){var b=this._getInst($(c)[0]),a=epgd.utils.now();this._base_gotoToday(c);this._setTime(b,a);this._setDate(b,a);this._hideDatepicker()};$.timepicker.quicklink=function(b){var g=b.target.nodeName=="I"?b.target.firstChild:b.target,a,i=null,h=false;try{a=b.data.tp_inst||$.datepicker._getInst(epgd.$dtPicker[0]).settings.timepicker}catch(c){epgd.utils.log((c.message||"common error")+"\n"+(c.stack||""),2);return false}if(g.nodeName=="U"){if(b.data.unit=="time"){i=$.datepicker.parseTime(a._defaults.timeFormat,g.innerHTML,a._defaults)}else{if(b.data.unit=="hour"){i={hour:parseInt(g.innerHTML,10),minute:a.minute}}}if(i){if(i.hour<a.hour-1){h=true}else{a.control.value(a,a.hour_slider,"hour",i.hour);a._onTimeChange();if(a.hour!=i.hour){h=true}}if(h){h=new Date(a.inst.selectedYear,a.inst.selectedMonth,a.inst.selectedDay+1,i.hour,i.minute);$.datepicker._setDate(a.inst,h);$.datepicker._setTime(a.inst,h);$.datepicker._updateDatepicker(a.inst)}else{a.control.value(a,a.minute_slider,"minute",i.minute)}}else{a.control.value(a,b.data.obj,b.data.unit,parseInt(g.innerHTML,10))}a._onTimeChange();a._onSelectHandler();if(b.target.nodeName=="I"){$.datepicker._hideDatepicker()}}};epgd.ajax=function(b,d,a){var c=$.extend({dataType:"json",contentType:"application/json; charset=utf-8"},b);return $.ajax(c).fail(function(h,g){epgd.utils.loader.close();if(h.status==401){epgd.pages.login.doLogin(null,null,function(){if(epgd.login.rights){c.url=c.url.replace(/sid[^\/]+\//,epgd.login.url);$.ajax(c).done(d).fail(function(){epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})})}else{epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}})}else{if(h.status==403){epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}else{if(h.status==501){epgd.utils.popup(epgd.tr.error.notImplemented,{title:epgd.tr.error.error})}else{if(a&&a.call(this,h,g)){return}var i="";try{if(h.responseJSON){i=h.responseJSON.result.message}}catch(g){i="";epgd.utils.log((g.message||"common error")+"\n"+(g.stack||"")+"\n options:"+JSON.stringify(b)+"\n jqhr:"+JSON.stringify(h),3)}epgd.utils.popup(i||h.responseText||epgd.tr.error.serverNotResponse,{title:epgd.tr.error.error})}}}}).done(d)};epgd.timerDialogBase=function(a){this.$win=null;this.list=null;if(a){this.options=$.extend({},this.options,a)}};epgd.timerDialogBase.prototype={options:{id:"baseDialog",modal:true,draggable:true,resizable:true,autoOpen:false,width:"auto",maxHeight:$(window).height(),close:function(){this.list.dialog.form.reset();$(this.list.dialog.form).next().remove()},buttons:[{text:epgd.tr.del,icons:{primary:"ui-icon-trash"},id:"tBDel",click:function(){$(this).dialog("close");this.list.del(this.list.dialog.form.tID.value)}},{text:epgd.tr.cancel,icons:{primary:"ui-icon-close"},click:function(){$(this).dialog("close")}},{text:epgd.tr.save,icons:{primary:"ui-icon-disk"},click:function(){this.list.dialog.save()}}]},save:function(d,b,a,c){this.list.save(d||this.getData(),b,a,c)&&!this.options.embed&&this.$win.dialog("close")},showError:function(b,a){epgd.utils.popup((a&&a.id?"<b>"+$('label[for="'+a.id+'"]').text()+"</b>":"")+"<div>"+b+"</div>",{autoClose:3000});a&&a.focus();return false},loadFolder:function(){var a=this;epgd.ajax({url:epgd.login.url+"data/recordingdirs"},function(d){if(d.recordingdirs.length){var b=[],c=epgd.vdrs.list,e;$.each(d.recordingdirs,function(h,g){e=c[g.vdruuid];b.push({value:g.directory,category:e?e.name:"-"})});$(a.form.tFolder).catcomplete("option","source",b)}})},close:function(){if(this.$win){this.$win.dialog("close")}},create:function(){var d=this.options,c=epgd.tr.pages.timerList,b="",a;for(a=1;a<epgd.tr.dateTimePicker.dayNamesShort.length;a++){b+='<input name="tWeek" type="checkbox" />'+epgd.tr.dateTimePicker.dayNamesShort[a]}b+='<input name="tWeek" type="checkbox" />'+epgd.tr.dateTimePicker.dayNamesShort[0];this.$win=$('<div id="'+d.id+'" class="searchDialog"><form><div class="colBlock"><div><label>&nbsp;</label><select id="tType"><option value="R">'+epgd.tr.pages.eventDetail.record+'</option><option value="V">'+epgd.tr.pages.eventDetail.ch_switch+'</option></select></div><div><label for="tSName">'+epgd.tr.pages.search.searchName+'</label><input type="text" id="tSName" /></div><div><label for="tInactive">'+c.inactive+'</label><input type="checkbox" id="tInactive" /></div></div><div class="ui-corner-all week">'+b+'</div><div class="onlyTypeR"><label for="tNameMode">'+c.namingMode+epgd.pages.help.getIcon("sTNameMode")+'</label><br /><select id="tNameMode"><option>'+c.namingModes.join("</option><option>")+'</option></select></div><div class="onlyTypeR"><label for="tTemplate">'+c.template+'</label><input class="full" id="tTemplate" type="text" value="" /></div><div class="onlyTypeR"><label for="tFolder">'+c.folder+'</label><input class="full" type="text" id="tFolder" /></div><div class="colBlock"><div class="noTypeS"><label for="tVdr">VDR</label><select id="tVdr"><option value="">Auto</option>'+$("#menu_vdrs").find("select").html()+'</select></div><div class="onlyTypeR"><label for="tPrio">'+c.prio+'</label><input type="number" placeholder="..." min="0" max="99" id="tPrio" style="width:40px" /></div><div class="onlyTypeR"><label for="tLife">'+c.lifetime+'</label><input type="number" placeholder="..." min="0" max="99" style="width:40px" id="tLife"/></div><div class="onlyTypeR"><label for="tVPS">VPS</label><input type="checkbox" id="tVPS" /></div></div><input type="hidden" id="tID" /><br clear="all" /></form></div>');!d.embed&&this.$win.appendTo(document.body).dialog(d);this.$win[0].list=this.list;this.form=this.$win.find("form")[0];$(this.form.tFolder).catcomplete({minLength:0,maxHeight:300}).focus(function(){$(this).catcomplete("search","")});$(this.form.tType).change(function(){if(this.selectedIndex<0){this.selectedIndex=0}this.form.className=this.form.className.replace(/ ?type./,"")+" type"+this[this.selectedIndex].value});$(this.form.tNameMode).change(function(){this.form.tTemplate.parentNode.style.display=(this.selectedIndex==6)?"block":"none"});epgd.utils.addPlaceholders(this.form.tTemplate,"%",c.templateFields);this.loadFolder()},render:function(b){b=b||{};if(!this.$win){this.create()}!this.options.embed&&this.$win.dialog("open").dialog("moveToTop");var c=this.form,e,a;c.tSName.focus();if(b.id){c.tID.value=b.id;this.$win.parent().find("#tBDel").show();this.$win.parent().find("#tBToggle").hide()}else{c.tID.value="";this.$win.parent().find("#tBDel").hide();this.$win.parent().find("#tBToggle").show()}$(c.tType).val(b.type||"R").change();$(c.tVdr).val(b.vdruuid||epgd.profile.timerDefaultVDRuuid);e=b.weekdays||0;for(a=0,f=1;a<c.tWeek.length;a++,f*=2){c.tWeek[a].checked=(e&f)}c.tPrio.value=b.priority||"";c.tLife.value=b.lifetime||"";c.tVPS.checked=b.vps==1;c.tInactive.checked=b.active===0;c.tFolder.value=b.directory||"";c.tSName.value=b.name||"";epgd.pages.help.initButtons(this.$win);this.resize()},resize:function(){this.$win.dialog("option","maxHeight",$(window).height())}};epgd.timerDialog=epgd.utils.inherits(function(){epgd.timerDialogBase.call(this,{id:"timerDialog",title:epgd.tr.pages.timer.timerList+" "+epgd.tr.edit,buttons:[{text:epgd.tr.pages.timer.searchTimerList,icons:{primary:"ui-icon-transferthick-e-w"},id:"tBToggle",click:function(){var a=this.list.dialog.getData(true);if(a){$(this).dialog("close");if(a.title){a.expression=a.title;a.searchfields=1}epgd.pages.searchTimerList.dialog.render(a)}}}].concat(epgd.timerDialog.base.options.buttons)})},epgd.timerDialogBase);epgd.timerDialog.prototype.create=function(){epgd.timerDialog.base.create.call(this);var b=epgd.tr.pages.timerList,a=this.form;$(a).prepend('<input type="hidden" id="tEvID" /><div id="tTitle"></div>');$(a.tWeek[0]).parent().before('<div><label for="tStart">'+b.recordTime+'</label><br /><span id="tEvTime"></span>&nbsp;<input type="text" id="tStart" style="width:165px" /> - <input type="text" id="tEnd" style="width:40px" /></div>');$(a.tNameMode).after('&nbsp;<span id="tFile"></span>');$(a.tFolder).parent().after('<div><label for="tChannels">'+epgd.tr.channel+'</label><input id="tChannel" type="text" class="full"/></div>');$(this.form.tStart).datetimepicker({minDateTime:epgd.utils.now()});$(this.form.tEnd).timepicker({});epgd.utils.addAutoComplete(a.tChannel,{source:epgd.channels.autoCompleteData});a.tFile=$(a).find("#tFile")[0];a.tEvTime=$(a).find("#tEvTime")[0];a.tTitle=$(a).find("#tTitle").click(function(){if(a.tEvID.value){epgd.utils.loader.process(function(){new epgd.eventDetail(a.tEvID.value).render()})}})[0]};epgd.timerDialog.prototype.render=function(a){a=a||{};epgd.timerDialog.base.render.call(this,a);var b=this.form,c;b.tFile.innerHTML=a.file||"...";b.tEvID.value=a.eventid||"";epgd.utils.setAutoCompleteValues(b.tChannel,a.channelid?[a.channelid]:null);b.tTitle.innerHTML=a.title||"";b.tEvTime.innerHTML=a.evStartTime?epgd.utils.formatDateTime(a.evStartTime)+" - "+epgd.utils.formatTime(a.evStartTime+a.evDuration):"";$([b.tStart,b.tEnd]).datetimepicker("option","disabled",!!a.eventid);if(a.day||!a.evStartTime){if(a.starttime){c=epgd.utils.date((a.day+parseInt(a.starttime/100,10)*60*60+(a.starttime%100)*60))}else{if(a.day){c=epgd.utils.date(a.day)}else{c=epgd.utils.now()}}$(b.tStart).datetimepicker("setDate",c);$(b.tStart).datetimepicker("setTime",c);if(a.endtime){c=epgd.utils.date((a.day+parseInt(a.endtime/100,10)*60*60+(a.endtime%100)*60))}else{c=new Date(c.getTime()+2*60*60000)}$(b.tEnd).datetimepicker("setTime",c)}else{$([b.tStart,b.tEnd]).val("...")}b.tNameMode.selectedIndex=typeof a.namingmode=="undefined"?parseInt(a.category=="Serie"?epgd.profile.namingModeSerie:epgd.profile.namingModeMovie,10):a.namingmode;b.tTemplate.value=a.template||(a.category=="Serie"?epgd.profile.namingModeSerieTemplate:epgd.profile.namingModeMovieTemplate);$(b.tNameMode).change()};epgd.timerDialog.prototype.getData=function(g){var b=this.form,e,a,c={};if(b.tEvID.value){c.eventid=parseInt(b.tEvID.value,10)}c.active=b.tInactive.checked?0:1;if(b.tID.value){c.id=parseInt(b.tID.value,10)}if(b.tStart.value&&b.tStart.value!="..."){e=$(b.tStart).datepicker("getDate");c.starttime=e.getHours()*100+e.getMinutes();e.setHours(0);e.setMinutes(0);c.day=parseInt(e.getTime()/1000,10);c.endtime=parseInt(b.tEnd.value.replace(":",""),10)}else{if(!c.eventid&&!g){return this.showError(epgd.tr.error.emptyField.replace("$field$",epgd.tr.pages.timerList.recordTime),b.tStart)}}c.weekdays=0;for(a=0,f=1;a<b.tWeek.length;a++,f*=2){if(b.tWeek[a].checked){c.weekdays+=f}}c.vps=b.tVPS.checked?1:0;if(b.tPrio.value){c.priority=parseInt(b.tPrio.value,10)}if(b.tLife.value){c.lifetime=parseInt(b.tLife.value,10)}c.channelid=epgd.utils.getAutoCompleteValues(b.tChannel);if(!c.channelid&&!g){return this.showError(epgd.tr.error.emptyField.replace("$field$",epgd.tr.channel),b.tChannel)}c.type=$(b.tType).val();e=$(b.tVdr).val();if(!e&&c.type=="V"){e=epgd.vdrs.current.uuid||""}if(e){c.vdruuid=e}c.namingmode=b.tNameMode.selectedIndex;c.template=b.tTemplate.value;if(c.type=="V"&&!e&&!g){return this.showError(epgd.tr.error.emptyField.replace("$field$","VDR"),b.tVdr)}c.directory=b.tFolder.value;c.title=b.tTitle.innerHTML||"";c.name=b.tSName.value;return c};epgd.searchTimerDialog=epgd.utils.inherits(function(a){this.searchResultList=null;epgd.timerDialogBase.call(this,$.extend({},{id:"searchTimerDialog",width:530,title:epgd.tr.pages.timer.searchTimerList+" "+epgd.tr.edit,buttons:[{text:epgd.tr.pages.timer.timerList,icons:{primary:"ui-icon-transferthick-e-w"},id:"tBToggle",click:function(){var b=this.list.dialog.getData(true);if(b){$(this).dialog("close");b.channelids&&(b.channelid=b.channelids.split(",")[0]);b.expression&&(b.title=b.expression);epgd.pages.timerList.dialog.render(b)}}},{text:epgd.tr.test,click:function(){this.list.dialog.search()}}].concat(epgd.searchTimerDialog.base.options.buttons,{text:epgd.tr.copy,icons:{primary:"ui-icon-copy"},id:"tBCopy",click:function(b){$(b.currentTarget).hide();this.list.dialog.form.tID.value="";this.list.dialog.form.tSName.value+=" copy";this.list.dialog.form.tSName.select()}})},a))},epgd.timerDialogBase);epgd.searchTimerDialog.prototype.search=function(a,b){if(!this.searchResultList){this.searchResultList=new epgd.searchResultList(null)}if(!this.searchResultList.$con||(a&&a[0]!=this.searchResultList.$con[0])){this.searchResultList.render(a||($('<div style="border-top:1px solid #ccc"></div>').insertAfter(this.form)))}else{this.searchResultList.$con.find("tbody").empty()}if(!this.searchResultList.$con.parent().length){this.searchResultList.$con.insertAfter(this.form);this.searchResultList.init()}this.searchResultList.update(b||this.getData());this.searchResultList.$con[0].scrollIntoView(true)};epgd.searchTimerDialog.prototype.create=function(){epgd.searchTimerDialog.base.create.call(this);var c=epgd.tr.pages.timerList,e=epgd.tr.pages.search,d="",b=this.form,a;for(a in e.searchModes){d+='<option value="'+(parseInt(a,10)+1)+'">'+e.searchModes[a]+"</option>"}if(!epgd.categories){epgd.categories=[];epgd.ajax({url:"data/categories",async:false},function(g){epgd.categories=g.categories})}if(!epgd.genres){epgd.genres=[];epgd.ajax({url:"data/genres",async:false},function(g){epgd.genres=g.genres})}$(b.tSName).parent().parent().after('<div><label for="tExpr">'+e.searchExpression+epgd.pages.help.getIcon("sExpr")+'</label> <input type="text" id="tExpr" style="width:300px" /></div><div class="full"><select id="tSMode" style="width:auto">'+d+'</select>&nbsp;&nbsp;<input type="checkbox" id="tCaseSens" />&nbsp;<label for="tCaseSens">'+e.caseSensitive+'</label></div><div class="ui-corner-all week">'+[""].concat(e.searchFields).join('<input type="checkbox" name="tSFields" />')+'</div><div><label for="tAdv"><input type="checkbox" id="tAdv" />&nbsp;'+epgd.tr.advanced+epgd.pages.help.getIcon("sTAdv")+'</label><div class="ui-corner-all week"><span>'+c.episode+'</span><input type="text" id="tSFEpisode" style="width:200px" /> <span>'+epgd.tr.pages.eventDetail.season+'</span><input type="text" id="tSFSeason" style="width:40px" /> <span>'+epgd.tr.pages.eventDetail.part+'</span><input type="text" id="tSFSPart" style="width:40px" /> <br /><span>'+epgd.tr.pages.eventDetail.category+'</span><input type="text" id="tSFCat" style="width:300px" /> <br /><span>'+epgd.tr.pages.eventDetail.genre+'</span><input type="text" id="tSFGenre" style="width:300px" /> <br /><input type="checkbox" name="tSFTip" value="GoldTipp" />GoldTipp<input type="checkbox" name="tSFTip" value="TagesTipp" />TagesTipp<input type="checkbox" name="tSFTip" value="TopTipp" />TopTipp<br /><span>'+epgd.tr.pages.eventDetail.year+'</span><input type="text" id="tSFYear" style="width:70px" /><br /><input type="checkbox" id="tSFNoEpgMatch" />'+c.noEpgMatch+'</div></div><div class="noTypeS"><div><label for="tRepeat"><input type="checkbox" id="tRepeat" />&nbsp;'+c.noRepeat+epgd.pages.help.getIcon("sTRepeat")+'</label><div class="ui-corner-all week">'+[""].concat(e.searchFields).join('<input type="checkbox" name="tRFields" />')+'</div></div></div><div><input type="radio" name="tChExclude" value="1" id="tChExclude0" /><label for="tChInclude">'+c.chInclude+"</label>"+epgd.pages.help.getIcon("sTChannels")+'<input type="radio" name="tChExclude" value="0" id="tChExclude1" /><label for="tChExclude">'+c.chExclude+'</label></div><input type="text" id="tChannels" class="full"/><div class="noTypeS"><label for="tChFormat">'+c.chFormat+epgd.pages.help.getIcon("sTChFormat")+'</label><input id="tChFormat" readonly onclick="epgd.timerEditChFormat(this)" /></div><div><label for="tTime"><input type="checkbox" id="tTime" />&nbsp;'+epgd.tr.dateTimePicker.timeText+epgd.pages.help.getIcon("sTime")+"</label></div>");$(b.tWeek[0]).before("<span>"+epgd.tr.dateTimePicker.timeTextBetween+' <input type="text" id="tStart" style="width:40px" /> - <input type="text" id="tEnd" style="width:40px" /></span>').parent().append('<br /><span class="onlyTypeS">'+c.nextDays.replace("$field$",'<input style="width:40px" type="text" id="tNextDays" />')+"</span>").insertAfter(b.tTime.parentNode);$([b.tStart,b.tEnd]).timepicker({alwaysSetTime:false});$([b.tTime,b.tRepeat,b.tAdv]).change(function(){$(this).parent().next().toggle(this.checked)});$([b.tSFSeason,b.tSFSPart,b.tSFYear]).change(function(){this.value=this.value.replace(/[^0-9-]/g,"");if(this.value.length==1&&this.value=="-"){this.value=""}});$(b.tType).append('<option value="S">'+epgd.tr.menu.search+"</option>");epgd.utils.addAutoComplete(b.tChannels,{source:epgd.channels.autoCompleteData,multiselect:true});epgd.utils.addAutoComplete(b.tSFCat,{source:epgd.categories,multiselect:true});epgd.utils.addAutoComplete(b.tSFGenre,{source:epgd.genres,multiselect:true})};epgd.searchTimerDialog.prototype.render=function(b){b=b||{searchfields:1};epgd.searchTimerDialog.base.render.call(this,b);var c=this.form,e,a;c.tExpr.value=b.expression||"";$(c.tSMode).val(b.searchmode||4);c.tCaseSens.checked=b.casesensitiv==1;e=b.searchfields||0;for(a=0,f=1;a<c.tSFields.length;a++,f*=2){c.tSFields[a].checked=(e&f)}if(b.starttime||b.endtime||b.weekdays||b.nextdays){c.tTime.checked=true;b.starttime?$(c.tStart).datetimepicker("setTime",new Date(0,0,0,parseInt(b.starttime/100,10),(b.starttime%100))):c.tStart.value="";b.endtime?$(c.tEnd).datetimepicker("setTime",new Date(0,0,0,parseInt(b.endtime/100,10),(b.endtime%100))):c.tEnd.value;c.tNextDays.value=b.nextdays||""}else{c.tTime.checked=false}$(c.tTime).change();e=b.repeatfields||0;for(a=0,f=1;a<c.tRFields.length;a++,f*=2){c.tRFields[a].checked=(e&f)}c.tRepeat.checked=e>0;$(c.tRepeat).change();c.tSFEpisode.value=b.episodename||"";c.tSFSeason.value=b.season||"";c.tSFSPart.value=b.seasonpart||"";c.tSFYear.value=b.year||"";epgd.utils.setAutoCompleteValues(c.tSFCat,new String(b.category).replace(/'/g,"").split(","));epgd.utils.setAutoCompleteValues(c.tSFGenre,new String(b.genre).replace(/'/g,"").split(","));e=b.tipp||"";for(a=0;a<c.tSFTip.length;a++){c.tSFTip[a].checked=e.indexOf("'"+c.tSFTip[a].value+"'")>=0}c.tSFNoEpgMatch.checked=b.noepgmatch==1;c.tAdv.checked=b.episodename||b.season||b.seasonpart||b.year||b.category||b.genre||b.tipp||b.noepgmatch;$(c.tAdv).change();epgd.utils.setAutoCompleteValues(c.tChannels,new String(b.channelids).split(","));if(b.chexclude){c.tChExclude1.checked=1}else{c.tChExclude0.checked=1}c.tChFormat.value=b.chformat||(b.id?"":epgd.profile.chFormat);c.tNameMode.defaultIndex=parseInt(b.category=="Serie"?epgd.profile.namingModeSearchSerie:epgd.profile.namingModeSearchMovie,10);c.tNameMode.selectedIndex=typeof b.namingmode=="undefined"?c.tNameMode.defaultIndex:b.namingmode;c.tTemplate.value=typeof b.template=="undefined"?(b.category=="Serie"?epgd.profile.namingModeSearchSerieTemplate:epgd.profile.namingModeSearchMovieTemplate):b.template;$(c.tNameMode).change();this.$win.parent().find("#tBCopy").toggle(!!b.id)};epgd.searchTimerDialog.prototype.getData=function(g){var b=this.form,e,a,c={expression:b.tExpr.value};if(b.tSFSeason.value){c.season=b.tSFSeason.value}if(b.tSFSPart.value){c.seasonpart=b.tSFSPart.value}if(b.tSFYear.value){c.year=b.tSFYear.value}if(!g){if(!c.expression){return this.showError(epgd.tr.error.emptyField.replace("$field$",epgd.tr.pages.search.searchExpression),b.tExpr)}if(c.season&&!/^[0-9]{0,3}-?[0-9]{0,3}$/.test(c.season)){return this.showError(epgd.tr.error.invalid,b.tSFSeason)}if(c.seasonpart&&!/^[0-9]{0,3}-?[0-9]{0,3}$/.test(c.seasonpart)){return this.showError(epgd.tr.error.invalid,b.tSFSPart)}if(c.year&&!/^((19|20)[0-9]{2})?(-|-(19|20)[0-9]{2})?$/.test(c.year)){return this.showError(epgd.tr.error.invalid,b.tSFYear)}}if(b.tID.value){c.id=parseInt(b.tID.value,10)}if(b.tSFEpisode.value){c.episodename=b.tSFEpisode.value}c.category=epgd.utils.getAutoCompleteValues(b.tSFCat,"'");c.genre=epgd.utils.getAutoCompleteValues(b.tSFGenre,"'");e="";for(a=0;a<b.tSFTip.length;a++){if(b.tSFTip[a].checked){e+=",'"+b.tSFTip[a].value+"'"}}c.tipp=e.slice(1);c.noepgmatch=b.tSFNoEpgMatch.checked?1:0;c.searchmode=parseInt($(b.tSMode).val(),10);c.searchfields=0;for(a=0,f=1;a<b.tSFields.length;a++,f*=2){if(b.tSFields[a].checked){c.searchfields+=f}}c.casesensitiv=b.tCaseSens.checked?1:0;c.repeatfields=0;if(b.tRepeat.checked){for(a=0,f=1;a<b.tRFields.length;a++,f*=2){if(b.tRFields[a].checked){c.repeatfields+=f}}}c.active=b.tInactive.checked?0:1;c.channelids=epgd.utils.getAutoCompleteValues(b.tChannels);c.chformat=b.tChFormat.value;c.chexclude=b.tChExclude1.checked?1:0;if(b.tTime.checked){c.starttime=parseInt(b.tStart.value.replace(":",""),10);c.endtime=parseInt(b.tEnd.value.replace(":",""),10);c.weekdays=0;for(a=0,f=1;a<b.tWeek.length;a++,f*=2){if(b.tWeek[a].checked){c.weekdays+=f}}}c.vps=b.tVPS.checked?1:0;if(b.tPrio.value){c.priority=parseInt(b.tPrio.value,10)}if(b.tLife.value){c.lifetime=parseInt(b.tLife.value,10)}c.directory=b.tFolder.value;e=$(b.tVdr).val();if(e){c.vdruuid=e}c.namingmode=b.tNameMode.selectedIndex;c.template=b.tTemplate.value;c.type=$(b.tType).val();if(c.type=="V"&&!e&&!g){return this.showError(epgd.tr.error.emptyField.replace("$field$","VDR"),b.tVdr)}c.name=b.tSName.value;if(b.tNextDays.value){c.nextdays=parseInt(b.tNextDays.value,10)}return c};epgd.searchTimerDialog.prototype.save=function(h,e,c,g){h=h||this.getData();var a=this,i=h.id,b=h.name;h.max=0;h.id&&delete h.id;h.name&&delete h.name;epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/search",type:"post",data:JSON.stringify(h)},function(d){h.id=i;h.name=b;if(d.count>50){epgd.utils.confirm(epgd.tr.pages.timerList.confirmSaveBigResult.replace("$cnt$",d.count),function(k){k&&epgd.searchTimerDialog.base.save.call(a,h)})}else{epgd.searchTimerDialog.base.save.call(a,h,e,c,g)}epgd.utils.loader.close()})},true)};epgd.searchDialog=epgd.utils.inherits(function(){epgd.searchTimerDialog.call(this,{id:"search",embed:true,buttons:null});this.searchResultList=new epgd.searchResultList({empty:epgd.tr.pages.search.empty},this)},epgd.searchTimerDialog);epgd.searchDialog.prototype.create=function(){epgd.searchDialog.base.create.call(this);var c=this.form,b=this,a=$('<div id="searchResult"></div>').appendTo(this.$win);$('<button type="submit" id="sSearch" class="iAsButton i-search">'+epgd.tr.pages.search.search+"</button>").insertAfter(c.tExpr).after(' <input type="checkbox" id="sAdv" />&nbsp;<label for="sAdv">'+epgd.tr.advanced+"</label>");$(c.tType).parent().hide().parent().css("border-top","1px solid #ccc").insertAfter($(c.tVdr.parentNode.parentNode).hide());$('<input type="button" class="iAsButton" id="tCopy" value="'+epgd.tr.copy+'" />').insertAfter(c.tSName).click(function(){b.form.tID.value="";b.form.tSName.value+=" copy";b.form.tSName.select()}).prop("disabled",true);$('<input type="button" class="iAsButton" id="tDel" value="'+epgd.tr.del+'" />').insertAfter(c.tSName).click(function(){b.list.del(this.form.tID.value,function(){b.form.tID.value="";b.loadSavedSearch()})}).prop("disabled",true);$('<input type="button" class="iAsButton" value="'+epgd.tr.save+'" />').insertAfter(c.tSName).click(function(){var e=b.getData();if(!e.name){return this.showError(epgd.tr.error.invalid,c.tSName)}b.save(e,null,null,function(){b.loadSavedSearch()})});$(c).submit(function(){b.search(a);return false});this.$win.find("#sExpr").keyup(function(d){if(d.keyCode==13){this.form.sSearch.click();$(this).blur()}}).focus();this.$win.find("#sAdv").change(function(){$(c).toggleClass("noAdv",!this.checked);b.resize()}).prop("checked",epgd.profile.searchAdv=="1").change();$(c.tSName).autocomplete({minLength:0,maxHeight:300,source:function(){return false},select:function(e,g){var h=g.item.data||{id:""};if(h.id){b.render(h);b.form.sSearch.click();$([c.tDel,c.tCopy,c.tInactive]).prop("disabled",false);return false}else{c.tID.value="";$([c.tDel,c.tCopy,c.tInactive]).prop("disabled",true)}}}).focus(function(){$(this).autocomplete("search","")});this.loadSavedSearch()};epgd.searchDialog.prototype.loadSavedSearch=function(){var a=this.form;epgd.ajax({url:epgd.login.url+"data/searchtimers?type=S"},function(c){var b=[];$.each(c.searchtimers,function(e,d){b.push({value:d.name||d.expression,label:d.name||d.expression,data:d})});$(a.tSName).autocomplete("option","source",b)})};epgd.searchDialog.prototype.resize=function(){var a=this.$win.find("#searchResult"),b=$(window).height()-a.offset().top-20;if(b<100){a.css({height:"auto","overflow-y":"visible"})}else{a.css({height:b+"px","overflow-y":"auto"})}};epgd.searchDialog.prototype.render=function(a){if(!epgd.$con.find("#search").length){$("#menu_search").addClass("menu-active");this.create();epgd.$con.html("");this.$win.appendTo(epgd.$con)}a=a||{searchfields:1};a.type="S";epgd.searchDialog.base.render.call(this,a)};epgd.searchDialog.prototype.close=function(){};epgd.channels={list:null,autoCompleteData:null,isDirty:false,selBox:$('<select id="selChannel"></select>')[0],load:function(){if(!this.list||this.isDirty){epgd.ajax({url:epgd.login.url+"data/channels",async:false,cache:false},function(d){var b=(epgd.profile.channelLogoPath?epgd.profile.channelLogoPath+"?maxW=70&maxH=50&id=":false),e="",c={},a=[];d.channels&&$.each(d.channels,function(g,h){var k=h.channelid||g;if(h.name){h.html='<div class="channel" id="'+k+'">'+(b?'<img src="'+b+k+'" alt="'+h.name+'" /><i class="i-tv" title="'+epgd.tr.pages.eventDetail.ch_switch+'" />'+(epgd.profile.logoShowName=="1"?h.name:""):h.name)+"</div>";h.visible&1&&(e+='<option value="'+k+'">'+h.name+"</option>")}else{h.html='<div class="channel" id="'+k+'"><i class="i-tv" title="'+epgd.tr.pages.eventDetail.ch_switch+'" />'+k+"</div>";h.visible&1&&(e+='<option value="'+k+'">'+k+"</option>")}c[k]=h;a.push({label:h.name,value:k})});epgd.channels.list=c;epgd.channels.autoCompleteData=a;$(epgd.channels.selBox).html(e);$(window).trigger("channels_load");this.dirty=false})}},getHtml:function(b){var a=this.list[b];return a?a.html:'<div class="channel" id="'+b+'"><i class="i-tv" title="'+epgd.tr.pages.eventDetail.ch_switch+'" />'+b+"</div>"},getName:function(b){var a=this.list[b];return a?a.name:b}};epgd.eventDetail=function(a){this.id=a;this.data=null;this.expire=0};epgd.eventDetail.prototype.imgPath=false;epgd.eventDetail.prototype.load=function(b,c){var a=this;epgd.ajax({url:epgd.login.url+"data/event?"+(b&&c?"channelid="+b+"&time="+c:"id="+this.id),async:false,cache:false},function(d){a.data=d.event;a.id=d.id;a.expire=epgd.utils.now().getTime()+900000});return this};epgd.eventDetail.prototype.render=function(){if(this.expire<epgd.utils.now().getTime()){this.load()}if(!this.data){return""}this.win.render(this)};epgd.eventDetail.prototype.doRecord=function(a){if(a===true){return epgd.tr.pages.eventDetail.record}a=a||this.data;var b={id:a.timerid,eventid:a.id,channelid:a.channelid,title:a.title,evStartTime:a.starttime,evDuration:a.duration,category:a.category,shorttext:a.shorttext,expression:a.title};if(b.eventid){epgd.pages.timerList.dialog.render(b)}else{epgd.pages.searchTimerList.dialog.render(b)}};epgd.eventDetail.prototype.doRepeat=function(c){if(c){return true}var d=this.win,a=d.$con.find(".repeat"),b;if(!a.length){if(!this.searchResultList){this.searchResultList=new epgd.searchResultList(null,{resize:function(){d.$con.last().find('td[data-evId="'+d.detail.data.id+'"]').parent().remove();d.$con.accordion("refresh");a.click()}})}a=$('<h3 class="repeat">'+epgd.tr.pages.eventDetail.repeat+"</h3>").appendTo(d.$con);b={searchfields:1,expression:this.data.title,searchmode:1,casesensitiv:1,fromEventDetail:true};if(this.data.shorttext){b.searchfields1=2;b.expression1=this.data.shorttext}epgd.pages.search.search.call(this,$('<div class="desc"></div>').appendTo(d.$con),b)}else{a.click()}};epgd.eventDetail.prototype.doPlay=function(b){var a=parseInt(epgd.utils.now().getTime()/1000,10)-this.data.starttime;if(a>this.data.duration){return false}if(b){return !epgd.vdrs.current.uuid?false:(a<0?epgd.tr.pages.timerList.newTimer+": ":"")+epgd.tr.pages.eventDetail.ch_switch}if(a<0){a=this.win.$rec;epgd.pages.timerList.save({type:"V",active:1,vdruuid:epgd.vdrs.current.uuid,eventid:this.data.id,channelid:this.data.channelid,title:this.data.title},null,null,function(){a.addClass("hasTimer")})}else{epgd.vdrs.current.switchChannel(this.data.channelid)}};epgd.eventDetail.prototype.doPrev=function(c){var b=this.data.starttime-500,a=this;if(b<epgd.profile.minEventTime){return false}if(c){return true}epgd.utils.loader.process(function(){new epgd.eventDetail().load(a.data.channelid,b).render()})};epgd.eventDetail.prototype.doNext=function(c){var b=this.data.starttime+this.data.duration+500,a=this;if(b>epgd.profile.maxEventTime){return false}if(c){return true}epgd.utils.loader.process(function(){new epgd.eventDetail().load(a.data.channelid,b).render()})};epgd.eventDetail.win=function(){this._create();this.closed=true;this.detail=null;var a=this;$(window).bind("epgd_close.eventDetail",function(){if(!a.closed){a.$win.css("z-Index","");a.$win.hide();$(document).unbind("keyup.eventDetail");a.closed=true;a.$openDialogs&&a.$openDialogs.removeClass("ui-state-disabled")}});$(window).bind("resize.eventDetail",function(b){if(!a.closed){try{a.$win.css("max-width",$(window).width());a.$win.show().position({of:window});a.$con.accordion("refresh")}catch(c){}if(parseInt(a.$win.css("top"),10)<69){a.$win.css("top","69px")}}})};epgd.eventDetail.win.prototype._create=function(){this.imgPath=epgd.profile.eventImgPath?epgd.profile.eventImgPath+"?no=0&maxW=270&maxH=146&id=":false;this.movieImgPath=epgd.profile.movieMediaPath?epgd.profile.movieMediaPath+"?actor_id=0&movie_id=":false;this.movieActorImgPath=epgd.profile.movieMediaPath?epgd.profile.movieMediaPath+"?maxW=60&maxH=90&media_type=4&actor_id=":false;this.serieImgPath=epgd.profile.serieImgPath?epgd.profile.serieImgPath+"?actor_id=0&series_id=":false;this.serieActorImgPath=epgd.profile.serieImgPath?epgd.profile.serieImgPath+"?maxW=60&maxH=90&season_number=0&episode_id=0&media_type=11&actor_id=":false;this.$win=$('<div id="eventDetail" class="ui-front"><div class="ui-front ui-widget ui-widget-content ui-corner-all" style="position:absolute;width:100%;height:100%"><div class="toolbar ui-widget-header ui-corner-all"></div><div></div></div><div class="ui-widget ui-widget-shadow ui-corner-all" style="position:absolute;width:100%;height:100%"></div></div>').appendTo(document.body);this.$con=this.$win.find(":first :last");var c=this,b=epgd.tr.pages.eventDetail,a=this.$win.find(".toolbar")[0];this.$rec=$('<button class="iAsButton i-record"/>').css("float","left").appendTo(a).click(function(){c.detail.doRecord()});$('<button class="iAsButton i-buffer" title="'+b.repeat+'" />').css("float","left").appendTo(a).click(function(){c.detail.doRepeat()});this.$play=$('<button class="iAsButton i-tv" />').css("float","left").appendTo(a).click(function(){c.detail.doPlay()});this.$prev=$('<button class="iAsButton i-rewind" title="'+b.eventPrev+'" />').appendTo(a).click(function(){c.detail.doPrev()});this.$next=$('<button class="iAsButton i-forward" title="'+b.eventNext+'" />').appendTo(a).click(function(){c.detail.doNext()});$('<button class="iAsButton i-cancel" title="'+epgd.tr.close+'" />').css("float","right").appendTo(a).click(function(){$(window).trigger("epgd_close.eventDetail")})};epgd.eventDetail.win.prototype.render=function(v){this.detail=v;var t=v.data,b=epgd.tr.pages.eventDetail,g=((parseInt(epgd.utils.now().getTime()/1000,10)-t.starttime)/t.duration*100),d="",x=t.episode||{},s=t.longdescription?'<div title="longdescription">'+t.longdescription+"</div>":"",u="",w=null,p=(this.imgPath&&t.imagecount?this.imgPath+t.id:""),o=null,m=x.episodename||t.title,n=$(window).width()<500,l,q,a,c,k,h,r="";if(t.cntlongdescription){s+='<hr><div title="cntlongdescription">'+t.cntlongdescription+"</div>"}if(t.rating){l=t.rating.slice(t.rating.indexOf("/")).split(" ");for(q=1;q<l.length;q+=3){d+=l[q]+'<div class="stars'+l[q+1].length+'"> </div>'}}u="";for(q in b.extInfo){if(t[q]){u+="<tr><th>"+b.extInfo[q]+"</th><td>"+t[q]+"</td></tr>"}}if(t.scraper&&(a=t.scraper.movie||t.scraper.serie)){a.media=a.media||[];if(a.actors){w="";for(q in a.actors){c=a.actors[q];w+="<div>"+(this.movieActorImgPath&&c.actorid?'<img src="'+this.movieActorImgPath+c.actorid+'" />':"")+'<a href="'+epgd.profile.movieActorPath+c.actorid+'" target="_blank">'+c.actorname+"</a>"+(c.actorrole||"")+"</div>"}}if(t.scraper.movie){a.isMovie=true;if(a.media&&this.movieImgPath){if(!p&&a.media["1"]){p=this.movieImgPath+a.movieid+"&media_type=1&maxW=270&maxH=146"}if(a.media["3"]){o=this.movieImgPath+a.movieid+"&media_type=3&maxW=400&maxH=999"}else{if(a.media["1"]){o=this.movieImgPath+a.movieid+"&media_type=1&maxW=400&maxH=999"}}}if(a.actors){w="";for(q in a.actors){c=a.actors[q];w+="<div>"+(this.movieActorImgPath?'<img src="'+this.movieActorImgPath+q+'" />':"")+'<a href="'+epgd.profile.movieActorPath+q+'" target="_blank">'+c.actorname+"</a>"+(c.actorrole||"")+"</div>"}}if(a.overview){s='<div title="overview">'+a.overview+"</div><hr />"+s}u="<h3><span>"+b.scrapperMovieInfo+'</span></h3><div><table class="colFull">'+(a.media["1"]&&this.movieImgPath?'<tr><th colspan="2"><img src="'+this.movieImgPath+a.movieid+'&media_type=1&maxW=397&maxH=400" /></th></tr>':"")+(a.title?"<tr><th>"+b.title+"</th><td>"+a.title+"</td></tr>":"")+(a.originaltitle?"<tr><th>"+b.original_title+"</th><td>"+a.originaltitle+"</td></tr>":"")+(a.runtime?"<tr><th>"+b.runtime+"</th><td>"+a.runtime+" "+epgd.tr.minutes+"</td></tr>":"")+(a.movie_release_date?"<tr><th>"+b.release_date+"</th><td>"+a.movie_release_date+"</td></tr>":"")+(a.genres?"<tr><th>"+b.genre+"</th><td>"+a.genres.replace(/^\||\|$/g,"").replace(/ ?\| ?/g,", ")+"</td></tr>":"")+(a.voteaverage?"<tr><th>"+b.vote_average+'</th><td class="stars"><div class="stars5" style="width:'+parseInt(a.voteaverage*8,10)+'px"></div> ('+a.voteaverage.toFixed(1)+" / 10)</td></tr>":"")+(a.popularity?"<tr><th>"+b.popularity+"</th><td>"+a.popularity.toFixed(1)+"</td></tr>":"")+u+(a.budget?"<tr><th>Budget</th><td>$"+a.budget+"</td></tr>":"")+(a.revenue?"<tr><th>Einnahmen</th><td>$"+a.revenue+"</td></tr>":"")+(a.homepage?"<tr><th>"+b.homepage+'</th><td><a href="'+a.homepage+'">'+a.homepage+"</a></td></tr>":"")+"</table>"+(a.media["0"]&&this.movieImgPath?'<img class="poster" src="'+this.movieImgPath+a.movieid+'&media_type=0&maxW=390&maxh=999" />':"")}else{a.isSerie=true;if(a.actors){w="";for(q in a.actors){c=a.actors[q];w+="<div>"+(this.serieActorImgPath?'<img src="'+this.serieActorImgPath+q+"&series_id="+a.seriesid+'" />':"")+"<a>"+c.actorname+"</a>"+(c.actorrole?c.actorrole.replace(/\|/g,"<br />"):"")+"</div>"}}l=a.episode;if(l){if(l.episodeoverview){if(t.longdescription&&l.episodeoverview.length>t.longdescription.length){s=s.replace(/^<div.+<\/div>/i,"")}s='<div title="episodeoverview">'+l.episodeoverview+"</div>"+s}s="<h5>"+l.episodename+"</h5>"+s;if(l.episodegueststars){w+='</div><div class="colFull actors"><h5>'+b.gueststars+"</h5><br />"+l.episodegueststars.replace(/^\||\|$/g,"").replace(/\|/g,"<br />")}}if(!p&&a.media["10"]&&this.serieImgPath){p=this.serieImgPath+a.seriesid+"&season_number="+l.seasonnumber+"&episode_id="+l.episodeid+"&media_type=10&maxW=270&maxH=146"}if(a.media["7"]){o=this.serieImgPath+a.seriesid+"&season_number=0&episode_id=0&media_type=7&maxW=400&maxh=999"}if(a.seriesoverview){s+=s?'<hr /><a href="#" onclick="return !$(this).next().toggle()">Serienbeschreibung</a><div style="display:none" title="seriesoverview">'+a.seriesoverview+"</div>":"<div>"+a.seriesoverview+"</div>"}u="<h3><span>"+b.scrapperSerieInfo+'</span></h3><div><table class="colFull">'+(a.media["1"]&&this.serieImgPath?'<tr><th colspan="2"><img src="'+this.serieImgPath+a.seriesid+'&season_number=0&episode_id=0&media_type=1&maxW=397&maxH=250" /></th></tr>':"")+(a.media["10"]&&this.serieImgPath?'<tr><th colspan="2"><img src="'+this.serieImgPath+a.seriesid+"&season_number="+l.seasonnumber+"&episode_id="+l.episodeid+'&media_type=10&maxW=397&maxH=400" /></th></tr>':"")+(a.seriesname?"<tr><th>"+b.title+"</th><td>"+a.seriesname+"</td></tr>":"")+(a.seriesnetwork?"<tr><th>"+b.network+"</th><td>"+a.seriesnetwork+"</td></tr>":"")+(a.seriesstatus?"<tr><th>"+b.seriesstatus+"</th><td>"+a.seriesstatus+"</td></tr>":"")+(a.seriesfirstaired?"<tr><th>"+b.release_date+"</th><td>"+a.seriesfirstaired+"</td></tr>":"")+(a.seriesgenre?"<tr><th>"+b.genre+"</th><td>"+a.seriesgenre.replace(/^\||\|$/g,"").replace(/ ?\| ?/g,", ")+"</td></tr>":"")+(a.seriesrating?"<tr><th>"+b.vote_average+'</th><td class="stars"><div class="stars5" style="width:'+parseInt(a.seriesrating*8,10)+'px"></div> ('+a.seriesrating.toFixed(1)+" / 10)</td></tr>":"")+u+(epgd.profile.serieSeasonPath?'<tr><td colspan="2"><a href="'+epgd.profile.serieSeasonPath+a.seriesid+'" target="_blank">'+b.homepage+"</a></td></tr>":"")+"</table>"+(a.media["6"]&&this.serieImgPath?'<img class="poster" src="'+this.serieImgPath+a.seriesid+"&season_number="+l.seasonnumber+'&episode_id=0&media_type=6&maxW=390&maxh=999" />':"")+(a.media["3"]&&this.serieImgPath?'<img class="poster" src="'+this.serieImgPath+a.seriesid+'&season_number=0&episode_id=0&media_type=3&maxW=390&maxh=999" />':"")}}else{a={};u="<h3><span>"+b.extentedInfo+'</span></h3><div><table class="colFull"><tr><th>'+b.title+"</th><td>"+t.title+"</td></tr>"+(x.partname?"<tr><th>"+b.part+"</th><td>"+x.partname+"</td></tr>":"")+(t.year?"<tr><th>"+b.release_date+"</th><td>"+t.year+"</td></tr>":"")+(x.lang?"<tr><th>"+b.lang+"</th><td>"+x.lang+"</td></tr>":"")+u+"</table>"}if(!w&&t.actor){w=t.actor.replace(/, /g,"<br />")}w&&(u+='<div class="colFull actors"><h5>'+b.actors+"</h5>"+w+"</div>");u&&(u+="</div>");k=(t.path?epgd.tr.pages.timerList.folder+"<br />"+t.path.replace(/\//g," / ")+"<br />":"")+(t.genre?(b.genre+"<b>"+t.genre+"</b><br />"):"")+(t.category?b.category+"<b>"+t.category+"</b><br />":"")+(t.country?b.country+"<b>"+t.country+"</b><br />":"")+(t.year?b.year+"<b>"+t.year+"</b><br />":"");h=(x.part?b.part+"<b>"+x.part+(x.parts?" / "+x.parts+"":"")+"</b><br />":"")+(x.season?b.season+"<b>"+x.season+"</b><br />":"")+(x.number?b.number+"<b>"+x.number+"</b><br />":"")+(x.extracol1?x.extracol1+"<br />":"")+(x.extracol2?x.extracol2+"<br />":"")+(x.extracol3?x.extracol3+"<br />":"");if(t.recordings){for(q in t.recordings){l=t.recordings[q];r+='<div class="rec" data-start="'+l.starttime+'" data-owner="'+(l.owner||"")+'" data-md5="'+l.md5path+'" data-path="'+l.path+'"><em>'+epgd.utils.formatDateTime(l.starttime)+"</em><u>"+parseInt(l.duration/60,10)+" "+epgd.tr.minutes+'</u><b onclick="new epgd.recordDetail(this.parentNode).render()"><div class="progress" title="'+l.matchdensitytitle+"% "+epgd.tr.pages.search.matchdensity+'"><div style="width:'+l.matchdensitytitle+'%" ></div></div>'+l.title+(l.shorttext?'<i><div class="progress" title="'+l.matchdensityshorttext+"% "+epgd.tr.pages.search.matchdensity+'"><div style="width:'+l.matchdensityshorttext+'%" ></div></div>'+l.shorttext+"</i>":"")+"</b></div>"}}this.$con=$('<div><h3><div class="date">'+$.datepicker.formatDate(n?"d. M y":"d. MM yy",epgd.utils.date(t.starttime))+"</div>"+(n?"":t.title)+'<div class="time"><b>'+epgd.utils.formatTime(t.starttime)+"</b>&nbsp;&ndash;&nbsp;"+epgd.utils.formatTime(t.starttime+t.duration)+" "+epgd.tr.oClock+"&nbsp;|&nbsp;"+parseInt(t.duration/60,10)+" "+epgd.tr.minutes+'</div></h3><div><div class="colFull"><div class="imgBox">'+(p?'<img src="'+p+'" />':"")+'</div><div class="chPrFl">'+epgd.channels.getHtml(t.channelid)+(g>0&&g<=100?'<div class="progress"><div style="width: '+g+'%"></div></div>':"")+'<div class="audio">'+(t.flags&&t.flags.indexOf("16:9")>0?'<span class="a-169"></span>':"")+(t.audio&&t.audio.indexOf("DolbyDigital")>=0?'<span class="a-dd" title="DolbyDigital"></span>':"")+(t.flags&&t.flags.indexOf("Live")>0?"Live":"")+(t.parentalrating?'<div class="parRate'+t.parentalrating+'">'+b.parentalrating+t.parentalrating+"</div>":"")+"</div>"+(t.merge?"<div>"+b.mergeSrc+t.merge+"</div>":"")+"</div>"+(d?'<div class="stars">'+d+"</div>":"")+'<div class="col2">'+t.title+(x.partname?"<br /><i>"+x.partname+"</i>":(t.shorttext?"<br /><i>"+t.shorttext+"</i>":""))+'</div><div class="col2 rate rate'+(t.numrating||"0")+'">'+(t.tipp?'<b class="tipp">'+t.tipp+"</b>":"")+(t.txtrating?"<span>"+t.txtrating+"</span>":"")+(t.shortreview||"")+"</div>"+(k?'<div class="info">'+k+"</div>":"")+(h?'<div class="info">'+h+"</div>":"")+(o?'<img src="'+o+'" />':"")+'</div><div class="colFull desc">'+(s?s.replace(/\n/g,"<br />"):"")+"</div></div>"+u+(t.category=="Serie"||a.isSerie||x.episodename?'<h3 data-conti="'+m+'"><span>'+b.constabelInfo+'</span></h3><div class="desc"><a class="iAsButton i-edit" href="'+epgd.profile.constabelEditPath+encodeURIComponent(m)+'.episodes" target="constabel">'+epgd.tr.edit+'</a><a class="iAsButton i-link-ext" href="'+epgd.profile.constabelLinkPath+encodeURIComponent(m)+'" target="constabel">'+epgd.tr.pages.eventDetail.addConstableLink+"</a>"+epgd.pages.help.getButton("constabel",true)+(epgd.profile.constabelLoginPath?'<a class="iAsButton i-login" href="'+epgd.profile.constabelLoginPath+'" target="constabel">'+epgd.tr.pages.eventDetail.loginConstable+"</a>":"")+'<pre id="cRaw"></pre></div>':"")+(r?"<h3><span>"+epgd.tr.menu.records+'</span></h3><div class="recordings">'+r+"</div>":"")+"</div>").replaceAll(this.$con);this.$con.accordion({heightStyle:"fill",header:"h3",active:0,beforeActivate:function(e,i){if(i.newHeader.attr("data-conti")){epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/proxy?id=constabel&title="+encodeURIComponent(encodeURIComponent(i.newHeader.attr("data-conti")))+"&_"+new Date().getTime(),dataType:"html",contentType:"text/plain; charset=utf-8"},function(E){if(E.indexOf("Error:")==-1){var F=i.newPanel.find("#cRaw"),D="<thead><tr><th>"+b.season+"</th><th>"+b.part+"</th><th>"+b.number+"</th><th>"+b.title+"</th>",B="<tbody>",A=E.split(/\r?\n/),z,y,C;for(C=0;C<A.length;C++){z=A[C];if(z.charAt(0)=="#"){y=z.match(/EXTRACOL[0-9] (.+)/i);if(y){D+="<th>"+y[1]+"</th>"}}else{y=z.split(/\t/);if(y.length>3){B+="<tr><td>"+y.join("</td><td>")+"</td></tr>"}}}F.html(E).hide().before('<a href="#" onclick="return !!$(\'#cRaw\').toggle()[0].scrollIntoView()">Raw</a>');F.before("<table>"+D+"</thead>"+B+"</tbody></table>")}else{i.newPanel.find("#cRaw").html(epgd.tr.error.noData)}epgd.utils.loader.close()});i.newHeader.removeAttr("data-conti")},true)}}});this.$rec.toggleClass("hasTimer",!!t.timerid).prop("title",this.detail.doRecord(true));q=this.detail.doPlay(true);this.$play.toggle(!!q).prop("title",q);this.$prev.toggle(this.detail.doPrev(true));this.$next.toggle(this.detail.doNext(true));this.$con.find(".channel .i-tv").click(function(){epgd.vdrs.current.switchChannel(this.parentNode.id)});this.closed=false;q=Math.max.apply(null,this.$win.siblings(".ui-front:visible").map(function(){return +$(this).css("z-index")}).get());if(q>=+this.$win.css("z-index")){this.$win.css("z-index",q+1)}$(window).trigger("resize.eventDetail");this.$openDialogs=$(".ui-dialog:visible:not(.ui-state-disabled)").addClass("ui-state-disabled");$(document).bind("keyup.eventDetail",function(i){if(i.keyCode==27){$(window).trigger("epgd_close.eventDetail")}});epgd.pages.help.initButtons(this.$con)};epgd.recordDetail=epgd.utils.inherits(function(a){this.elem=a;return epgd.eventDetail.call(this)},epgd.eventDetail);epgd.recordDetail.prototype.load=function(){var a=this;epgd.ajax({url:epgd.login.url+"data/recording?starttime="+this.elem.getAttribute("data-start")+"&md5path="+this.elem.getAttribute("data-md5")+"&owner="+this.elem.getAttribute("data-owner"),async:false},function(b){a.data=b.recording});return this};epgd.recordDetail.prototype.doRecord=function(a){if(a===true){return epgd.tr.pages.records.similarTimer}epgd.eventDetail.prototype.doRecord.call(this,a)};epgd.recordDetail.prototype.doPlay=function(a){if(a){return epgd.tr.pages.eventDetail.play}epgd.ajax({url:epgd.login.url+"data/replayrecording?vdruuid="+(!epgd.vdrs.list[this.data.vdruuid].usecommonrecfolder?this.data.vdruuid:epgd.vdrs.current.uuid)+"&starttime="+this.data.starttime+"&md5path="+this.data.md5path+"&owner="+(this.data.owner||""),cache:false},function(b){epgd.utils.popup(b.result.message,{title:"VDR",autoClose:5000})})};epgd.recordDetail.prototype.doPrev=function(b){var a=$(this.elem).prev(".rec");if(!a.length){return false}if(b){return true}a.find("B").click()};epgd.recordDetail.prototype.doNext=function(b){var a=$(this.elem).next(".rec");if(!a.length){return false}if(b){return true}a.find("B").click()};epgd.doneTimerDetail=epgd.utils.inherits(function(a){this.tr=a;return epgd.eventDetail.call(this)},epgd.eventDetail);epgd.doneTimerDetail.prototype.load=function(){var a=this;epgd.ajax({url:epgd.login.url+"data/donetimer?id="+this.tr.tData.id,async:false,cache:false},function(c){var b=c.donetimer;if(b.state){b.cntlongdescription=epgd.pages.timerListDone.stateIcons[b.state]}b.episode={lang:b.episodelang,season:b.episodeseason,part:b.episodepart};a.id=c.id;a.expire=epgd.utils.now().getTime()+900000;delete b.timerid;delete b.id;a.data=b});return this};epgd.doneTimerDetail.prototype.doRecord=function(a){if(a===true){return epgd.tr.pages.records.similarTimer}epgd.eventDetail.prototype.doRecord.call(this,a)};epgd.doneTimerDetail.prototype.doPlay=function(a){return false};epgd.doneTimerDetail.prototype.doPrev=function(b){var a=$(this.tr).prev("tr");if(!a.length){return false}if(b){return true}a.find("td").click()};epgd.doneTimerDetail.prototype.doNext=function(b){var a=$(this.tr).next("tr");if(!a.length){return false}if(b){return true}a.find("td").click()};$(document).ready(function(){epgd.eventDetail.prototype.win=new epgd.eventDetail.win()});epgd.pages.editChannels={render:function(){if(!(epgd.login.rights&epgd.rights.umConfigEdit)==epgd.rights.umConfigEdit){return epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}var i=epgd.tr.pages.editChannels,m=epgd.$con,e,l="",h="",k,c,d,g,b,a;for(d in epgd.channels.list){a=epgd.channels.list[d];k=[];for(g in a.sources){c=a.sources[g];k[c.merge]="<li><u>"+g+'</u> <input type="text" readonly value="'+c.extid+'" /></li>'}l+='<li><em class="i-check'+(a.visible&1?"":"-empty")+'"></em><em style="display:none" class="i-check'+(a.visible&2?"":"-empty")+'"></em><span>'+d+'</span><input type="text" value="'+(a.name||"")+'" /></li>'}for(b in epgd.vdrs.list){h+='<li data-url="vdr&uuid='+b+'">'+epgd.vdrs.list[b].name+"</li>"}e=m.html('<div class="ui-widget"><div class="ui-state-highlight ui-corner-all" style="padding: 0.3em 0.7em; font-size:0.9em"><button class="iAsButton i-down-dir">'+i.menu.channelList+'</button> <span class="i-info-circled" style="display:inline-block"></span>'+epgd.tr.pages.editChannels.headline+'</div></div><div class="pageEditChannels" id="pageEditChannelsHead"><div class="selMarkBlock"><b title="'+epgd.tr.markAll+'" class="selected" data-t="1"></b><b title="'+epgd.tr.markNone+'" data-t="0"></b><b title="'+epgd.tr.markToggle+'"><b class="selected"></b></b></div><div class="selMarkBlock" data-index="0" title="'+epgd.tr.pages.editChannels.checkWeb+'">Web<em title="'+epgd.tr.markAll+'" class="iAsButton i-check"></em><em title="'+epgd.tr.markNone+'" class="iAsButton i-check-empty"></em></div><span><input type="text"/>channel-id</span><span><input type="text"/>channel-name</span></div>').find("button");e.click(function(){var n=this.$menu.show();$(document).bind("click.ui_menu",function(o){if(!$(o.target).closest(".ui-menu").length){n.hide();$(this).unbind("click.ui_menu")}});return false})[0].$menu=$('<ul style="font-size:0.8em; width:200px;position:absolute"><li data-id="loadList"><a>'+i.menu.referenceList+'</a><ul style="width:100px"><li data-id="channelpedia"><a>channelpedia</a></li>'+(h?"<li><a>VDR</a><ul>"+h+"</ul></li>":"")+'<li data-id="insertList"><a>'+i.menu.insertAsText+'</a></li></ul></li><li data-id="getChannelNames"><a>'+i.menu.extentEmptyChannelNames+'</a></li><li data-id="getAllChannelNames"><a>'+i.menu.applyAllChannelNames+'</a></li><li data-id="getOrder"><a>'+i.menu.applyChannelSort+"</a></li></ul>").hide().insertAfter(e).menu({select:function(p,q){var s=q.item,n,r,o="";if(!s.attr("data-id")){s=s.parents("li[data-id]:first")}switch(s.attr("data-id")){case"getChannelNames":o='[value=""]';case"getAllChannelNames":epgd.utils.loader.process(function(){var t=[];$("#pageEditChannelsSource li").each(function(){t[this.lastChild.innerHTML]=this.firstChild.innerHTML});$("#pageEditChannels > li > input"+o).each(function(){this.value=t[this.previousSibling.innerHTML]||this.value})});break;case"getOrder":epgd.utils.loader.process(function(){var u=$("#pageEditChannels"),t;$($("#pageEditChannelsSource span").get().reverse()).each(function(){t=u.find("> li > span:contains("+this.innerHTML+")");if(t.length){t.parent().prependTo(u)}})});break;case"insertList":$('<div title="channel.conf"><p>'+i.desc_insertList+' <a href="http://channelpedia.yavdr.com/gen/DVB-S/S19.2E/S19.2E_complete_sorted_by_groups.channels.conf" target="forList">channelpedia.yavdr.com</p><textarea style="width:100%; height:60%"></textarea><button>ok</button></div>').dialog({modal:true,width:500,height:400}).find("textarea").change(function(){epgd.pages.editChannels.insertReferenceList(this.value);$(this).parent().dialog("destroy")});break;case"loadList":if(q.item.attr("data-url")){epgd.ajax({url:epgd.login.url+"data/proxy?id="+q.item.attr("data-url"),dataType:"html",contentType:"text/plain; charset=utf-8"},epgd.pages.editChannels.insertReferenceList);break}case"channelpedia":n=$('<ul style="width:100px" />').appendTo(q.item)[0];epgd.ajax({url:epgd.login.url+"data/proxy?id=channelpedia",dataType:"html",contentType:"text/plain; charset=utf-8"},function(u){s.attr("data-id","");var t=$(u.replace(/<img [^>]+>/g,"")).find(".entryMenu > ul:first");t.find("br").remove();t.find("a").each(function(){this.parentNode.setAttribute("data-url",this.getAttribute("href"));this.removeAttribute("href")});t.find(">li").each(function(){$('<li data-id="channelpediaList"><a>'+this.firstChild.innerHTML+"</a></li>").append($(this).next("ul").width(400)).appendTo(n)});$(p.target).menu("refresh").menu("expand")});return true;case"channelpediaList":r=q.item.attr("data-url");s.attr("data-id","loadList");q.item.removeAttr("data-url");epgd.ajax({url:epgd.login.url+"data/proxy?id=channelpedia&path="+r,dataType:"html",contentType:"text/plain; charset=utf-8"},function(u){var t=$("<ul />");$(u).find('.singleSourceMainMenu li:contains("channels.conf")').each(function(){var v=$(this);$('<li title="'+v.find(".description").text()+'" data-url="channelpedia&path='+r+v.find(".button a").attr("href")+'"><a>'+v.find(".caption").text()+"</a></li>").appendTo(t)});t.appendTo(q.item);$(p.target).menu("refresh").menu("expand")});return true;default:return false}$(document).trigger("click.ui_menu")}}).position({my:"left top",at:"left bottom",of:e[0]});$('<button class="iAsButton i-save">'+epgd.tr.save+"</button>").insertAfter(e).click(function(){var n={};$("#pageEditChannels > li").each(function(p){var q=$(this),o={};k={};q.find(">ol>li").each(function(s){var t=$(this),r=t.find("input").val();o[t.find("u").text()]=k={merge:s};if(r){k.extid=r}});n[q.find("span").text()]={name:q.find("input").val(),visible:q.find("em:eq(0)").hasClass("i-check")*1+q.find("em:eq(1)").hasClass("i-check")*2,order:p+1,sources:o}});epgd.ajax({url:epgd.login.url+"data/save-channels",type:"post",data:JSON.stringify({channels:n})},function(o){o=o.result;if(o.state==200){epgd.utils.popup(epgd.tr.dataSaved);epgd.channels.isDirty=true}else{epgd.utils.popup(o.message)}})});$('<ol id="pageEditChannels" class="pageEditChannels">'+l+"</ol>").appendTo(m).sortable({revert:"invalid",handle:":not(em)"}).click(function(o){if(o.target.nodeName=="EM"){$(o.target).toggleClass("i-check i-check-empty")}else{$li=$(o.target).closest("li");if($li.parent("#pageEditChannels").length){$li.toggleClass("selected");if(o.shiftKey&&this.lastSel){var n=$(this.lastSel),p=$li.index()-n.index();if(p>0){n.nextAll(":lt("+p+"):not(.filterHide)").toggleClass("selected",n.hasClass("selected"))}else{n.prevAll(":lt("+-p+"):not(.filterHide)").toggleClass("selected",n.hasClass("selected"))}}else{this.lastSel=$li[0]}}}});$('<ol id="pageEditChannelsSource" class="pageEditChannels"></ol>').appendTo(m).sortable({connectWith:"#pageEditChannels",revert:"invalid",remove:function(o,n){$('<li><em class="i-check"></em><span>'+n.item.find("span").text()+'</span><input type="text" value="'+n.item.find("i").text()+'" /></li>').insertAfter(n.item);return false}}).hide();m.append('<br clear="all" />');$(window).bind("resize.editChannels",function(){var n=$(window).height()-$("#pageEditChannels").offset().top-20;if($("#pageEditChannelsSource:visible").length==0||(m.width()-$("#pageEditChannels").width()-$("#pageEditChannelsSource").width()-80)>0){$("#pageEditChannels,#pageEditChannelsSource").css({height:n})}else{$("#pageEditChannels").height(n*0.66);$("#pageEditChannelsSource").height(n*0.33)}}).trigger("resize");$(window).bind("epgd_close.editChannels",function(){$(window).unbind(".editChannels");epgd.channels.load()});$("#pageEditChannelsHead em").click(function(){var p=null,n;try{p=$(window.getSelection().getRangeAt(0).cloneContents()).children()}catch(o){p=null}if(!p||!p.length){n=$("#pageEditChannels > li");p=n.filter(".selected");if(!p.length){p=n}}p.find("> em:eq("+this.parentNode.getAttribute("data-index")+").i-check"+(this.className.indexOf("i-check-empty")>0?"":"-empty")).toggleClass("i-check i-check-empty")});$("#pageEditChannelsHead b").click(function(){var n=this.getAttribute("data-t");$("#pageEditChannels > li").toggleClass("selected",n==1?true:n==0?false:undefined);return false});this.inp_ChID=$("#pageEditChannelsHead input:eq(0)").keyup(this.filter)[0];this.inp_ChName=$("#pageEditChannelsHead input:eq(1)").keyup(this.filter)[0]},filter:function(){var b=epgd.pages.editChannels.inp_ChID.value.toLowerCase(),a=epgd.pages.editChannels.inp_ChName.value.toLowerCase();$("#pageEditChannels > li").each(function(){var c=$(this);if((!b||c.find("span").text().toLowerCase().indexOf(b)>=0)&&(!a||c.find("input").val().toLowerCase().indexOf(a)>=0)){c.removeClass("filterHide")}else{c.addClass("filterHide")}})},insertReferenceList:function(c){var a="",b;$(c.split("\n")).each(function(){b=this.split(":");if(b[0]){a+="<li><i>"+b[0].split(/,|;/)[0]+"</i><span>"+b[3]+"-"+b[10]+"-"+b[11]+"-"+b[9]+"</span></li>"}});$("#pageEditChannelsSource").show().html(a);$(window).trigger("resize.editChannels")}};epgd.pages.editUser={cur:null,render:function(){if(!(epgd.login.rights&epgd.rights.umConfigUsers)==epgd.rights.umConfigUsers){return epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}var b=epgd.tr.pages.editUser,a=$("<form></form>"),c=$('<select size="10"></select>').change(function(){epgd.pages.editUser.showUser(this[this.selectedIndex].data,a,epgd.pages.editUser.render)});$("<option>"+b.add+"</option>").appendTo(c)[0];epgd.$con.html('<div id="page_editUser"><div><h2>'+b.user+"</h2></div></div>");epgd.ajax({url:epgd.login.url+"data/users",cache:false},function(d){for(var e in d.users){$("<option>"+e+"</option>").appendTo(c)[0].data=d.users[e]}});epgd.$con.find("#page_editUser").append(a).children().first().append(c)},showUser:function(a,d,i){epgd.pages.editUser.cur=a||{user:"",active:1,rights:epgd.login.rights};var h=epgd.tr.pages.editUser,g=epgd.pages.editUser.cur,c="",e;for(e in epgd.rights){c+='<div><input type="checkbox"'+((g.rights&epgd.rights[e])==epgd.rights[e]?' checked="checked"':"")+' name="uRights" id="uR'+e+'" value="'+epgd.rights[e]+'"/><label for="uR'+e+'">'+(h.rights[e]||e)+"</label></div>"}d.html((!g.user?"<h2>"+epgd.tr.pages.login.userName+'</h2><div><input type="text" id="uName" value="" /></div><br />':"")+'<div><input type="radio"'+(g.active=="1"?' checked="checked"':"")+' name="uActive" value="1" id="uActive"/><label for="uActive">'+h.active+'</label> <input type="radio"'+(g.active=="0"?' checked="checked"':"")+' name="uActive" value="0" id="uInactive" /><label for="uInActive">'+h.inActive+"</label>"+(g.user&&' <input type="radio" name="uActive" value="-1" id="uDel"/><label for="uDel">'+epgd.tr.del+"</label>")+"</div><h2>"+epgd.tr.pages.login.password+'</h2><div><input type="password" id="uPass" /></div><h2>'+h.rights.label+"</h2><div>"+c+'</div><div><br /><button class="iAsButton i-save">'+epgd.tr.save+"</button></div>");d.find("button").click(function(){return epgd.pages.editUser.save(this.form,i)});$uRights=$(d[0].uRights).each(function(){this.r=parseInt(this.value,10)});function b(){var k=this.r;if(this.checked){$uRights.each(function(){if(this.r<k&&(k&this.r)==this.r){this.checked=this.disabled=true}})}else{$uRights.each(function(){if(this.r<k&&(k&this.r)==this.r){this.disabled=false;var l=this;$uRights.each(function(){if(this.checked&&this.r>l.r&&(this.r&l.r)==l.r){l.checked=l.disabled=true}})}})}}$uRights.each(b).click(b)},save:function(b,d){var a={rights:1},c=epgd.pages.editUser.cur;$(b.uRights).each(function(){if(this.checked){a.rights|=this.r}});a.active=parseInt(b.uActive.value,10);if(c.user){a.user=c.user;if(a.active==-1){delete a.active;a.state="D"}else{a.state="M";if(a.active==c.active){delete a.active}if(a.rights==c.rights){delete a.rights}if(b.uPass.value){a.passwd=YaMD5.hashStr(a.user+b.uPass.value)}}}else{a.state="C";a.user=b.uName.value;if(!a.user){return !epgd.utils.topInfo(epgd.tr.error.emptyField.replace("$field$",epgd.tr.pages.login.userName),{isError:1})}a.passwd=YaMD5.hashStr(a.user+b.uPass.value)}epgd.ajax({url:epgd.login.url+"data/save-users",type:"post",data:JSON.stringify({users:[a]})},function(e){if(e.Error||e.result.state!=200){return epgd.utils.topInfo(e.Error||e.result.message,{isError:1})}(a.user==epgd.login.user)&&$(window).trigger("login_changed",a);if($.isFunction(d)){d(e)}});return false}};epgd.pages.help={$con:null,render:function(){$("#menu_help").addClass("menu-active");if(!this.$con){this.load()}epgd.$con.html(this.$con);this.init()},getButton:function(b,a){return(a?"<a":"<button")+' id="bh_'+b+'" class="help iAsButton i-help" role="button">'+epgd.tr.menu.help+"</"+(a?"a>":"button>")},getIcon:function(a){return'<a id="bh_'+a+'" class="help iAsIcon i-help" />'},initButtons:function(a){if(!a){a=epgd.$con}a.tooltip({items:".help",tooltipClass:"quickInfo",content:function(){return epgd.pages.help.getQuickInfo(this.id.slice(3))},open:function(b,c){$(c.tooltip).position({of:b.toElement,my:"left top"});b.preventDefault()}})},getQuickInfo:function(b){var a=epgd.pages.help;if(!a.$con){a.load()}return a.$con.find("#h_"+b).html()||epgd.tr.pages.help.noHelp},load:function(){var a=this;epgd.ajax({url:epgd.tr.pages.help.url,async:false,dataType:"html",contentType:"text/plain; charset=utf-8"},function(b){a.$con=$($(b).filter("#help")[0]);$(b).filter("#help_js").appendTo(document.body)})}};epgd.pages.login={useCookie:document.cookie.match(/login=([^;]+)/),render:function(){if(epgd.login.session){this.doLogin("logout")}this.showForm()},showForm:function(c){var b=epgd.tr.pages.login,a=$("#login");if(!a.length){a=$('<div id="login" title="'+b.label+'" class="searchDialog ui-dialog" style="margin:5% auto"><form class="ui-dialog-content ui-widget-content"><table cellpadding="5"><tr><td>'+b.userName+'</td><td><input type="text" id="lUser" /></td></tr><tr><td>'+b.password+'</td><td><input type="password" id="lPass" /></td></tr><tr><td colspan="2"><input type="checkbox" id="lAlways" /> <label for="lAlways">'+b.loggedAlwaysIn+"</label></td></tr></table></form></div>");a.dialog({modal:true,width:"auto",closeOnEscape:false,buttons:[{text:b.label,icons:{primary:"ui-icon-unlocked"},click:function(){var d=a.find("form")[0];if(!d.lUser.value){return !!epgd.utils.topInfo(epgd.tr.error.emptyField.replace("$field$",b.userName),{isError:1})}$(this).dialog("close");epgd.pages.login.useCookie=d.lAlways.checked?[]:null;epgd.pages.login.doLogin(d.lUser.value,d.lPass.value,c)}}]}).keypress(function(d){if(d.keyCode==13){$(this).parent().find(".ui-dialog-buttonpane button:eq(0)").trigger("click")}}).parent().find(".ui-dialog-titlebar-close").remove()}else{a.dialog("open")}},doLogin:function(c,g,i){var d=epgd.login,b="",h=sessionStorage;try{h.setItem("_storagetest_",1);h.removeItem("_storagetest_")}catch(e){h={removeItem:function(){},setItem:function(){},getItem:function(){return null}}}function a(){if(epgd.login.user!=d.user||epgd.login.rights!=d.rights){if(!epgd.login.session){if(epgd.pages.login.useCookie){epgd.pages.login.useCookie[1]=null;document.cookie="login=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}h.removeItem("login");epgd.login.url=""}else{if(epgd.pages.login.useCookie){epgd.pages.login.useCookie[1]=b;var k=new Date();k.setTime(k.getTime()+365*24*60*60*1000);document.cookie="login="+b+"; expires="+k.toUTCString()}h.setItem("login",b);epgd.login.url="sid"+epgd.login.session+"/"}$(window).trigger("login_changed",d)}epgd.login.url=epgd.login.session?"sid"+epgd.login.session+"/":"";if($.isFunction(i)){i()}}if(c!="logout"){if(d.session){$.ajax({url:d.url+"data/login",data:JSON.stringify({key:""}),type:"post",contentType:"application/json; charset=utf-8",dataType:"json"});epgd.login.url=""}if(epgd.profile.needLogin=="0"){epgd.login={user:"",session:"",rights:4294967295,url:""};return a()}if(c){b=YaMD5.hashStr(c+g)}else{b=h.getItem("login");if(!b&&epgd.pages.login.useCookie){b=epgd.pages.login.useCookie[1]}if(!b){return this.showForm(i)}}}$.ajax({url:epgd.login.url+"data/login",data:JSON.stringify({key:b}),type:"post",contentType:"application/json; charset=utf-8",dataType:"json"}).done(function(l){var k=epgd.tr.pages.login;epgd.login=l.login||{user:"",session:"",rights:0,url:""};if(!epgd.login.session){if(c=="logout"){epgd.utils.topInfo(k.logoutMessage)}else{epgd.utils.topInfo(k.error,{isError:1})}$("#menu_login a").text(k.label)}else{$("#menu_login a").text(epgd.login.user+" "+k.logout);if(location.hash=="#menu_login"||location.hash=="#"){location.hash=""}}return a()})}};epgd.pages.magazine={startTime:null,endTime:null,$head:null,$con:null,list:[],viewCnt:0,scrollStart:0,timeLineL:null,timeLineR:null,qt:{},imgPath:epgd.profile.eventImgPath?epgd.profile.eventImgPath+"?no=0&maxW=100&maxH=70&id=":false,init:function(){this.select=epgd.channels.selBox;$(window).bind("channels_load",function(){var a=epgd.pages.magazine,b;if(!a.$head){return}a.$head.empty();for(b in a.list){a.list[b].index=-1}a._initChannels();for(b in a.list){if(a.list[b].index==-1){a.preTime.removeChild(a.list[b].col);delete a.list[b]}}})},initQT:function(){var a={};epgd.profile.quickTimes.replace(/=([0-9]{1,2}):([0-9]{1,2})/g,function(c,d,b){a[parseInt(d,10)]="<p"+(b?' style="margin-top:'+(b*2)+'px"':"")+"> </p>"});this.qt=a},_initChannels:function(){var b,a;for(a=0;a<this.select.length;a++){b=this.list[this.select[a].value];if(!b){b=new epgd.pages.magazine.channel(this.select[a].value,a,$('<div class="ui-widget-content"/>')[0]);this.list[b.id]=b}else{b.index=a}this.preTime.appendChild(b.col);this.select[a].ch=b;this.$head.append('<div class="ui-widget-content ui-corner-top">'+epgd.channels.getHtml(b.id)+"</div>")}this.$head.css("width",(208*this.select.length+55)+"px")},_initWinBindings:function(){$(window).bind("epgd_close.pages_magazine",function(){epgd.$dtPicker.hide();$(window).unbind(".pages_magazine");clearInterval(this.pages_magazine.timeInterval);delete this.pages_magazine}).bind("resize.pages_magazine",function(){var b=$(window).width(),a=$(this).scrollLeft();this.pages_magazine.$nav.width(b+"px");this.pages_magazine.$con.css("height",($(window).height()-10-$("#magazine").offset().top)+"px");this.pages_magazine.viewCnt=parseInt((b-110)/208,10);if(this.pages_magazine.viewCnt<5){this.pages_magazine.timeLineR.style.left="-50px";this.pages_magazine.$con.css("width",(208*this.pages_magazine.select.length+25)+"px")}else{if(this.pages_magazine.viewCnt>=this.pages_magazine.select.length){this.pages_magazine.viewCnt=this.pages_magazine.select.length;this.pages_magazine.timeLineR.style.left="-50px";b=this.pages_magazine.viewCnt*208+55;this.pages_magazine.$con.css("width",(b-30)+"px")}else{this.pages_magazine.timeLineR.style.left=(a+b-52)+"px";this.pages_magazine.$con.css("width",(208*this.pages_magazine.select.length+150)+"px")}}this.pages_magazine.lineNow.style.width=(b-10)+"px";epgd.$menu.parent().offset({left:a});this.pages_magazine.$nav.offset({left:a});this.pages_magazine.update()}).bind("scroll.pages_magazine",function(){this.pages_magazine.timeLineL.style.left="-50px";this.pages_magazine.timeLineR.style.left="-50px"}).bind("scrollstop.pages_magazine",function(){var a=$(this).scrollLeft();this.pages_magazine.timeLineL.style.left=this.pages_magazine.lineNow.style.left=a+"px";if(this.pages_magazine.viewCnt>=5&&this.pages_magazine.viewCnt<this.pages_magazine.select.length){this.pages_magazine.timeLineR.style.left=(a+$(window).width()-52)+"px"}this.pages_magazine.nextMain=parseInt((a+104)/208,10);if(this.pages_magazine.select.selectedIndex!=this.pages_magazine.nextMain){this.pages_magazine.setMain(0,this.pages_magazine.nextMain,true)}epgd.$menu.parent().offset({left:a});this.pages_magazine.$nav.offset({left:a});return false}).bind("datepicker.pages_magazine",function(){this.pages_magazine.setTime(epgd.utils.unixTime(epgd.$dtPicker.datetimepicker("getDate")||epgd.utils.now()),true)})[0].pages_magazine=this;this.$con.bind("scrollstop.pages_magazine",function(){var a=$(this).scrollTop();if(a>this.pages_magazine.scrollEnd){this.pages_magazine.setTime(a*30+epgd.profile.minEventTime)}else{if(a<this.pages_magazine.scrollStart){this.pages_magazine.setTime(Math.max(this.pages_magazine.startTime-43200,epgd.profile.minEventTime))}}});this._setLineNow();this.timeInterval=setInterval(this._setLineNow,60000)},_setLineNow:function(){var a=window.pages_magazine,b=new Date().getTime()/1000;if(b>a.endTime||(a.startTime-epgd.profile.minEventTime)<-3600){$(window).trigger("epgd_close");$('<div class="ui-widget-overlay ui-front"></div>').click(function(){epgd.profile.minEventTime=epgd.utils.now().getTime()/1000-10800;$(window).trigger("profile_updated",{minEventTime:true});epgd.$dtPicker.datetimepicker("setDate",epgd.utils.now());a.$con.empty();a.render();$(this).remove()}).appendTo(document.body);return}a.lineNow.style.top=((b-a.startTime)/30+a.scrollStart)+"px";a.lineNow.innerHTML=epgd.utils.formatTime(b)},render:function(b){$("#menu_magazine").addClass("menu-active").append(epgd.$dtPicker.show());var a=epgd.utils.unixTime(epgd.utils.now()),c;if(this.startTime&&(this.startTime-epgd.profile.minEventTime)<-3600){this.startTime=null;this.list=[]}if(!this.startTime){$(window).trigger("epgd_close");$(this.select).appendTo(epgd.$menu.find("#menu_magazine")).mousedown(function(d){d.stopPropagation();return true}).click(function(d){return false}).change(function(){epgd.pages.magazine.render($(this).val())});if(this.select.selectedIndex<0){this.select.selectedIndex=0}this.$nav=$('<div id="magazine-nav"><div class="ui-widget-content ui-corner-top left"><div class="ui-widget-content ui-corner-top"><span class="iAsButton i-left-dir"></span><span class="iAsButton i-rewind"></span></div></div><div class="ui-widget-content ui-corner-top right"><div class="ui-widget-content ui-corner-top"><span class="iAsButton i-right-dir"></span><span class="iAsButton i-forward"></span></div></div></div>');this.$head=$('<div id="magazine-head"></div>');this.$con=$('<div id="magazine"></div>');this.$con[0].pages_magazine=this;this.preTime=$('<div style="height:'+parseInt((epgd.profile.maxEventTime-epgd.profile.minEventTime)/30,10)+'px"></div>').appendTo(this.$con)[0];this.timeLineL=$('<div class="ui-widget-content timeLine"></div>').appendTo(this.preTime)[0];this.timeLineR=$('<div class="ui-widget-content timeLine tlr"></div>').appendTo(this.preTime)[0];this.lineNow=$('<p class="timeNow"></p>').appendTo(this.preTime)[0];this._initChannels();this.startTime=a+3600;c=new Date(this.startTime*1000);if(c.getMinutes()>0){c.setMinutes(0);this.startTime=c.getTime()/1000}this.endTime=this.startTime;this.setTime(this.startTime-7200)}if(!window.pages_magazine){this._initWinBindings();epgd.$con.empty();this.$nav.appendTo(epgd.$con).bind("click",this.actionHead);this.$head.appendTo(epgd.$con).bind("click",function(d){if(d.target.className=="i-tv"){epgd.vdrs.current.switchChannel(d.target.parentNode.id)}});this.$con.appendTo(epgd.$con).bind("click",this.actionCon).bind("touchend",this.actionConOpen);if(!$.support.touch&&epgd.profile.magazinePan>0){this._pan()}}$(window).trigger("resize.pages_magazine");if(b){this.setChannel(b)}if(a<this.startTime||a>this.endTime){this.setTime(a)}this.$con.scrollTop((a-epgd.profile.minEventTime)/30-15);$(window).trigger("resize.pages_magazine")},_pan:function(){var b=false,a=$('<div style="width:90%; height:35px; margin-top:15px; position:fixed;z-index:99;left:5%"></div>').prependTo(epgd.$con)[0],c=$('<div style="width:90%; height:35px; position:fixed;z-index:99;bottom:0;left:5%"></div>').appendTo(epgd.$con)[0];this.timeLineL.pan=-1;this.timeLineR.pan=1;a.pan=epgd.profile.magazinePan*-30;c.pan=epgd.profile.magazinePan*30;window.tp=a;window.bp=c;window.p=b;$([this.timeLineL,this.timeLineR,a,c]).mouseover(function(d){if(b){return}b=this.pan;window.setTimeout(function(){if(b){var e=window.setInterval(function(){if(!b||!window.pages_magazine){return window.clearInterval(e)}if(b<-1||b>1){window.pages_magazine.setTime((window.pages_magazine.$con.scrollTop()+15)*30+epgd.profile.minEventTime+b,true)}else{window.pages_magazine.setMain(b)}},(b<-1||b>1?100:1200))}},epgd.profile.magazinePanDelay)}).mouseout(function(){b=false})},setChannel:function(b){if(this.list.lengt>0){this.setMain(0,this.list[b].index)}else{var a=this;$(window).one("resize.pages_magazine",function(){a.setMain(0,a.list[b].index)})}},setMain:function(e,a,d){var b=this.select,c=isNaN(a)?b.selectedIndex:a;c+=e;if(c<0){c=0}else{if(c>=b.length-this.viewCnt){c=b.length-this.viewCnt}}b.selectedIndex=c;this.update();!d&&$(window).scrollLeft(c*208)},setTime:function(g,a){var b,e="",c,d=g+43200;if(g<this.startTime){do{this.startTime-=3600;b=epgd.utils.formatTime(this.startTime);c=parseInt(b,10);if(c%4==0){b+=$.datepicker.formatDate("<br />D,<br />dd<br />MM<br />yy",new Date(this.startTime*1000))}e=(this.qt[c]||"")+"<dfn>"+b+"</dfn>"+e}while(this.startTime>g);$(this.timeLineL).prepend(e);$(this.timeLineR).prepend(e);this.scrollStart=(this.startTime-epgd.profile.minEventTime)/30;if(this.scrollStart<0){this.scrollStart=0;this._setLineNow()}this.preTime.style.paddingTop=this.scrollStart+"px"}if(this.endTime<d){e="";d=Math.max(d,this.endTime+43200);for(;this.endTime<d;this.endTime+=3600){b=epgd.utils.formatTime(this.endTime);c=parseInt(b,10);if(c%4==0){b+=$.datepicker.formatDate("<br />D,<br />dd<br />M<br />yy",new Date(this.endTime*1000))}e+=(this.qt[c]||"")+"<dfn>"+b+"</dfn>"}$(this.timeLineL).append(e);$(this.timeLineR).append(e);this.scrollEnd=(this.endTime-epgd.profile.minEventTime-43200)/30}e&&this.update();a&&this.$con.scrollTop((g-epgd.profile.minEventTime)/30-15)},actionHead:function(b){var a=epgd.pages.magazine,d;if(b.target.nodeName=="SPAN"){d=b.target.className;if(d.indexOf("i-left-dir")>-1){a.setMain(-1)}else{if(d.indexOf("i-rewind")>-1){a.setMain(-a.viewCnt)}else{if(d.indexOf("i-right-dir")>-1){a.setMain(1)}else{if(d.indexOf("i-forward")>-1){a.setMain(a.viewCnt)}}}}}},actionConOpen:function(b){var a=$(b.target).closest("dt")[0];if(a){a.firstOpen=(a.clientHeight!=a.scrollHeight)}},actionCon:function(b){var a=$(b.target).closest("dt")[0];if(a){if(a.firstOpen){return false}if(!a.eventDetail){a.eventDetail=new epgd.eventDetail(a.title)}epgd.utils.loader.process(function(){a.eventDetail.render()})}},update:function(){var a=this,b;for(b=0,j=this.select.selectedIndex;b<this.viewCnt&&j<this.select.length;b++){this.select[j++].ch.updateTime()}window.setTimeout(function(){for(var d=0,c=a.select.selectedIndex+a.viewCnt;d<a.viewCnt&&c<a.select.length;d++){a.select[c++].ch.updateTime()}},500)}};epgd.pages.magazine.channel=function(c,b,a){this.id=c;this.index=b;this.col=a;this.startTime;this.endTime};epgd.pages.magazine.channel.prototype={updateTime:function(){if(!this.startTime){this.startTime=epgd.pages.magazine.startTime;this.endTime=epgd.pages.magazine.endTime;this.loadData(epgd.pages.magazine.startTime,epgd.pages.magazine.endTime)}else{if(epgd.pages.magazine.startTime<this.startTime){this.loadData(epgd.pages.magazine.startTime,this.startTime)}if(epgd.pages.magazine.endTime>this.endTime){this.loadData(this.endTime,epgd.pages.magazine.endTime)}}},loadData:function(c,b){var a=this,d=(a.endTime<b);if(d){a.endTime=b}else{a.startTime=c}epgd.ajax({url:epgd.login.url+"data/events?time="+c+"&endtime="+b+"&channelid="+this.id},function(k){var g="",n=k.events[0],l,e,s=null,r=$(a.col),o,m,p,q;if(n){if(d){s=r.find("dt:last");q=s[0].eTime;if(s.attr("title")==n.id){delete k.events[0]}}else{q=n.starttime;s=r.find("dt:first");if(s.attr("title")==k.events[k.events.length-1].id){delete k.events[k.events.length-1]}}for(l=0;l<k.events.length;l++){e=k.events[l];o=e.shortdescription||e.shorttext;m=e.duration;p=parseInt(m/60,10);m+=(e.starttime-q);m=m<600?20:parseInt(m/30,10);q+=m*30;g+='<dt title="'+e.id+'" style="height:'+m+"px;min-height:"+m+'px"><div class="title">'+e.title+"</div>"+(epgd.pages.magazine.imgPath&&e.imagecount?'<img src="'+epgd.pages.magazine.imgPath+e.id+'" />':"")+'<div class="time'+(e.timerid?" hasTimer":"")+'"><u>'+epgd.utils.formatTime(e.starttime)+"</u><i>"+p+"&nbsp;"+epgd.tr.minutes+"</i></div>"+(e.numrating?'<span class="rate rate'+e.numrating+'"> </span>':"")+(e.tipp?'<b class="tipp">'+e.tipp+"</b>":"")+'<div class="desc">'+(e.genre?"<span>"+e.genre+"</span> ":"")+(o?o.replace(/\n/g,"<br />"):"")+"</div></dt>"}}else{m=(b-c)/30;g='<div style="height:'+m+"px;min-height:"+m+'px"></div>';n={starttime:c};q=c}if(d){r.append(g);r.find("dt:last")[0].eTime=q}else{r.prepend(g);if(s&&s.length){s.css("margin-top","");m=s[0].starttime-q;if(m){m=parseInt(m/30,10)+parseInt(s.css("min-height"),10);s.css({height:m+"px","min-height":m+"px"})}}else{r.find("dt:last")[0].eTime=q}r.find("dt:first").css("margin-top",parseInt((n.starttime-c)/30,10))[0].starttime=n}})}};epgd.pages.now={$ul:null,timestamp_min:-1,timestamp_max:0,timestamp_cur:0,init:function(){$(window).bind("channels_load",function(){epgd.pages.timestamp_max=0})},render:function(){if(!window.pages_now){this.$search=$('<div style="float:left;margin-left:5px"></div>').appendTo($("#menu_now")).click(function(){if(this.curType=="@Now"){window.pages_now.setTime(null,"@Now")}});var a=this.$searchMenu=$('<ul class="ui-menu ui-widget ui-widget-content"></ul>').appendTo($("#menu_now")).hide();epgd.profile.quickTimes&&epgd.profile.quickTimes.replace(/([^=]+)=!?([^~]+)~?/g,function(c,b,d){a.append('<li data-type="'+d+'" class="ui-menu-item '+(d.indexOf("@")==0&&d!="@Next"&&d!="@Now"?"i-search":"i-clock")+'">'+b+"</li>")});if(!a.find('li[data-type="@Next"]').length){a.prepend('<li data-type="@Next" class="ui-menu-item">'+epgd.tr.pages.eventDetail.eventNext+"</li>")}if(!a.find('li[data-type="@Now"]').length){a.prepend('<li data-type="@Now" class="ui-menu-item">'+epgd.tr.pages.dateTimePicker.currentText+"</li>")}this.$searchMenu.click(function(b){if(b.target.getAttribute("data-type")){window.pages_now.setTime(null,b.target.getAttribute("data-type"));a.hide()}});$(window).bind("epgd_close.pages_now",function(){if(window.pages_now){epgd.$dtPicker.hide();window.pages_now.$searchMenu.remove();window.pages_now.$search.remove();delete window.pages_now}$(window).unbind(".pages_now");$("#menu_now").unbind(".pages_now")}).bind("datepicker.pages_now",function(){this.pages_now.setTime(epgd.utils.unixTime(epgd.$dtPicker.datetimepicker("getDate")))})[0].pages_now=this;this.$ul=epgd.$con.html('<div id="pageNow"><ul class="teaserList"></ul></div>').find("ul").click(function(c){if($(c.target).closest(".channel").length){$(window).trigger("epgd_close.eventDetail");if(c.target.className=="i-tv"){epgd.vdrs.current.switchChannel(c.target.parentNode.id)}else{epgd.$menu.menu("select",{target:"#menu_magazine"});epgd.pages.magazine.setChannel($(c.target).closest(".channel").attr("id"))}return}var b=$(c.target).closest("li")[0];if(!b){return}if(!b.eventDetail){b.eventDetail=new epgd.eventDetail(b.title)}epgd.utils.loader.process(function(){b.eventDetail.render()})});this.setTime(null,"@Now")}$("#menu_now").addClass("menu-active").bind("click.pages_now",function(b){if((b.target==this||b.target.nodeName=="A")&&window.pages_now){window.pages_now.$searchMenu.show();b.preventDefault()}return false}).append(epgd.$dtPicker.show())},setTime:function(c,b){b=b||"@time";var a=" "+epgd.tr.pages.now.at;if(b=="@Now"||b=="@time"){this.timestamp_cur=c||epgd.utils.unixTime(epgd.utils.now());this.load("data/events?time="+this.timestamp_cur);epgd.$dtPicker.datetimepicker("setDate",epgd.utils.date(this.timestamp_cur))}else{if(b=="@Next"){this.load("data/events?next=1&time="+this.timestamp_cur)}else{if(b[0]=="@"){a=" "+epgd.tr.menu.search;this.load("data/search","post",JSON.stringify({autotimername:b.slice(1)}))}else{$.timepicker.quicklink({target:{nodeName:"U",innerHTML:b},data:{unit:"time"}});$(window).trigger("datepicker")}}}this.$search[0].curType=b;this.$search.text(this.$searchMenu.find('li[data-type="'+b+'"]').text()+a)},load:function(a,b,c){epgd.utils.loader.process(function(){pages_now.$ul.empty();epgd.ajax({url:epgd.login.url+a,async:false,cache:false,type:b,data:c},function(h){if(!h.events||!h.events.length){epgd.utils.loader.close();return epgd.utils.popup(epgd.tr.error.noData)}var i=epgd.profile.eventImgPath?epgd.profile.eventImgPath+"?no=0&maxW=100&maxH=70&id=":false,g=0,d=2000000000,e=epgd.tr.dateTimePicker.dateFormat.replace(/\.?y+/,"");now=parseInt(epgd.utils.now().getTime()/1000,10);$.each(h.events,function(o,m){var k=m.starttime+m.duration,l=((now-m.starttime)/m.duration*100),n=m.shortdescription||m.shorttext;if(m.starttime>g){g=m.starttime}if(k<d){d=k}$('<li title="'+m.id+'" class="ui-widget-content ui-corner-all">'+epgd.channels.getHtml(m.channelid)+'<div class="time'+(m.timerid?" hasTimer":"")+'"><b>'+epgd.utils.formatTime(m.starttime)+"</b>&nbsp;&ndash;&nbsp;"+epgd.utils.formatTime(k)+" "+epgd.tr.oClock+(m.tipp?'<b class="tipp">'+m.tipp+"</b>":"")+"</div>"+(l>0&&l<=100?'<div class="progress"><div style="width: '+l+'%"></div></div>':'<div class="date">'+epgd.utils.formatDate(m.starttime,e)+"</div>")+'<div class="desc">'+(i&&m.imagecount?'<img src="'+i+m.id+'" />':"")+'<div class="title">'+m.title+(m.numrating?'<span class="rate rate'+m.numrating+'"> </span>':"")+"</div>"+(m.genre?"<span>"+m.genre+"</span> ":"")+(n?n.replace(/\n/g,"<br />"):"")+"</div></li>").appendTo(pages_now.$ul)});epgd.pages.now.timestamp_min=g;epgd.pages.now.timestamp_max=d;epgd.utils.loader.close()})},true)}};epgd.pages.profile={render:function(){var b=epgd.profile.startPage.slice(5),c="<option>"+epgd.tr.pages.timerList.namingModes.join("</option><option>")+"</option>",a='<form id="page_profile"><h3>Interface</h3><div><table><tr><td>startpage</td><td><select id="startPage">'+jQuery.map(epgd.tr.menu,function(e,d){return'<option value="menu_'+d+(b==d?'" selected="selected">':'">')+e+"</option>"}).join("")+'</select></td></tr><tr><td>default VDR</td><td><select id="defaultVDRuuid">'+$("#menu_vdrs").find("select").html()+'</select></td></tr><tr><td>datepicker first day</td><td><select id="pickerFirstDay"><option>'+epgd.tr.dateTimePicker.dayNames.join("</option><option>")+'</option></select></td></tr><tr><td>quicklinks</td><td><textarea rows="5" style="float:left;width:50%; margin-right:10px" id="quickTimes" onchange="epgd.pages.profile.validate.quickTimes(this)">'+epgd.profile.quickTimes.replace(/~/g,"\n")+'</textarea><span>enter in each line label=hh:mm(24h), eg:<br />prime time=20:15 or prime time=!20:15 (this time will not be highlighted in magazine)<br />now=@Now or next=@Next<br />tip=@searchtimerName</span></td></tr><tr><td>constabel-login</td><td><input type="text" class="full" id="constabelLoginPath" value="'+(epgd.profile.constabelLoginPath||"")+'" /><br />e.g.https://www.eplists.de/eplist.cgi?action=login&login=[username]&secret=[password]</td></tr><tr><td>'+epgd.tr.pages.profile.maxListEntries+'</td><td><input type="text" id="maxListEntries" value="'+epgd.profile.maxListEntries+'" data-valexp="^[1-9]{0,3}$" /></td></tr><tr><th colspan="2">'+epgd.tr.menu.magazine+"</th><tr><tr><td>"+epgd.tr.pages.profile.magazinePan+'</td><td><input type="text" id="magazinePan" value="'+epgd.profile.magazinePan+'" data-valexp="^[0-9]{1,2}$" /></td></tr><tr><td>'+epgd.tr.pages.profile.magazinePanDelay+'</td><td><input type="text" id="magazinePanDelay" value="'+epgd.profile.magazinePanDelay+'" data-valexp="^[1-9][0-9]{2,3}$" /></td></tr><tr><th colspan="2">'+epgd.tr.pages.timer.timerList+"</th><tr><tr><td>"+epgd.tr.pages.timerList.namingMode+"</td><td><b>"+epgd.tr.pages.eventDetail.scrapperSerieInfo+"</b><div>"+epgd.tr.pages.timer.timerList+': <select id="namingModeSerie">'+c+'</select><input id="namingModeSerieTemplate" value="'+epgd.profile.namingModeSearchSerieTemplate+'" type="text" style="width:90%" /></div><div>'+epgd.tr.pages.timer.searchTimerList+': <select id="namingModeSearchSerie">'+c+'</select><input id="namingModeSearchSerieTemplate" value="'+epgd.profile.namingModeSearchSerieTemplate+'" type="text" style="width:90%" /></div><b style="text-decoration:line-through">'+epgd.tr.pages.eventDetail.scrapperSerieInfo+"</b><div>"+epgd.tr.pages.timer.timerList+': <select id="namingModeMovie">'+c+'</select><input id="namingModeMovieTemplate" value="'+epgd.profile.namingModeMovieTemplate+'" type="text" style="width:90%" /></div><div>'+epgd.tr.pages.timer.searchTimerList+': <select id="namingModeSearchMovie">'+c+'</select><input id="namingModeSearchMovieTemplate" value="'+epgd.profile.namingModeSearchMovieTemplate+'" type="text" style="width:90%" /></div></td></tr><tr><td>'+epgd.tr.pages.timerList.chFormat+'</td><td><input id="chFormat" readonly onclick="epgd.timerEditChFormat(this)" value="'+epgd.profile.chFormat+'" /></td></tr><tr><td>VDR</td><td><select id="timerDefaultVDRuuid"><option value="">Auto</option>'+$("#menu_vdrs").find("select").html()+"</select></td></tr><tr><td>"+epgd.tr.pages.profile.mailReceiver+'</td><td><input type="mail" value="'+(epgd.profile.mailReceiver||"")+"\" id=\"mailReceiver\" /><button onclick=\"epgd.utils.sendMail('checkMailAddress','it works','',$(form.mailReceiver).val())\">"+epgd.tr.test+"</button></td></tr><tr><td>"+epgd.tr.pages.profile.sendMessages+"</td><td>"+jQuery.map(epgd.tr.pages.timerList.messageTypes,function(e,d){return'<input type="checkbox" value="'+d+'" name="messageMailTypes"'+(epgd.profile.messageMailTypes.indexOf(d)>=0?' checked="checked"':"")+" />"+e}).join("&nbsp;&nbsp;")+'</td></tr><tr><th colspan="2">'+epgd.tr.menu.search+"</th><tr><tr><td>"+epgd.tr.advanced+'</td><td><input type="checkbox" id="searchAdv" /></td></tr><tr><th colspan="2">VDR OSD</th><tr><tr><td>'+epgd.tr.pages.profile.vdr.startWithSched+'</td><td><input type="checkbox" id="startWithSched"'+(epgd.profile.startWithSched=="1"?' checked="checked"':"")+' /></td></tr><tr><th colspan="2">'+epgd.tr.menu.records+"</th><tr><tr><td>"+epgd.tr.pages.profile.record.subFolderSort+'</td><td><select id="recordSubFolderSort"><option value="1">'+epgd.tr.pages.eventDetail.title+' up</option><option value="2">'+epgd.tr.pages.eventDetail.title+' down</option><option value="3">'+epgd.tr.pages.timerList.folder+' up</option><option value="4">'+epgd.tr.pages.timerList.folder+' down</option><option value="5">'+epgd.tr.pages.timerList.recordTime+' up</option><option value="6">'+epgd.tr.pages.timerList.recordTime+" down</option></select></td></tr></table></div>";if((epgd.login.rights&epgd.rights.umConfigEdit)==epgd.rights.umConfigEdit){a+="<h3>System</h3><div></div>"}epgd.$con.html(a+'</form><br /><input type="button" value="'+epgd.tr.save+'" onclick="epgd.pages.profile.save()" class="ui-button ui-widget ui-state-default ui-corner-all">');this.form=$("#page_profile").tooltip().accordion({headers:"<h3>",collapsible:true,heightStyle:"content",activate:function(e,g){var d=g.newPanel[0];if(d&&!d.hasLoaded){d.hasLoaded=true;if(g.newHeader.text()=="System"){$(d).html('<table><tr><th colspan="2">'+epgd.tr.pages.login.label+"</th></tr><tr><td>"+epgd.tr.pages.login.needLogin+'</td><td><input type="checkbox" id="needLogin" /></td></tr></table>').find("#needLogin").click(function(){if(this.checked&&!this.hasUsers){this.checked=false;var h=this;epgd.ajax({url:epgd.login.url+"data/users",cache:false},function(l){var i=null,k,m;for(m in l.users){i=l.users[m];if(i.active){return(h.hasUsers=h.checked=true)}}k=$('<form title="'+epgd.tr.pages.editUser.user+" "+(i?i.user:epgd.tr.pages.editUser.add)+'"></form>');epgd.pages.editUser.showUser(i,k,function(){k.dialog("close");if(!i){h.hasUsers=h.checked=true}else{$(h).click()}});k.dialog({modal:true,width:"auto"})})}}).prop("checked",epgd.profile.needLogin=="1");epgd.ajax({url:epgd.login.url+"data/parameters",async:true,cache:false,dataType:"json"},function(n){var l="",k,q,r,m=epgd.tr.pages.profile.system,o=1,h=2;for(k in n.parameters){q=n.parameters[k];if(q.owner=="epgd"){l+="<tr><td>"+(m[q.name]||q.name)+"</td><td>";r=typeof q.value=="undefined"?q["default"]:q.value;if(q.type==o){r=epgd.utils.formatDateTime(r)}if(q.readonly){l+=r}else{l+='<input data-value="'+r+'" data-valexp="'+(q.valexp||"")+'" id="'+q.name+'"';if(q.type==h){l+=' type="checkbox"'+(r=="1"?" checked":"")}else{l+=' type="text" class="full" value="'+r+'"'}l+=" /></td></tr>"}}}l&&$(d).find("table").append('<tbody id="pSystem"><tr><th>'+m.label+'</th><th style="min-width:300px"></th></tr>'+l+"</tbody>")})}}}})[0];this.form.namingModeSerie.selectedIndex=epgd.profile.namingModeSerie;this.form.namingModeSearchSerie.selectedIndex=epgd.profile.namingModeSearchSerie;this.form.namingModeMovie.selectedIndex=epgd.profile.namingModeMovie;this.form.namingModeSearchMovie.selectedIndex=epgd.profile.namingModeSearchMovie;$([this.form.namingModeSerie,this.form.namingModeSearchSerie,this.form.namingModeMovie,this.form.namingModeSearchMovie]).change(function(){this.nextSibling.style.display=(this.selectedIndex==6)?"block":"none"}).change();epgd.utils.addPlaceholders(this.form.namingModeSerieTemplate,"%",epgd.tr.pages.timerList.templateFields);epgd.utils.addPlaceholders(this.form.namingModeSearchSerieTemplate,"%",epgd.tr.pages.timerList.templateFields);epgd.utils.addPlaceholders(this.form.namingModeMovieTemplate,"%",epgd.tr.pages.timerList.templateFields);epgd.utils.addPlaceholders(this.form.namingModeSearchMovieTemplate,"%",epgd.tr.pages.timerList.templateFields);$(this.form.quickTimes).one("focus",function(){var d=this;epgd.ajax({url:epgd.login.url+"data/searchtimers?type=S"},function(g){var e={"@Now":": current time","@Next":": next event"};$.each(g.searchtimers,function(i,h){e["@"+h.name||h.expression]=": saved timer"});epgd.utils.addPlaceholders(d,"@",e)})});this.form.searchAdv.checked=epgd.profile.searchAdv=="1";epgd.profile.defaultVDRuuid&&$(this.form.defaultVDRuuid).val(epgd.profile.defaultVDRuuid);$(this.form.timerDefaultVDRuuid).val(epgd.profile.timerDefaultVDRuuid);$(this.form.recordSubFolderSort).val(epgd.profile.recordSubFolderSort);this.form.pickerFirstDay.selectedIndex=(epgd.profile.pickerFirstDay||epgd.tr.dateTimePicker.firstDay)},save:function(){var d=epgd.profile,g=[],e=this.form,a="@"+epgd.login.user,b;function c(h){if(d[h.name]!=h.value){g.push(h)}}if(!this.validate.quickTimes(e.quickTimes)||!this.validate.checkRegex(e.magazinePan)||!this.validate.checkRegex(e.magazinePanDelay)){return false}c({name:"defaultVDRuuid",value:$(e.defaultVDRuuid).val()||"",owner:a});c({name:"quickTimes",value:e.quickTimes.value.replace(/\n/g,"~"),owner:a});c({name:"startWithSched",value:$(e.startWithSched).prop("checked")?"1":"0",owner:a});c({name:"pickerFirstDay",value:new String(e.pickerFirstDay.selectedIndex),owner:a});c({name:"startPage",value:$(e.startPage).val()||"",owner:a});c({name:"namingModeSerie",value:new String(this.form.namingModeSerie.selectedIndex),owner:a});c({name:"namingModeSearchSerie",value:new String(this.form.namingModeSearchSerie.selectedIndex),owner:a});c({name:"namingModeMovie",value:new String(this.form.namingModeMovie.selectedIndex),owner:a});c({name:"namingModeSearchMovie",value:new String(this.form.namingModeSearchMovie.selectedIndex),owner:a});c({name:"namingModeSerieTemplate",value:new String(this.form.namingModeSerieTemplate.value),owner:a});c({name:"namingModeSearchSerieTemplate",value:new String(this.form.namingModeSearchSerieTemplate.value),owner:a});c({name:"namingModeMovieTemplate",value:new String(this.form.namingModeMovieTemplate.value),owner:a});c({name:"namingModeSearchMovieTemplate",value:new String(this.form.namingModeSearchMovieTemplate.value),owner:a});c({name:"timerDefaultVDRuuid",value:$(e.timerDefaultVDRuuid).val()||"",owner:a});c({name:"constabelLoginPath",value:$(e.constabelLoginPath).val()||"",owner:a});c({name:"chFormat",value:$(e.chFormat).val()||"",owner:a});c({name:"searchAdv",value:$(e.searchAdv).prop("checked")?"1":"0",owner:a});c({name:"messageMailTypes",value:$(e.messageMailTypes).map(function(){return this.checked?this.value:""}).toArray().join(""),owner:a});c({name:"mailReceiver",value:$(e.mailReceiver).val()||"",owner:a});c({name:"magazinePan",value:$(e.magazinePan).val()||"",owner:a});c({name:"magazinePanDelay",value:$(e.magazinePanDelay).val()||"",owner:a});c({name:"maxListEntries",value:$(e.maxListEntries).val()||"",owner:a});c({name:"recordSubFolderSort",value:$(e.recordSubFolderSort).val()||"1",owner:a});b=$("#pSystem").parent().parent()[0];if(b&&b.hasLoaded){c({name:"needLogin",value:$(e.needLogin).prop("checked")?"1":"0",owner:"webif"});$("#pSystem input").each(function(){if(this.type=="checkbox"){if(this.checked!=(this.getAttribute("data-value")=="1")){g.push({name:this.id,value:(this.checked?"1":"0"),owner:"epgd",valexp:this.getAttribute("data-valexp")})}}else{if(this.getAttribute("data-value")!=this.value){if(epgd.pages.profile.validate.checkRegex(this)){g.push({name:this.id,value:this.value,owner:"epgd"})}else{g=[];return false}}}})}if(g.length){if(b){b.hasLoaded=false}b=$("#page_profile").accordion("option","active");$("#page_profile").accordion("option","active",false).accordion("option","active",b);epgd.ajax({url:epgd.login.url+"data/save-parameters",type:"post",data:JSON.stringify({parameters:g})},function(h){h=h.result;if(h&&h.state==200){epgd.utils.topInfo(epgd.tr.dataSaved)}else{epgd.utils.topInfo(h.message,{isError:1})}epgd.profile_load()},function(k){try{var i="";$(k.responseJSON.result.failed).each(function(){i+="<li>"+e[g[this].name].parentNode.previousSibling.innerHTML+"</li>"});if(i){epgd.utils.popup("<ol>"+i+"</ol>",{title:epgd.tr.error.invalid});return true}}catch(h){}return false})}},validate:{quickTimes:function(a){a.value=a.value.replace(/\n{2,}/g,"\n").replace(/^\n+|\n+$/g,"");if(!/^(\n?[^=]+=!?(([0-1]?[0-9]|2[0-4]):[0-5]?[0-9]|@Now|@Next|@[A-Za-z0-9]*))*$/.test(a.value)){a.focus();epgd.utils.popup(epgd.tr.error.invalid);return false}return true},checkRegex:function(a){if(a.getAttribute("data-valexp")&&!new RegExp(a.getAttribute("data-valexp")).test(a.value)){a.focus();epgd.utils.popup(epgd.tr.error.invalid);return false}return true}}};epgd.pages.records={render:function(){if(!(epgd.login.rights&epgd.rights.umRecordings)==epgd.rights.umRecordings){return epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}if(!epgd.profile.recordSubFolderSort){epgd.profile.recordSubFolderSort=1}$("#menu_records").addClass("menu-active");var a=epgd.tr.pages.records;if(!this.$bar){this.$bar=$('<div class="ui-widget ui-state-highlight ui-corner-all" style="padding:3px 10px"><button class="iAsButton i-trash" title="'+epgd.tr.del+'"/><div id="recBar"><button class="iAsButton i-refresh" onclick="epgd.pages.records.update()">'+epgd.tr.reload+"</button>"+epgd.pages.help.getIcon("recRefresh")+"&nbsp;&nbsp; "+epgd.tr.pages.search.search+epgd.pages.help.getIcon("recSearch")+'<button class="iAsButton" onclick="this.checked = !this.checked; $(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();">&nbsp;&#8727;</button><input id="rSVal" type="text" onkeyup="epgd.pages.records.search(this.value)" /><button class="iAsButton" onclick="this.checked = !this.checked;$(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();">&#8727;&nbsp;</button><span style="display:none"><button class="iAsButton i-rewind" onclick="epgd.pages.records.searchMove(1)"></button><span id="rSCnt">0</span><button class="iAsButton i-forward" onclick="epgd.pages.records.searchMove(-1)"></button></span>&nbsp;&nbsp; <input type="checkbox" id="dragdrop"'+($.support.touch?"":' checked="checked"')+' onchange="epgd.pages.records.dd(this.checked)" />'+a.ddLabel+epgd.pages.help.getIcon("recDD")+"</div></div>");this.$trash=this.$bar.find(".i-trash");this.curSearch={pattern:"",searchValue:"",hits:$(),cur:0,$count:this.$bar.find("#rSCnt"),fromStart:this.$bar.find("#rSVal").prev("button")[0],toEnd:this.$bar.find("#rSVal").next("button")[0]}}this.$bar.insertAfter(epgd.$menu);this.$trash.droppable({accept:".rec",hoverClass:"ui-state-hover",tolerance:"pointer",drop:function(c,d){var b=d.helper.context;epgd.utils.confirm(epgd.tr.pages.records.deleteMessage.replace("$src$",b.getAttribute("data-path")),function(e){e&&epgd.pages.records.del(b)});return false}}).click(function(){var b=$("#records").find(".rec.selected");b.length&&epgd.utils.confirm(epgd.tr.confirmDelete+(b.length>1?"<br />"+b.length+epgd.tr.entries:""),function(c){c&&b.each(function(){epgd.pages.records.del(this)})})});epgd.pages.help.initButtons(this.$bar);epgd.$menu.checkMenuSize();$(window).bind("epgd_close.records",function(){epgd.pages.records.$bar.remove();epgd.$menu.checkMenuSize();$(window).unbind(".records")});epgd.$con.html('<div id="records"></div>');epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/recordings",cache:false},function(x){var b=x.recordings,g,y,o,l,n,r,m={f:{},r:[]},d={},s,k,h="",q=" "+epgd.tr.minutes,u,e=epgd.profile.recordSubFolderSort==6?function(p,i){return p.starttime>i.starttime?-1:1}:epgd.profile.recordSubFolderSort==5?function(p,i){return p.starttime>i.starttime?1:-1}:epgd.profile.recordSubFolderSort==4?function(p,i){return p.path>i.path?-1:1}:epgd.profile.recordSubFolderSort==3?function(p,i){return p.path>i.path?1:-1}:epgd.profile.recordSubFolderSort==2?function(p,i){return p.tit>i.tit?-1:1}:function(p,i){return p.tit>i.tit?1:-1};for(s in epgd.vdrs.list){k=epgd.vdrs.list[s];if(!k.usecommonrecfolder){d[s]={f:{},r:[]}}h+="<div>VDR - "+k.name+": "+k.videodir+" - "+parseInt(k.videofree/1000,10)+" GB "+a.available+" / "+parseInt(k.videototal/1000,10)+" GB</div>"}if(!$("#dragdrop").parent().length){return false}epgd.$con.find("#records").before(h);h="";for(r in b){g=b[r];l=d[g.vdruuid]||m;o=g.path.split("/");o.pop();for(n=0;n<o.length;n++){y=o[n].replace(/_/g," ");l=l.f[y]||(l.f[y]={f:{},r:[]})}l.r.push(g)}function w(z){var i=false,v,p;z.cnt=0;for(v in z.f){p=z.f[v];if(p.r.length==1){z.r.push(p.r.pop())}w(p);if(w(p)){i=true;z.cnt+=p.cnt}else{delete z.f[v]}}if(!i){delete z.f}z.cnt+=z.r.length;return i||z.r.length>0}function c(i){Object.keys(i.f).sort().forEach(function(v){var t=i.f[v],p;h+=v?'<div class="folder"><h4><span class="i-folder-closed">('+(t.cnt)+')</span><m class="i-"/>'+v+"</h4>":"<div>";t.f&&c(t);if(t.r.length){for(p in t.r){g=t.r[p];g.tit=((g.name!=v?g.name:"")+(v!=g.title&&(g.title!=g.name)?"<br />"+g.title:"")+(g.shorttext&&(g.shorttext!=g.name)?"<i>"+g.shorttext+"</i>":""))||v;g.html='<div class="rec" data-start="'+g.starttime+'" data-owner="'+(g.owner||"")+'" data-md5="'+g.md5path+'" data-path="'+g.path+'"><em>'+epgd.utils.formatDateTime(g.starttime)+"</em><u>"+parseInt(g.duration/60,10)+q+"</u><b>"+g.tit+"</b></div>"}t.r.sort(e);for(p in t.r){h+=t.r[p].html}}h+="</div>"})}n={};if(w(m)){n[a.commonRecFolder]=m}for(s in d){l=d[s];if(w(l)){n["VDR - "+epgd.vdrs.list[s].name]=l}}c({f:n});u=epgd.$con.find("#records").html(h);if(!u.length){return false}u=u.click(epgd.pages.records.action).find(">div");if(u.length==1){u.first().toggleClass("open")}epgd.pages.records.$menu=$('<ul class="ui-menu ui-widget ui-widget-content" style="position:absolute"><li class="ui-menu-item" data-type="title"><a class="iAsButton i-sort-name-up" data-sort="1"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="2"></a>&nbsp;'+epgd.tr.pages.eventDetail.title+'</li><li class="ui-menu-item" data-type="path"><a class="iAsButton i-sort-name-up" data-sort="3"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="4"></a>&nbsp;'+epgd.tr.pages.timerList.folder+'</li><li class="ui-menu-item" data-type="start"><a class="iAsButton i-sort-name-up" data-sort="5"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="6"></a>&nbsp;'+epgd.tr.pages.timerList.recordTime+"</li></ul>").hide().appendTo(epgd.$con);$("#dragdrop").change();epgd.pages.records.curSearch.$recs=null;epgd.utils.loader.close()})},true)},search:function(e){var c=this.curSearch,h,b,d,a=c.fromStart.checked,g=c.toEnd.checked;if(!c.$recs){c.$recs=epgd.$con.find("#records .rec,h4")}if(typeof e=="string"){c.searchValue=e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}d=(a?">"+c.searchValue:c.searchValue).toLowerCase()+(g?"<":"");if(d==c.pattern){return}h=c.searchValue.length;b=c.$recs;if(c.hits.length){$(c.hits).each(function(){this.innerHTML=this.innerHTML.replace(/<mark>([^<]+)<\/mark>/gi,"$1")}).parents(".tmp-open").removeClass("tmp-open");if(d.indexOf(c.pattern)==0){b=$(c.hits)}else{c.cur=0}c.hits=[]}else{c.cur=0}c.pattern=d;if(h>2){b.each(function(){var i=this.innerHTML.toLowerCase().indexOf(d);if(i>0){c.hits.push(this);$(this).parents(".folder").addClass("tmp-open");do{if(a){i++}this.innerHTML=this.innerHTML.slice(0,i)+"<mark>"+c.searchValue+"</mark>"+this.innerHTML.slice(i+h)}while((i=this.innerHTML.toLowerCase().indexOf(d,i+13))>0)}});c.$count.text(c.hits.length).parent().show();this.searchMove(0)}else{c.$count.parent().hide()}},searchMove:function(a){this.curSearch.cur+=a;var b=this.curSearch.hits[this.curSearch.cur];if(!b){this.curSearch.cur=a<0?this.curSearch.hits.length-1:0;b=this.curSearch.hits[this.curSearch.cur]}if(b){b.scrollIntoView(false);$(b).css({"background-color":"green"});window.setTimeout(function(){$(b).css({"background-color":""})},1500)}},action:function(b){var a=b.target;if(a.nodeName=="MARK"){a=a.parentNode}if(a.nodeName=="M"){epgd.pages.records.$menu.show().position({my:"left top",at:"left bottom",of:a}).find("a").removeClass("ui-state-highlight");epgd.pages.records.$menu.find("a[data-sort="+(a.curSort||epgd.profile.recordSubFolderSort)+"]").addClass("ui-state-highlight");$(document).one("click.recmenu",function(d){if(d.target.nodeName=="A"){var c=d.target.parentNode.getAttribute("data-type");if(c){a.curSort=d.target.getAttribute("data-sort");epgd.pages.records.sort(a.parentNode.parentNode,a.curSort)}}epgd.pages.records.$menu.hide();$(document).unbind(".recmenu")}).bind("keyup.recmenu",function(c){if(c.keyCode==27){$(document).trigger("click.recmenu")}});return false}if(a.nodeName=="I"||a.nodeName=="SPAN"){a=a.parentNode}if(a.nodeName=="B"){a=a.parentNode;if(!a.recDetail){a.recDetail=new epgd.recordDetail(a)}epgd.utils.loader.process(function(){a.recDetail.render()})}else{if(a.nodeName=="H4"){a=a.parentNode;if(a.nodeName=="DIV"&&a.className.indexOf("folder")>=0){if(a.className.indexOf("open")==-1){if($(window).width()<500){$(a).siblings(".open").removeClass("open");document.body.scrollTop=$(a).offset().top-35}$(a).addClass("open")}else{$(a).removeClass("open")}}}else{$(a).closest(".rec").toggleClass("selected")}}},dd:function(b){var c=$("#records"),a=c.find(".rec").has(".ui-draggable");if(b&&a.length==0){c.find("h4").droppable(this.__dropSettings);a.end().draggable({cancle:"b",revert:"invalid",distance:15,helper:function(){return $(this).clone().css("display","block")},appendTo:"body",cursor:"pointer",cursorAt:{left:-15,top:5},start:function(d,e){$(document).trigger("click.recmenu");$(document.body).addClass("dd-open");document.body.style.paddingTop=epgd.pages.records.$bar.height()+"px";document.body.scrollTop-=d.pageY-$(d.delegateTarget).closest(".folder").offset().top},stop:function(d,e){$(document.body).removeClass("dd-open");epgd.$menu.checkMenuSize()}})}else{if(a.length){a.draggable(b?"enable":"disable")}}},__dropSettings:{accept:".rec",hoverClass:"ui-state-hover",tolerance:"pointer",drop:function(b,c){console.log("Dropped!",b,c);var a=$(b.target),d="";do{d=a.text().replace(/^\(.*\)/,"")+"/"+d;a=a.parent()}while((a=a.prevAll("h4")).length);epgd.pages.records.move(c.draggable.context,d.slice(d.indexOf("/",2)+1).replace(/ /g,"_"),b.target.parentNode);return false}},update:function(){epgd.ajax({url:epgd.login.url+"data/updaterecordings"},function(a){epgd.utils.topInfo(epgd.tr.pages.records.refreshMessage.replace("$sec$",5),{autoClose:5000});$(window).trigger("epgd_close.records");window.setTimeout(function(){epgd.pages.records.render()},5000)})},move:function(e,h,d){var g=e.getAttribute("data-path").split("/"),b=g.pop(),c,a=0;g=g.join("/")+"/";for(c=0;c<Math.min(h.length,g.length)&&h[c]==g[c];c++){if(h[c]=="/"){a=c}}g=window.prompt(epgd.tr.pages.records.moveMessage.replace("$src$",g),h.concat(g.slice(a)).replace(/\/{2,}/g,"/").replace(/\/$/,""));if(g){epgd.ajax({url:epgd.login.url+"data/renamerecording?starttime="+e.getAttribute("data-start")+"&md5path="+e.getAttribute("data-md5")+"&owner="+e.getAttribute("data-owner")+"&name="+g.replace(/\//g,"~"),async:true},function(n){n=n.result;if(n&&n.state==200){var k=$(e),p=k.prevAll("h4").find("span"),o=$(d),m=g.split("/"),l;k.attr("data-path",g+"/"+b);k.attr("data-md5","").draggable("disable").addClass("ui-state-disabled");m.shift();k.parents(".folder:not(:last)").find(">h4>span").each(function(){this.innerHTML="("+(parseInt(this.innerHTML.slice(1,-1),10)-1)+")"});p=o.find("span");p.text("("+(parseInt(p.text().slice(1,-1),10)+1)+")");for(l=0;l<m.length;l++){if(o.find(">.folder>h4").each(function(){if(this.lastChild.nodeValue==m[l]){o=$(this.parentNode);p=o.find("span");p.text("("+(parseInt(p.text().slice(1,-1),10)+1)+")");return true}else{return false}}).length==0){for(;l<m.length;l++){o=$('<h4><span class="i-folder-closed">(1)</span><m class="i-"/>'+m[l]+"</h4></div>").droppable(epgd.pages.records.__dropSettings).wrap('<div class="folder open"></div>').parent().appendTo(o)}}}k.appendTo(o);epgd.pages.records.sort(d);epgd.utils.topInfo(epgd.tr.dataSaved);epgd.pages.records.__updateRec(e)}else{epgd.utils.topInfo(n.message,{isError:1});return false}})}return !!g},__updateRec:function(b,a){epgd.ajax({url:epgd.login.url+"data/recording?starttime="+b.getAttribute("data-start")+"&path="+b.getAttribute("data-path")+"&owner="+b.getAttribute("data-owner")+"&"+a,async:true},function(c){$(b).attr("data-md5",c.recording.md5path).draggable("enable").removeClass("ui-state-disabled")},function(d,c){if(!a){a=0}else{if(a>=5){return epgd.utils.popup(epgd.tr.pages.records.notFoundMessage,{title:epgd.tr.error.error})}}window.setTimeout(epgd.pages.records.__updateRec,3000,b,++a);return true})},del:function(a){epgd.ajax({url:epgd.login.url+"data/deleterecording?starttime="+a.getAttribute("data-start")+"&md5path="+a.getAttribute("data-md5")+"&owner="+a.getAttribute("data-owner"),async:true},function(b){b=b.result;if(b&&b.state==200){epgd.utils.topInfo(a.getAttribute("data-path")+"<br />"+epgd.tr.dataSaved);$(a).parents(".folder:not(:last)").find(">h4>span").each(function(){this.innerHTML="("+(parseInt(this.innerHTML.slice(1,-1),10)-1)+")"});$(a).remove()}else{epgd.utils.topInfo(a.getAttribute("data-path")+"<br />"+b.message,{isError:1})}})},sort:function(a,d){var e=$(a).find(">div.rec"),b=d%2?1:-1,c;if(!d){d=$(">h4>m",a)[0].curSort||epgd.profile.recordSubFolderSort}if(d<3){e.sort(function(h,g){return h.lastChild.innerHTML>g.lastChild.innerHTML?b:-b}).appendTo(a)}else{c=d<5?"data-path":"data-start";e.sort(function(h,g){return h.getAttribute(c)>g.getAttribute(c)?b:-b}).appendTo(a)}$(a).find(">div.folder").each(function(){epgd.pages.records.sort(this,d)})}};epgd.sortTable=function(a){this.o=$.extend({conSel:epgd.$con,empty:"",right:1},a)};epgd.sortTable.prototype={sortIcons:'<span class="iAsButton i-sort-name-down sort"></span><span class="iAsButton i-sort-name-up sort"></span>',update:function(){},hideHead:function(){var a=this.$con.find("thead:first").hide().find(">tr>th");this.$con.find("tbody:first").html('<tr><td colspan="'+a.length+'">'+this.o.empty+(a.last().find(".i-doc-new").wrapAll("<div />").parent().html()||"")+"</td></tr>")},showHead:function(){this.$con.find(">table>thead").show();this.filter();this.sort()},getTable:function(){},action:function(a,c,b){switch(c){case"refresh":this.update();break;case"detail":if(!a[0].eventDetail){a[0].eventDetail=new epgd.eventDetail(b)}epgd.utils.loader.process(function(){a[0].eventDetail.render()});break}},render:function(a,b){this.trs=[];this.$con=a||$(this.o.conSel);this.$con.empty();if(!(epgd.login.rights&this.o.right)==this.o.right){return epgd.utils.popup(epgd.tr.error.forbidden,{title:epgd.tr.error.error})}this.$con.html(this.getTable());this.init();this.update(b)},init:function(){var b=this,a=0;this.$con.find(">table").click(function(h){var e=$(h.target),g=e[0],i=g.getAttribute("data-evId"),k,c;if(i){b.action(e,"detail",i)}else{if(h.target.className=="i-tv"){epgd.vdrs.current.switchChannel(h.target.parentNode.id)}else{e=e.closest("span.sort");if(e.length){e.parent().parent().find(".ui-state-highlight").removeClass("ui-state-highlight");e.addClass("ui-state-highlight");b.sort(e)}else{e=$(g).closest("span.edit");if(e.length){b.action(e,e[0].className.match(/i-([a-z0-9-]+)/)[1])}if(b.o.selectable){if(g.nodeName=="TD"){e=$(g).parent().toggleClass("selected");if(h.shiftKey&&this.lastSel){c=$(this.lastSel);k=e.index()-c.index();if(k>0){c.nextAll(":lt("+k+"):visible").toggleClass("selected",c.hasClass("selected"))}else{c.prevAll(":lt("+-k+"):visible").toggleClass("selected",c.hasClass("selected"))}}else{this.lastSel=e[0]}}else{if(g.nodeName=="B"){k=g.getAttribute("data-t");$(b.trs).filter(":visible").toggleClass("selected",k==1?true:k==0?false:undefined);return false}}}}return false}}}).find(">thead>tr").find(">th").each(function(){this.cIndex=a;a+=this.colSpan}).end().find('[data-defaultSort="1"]>span.sort:last,[data-defaultSort="-1"]>span.sort:first').addClass("ui-state-highlight");this.$con.find(">table>thead input.filter").keyup(function(){b.filter()}).each(function(){if(!this.result){this.result=$('<i style="padding-left:5px;font-weight:normal"></i>').insertAfter(this)[0]}})},sort:function(e){e=e||this.$con.find(">table>thead .ui-state-highlight");if(!e.length){return}var c=e.parent()[0],g=(e.hasClass("i-sort-name-down")?-1:1),a=this.trs,b,h;if(!c.sortInfo){c=c.cIndex;for(b=0;b<a.length;b++){h=a[b].cells[c];h.sort=h.getAttribute("data-sort")||$(h).text().toLowerCase()}}else{c=c.cIndex}a.sort(function(i,d){var l=i.cells[c].sort,k=d.cells[c].sort;return(l>k?1*g:l==k?0:-1*g)});this.$con.find(">table>tbody").append(a.slice())},filter:function(){var b={},a,d,e,c;this.$con.find(">table>thead input.filter").each(function(){if(this.value){b[this.parentNode.cIndex]=[this.value.toLowerCase(),0,this.result||{}]}else{if(this.result){this.result.innerHTML=""}}});for(a=0;a<this.trs.length;a++){e=this.trs[a];c="";for(d in b){if(e.cells[d].innerHTML.toLowerCase().indexOf(b[d][0])==-1){c="none"}else{b[d][1]++}}e.style.display=c}for(d in b){if(b[d][2].innerHTML=b[d][1]){}}}};epgd.timerEditChFormat=function(c){var a=",SD,HD,3D",b=c.value,d;if(b){b=b.split(",");for(d=0;d<b.length;d++){a=a.replace(","+b[d]+",",",")}}$('<div title="'+epgd.tr.pages.timerList.chFormat+'"><ol style="float:left; border:2px inset #ddd; min-height:50px; margin-right:20px;">'+(b.length?"<li>"+b.join("</li><li>")+"</li>":"")+'</ol><ul style="float:left; border:2px inset #ddd; min-height:50px;list-style-type:none">'+(a.length>1?"<li>"+a.slice(1).replace(/,/g,"</li><li>")+"</li>":"")+"</div>").dialog({modal:true,buttons:[{text:epgd.tr.apply,click:function(){var e="";$(this).find("ol > li").each(function(){e+=","+this.innerHTML});c.value=e.slice(1);$(this).dialog("close")}},{text:epgd.tr.cancel,click:function(){$(this).dialog("close")}}]}).find("ul,ol").sortable({connectWith:"ul,ol"}).disableSelection()};epgd.timerListBase=epgd.utils.inherits(function(a,b){this.dialog=b;if(this.dialog){this.dialog.list=this}if(!a.conSel){a.conSel="#content"}if(!a.empty){a.empty=epgd.tr.pages.timerList.empty}epgd.sortTable.call(this,a)},epgd.sortTable);epgd.timerListBase.prototype.getTable=function(){var a=epgd.tr.pages.timerList;return'<table id="timerList" class="timerTable"><thead><tr><th style="min-width:120px">'+epgd.tr.channel+this.sortIcons+'</th><th></th><th data-defaultSort="1" colspan="2">'+a.startTime+this.sortIcons+' <input type="text" class="filter" style="width:50px" /></th><th>'+a.endTime+'</th><th style="min-width:120px">'+epgd.tr.pages.eventDetail.title+this.sortIcons+' <input type="text" class="filter" style="width:100px" /></th><th style="min-width:120px">VDR'+this.sortIcons+' <input type="text" class="filter" style="width:50px" /></th><th style="min-width:130px">'+this.sortIcons+(this.o.addNew?'<span class="iAsButton i-doc-new edit" title="'+a.newTimer+'"></span><span class="iAsButton i-refresh edit" title="'+epgd.tr.reload+'"></span>':"")+(this.o.selectable?'<br clear="all" /><span style="margin-top:3px" class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span><div class="selMarkBlock" style="width:auto"><b title="'+epgd.tr.markAll+'" class="selected" data-t="1"></b><b title="'+epgd.tr.markNone+'" data-t="0"></b><b title="'+epgd.tr.markToggle+'"><b class="selected"></b></b></div>':"")+"</th></tr></thead><tbody></tbody></table>"};epgd.timerListBase.prototype.update=function(){var a=this;epgd.utils.loader.process(function(){a.$con.find("tbody").empty();epgd.ajax({url:epgd.login.url+a.o.updateUrl,async:false,cache:false},function(h){if(!h.timers.length){a.hideHead()}else{var b=[],k=a.editIcons,i="DF",g={D:'<div class="i-trash">'+epgd.tr.pages.timerList.timerStates.D+"</div>",E:'<div class="i-warning">'+epgd.tr.pages.timerList.timerStates.E+"</div>",F:'<div class="i-ok">'+epgd.tr.pages.timerList.timerStates.F+"</div>",R:'<div class="i-progress">'+epgd.tr.pages.timerList.timerStates.R+"</div>",P:'<div class="i-clock">'+epgd.tr.pages.timerList.timerStates.P+"</div>",U:'<div class="i-help">'+epgd.tr.pages.timerList.timerStates.U+"</div>"},d={V:"i-tv",R:"i-record",S:"i-search"},e=epgd.tr.pages.timerList.timerActions,c='<span class="iAsButton i-flashlight edit" title="'+epgd.tr.pages.timer.searchTimerList+" "+epgd.tr.edit+'" data-id="$id$">$title$</span>';$.each(h.timers,function(o,l){l.action=l.action?l.action.toUpperCase():"A";l.state=l.state?l.state.toUpperCase():"U";var n=epgd.vdrs.list[l.vdruuid]||{name:"--"},m=$("<tr"+(l.active?"":' class="ui-state-disabled"')+"><td>"+epgd.channels.getHtml(l.channelid)+"</td><td>"+(l.action!="A"?'<div class="i-wait">'+e[l.action]+"</div>":g[l.state])+(l.info||"")+'</td><td data-sort="'+new String(l.day)+new String(10000+l.starttime).slice(1)+'">'+(l.day?epgd.utils.formatDate(l.day):"-")+"</td><td>"+new String(100+parseInt(l.starttime/100,10)).slice(1)+":"+new String(100+parseInt(l.starttime%100,10)).slice(1)+"</td><td>"+new String(100+parseInt(l.endtime/100,10)).slice(1)+":"+new String(100+parseInt(l.endtime%100,10)).slice(1)+"</td><td"+(l.eventid?' data-evId="'+l.eventid+'" class="'+d[l.type]+'">'+(l.title||"")+"<br />"+(l.shorttext||""):">")+"</td><td>"+n.name+"<br />"+(l.directory?l.directory+"~":"")+(l.file||"")+"</td><td>"+(l.autotimerid?c.replace("$id$",l.autotimerid).replace("$title$",l.autotimername||l.expression||epgd.tr.pages.timer.searchTimerList):"")+(i.indexOf(l.state)==-1?k:"")+"</td></tr>")[0];m.tData=l;b.push(m)});a.trs=b;a.showHead()}epgd.utils.loader.close();$(window).trigger("timerlist_updated",a)})},true)};epgd.timerListBase.prototype.action=function(a,d,b){var c;switch(d){case"edit":case"doc-new":this.dialog.render(a.closest("tr")[0].tData);break;case"trash":this.del(this.getSelectedIds(a));break;case"flashlight":c=a.attr("data-id"),list=this;$(window).one("searchTimerList_updated",function(){list.$con.find("tbody>tr").each(function(){if(this.tData.id==c){epgd.pages.searchTimerList.dialog.render(this.tData);return false}})});epgd.$menu.menu("select",{target:"#menu_searchTimerList"});break;default:epgd.sortTable.prototype.action.call(this,a,d,b)}};epgd.timerListBase.prototype.editIcons='<span class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span><span class="iAsButton i-edit edit" title="'+epgd.tr.edit+'"></span>';epgd.timerListBase.prototype.getSelectedIds=function(a){var b=[];if(a[0].parentNode.nodeName=="TH"){$(this.trs).filter(".selected:visible").each(function(){b.push(this.tData.id)})}else{b.push(a.closest("tr")[0].tData.id)}return b};epgd.timerListBase.prototype.del=function(c,d,e){var b=this,a=$.isArray(c)?c:[parseInt(c,10)];c&&a.length&&epgd.utils.confirm(epgd.tr.confirmDelete+(a.length>1?"<br />"+a.length+epgd.tr.entries:""),function(g){g&&b.saveArray(a,e||"delete",d)})};epgd.timerListBase.prototype.saveArray=function(c,g,e){var b=this,a=$.isArray(c)?c:[parseInt(c,10)],d={};d[g]=a;c&&a.length&&this.save(d,null,function(k){try{var h=",";$(k.responseJSON.result.failed).each(function(){h+=a[this]+","});if(h.length>1){$(b.trs).each(function(){if(h.indexOf(","+this.tData.id+",")>=0){this.style.backgroundColor="red"}})}}catch(i){}return false},e)};epgd.timerListBase.prototype.save=function(d,b,a,c){if(!d){return false}var e=this;epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+(b||e.o.saveUrl),type:"post",data:JSON.stringify(d)},function(g){g=g.result;if(g.state==200){epgd.utils.topInfo(epgd.tr.dataSaved)}else{epgd.utils.topInfo(g.message,{isError:1})}epgd.utils.loader.close();e.$con&&e.$con.parent().length&&e.update();c&&c.call(e)},a)},true);return true};epgd.searchResultList=epgd.utils.inherits(function(a,b){epgd.timerListBase.call(this,$.extend({saveUrl:"data/save-searchtimer"},a),b)},epgd.timerListBase);epgd.searchResultList.prototype.getTable=function(){var a=epgd.tr.pages.timerList;return'<table id="searchResultList" class="timerTable"><thead><tr><th style="min-width:120px">'+epgd.tr.channel+this.sortIcons+'</th><th data-defaultSort="1" colspan="2">'+a.startTime+this.sortIcons+"</th><th>"+a.endTime+"</th><th>"+epgd.tr.pages.eventDetail.title+this.sortIcons+"</th><th></th></tr></thead><tbody></tbody></table>"};epgd.searchResultList.prototype.update=function(b){if(!b){return false}var a=this;b.id&&delete b.id;b.name&&delete b.name;b.max=epgd.profile.maxListEntries;epgd.utils.loader.process(function(){a.$con.find("tbody").empty();epgd.ajax({url:epgd.login.url+"data/search",type:"post",data:JSON.stringify(b)},function(e){var c=[],d;if(!e.events||!e.events.length){a.hideHead()}else{e.count>b.max&&epgd.utils.popup("Achtung! Es wurden "+e.count+" Ergebnisse gefunden. Angezeigt werden aber nur "+b.max+".<br /> Das Nachladen ist noch nicht implementiert! Der Wert kann in den Einstellungen angepasst werden");$.each(e.events,function(l,h){var k="",g="",i;if(h.dones){for(d in h.dones){i=h.dones[d];g+='<span class="iAsButton" title="'+epgd.tr.pages.timerList.doneStates[i.state]+" data-id="+i.id+'">'+i.state+"</span>";if(i.state=="R"){k=' class="ui-state-disabled"'}}}c.push($("<tr"+k+"><td>"+epgd.channels.getHtml(h.channelid)+'</td><td data-sort="'+h.starttime+'">'+epgd.utils.formatDate(h.starttime)+"</td><td>"+epgd.utils.formatTime(h.starttime)+"</td><td>"+epgd.utils.formatTime(h.starttime+h.duration)+'</td><td data-evId="'+h.id+'">'+h.title+"<br />"+(h.shorttext||"")+"</td><td>"+g+"</td></tr>").tooltip()[0])});a.trs=c;a.showHead()}epgd.utils.loader.close();a.dialog&&a.dialog.resize&&window.setTimeout(function(){a.dialog.resize()},100)})},true)};epgd.searchTimerTimerList=epgd.utils.inherits(function(a,b){epgd.timerListBase.call(this,$.extend({saveUrl:"data/save-timer",updateUrl:"data/timers?state=P,R"},a),b)},epgd.timerListBase);epgd.searchTimerTimerList.prototype.getTable=function(){var a=epgd.tr.pages.timerList;return'<table class="timerTable"><thead><tr><th>'+epgd.tr.channel+this.sortIcons+'</th><th data-defaultSort="1" colspan="2">'+a.startTime+this.sortIcons+"</th><th>"+a.endTime+"</th><th>"+epgd.tr.pages.eventDetail.title+this.sortIcons+"</th><th>VDR"+this.sortIcons+"</th><th></th></tr></thead><tbody></tbody></table>"};epgd.searchTimerTimerList.prototype.update=function(b){if(!b){return false}var a=this;epgd.utils.loader.process(function(){a.$con.find("tbody").empty();epgd.ajax({url:epgd.login.url+a.o.updateUrl+"&autotimerid="+b.id,async:true,cache:false},function(d){var c=[],e='<span class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span>';if(!d.timers.length){a.hideHead()}else{$.each(d.timers,function(k,g){var i=epgd.vdrs.list[g.vdruuid]||{name:"--"},h=$("<tr"+(g.active?"":' class="ui-state-disabled"')+"><td>"+epgd.channels.getHtml(g.channelid)+'</td><td data-sort="'+new String(g.day)+new String(10000+g.starttime).slice(1)+'">'+(g.day?$.datepicker.formatDate(epgd.tr.dateTimePicker.dateFormat,epgd.utils.date(g.day)):"-")+"</td><td>"+new String(100+parseInt(g.starttime/100,10)).slice(1)+":"+new String(100+parseInt(g.starttime%100,10)).slice(1)+"</td><td>"+new String(100+parseInt(g.endtime/100,10)).slice(1)+":"+new String(100+parseInt(g.endtime%100,10)).slice(1)+"</td><td"+(g.eventid?' data-evId="'+g.eventid+'">'+g.title+"<br />"+(g.shorttext||""):">")+"</td><td>"+i.name+"<br />"+g.file+"</td><td>"+e+"</td></tr>")[0];h.tData=g;c.push(h)});a.trs=c;a.showHead()}a.dialog&&a.dialog.resize&&window.setTimeout(function(){a.dialog.resize()},100);epgd.utils.loader.close()})})};epgd.pages.timerList=new epgd.timerListBase({updateUrl:"data/timers?state=P,R",saveUrl:"data/save-timer",selectable:true,addNew:true,right:epgd.rights.umTimer},new epgd.timerDialog());epgd.pages.timersDone=new epgd.timerListBase({updateUrl:"data/timers?state=D,F,E&action=A",right:epgd.rights.umTimer});epgd.pages.timersDone.getTable=function(){return epgd.timerListBase.prototype.getTable.call(this).replace('data-defaultSort="1"','data-defaultSort="-1"')};epgd.pages.timerListDone=new epgd.timerListBase({updateUrl:"data/donetimers",saveUrl:"data/store-donetimers",selectable:true,right:epgd.rights.umTimer});epgd.pages.timerListDone.getTable=function(){return'<table id="timerListDone" class="timerTable"><thead><tr><th style="min-width:120px"><input type="text" class="filter" style="width:40px" />'+this.sortIcons+'</th><th data-defaultSort="-1" style="min-width:180px">'+epgd.tr.pages.timerList.recordTime+this.sortIcons+"</th><th>"+epgd.tr.pages.eventDetail.title+' <input type="text" class="filter" />'+this.sortIcons+'</th><th style="min-width:120px">'+epgd.tr.channel+this.sortIcons+'</th><th style="min-width:100px">'+this.sortIcons+'<span style="margin-top:3px" class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span><div class="selMarkBlock" style="width:auto"><b title="'+epgd.tr.markAll+'" class="selected" data-t="1"></b><b title="'+epgd.tr.markNone+'" data-t="0"></b><b title="'+epgd.tr.markToggle+'"><b class="selected"></b></b></div></th></tr></thead><tbody></tbody></table>'};epgd.pages.timerListDone.action=function(a,c,b){if(c=="detail"&&!a[0].eventDetail){a[0].eventDetail=new epgd.doneTimerDetail(a.parent()[0])}epgd.timerListBase.prototype.action.call(this,a,c,b)};epgd.pages.timerListDone.stateIcons={D:'<div class="i-trash">'+epgd.tr.pages.timerList.doneStates.D+"</div>",F:'<div class="i-warning">'+epgd.tr.pages.timerList.doneStates.F+"</div>",f:'<div class="i-warning">'+epgd.tr.pages.timerList.doneStates.f+"</div>",R:'<div class="i-ok">'+epgd.tr.pages.timerList.doneStates.R+"</div>",C:'<div class="i-buffer">'+epgd.tr.pages.timerList.doneStates.C+"</div>",Q:'<div class="i-clock">'+epgd.tr.pages.timerList.doneStates.Q+"</div>"};epgd.pages.timerListDone.update=function(){var a=this;epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+a.o.updateUrl,async:false,cache:false},function(h){a.$con.find("tbody").empty();if(!h.donetimers.length){a.hideHead()}else{var b=[],g,e,d,c='<span class="iAsButton i-flashlight edit" title="'+epgd.tr.pages.timer.searchTimerList+" "+epgd.tr.edit+'" data-id="$id$">$title$</span>';for(e in h.donetimers){d=h.donetimers[e];g=$("<tr><td>"+(d.state&&a.stateIcons[d.state]||"")+'</td><td data-sort="'+d.starttime+'">'+epgd.utils.formatDateTime(d.starttime)+"<br />"+parseInt(d.duration/60,10)+" "+epgd.tr.minutes+'</td><td data-evId="'+d.id+'">'+(d.title||"")+"<br />"+(d.shorttext||"")+'</td><td data-sort="'+d.channelid+'">'+epgd.channels.getHtml(d.channelid)+'</td><td><span class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span>'+(d.autotimerid?c.replace("$id$",d.autotimerid).replace("$title$",d.autotimername||d.expression||epgd.tr.pages.timer.searchTimerList):"")+"</td></tr>")[0];g.tData=d;b.push(g)}a.trs=b;a.showHead()}epgd.utils.loader.close();$(window).trigger("timerlist_updated",a)})},true)};epgd.pages.timerJobList=new epgd.timerListBase({updateUrl:"data/timers?notaction=A",saveUrl:"data/delete-timerjobs",selectable:true,right:epgd.rights.umTimer},new epgd.timerDialog());epgd.pages.searchTimerList=new epgd.timerListBase({saveUrl:"data/save-searchtimer",right:epgd.rights.umSearchTimer},new epgd.searchTimerDialog());epgd.pages.searchTimerList.getTable=function(){var a=epgd.tr.pages.timerList;return'<table id="timerSearchList" class="timerTable"><thead><tr><th data-defaultSort="1">'+epgd.tr.pages.search.searchName+"/"+epgd.tr.pages.search.searchExpression+' <input type="text" class="filter" />'+this.sortIcons+"</th><th>hits"+this.sortIcons+'</th><th style="min-width:120px">VDR'+this.sortIcons+'</th><th><span class="iAsButton i-doc-new edit" title="'+a.newTimer+'"></span><span class="iAsButton i-refresh edit" title="'+epgd.tr.reload+'"></span><span class="iAsButton i-link-ext edit" title="'+a.searchTimerReload+'"></span></th></tr></thead><tbody></tbody></table>'};epgd.pages.searchTimerList.action=function(c,e,d){epgd.timerListBase.prototype.action.call(this,c,e,d);switch(e){case"link-ext":this.triggerUpdate();break;case"down-dir":if(!c[0].tList){var b={$td:c.parent().css("position","relative"),tdHeight:c.parent().outerHeight()+10,data:c.parent().parent()[0].tData,resize:function(){var g=this.list.$con.find(">table").addClass("sub");g.width(this.$td.parent().outerWidth());this.$td.height(this.tdHeight+g.outerHeight(true)+10)},toggle:function(g){this.list.$con.toggle(g);if(g){this.$td.css("height","100px");this.list.update(this.data)}else{this.$td.css("height","auto")}}},a={conSel:$('<div style="position:absolute;z-index:5;top:'+b.tdHeight+'px" />').appendTo(document.body)};c[0].tList=b.data.type=="S"?new epgd.searchResultList(a,b):new epgd.searchTimerTimerList(a,b);c[0].tList.render();b.$td.append(b.list.$con)}c[0].tList.dialog.toggle(true);c.removeClass("i-down-dir").addClass("i-right-dir");break;case"right-dir":c.removeClass("i-right-dir").addClass("i-down-dir");if(c[0].tList){c[0].tList.dialog.toggle(false)}break}};epgd.pages.searchTimerList.update=function(){var a=this;this.$con.find("tbody").empty();epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/searchtimers",async:false,cache:false},function(d){var b=[],e=a.editIcons,c={V:"i-tv",R:"i-record",S:"i-search"};if(!d.searchtimers.length){a.hideHead()}else{$.each(d.searchtimers,function(k,g){var i=epgd.vdrs.list[g.vdruuid]||{name:"--"},h=$("<tr"+(g.active?"":' class="ui-state-disabled"')+'><td><span class="iAsButton i-down-dir edit" title="'+epgd.tr.pages.timer.timerList+'"></span><div class="'+c[g.type]+'">'+(g.name||g.expression)+"</div></td><td"+(g.type=="S"?">--":' data-sort="'+new String("00000"+g.hits).slice(-5)+'">'+g.hits)+"</td><td>"+i.name+"</td><td>"+e+"</td></tr>")[0];h.tData=g;b.push(h)});a.trs=b;a.showHead()}epgd.utils.loader.close();$(window).trigger("searchTimerList_updated",a)})})};epgd.pages.searchTimerList.triggerUpdate=function(){var a=this;epgd.ajax({url:epgd.login.url+"data/updatesearchtimer"},function(b){if(b.result.state==200){epgd.utils.topInfo(epgd.tr.dataSaved)}else{epgd.utils.topInfo(b.message,{isError:1})}a.update()})};epgd.pages.search=new epgd.searchDialog();epgd.pages.messageList=new epgd.timerListBase({saveUrl:"data/markmessages",selectable:true});epgd.pages.messageList.getTable=function(){return'<table id="messageList" class="timerTable"><thead><tr><th style="width:70px">id'+this.sortIcons+'</th><th style="width:120px">Typ <input type="text" class="filter" style="width:18px" />'+this.sortIcons+'</th><th style="width:140px">Zeit'+this.sortIcons+'</th><th style="width:100px">Titel <input type="text" class="filter" style="width:50px" />'+this.sortIcons+'</th><th style="min-width:140px">infotext <input type="text" class="filter" />'+this.sortIcons+'</th><th style="min-width:190px"><div class="selMarkBlock" style="width:auto;float: right;"><b title="'+epgd.tr.markAll+'" class="selected" data-t="1"></b><b title="'+epgd.tr.markNone+'" data-t="0"></b><b title="'+epgd.tr.markToggle+'"><b class="selected"></b></b></div>Status <input type="text" class="filter" style="width:20px" /><br />'+this.sortIcons+'<span class="iAsButton i-refresh edit" title="'+epgd.tr.reload+'"></span><span style="margin-top:3px" class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span><span style="margin-top:3px" class="iAsButton i-check edit" title="'+epgd.tr.pages.timerList.messageStates.R+'"></span><span style="margin-top:3px" class="iAsButton i-check-empty edit" title="'+epgd.tr.pages.timerList.messageStates.N+'"></span></th></tr></thead><tbody></tbody></table>'};epgd.pages.messageList.update=function(b){var a=this;epgd.utils.loader.process(function(){epgd.ajax({url:epgd.login.url+"data/messages",async:false,cache:false},function(l){a.$con.find("tbody").empty();if(!l.messages.length){a.hideHead()}else{var c=[],k,h,g,e={N:'<span class="iAsButton i-check-empty edit">'+epgd.tr.pages.timerList.messageStates.N+"</span>",R:'<span class="iAsButton i-check edit">'+epgd.tr.pages.timerList.messageStates.R+"</span>"},d={E:'<div class="i-error">'+epgd.tr.pages.timerList.timerStates.E+"</div>",F:'<div class="i-flash-outline">'+epgd.tr.pages.timerList.timerStates.F+"</div>",I:'<div class="i-info">'+epgd.tr.pages.timerList.messageTypes.I+"</div>",W:'<div class="i-warning">'+epgd.tr.pages.timerList.messageTypes.W+"</div>"};for(h in l.messages){g=l.messages[h];k=$('<tr><td data-sort="'+new String("0000000"+g.id).slice(-7)+'">'+g.id+"</td><td>"+(d[g.type]||"")+'</td><td data-sort="'+g.updsp+'">'+epgd.utils.formatDateTime(g.updsp)+"</td><td>"+g.title+"</td><td>"+g.text+'</td><td data-sort="'+g.state+g.updsp+'"><span class="iAsButton i-trash edit" title="'+epgd.tr.del+'"></span>'+(e[g.state]||"")+"</td></tr>")[0];k.tData=g;c.push(k)}a.trs=c;a.$con.find(">table>tbody").append(c.sort(function(m,i){return m.tData.state==i.tData.state?m.tData.state.updsp>i.tData.state.updsp?-1:1:m.tData.state>i.tData.state}).slice());a.showHead()}epgd.utils.loader.close();$(window).trigger("messagelist_updated",a)})},true)};epgd.pages.messageList.action=function(b,g,e){var c=this.getSelectedIds(b),d=null,a;if(c){switch(g){case"check":d=b[0].parentNode.nodeName=="TH"?"R":"N";break;case"check-empty":d=b[0].parentNode.nodeName=="TH"?"N":"R";break;case"trash":d="D";break}if(d){for(a in c){c[a]={id:c[a],state:d}}d=="D"?this.del(c,null,"messages"):this.saveArray(c,"messages");return true}}return epgd.timerListBase.prototype.action.call(this,b,g,e)};epgd.vdr=function(a,b){this.uuid=a;$.extend(this,b)};epgd.vdr.prototype.switchChannel=function(a){epgd.ajax({url:epgd.login.url+"data/channelswitch?uuid="+this.uuid+"&channel="+a,cache:false},function(b){epgd.utils.popup(b.result.message,{title:"VDR",autoClose:5000})})};epgd.vdr.prototype.wol=function(){epgd.ajax({url:epgd.login.url+"data/wakeupvdr?uuid="+this.uuid,cache:false},function(a){epgd.utils.popup(a.result.message,{title:"VDR",autoClose:5000})})};epgd.vdrs={list:null,current:null,load:function(){if(!this.list){this.list={};epgd.ajax({url:epgd.login.url+"data/vdrs",async:false},function(b){var a;for(a in b.vdrs){epgd.vdrs.list[a]=new epgd.vdr(a,b.vdrs[a])}if(!epgd.vdrs.current){if(epgd.profile.defaultVDRuuid){epgd.vdrs.current=epgd.vdrs.list[epgd.profile.defaultVDRuuid];if(!epgd.vdrs.current){epgd.utils.log("the default VDR ("+epgd.profile.defaultVDRuuid+" is invalid! Please change this in Web Interface/options)")}}if(!epgd.vdrs.current){for(a in epgd.vdrs.list){epgd.vdrs.current=epgd.vdrs.list[a];break}}if(!epgd.vdrs.current){epgd.utils.log("no VDR found",2);epgd.vdrs.current=new epgd.vdr("000-missing-vdr-000",{name:"no VDR found"})}}$(window).trigger("vdrs_load")})}},get:function(a){return this.list[(a||this.current)]||{}}};epgd.pages.vdrs={render:function(){epgd.$con.html('<div><button class="iAsButton" onclick="epgd.vdrs.current.wol()">WOL</button>')}}; \ No newline at end of file
diff --git a/httpd.c b/httpd.c
index a4e3295..fc88279 100644
--- a/httpd.c
+++ b/httpd.c
@@ -881,7 +881,7 @@ int cEpgHttpd::initDb()
// from timers t left outer join events e
// on (t.eventid = e.masterid and e.updflg in (...))
// where
- // t.state in (?)
+ // e.updflg in in (<visible>)
// timerIncState.setField(&timerStateDef);
// timerExcState.setField(&timerStateDef);
diff --git a/webdo.c b/webdo.c
index 679501e..8374f34 100644
--- a/webdo.c
+++ b/webdo.c
@@ -1547,13 +1547,13 @@ int cEpgHttpd::doTimers(MHD_Connection* tcp, json_t* obj)
// state / action
- if (!isEmpty(action) && !strchr(action, *timerDb->getStrValue("ACTION")))
+ if (!isEmpty(action) && !strchr(action, toupper(*timerDb->getStrValue("ACTION"))))
continue;
if (!isEmpty(state)&& !strchr(state, *timerDb->getStrValue("STATE")))
continue;
- if (!isEmpty(naction) && strchr(naction, *timerDb->getStrValue("ACTION")))
+ if (!isEmpty(naction) && strchr(naction, toupper(*timerDb->getStrValue("ACTION"))))
continue;
if (!isEmpty(nstate) && strchr(nstate, *timerDb->getStrValue("STATE")))
diff --git a/webstore.c b/webstore.c
index c8aff7e..adfc049 100644
--- a/webstore.c
+++ b/webstore.c
@@ -369,7 +369,7 @@ int cEpgHttpd::storeTimerJob(json_t* jInData, json_t* response)
//***************************************************************************
// Modify Timer (copy paste from cMenuDb of epg2vdr)
//
-// - timerRow contains the destination vdrUuid
+// - timerRow contains the new/modified values
//***************************************************************************
int cEpgHttpd::modifyCreateTimer(cDbRow* timerRow)
@@ -405,6 +405,11 @@ int cEpgHttpd::modifyCreateTimer(cDbRow* timerRow)
if (!timerDb->hasValue("VDRUUID", timerRow->getStrValue("VDRUUID")))
move = yes;
+
+ // move to another timer type?
+
+ if (!timerDb->hasValue("TYPE", timerRow->getStrValue("TYPE")))
+ move = yes;
}
else
{