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

Compare commits

...

2 Commits
v0.5 ... v0.5.2

Author SHA1 Message Date
Lars Jung
b7387adfc8 Some fixes. 2011-07-02 21:11:25 +02:00
Lars Jung
8ee98ed7bd Disabled tree. 2011-07-01 15:32:22 +02:00
18 changed files with 144 additions and 131 deletions

4
.gitignore vendored
View File

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

View File

@@ -1,4 +1,4 @@
# h5ai v0.5   ·   a beautified Apache index # h5ai v0.5.2   ·   a beautified Apache index
## Screenshots ## Screenshots
@@ -47,6 +47,19 @@ please respect their rights.
## Changelog ## 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*
* disabled tree sidebar for now, since it had unwanted side effects
### v0.5 ### v0.5
*2011-07-01* *2011-07-01*

View File

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

View File

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

View File

@@ -8,7 +8,9 @@
list-style: none; list-style: none;
li { li {
position: relative;
white-space: nowrap; white-space: nowrap;
clear: both;
&.header a { &.header a {
padding-bottom: 18px; padding-bottom: 18px;
@@ -44,16 +46,16 @@
} }
} }
.icon, .label, .date, .size { .icon, .label, .date, .size {
display: inline-block; padding: 6px;
padding: 3px 6px 6px 6px;
text-align: left;
} }
.icon { .icon {
text-align: center; display: inline-block;
position: absolute;
left: 0;
top: 2px;
width: 16px; width: 16px;
img { img {
padding-top: 4px;
width: 16px; width: 16px;
height: 16px; height: 16px;
} }
@@ -62,17 +64,26 @@
display: none; display: none;
} }
.label { .label {
width: 682px; display: block;
margin: 0 220px 0 24px;
overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-align: left;
} }
.date { .date {
position: absolute;
right: 70px;
top: 0;
text-align: right; text-align: right;
width: 160px; width: 140px;
white-space: nowrap; white-space: nowrap;
} }
.size { .size {
position: absolute;
right: 0;
top: 0;
text-align: right; text-align: right;
width: 70px; width: 50px;
white-space: nowrap; white-space: nowrap;
} }
} }

View File

@@ -1,32 +1,32 @@
.border-radius ( @radius: 5px ) { .border-radius ( @radius ) {
-moz-border-radius: @radius; -moz-border-radius: @radius;
-webkit-border-radius: @radius; -webkit-border-radius: @radius;
border-radius: @radius; border-radius: @radius;
} }
.box-shadow ( @x: 10px, @y: 10px, @blur: 5px, @color: #ccc ) { .box-shadow ( @shadow ) {
-moz-box-shadow: @x @y @blur @color; -moz-box-shadow: @shadow;
-webkit-box-shadow: @x @y @blur @color; -webkit-box-shadow: @shadow;
box-shadow: @x @y @blur @color; box-shadow: @shadow;
} }
.transition ( @transitions ) { .transition ( @transition ) {
-moz-transition: @transitions; -moz-transition: @transition;
-ms-transition: @transitions; -ms-transition: @transition;
-o-transition: @transitions; -o-transition: @transition;
-webkit-transition: @transitions; -webkit-transition: @transition;
transition: @transitions; transition: @transition;
} }
.transform ( @transforms ) { .transform ( @transform ) {
-moz-transform: @transforms; -moz-transform: @transform;
-o-transform: @transforms; -o-transform: @transform;
-webkit-transform: @transforms; -webkit-transform: @transform;
transform: @transforms; transform: @transform;
} }

View File

