Skip to content

Commit

Permalink
Merge pull request #18 from sprintr/master
Browse files Browse the repository at this point in the history
Read file extensions properly
  • Loading branch information
ivogabe committed Jun 11, 2014
2 parents b6695f0 + 3cf20e6 commit aa2f6ae
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ define(function(require, exports, module) {

$items.each(function(index) {
var ext = ($(this).find('.extension').text() || '').substr(1).toLowerCase();

var lastIndex = ext.lastIndexOf('.');
if(lastIndex > 0) {
ext = ext.substr(lastIndex + 1);
}

var data;

if ($(this).parent().hasClass('jstree-leaf')) {
Expand All @@ -163,6 +167,10 @@ define(function(require, exports, module) {

$items.each(function(index) {
var ext = ($(this).find('.extension').text() || '').substr(1);
var lastIndex = ext.lastIndexOf('.');
if(lastIndex > 0) {
ext = ext.substr(lastIndex + 1);
}

var data = fileInfo.hasOwnProperty(ext) ? fileInfo[ext] : getDefaultIcon(ext);

Expand Down

0 comments on commit aa2f6ae

Please sign in to comment.