node_modules/connect/node_modules/serve-index/index.js
/**
 * Load icon images, return css string.
 */
Load icon images, return css string.
Load icon images return css string .
function iconStyle (files, useIcons) {
  if (!useIcons) return '';
  var className;
  var i;
  var icon;
  var list = [];
  var rules = {};
  var selector;
  var selectors = {};
  var style = '';
  for (i = 0; i < files.length; i++) {
    var file = files[i];
    var isDir = '..' == file.name || (file.stat && file.stat.isDirectory());
    icon = isDir ? icons.folder : icons[extname(file.name)] || icons.default;
    var ext = extname(file.name);
    className = 'icon-' + (isDir ? 'directory' : (icons[ext] ? ext.substring(1) : 'default'));
    selector = '#files .' + className + ' .name';
    if (!rules[icon]) {
      rules[icon] = 'background-image: url(data:image/png;base64,' + load(icon) + ');'
      selectors[icon] = [];
      list.push(icon);
    }
    if (!~selectors[icon].indexOf(selector)) {
      selectors[icon].push(selector);
    }
  }
  for (i = 0; i < list.length; i++) {
    icon = list[i];
    style += selectors[icon].join(',\n') + ' {\n  ' + rules[icon] + '\n}\n';
  }
  return style;
}
function iconStyle ( files , useIcons ) { if ( ! useIcons ) return '' ; var className ; var i ; var icon ; var list = [ ] ; var rules = { } ; var selector ; var selectors = { } ; var style = '' ; for ( i = 0 ; i < files . length ; i ++ ) { var file = files [ i ] ; var isDir = '..' == file . name || ( file . stat && file . stat . isDirectory ( ) ) ; icon = isDir ? icons . folder : icons [ extname ( file . name ) ] || icons . default ; var ext = extname ( file . name ) ; className = 'icon-' + ( isDir ? 'directory' : ( icons [ ext ] ? ext . substring ( 1 ) : 'default' ) ) ; selector = '#files .' + className + ' .name' ; if ( ! rules [ icon ] ) { rules [ icon ] = 'background-image: url(data:image/png;base64,' + load ( icon ) + ');' selectors [ icon ] = [ ] ; list . push ( icon ) ; } if ( ! ~ selectors [ icon ] . indexOf ( selector ) ) { selectors [ icon ] . push ( selector ) ; } } for ( i = 0 ; i < list . length ; i ++ ) { icon = list [ i ] ; style += selectors [ icon ] . join ( ',\n' ) + ' {\n  ' + rules [ icon ] + '\n}\n' ; } return style ; }
Load icon images, return css string.
Load icon images return css string .