1
0
mirror of https://github.com/lrsjng/h5ai.git synced 2025-09-03 19:02:33 +02:00

Compare commits

...

9 Commits
v0.5.2 ... v0.7

Author SHA1 Message Date
Lars Jung
8eac4ca133 Removed shadows. Reworked tree side bar. 2011-07-07 02:26:07 +02:00
Lars Jung
e4646734f2 Added localization. 2011-07-05 01:39:45 +02:00
Lars Jung
e54abe08ca Added folder effects to details and icons view. Moved some icons. 2011-07-04 20:14:24 +02:00
Lars Jung
faaddd8d60 Remove screenshots. 2011-07-04 16:31:05 +02:00
Lars Jung
d599425452 Some comments and documentation. 2011-07-04 16:26:35 +02:00
Lars Jung
3e6197d2fc Added comments in options.js. 2011-07-04 12:51:34 +02:00
Lars Jung
ecf93da505 Forgot to remove local options. 2011-07-04 02:24:12 +02:00
Lars Jung
e91a127771 Forgot to remove local options. 2011-07-04 02:23:43 +02:00
Lars Jung
b8fba3ac8e Added basic options support. Refactored js. 2011-07-04 02:18:27 +02:00
42 changed files with 1032 additions and 674 deletions

View File

@@ -1,14 +1,14 @@
# h5ai v0.5.2   ·   a beautified Apache index # h5ai v0.7   ·   a beautified Apache index
## Screenshots ## Screenshots
<a href="http://github.com/lrsjng/h5ai/raw/master/resources/h5ai-v0.4-details.png" target="_blank"> <a href="http://larsjung.de/h5ai/sample/screenshots/h5ai-v0.5.2-details.png" target="_blank">
<img src="http://github.com/lrsjng/h5ai/raw/master/resources/h5ai-v0.4-details.png" width="400px" alt="screenshot" title="screenshot" style="display: inline" /> <img src="http://larsjung.de/h5ai/sample/screenshots/h5ai-v0.5.2-details.png" width="400px" alt="screenshot" title="details view" style="display: inline" />
</a> </a>
&#160; &#160; &#160; &#160; &#160; &#160;
<a href="http://github.com/lrsjng/h5ai/raw/master/resources/h5ai-v0.4-icons.png" target="_blank"> <a href="http://larsjung.de/h5ai/sample/screenshots/h5ai-v0.5.2-icons.png" target="_blank">
<img src="http://github.com/lrsjng/h5ai/raw/master/resources/h5ai-v0.4-icons.png" width="400px" alt="screenshot" title="screenshot" style="display: inline" /> <img src="http://larsjung.de/h5ai/sample/screenshots/h5ai-v0.5.2-icons.png" width="400px" alt="screenshot" title="icons view" style="display: inline" />
</a> </a>
@@ -24,9 +24,9 @@ Everything you need is located in folder `target`.
* Copy folder `h5ai` to the web-root directory of your server or alternativly set an alias `/h5ai/` to * Copy folder `h5ai` to the web-root directory of your server or alternativly set an alias `/h5ai/` to
this folder. this folder.
* Add the content of file `dot.htaccess` to the `.htaccess` file inside the directory * Add the content of file `dot.htaccess` to the `.htaccess` file inside the directory you want to be
you want to be styled (you might have to create this file). This directory and any subdirectories will be styled (you might have to create this file). This directory and any subdirectories will be styled by h5ai.
styled by h5ai. * Adjust `options.js` inside the `h5ai` folder to your needs. Defaults will be fine for a start.
Optionally add `h5ai.header.html` and/or `h5ai.footer.html` files to any of the styled folders to [display Optionally add `h5ai.header.html` and/or `h5ai.footer.html` files to any of the styled folders to [display
custom top or bottom sections](http://larsjung.de/h5ai/sample/customize). The content of those files custom top or bottom sections](http://larsjung.de/h5ai/sample/customize). The content of those files
@@ -47,6 +47,29 @@ please respect their rights.
## Changelog ## Changelog
### v0.7
*2011-07-07*
* removed shadows
* smarter tree side bar
### v0.6
*2011-07-05*
* refactored js
* added localization, see options.js
### v0.5.3
*2011-07-04*
* refactored js
* added basic options support
* commented options.js
* optional tree sidebar
### v0.5.2 ### v0.5.2
*2011-07-02* *2011-07-02*

View File

@@ -3,7 +3,7 @@ custom = true
# project # project
project.name = h5ai project.name = h5ai
project.version = 0.5.2 project.version = 0.7
# src # src

View File

@@ -2,6 +2,7 @@
<project <project
name="h5ai" name="h5ai"
basedir="." basedir="."
default="build"
xmlns:scripp="antlib:de.larsjung.scripp.ant" xmlns:scripp="antlib:de.larsjung.scripp.ant"
> >
<target name="init"> <target name="init">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

@@ -44,6 +44,18 @@
color: #e80; color: #e80;
} }
} }
&.error {
> a, > a:visited {
opacity: 0.7;
color: #999;
.hint {
font-size: 0.9em;
font-style: italic;
color: #c55;
}
}
}
} }
.icon, .label, .date, .size { .icon, .label, .date, .size {
padding: 6px; padding: 6px;
@@ -65,17 +77,17 @@
} }
.label { .label {
display: block; display: block;
margin: 0 220px 0 24px; margin: 0 270px 0 24px;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-align: left; text-align: left;
} }
.date { .date {
position: absolute; position: absolute;
right: 70px; right: 100px;
top: 0; top: 0;
text-align: right; text-align: right;
width: 140px; width: 160px;
white-space: nowrap; white-space: nowrap;
} }
.size { .size {
@@ -83,7 +95,7 @@
right: 0; right: 0;
top: 0; top: 0;
text-align: right; text-align: right;
width: 50px; width: 80px;
white-space: nowrap; white-space: nowrap;
} }
} }
@@ -155,6 +167,18 @@
display: none; display: none;
} }
} }
&.error {
> a, > a:visited {
opacity: 0.7;
color: #999;
.hint {
font-size: 0.9em;
font-style: italic;
color: #c55;
}
}
}
} }
} }
} }

View File

