var Buttons = { created: false, btnSelected : 0, btnMax : 2, prButton : null }; /* * First: do just the buttons for play / resume */ Buttons.init = function (){ if (this.created == false) { Buttons.createStyleSheet (); Buttons.createPrcButtons(); $("#prc-buttons").hide(); Buttons.createYnButtons(); $("#yn-buttons").hide(); this.created = true; this.prButton = new ButtonHandler(); this.prButton.hndlName = "prcButtons"; this.prButton.enterCallback = Buttons.prcEnterCallback; this.prButton.btnMax = 2; this.prButton.elmName = "#pr-btn-"; this.prButton.masterElm = "#prc-buttons"; this.prButton.inputElm = "#prc-buttons-anchor"; var elem = document.getElementById('prc-buttons-anchor'); elem.setAttribute('onkeydown', 'Buttons.prButton.onInput();'); this.ynButton = new ButtonHandler(); this.ynButton.hndlName = "ynButtons"; this.ynButton.enterCallback = Buttons.ynEnterCallback; this.ynButton.returnCallback = Buttons.ynReturnCallback; this.ynButton.btnMax = 1; this.ynButton.elmName = "#yn-btn-"; this.ynButton.masterElm = "#yn-buttons"; this.ynButton.inputElm = "#yn-buttons-anchor"; elem = document.getElementById('yn-buttons-anchor'); elem.setAttribute('onkeydown', 'Buttons.ynButton.onInput();'); // $("#prc-buttons-anchor").attr("onkeydown", "Button.prButton.onInput();"); } }; Buttons.ynReturnCallback = function () { switch (Main.state) { case Main.eOPT: Options.drawServerList(); break; case Main.eTMR: Buttons.ynHide(); Timers.focus(); break; case Main.eMED: Buttons.ynHide(); break; default: break; } }; Buttons.ynEnterCallback = function () { Main.log("Buttons.ynEnterCallback btnSelected= " + Buttons.ynButton.btnSelected); switch(Buttons.ynButton.btnSelected){ case 0: Main.logToServer("ynButtons: No -> Don't delete"); break; case 1: Main.logToServer("ynButtons: Yes "+Player.resumePos); switch (Main.state) { case Main.eREC: Server.deleteRecording(Player.guid); break; case Main.eURLS: Server.deleteUrls(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid); break; case Main.eOPT: Config.deletedFromContext((Options.selectedLine -1)); // 0 is reserved for the input field Options.drawServerList(); break; case Main.eTMR: Timers.timerCallback(); break; case Main.eMED: Server.deleteMedFile(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid); break; } break; } Buttons.ynHide(); }; Buttons.prcEnterCallback = function () { Main.log("Buttons.prcEnterCallback"); switch(Buttons.prButton.btnSelected){ case 0: Main.logToServer("prcButtons: Play from start"); Display.hide(); Display.showProgress(); Player.playVideo(-1); Buttons.prcHide(); break; case 1: Main.logToServer("prcButtons: Resume from "+Player.resumePos); // Player.playVideo(Player.resumePos); Display.hide(); Display.showProgress(); Spinner.show(); Server.getResume(Player.guid); Buttons.prcHide(); break; case 2: //delete Buttons.prcHide(); Buttons.ynShow(); break; } }; Buttons.show = function () { Main.log("Buttons.show()"); this.prButton.show(); this.prButton.reset(); }; Buttons.hide = function () { this.prButton.hide(); // $("#prc-buttons-anchor").blur(); Main.enableKeys(); }; Buttons.prcShow = function () { Main.log("Buttons.show()"); this.prButton.show(); this.prButton.reset(); }; Buttons.prcHide = function () { this.prButton.hide(); // $("#prc-buttons-anchor").blur(); Main.enableKeys(); }; //change the Headline Text of the yn buttons (Default is "Delete ?") Buttons.ynHeadlineText = function(msg) { $("#yn-btn-text").text(msg); }; Buttons.ynShow = function () { Main.log("Buttons.ynShow()"); this.ynButton.show(); this.ynButton.reset(); }; Buttons.ynHide = function () { $("#yn-btn-text").text("Delete ?"); this.ynButton.hide(); switch (Main.state) { case Main.eOPT: $("#optionsViewAnchor").focus(); break; case Main.eTMR: Timers.focus(); break; case Main.eMED: Main.log("Buttons.ynReturnCallback isActive= " + (ImgViewer.isActive == true) ? "true" : "false"); if (ImgViewer.isActive == true) { ImgViewer.focus (); } else Main.enableKeys(); break; default: Main.enableKeys(); break; }; }; Buttons.createStyleSheet = function () { var sheet = $("