diff --git a/build/libifm.php b/build/libifm.php index 1db68b7..d1307ff 100644 --- a/build/libifm.php +++ b/build/libifm.php @@ -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 ) { diff --git a/ifm.php b/ifm.php index 151aa3b..cabe41a 100644 --- a/ifm.php +++ b/ifm.php @@ -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 ) { diff --git a/src/ifm.js b/src/ifm.js index 59e3a19..778123a 100644 --- a/src/ifm.js +++ b/src/ifm.js @@ -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", diff --git a/src/main.php b/src/main.php index 11a418a..772741c 100644 --- a/src/main.php +++ b/src/main.php @@ -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 ) {