Some fixes.

This commit is contained in:
Lars Jung 2011-07-02 21:11:25 +02:00
parent 8ee98ed7bd
commit b7387adfc8
15 changed files with 94 additions and 80 deletions

4
.gitignore vendored
View file

@ -3,7 +3,9 @@
bin
build
#target
build.local.xml
build.local.*
# Eclipse
.classpath

View file

@ -1,4 +1,4 @@
# h5ai v0.5.1   ·   a beautified Apache index
# h5ai v0.5.2   ·   a beautified Apache index
## Screenshots
@ -47,6 +47,13 @@ please respect their rights.
## Changelog
### v0.5.2
*2011-07-02*
* details view adjusts to window width
* linked icon for *.gz and *.bz2
### v0.5.1
*2011-07-01*

View file

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

View file

@ -8,14 +8,16 @@
# Options +FollowSymLinks
################################
# cache images for 52 weeks
################################
<IfModule mod_headers.c>
################################
# cache images for 52 weeks
################################
<FilesMatch "\.png$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
</IfModule>
@ -54,6 +56,7 @@
IndexOrderDefault Ascending Name
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
IndexOptions Charset=UTF-8
IndexOptions FancyIndexing
IndexOptions HTMLTable
@ -87,9 +90,9 @@
AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml
AddIcon /h5ai/icons/16x16/bin.png .so .o
AddIcon /h5ai/icons/16x16/zip.png .zip .Z .z .jar .war
AddIcon /h5ai/icons/16x16/tar.png .tar
AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2
AddIcon /h5ai/icons/16x16/zip.png .zip .Z .z .jar .war .gz .bz2
AddIcon /h5ai/icons/16x16/tar.png .tar
AddIcon /h5ai/icons/16x16/pdf.png .pdf
AddIcon /h5ai/icons/16x16/deb.png .deb
AddIcon /h5ai/icons/16x16/rpm.png .rpm

View file

@ -8,6 +8,7 @@
list-style: none;
li {
position: relative;
white-space: nowrap;
clear: both;
@ -45,17 +46,16 @@
}
}
.icon, .label, .date, .size {
display: inline-block;
padding: 3px 6px 6px 6px;
text-align: left;
padding: 6px;
}
.icon {
text-align: center;
display: inline-block;
position: absolute;
left: 0;
top: 2px;
width: 16px;
//float: left;
img {
padding-top: 4px;
width: 16px;
height: 16px;
}
@ -64,22 +64,27 @@
display: none;
}
.label {
width: 682px;
display: block;
margin: 0 220px 0 24px;
overflow: hidden;
white-space: nowrap;
//word-wrap: break-word;
//float: left;
text-align: left;
}
.date {
position: absolute;
right: 70px;
top: 0;
text-align: right;
width: 160px;
width: 140px;
white-space: nowrap;
//float: right;
}
.size {
position: absolute;
right: 0;
top: 0;
text-align: right;
width: 70px;
width: 50px;
white-space: nowrap;
//float: right;
}
}
}

View file

@ -11,7 +11,7 @@
<img class="techclass" src="/h5ai/images/html5-storage.png" alt="html5-storage" />
<img class="techclass" src="/h5ai/images/html5-css3.png" alt="html5-css3" />
</a>
<a href="http://larsjung.de/h5ai" target="_blank" title="%BUILD_NAME% %BUILD_VERSION%">h5ai</a>
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai %BUILD_VERSION%">h5ai</a>
using
<a href="http://tiheum.deviantart.com/art/Faenza-Icons-173323228" target="_blank" title="icon theme for Gnome">Faenza icons</a>
</footer>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Directory index · styled with h5ai</title>
<meta name="h5ai-version" content="%BUILD_NAME% %BUILD_VERSION%">
<meta name="h5ai-version" content="h5ai %BUILD_VERSION%">
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="keywords" content="directory, index, autoindex, h5ai">
<link rel="shortcut icon" type="image/png" href="/h5ai/images/h5ai-16x16.png">

View file

