1
0
mirror of https://github.com/misterunknown/ifm.git synced 2025-08-30 10:59:49 +02:00

added ability to change directory by typing the path in the input field in the navbar

This commit is contained in:
Marco Dickert
2017-02-17 14:27:50 +01:00
parent 71780a2f3f
commit 44dfe7d3fc
2 changed files with 10 additions and 6 deletions

View File

@@ -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" ); }
});