@@ -1,19 +1,50 @@
#tree { #tree {
display: none;
position: fixed; position: fixed;
left: 0; left: -200px;
top: 80px; top: 80px;
font-size: 0.85em; font-size: 0.85em;
padding: 16px 32px 16px 16px; padding: 16px 32px 16px 16px;
background-color: rgb(240,240,240); background-color: rgb(241,241,241);
border: 1px solid rgb(225,225,225); border: 2px solid rgb(210,210,210);
border-left: none; border-left: none;
.border-radius ( 0 15px 15px 0 ); .border-radius ( 0 15px 15px 0 );
.box-shadow( 0 0 30px #999 );
.entry { .entry {
.blank, .indicator {
display: inline-block;
width: 16px;
height: 25px;
float: left;
}
.indicator {
opacity: 0.7;
.transition( all 0.2s ease-in-out );
cursor: pointer;
&:hover {
opacity: 1;
}
img {
position: relative;
left: 0;
top: 3px;
width: 12px;
height: 12px;
vertical-align: bottom;
.transition( all 0.2s ease-in-out );
}
&.open {
img {
.transform( rotate(90deg) );
}
}
&.unknown {
opacity: 0.3;
}
}
> a, > a.visited { > a, > a.visited {
margin-left: 16px;
padding: 4px 6px; padding: 4px 6px;
border: 1px solid rgba(0,0,0,0); border: 1px solid rgba(0,0,0,0);
.border-radius( 5px ); .border-radius( 5px );
@@ -40,6 +71,7 @@
display: inline-block; display: inline-block;
margin-left: 12px; margin-left: 12px;
font-style: italic; font-style: italic;
font-size: 0.9em;
color: #ccc; color: #ccc;
img { img {
width: 10px; width: 10px;
@@ -47,9 +79,6 @@
vertical-align: baseline; vertical-align: baseline;
} }
} }
.error {
color: #c55;
}
} }
&.file { &.file {
display: none; display: none;
@@ -61,12 +90,15 @@
opacity: 1; opacity: 1;
} }
} }
&.notListable { &.error {
> a, > a:visited { > a, > a:visited {
color: #999; color: #999;
} }
.hint {
color: #c55;
}
} }
ul { .content {
list-style: none; list-style: none;
margin-left: 20px; margin-left: 20px;
} }

View File

