commit 82a2620c78d38b7ddc6cb0b72cbf608fda8d20cb Author: Yazzi Hsueh Date: Sun Jun 18 07:27:01 2023 +0800 Initial commit diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..70cb615 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Yazzi Hsueh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7aa8f55 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +NGINX FancyIndex Theme +=== + +A prettier theme for nginx' fancyindex module. Further details about this excellent +module can be found at the dev's [github page](https://github.com/aperezdc/ngx-fancyindex). + +####NOTE: +NGX-FANCYINDEX truncates the file name to 50 characters subtracts 3 and then +appends a "..>" to the truncated name. This can be fixed by recompiling +NGX-FANCYINDEX after changing line 55 of "ngx_http_fancyindex_module.c": + +From: + + #define NGX_HTTP_FANCYINDEX_NAME_LEN 50 + +To: + + #define NGX_HTTP_FANCYINDEX_NAME_LEN 500 (or some other number greater than 50) + +#####Usage: + - Compile nginx with the fancyindex module. + - Include the contents of 'fancyindex.conf' in your location directive of your nginx conf. + - copy the remaining items in your web root under 'fancyindex'. + - header.html + - footer.html + - css\fancyindex.css + - fonts\\* + - images\breadcrumb.png + - Restart your nginx server. + +#####Added/Modified: + - Mime type icons from [Splitbrain](http://www.splitbrain.org/projects/file_icons) + - Icons default to enabled on large devices and off on small devices like phones. + - If you'd prefer no icons at all: copy css\fancyindex_NoIcons.css css\fancyindex.css + - Slightly better handling of mobile CSS click areas. + - Added HTML5 History for quicker page transitions. + - This can be disabled by commenting out the script tag in footer.html + - Fixed CSS issues on older versions of FF + +#####Addendums: + - If you want your 'Parent Directory/' listing back in your file listings: + - Read: [This Issue](https://github.com/TheInsomniac/Nginx-Fancyindex-Theme/issues/1#issuecomment-43936700) + +![Image1](https://raw.githubusercontent.com/TheInsomniac/Nginx-Fancyindex-Theme/master/images/fancyindex.png) + +![Image1](https://raw.githubusercontent.com/TheInsomniac/Nginx-Fancyindex-Theme/master/images/fancyindex1.png) + +![Image1](https://raw.githubusercontent.com/TheInsomniac/Nginx-Fancyindex-Theme/master/images/fancyindex2.png) diff --git a/css/fancyindex.css b/css/fancyindex.css new file mode 100644 index 0000000..93a9dd3 --- /dev/null +++ b/css/fancyindex.css @@ -0,0 +1,466 @@ +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_2_0.eot'); + src: url('../fonts/298CCB_2_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_2_0.woff') format('woff'),url('../fonts/298CCB_2_0.ttf') format('truetype') +} + +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_0_0.eot'); + src: url('../fonts/298CCB_0_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_0_0.woff') format('woff'),url('../fonts/298CCB_0_0.ttf') format('truetype'); + font-weight: 300 +} + +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_1_0.eot'); + src: url('../fonts/298CCB_1_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_1_0.woff') format('woff'),url('../fonts/298CCB_1_0.ttf') format('truetype'); + font-weight: 500 +} + +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_3_0.eot'); + src: url('../fonts/298CCB_3_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_3_0.woff') format('woff'),url('../fonts/298CCB_3_0.ttf') format('truetype'); + font-weight: bold +} + +*, +*:before, +*:after { + box-sizing: border-box; +} + +.clearfix { + *zoom: 1; +} + +.clearfix:before, +.clearfix:after { + display: table; + line-height: 0; + content: ""; +} + +.clearfix:after { + clear: both; +} + +html, body { + /* height: 100%; */ + font-size: 100%; + background-color: #f7f7f7; + font-family: "ProximaNova"; +} + +.box { + border: 1px solid #d9d6d6; + width: 100%; +} + +.box .box-header { + font-weight: 500; + font-style: normal; + background: #f7f7f7; + background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#f7f7f7)); + background: -webkit-linear-gradient(top,#fff,#f7f7f7); + background: linear-gradient(top,#fff,#f7f7f7); + text-transform: uppercase; + height: 45px; + font-size: 16px; + border-bottom: 1px solid #d9d6d6; +} + +.box .box-header .box-header-content { + padding: 12px 20px; + font-weight: 700; + position: relative; +} + +.box .box-content { + width: 97%; + margin: 20px auto; + background: #fff; +} + +.box.box-breadcrumbs .box-header { + height: auto; +} + +.box.box-breadcrumbs .box-header-content { + padding: 0; +} + +.breadcrumbs a { + position: relative; + display: inline-block; + padding: 8px 18px 8px 10px; + font-weight: 400; + font-size: 12px; + color: #a3a9ab; + text-shadow: 0 1px 0 #FFF; + -webkit-transition: 300ms color; + transition: 300ms color; +} + +.breadcrumbs a:after { + display: block; + content: ''; + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: 20px; + background: url(../images/breadcrumb.png) no-repeat center right; +} + +.breadcrumbs a:hover { + color: #50b1ff; + text-decoration: none; + background: none; +} + +tbody tr:first-child { + display: none; +} + +tr.e { + background:#f7f7f7; +} + +th,td { + padding:0.1em 0.5em; +} + +th { + text-align:left; + font-weight:500; + background:#eee; + border-bottom: 1px solid #d9d6d6; +} + +th > a { + color: #333; +} + +h1 { + font-size: 1.5rem; + color: #333; + display: none; +} + +#list { + border:1px solid #d9d6d6; + width:100%; +} + +td > a { + display: block; +} + +a { + color:#777; + text-decoration: none; +} + +a:hover { + color:#333; +} + +@media screen and (max-width: 1024px) { + tr > td:nth-child(3) { + display: none; + } + thead > tr > th:nth-child(3) { + display: none; + } + .box .box-content { + padding-top: 20px; + padding-bottom: 0; + padding-left: 0; + padding-right: 0; + } +} + +@media screen and (min-width: 1025px) { + + /* I C O N S (only on 1024+ px resolutions) + ~~~~~~~~~~~~*/ + + #list a[href*="."]:before, #list a[href*="/"]:before, + #list a[href~="INSTALL"]:before, #list a[href~="README"]:before, + #list a[href~="CHANGELOG"]:before, #list a[href~="COPYING"]:before { + background: url('../icons/file.png') left center no-repeat; + content: ""; padding: 0 22px 0 0; + } + + #list a[href*="."]:after, #list a[href*="/"]:after { + content: ""; + } + + #list a[href$="/"]:before, #list a[href*="/?"]:before { + background: url('../icons/folder_black.png') left center no-repeat; + } + + + /* A P P L I C A T I O N + ~~~~~~~~~~~~~~~~~~~~~~~~*/ + + #list a[href$=".doc"]:before { + background: url('../icons/doc.png') left center no-repeat; + } + + #list a[href$=".pdf"]:before { + background: url('../icons/pdf.png') left center no-repeat; + } + + #list a[href$=".pgp"]:before { + background: url('../icons/pgp.png') left center no-repeat; + } + + #list a[href$=".xml"]:before { + background: url('../icons/xml.png') left center no-repeat; + } + + #list a[href$=".xls"]:before { + background: url('../icons/xls.png') left center no-repeat; + } + + #list a[href$=".ppt"]:before { + background: url('../icons/ppt.png') left center no-repeat; + } + + #list a[href$=".7z"]:before { + background: url('../icons/7z.png') left center no-repeat; + } + + #list a[href$=".torrent"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".iso"]:before { + background: url('../icons/iso.png') left center no-repeat; + } + + #list a[href$=".cue"]:before, #list a[href$=".bin"]:before { + background: url('../icons/bin.png') left center no-repeat; + } + + #list a[href$=".deb"]:before { + background: url('../icons/deb.png') left center no-repeat; + } + + #list a[href$=".exe"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".swf"]:before { + background: url('../icons/swf.png') left center no-repeat; + } + + #list a[href$=".tgz"]:before, #list a[href$=".tar.gz"]:before, + #list a[href$=".tar.xz"]:before { + background: url('../icons/tgz.png') left center no-repeat; + } + + #list a[href$=".xpi"]:before { + background: url('../icons/xpi.png') left center no-repeat; + } + + #list a[href$=".apk"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".bat"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".jar"]:before { + background: url('../icons/jar.png') left center no-repeat; + } + + #list a[href$=".pl"]:before { + background: url('../icons/pl.png') left center no-repeat; + } + + #list a[href$=".php"]:before { + background: url('../icons/php.png') left center no-repeat; + } + + #list a[href$=".rar"]:before { + background: url('../icons/rar.png') left center no-repeat; + } + + #list a[href$=".rpm"]:before { + background: url('../icons/rpm.png') left center no-repeat; + } + + #list a[href$=".rb"]:before { + background: url('../icons/rb.png') left center no-repeat; + } + + #list a[href$=".tar"]:before { + background: url('../icons/tar.png') left center no-repeat; + } + + #list a[href$=".zip"]:before { + background: url('../icons/zip.png') left center no-repeat; + } + + /* A U D I O + ~~~~~~~~~~~~*/ + + #list a[href$=".m3u"]:before { + background: url('../icons/audio.png') left center no-repeat; + } + + #list a[href$=".mpeg"]:before { + background: url('../icons/mpg.png') left center no-repeat; + } + + #list a[href$=".wma"]:before { + background: url('../icons/audio.png') left center no-repeat; + } + + #list a[href$=".ogg"]:before { + background: url('../icons/ogg.png') left center no-repeat; + } + + #list a[href$=".wav"]:before { + background: url('../icons/wav.png') left center no-repeat; + } + + + #list a[href$=".flac"]:before { + background: url('../icons/audio.png') left center no-repeat; + } + + /* I M A G E + ~~~~~~~~~~~~*/ + + #list a[href$=".bmp"]:before, #list a[href$=".svg"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + #list a[href$=".gif"]:before { + background: url('../icons/gif.png') left center no-repeat; + } + + #list a[href$=".jpg"]:before, #list a[href$=".jpeg"]:before { + background: url('../icons/jpeg.png') left center no-repeat; + } + + #list a[href$=".png"]:before { + background: url('../icons/png.png') left center no-repeat; + } + + #list a[href$=".tiff"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + #list a[href$=".ico"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + #list a[href$=".psd"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + #list a[href$=".xcf"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + + /* T E X T + ~~~~~~~~~~*/ + + #list a[href$=".css"]:before { + background: url('../icons/css.png') left center no-repeat; + } + + #list a[href$=".htm"]:before, #list a[href$=".html"]:before, + #list a[href$=".md"]:before { + background: url('../icons/html.png') left center no-repeat; + } + + #list a[href$=".txt"]:before, #list a[href$=".json"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href$=".csv"]:before { + background: url('../icons/csv.png') left center no-repeat; + } + + #list a[href$=".conf"]:before { + background: url('../icons/conf.png') left center no-repeat; + } + + #list a[href$=".rtf"]:before { + background: url('../icons/rtf.png') left center no-repeat; + } + + #list a[href$=".bak"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".c"]:before { + background: url('../icons/c.png') left center no-repeat; + } + + #list a[href$=".cpp"]:before { + background: url('../icons/cpp.png') left center no-repeat; + } + + #list a[href~="CHANGELOG"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href~="COPYING"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href~="INSTALL"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href$=".java"]:before { + background: url('../icons/java.png') left center no-repeat; + } + + #list a[href$=".js"]:before { + background: url('../icons/js.png') left center no-repeat; + } + + #list a[href$=".h"]:before { + background: url('../icons/c.png') left center no-repeat; + } + + #list a[href$=".py"]:before { + background: url('../icons/py.png') left center no-repeat; + } + + #list a[href~="README"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href$=".sh"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".sql"]:before { + background: url('../icons/sql.png') left center no-repeat; + } + + #list a[href$=".xml"]:before { + background: url('../icons/xml.png') left center no-repeat; + } + + /* V I D E O + ~~~~~~~~~~~~*/ + + #list a[href$=".avi"]:before, #list a[href$=".mp4"]:before, + #list a[href$=".mkv"]:before, #list a[href$=".divx"]:before, + #list a[href$=".wmv"]:before { + background: url('../icons/video.png') left center no-repeat; + } +} diff --git a/css/fancyindex_Icons.css b/css/fancyindex_Icons.css new file mode 100644 index 0000000..93a9dd3 --- /dev/null +++ b/css/fancyindex_Icons.css @@ -0,0 +1,466 @@ +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_2_0.eot'); + src: url('../fonts/298CCB_2_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_2_0.woff') format('woff'),url('../fonts/298CCB_2_0.ttf') format('truetype') +} + +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_0_0.eot'); + src: url('../fonts/298CCB_0_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_0_0.woff') format('woff'),url('../fonts/298CCB_0_0.ttf') format('truetype'); + font-weight: 300 +} + +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_1_0.eot'); + src: url('../fonts/298CCB_1_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_1_0.woff') format('woff'),url('../fonts/298CCB_1_0.ttf') format('truetype'); + font-weight: 500 +} + +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_3_0.eot'); + src: url('../fonts/298CCB_3_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_3_0.woff') format('woff'),url('../fonts/298CCB_3_0.ttf') format('truetype'); + font-weight: bold +} + +*, +*:before, +*:after { + box-sizing: border-box; +} + +.clearfix { + *zoom: 1; +} + +.clearfix:before, +.clearfix:after { + display: table; + line-height: 0; + content: ""; +} + +.clearfix:after { + clear: both; +} + +html, body { + /* height: 100%; */ + font-size: 100%; + background-color: #f7f7f7; + font-family: "ProximaNova"; +} + +.box { + border: 1px solid #d9d6d6; + width: 100%; +} + +.box .box-header { + font-weight: 500; + font-style: normal; + background: #f7f7f7; + background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#f7f7f7)); + background: -webkit-linear-gradient(top,#fff,#f7f7f7); + background: linear-gradient(top,#fff,#f7f7f7); + text-transform: uppercase; + height: 45px; + font-size: 16px; + border-bottom: 1px solid #d9d6d6; +} + +.box .box-header .box-header-content { + padding: 12px 20px; + font-weight: 700; + position: relative; +} + +.box .box-content { + width: 97%; + margin: 20px auto; + background: #fff; +} + +.box.box-breadcrumbs .box-header { + height: auto; +} + +.box.box-breadcrumbs .box-header-content { + padding: 0; +} + +.breadcrumbs a { + position: relative; + display: inline-block; + padding: 8px 18px 8px 10px; + font-weight: 400; + font-size: 12px; + color: #a3a9ab; + text-shadow: 0 1px 0 #FFF; + -webkit-transition: 300ms color; + transition: 300ms color; +} + +.breadcrumbs a:after { + display: block; + content: ''; + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: 20px; + background: url(../images/breadcrumb.png) no-repeat center right; +} + +.breadcrumbs a:hover { + color: #50b1ff; + text-decoration: none; + background: none; +} + +tbody tr:first-child { + display: none; +} + +tr.e { + background:#f7f7f7; +} + +th,td { + padding:0.1em 0.5em; +} + +th { + text-align:left; + font-weight:500; + background:#eee; + border-bottom: 1px solid #d9d6d6; +} + +th > a { + color: #333; +} + +h1 { + font-size: 1.5rem; + color: #333; + display: none; +} + +#list { + border:1px solid #d9d6d6; + width:100%; +} + +td > a { + display: block; +} + +a { + color:#777; + text-decoration: none; +} + +a:hover { + color:#333; +} + +@media screen and (max-width: 1024px) { + tr > td:nth-child(3) { + display: none; + } + thead > tr > th:nth-child(3) { + display: none; + } + .box .box-content { + padding-top: 20px; + padding-bottom: 0; + padding-left: 0; + padding-right: 0; + } +} + +@media screen and (min-width: 1025px) { + + /* I C O N S (only on 1024+ px resolutions) + ~~~~~~~~~~~~*/ + + #list a[href*="."]:before, #list a[href*="/"]:before, + #list a[href~="INSTALL"]:before, #list a[href~="README"]:before, + #list a[href~="CHANGELOG"]:before, #list a[href~="COPYING"]:before { + background: url('../icons/file.png') left center no-repeat; + content: ""; padding: 0 22px 0 0; + } + + #list a[href*="."]:after, #list a[href*="/"]:after { + content: ""; + } + + #list a[href$="/"]:before, #list a[href*="/?"]:before { + background: url('../icons/folder_black.png') left center no-repeat; + } + + + /* A P P L I C A T I O N + ~~~~~~~~~~~~~~~~~~~~~~~~*/ + + #list a[href$=".doc"]:before { + background: url('../icons/doc.png') left center no-repeat; + } + + #list a[href$=".pdf"]:before { + background: url('../icons/pdf.png') left center no-repeat; + } + + #list a[href$=".pgp"]:before { + background: url('../icons/pgp.png') left center no-repeat; + } + + #list a[href$=".xml"]:before { + background: url('../icons/xml.png') left center no-repeat; + } + + #list a[href$=".xls"]:before { + background: url('../icons/xls.png') left center no-repeat; + } + + #list a[href$=".ppt"]:before { + background: url('../icons/ppt.png') left center no-repeat; + } + + #list a[href$=".7z"]:before { + background: url('../icons/7z.png') left center no-repeat; + } + + #list a[href$=".torrent"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".iso"]:before { + background: url('../icons/iso.png') left center no-repeat; + } + + #list a[href$=".cue"]:before, #list a[href$=".bin"]:before { + background: url('../icons/bin.png') left center no-repeat; + } + + #list a[href$=".deb"]:before { + background: url('../icons/deb.png') left center no-repeat; + } + + #list a[href$=".exe"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".swf"]:before { + background: url('../icons/swf.png') left center no-repeat; + } + + #list a[href$=".tgz"]:before, #list a[href$=".tar.gz"]:before, + #list a[href$=".tar.xz"]:before { + background: url('../icons/tgz.png') left center no-repeat; + } + + #list a[href$=".xpi"]:before { + background: url('../icons/xpi.png') left center no-repeat; + } + + #list a[href$=".apk"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".bat"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".jar"]:before { + background: url('../icons/jar.png') left center no-repeat; + } + + #list a[href$=".pl"]:before { + background: url('../icons/pl.png') left center no-repeat; + } + + #list a[href$=".php"]:before { + background: url('../icons/php.png') left center no-repeat; + } + + #list a[href$=".rar"]:before { + background: url('../icons/rar.png') left center no-repeat; + } + + #list a[href$=".rpm"]:before { + background: url('../icons/rpm.png') left center no-repeat; + } + + #list a[href$=".rb"]:before { + background: url('../icons/rb.png') left center no-repeat; + } + + #list a[href$=".tar"]:before { + background: url('../icons/tar.png') left center no-repeat; + } + + #list a[href$=".zip"]:before { + background: url('../icons/zip.png') left center no-repeat; + } + + /* A U D I O + ~~~~~~~~~~~~*/ + + #list a[href$=".m3u"]:before { + background: url('../icons/audio.png') left center no-repeat; + } + + #list a[href$=".mpeg"]:before { + background: url('../icons/mpg.png') left center no-repeat; + } + + #list a[href$=".wma"]:before { + background: url('../icons/audio.png') left center no-repeat; + } + + #list a[href$=".ogg"]:before { + background: url('../icons/ogg.png') left center no-repeat; + } + + #list a[href$=".wav"]:before { + background: url('../icons/wav.png') left center no-repeat; + } + + + #list a[href$=".flac"]:before { + background: url('../icons/audio.png') left center no-repeat; + } + + /* I M A G E + ~~~~~~~~~~~~*/ + + #list a[href$=".bmp"]:before, #list a[href$=".svg"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + #list a[href$=".gif"]:before { + background: url('../icons/gif.png') left center no-repeat; + } + + #list a[href$=".jpg"]:before, #list a[href$=".jpeg"]:before { + background: url('../icons/jpeg.png') left center no-repeat; + } + + #list a[href$=".png"]:before { + background: url('../icons/png.png') left center no-repeat; + } + + #list a[href$=".tiff"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + #list a[href$=".ico"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + #list a[href$=".psd"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + #list a[href$=".xcf"]:before { + background: url('../icons/image.png') left center no-repeat; + } + + + /* T E X T + ~~~~~~~~~~*/ + + #list a[href$=".css"]:before { + background: url('../icons/css.png') left center no-repeat; + } + + #list a[href$=".htm"]:before, #list a[href$=".html"]:before, + #list a[href$=".md"]:before { + background: url('../icons/html.png') left center no-repeat; + } + + #list a[href$=".txt"]:before, #list a[href$=".json"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href$=".csv"]:before { + background: url('../icons/csv.png') left center no-repeat; + } + + #list a[href$=".conf"]:before { + background: url('../icons/conf.png') left center no-repeat; + } + + #list a[href$=".rtf"]:before { + background: url('../icons/rtf.png') left center no-repeat; + } + + #list a[href$=".bak"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".c"]:before { + background: url('../icons/c.png') left center no-repeat; + } + + #list a[href$=".cpp"]:before { + background: url('../icons/cpp.png') left center no-repeat; + } + + #list a[href~="CHANGELOG"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href~="COPYING"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href~="INSTALL"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href$=".java"]:before { + background: url('../icons/java.png') left center no-repeat; + } + + #list a[href$=".js"]:before { + background: url('../icons/js.png') left center no-repeat; + } + + #list a[href$=".h"]:before { + background: url('../icons/c.png') left center no-repeat; + } + + #list a[href$=".py"]:before { + background: url('../icons/py.png') left center no-repeat; + } + + #list a[href~="README"]:before { + background: url('../icons/txt.png') left center no-repeat; + } + + #list a[href$=".sh"]:before { + background: url('../icons/file.png') left center no-repeat; + } + + #list a[href$=".sql"]:before { + background: url('../icons/sql.png') left center no-repeat; + } + + #list a[href$=".xml"]:before { + background: url('../icons/xml.png') left center no-repeat; + } + + /* V I D E O + ~~~~~~~~~~~~*/ + + #list a[href$=".avi"]:before, #list a[href$=".mp4"]:before, + #list a[href$=".mkv"]:before, #list a[href$=".divx"]:before, + #list a[href$=".wmv"]:before { + background: url('../icons/video.png') left center no-repeat; + } +} diff --git a/css/fancyindex_NoIcons.css b/css/fancyindex_NoIcons.css new file mode 100644 index 0000000..c9c76a0 --- /dev/null +++ b/css/fancyindex_NoIcons.css @@ -0,0 +1,185 @@ +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_2_0.eot'); + src: url('../fonts/298CCB_2_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_2_0.woff') format('woff'),url('../fonts/298CCB_2_0.ttf') format('truetype') +} + +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_0_0.eot'); + src: url('../fonts/298CCB_0_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_0_0.woff') format('woff'),url('../fonts/298CCB_0_0.ttf') format('truetype'); + font-weight: 300 +} + +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_1_0.eot'); + src: url('../fonts/298CCB_1_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_1_0.woff') format('woff'),url('../fonts/298CCB_1_0.ttf') format('truetype'); + font-weight: 500 +} + +@font-face { + font-family: 'ProximaNova'; + src: url('../fonts/298CCB_3_0.eot'); + src: url('../fonts/298CCB_3_0.eot?#iefix') format('embedded-opentype'),url('../fonts/298CCB_3_0.woff') format('woff'),url('../fonts/298CCB_3_0.ttf') format('truetype'); + font-weight: bold +} + +*, +*:before, +*:after { + box-sizing: border-box; +} + +.clearfix { + *zoom: 1; +} + +.clearfix:before, +.clearfix:after { + display: table; + line-height: 0; + content: ""; +} + +.clearfix:after { + clear: both; +} + +html, body { + /* height: 100%; */ + font-size: 100%; + background-color: #f7f7f7; + font-family: "ProximaNova"; +} + +.box { + border: 1px solid #d9d6d6; + width: 100%; +} + +.box .box-header { + font-weight: 500; + font-style: normal; + background: #f7f7f7; + background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#f7f7f7)); + background: -webkit-linear-gradient(top,#fff,#f7f7f7); + background: linear-gradient(top,#fff,#f7f7f7); + text-transform: uppercase; + height: 45px; + font-size: 16px; + border-bottom: 1px solid #d9d6d6; +} + +.box .box-header .box-header-content { + padding: 12px 20px; + font-weight: 700; + position: relative; +} + +.box .box-content { + width: 97%; + margin: 20px auto; + background: #fff; +} + +.box.box-breadcrumbs .box-header { + height: auto; +} + +.box.box-breadcrumbs .box-header-content { + padding: 0; +} + +.breadcrumbs a { + position: relative; + display: inline-block; + padding: 8px 18px 8px 10px; + font-weight: 400; + font-size: 12px; + color: #a3a9ab; + text-shadow: 0 1px 0 #FFF; + -webkit-transition: 300ms color; + transition: 300ms color; +} + +.breadcrumbs a:after { + display: block; + content: ''; + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: 20px; + background: url(../images/breadcrumb.png) no-repeat center right; +} + +.breadcrumbs a:hover { + color: #50b1ff; + text-decoration: none; + background: none; +} + +tbody tr:first-child { + display: none; +} + +tr.e { + background:#f7f7f7; +} + +th,td { + padding:0.1em 0.5em; +} + +th { + text-align:left; + font-weight:500; + background:#eee; + border-bottom: 1px solid #d9d6d6; +} + +th > a { + color: #333; +} + +h1 { + font-size: 1.5rem; + color: #333; + display: none; +} + +#list { + border:1px solid #d9d6d6; + width:100%; +} + +td > a { + display: block; +} + +a { + color:#777; + text-decoration: none; +} + +a:hover { + color:#333; + /* background: #d7d7d7; */ +} + +@media screen and (max-width: 1024px) { + tr > td:nth-child(3) { + display: none; + } + thead > tr > th:nth-child(3) { + display: none; + } + .box .box-content { + padding-top: 20px; + padding-bottom: 0; + padding-left: 0; + padding-right: 0; + } +} + diff --git a/fancyindex.conf b/fancyindex.conf new file mode 100644 index 0000000..9f9225c --- /dev/null +++ b/fancyindex.conf @@ -0,0 +1,8 @@ +# Include in location directive + fancyindex on; + fancyindex_localtime on; #on for local time zone. off for GMT + fancyindex_exact_size off; #off for human-readable. on for exact size in bytes + fancyindex_header "/fancyindex/header.html"; + fancyindex_footer "/fancyindex/footer.html"; + fancyindex_ignore "fancyindex"; #ignore this directory when showing list +# end include diff --git a/fonts/298CCB_0_0.eot b/fonts/298CCB_0_0.eot new file mode 100644 index 0000000..3fdc479 Binary files /dev/null and b/fonts/298CCB_0_0.eot differ diff --git a/fonts/298CCB_0_0.ttf b/fonts/298CCB_0_0.ttf new file mode 100644 index 0000000..a68a70e Binary files /dev/null and b/fonts/298CCB_0_0.ttf differ diff --git a/fonts/298CCB_0_0.woff b/fonts/298CCB_0_0.woff new file mode 100644 index 0000000..36de6b2 Binary files /dev/null and b/fonts/298CCB_0_0.woff differ diff --git a/fonts/298CCB_1_0.eot b/fonts/298CCB_1_0.eot new file mode 100644 index 0000000..9060d6f Binary files /dev/null and b/fonts/298CCB_1_0.eot differ diff --git a/fonts/298CCB_1_0.ttf b/fonts/298CCB_1_0.ttf new file mode 100644 index 0000000..e945bf9 Binary files /dev/null and b/fonts/298CCB_1_0.ttf differ diff --git a/fonts/298CCB_1_0.woff b/fonts/298CCB_1_0.woff new file mode 100644 index 0000000..46b74b6 Binary files /dev/null and b/fonts/298CCB_1_0.woff differ diff --git a/fonts/298CCB_2_0.eot b/fonts/298CCB_2_0.eot new file mode 100644 index 0000000..c4ee769 Binary files /dev/null and b/fonts/298CCB_2_0.eot differ diff --git a/fonts/298CCB_2_0.ttf b/fonts/298CCB_2_0.ttf new file mode 100644 index 0000000..5741a34 Binary files /dev/null and b/fonts/298CCB_2_0.ttf differ diff --git a/fonts/298CCB_2_0.woff b/fonts/298CCB_2_0.woff new file mode 100644 index 0000000..6c0b852 Binary files /dev/null and b/fonts/298CCB_2_0.woff differ diff --git a/fonts/298CCB_3_0.eot b/fonts/298CCB_3_0.eot new file mode 100644 index 0000000..4204823 Binary files /dev/null and b/fonts/298CCB_3_0.eot differ diff --git a/fonts/298CCB_3_0.ttf b/fonts/298CCB_3_0.ttf new file mode 100644 index 0000000..17cb8b4 Binary files /dev/null and b/fonts/298CCB_3_0.ttf differ diff --git a/fonts/298CCB_3_0.woff b/fonts/298CCB_3_0.woff new file mode 100644 index 0000000..7c41154 Binary files /dev/null and b/fonts/298CCB_3_0.woff differ diff --git a/footer.html b/footer.html new file mode 100644 index 0000000..5bae493 --- /dev/null +++ b/footer.html @@ -0,0 +1,22 @@ + + + + + + + diff --git a/header.html b/header.html new file mode 100644 index 0000000..3c7a260 --- /dev/null +++ b/header.html @@ -0,0 +1,23 @@ + + + + + + + Files... + + + + +
+
+
+ +
+
+
+

Index of: diff --git a/icons/7z.png b/icons/7z.png new file mode 100644 index 0000000..52f7d5d Binary files /dev/null and b/icons/7z.png differ diff --git a/icons/ai.png b/icons/ai.png new file mode 100644 index 0000000..a999762 Binary files /dev/null and b/icons/ai.png differ diff --git a/icons/aiff.png b/icons/aiff.png new file mode 100644 index 0000000..82d523f Binary files /dev/null and b/icons/aiff.png differ diff --git a/icons/asc.png b/icons/asc.png new file mode 100644 index 0000000..d9fa4a8 Binary files /dev/null and b/icons/asc.png differ diff --git a/icons/audio.png b/icons/audio.png new file mode 100644 index 0000000..9888325 Binary files /dev/null and b/icons/audio.png differ diff --git a/icons/bin.png b/icons/bin.png new file mode 100644 index 0000000..fbd174e Binary files /dev/null and b/icons/bin.png differ diff --git a/icons/bz2.png b/icons/bz2.png new file mode 100644 index 0000000..d48cae0 Binary files /dev/null and b/icons/bz2.png differ diff --git a/icons/c.png b/icons/c.png new file mode 100644 index 0000000..efe18f4 Binary files /dev/null and b/icons/c.png differ diff --git a/icons/cfc.png b/icons/cfc.png new file mode 100644 index 0000000..09c149d Binary files /dev/null and b/icons/cfc.png differ diff --git a/icons/cfm.png b/icons/cfm.png new file mode 100644 index 0000000..d755f28 Binary files /dev/null and b/icons/cfm.png differ diff --git a/icons/chm.png b/icons/chm.png new file mode 100644 index 0000000..53d48f3 Binary files /dev/null and b/icons/chm.png differ diff --git a/icons/class.png b/icons/class.png new file mode 100644 index 0000000..a39f70c Binary files /dev/null and b/icons/class.png differ diff --git a/icons/conf.png b/icons/conf.png new file mode 100644 index 0000000..ddffe6f Binary files /dev/null and b/icons/conf.png differ diff --git a/icons/cpp.png b/icons/cpp.png new file mode 100644 index 0000000..7946440 Binary files /dev/null and b/icons/cpp.png differ diff --git a/icons/cs.png b/icons/cs.png new file mode 100644 index 0000000..d5db29b Binary files /dev/null and b/icons/cs.png differ diff --git a/icons/css.png b/icons/css.png new file mode 100644 index 0000000..0401204 Binary files /dev/null and b/icons/css.png differ diff --git a/icons/csv.png b/icons/csv.png new file mode 100644 index 0000000..3a88353 Binary files /dev/null and b/icons/csv.png differ diff --git a/icons/deb.png b/icons/deb.png new file mode 100644 index 0000000..9229d87 Binary files /dev/null and b/icons/deb.png differ diff --git a/icons/divx.png b/icons/divx.png new file mode 100644 index 0000000..98dab8f Binary files /dev/null and b/icons/divx.png differ diff --git a/icons/doc.png b/icons/doc.png new file mode 100644 index 0000000..932567f Binary files /dev/null and b/icons/doc.png differ diff --git a/icons/dot.png b/icons/dot.png new file mode 100644 index 0000000..9f2da1a Binary files /dev/null and b/icons/dot.png differ diff --git a/icons/eml.png b/icons/eml.png new file mode 100644 index 0000000..02828e1 Binary files /dev/null and b/icons/eml.png differ diff --git a/icons/enc.png b/icons/enc.png new file mode 100644 index 0000000..cb2d7d4 Binary files /dev/null and b/icons/enc.png differ diff --git a/icons/file.png b/icons/file.png new file mode 100644 index 0000000..24d5f32 Binary files /dev/null and b/icons/file.png differ diff --git a/icons/folder_black.png b/icons/folder_black.png new file mode 100644 index 0000000..cb1d414 Binary files /dev/null and b/icons/folder_black.png differ diff --git a/icons/gif.png b/icons/gif.png new file mode 100644 index 0000000..b4c07a9 Binary files /dev/null and b/icons/gif.png differ diff --git a/icons/gz.png b/icons/gz.png new file mode 100644 index 0000000..2426bd1 Binary files /dev/null and b/icons/gz.png differ diff --git a/icons/hlp.png b/icons/hlp.png new file mode 100644 index 0000000..4417d8e Binary files /dev/null and b/icons/hlp.png differ diff --git a/icons/htm.png b/icons/htm.png new file mode 100644 index 0000000..1a68121 Binary files /dev/null and b/icons/htm.png differ diff --git a/icons/html.png b/icons/html.png new file mode 100644 index 0000000..672cbce Binary files /dev/null and b/icons/html.png differ diff --git a/icons/image.png b/icons/image.png new file mode 100644 index 0000000..f83e289 Binary files /dev/null and b/icons/image.png differ diff --git a/icons/iso.png b/icons/iso.png new file mode 100644 index 0000000..1b2ff19 Binary files /dev/null and b/icons/iso.png differ diff --git a/icons/jar.png b/icons/jar.png new file mode 100644 index 0000000..4db70a2 Binary files /dev/null and b/icons/jar.png differ diff --git a/icons/java.png b/icons/java.png new file mode 100644 index 0000000..7489b97 Binary files /dev/null and b/icons/java.png differ diff --git a/icons/jpeg.png b/icons/jpeg.png new file mode 100644 index 0000000..aa4cc23 Binary files /dev/null and b/icons/jpeg.png differ diff --git a/icons/jpg.png b/icons/jpg.png new file mode 100644 index 0000000..1fb6cc1 Binary files /dev/null and b/icons/jpg.png differ diff --git a/icons/js.png b/icons/js.png new file mode 100644 index 0000000..7db4de7 Binary files /dev/null and b/icons/js.png differ diff --git a/icons/lua.png b/icons/lua.png new file mode 100644 index 0000000..7c07d02 Binary files /dev/null and b/icons/lua.png differ diff --git a/icons/m.png b/icons/m.png new file mode 100644 index 0000000..aa0cbae Binary files /dev/null and b/icons/m.png differ diff --git a/icons/mm.png b/icons/mm.png new file mode 100644 index 0000000..b737571 Binary files /dev/null and b/icons/mm.png differ diff --git a/icons/mov.png b/icons/mov.png new file mode 100644 index 0000000..7e7aa36 Binary files /dev/null and b/icons/mov.png differ diff --git a/icons/mp3.png b/icons/mp3.png new file mode 100644 index 0000000..928705d Binary files /dev/null and b/icons/mp3.png differ diff --git a/icons/mpg.png b/icons/mpg.png new file mode 100644 index 0000000..9a3f8ea Binary files /dev/null and b/icons/mpg.png differ diff --git a/icons/odc.png b/icons/odc.png new file mode 100644 index 0000000..47f65c8 Binary files /dev/null and b/icons/odc.png differ diff --git a/icons/odf.png b/icons/odf.png new file mode 100644 index 0000000..a2fbc51 Binary files /dev/null and b/icons/odf.png differ diff --git a/icons/odg.png b/icons/odg.png new file mode 100644 index 0000000..434f182 Binary files /dev/null and b/icons/odg.png differ diff --git a/icons/odi.png b/icons/odi.png new file mode 100644 index 0000000..74f6303 Binary files /dev/null and b/icons/odi.png differ diff --git a/icons/odp.png b/icons/odp.png new file mode 100644 index 0000000..a5c77f8 Binary files /dev/null and b/icons/odp.png differ diff --git a/icons/ods.png b/icons/ods.png new file mode 100644 index 0000000..2ab1273 Binary files /dev/null and b/icons/ods.png differ diff --git a/icons/odt.png b/icons/odt.png new file mode 100644 index 0000000..b0c21fc Binary files /dev/null and b/icons/odt.png differ diff --git a/icons/ogg.png b/icons/ogg.png new file mode 100644 index 0000000..62cea6a Binary files /dev/null and b/icons/ogg.png differ diff --git a/icons/pdf.png b/icons/pdf.png new file mode 100644 index 0000000..638066d Binary files /dev/null and b/icons/pdf.png differ diff --git a/icons/pgp.png b/icons/pgp.png new file mode 100644 index 0000000..e6b35f3 Binary files /dev/null and b/icons/pgp.png differ diff --git a/icons/php.png b/icons/php.png new file mode 100644 index 0000000..44c0fe0 Binary files /dev/null and b/icons/php.png differ diff --git a/icons/pl.png b/icons/pl.png new file mode 100644 index 0000000..ad2324e Binary files /dev/null and b/icons/pl.png differ diff --git a/icons/png.png b/icons/png.png new file mode 100644 index 0000000..f0b5b00 Binary files /dev/null and b/icons/png.png differ diff --git a/icons/ppt.png b/icons/ppt.png new file mode 100644 index 0000000..adaefc6 Binary files /dev/null and b/icons/ppt.png differ diff --git a/icons/ps.png b/icons/ps.png new file mode 100644 index 0000000..487c3cb Binary files /dev/null and b/icons/ps.png differ diff --git a/icons/py.png b/icons/py.png new file mode 100644 index 0000000..9e31edb Binary files /dev/null and b/icons/py.png differ diff --git a/icons/ram.png b/icons/ram.png new file mode 100644 index 0000000..1a54d76 Binary files /dev/null and b/icons/ram.png differ diff --git a/icons/rar.png b/icons/rar.png new file mode 100644 index 0000000..a6af4d1 Binary files /dev/null and b/icons/rar.png differ diff --git a/icons/rb.png b/icons/rb.png new file mode 100644 index 0000000..3067016 Binary files /dev/null and b/icons/rb.png differ diff --git a/icons/rm.png b/icons/rm.png new file mode 100644 index 0000000..a2db68e Binary files /dev/null and b/icons/rm.png differ diff --git a/icons/rpm.png b/icons/rpm.png new file mode 100644 index 0000000..22212ea Binary files /dev/null and b/icons/rpm.png differ diff --git a/icons/rtf.png b/icons/rtf.png new file mode 100644 index 0000000..d8bada5 Binary files /dev/null and b/icons/rtf.png differ diff --git a/icons/sig.png b/icons/sig.png new file mode 100644 index 0000000..3d8b19d Binary files /dev/null and b/icons/sig.png differ diff --git a/icons/sql.png b/icons/sql.png new file mode 100644 index 0000000..f60054a Binary files /dev/null and b/icons/sql.png differ diff --git a/icons/swf.png b/icons/swf.png new file mode 100644 index 0000000..0729ed0 Binary files /dev/null and b/icons/swf.png differ diff --git a/icons/sxc.png b/icons/sxc.png new file mode 100644 index 0000000..419c183 Binary files /dev/null and b/icons/sxc.png differ diff --git a/icons/sxd.png b/icons/sxd.png new file mode 100644 index 0000000..5801bb2 Binary files /dev/null and b/icons/sxd.png differ diff --git a/icons/sxi.png b/icons/sxi.png new file mode 100644 index 0000000..2a94290 Binary files /dev/null and b/icons/sxi.png differ diff --git a/icons/sxw.png b/icons/sxw.png new file mode 100644 index 0000000..6da97be Binary files /dev/null and b/icons/sxw.png differ diff --git a/icons/tar.png b/icons/tar.png new file mode 100644 index 0000000..5a2f717 Binary files /dev/null and b/icons/tar.png differ diff --git a/icons/tex.png b/icons/tex.png new file mode 100644 index 0000000..e46a516 Binary files /dev/null and b/icons/tex.png differ diff --git a/icons/tgz.png b/icons/tgz.png new file mode 100644 index 0000000..141acf5 Binary files /dev/null and b/icons/tgz.png differ diff --git a/icons/txt.png b/icons/txt.png new file mode 100644 index 0000000..da20009 Binary files /dev/null and b/icons/txt.png differ diff --git a/icons/vcf.png b/icons/vcf.png new file mode 100644 index 0000000..195ab38 Binary files /dev/null and b/icons/vcf.png differ diff --git a/icons/video.png b/icons/video.png new file mode 100644 index 0000000..b89fc52 Binary files /dev/null and b/icons/video.png differ diff --git a/icons/vsd.png b/icons/vsd.png new file mode 100644 index 0000000..d14b81d Binary files /dev/null and b/icons/vsd.png differ diff --git a/icons/wav.png b/icons/wav.png new file mode 100644 index 0000000..79e8076 Binary files /dev/null and b/icons/wav.png differ diff --git a/icons/wma.png b/icons/wma.png new file mode 100644 index 0000000..6854de7 Binary files /dev/null and b/icons/wma.png differ diff --git a/icons/wmv.png b/icons/wmv.png new file mode 100644 index 0000000..b26f45d Binary files /dev/null and b/icons/wmv.png differ diff --git a/icons/xls.png b/icons/xls.png new file mode 100644 index 0000000..e8cd58d Binary files /dev/null and b/icons/xls.png differ diff --git a/icons/xml.png b/icons/xml.png new file mode 100644 index 0000000..eb46323 Binary files /dev/null and b/icons/xml.png differ diff --git a/icons/xpi.png b/icons/xpi.png new file mode 100644 index 0000000..5e537e2 Binary files /dev/null and b/icons/xpi.png differ diff --git a/icons/xvid.png b/icons/xvid.png new file mode 100644 index 0000000..d8429dc Binary files /dev/null and b/icons/xvid.png differ diff --git a/icons/zip.png b/icons/zip.png new file mode 100644 index 0000000..999ffbe Binary files /dev/null and b/icons/zip.png differ diff --git a/images/breadcrumb.png b/images/breadcrumb.png new file mode 100644 index 0000000..710a1b8 Binary files /dev/null and b/images/breadcrumb.png differ diff --git a/images/fancyindex.png b/images/fancyindex.png new file mode 100644 index 0000000..56e308c Binary files /dev/null and b/images/fancyindex.png differ diff --git a/images/fancyindex1.png b/images/fancyindex1.png new file mode 100644 index 0000000..acd3cf3 Binary files /dev/null and b/images/fancyindex1.png differ diff --git a/images/fancyindex2.png b/images/fancyindex2.png new file mode 100644 index 0000000..3b3ac41 Binary files /dev/null and b/images/fancyindex2.png differ diff --git a/js/history.js b/js/history.js new file mode 100644 index 0000000..6818ece --- /dev/null +++ b/js/history.js @@ -0,0 +1,94 @@ +if (!!(window.history && history.pushState)) { + + var addEvent = (function () { + if (document.addEventListener) { + return function (el, type, fn) { + if (el && el.nodeName || el === window) { + el.addEventListener(type, fn, false); + } else if (el && el.length) { + for (var i = 0; i < el.length; i++) { + addEvent(el[i], type, fn); + } + } + }; + } else { + return function (el, type, fn) { + if (el && el.nodeName || el === window) { + el.attachEvent('on' + type, function () { + return fn.call(el, window.event); + }); + } else if (el && el.length) { + for (var i = 0; i < el.length; i++) { + addEvent(el[i], type, fn); + } + } + }; + } + })(); + + var updateCrumbs = function() { + window.document.title = window.location.pathname; + setTimeout(function () { + var loc = window.location.pathname; + var segments = loc.split('/'); + var breadcrumbs = ''; + var currentPath = '/'; + for (var i = 0; i < segments.length; i++) { + if (segments[i] !== '') { + currentPath += segments[i] + '/'; + breadcrumbs += '' + window.unescape(segments[i]) + '<\/a>'; + } else if (segments.length -1 !== i) { + currentPath += ''; + breadcrumbs += 'Root<\/a>'; + } + } + document.getElementById('breadcrumbs').innerHTML = breadcrumbs; + }, 500); + }; + + var swapPage = function(href) { + var req = false; + if (window.XMLHttpRequest) { + req = new XMLHttpRequest(); + } else if (window.ActiveXObject) { + req = new ActiveXObject('Microsoft.XMLHTTP'); + } + req.open('GET', href, false); + req.send(null); + if (req.status == 200) { + var target = document.getElementsByClassName('box-content')[0]; + var div = document.createElement('div'); + div.innerHTML = req.responseText; + var elements = div.getElementsByClassName('box-content')[0]; + target.innerHTML = elements.innerHTML; + initHistory(); + return true; + // Terrible error catching implemented! Basically, if the ajax request fails + // we'll just refresh the entire page with the new URL. + } else { + window.location.replace(href); + } + return false; + }; + + var initHistory = function() { + var list = document.getElementById('list'); + + addEvent(list, 'click', function (event) { + if (event.target.nodeName == 'A' && event.target.innerHTML.indexOf('/') !== -1) { + event.preventDefault(); + swapPage(event.target.href); + var title = event.target.innerHTML; + history.pushState({page: title}, title, event.target.href); + updateCrumbs(); + } + }); + }; + + addEvent(window, 'popstate', function (e) { + swapPage(window.location.pathname); + updateCrumbs(); + }); + + initHistory(); +}