From 709acbfc673517da19e445308e97d6911c1c62d8 Mon Sep 17 00:00:00 2001 From: Marco Dickert Date: Fri, 17 Feb 2017 14:05:45 +0100 Subject: [PATCH] moved includes to src/includes, added modal input focus --- ifm.php | 14 +++++++++++++- src/ifm.js | 14 +++++++++++++- src/{ace => includes}/ace.js | 0 src/{ => includes}/bootstrap-notify.min.js | 0 src/{ => includes}/bootstrap.min.css | 0 src/{ => includes}/bootstrap.min.js | 0 src/{ => includes}/ekko-lightbox.min.css | 0 src/{ => includes}/ekko-lightbox.min.js | 0 src/{ => includes}/fontello-embedded.css | 0 src/{ => includes}/jquery.min.js | 0 src/main.php | 16 ++++++++-------- 11 files changed, 34 insertions(+), 10 deletions(-) rename src/{ace => includes}/ace.js (100%) rename src/{ => includes}/bootstrap-notify.min.js (100%) rename src/{ => includes}/bootstrap.min.css (100%) rename src/{ => includes}/bootstrap.min.js (100%) rename src/{ => includes}/ekko-lightbox.min.css (100%) rename src/{ => includes}/ekko-lightbox.min.js (100%) rename src/{ => includes}/fontello-embedded.css (100%) rename src/{ => includes}/jquery.min.js (100%) diff --git a/ifm.php b/ifm.php index 6ae697e..8654d80 100644 --- a/ifm.php +++ b/ifm.php @@ -454,8 +454,14 @@ function IFM() { modalDialog.append( modalContent ); modal.append( modalDialog ); $( document.body ).append( modal ); - modal.modal(); modal.on('hide.bs.modal', function () { $(this).remove(); }); + modal.on('shown.bs.modal', function () { + var formElements = $(this).find('input, button'); + if( formElements.length > 0 ) { + formElements.first().focus(); + } + }); + modal.modal('show'); }; this.hideModal = function() { @@ -1079,6 +1085,12 @@ function IFM() { $("#upload").click(function(){ self.uploadFileDialog(); }); + $('#currentDir').on( 'keypress', function (event) { + if( event.keyCode == 13 ) { + event.preventDefault(); + self.changeDirectory( $(this).val(), { absolute: true } ); + } + }); $(document).on( 'keypress', self.handleKeystrokes ); // handle history manipulation diff --git a/src/ifm.js b/src/ifm.js index d07fa31..c08b7ff 100644 --- a/src/ifm.js +++ b/src/ifm.js @@ -26,8 +26,14 @@ function IFM() { modalDialog.append( modalContent ); modal.append( modalDialog ); $( document.body ).append( modal ); - modal.modal(); modal.on('hide.bs.modal', function () { $(this).remove(); }); + modal.on('shown.bs.modal', function () { + var formElements = $(this).find('input, button'); + if( formElements.length > 0 ) { + formElements.first().focus(); + } + }); + modal.modal('show'); }; this.hideModal = function() { @@ -651,6 +657,12 @@ function IFM() { $("#upload").click(function(){ self.uploadFileDialog(); }); + $('#currentDir').on( 'keypress', function (event) { + if( event.keyCode == 13 ) { + event.preventDefault(); + self.changeDirectory( $(this).val(), { absolute: true } ); + } + }); $(document).on( 'keypress', self.handleKeystrokes ); // handle history manipulation diff --git a/src/ace/ace.js b/src/includes/ace.js similarity index 100% rename from src/ace/ace.js rename to src/includes/ace.js diff --git a/src/bootstrap-notify.min.js b/src/includes/bootstrap-notify.min.js similarity index 100% rename from src/bootstrap-notify.min.js rename to src/includes/bootstrap-notify.min.js diff --git a/src/bootstrap.min.css b/src/includes/bootstrap.min.css similarity index 100% rename from src/bootstrap.min.css rename to src/includes/bootstrap.min.css diff --git a/src/bootstrap.min.js b/src/includes/bootstrap.min.js similarity index 100% rename from src/bootstrap.min.js rename to src/includes/bootstrap.min.js diff --git a/src/ekko-lightbox.min.css b/src/includes/ekko-lightbox.min.css similarity index 100% rename from src/ekko-lightbox.min.css rename to src/includes/ekko-lightbox.min.css diff --git a/src/ekko-lightbox.min.js b/src/includes/ekko-lightbox.min.js similarity index 100% rename from src/ekko-lightbox.min.js rename to src/includes/ekko-lightbox.min.js diff --git a/src/fontello-embedded.css b/src/includes/fontello-embedded.css similarity index 100% rename from src/fontello-embedded.css rename to src/includes/fontello-embedded.css diff --git a/src/jquery.min.js b/src/includes/jquery.min.js similarity index 100% rename from src/jquery.min.js rename to src/includes/jquery.min.js diff --git a/src/main.php b/src/main.php index ae1f176..f040770 100644 --- a/src/main.php +++ b/src/main.php @@ -29,9 +29,9 @@ class IFM { - - - + + + @@ -105,11 +105,11 @@ class IFM {
- - - - - + + + + +