5 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
6 <title>listing directory {directory}</title>
10 var el = 'string' == typeof id
11 ? document.getElementById(id)
14 el.on = function(event, fn){
15 if ('content loaded' == event) {
16 event = window.attachEvent ? "load" : "DOMContentLoaded";
19 ? el.addEventListener(event, fn, false)
20 : el.attachEvent("on" + event, fn);
23 el.all = function(selector){
24 return $(el.querySelectorAll(selector));
27 el.each = function(fn){
28 for (var i = 0, len = el.length; i < len; ++i) {
33 el.getClasses = function(){
34 return this.getAttribute('class').split(/\s+/);
37 el.addClass = function(name){
38 var classes = this.getAttribute('class');
39 el.setAttribute('class', classes
40 ? classes + ' ' + name
44 el.removeClass = function(name){
45 var classes = this.getClasses().filter(function(curr){
48 this.setAttribute('class', classes.join(' '));
55 var str = $('search').value
56 , links = $('files').all('a');
58 links.each(function(link){
59 var text = link.textContent;
61 if ('..' == text) return;
62 if (str.length && ~text.indexOf(str)) {
63 link.addClass('highlight');
65 link.removeClass('highlight');
70 $(window).on('content loaded', function(){
71 $('search').on('keyup', search);
75 <body class="directory">
76 <input id="search" type="text" placeholder="Search" autocomplete="off" />
78 <h1><a href="/">~</a>{linked-path}</h1>