Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="browser"></div>
<div class="browser"></div>
<!--
if you're copying or renaming files there is
artifical delay that simulate server side processing
-->
              
            
!

CSS

              
                body {
	margin: 0;
  font-size: 12px;
}
.browser {
	width: 300px;
	height: 200px;
	border: 1px solid gray;
  float: left;
  margin: 20px;
}
.browser.selected {
	border-color: blue;
}
/* customization */
.browser-widget li.file,
.browser-widget li.directory {
    width: 60px;
}
              
            
!

JS

              
                (function($) {
  var env = {
    'foo': {
      'foo.txt': 'foo.txt content',
      'bar.txt': 'bar.txt content'
    },
    'bar': {
      'page.html': '<html></html>',
      'style.css': 'body { overflow: scroll; }',
      baz: {
        'foo.txt': 'Hello'
      }
    },
    'baz.txt': 'baz.txt content',
    'quux.txt': 'quux.txt content',
    'lorem.svg': 'lorem.svg content',
    'ipsum.doc': 'ipsum.doc content',
    'dolor.txt': 'dolor.txt content',
    'sit.jpg': 'sit.jpg content',
    'amet.gif': 'amet.gif content'
  };
  function get(path) {
    var current = env;
    browser.walk(path, function(file) {
      current = current[file];
    });
    return current;
  }
  function remove(src) {
    var file = env;
    browser.walk(src, function(part, last) {
      var src = file[part];
      if (last) {
        delete file[part];
      }
      file = src;
    });
  }
  function process(src, dest, remove) {
    console.log('process ' + src + ' => ' + dest);
    var file = env;
    var name;
    browser.walk(src, function(part, last) {
      var src = file[part];
      if (last) {
        if (remove) {
          delete file[part];
        }
      }
      file = src;
    });
    var current = env;
    browser.walk(dest, function(part, last) {
      if (!last) {
        current = current[part];
      } else {
        name = part;
      }
    });
    current[name] = file;
    var defer = $.Deferred();
    // one second delay promise that simulate ajax upload
    setTimeout(function() {
      defer.resolve();
    }, 1000);
    return defer.promise();
  }
  function upload(file, path) {
    var current = env;
    browser.walk(path, function(part) {
      if (!current[part]) {
        current[part] = {}; // upload new directory
      }
      current = current[part];
    });
    current[file.name] = 'new file ' + file.name;
    console.log('upload ' + file.name + ' to ' + path + ' directory');
    return $.when(true); // resolved promise
  }
  $('.browser').browse({
    root: '/',
    separator: '/',
    contextmenu: true,
    name: 'filestystem',
    menu: function(type) {
      if (type == 'li') {
        return {
          'play': function($li) {
            alert('winamp play "' + $li.text() + '"');
          },
          'add to playlist': function($li) {
            alert('playlist "' + $li.text() + '"');
          }
        }
      }
    },
    remove: function(src) {
      remove(src);
    },
    rename: function(src, dest) {
      return process(src, dest, true);
    },
    refresh_timer: 0,
    copy: process,
    dir: function(path) {
      dir = get(path);
      var result;
      if ($.isPlainObject(dir)) {
        result = {files:[], dirs: []};
        Object.keys(dir).forEach(function(key) {
          if (typeof dir[key] == 'string') {
            result.files.push(key);
          } else if ($.isPlainObject(dir[key])) {
            result.dirs.push(key);
          }
        });
      }
      return $.when(result); // resolved promise
    },
    upload: function(file, path) {
      return upload(file, path);
    },
    open: function(filename) {
      var file = get(filename);
      if (typeof file == 'string') {
        alert(file);
      }
    }
  });
  var browser = $('.browser').eq(0).browse();
})(jQuery);

github('jcubic/jquery.filebrowser');

              
            
!
999px

Console