@@ -10,7 +10,7 @@
border: 1px solid rgb(225,225,225); border: 1px solid rgb(225,225,225);
border-left: none; border-left: none;
.border-radius ( 0 15px 15px 0 ); .border-radius ( 0 15px 15px 0 );
.box-shadow( 0, 0, 30px, #999 ); .box-shadow( 0 0 30px #999 );
.entry { .entry {
> a, > a.visited { > a, > a.visited {
@@ -51,6 +51,9 @@
color: #c55; color: #c55;
} }
} }
&.file {
display: none;
}
&.current { &.current {
> a, > a:visited { > a, > a:visited {
border: 1px solid rgba(0,0,0,0.1); border: 1px solid rgba(0,0,0,0.1);

View File

@@ -41,7 +41,7 @@ body > nav {
font-size: 0.85em; font-size: 0.85em;
background-color: rgb(240,240,240); background-color: rgb(240,240,240);
border-bottom: 1px solid rgb(225,225,225); border-bottom: 1px solid rgb(225,225,225);
.box-shadow( 0, 0, 30px, #555 ); .box-shadow( 0 0 30px #555 );
span.jsDisabledFallback { span.jsDisabledFallback {
display: block; display: block;
@@ -135,7 +135,7 @@ body > footer {
color: #999; color: #999;
font-size: 0.85em; font-size: 0.85em;
text-align: center; text-align: center;
.box-shadow( 0, 0, 30px, #555 ); .box-shadow( 0 0 30px #555 );
a, a:visited { a, a:visited {
color: #555; color: #555;

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-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="%BUILD_NAME% %BUILD_VERSION%">h5ai</a> <a href="http://larsjung.de/h5ai" target="_blank" title="h5ai %BUILD_VERSION%">h5ai</a>
using using
<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>

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="%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="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">

View File

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

View File

@@ -18,9 +18,9 @@
H5aiTree = function ( options ) { H5aiTree = function ( options ) {
var h5aiMetaRegEx = /<meta name="h5ai-version"/;
var folderRegEx = /\/$/; var folderRegEx = /\/$/;
var pathnameRegEx = /^(\/(.*\/)*)([^\/]+\/?)$/; var pathnameRegEx = /^(\/(.*\/)*)([^\/]+\/?)$/;
var contentTypeRegEx = /^text\/html;h5ai=/;
function init() { function init() {
@@ -39,8 +39,8 @@
var match = pathnameRegEx.exec( pathname ); var match = pathnameRegEx.exec( pathname );
return [ match[1], match[3] ]; return [ match[1], match[3] ];
}; };
function checkCrumb() { function checkCrumb() {
$( "li.crumb a" ).each( function() { $( "li.crumb a" ).each( function() {
@@ -108,7 +108,7 @@
walkBack( pathname, function( walkbackedPathname ) { walkBack( pathname, function( walkbackedPathname ) {
var entry = new Entry( walkbackedPathname ); var entry = new Entry( walkbackedPathname );
fetchFoldersRecursive( walkbackedPathname, function ( content ) { fetchEntriesRecursive( walkbackedPathname, function ( content ) {
entry.content = content; entry.content = content;
callback( entry ); callback( entry );
} ); } );
@@ -134,96 +134,72 @@
}; };
function fetchFoldersRecursive( pathname, callback ) { function fetchEntriesRecursive( pathname, callback ) {
fetchFolders( pathname, false, function ( folders ) { fetchEntries( pathname, false, function ( entries ) {
if ( folders instanceof Array ) { if ( entries instanceof Array ) {
for ( idx in folders ) { for ( idx in entries ) {
( function ( entry ) { ( function ( entry ) {
if ( entry.isFolder ) { if ( entry.isFolder ) {
fetchFoldersRecursive( entry.absHref, function( content ) { fetchEntriesRecursive( entry.absHref, function( content ) {
entry.content = content; entry.content = content;
callback( folders ); callback( entries );
} ); } );
}; };
} ) ( folders[idx] ); } ) ( entries[idx] );
}; };
}; };
callback( folders ); callback( entries );
} );
};
function fetchFolders( pathname, includeParent, callback ) {
fetchEntries( pathname, includeParent, function ( entries ) {
if ( entries instanceof Array ) {
var folders = [];
for ( idx in entries ) {
var entry = entries[idx];
if ( entry.isFolder ) {
folders.push( entry );
};
};
callback( folders );
} else {
callback( entries );
};
} ); } );
}; };
function fetchEntries( pathname, includeParent, callback ) { function fetchEntries( pathname, includeParent, callback ) {
$.ajax( { checkPathname( pathname, function ( status ) {
url: pathname, console.log( "checkPathname", pathname, status );
type: "GET", if ( status !== 0 ) {
dataType: "html", callback( status );
error: function ( xhr ) { } else {
$.ajax( {
callback( xhr.status ); url: pathname,
}, type: "GET",
success: function ( html ) { dataType: "html",
error: function ( xhr ) {
if ( ! h5aiMetaRegEx.test( html ) ) { // since it was checked before this should never happen
callback( 200 ); callback( xhr.status );
} else { },
var entries = []; success: function ( html, status, xhr ) {
$( html ).find( "#table table td" ).closest( "tr" ).each( function () { if ( !contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) {
var entry = new Entry( pathname, this ); // since it was checked before this should never happen
if ( !entry.isParentFolder || includeParent ) { callback( xhr.status );
entries.push( entry ); } 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 ) { function checkPathname( pathname, callback ) {
$.ajax( { $.ajax( {
url: pathname, url: pathname,
type: "GET", type: "HEAD",
dataType: "html", complete: function ( xhr ) {
error: function ( xhr ) { if ( xhr.status === 200 && contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) {
callback( xhr.status );
},
success: function ( html ) {
if ( h5aiMetaRegEx.test( html ) ) {
callback( 0 ); callback( 0 );
} else { } else {
callback( 200 ); callback( xhr.status );
}; };
} }
} ); } );
@@ -240,7 +216,7 @@
var $tds = $( tableRow ).find( "td" ); var $tds = $( tableRow ).find( "td" );
var $img = $( $tds.get( 0 ) ).find( "img" ); var $img = $( $tds.get( 0 ) ).find( "img" );
var $a= $( $tds.get( 1 ) ).find( "a" ); var $a= $( $tds.get( 1 ) ).find( "a" );
this.parentFolder = folder; this.parentFolder = folder;
this.icon16 = $img.attr( "src" ); this.icon16 = $img.attr( "src" );
this.alt = $img.attr( "alt" ); this.alt = $img.attr( "alt" );
@@ -271,14 +247,15 @@
this.isComplete = function () { this.isComplete = function () {
if ( this.content === undefined ) { if ( this.isFolder ) {
return false; if ( this.content === undefined ) {
}; return false;
if ( this.content instanceof Array ) { } else if ( this.content instanceof Array ) {
for ( idx in this.content ) { for ( idx in this.content ) {
if ( !this.content[idx].isComplete() ) { if ( !this.content[idx].isComplete() ) {
return false; return false;
};
}; };
}; };
}; };
@@ -287,7 +264,7 @@
this.toHtml = function () { this.toHtml = function () {
var $entry = $( "<div class='entry' />" ); var $entry = $( "<div class='entry' />" );
try { try {
@@ -297,6 +274,7 @@
.append( $( "<span class='label'>" + this.label + "</span>" ) ); .append( $( "<span class='label'>" + this.label + "</span>" ) );
if ( this.isFolder ) { if ( this.isFolder ) {
$entry.addClass( "folder" );
if ( this.absHref === document.location.pathname ) { if ( this.absHref === document.location.pathname ) {
$a.find( ".icon img" ).attr( "src", "/h5ai/images/folder-open.png" ); $a.find( ".icon img" ).attr( "src", "/h5ai/images/folder-open.png" );
$entry.addClass( "current" ); $entry.addClass( "current" );
@@ -315,6 +293,8 @@
$a.append( $( "<span class='hint error'>" + this.content + "</span>" ) ); $a.append( $( "<span class='hint error'>" + this.content + "</span>" ) );
$entry.addClass( "notListable" ); $entry.addClass( "notListable" );
}; };
} else {
$entry.addClass( "file" );
}; };
} catch( err ) { } catch( err ) {

View File

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

View File

@@ -1,5 +1,5 @@
################################ ################################
# h5ai 0.5 # h5ai 0.5.2
# customized .htaccess # customized .htaccess
################################ ################################
@@ -8,14 +8,16 @@
# Options +FollowSymLinks # Options +FollowSymLinks
################################
# cache images for 52 weeks
################################
<IfModule mod_headers.c> <IfModule mod_headers.c>
################################
# cache images for 52 weeks
################################
<FilesMatch "\.png$"> <FilesMatch "\.png$">
Header set Cache-Control "max-age=31449600, public" Header set Cache-Control "max-age=31449600, public"
</FilesMatch> </FilesMatch>
</IfModule> </IfModule>
@@ -54,6 +56,7 @@
IndexOrderDefault Ascending Name IndexOrderDefault Ascending Name
IndexOptions Type=text/html;h5ai=0.5.2
IndexOptions Charset=UTF-8 IndexOptions Charset=UTF-8
IndexOptions FancyIndexing IndexOptions FancyIndexing
IndexOptions HTMLTable IndexOptions HTMLTable
@@ -87,9 +90,9 @@
AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml
AddIcon /h5ai/icons/16x16/bin.png .so .o 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/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/pdf.png .pdf
AddIcon /h5ai/icons/16x16/deb.png .deb AddIcon /h5ai/icons/16x16/deb.png .deb
AddIcon /h5ai/icons/16x16/rpm.png .rpm 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-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">h5ai</a> <a href="http://larsjung.de/h5ai" target="_blank" title="h5ai 0.5.2">h5ai</a>
using using
<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>

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"> <meta name="h5ai-version" content="h5ai 0.5.2">
<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">

File diff suppressed because one or more lines are too long