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

Enable edit function only for text files, not binary etc. Related to #90

This commit is contained in:
Marco Dickert
2018-02-23 15:33:47 +01:00
parent cd40fd759e
commit 0ccd4223e8
4 changed files with 6 additions and 3 deletions

View File

@@ -1565,7 +1565,7 @@ function IFM( params ) {
icon: "icon icon-archive",
title: "extract"
});
} else if( self.config.edit && item.icon.indexOf( 'file-image' ) == -1 && ! self.inArray( item.ext, ["zip","tar","tgz","tar.gz","tar.xz","tar.bz2"] ) ) {
} else if( self.config.edit && item.mime_type.substr( 0, 4 ) == "text" ) {
item.eaction = "edit";
item.button.push({
action: "edit",
@@ -3367,6 +3367,7 @@ function IFM( params ) {
$type = substr( strrchr( $name, "." ), 1 );
$item["icon"] = $this->getTypeIcon( $type );
$item["ext"] = strtolower($type);
$item["mime_type"] = mime_content_type( $name );
}
if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $name ) ); }
if( $this->config['showfilesize'] == 1 ) {

View File

@@ -1565,7 +1565,7 @@ function IFM( params ) {
icon: "icon icon-archive",
title: "extract"
});
} else if( self.config.edit && item.icon.indexOf( 'file-image' ) == -1 && ! self.inArray( item.ext, ["zip","tar","tgz","tar.gz","tar.xz","tar.bz2"] ) ) {
} else if( self.config.edit && item.mime_type.substr( 0, 4 ) == "text" ) {
item.eaction = "edit";
item.button.push({
action: "edit",
@@ -3367,6 +3367,7 @@ function IFM( params ) {
$type = substr( strrchr( $name, "." ), 1 );
$item["icon"] = $this->getTypeIcon( $type );
$item["ext"] = strtolower($type);
$item["mime_type"] = mime_content_type( $name );
}
if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $name ) ); }
if( $this->config['showfilesize'] == 1 ) {

View File

@@ -145,7 +145,7 @@ function IFM( params ) {
icon: "icon icon-archive",
title: "extract"
});
} else if( self.config.edit && item.icon.indexOf( 'file-image' ) == -1 && ! self.inArray( item.ext, ["zip","tar","tgz","tar.gz","tar.xz","tar.bz2"] ) ) {
} else if( self.config.edit && item.mime_type.substr( 0, 4 ) == "text" ) {
item.eaction = "edit";
item.button.push({
action: "edit",

View File

@@ -356,6 +356,7 @@ f00bar;
$type = substr( strrchr( $name, "." ), 1 );
$item["icon"] = $this->getTypeIcon( $type );
$item["ext"] = strtolower($type);
$item["mime_type"] = mime_content_type( $name );
}
if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $name ) ); }
if( $this->config['showfilesize'] == 1 ) {