@ -256,7 +256,6 @@
// in case of floats
$( "#extended" ).append( $( "<div class='clearfix' />" ) );
// click callbacks
$( "#extended .entry.folder" )
.click( function() {
@ -269,7 +268,6 @@
};
/*******************************
* init views
*******************************/

View file

@ -10,7 +10,7 @@
$( function() {
window.setTimeout( function() {
// $.h5aiTree = new H5aiTree();
$.h5aiTree = new H5aiTree();
}, 1 );
} );
@ -18,9 +18,9 @@
H5aiTree = function ( options ) {
var h5aiMetaRegEx = /<meta name="h5ai-version"/;
var folderRegEx = /\/$/;
var pathnameRegEx = /^(\/(.*\/)*)([^\/]+\/?)$/;
var contentTypeRegEx = /^text\/html;h5ai=/;
function init() {
@ -156,54 +156,50 @@
function fetchEntries( pathname, includeParent, callback ) {
$.ajax( {
url: pathname,
type: "GET",
dataType: "html",
error: function ( xhr ) {
callback( xhr.status );
},
success: function ( html ) {
if ( ! h5aiMetaRegEx.test( html ) ) {
callback( 200 );
} 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 );
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 );
};
} );
callback( entries );
};
}
}
} );
};
} );
};
/*
* Checks pathname for accessibility.
* Calls callback with argument 0 if pathname is a h5ai styled directory.
* Otherwise it returns the http response status.
*/
function checkPathname( pathname, callback ) {
$.ajax( {
url: pathname,
type: "GET",
dataType: "html",
error: function ( xhr ) {
callback( xhr.status );
},
success: function ( html ) {
if ( h5aiMetaRegEx.test( html ) ) {
type: "HEAD",
complete: function ( xhr ) {
if ( xhr.status === 200 && contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) {
callback( 0 );
} else {
callback( 200 );
callback( xhr.status );
};
}
} );
@ -220,7 +216,7 @@
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" );
@ -251,7 +247,7 @@
this.isComplete = function () {
if ( this.isFolder ) {
if ( this.content === undefined ) {
return false;
@ -268,7 +264,7 @@
this.toHtml = function () {
var $entry = $( "<div class='entry' />" );
try {

View file

@ -1,3 +1,3 @@
// @include "inc/jquery.json.min.js"
// @include "inc/h5ai.js"
// @include "inc/h5aitree.js"
// #not#include "inc/h5aitree.js"

View file

@ -1,5 +1,5 @@
################################
# h5ai 0.5.1
# h5ai 0.5.2
# customized .htaccess
################################
@ -8,14 +8,16 @@
# Options +FollowSymLinks
################################
# cache images for 52 weeks
################################
<IfModule mod_headers.c>
################################
# cache images for 52 weeks
################################
<FilesMatch "\.png$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
</IfModule>
@ -54,6 +56,7 @@
IndexOrderDefault Ascending Name
IndexOptions Type=text/html;h5ai=0.5.2
IndexOptions Charset=UTF-8
IndexOptions FancyIndexing
IndexOptions HTMLTable
@ -87,9 +90,9 @@
AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml
AddIcon /h5ai/icons/16x16/bin.png .so .o
AddIcon /h5ai/icons/16x16/zip.png .zip .Z .z .jar .war
AddIcon /h5ai/icons/16x16/tar.png .tar
AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2
AddIcon /h5ai/icons/16x16/zip.png .zip .Z .z .jar .war .gz .bz2
AddIcon /h5ai/icons/16x16/tar.png .tar
AddIcon /h5ai/icons/16x16/pdf.png .pdf
AddIcon /h5ai/icons/16x16/deb.png .deb
AddIcon /h5ai/icons/16x16/rpm.png .rpm

File diff suppressed because one or more lines are too long

View file

@ -11,7 +11,7 @@
<img class="techclass" src="/h5ai/images/html5-storage.png" alt="html5-storage" />
<img class="techclass" src="/h5ai/images/html5-css3.png" alt="html5-css3" />
</a>
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai 0.5.1">h5ai</a>
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai 0.5.2">h5ai</a>
using
<a href="http://tiheum.deviantart.com/art/Faenza-Icons-173323228" target="_blank" title="icon theme for Gnome">Faenza icons</a>
</footer>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Directory index · styled with h5ai</title>
<meta name="h5ai-version" content="h5ai 0.5.1">
<meta name="h5ai-version" content="h5ai 0.5.2">
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="keywords" content="directory, index, autoindex, h5ai">
<link rel="shortcut icon" type="image/png" href="/h5ai/images/h5ai-16x16.png">

File diff suppressed because one or more lines are too long