@@ -39,10 +39,9 @@ body > nav {
left: 0; left: 0;
top: 0; top: 0;
font-size: 0.85em; font-size: 0.85em;
background-color: rgb(240,240,240); background-color: rgb(241,241,241);
border-bottom: 1px solid rgb(225,225,225); border-bottom: 2px solid rgb(210,210,210);
.box-shadow( 0 0 30px #555 );
span.jsDisabledFallback { span.jsDisabledFallback {
display: block; display: block;
height: 30px; height: 30px;
@@ -57,7 +56,7 @@ body > nav {
&.crumb { &.crumb {
float: left; float: left;
border-right: 1px dotted rgb(225,225,225); border-right: 1px solid rgb(231,231,231);
.hint { .hint {
margin-left: 8px; margin-left: 8px;
font-style: italic; font-style: italic;
@@ -76,7 +75,7 @@ body > nav {
} }
&.view { &.view {
float: right; float: right;
border-left: 1px dotted rgb(225,225,225); border-left: 1px solid rgb(230,230,230);
} }
&:hover, &:hover a { &:hover, &:hover a {
background-color: rgba(255,255,255,0.5); background-color: rgba(255,255,255,0.5);
@@ -130,12 +129,12 @@ body > footer {
left: 0; left: 0;
bottom: 0; bottom: 0;
padding: 10px 0; padding: 10px 0;
border-top: 1px solid rgb(225,225,225); background-color: rgb(241,241,241);
background-color: rgb(240,240,240); border-top: 2px solid rgb(210,210,210);
color: #999; color: #999;
font-size: 0.85em; font-size: 0.85em;
text-align: center; text-align: center;
.box-shadow( 0 0 30px #555 );
a, a:visited { a, a:visited {
color: #555; color: #555;

View File

@@ -12,11 +12,12 @@
<img class="techclass" src="/h5ai/images/html5-css3.png" alt="html5-css3" /> <img class="techclass" src="/h5ai/images/html5-css3.png" alt="html5-css3" />
</a> </a>
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai %BUILD_VERSION%">h5ai</a> <a href="http://larsjung.de/h5ai" target="_blank" title="h5ai %BUILD_VERSION%">h5ai</a>
using <span class="l10n-footerUsing">using</span>
<a href="http://tiheum.deviantart.com/art/Faenza-Icons-173323228" target="_blank" title="icon theme for Gnome">Faenza icons</a> <a href="http://tiheum.deviantart.com/art/Faenza-Icons-173323228" target="_blank" title="icon theme for Gnome">Faenza icons</a>
</footer> </footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script>window.jQuery || document.write( '<script src="/h5ai/js/lib/jquery.min.js"><\/script>' )</script> <script>window.jQuery || document.write( '<script src="/h5ai/js/lib/jquery.min.js"><\/script>' )</script>
<script src="/h5ai/options.js"></script>
<script src="/h5ai/js/main.js"></script> <script src="/h5ai/js/main.js"></script>
</body> </body>
</html> </html>

View File

@@ -16,9 +16,15 @@
<nav> <nav>
<span class="jsDisabledFallback">Directory index · JavaScript is disabled</span> <span class="jsDisabledFallback">Directory index · JavaScript is disabled</span>
<ul> <ul>
<li id="domain" class="crumb"><a href="/"><img src="/h5ai/images/home.png" alt="domain" /><span>domain</span></a></li> <li id="domain" class="crumb">
<li id="viewicons" class="view"><a href="#"><img src="/h5ai/images/view-icons.png" alt="view-icons" />icons</a></li> <a href="/"><img src="/h5ai/images/home.png" alt="domain" /><span>domain</span></a>
<li id="viewdetails" class="view" ><a href="#"><img src="/h5ai/images/view-details.png" alt="view-details" />details</a></li> </li>
<li id="viewicons" class="view">
<a href="#"><img src="/h5ai/images/view-icons.png" alt="view-icons" /><span class="l10n-viewIcons">icons</span></a>
</li>
<li id="viewdetails" class="view" >
<a href="#"><img src="/h5ai/images/view-details.png" alt="view-details" /><span class="l10n-viewDetails">details</span></a>
</li>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</nav> </nav>

View File

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View File

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/h5ai/images/blank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

BIN
src/h5ai/images/tree.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

143
src/h5ai/js/inc/file.js Normal file
View File

@@ -0,0 +1,143 @@
var File = function ( utils, folder, tableRow ) {
var THIS = this;
if ( ! /\/$/.test( folder ) ) {
folder += "/";
};
if ( tableRow !== undefined ) {
var $tds = $( tableRow ).find( "td" );
var $img = $tds.eq( 0 ).find( "img" );
var $a= $tds.eq( 1 ).find( "a" );
this.parentFolder = folder;
this.icon16 = $img.attr( "src" );
this.alt = $img.attr( "alt" );
this.label = $a.text();
this.href = decodeURI( $a.attr("href") );
this.date = $tds.eq( 2 ).text();
this.size = $tds.eq( 3 ).text();
} else {
var splits = utils.splitPathname( folder );
this.parentFolder = splits[0];
this.label = splits[1];
this.icon16 = "/h5ai/icons/16x16/folder.png";
this.alt = "[DIR]";
this.href = this.label;
this.date = "";
this.size = "";
if ( this.label === "/" ) {
this.label = document.domain + "/";
};
};
this.icon48 = this.icon16.replace( "16x16", "48x48" );
this.isFolder = ( this.alt === "[DIR]" );
this.isParentFolder = ( this.isFolder && this.label === "Parent Directory" );
this.absHref = this.isParentFolder ? this.href : this.parentFolder + this.href;
this.status = undefined; // undefined, "h5ai" or HTTP response code
this.content = undefined;
this.$treeHtml = undefined;
this.isEmpty = function() {
if ( this.content === undefined ) {
return true;
};
for ( var prop in this.content ) {
if( this.content.hasOwnProperty( prop ) ) {
return false;
};
};
return true;
};
this.updateTreeHtml = function () {
var $html = $( "<div class='entry' />" ).data( "file", this );
var $blank = $( "<span class='blank' />" ).appendTo( $html );
try {
var $a = $( "<a href='" + this.absHref + "' />" )
.appendTo( $html )
.append( $( "<span class='icon'><img src='" + this.icon16 + "' /></span>" ) )
.append( $( "<span class='label'>" + this.label + "</span>" ) );
if ( this.isFolder ) {
$html.addClass( "folder" );
// indicator
if ( this.status === undefined || !this.isEmpty() ) {
var $indicator = $( "<span class='indicator'><img src='/h5ai/images/tree.png' /></span>" );
if ( this.status === undefined ) {
$indicator.addClass( "unknown" );
} else {
$indicator.addClass( "open" );
};
$indicator.click( function( event ) {
if ( $indicator.hasClass( "unknown" ) ) {
tree.fetchEntry( THIS.absHref, function ( newEntry ) {
$html.replaceWith( newEntry.updateTreeHtml() );
} );
} else if ( $indicator.hasClass( "open" ) ) {
$indicator.removeClass( "open" );
$html.find( "> ul.content" ).slideUp();
} else {
$indicator.addClass( "open" );
$html.find( "> ul.content" ).slideDown();
};
} );
$blank.replaceWith( $indicator );
};
// is this the current folder?
if ( this.absHref === decodeURI( document.location.pathname ) ) {
$html.addClass( "current" );
$a.find( ".icon img" ).attr( "src", "/h5ai/icons/16x16/folder-open.png" );
};
// does it have subfolders?
if ( !this.isEmpty() ) {
var $ul = $( "<ul class='content' />" ).appendTo( $html );
for ( idx in this.content ) {
$( "<li />" ).append( this.content[idx].updateTreeHtml() ).appendTo( $ul );
};
};
// reflect folder status
if ( !isNaN( this.status ) ) {
if ( this.status === 200 ) {
$a.find( ".icon img" ).attr( "src", "/h5ai/icons/16x16/folder-page.png" );
$a.append( $( "<span class='hint'><img src='/h5ai/images/page.png' /></span>" ) );
} else {
$html.addClass( "error" );
$a.append( $( "<span class='hint'>" + this.status + "</span>" ) );
};
};
} else {
$html.addClass( "file" );
};
} catch( err ) {
console.log( "updateTreeHtml failed", err );
$( "<span class='fail'>failed</span>" ).appendTo( $html );
};
if ( this.$treeHtml !== undefined ) {
this.$treeHtml.replaceWith( $html );
};
this.$treeHtml = $html;
return $html;
};
};

View File

@@ -1,324 +1,344 @@
( function( $ ) {
var H5ai = function ( options ) {
var THIS = this;
/******************************* /*******************************
* init after dom load * config
*******************************/ *******************************/
$( function() { var defaults = {
columnClasses: [ "icon", "name", "date", "size" ],
defaultSortOrder: "C=N;O=A",
store: {
viewmode: "h5ai.viewmode"
},
icons: {
crumb: "/h5ai/images/crumb.png",
ascending: "/h5ai/images/ascending.png",
descending: "/h5ai/images/descending.png"
},
customHeader: "h5ai.header.html",
customFooter: "h5ai.footer.html",
callbacks: {
folderClick: [],
fileClick: []
},
$.h5ai = new H5ai(); viewmodes: [ "details", "icons" ],
} ); showTree: false,
folderStatus: {
},
lang: undefined,
useBrowserLang: true
};
this.config = $.extend( {}, defaults, options );
H5ai = function ( options ) { /*******************************
* public api
*******************************/
this.folderClick = function ( fn ) {
/******************************* if ( typeof fn === "function" ) {
* config this.config.callbacks.folderClick.push( fn );
*******************************/
var config = {
columnClasses: [ "icon", "name", "date", "size" ],
defaultSortOrder: "C=N;O=A",
viewmodes: [ "details", "icons" ],
store: {
viewmode: "h5ai.viewmode"
},
icons: {
crumb: "/h5ai/images/crumb.png",
ascending: "/h5ai/images/ascending.png",
descending: "/h5ai/images/descending.png"
},
customHeader: "h5ai.header.html",
customFooter: "h5ai.footer.html",
callbacks: {
folderClick: [],
fileClick: []
}
}; };
return this;
/*******************************
* public api
*******************************/
this.folderClick = function ( fn ) {
if ( typeof fn === "function" ) {
config.callbacks.folderClick.push( fn );
};
return this;
};
this.fileClick = function ( fn ) {
if ( typeof fn === "function" ) {
config.callbacks.fileClick.push( fn );
};
return this;
};
/*******************************
* init (will be called at the bottom)
*******************************/
var init = function () {
applyViewmode();
initBreadcrumb();
initViews();
customize();
};
/*******************************
* callback triggers
*******************************/
var triggerFolderClick = function ( label ) {
for ( idx in config.callbacks.folderClick ) {
config.callbacks.folderClick[idx].call( window, label );
};
};
var triggerFileClick = function ( label ) {
for ( idx in config.callbacks.fileClick ) {
config.callbacks.fileClick[idx].call( window, label );
};
};
/*******************************
* local stored viewmode
*******************************/
var getViewmode = function () {
var viewmode = localStorage.getItem( config.store.viewmode );
if ( $.inArray( viewmode, config.viewmodes ) ) {
return viewmode;
};
return config.viewmodes[0];
};
var applyViewmode = function ( viewmode ) {
$( "#table" ).hide();
if ( viewmode !== undefined ) {
localStorage.setItem( config.store.viewmode, viewmode );
};
$( "body > nav li.view" ).removeClass( "current" );
if ( getViewmode() === "icons" ) {
$( "#viewicons" ).closest( "li" ).addClass( "current" );
$( "#extended" ).removeClass( "details-view" ).addClass( "icons-view" ).show();
} else {
$( "#viewdetails" ).closest( "li" ).addClass( "current" );
$( "#extended" ).addClass( "details-view" ).removeClass( "icons-view" ).show();
};
};
/*******************************
* breadcrumb and doc title
*******************************/
var initBreadcrumb = function () {
$( "#domain span" ).text( document.domain );
var pathname = decodeURI( document.location.pathname );
var parts = pathname.split( "/" );
var path = "/";
var $ul = $( "nav ul" );
for ( idx in parts ) {
var part = parts[idx];
if ( part !== "" ) {
path += part + "/";
$ul.append( $( "<li class='crumb'><a href='" + path + "'><img src='" + config.icons.crumb + "' alt='>' />" + part + "</a></li>" ) );
};
};
$( "body > nav .crumb:last" ).addClass( "current" );
document.title = document.domain + pathname;
};
/*******************************
* table view
*******************************/
var initTableView = function () {
function getColumnClass( idx ) {
if ( idx >= 0 && idx < config.columnClasses.length ) {
return config.columnClasses[idx];
};
return "unknown";
};
$( "#table td" ).removeAttr( "align" ).removeAttr( "valign" );
$( "#table tr" ).each( function () {
var colIdx = 0;
$( this ).find( "th,td" ).each( function () {
$( this ).addClass( getColumnClass( colIdx++ ) );
} );
} );
};
/*******************************
* extended view
*******************************/
var initExtendedView = function () {
var $ul = $( "<ul/>" );
// headers
var $li = $( "<li class='header' />" ).appendTo( $ul );
$( "<a class='icon'></a>" ).appendTo( $li );
var $label = $( "th.name a" );
var $date = $( "th.date a" );
var $size = $( "th.size a" );
$( "<a class='label' href='" + $label.attr( "href" ) + "'>" + $label.text() + "</a>" ).appendTo( $li );
$( "<a class='date' href='" + $date.attr( "href" ) + "'>" + $date.text() + "</a>" ).appendTo( $li );
$( "<a class='size' href='" + $size.attr( "href" ) + "'>" + $size.text() + "</a>" ).appendTo( $li );
// header sort icons
var order = document.location.search;
if ( order === "" ) {
order = config.defaultSortOrder;
};
var $icon;
if ( order.indexOf( "O=A" ) >= 0 ) {
$icon = $( "<img src='" + config.icons.ascending + "' class='sort' alt='ascending' />" );
} else {
$icon = $( "<img src='" + config.icons.descending + "' class='sort' alt='descending' />" );
};
if ( order.indexOf( "C=N" ) >= 0 ) {
$li.find( "a.label" ).append( $icon );
} else if ( order.indexOf( "C=M" ) >= 0 ) {
$li.find( "a.date" ).prepend( $icon );
} else if ( order.indexOf( "C=S" ) >= 0 ) {
$li.find( "a.size" ).prepend( $icon );
};
// entries
$( "#table td.name a" ).closest( "tr" ).each( function () {
var $tr = $( this );
var $img = $tr.find( "td.icon img" );
var iconsmall = $img.attr( "src" );
var iconbig = iconsmall.replace( "16x16", "48x48" );
var alt = $img.attr( "alt" );
var $link = $tr.find( "td.name a" );
var label = $link.text();
var href = $link.attr( "href" );
var date = $tr.find( "td.date" ).text();
var size = $tr.find( "td.size" ).text();
var $li = $( "<li class='entry' />" ).appendTo( $ul );
if ( alt === "[DIR]" ) {
$li.addClass( "folder" );
} else {
$li.addClass( "file" );
}
var $a = $( "<a href='" + href + "' />" ).appendTo( $li );
$( "<span class='icon small'><img src='" + iconsmall + "' alt='" + alt + "' /></span>" ).appendTo( $a );
$( "<span class='icon big'><img src='" + iconbig + "' alt='" + alt + "' /></span>" ).appendTo( $a );
$( "<span class='label'>" + label + "</span>" ).appendTo( $a );
$( "<span class='date'>" + date + "</span>" ).appendTo( $a );
$( "<span class='size'>" + size + "</span>" ).appendTo( $a );
} );
$( "#extended" ).append( $ul );
// empty
$entries = $( "#extended .entry" );
if ( $entries.size() === 0 || $entries.size() === 1 && $entries.find( ".label" ).text() === "Parent Directory" ) {
$( "#extended" ).append( $( "<div class='empty'>empty</div>" ) );
};
// in case of floats
$( "#extended" ).append( $( "<div class='clearfix' />" ) );
// click callbacks
$( "#extended .entry.folder" )
.click( function() {
triggerFolderClick( $( this ).find( ".label" ).text() );
} );
$( "#extended .entry.file" )
.click( function() {
triggerFileClick( $( this ).find( ".label" ).text() );
} );
};
/*******************************
* init views
*******************************/
var initViews = function () {
initTableView();
initExtendedView();
$( "#viewdetails" ).closest( "li" )
.click( function () {
applyViewmode( "details" );
} );
$( "#viewicons" ).closest( "li" )
.click( function () {
applyViewmode( "icons" );
} );
};
/*******************************
* customize
*******************************/
var customize = function () {
$.ajax( {
url: config.customHeader,
dataType: "html",
success: function ( data ) {
$( "#content > header" ).append( $( data ) ).show();
}
} );
$.ajax( {
url: config.customFooter,
dataType: "html",
success: function ( data ) {
$( "#content > footer" ).prepend( $( data ) ).show();
}
} );
};
/*******************************
* finally run init
*******************************/
init();
}; };
} )( jQuery );
this.fileClick = function ( fn ) {
if ( typeof fn === "function" ) {
this.config.callbacks.fileClick.push( fn );
};
return this;
};
/*******************************
* init
*******************************/
this.init = function () {
this.applyViewmode();
this.initBreadcrumb();
this.initViews();
this.customize();
this.localize( h5aiLangs, this.config.lang, this.config.useBrowserLang );
};
/*******************************
* callback triggers
*******************************/
this.triggerFolderClick = function ( label ) {
for ( idx in this.config.callbacks.folderClick ) {
this.config.callbacks.folderClick[idx].call( window, label );
};
};
this.triggerFileClick = function ( label ) {
for ( idx in this.config.callbacks.fileClick ) {
this.config.callbacks.fileClick[idx].call( window, label );
};
};
/*******************************
* local stored viewmode
*******************************/
this.getViewmode = function () {
var viewmode = localStorage.getItem( this.config.store.viewmode );
return $.inArray( viewmode, this.config.viewmodes ) >= 0 ? viewmode : this.config.viewmodes[0];
};
this.applyViewmode = function ( viewmode ) {
if ( viewmode !== undefined ) {
localStorage.setItem( this.config.store.viewmode, viewmode );
};
viewmode = this.getViewmode();
$( "body > nav li.view" ).hide();
if ( this.config.viewmodes.length > 1 ) {
if ( $.inArray( "details", this.config.viewmodes ) >= 0 ) {
$( "#viewdetails" ).show();
};
if ( $.inArray( "icons", this.config.viewmodes ) >= 0 ) {
$( "#viewicons" ).show();
};
};
$( "body > nav li.view" ).removeClass( "current" );
if ( viewmode === "details" ) {
$( "#viewdetails" ).closest( "li" ).addClass( "current" );
$( "#table" ).hide();
$( "#extended" ).addClass( "details-view" ).removeClass( "icons-view" ).show();
} else if ( viewmode === "icons" ) {
$( "#viewicons" ).closest( "li" ).addClass( "current" );
$( "#table" ).hide();
$( "#extended" ).removeClass( "details-view" ).addClass( "icons-view" ).show();
} else {
$( "#table" ).show();
$( "#extended" ).hide();
};
};
/*******************************
* breadcrumb and doc title
*******************************/
this.initBreadcrumb = function () {
$( "#domain span" ).text( document.domain );
var pathname = decodeURI( document.location.pathname );
var parts = pathname.split( "/" );
var path = "/";
var $ul = $( "nav ul" );
for ( idx in parts ) {
var part = parts[idx];
if ( part !== "" ) {
path += part + "/";
$ul.append( $( "<li class='crumb'><a href='" + path + "'><img src='" + this.config.icons.crumb + "' alt='>' />" + part + "</a></li>" ) );
};
};
$( "body > nav .crumb:last" ).addClass( "current" );
document.title = document.domain + pathname;
};
/*******************************
* table view
*******************************/
this.initTableView = function () {
function getColumnClass( idx ) {
if ( idx >= 0 && idx < THIS.config.columnClasses.length ) {
return THIS.config.columnClasses[idx];
};
return "unknown";
};
$( "#table td" ).removeAttr( "align" ).removeAttr( "valign" );
$( "#table tr" ).each( function () {
var colIdx = 0;
$( this ).find( "th,td" ).each( function () {
$( this ).addClass( getColumnClass( colIdx++ ) );
} );
} );
};
/*******************************
* extended view
*******************************/
this.initExtendedView = function () {
var $ul = $( "<ul/>" );
// headers
var $label = $( "th.name a" );
var $date = $( "th.date a" );
var $size = $( "th.size a" );
var $li = $( "<li class='header' />" ).appendTo( $ul );
$( "<a class='icon'></a>" ).appendTo( $li );
$( "<a class='label' href='" + $label.attr( "href" ) + "'><span class='l10n-columnName'>" + $label.text() + "</span></a>" ).appendTo( $li );
$( "<a class='date' href='" + $date.attr( "href" ) + "'><span class='l10n-columnLastModified'>" + $date.text() + "</span></a>" ).appendTo( $li );
$( "<a class='size' href='" + $size.attr( "href" ) + "'><span class='l10n-columnSize'>" + $size.text() + "</span></a>" ).appendTo( $li );
// header sort icons
var order = document.location.search;
if ( order === "" ) {
order = this.config.defaultSortOrder;
};
var $icon;
if ( order.indexOf( "O=A" ) >= 0 ) {
$icon = $( "<img src='" + this.config.icons.ascending + "' class='sort' alt='ascending' />" );
} else {
$icon = $( "<img src='" + this.config.icons.descending + "' class='sort' alt='descending' />" );
};
if ( order.indexOf( "C=N" ) >= 0 ) {
$li.find( "a.label" ).append( $icon );
} else if ( order.indexOf( "C=M" ) >= 0 ) {
$li.find( "a.date" ).prepend( $icon );
} else if ( order.indexOf( "C=S" ) >= 0 ) {
$li.find( "a.size" ).prepend( $icon );
};
// entries
$( "#table td.name a" ).closest( "tr" ).each( function () {
var file = new File( utils, decodeURI( document.location.pathname ), this );
var $li = $( "<li class='entry' />" ).data( "file", file ).appendTo( $ul );
if ( file.isFolder ) {
$li.addClass( "folder" )
.click( function() {
THIS.triggerFolderClick( file );
} );
} else {
$li.addClass( "file" )
.click( function() {
THIS.triggerFileClick( file );
} );
};
var $a = $( "<a href='" + file.href + "' />" ).appendTo( $li );
$( "<span class='icon small'><img src='" + file.icon16 + "' alt='" + file.alt + "' /></span>" ).appendTo( $a );
$( "<span class='icon big'><img src='" + file.icon48 + "' alt='" + file.alt + "' /></span>" ).appendTo( $a );
var $label = $( "<span class='label'>" + file.label + "</span>" ).appendTo( $a );
$( "<span class='date'>" + file.date + "</span>" ).appendTo( $a );
$( "<span class='size'>" + file.size + "</span>" ).appendTo( $a );
if ( file.isParentFolder ) {
$label.addClass( "l10n-parentDirectory" );
$li.addClass( "parentfolder" );
};
} );
$( "#extended" ).append( $ul );
// empty
if ( $ul.children( ".entry:not(.parentfolder)" ).size() === 0 ) {
$( "#extended" ).append( $( "<div class='empty'>empty</div>" ) );
};
// in case of floats
$( "#extended" ).append( $( "<div class='clearfix' />" ) );
};
/*******************************
* init views
*******************************/
this.initViews = function () {
this.initTableView();
this.initExtendedView();
$( "#viewdetails" ).closest( "li" )
.click( function () {
THIS.applyViewmode( "details" );
} );
$( "#viewicons" ).closest( "li" )
.click( function () {
THIS.applyViewmode( "icons" );
} );
};
/*******************************
* customize
*******************************/
this.customize = function () {
$.ajax( {
url: this.config.customHeader,
dataType: "html",
success: function ( data ) {
$( "#content > header" ).append( $( data ) ).show();
}
} );
$.ajax( {
url: this.config.customFooter,
dataType: "html",
success: function ( data ) {
$( "#content > footer" ).prepend( $( data ) ).show();
}
} );
};
/*******************************
* localization
*******************************/
this.localize = function ( data, lang, useBrowserLang ) {
if ( useBrowserLang === true ) {
var browserLang = navigator.language;
if ( data[ browserLang ] !== undefined ) {
lang = browserLang;
} else if ( browserLang.length > 2 && data[ browserLang.substr( 0, 2 ) ] !== undefined ) {
lang = browserLang.substr( 0, 2 );
};
if ( lang === "en" ) {
lang = undefined;
};
};
if ( data[ lang ] !== undefined ) {
var selected = data[ lang ];
for ( key in selected ) {
$( ".l10n-" + key ).text( selected[key] );
};
};
};
};

View File

@@ -1,312 +0,0 @@
( function( $ ) {
/*******************************
* init after dom load
*******************************/
$( function() {
window.setTimeout( function() {
$.h5aiTree = new H5aiTree();
}, 1 );
} );
H5aiTree = function ( options ) {
var folderRegEx = /\/$/;
var pathnameRegEx = /^(\/(.*\/)*)([^\/]+\/?)$/;
var contentTypeRegEx = /^text\/html;h5ai=/;
function init() {
checkCrumb();
initShifting();
populateTree();
};
function splitPathname( pathname ) {
if ( pathname === "/" ) {
return [ "", "/" ];
};
var match = pathnameRegEx.exec( pathname );
return [ match[1], match[3] ];
};
function checkCrumb() {
$( "li.crumb a" ).each( function() {
var $a = $( this );
var pathname = $a.attr( "href" );
checkPathname( pathname, function ( status ) {
if ( status !== 0 ) {
$( "<img class='hint' src='/h5ai/images/page.png' alt='not listable' />" ).appendTo( $a );
if ( status !== 200 ) {
$( "<span class='hint'>(" + status + ")</span>" ).appendTo( $a );
};
};
} );
} );
};
function shiftTree( show ) {
var $tree = $( "#tree" );
var $extended = $( "#extended" );
var show = show || false;
if ( $tree.outerWidth() < $extended.offset().left || show ) {
$tree.stop().animate( { left: 0 } );
} else {
//var left = Math.max( 24 - $tree.outerWidth(), $extended.offset().left - $tree.outerWidth() - 16 );
var left = 24 - $tree.outerWidth();
$tree.stop().animate( { left: left } );
};
};
function initShifting() {
$( "#tree" ).hover(
function () {
shiftTree( true );
},
function () {
shiftTree();
}
);
$( window ).resize( function() {
shiftTree();
} );
};
function populateTree() {
var $tree = $( "#tree" );
$tree.css( { left: -400 } ).show();
shiftTree();
var pathname = decodeURI( document.location.pathname );
fetchTree( pathname, function( entry ) {
$tree.empty().append( entry.toHtml() );
shiftTree();
} );
};
function fetchTree( pathname, callback ) {
walkBack( pathname, function( walkbackedPathname ) {
var entry = new Entry( walkbackedPathname );
fetchEntriesRecursive( walkbackedPathname, function ( content ) {
entry.content = content;
callback( entry );
} );
} );
};
function walkBack( pathname, callback ) {
var splits = splitPathname( pathname );
var parent = splits[0];
if ( parent === "" ) {
callback( pathname );
} else {
checkPathname( parent, function( state ) {
if ( state === 0 ) {
walkBack( parent, callback );
} else {
callback( pathname );
};
} );
};
};
function fetchEntriesRecursive( pathname, callback ) {
fetchEntries( pathname, false, function ( entries ) {
if ( entries instanceof Array ) {
for ( idx in entries ) {
( function ( entry ) {
if ( entry.isFolder ) {
fetchEntriesRecursive( entry.absHref, function( content ) {
entry.content = content;
callback( entries );
} );
};
} ) ( entries[idx] );
};
};
callback( entries );
} );
};
function fetchEntries( pathname, includeParent, callback ) {
checkPathname( pathname, function ( status ) {
console.log( "checkPathname", pathname, status );
if ( status !== 0 ) {
callback( status );
} else {
$.ajax( {
url: pathname,
type: "GET",
dataType: "html",
error: function ( xhr ) {
// since it was checked before this should never happen
callback( xhr.status );
},
success: function ( html, status, xhr ) {
if ( !contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) {
// since it was checked before this should never happen
callback( xhr.status );
} else {
var entries = [];
$( html ).find( "#table table td" ).closest( "tr" ).each( function () {
var entry = new Entry( pathname, this );
if ( !entry.isParentFolder || includeParent ) {
entries.push( entry );
};
} );
callback( entries );
};
}
} );
};
} );
};
function checkPathname( pathname, callback ) {
$.ajax( {
url: pathname,
type: "HEAD",
complete: function ( xhr ) {
if ( xhr.status === 200 && contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) {
callback( 0 );
} else {
callback( xhr.status );
};
}
} );
};
Entry = function ( folder, tableRow ) {
if ( !folderRegEx.test( folder ) ) {
folder += "/";
};
if ( tableRow !== undefined ) {
var $tds = $( tableRow ).find( "td" );
var $img = $( $tds.get( 0 ) ).find( "img" );
var $a= $( $tds.get( 1 ) ).find( "a" );
this.parentFolder = folder;
this.icon16 = $img.attr( "src" );
this.alt = $img.attr( "alt" );
this.label = $a.text();
this.href = $a.attr("href");
this.date = $( $tds.get(2) ).text();
this.size = $( $tds.get(3) ).text();
} else {
var splits = splitPathname( folder );
this.parentFolder = splits[0];
this.label = splits[1];
this.icon16 = "/h5ai/icons/16x16/folder.png";
this.alt = "[DIR]";
this.href = this.label;
this.date = "";
this.size = "";
if ( this.label === "/" ) {
this.label = document.domain + "/";
};
};
this.icon48 = this.icon16.replace( "16x16", "48x48" );
this.isFolder = ( this.alt === "[DIR]" );
this.isParentFolder = ( this.isFolder && this.label === "Parent Directory" );
this.absHref = this.isParentFolder ? this.href : this.parentFolder + this.href;
this.content = undefined;
this.isComplete = function () {
if ( this.isFolder ) {
if ( this.content === undefined ) {
return false;
} else if ( this.content instanceof Array ) {
for ( idx in this.content ) {
if ( !this.content[idx].isComplete() ) {
return false;
};
};
};
};
return true;
};
this.toHtml = function () {
var $entry = $( "<div class='entry' />" );
try {
var $a = $( "<a href='" + this.absHref + "' />" )
.appendTo( $entry )
.append( $( "<span class='icon'><img src='" + this.icon16 + "' /></span>" ) )
.append( $( "<span class='label'>" + this.label + "</span>" ) );
if ( this.isFolder ) {
$entry.addClass( "folder" );
if ( this.absHref === document.location.pathname ) {
$a.find( ".icon img" ).attr( "src", "/h5ai/images/folder-open.png" );
$entry.addClass( "current" );
};
if ( this.content instanceof Array ) {
var $ul = $( "<ul class='content' />" ).appendTo( $entry );
for ( idx in this.content ) {
$( "<li />" ).append( this.content[idx].toHtml() ).appendTo( $ul );
};
} else if ( this.content === undefined ) {
$a.append( $( "<span class='hint'><img src='/h5ai/images/loading.png' /></span>" ) );
} else if ( this.content === 200 ) {
$a.find( ".icon img" ).attr( "src", "/h5ai/images/folder-page.png" );
$a.append( $( "<span class='hint'><img src='/h5ai/images/page.png' /></span>" ) );
} else {
$a.append( $( "<span class='hint error'>" + this.content + "</span>" ) );
$entry.addClass( "notListable" );
};
} else {
$entry.addClass( "file" );
};
} catch( err ) {
$( "<span class='fail'>fail</span>" ).appendTo( $entry );
};
return $entry;
};
};
init()
};
} )( jQuery );

193
src/h5ai/js/inc/tree.js Normal file
View File

@@ -0,0 +1,193 @@
var Tree = function ( utils, h5ai ) {
var THIS = this;
var contentTypeRegEx = /^text\/html;h5ai=/;
this.init = function () {
if ( h5ai.config.showTree ) {
this.checkCrumb();
this.checkCurrentFolder();
this.populateTree();
};
};
this.checkCrumb = function () {
$( "li.crumb a" ).each( function() {
var $a = $( this );
var pathname = $a.attr( "href" );
THIS.checkPathname( pathname, function ( status ) {
if ( !isNaN( status ) ) {
if ( status === 200 ) {
$( "<img class='hint' src='/h5ai/images/page.png' alt='not listable' />" ).appendTo( $a );
} else {
$( "<span class='hint'>(" + status + ")</span>" ).appendTo( $a );
};
};
} );
} );
};
this.checkCurrentFolder = function () {
$( "#extended li.entry.folder" ).each( function() {
var $entry = $( this );
if ( $entry.hasClass( "parentfolder" ) ) {
return;
};
var $a = $entry.find( "a" );
var pathname = decodeURI( document.location.pathname ) + $a.attr( "href" );
THIS.checkPathname( pathname, function ( status ) {
if ( !isNaN( status ) ) {
if ( status === 200 ) {
$a.find( ".icon.small img" ).attr( "src", "/h5ai/icons/16x16/folder-page.png" );
$a.find( ".icon.big img" ).attr( "src", "/h5ai/icons/48x48/folder-page.png" );
} else {
$entry.addClass( "error" );
$a.find( ".label" )
.append( " " )
.append( $( "<span class='hint'>" + status + "</span>" ) );
};
};
} );
} );
};
this.populateTree = function () {
var $tree = $( "#tree" );
var $extended = $( "#extended" );
var shiftTree = function ( show ) {
if ( $tree.outerWidth() < $extended.offset().left || show === true ) {
$tree.stop().animate( { left: 0 } );
} else {
$tree.stop().animate( { left: 18 - $tree.outerWidth() } );
};
};
$tree.hover(
function () {
shiftTree( true );
},
function () {
shiftTree();
}
);
$( window ).resize( function() {
shiftTree();
} );
this.fetchTree( decodeURI( document.location.pathname ), function( entry ) {
$tree.append( entry.updateTreeHtml() );
shiftTree();
} );
};
this.fetchTree = function ( pathname, callback, child ) {
this.fetchEntry( pathname, function ( entry ) {
if ( child !== undefined ) {
entry.content[ child.absHref ] = child;
};
var parent = utils.splitPathname( pathname )[0];
if ( parent === "" ) {
callback( entry );
} else {
THIS.fetchTree( parent, callback, entry );
};
} );
};
this.fetchEntry = function ( pathname, callback ) {
this.fetchEntries( pathname, false, function ( status, entries ) {
var entry = new File( utils, pathname );
entry.status = status;
entry.content = entries;
callback( entry );
} );
};
this.fetchEntries = function ( pathname, includeParent, callback ) {
this.checkPathname( pathname, function ( status ) {
console.log( "checkPathname", pathname, status );
if ( status !== "h5ai" ) {
callback( status, {} );
return;
};
$.ajax( {
url: pathname,
type: "GET",
dataType: "html",
error: function ( xhr ) {
callback( xhr.status, {} ); // since it was checked before this should never happen
},
success: function ( html, status, xhr ) {
if ( !contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) {
callback( xhr.status, {} ); // since it was checked before this should never happen
return;
};
var entries = {};
$( html ).find( "#table table td" ).closest( "tr" ).each( function () {
var entry = new File( utils, pathname, this );
if ( entry.isFolder && ( !entry.isParentFolder || includeParent ) ) {
entries[ entry.absHref ] = entry;
THIS.checkPathname( entry.absHref, function ( status ) {
if ( status !== "h5ai" ) {
entry.status = status;
entry.updateTreeHtml();
};
} );
};
} );
callback( "h5ai", entries );
}
} );
} );
};
var pathnameCache = {};
this.checkPathname = function ( pathname, callback ) {
if ( h5ai.config.folderStatus[ pathname ] !== undefined ) {
callback( h5ai.config.folderStatus[ pathname ] );
return;
} else if ( pathnameCache[ pathname ] !== undefined ) {
callback( pathnameCache[ pathname ] );
return;
};
$.ajax( {
url: pathname,
type: "HEAD",
complete: function ( xhr ) {
var status = xhr.status;
if ( status === 200 && contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) {
status = "h5ai";
};
pathnameCache[ pathname ] = status;
callback( status );
}
} );
};
};

15
src/h5ai/js/inc/utils.js Normal file
View File

@@ -0,0 +1,15 @@
var Utils = function () {
var pathnameRegEx = /^(\/(.*\/)*)([^\/]+\/?)$/;
this.splitPathname = function ( pathname ) {
if ( pathname === "/" ) {
return [ "", "/" ];
};
var match = pathnameRegEx.exec( pathname );
return [ match[1], match[3] ];
};
};

View File

@@ -1,3 +1,37 @@
// @include "inc/jquery.json.min.js" ( function( $ ) {
// @include "inc/h5ai.js"
// #not#include "inc/h5aitree.js" // @include "inc/utils.js"
// @include "inc/h5ai.js"
// @include "inc/file.js"
// @include "inc/tree.js"
/*******************************
* create
*******************************/
var utils = new Utils();
var h5ai = new H5ai( h5aiOptions );
var tree = new Tree( utils, h5ai );
/*******************************
* register public api
*******************************/
$.h5ai = {
folderClick: h5ai.folderClick,
fileClick: h5ai.fileClick
};
/*******************************
* init after dom load
*******************************/
$( function() {
h5ai.init();
tree.init();
} );
} )( jQuery );

86
src/h5ai/options.js Normal file
View File

@@ -0,0 +1,86 @@
/*
* h5ai %BUILD_VERSION%
* Options and localization
*/
h5aiOptions = {
/*
* An array of view modes the user may choose from. Currently there
* are two possible values: "details" and "icons". The first value
* indicates the default view mode. If only one value is given the
* view mode is fixed and the selector buttons are hidden.
* The user selected view mode is also stored local in modern browsers
* so that it will be persistent.
*/
viewmodes: [ "details", "icons" ],
/*
* Show a folder tree, boolean.
* Note that this tree might have side effects as it sends HEAD requests
* to the folders, and therefore will invoke index.php scripts. Use
* folderStatus below to avoid such requests.
* It might also affect performance significantly.
*/
showTree: true,
/*
* Associative array of folders and their HTTP status codes to
* avoid HEAD requests to that folders. The key (folder) must start
* and end with a slash (/).
* For example:
* "/some/folder/": 200
* will always return HTTP status 200 (OK), which will be interpreted
* as a non auto indexed folder, that means a folder containing an
* appropriate default index file.
*/
folderStatus: {
/*
* for example:
* "/some/folder/": 200
*/
},
/*
* Localization, for example "en", "de" etc. - see h5aiLangs below for
* possible values. Adjust it to your needs. If lang is not found in
* h5aiLangs the displayed labels stay unchanged.
*/
lang: undefined,
/*
* Try to use browser language, falls back to previous specified lang.
*/
useBrowserLang: true
};
/*
* Available translations.
* "en" is just an example - see it as a reference. Those values
* are "hardcoded" and will be displayed if all labels stay unchanged.
*/
h5aiLangs = {
"en": {
viewDetails: "details",
viewIcons: "icons",
columnName: "Name",
columnLastModified: "Last modified",
columnSize: "Size",
footerUsing: "using",
parentDirectory: "Parent Directory"
},
"de": {
viewDetails: "Details",
viewIcons: "Icons",
columnName: "Name",
columnLastModified: "Geändert",
columnSize: "Größe",
footerUsing: "nutzt",
parentDirectory: "Übergeordnetes Verzeichnis"
}
};

View File

@@ -1,5 +1,5 @@
################################ ################################
# h5ai 0.5.2 # h5ai 0.7
# customized .htaccess # customized .htaccess
################################ ################################
@@ -56,7 +56,7 @@
IndexOrderDefault Ascending Name IndexOrderDefault Ascending Name
IndexOptions Type=text/html;h5ai=0.5.2 IndexOptions Type=text/html;h5ai=0.7
IndexOptions Charset=UTF-8 IndexOptions Charset=UTF-8
IndexOptions FancyIndexing IndexOptions FancyIndexing
IndexOptions HTMLTable IndexOptions HTMLTable

File diff suppressed because one or more lines are too long

View File

@@ -11,12 +11,13 @@
<img class="techclass" src="/h5ai/images/html5-storage.png" alt="html5-storage" /> <img class="techclass" src="/h5ai/images/html5-storage.png" alt="html5-storage" />
<img class="techclass" src="/h5ai/images/html5-css3.png" alt="html5-css3" /> <img class="techclass" src="/h5ai/images/html5-css3.png" alt="html5-css3" />
</a> </a>
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai 0.5.2">h5ai</a> <a href="http://larsjung.de/h5ai" target="_blank" title="h5ai 0.7">h5ai</a>
using <span class="l10n-footerUsing">using</span>
<a href="http://tiheum.deviantart.com/art/Faenza-Icons-173323228" target="_blank" title="icon theme for Gnome">Faenza icons</a> <a href="http://tiheum.deviantart.com/art/Faenza-Icons-173323228" target="_blank" title="icon theme for Gnome">Faenza icons</a>
</footer> </footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script>window.jQuery || document.write( '<script src="/h5ai/js/lib/jquery.min.js"><\/script>' )</script> <script>window.jQuery || document.write( '<script src="/h5ai/js/lib/jquery.min.js"><\/script>' )</script>
<script src="/h5ai/options.js"></script>
<script src="/h5ai/js/main.js"></script> <script src="/h5ai/js/main.js"></script>
</body> </body>
</html> </html>

View File

@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Directory index · styled with h5ai</title> <title>Directory index · styled with h5ai</title>
<meta name="h5ai-version" content="h5ai 0.5.2"> <meta name="h5ai-version" content="h5ai 0.7">
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)"> <meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="keywords" content="directory, index, autoindex, h5ai"> <meta name="keywords" content="directory, index, autoindex, h5ai">
<link rel="shortcut icon" type="image/png" href="/h5ai/images/h5ai-16x16.png"> <link rel="shortcut icon" type="image/png" href="/h5ai/images/h5ai-16x16.png">
@@ -16,9 +16,15 @@
<nav> <nav>
<span class="jsDisabledFallback">Directory index · JavaScript is disabled</span> <span class="jsDisabledFallback">Directory index · JavaScript is disabled</span>
<ul> <ul>
<li id="domain" class="crumb"><a href="/"><img src="/h5ai/images/home.png" alt="domain" /><span>domain</span></a></li> <li id="domain" class="crumb">
<li id="viewicons" class="view"><a href="#"><img src="/h5ai/images/view-icons.png" alt="view-icons" />icons</a></li> <a href="/"><img src="/h5ai/images/home.png" alt="domain" /><span>domain</span></a>
<li id="viewdetails" class="view" ><a href="#"><img src="/h5ai/images/view-details.png" alt="view-details" />details</a></li> </li>
<li id="viewicons" class="view">
<a href="#"><img src="/h5ai/images/view-icons.png" alt="view-icons" /><span class="l10n-viewIcons">icons</span></a>
</li>
<li id="viewdetails" class="view" >
<a href="#"><img src="/h5ai/images/view-details.png" alt="view-details" /><span class="l10n-viewDetails">details</span></a>
</li>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</nav> </nav>

View File

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View File

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

BIN
target/h5ai/images/tree.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

File diff suppressed because one or more lines are too long

86
target/h5ai/options.js Normal file
View File

@@ -0,0 +1,86 @@
/*
* h5ai 0.7
* Options and localization
*/
h5aiOptions = {
/*
* An array of view modes the user may choose from. Currently there
* are two possible values: "details" and "icons". The first value
* indicates the default view mode. If only one value is given the
* view mode is fixed and the selector buttons are hidden.
* The user selected view mode is also stored local in modern browsers
* so that it will be persistent.
*/
viewmodes: [ "details", "icons" ],
/*
* Show a folder tree, boolean.
* Note that this tree might have side effects as it sends HEAD requests
* to the folders, and therefore will invoke index.php scripts. Use
* folderStatus below to avoid such requests.
* It might also affect performance significantly.
*/
showTree: true,
/*
* Associative array of folders and their HTTP status codes to
* avoid HEAD requests to that folders. The key (folder) must start
* and end with a slash (/).
* For example:
* "/some/folder/": 200
* will always return HTTP status 200 (OK), which will be interpreted
* as a non auto indexed folder, that means a folder containing an
* appropriate default index file.
*/
folderStatus: {
/*
* for example:
* "/some/folder/": 200
*/
},
/*
* Localization, for example "en", "de" etc. - see h5aiLangs below for
* possible values. Adjust it to your needs. If lang is not found in
* h5aiLangs the displayed labels stay unchanged.
*/
lang: undefined,
/*
* Try to use browser language, falls back to previous specified lang.
*/
useBrowserLang: true
};
/*
* Available translations.
* "en" is just an example - see it as a reference. Those values
* are "hardcoded" and will be displayed if all labels stay unchanged.
*/
h5aiLangs = {
"en": {
viewDetails: "details",
viewIcons: "icons",
columnName: "Name",
columnLastModified: "Last modified",
columnSize: "Size",
footerUsing: "using",
parentDirectory: "Parent Directory"
},
"de": {
viewDetails: "Details",
viewIcons: "Icons",
columnName: "Name",
columnLastModified: "Geändert",
columnSize: "Größe",
footerUsing: "nutzt",
parentDirectory: "Übergeordnetes Verzeichnis"
}
};