diff --git a/ifm.php b/ifm.php index 8654d80..9aff577 100644 --- a/ifm.php +++ b/ifm.php @@ -568,8 +568,10 @@ function IFM() { }); }; - this.changeDirectory = function( newdir, options={ absolute: false, pushState: true } ) { - if( ! options.absolute ) newdir = self.pathCombine( self.currentDir, newdir ); + this.changeDirectory = function( newdir, options={} ) { + config = { absolute: false, pushState: true }; + jQuery.extend( config, options ); + if( ! config.absolute ) newdir = self.pathCombine( self.currentDir, newdir ); $.ajax({ url: self.IFM_SCFN, type: "POST", @@ -582,7 +584,7 @@ function IFM() { self.currentDir = data.realpath; self.refreshFileTable(); $( "#currentDir" ).val( self.currentDir ); - if( options.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+self.currentDir ); + if( config.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+self.currentDir ); }, error: function() { self.showMessage( "General error occured: No or broken response", "e" ); } }); diff --git a/src/ifm.js b/src/ifm.js index c08b7ff..bb4fede 100644 --- a/src/ifm.js +++ b/src/ifm.js @@ -140,8 +140,10 @@ function IFM() { }); }; - this.changeDirectory = function( newdir, options={ absolute: false, pushState: true } ) { - if( ! options.absolute ) newdir = self.pathCombine( self.currentDir, newdir ); + this.changeDirectory = function( newdir, options={} ) { + config = { absolute: false, pushState: true }; + jQuery.extend( config, options ); + if( ! config.absolute ) newdir = self.pathCombine( self.currentDir, newdir ); $.ajax({ url: self.IFM_SCFN, type: "POST", @@ -154,7 +156,7 @@ function IFM() { self.currentDir = data.realpath; self.refreshFileTable(); $( "#currentDir" ).val( self.currentDir ); - if( options.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+self.currentDir ); + if( config.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+self.currentDir ); }, error: function() { self.showMessage( "General error occured: No or broken response", "e" ); } });