Fix some JS hints.

This commit is contained in:
Lars Jung 2014-06-10 00:54:27 +02:00
parent 8c6afea314
commit 98f6611a7a
3 changed files with 27 additions and 19 deletions

View File

@ -3,7 +3,7 @@ modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'cor
var settings = _.extend({
enabled: true
}, allsettings['preview']),
}, allsettings.preview),
template = '<div id="pv-overlay" class="noSelection">' +
'<div id="pv-content"/>' +

View File

@ -77,15 +77,19 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
// numeric, hex or date detection
xD = parseInt(x.match(hre), 10) || (xN.length != 1 && x.match(dre) && Date.parse(x)),
xD = parseInt(x.match(hre), 10) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),
yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null,
oFxNcL, oFyNcL;
// first try and sort Hex codes or Dates
if (yD)
if ( xD < yD ) return -1;
else if ( xD > yD ) return 1;
if (yD) {
if (xD < yD) {
return -1;
} else if (xD > yD) {
return 1;
}
}
// natural sorting through split numeric strings and default strings
for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc += 1) {
// find floats not starting with '0', string or 0 if not defined (Clint Priest)
oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
@ -96,8 +100,12 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
oFxNcL += '';
oFyNcL += '';
}
if (oFxNcL < oFyNcL) return -1;
if (oFxNcL > oFyNcL) return 1;
if (oFxNcL < oFyNcL) {
return -1;
}
if (oFxNcL > oFyNcL) {
return 1;
}
}
return 0;
},

View File

@ -4,15 +4,15 @@ modulejs.define('info', ['$', 'config'], function ($, config) {
var map = function (setup) {
return {
'php_version': setup['HAS_PHP_VERSION'],
'cache_dir': setup['HAS_WRITABLE_CACHE'],
'image_thumbs': setup['HAS_PHP_JPG'],
'exif_thumbs': setup['HAS_PHP_EXIF'],
'movie_thumbs': setup['HAS_CMD_FFMPEG'] || setup['HAS_CMD_AVCONV'],
'pdf_thumbs': setup['HAS_CMD_CONVERT'],
'shell_tar': setup['HAS_CMD_TAR'],
'shell_zip': setup['HAS_CMD_ZIP'],
'folder_sizes': setup['HAS_CMD_DU']
'php_version': setup.HAS_PHP_VERSION,
'cache_dir': setup.HAS_WRITABLE_CACHE,
'image_thumbs': setup.HAS_PHP_JPG,
'exif_thumbs': setup.HAS_PHP_EXIF,
'movie_thumbs': setup.HAS_CMD_FFMPEG || setup.HAS_CMD_AVCONV,
'pdf_thumbs': setup.HAS_CMD_CONVERT,
'shell_tar': setup.HAS_CMD_TAR,
'shell_zip': setup.HAS_CMD_ZIP,
'folder_sizes': setup.HAS_CMD_DU
};
},
@ -37,8 +37,8 @@ modulejs.define('info', ['$', 'config'], function ($, config) {
setValue(this, values[$(this).data('id')]);
});
$('.idx-file .value').text(setup['INDEX_HREF']);
$('.test.php .result').text(setup['PHP_VERSION']);
$('.idx-file .value').text(setup.INDEX_HREF);
$('.test.php .result').text(setup.PHP_VERSION);
};
init();