]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Close console on press ESC key
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 20 Dec 2015 10:33:38 +0000 (11:33 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 20 Dec 2015 10:35:28 +0000 (11:35 +0100)
gui/baculum/protected/Portlets/Console.tpl

index d4824dea53cfa346b5846e700eb2af6aec69e3de..57e298d049a56454abdb103f84c0a19f11e12728 100644 (file)
@@ -1,11 +1,15 @@
 <script type="text/javascript">
-       $('console_launcher').observe('click', function(){
-               Effect.toggle('<%=$this->ConsoleContainer->ClientID%>', 'slide', { duration: 0.2 , afterFinish: function(){
+       var show_hide_console = function() {
+               Effect.toggle('<%=$this->ConsoleContainer->ClientID%>', 'slide', { duration: 0.2 , afterFinish: function() {
                        $('<%=$this->OutputListing->ClientID%>').scrollTop = $('<%=$this->OutputListing->ClientID%>').scrollHeight;
                        $('<%=$this->getPage()->VolumesTools->Tools->ClientID%>').hide();
                        $('console_launcher').down('span').innerHTML = ($('<%=$this->ConsoleContainer->ClientID%>').getStyle('display') == 'block') ? '<%[ hide console ]%>' : '<%[ show console ]%>';
+                       $('<%=$this->CommandLine->ClientID%>').select();
                        window.scrollTo(0, document.body.scrollHeight);
                }});
+       };
+       $('console_launcher').observe('click', function(){
+               show_hide_console();
        });
 </script>
 <com:TActivePanel ID="ConsoleContainer" DefaultButton="Enter" Style="text-align: left; display: none;">
                </prop:ClientSide.OnComplete>
        </com:TActiveButton>
         <com:TActiveButton ID="Clear" Text="<%[ Clear ]%>" OnCallback="clearConsole" Style="margin: auto 5px; " />
+       <script type="text/javascript">
+       $('<%=$this->CommandLine->ClientID%>').stopObserving('keydown');
+       $('<%=$this->CommandLine->ClientID%>').observe('keydown', function(e) {
+               if (e.keyCode == 27) { // close console on pressed ESC key
+                       show_hide_console();
+               }
+       });
+       </script>
 </com:TActivePanel>