diff options
author | Izzy Galvez <i@igalvez.net> | 2014-09-22 08:52:56 +0400 |
---|---|---|
committer | Izzy Galvez <i@igalvez.net> | 2014-09-22 08:52:56 +0400 |
commit | fab4e9f2f8be905951411474c033ddc84830c561 (patch) | |
tree | 18fb34a749be6022bcc9c304c7c45c7a102d1fa6 | |
parent | eb57b88f7766f4118db7c31978124a910b29adb0 (diff) |
proof of concept works! adding existing code to repo
-rwxr-xr-x | .autoindex/.htaccess | 1 | ||||
-rwxr-xr-x | .autoindex/breadcrumbs.js | 27 | ||||
-rwxr-xr-x | .autoindex/css.shtml | 8 | ||||
-rwxr-xr-x | .autoindex/docs/images/breadcrumbs.png | bin | 0 -> 4985 bytes | |||
-rwxr-xr-x | .autoindex/docs/images/folders.png | bin | 0 -> 49086 bytes | |||
-rwxr-xr-x | .autoindex/docs/images/home.png | bin | 0 -> 29954 bytes | |||
-rw-r--r-- | .autoindex/error/.htaccess | 1 | ||||
-rwxr-xr-x | .autoindex/error/403.shtml | 33 | ||||
-rwxr-xr-x | .autoindex/error/404.shtml | 33 | ||||
-rwxr-xr-x | .autoindex/error/500.shtml | 33 | ||||
-rwxr-xr-x | .autoindex/error/js.shtml | 34 | ||||
-rwxr-xr-x | .autoindex/file-types.js | 46 | ||||
-rwxr-xr-x | .autoindex/folder-path.shtml | 4 | ||||
-rwxr-xr-x | .autoindex/footer-info.shtml | 5 | ||||
-rwxr-xr-x | .autoindex/footer.shtml | 11 | ||||
-rwxr-xr-x | .autoindex/header.shtml | 21 | ||||
-rwxr-xr-x | .autoindex/js.shtml | 7 | ||||
-rwxr-xr-x | .autoindex/meta.shtml | 2 | ||||
-rwxr-xr-x | .autoindex/navbar.shtml | 18 | ||||
-rwxr-xr-x | .autoindex/script.js | 123 | ||||
-rwxr-xr-x | .autoindex/style.css | 131 | ||||
-rwxr-xr-x | .htaccess | 27 |
22 files changed, 565 insertions, 0 deletions
diff --git a/.autoindex/.htaccess b/.autoindex/.htaccess new file mode 100755 index 0000000..45552cb --- /dev/null +++ b/.autoindex/.htaccess @@ -0,0 +1 @@ +Options -Indexes
\ No newline at end of file diff --git a/.autoindex/breadcrumbs.js b/.autoindex/breadcrumbs.js new file mode 100755 index 0000000..a23ba08 --- /dev/null +++ b/.autoindex/breadcrumbs.js @@ -0,0 +1,27 @@ +var parts = document.URL.split('/'); +parts.pop(); // remove last element + +if(parts.length > 3) { + + var breadcrumbs = '<a href="/"><i class="fa fa-fw fa-home"></i>' /*+ parts[0] + '//' + parts[2].replace(/(\W)/g, '$1<wbr/>') */+ '<span>/</span></a>'; + + var current = ''; + for(var i = 3; i < parts.length; i++) { + + current += '/' + parts[i]; + breadcrumbs += '<a '; + + if(i == parts.length - 1) { + breadcrumbs += 'class="active" '; + } + + breadcrumbs += 'href="' + current + '/">' + parts[i].replace(/(\W)/g, '$1<wbr/>') + '<span>/</span></a></i>'; + + } +} else { + + var breadcrumbs = '<a class="active" href="/"><i class="fa fa-fw fa-home"></i>' /*+ parts[0] + '//' + parts[2].replace(/(\W)/g, '$1<wbr/>')*/ + '<span>/</span></a>'; + +} + +$('#url').html(breadcrumbs);
\ No newline at end of file diff --git a/.autoindex/css.shtml b/.autoindex/css.shtml new file mode 100755 index 0000000..c89177a --- /dev/null +++ b/.autoindex/css.shtml @@ -0,0 +1,8 @@ +<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/> +<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> +<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"/> +<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,400italic,700,700italic"/> +<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Code+Pro"/> +<style> +<!--#include virtual="/.autoindex/style.css" --> +</style>
\ No newline at end of file diff --git a/.autoindex/docs/images/breadcrumbs.png b/.autoindex/docs/images/breadcrumbs.png Binary files differnew file mode 100755 index 0000000..bd27c51 --- /dev/null +++ b/.autoindex/docs/images/breadcrumbs.png diff --git a/.autoindex/docs/images/folders.png b/.autoindex/docs/images/folders.png Binary files differnew file mode 100755 index 0000000..c304728 --- /dev/null +++ b/.autoindex/docs/images/folders.png diff --git a/.autoindex/docs/images/home.png b/.autoindex/docs/images/home.png Binary files differnew file mode 100755 index 0000000..ccf0c29 --- /dev/null +++ b/.autoindex/docs/images/home.png diff --git a/.autoindex/error/.htaccess b/.autoindex/error/.htaccess new file mode 100644 index 0000000..45552cb --- /dev/null +++ b/.autoindex/error/.htaccess @@ -0,0 +1 @@ +Options -Indexes
\ No newline at end of file diff --git a/.autoindex/error/403.shtml b/.autoindex/error/403.shtml new file mode 100755 index 0000000..e0755c2 --- /dev/null +++ b/.autoindex/error/403.shtml @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + +<!--#include virtual="/.autoindex/meta.shtml" --> + +<title>HTTP 401: Forbidden</title> + +<!--#include virtual="/.autoindex/css.shtml" --> + +</head> +<body> + +<div id="wrapper" class="container" style="display: none;"> + +<!--#include virtual="/.autoindex/navbar.shtml" --> + +<!--#include virtual="/.autoindex/folder-path.shtml" --> + + <div class="alert alert-warning"> + <div class="alert-title"><i class="fa fa-fw fa-lock"></i>HTTP 401: Forbidden</div> + <div class="alert-content">You do not have permission to access the following resource:<br/><span></span></div> + <button id="back" type="button" class="btn btn-warning"><i class="fa fa-arrow-left"></i>Back</button> + </div> + +<!--#include virtual="/.autoindex/footer-info.shtml" --> + +</div><!--/.container --> + +<!--#include virtual="/.autoindex/error/js.shtml" --> + +</body> +</html>
\ No newline at end of file diff --git a/.autoindex/error/404.shtml b/.autoindex/error/404.shtml new file mode 100755 index 0000000..4ff661e --- /dev/null +++ b/.autoindex/error/404.shtml @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + +<!--#include virtual="/.autoindex/meta.shtml" --> + +<title>HTTP 404: Not Found</title> + +<!--#include virtual="/.autoindex/css.shtml" --> + +</head> +<body> + +<div id="wrapper" class="container" style="display: none;"> + +<!--#include virtual="/.autoindex/navbar.shtml" --> + +<!--#include virtual="/.autoindex/folder-path.shtml" --> + + <div class="alert alert-warning"> + <div class="alert-title"><i class="fa fa-fw fa-search"></i>HTTP 404: Not Found</div> + <div class="alert-content">The server could not find the following resource:<br/><span></span></div> + <button id="back" type="button" class="btn btn-warning"><i class="fa fa-arrow-left"></i>Back</button> + </div> + +<!--#include virtual="/.autoindex/footer-info.shtml" --> + +</div><!--/.container --> + +<!--#include virtual="/.autoindex/error/js.shtml" --> + +</body> +</html>
\ No newline at end of file diff --git a/.autoindex/error/500.shtml b/.autoindex/error/500.shtml new file mode 100755 index 0000000..343ee11 --- /dev/null +++ b/.autoindex/error/500.shtml @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + +<!--#include virtual="/.autoindex/meta.shtml" --> + +<title>HTTP 500: Internal Server Error</title> + +<!--#include virtual="/.autoindex/css.shtml" --> + +</head> +<body> + +<div id="wrapper" class="container" style="display: none;"> + +<!--#include virtual="/.autoindex/navbar.shtml" --> + +<!--#include virtual="/.autoindex/folder-path.shtml" --> + + <div class="alert alert-danger"> + <div class="alert-title"><i class="fa fa-fw fa-ambulance"></i>HTTP 500: Internal Server Error</div> + <div class="alert-content">The server experienced an unexpected error when loading the following resource:<br/><span></span></div> + <button id="back" type="button" class="btn btn-danger"><i class="fa fa-arrow-left"></i>Back</button> + </div> + +<!--#include virtual="/.autoindex/footer-info.shtml" --> + +</div><!--/.container --> + +<!--#include virtual="/.autoindex/error/js.shtml" --> + +</body> +</html>
\ No newline at end of file diff --git a/.autoindex/error/js.shtml b/.autoindex/error/js.shtml new file mode 100755 index 0000000..e4490c0 --- /dev/null +++ b/.autoindex/error/js.shtml @@ -0,0 +1,34 @@ +<script src="//code.jquery.com/jquery-2.1.1.min.js"></script> +<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> +<script> + +var parts = document.URL.split('/'); + +if(parts[parts.length - 1] == '') { + + parts.pop(); + var last = parts.pop(); + var url = parts.join('/') + '/<b>' + last + '/</b>'; + +} else { + + var last = parts.pop(); + var url = parts.join('/') + '/<b>' + last + '</b>'; + +} + +$('.alert-content span').html('<a href="' + document.URL + '">' + url + '</a>'); + +$('#back').click(function() { + history.go(-1); +}); + +$('#refresh').click(function(e) { + e.preventDefault(); + location.reload(); +}); + +<!--#include virtual="/.autoindex/breadcrumbs.js" --> + +$('#wrapper').show(); +</script>
\ No newline at end of file diff --git a/.autoindex/file-types.js b/.autoindex/file-types.js new file mode 100755 index 0000000..83d09bb --- /dev/null +++ b/.autoindex/file-types.js @@ -0,0 +1,46 @@ +var iconText = 'file-text-o'; +var iconCode = 'file-code-o'; +var iconImage = 'picture-o'; +var iconFont = 'font'; + +var filesText = [ + 'txt', + 'pem' +]; + +var filesWeb = [ // web pages +] + +var filesCode = [ + 'html', + 'js', + 'css', + 'scss', + 'less', + 'map', + 'json', + 'yml', + 'xml', + 'jade', + 'md', + 'py', + 'sh', + 'svg', + 'cgi' +] + +var filesImage = [ + 'jpg', + 'jpeg', + 'png', + 'gif', + 'tiff', + 'ico' +] + +var filesFont = [ + 'otf', + 'eot', + 'ttf', + 'woff' +] diff --git a/.autoindex/folder-path.shtml b/.autoindex/folder-path.shtml new file mode 100755 index 0000000..67b3a84 --- /dev/null +++ b/.autoindex/folder-path.shtml @@ -0,0 +1,4 @@ +<div class="panel panel-default"> + <div class="panel-heading">Folder Path</div> + <div class="panel-body" id="url"></div> +</div>
\ No newline at end of file diff --git a/.autoindex/footer-info.shtml b/.autoindex/footer-info.shtml new file mode 100755 index 0000000..5a3f4eb --- /dev/null +++ b/.autoindex/footer-info.shtml @@ -0,0 +1,5 @@ +<div id="footer"> + <p>Server IP Address: <!--#echo var="SERVER_ADDR" --></p> + <p>Server Admin: <a href="mailto:<!--#echo var="SERVER_ADMIN" -->"><!--#echo var="SERVER_ADMIN" --></a></p> + <p>Generated by: Apache + <a href="https://github.com/iglvzx/IGalvez.Autoindex" target="_blank"><i class="fa fa-github-alt"></i>IGalvez.Autoindex</a></p> +</div>
\ No newline at end of file diff --git a/.autoindex/footer.shtml b/.autoindex/footer.shtml new file mode 100755 index 0000000..cccb4ab --- /dev/null +++ b/.autoindex/footer.shtml @@ -0,0 +1,11 @@ + </div><!--/.table-reponsive --> +</div><!--/.panel --> + +<!--#include virtual="/.autoindex/footer-info.shtml" --> + +</div><!--/.container --> + +<!--#include virtual="/.autoindex/js.shtml" --> + +</body> +</html>
\ No newline at end of file diff --git a/.autoindex/header.shtml b/.autoindex/header.shtml new file mode 100755 index 0000000..ef23d44 --- /dev/null +++ b/.autoindex/header.shtml @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + +<!--#include virtual="/.autoindex/meta.shtml" --> + +<title></title> + +<!--#include virtual="/.autoindex/css.shtml" --> + +</head> +<body> + +<div id="wrapper" class="container" style="display: none;"> + +<!--#include virtual="/.autoindex/navbar.shtml" --> + +<!--#include virtual="/.autoindex/folder-path.shtml" --> + +<div class="panel panel-default"> + <div class="table-responsive">
\ No newline at end of file diff --git a/.autoindex/js.shtml b/.autoindex/js.shtml new file mode 100755 index 0000000..2caf64c --- /dev/null +++ b/.autoindex/js.shtml @@ -0,0 +1,7 @@ +<script src="//code.jquery.com/jquery-2.1.1.min.js"></script> +<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> +<script> +<!--#include virtual="/.autoindex/file-types.js" --> +<!--#include virtual="/.autoindex/breadcrumbs.js" --> +<!--#include virtual="/.autoindex/script.js" --> +</script>
\ No newline at end of file diff --git a/.autoindex/meta.shtml b/.autoindex/meta.shtml new file mode 100755 index 0000000..6892e40 --- /dev/null +++ b/.autoindex/meta.shtml @@ -0,0 +1,2 @@ +<meta charset="utf-8"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/>
\ No newline at end of file diff --git a/.autoindex/navbar.shtml b/.autoindex/navbar.shtml new file mode 100755 index 0000000..5b35e8e --- /dev/null +++ b/.autoindex/navbar.shtml @@ -0,0 +1,18 @@ +<div class="navbar navbar-default" role="navigation"> +<div class="container-fluid"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="/"><!--#echo var="HTTP_HOST" --></a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav" id="nav-buttons"> + <li><a id="refresh" href="#"><i class="fa fa-repeat"></i>Refresh</a></li> + </ul> + </div><!--/.nav-collapse --> +</div><!--/.container-fluid --> +</div>
\ No newline at end of file diff --git a/.autoindex/script.js b/.autoindex/script.js new file mode 100755 index 0000000..5fd5547 --- /dev/null +++ b/.autoindex/script.js @@ -0,0 +1,123 @@ +// set page title ---------------------------------------------------------------------------------- +document.title = document.URL; + +$('table').addClass('table'); // add Bootstrap CSS to table + +$('td').removeAttr('align'); // remove align="right" from cells + +$('td').each(function() { // change text for no size value + if(this.innerHTML == ' - ') { + this.innerHTML = ''; + } +}); + +// move header row to thead ------------------------------------------------------------------------ +var header = $('table tbody tr').first(); + +var thead = $('<thead/>'); +thead.append(header); +$('table').prepend(thead); + +// CSS and icons for header links ------------------------------------------------------------------ +var hName = $('a', header).eq(0); +var hModified = $('a', header).eq(1); +var hSize = $('a', header).eq(2); + +if(/\/$/.test(document.URL)) { + addIcon(hName, 'chevron-down', 'right'); +} else { + if(/\?C=N;O=D$/.test(document.URL)){ + addIcon(hName, 'chevron-up', 'right'); + } else if(/\?C=N;O=A$/.test(document.URL)){ + addIcon(hName, 'chevron-down', 'right'); + } + + if(/\?C=M;O=D$/.test(document.URL)){ + addIcon(hModified, 'chevron-up', 'right'); + } else if(/\?C=M;O=A$/.test(document.URL)){ + addIcon(hModified, 'chevron-down', 'right'); + } + + if(/\?C=S;O=D$/.test(document.URL)){ + addIcon(hSize, 'chevron-up', 'right'); + } else if(/\?C=S;O=A$/.test(document.URL)){ + addIcon(hSize, 'chevron-down', 'right'); + } +} + +function addIcon(object, icon, className) { + var HTML = '<i class="' + className + ' fa fa-fw fa-' + icon + '"></i>'; + + if(className == 'right') { + object.append(HTML); + } else if(className == 'left') { + object.prepend(HTML); + } +} + +// CSS and icons to rows and links ----------------------------------------------------------------- +$('table tbody tr').each(function(i, obj) { + + var link = $('a', this).first(); + link.parent().addClass('td-link'); + var file = link.text(); + + if(file == 'Parent Directory' && i == 0){ // parent directory + link.attr('data-type', 'parent'); + link.attr('id', 'parent'); + $(this).addClass('warning'); + link.text('../'); + addIcon(link, 'folder', 'left'); + + } else { + + if (file.substring(file.length - 1) == '/') { + link.attr('data-type', 'folder'); + $(this).addClass('active'); + addIcon(link, 'folder', 'left'); + } else { + + var fparts = file.split('.'); + + if(fparts.length > 1) { + + var ext = fparts[fparts.length - 1]; + + if($.inArray(ext, filesText) > -1) { // text files + addIcon(link, iconText, 'left'); + showSource = true; + } else if($.inArray(ext, filesCode) > -1) { // code + addIcon(link, iconCode, 'left'); + showSource = true; + } else if($.inArray(ext, filesImage) > -1) { // images + addIcon(link, iconImage, 'left'); + } else if($.inArray(ext, filesFont) > -1) { // fonts + addIcon(link, iconFont, 'left'); + } else { // unknown file extension + addIcon(link, 'file-o', 'left'); + } + + } else { // files with no extension + addIcon(link, 'file-o', 'left'); + } + + link.attr('target', '_blank'); + link.attr('data-type', 'file'); + } + + } + +}); + +$('#refresh').click(function(e) { + e.preventDefault(); + location.reload(); +}); + +var parent = $('#parent'); + +if(parent.length) { + $('#nav-buttons').append('<li><a href="' + parent.attr('href') + '"><i class="fa fa-arrow-up"></i>Up</a></li>'); +} + +$('#wrapper').show();
\ No newline at end of file diff --git a/.autoindex/style.css b/.autoindex/style.css new file mode 100755 index 0000000..9a04614 --- /dev/null +++ b/.autoindex/style.css @@ -0,0 +1,131 @@ +html { + overflow-y: scroll; +} + +body { + padding-top: 15px; + padding-bottom: 15px; + font-family: Roboto, sans-serif; + font-size: 15px; +} + +tr a { + display: block; + padding: 8px; +} + +div.panel.panel-default > div.table-responsive > table.table.table-bordered > thead > tr > th { + /* border-bottom: 2px solid #DDD; */ +} + +tbody > tr > td.td-link, +.table > thead > tr > th { + padding: 0; +} + +#url a .fa { + + font-size: 18px; +} + +#url .active { + font-weight: bold; +} + +a .fa.left { + margin-right: 8px; + font-size: 18px; +} + +a .fa.right { + margin-left: 4px; + font-size: 15px; +} + +.panel, .alert, .btn, pre, .navbar, .navbar-toggle { + /*border-radius: 2px;*/ + /*box-shadow: none;*/ +} + +.navbar .fa { + margin-right: 8px; +} + +.panel-heading { + font-weight: bold; +} + +.panel-body { + padding: 8px; +} + +a[data-type="parent"] .fa { + /*transform: rotate(-45deg); */ +} + +.alert { + padding: 8px; +} + +.alert .btn { + margin: 0; + padding: 0; + padding: 4px 8px; + margin-top: 8px; +} + +.btn .fa { + margin-right: 4px; +} + + +.alert-title { + font-size: 18px; + font-weight: bold; +} + +.alert-title .fa { + margin-right: 8px; +} + +.alert-title + .alert-content { + margin-top: 4px; +} + +.alert .btn + .btn { + margin-left: 4px; +} + +.table > .new-thead > tr > th { + padding: 8px; +} + +tr.header { + font-weight: bold; +} + +pre { + font-family: 'Source Code Pro', monospace; + font-size: 13px; +} + +pre.text-file { + margin-bottom: 20px; + padding: 8px; + max-height: 400px; + margin-top: -10px; +} + +#footer { + color: #999; + margin-top: -5px; +} + +#footer .fa { + margin-right: 4px; +} + +#footer p { + padding: 0; + margin: 0; +}
\ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100755 index 0000000..8c19086 --- /dev/null +++ b/.htaccess @@ -0,0 +1,27 @@ +DirectoryIndex ff307feeee3339bcb5dbdfc9904e4f20 +Options +Indexes +Options +Includes + +AddType text/html .shtml +AddOutputFilter INCLUDES .shtml + +AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/json + +IndexOptions Charset=UTF-8 +IndexOptions FancyIndexing +IndexOptions SuppressHTMLPreamble +IndexOptions HTMLTable +IndexOptions VersionSort +IndexOptions SuppressDescription +IndexOptions SuppressIcon +IndexOptions SuppressRules +IndexOptions FoldersFirst +IndexOptions IgnoreCase +IndexOptions NameWidth=* + +HeaderName /.autoindex/header.shtml +ReadmeName /.autoindex/footer.shtml + +ErrorDocument 404 /.autoindex/error/404.shtml +ErrorDocument 403 /.autoindex/error/403.shtml +ErrorDocument 500 /.autoindex/error/500.shtml |