mirror of
https://github.com/misterunknown/ifm.git
synced 2025-09-02 04:02:33 +02:00
added ability to change directory by typing the path in the input field in the navbar
This commit is contained in:
8
ifm.php
8
ifm.php
@@ -568,8 +568,10 @@ function IFM() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.changeDirectory = function( newdir, options={ absolute: false, pushState: true } ) {
|
this.changeDirectory = function( newdir, options={} ) {
|
||||||
if( ! options.absolute ) newdir = self.pathCombine( self.currentDir, newdir );
|
config = { absolute: false, pushState: true };
|
||||||
|
jQuery.extend( config, options );
|
||||||
|
if( ! config.absolute ) newdir = self.pathCombine( self.currentDir, newdir );
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: self.IFM_SCFN,
|
url: self.IFM_SCFN,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@@ -582,7 +584,7 @@ function IFM() {
|
|||||||
self.currentDir = data.realpath;
|
self.currentDir = data.realpath;
|
||||||
self.refreshFileTable();
|
self.refreshFileTable();
|
||||||
$( "#currentDir" ).val( self.currentDir );
|
$( "#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" ); }
|
error: function() { self.showMessage( "General error occured: No or broken response", "e" ); }
|
||||||
});
|
});
|
||||||
|
@@ -140,8 +140,10 @@ function IFM() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.changeDirectory = function( newdir, options={ absolute: false, pushState: true } ) {
|
this.changeDirectory = function( newdir, options={} ) {
|
||||||
if( ! options.absolute ) newdir = self.pathCombine( self.currentDir, newdir );
|
config = { absolute: false, pushState: true };
|
||||||
|
jQuery.extend( config, options );
|
||||||
|
if( ! config.absolute ) newdir = self.pathCombine( self.currentDir, newdir );
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: self.IFM_SCFN,
|
url: self.IFM_SCFN,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@@ -154,7 +156,7 @@ function IFM() {
|
|||||||
self.currentDir = data.realpath;
|
self.currentDir = data.realpath;
|
||||||
self.refreshFileTable();
|
self.refreshFileTable();
|
||||||
$( "#currentDir" ).val( self.currentDir );
|
$( "#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" ); }
|
error: function() { self.showMessage( "General error occured: No or broken response", "e" ); }
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user