mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-29 08:40:34 +02:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4fd85accef | ||
|
177dade3a5 | ||
|
a529a32d3a | ||
|
4f09cbf00e | ||
|
e07f05864c | ||
|
b07d702896 | ||
|
ea716b36aa | ||
|
81ec9b2743 | ||
|
ccb26f4774 | ||
|
31bf39bb45 | ||
|
32ec4f5b5e | ||
|
4da215fc68 |
49
README.md
49
README.md
@@ -1,42 +1,47 @@
|
||||
h5ai v0.3 - a beautified Apache index
|
||||
=====================================
|
||||
# h5ai v0.3.1   ·   a beautified Apache index
|
||||
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
## Screenshots
|
||||
|
||||
<a href="http://repo.larsjung.de/screens/h5ai-v0.2.1-details.png" target="_blank" style="float: left">
|
||||
<img src="http://repo.larsjung.de/screens/h5ai-v0.2.1-details.png" width="400px" alt="screenshot" title="screenshot"/>
|
||||
<a href="http://github.com/lrsjng/h5ai/raw/master/resources/h5ai-v0.2.1-details.png" target="_blank">
|
||||
<img src="http://github.com/lrsjng/h5ai/raw/master/resources/h5ai-v0.2.1-details.png" width="400px" alt="screenshot" title="screenshot" style="display: inline" />
|
||||
</a>
|
||||
<a href="http://repo.larsjung.de/screens/h5ai-v0.2.1-icons.png" target="_blank" style="float: right">
|
||||
<img src="http://repo.larsjung.de/screens/h5ai-v0.2.1-icons.png" width="400px" alt="screenshot" title="screenshot" />
|
||||
     
|
||||
<a href="http://github.com/lrsjng/h5ai/raw/master/resources/h5ai-v0.2.1-icons.png" target="_blank">
|
||||
<img src="http://github.com/lrsjng/h5ai/raw/master/resources/h5ai-v0.2.1-icons.png" width="400px" alt="screenshot" title="screenshot" style="display: inline" />
|
||||
</a>
|
||||
<div style="clear: both"/>
|
||||
|
||||
|
||||
Live example
|
||||
------------
|
||||
## Live example
|
||||
|
||||
View a [sample folder](http://repo.larsjung.de/h5ai-sample)
|
||||
*(the files are all empty to save webspace)*
|
||||
|
||||
|
||||
Install
|
||||
-------
|
||||
## Install
|
||||
|
||||
Everything you need is located in folder `target`.
|
||||
|
||||
* 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
|
||||
this folder.
|
||||
* Add the content of file `dot.htaccess` to the `.htaccess` file inside the directory
|
||||
you want to be styled (you might have to create this file). This directory and any subdirectories will be
|
||||
styled by h5ai.
|
||||
* 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://repo.larsjung.de/h5ai-sample/customize). The content of those files
|
||||
will be wrapped by `<header>` and `<footer>` tags.
|
||||
|
||||
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://repo.larsjung.de/h5ai-sample/customize). The content of those files
|
||||
will be wrapped by `<header>` and `<footer>` tags.
|
||||
|
||||
|
||||
Changelog
|
||||
---------
|
||||
## Changelog
|
||||
|
||||
### v0.3.1
|
||||
*2011-06-24*
|
||||
|
||||
* refactored js
|
||||
* added `folderClick` and `fileClick` callback hooks
|
||||
* fixed .emtpy style
|
||||
|
||||
|
||||
### v0.3
|
||||
*2011-06-23*
|
||||
@@ -77,15 +82,13 @@ Changelog
|
||||
* added icon view
|
||||
|
||||
|
||||
Author
|
||||
------
|
||||
## Author
|
||||
|
||||
[Lars Jung](http://larsjung.de)
|
||||
[h5ai on github](http://github.com/lrsjng/h5ai)
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
## License
|
||||
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a>
|
||||
This project is licensed under the [CC BY-SA 3.0 License](http://creativecommons.org/licenses/by-sa/3.0/).
|
||||
|
@@ -3,7 +3,7 @@ custom = true
|
||||
|
||||
# project
|
||||
project.name = h5ai
|
||||
project.version = 0.3
|
||||
project.version = 0.3.2
|
||||
|
||||
|
||||
# src
|
||||
|
BIN
resources/h5ai-v0.2.1-details.png
Normal file
BIN
resources/h5ai-v0.2.1-details.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 103 KiB |
BIN
resources/h5ai-v0.2.1-icons.png
Normal file
BIN
resources/h5ai-v0.2.1-icons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
@@ -157,13 +157,13 @@ body > nav {
|
||||
min-width: 70px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.empty {
|
||||
text-align: center;
|
||||
margin: 50px 0;
|
||||
color: #ddd;
|
||||
font-size: 5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.empty {
|
||||
text-align: center;
|
||||
margin: 50px 0;
|
||||
color: #ddd;
|
||||
font-size: 5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +197,14 @@ body > nav {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
.empty {
|
||||
padding: 16px;
|
||||
height: 120px;
|
||||
text-align: center;
|
||||
color: #ddd;
|
||||
font-size: 5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -16,8 +16,8 @@
|
||||
and
|
||||
<a href="http://tiheum.deviantart.com/art/Faenza-Icons-173323228" target="_blank" title="icon theme for Gnome">Faenza icons</a>
|
||||
</footer>
|
||||
<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-1.6.1.min.js"><\/script>' )</script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
||||
<script>window.jQuery || document.write( '<script src="/h5ai/js/lib/jquery.min.js"><\/script>' )</script>
|
||||
<script src="/h5ai/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
@@ -10,7 +10,7 @@
|
||||
<link rel="apple-touch-icon" href="/h5ai/images/folder.png">
|
||||
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
|
||||
<link rel="stylesheet" type="text/css" href="/h5ai/css/main.css">
|
||||
<script src="/h5ai/js/lib/modernizr-2.0.4.min.js"></script>
|
||||
<script src="/h5ai/js/lib/modernizr.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
|
@@ -1,241 +1,321 @@
|
||||
( function( $ ) {
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* init after dom load
|
||||
*******************************/
|
||||
|
||||
$( function() {
|
||||
|
||||
applyViewmode();
|
||||
initBreadcrumb();
|
||||
initViews();
|
||||
customize();
|
||||
$.h5ai = new H5ai();
|
||||
} );
|
||||
|
||||
|
||||
|
||||
H5ai = function ( options ) {
|
||||
|
||||
/*******************************
|
||||
* config
|
||||
*******************************/
|
||||
/*******************************
|
||||
* config
|
||||
*******************************/
|
||||
|
||||
var config = {
|
||||
columnClasses: [ "icon", "name", "date", "size" ],
|
||||
defaultSortOrder: "C=N;O=A",
|
||||
viewmodes: [ "details", "icons" ],
|
||||
store: {
|
||||
viewmode: "h5ai.viewmode"
|
||||
},
|
||||
icons: {
|
||||
crumb: "/h5ai/icons/crumb.png",
|
||||
ascending: "/h5ai/icons/ascending.png",
|
||||
descending: "/h5ai/icons/descending.png"
|
||||
},
|
||||
customHeader: "h5ai.header.html",
|
||||
customFooter: "h5ai.footer.html"
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* local stored viewmode
|
||||
*******************************/
|
||||
|
||||
function getViewmode() {
|
||||
|
||||
var viewmode = localStorage.getItem( config.store.viewmode );
|
||||
if ( $.inArray( viewmode, config.viewmodes ) ) {
|
||||
return viewmode;
|
||||
};
|
||||
return config.viewmodes[0];
|
||||
};
|
||||
|
||||
|
||||
function applyViewmode( viewmode ) {
|
||||
|
||||
if ( viewmode !== undefined ) {
|
||||
localStorage.setItem( config.store.viewmode, viewmode );
|
||||
}
|
||||
if ( getViewmode() === "icons" ) {
|
||||
$( "#details" ).hide();
|
||||
$( "#icons" ).show();
|
||||
} else {
|
||||
$( "#details" ).show();
|
||||
$( "#icons" ).hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* breadcrumb
|
||||
*******************************/
|
||||
|
||||
function initBreadcrumb() {
|
||||
|
||||
$( "#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>" ) );
|
||||
var config = {
|
||||
columnClasses: [ "icon", "name", "date", "size" ],
|
||||
defaultSortOrder: "C=N;O=A",
|
||||
viewmodes: [ "details", "icons" ],
|
||||
store: {
|
||||
viewmode: "h5ai.viewmode"
|
||||
},
|
||||
icons: {
|
||||
crumb: "/h5ai/icons/crumb.png",
|
||||
ascending: "/h5ai/icons/ascending.png",
|
||||
descending: "/h5ai/icons/descending.png"
|
||||
},
|
||||
customHeader: "h5ai.header.html",
|
||||
customFooter: "h5ai.footer.html",
|
||||
callbacks: {
|
||||
folderClick: [],
|
||||
fileClick: []
|
||||
}
|
||||
}
|
||||
|
||||
$( "nav li a" ).closest( "li" )
|
||||
.click( function () {
|
||||
document.location.href = $( this ).find( "a" ).attr( "href" );
|
||||
} );
|
||||
|
||||
document.title = document.domain + pathname;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* public api
|
||||
*******************************/
|
||||
|
||||
this.folderClick = function ( fn ) {
|
||||
|
||||
/*******************************
|
||||
* details view
|
||||
*******************************/
|
||||
|
||||
function makeTableHtml5Conform() {
|
||||
|
||||
$( "#details td" ).removeAttr( "align" ).removeAttr( "valign" );
|
||||
};
|
||||
if ( typeof fn === "function" ) {
|
||||
config.callbacks.folderClick.push( fn );
|
||||
};
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
function getColumnClass( idx ) {
|
||||
this.fileClick = function ( fn ) {
|
||||
|
||||
if ( idx >= 0 && idx < config.columnClasses.length ) {
|
||||
return config.columnClasses[idx];
|
||||
}
|
||||
return "unknown";
|
||||
};
|
||||
|
||||
|
||||
function initTableColumns() {
|
||||
|
||||
$( "#details tr" ).each( function () {
|
||||
var colIdx = 0;
|
||||
$( this ).find( "th,td" ).each( function () {
|
||||
$( this ).addClass( getColumnClass( colIdx ) );
|
||||
colIdx++;
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
function initTableRows() {
|
||||
|
||||
$( "#details th a" ).closest( "th" )
|
||||
.addClass( "header" )
|
||||
.click( function () {
|
||||
document.location.href = $( this ).find( "a" ).attr( "href" );
|
||||
} );
|
||||
$( "#details td.name a" ).closest( "tr" )
|
||||
.addClass( "entry" )
|
||||
.click( function () {
|
||||
document.location.href = $( this ).find( "td.name a" ).attr( "href" );
|
||||
} );
|
||||
$dataRows = $( "#details td" ).closest( "tr" );
|
||||
if ( $dataRows.size() === 0 || $dataRows.size() === 1 && $dataRows.find( "td.name a" ).text() === "Parent Directory" ) {
|
||||
$( "#details" ).append( $( "<div class='empty'>empty</div>" ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function addSortOrderIcon() {
|
||||
|
||||
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 ) {
|
||||
$( "#details th.name a" ).append( $icon );
|
||||
} else if ( order.indexOf( "C=M" ) >= 0 ) {
|
||||
$( "#details th.date a" ).prepend( $icon );
|
||||
} else if ( order.indexOf( "C=S" ) >= 0 ) {
|
||||
$( "#details th.size a" ).prepend( $icon );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function initDetailsView() {
|
||||
|
||||
makeTableHtml5Conform();
|
||||
initTableColumns();
|
||||
initTableRows();
|
||||
addSortOrderIcon();
|
||||
};
|
||||
if ( typeof fn === "function" ) {
|
||||
config.callbacks.fileClick.push( fn );
|
||||
};
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* init (will be called at the bottom)
|
||||
*******************************/
|
||||
|
||||
/*******************************
|
||||
* icons view
|
||||
*******************************/
|
||||
var init = function () {
|
||||
|
||||
function initIconsView() {
|
||||
applyViewmode();
|
||||
initBreadcrumb();
|
||||
initViews();
|
||||
customize();
|
||||
};
|
||||
|
||||
var $div = $( "<div></div>" );
|
||||
$( "#details td.name a" ).closest( "tr" ).each( function () {
|
||||
var $tr = $( this );
|
||||
var icon = $tr.find( "td.icon img" ).attr( "src" ).replace( "icons", "images" );
|
||||
var $link = $tr.find( "td.name a" );
|
||||
$( "<div class='entry'><img src='" + icon + "' /><div class='label'>" + $link.text() + "</div></div>" )
|
||||
|
||||
|
||||
/*******************************
|
||||
* 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 ) {
|
||||
|
||||
if ( viewmode !== undefined ) {
|
||||
localStorage.setItem( config.store.viewmode, viewmode );
|
||||
};
|
||||
if ( getViewmode() === "icons" ) {
|
||||
$( "#details" ).hide();
|
||||
$( "#icons" ).show();
|
||||
} else {
|
||||
$( "#details" ).show();
|
||||
$( "#icons" ).hide();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* breadcrumb
|
||||
*******************************/
|
||||
|
||||
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>" ) );
|
||||
};
|
||||
};
|
||||
|
||||
$( "nav li a" ).closest( "li" )
|
||||
.click( function () {
|
||||
document.location.href = $link.attr( "href" );
|
||||
} ).
|
||||
appendTo( $div );
|
||||
} );
|
||||
$div.append( $( "<div class='clearfix'></div>" ) );
|
||||
$( "#icons" ).append( $div );
|
||||
};
|
||||
document.location.href = $( this ).find( "a" ).attr( "href" );
|
||||
} );
|
||||
|
||||
document.title = document.domain + pathname;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* details view
|
||||
*******************************/
|
||||
|
||||
/*******************************
|
||||
* init views
|
||||
*******************************/
|
||||
var makeTableHtml5Conform = function () {
|
||||
|
||||
function initViews() {
|
||||
$( "#details td" ).removeAttr( "align" ).removeAttr( "valign" );
|
||||
};
|
||||
|
||||
initDetailsView();
|
||||
initIconsView();
|
||||
|
||||
$( "#viewdetails" ).closest( "li" )
|
||||
.click( function () {
|
||||
applyViewmode( "details" );
|
||||
var getColumnClass = function ( idx ) {
|
||||
|
||||
if ( idx >= 0 && idx < config.columnClasses.length ) {
|
||||
return config.columnClasses[idx];
|
||||
};
|
||||
return "unknown";
|
||||
};
|
||||
|
||||
|
||||
var initTableColumns = function () {
|
||||
|
||||
$( "#details tr" ).each( function () {
|
||||
var colIdx = 0;
|
||||
$( this ).find( "th,td" ).each( function () {
|
||||
$( this ).addClass( getColumnClass( colIdx ) );
|
||||
colIdx++;
|
||||
} );
|
||||
} );
|
||||
$( "#viewicons" ).closest( "li" )
|
||||
.click( function () {
|
||||
applyViewmode( "icons" );
|
||||
};
|
||||
|
||||
|
||||
var initTableRows = function () {
|
||||
|
||||
$( "#details th a" ).closest( "th" )
|
||||
.addClass( "header" )
|
||||
.click( function () {
|
||||
document.location.href = $( this ).find( "a" ).attr( "href" );
|
||||
} );
|
||||
$( "#details td.name a" ).closest( "tr" )
|
||||
.addClass( "entry" )
|
||||
.click( function () {
|
||||
document.location.href = $( this ).find( "td.name a" ).attr( "href" );
|
||||
} );
|
||||
$( "#details tr.entry" ).each( function () {
|
||||
var $row = $( this );
|
||||
$row.find( "td.name a" ).addClass( "label" );
|
||||
if ( $row.find( "td.icon img" ).attr( "alt" ) === "[DIR]" ) {
|
||||
$row.addClass( "folder" );
|
||||
} else {
|
||||
$row.addClass( "file" );
|
||||
};
|
||||
} );
|
||||
};
|
||||
$entries = $( "#details tr.entry" );
|
||||
if ( $entries.size() === 0 || $entries.size() === 1 && $entries.find( "td.name a" ).text() === "Parent Directory" ) {
|
||||
$( "#details" ).append( $( "<div class='empty'>empty</div>" ) );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var addSortOrderIcon = function () {
|
||||
|
||||
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 ) {
|
||||
$( "#details th.name a" ).append( $icon );
|
||||
} else if ( order.indexOf( "C=M" ) >= 0 ) {
|
||||
$( "#details th.date a" ).prepend( $icon );
|
||||
} else if ( order.indexOf( "C=S" ) >= 0 ) {
|
||||
$( "#details th.size a" ).prepend( $icon );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var initDetailsView = function () {
|
||||
|
||||
makeTableHtml5Conform();
|
||||
initTableColumns();
|
||||
initTableRows();
|
||||
addSortOrderIcon();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* icons view
|
||||
*******************************/
|
||||
|
||||
/*******************************
|
||||
* customize
|
||||
*******************************/
|
||||
var initIconsView = function () {
|
||||
|
||||
var $div = $( "<div></div>" );
|
||||
$( "#details td.name a" ).closest( "tr" ).each( function () {
|
||||
var $tr = $( this );
|
||||
var icon = $tr.find( "td.icon img" ).attr( "src" ).replace( "icons", "images" );
|
||||
var $link = $tr.find( "td.name a" );
|
||||
var $entry = $( "<div class='entry'><img src='" + icon + "' /><div class='label'>" + $link.text() + "</div></div>" )
|
||||
.click( function () {
|
||||
document.location.href = $link.attr( "href" );
|
||||
} ).
|
||||
appendTo( $div );
|
||||
if ( $tr.hasClass( "folder" ) ) {
|
||||
$entry.addClass( "folder" );
|
||||
} else {
|
||||
$entry.addClass( "file" );
|
||||
};
|
||||
} );
|
||||
if ( $( "#details .empty" ).size() > 0 ) {
|
||||
$div.append( $( "<div class='empty'>empty</div>" ) );
|
||||
};
|
||||
$div.append( $( "<div class='clearfix'></div>" ) );
|
||||
$( "#icons" ).append( $div );
|
||||
};
|
||||
|
||||
|
||||
function customize() {
|
||||
try {
|
||||
|
||||
/*******************************
|
||||
* init views
|
||||
*******************************/
|
||||
|
||||
var initViews = function () {
|
||||
|
||||
initDetailsView();
|
||||
initIconsView();
|
||||
|
||||
$( "#content .entry.folder" )
|
||||
.click( function() {
|
||||
triggerFolderClick( $( this ).find( ".label" ).text() );
|
||||
} );
|
||||
$( "#content .entry.file" )
|
||||
.click( function() {
|
||||
triggerFileClick( $( this ).find( ".label" ).text() );
|
||||
} );
|
||||
|
||||
$( "#viewdetails" ).closest( "li" )
|
||||
.click( function () {
|
||||
applyViewmode( "details" );
|
||||
} );
|
||||
$( "#viewicons" ).closest( "li" )
|
||||
.click( function () {
|
||||
applyViewmode( "icons" );
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* customize
|
||||
*******************************/
|
||||
|
||||
var customize = function () {
|
||||
|
||||
$.ajax( {
|
||||
url: config.customHeader,
|
||||
dataType: "html",
|
||||
@@ -243,8 +323,7 @@
|
||||
$( "#content > header" ).append( $( data ) ).show();
|
||||
}
|
||||
} );
|
||||
} catch( err ) {};
|
||||
try {
|
||||
|
||||
$.ajax( {
|
||||
url: config.customFooter,
|
||||
dataType: "html",
|
||||
@@ -252,8 +331,15 @@
|
||||
$( "#content > footer" ).prepend( $( data ) ).show();
|
||||
}
|
||||
} );
|
||||
} catch( err ) {};
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* finally run init
|
||||
*******************************/
|
||||
|
||||
init();
|
||||
};
|
||||
|
||||
|
||||
} )( jQuery );
|
||||
|
@@ -1,5 +1,5 @@
|
||||
################################
|
||||
# h5ai 0.3
|
||||
# h5ai 0.3.1
|
||||
# customized .htaccess
|
||||
################################
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@@ -10,14 +10,14 @@
|
||||
<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://github.com/lrsjng/h5ai" target="_blank" title="h5ai 0.3">h5ai</a>
|
||||
<a href="http://github.com/lrsjng/h5ai" target="_blank" title="h5ai 0.3.1">h5ai</a>
|
||||
using
|
||||
<a href="http://html5boilerplate.com" target="_blank" title="a rock-solid default for HTML5 awesome">HTML5 Boilerplate</a>
|
||||
and
|
||||
<a href="http://tiheum.deviantart.com/art/Faenza-Icons-173323228" target="_blank" title="icon theme for Gnome">Faenza icons</a>
|
||||
</footer>
|
||||
<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-1.6.1.min.js"><\/script>' )</script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
||||
<script>window.jQuery || document.write( '<script src="/h5ai/js/lib/jquery.min.js"><\/script>' )</script>
|
||||
<script src="/h5ai/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
@@ -3,14 +3,14 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Directory index · styled with h5ai</title>
|
||||
<meta name="h5ai-version" content="h5ai 0.3">
|
||||
<meta name="h5ai-version" content="h5ai 0.3.1">
|
||||
<meta name="description" content="Directory index styled with h5ai (http://github.com/lrsjng/h5ai)">
|
||||
<meta name="keywords" content="directory, index, autoindex, h5ai">
|
||||
<link rel="shortcut icon" href="/h5ai/icons/folder.png" />
|
||||
<link rel="apple-touch-icon" href="/h5ai/images/folder.png">
|
||||
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
|
||||
<link rel="stylesheet" type="text/css" href="/h5ai/css/main.css">
|
||||
<script src="/h5ai/js/lib/modernizr-2.0.4.min.js"></script>
|
||||
<script src="/h5ai/js/lib/modernizr.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
|
@@ -1 +1 @@
|
||||
(function(h){h(function(){a();f();m();j()});var d={columnClasses:["icon","name","date","size"],defaultSortOrder:"C=N;O=A",viewmodes:["details","icons"],store:{viewmode:"h5ai.viewmode"},icons:{crumb:"/h5ai/icons/crumb.png",ascending:"/h5ai/icons/ascending.png",descending:"/h5ai/icons/descending.png"},customHeader:"h5ai.header.html",customFooter:"h5ai.footer.html"};function g(){var o=localStorage.getItem(d.store.viewmode);if(h.inArray(o,d.viewmodes)){return o}return d.viewmodes[0]}function a(o){if(o!==undefined){localStorage.setItem(d.store.viewmode,o)}if(g()==="icons"){h("#details").hide();h("#icons").show()}else{h("#details").show();h("#icons").hide()}}function f(){h("#domain span").text(document.domain);var s=decodeURI(document.location.pathname);var r=s.split("/");var q="/";var p=h("nav ul");for(idx in r){var o=r[idx];if(o!==""){q+=o+"/";p.append(h("<li class='crumb'><a href='"+q+"'><img src='"+d.icons.crumb+"' alt='>' />"+o+"</a></li>"))}}h("nav li a").closest("li").click(function(){document.location.href=h(this).find("a").attr("href")});document.title=document.domain+s}function c(){h("#details td").removeAttr("align").removeAttr("valign")}function i(o){if(o>=0&&o<d.columnClasses.length){return d.columnClasses[o]}return"unknown"}function b(){h("#details tr").each(function(){var o=0;h(this).find("th,td").each(function(){h(this).addClass(i(o));o++})})}function l(){h("#details th a").closest("th").addClass("header").click(function(){document.location.href=h(this).find("a").attr("href")});h("#details td.name a").closest("tr").addClass("entry").click(function(){document.location.href=h(this).find("td.name a").attr("href")});$dataRows=h("#details td").closest("tr");if($dataRows.size()===0||$dataRows.size()===1&&$dataRows.find("td.name a").text()==="Parent Directory"){h("#details").append(h("<div class='empty'>empty</div>"))}}function e(){var o=document.location.search;if(o===""){o=d.defaultSortOrder}var p;if(o.indexOf("O=A")>=0){p=h("<img src='"+d.icons.ascending+"' class='sort' alt='ascending' />")}else{p=h("<img src='"+d.icons.descending+"' class='sort' alt='descending' />")}if(o.indexOf("C=N")>=0){h("#details th.name a").append(p)}else{if(o.indexOf("C=M")>=0){h("#details th.date a").prepend(p)}else{if(o.indexOf("C=S")>=0){h("#details th.size a").prepend(p)}}}}function k(){c();b();l();e()}function n(){var o=h("<div></div>");h("#details td.name a").closest("tr").each(function(){var r=h(this);var q=r.find("td.icon img").attr("src").replace("icons","images");var p=r.find("td.name a");h("<div class='entry'><img src='"+q+"' /><div class='label'>"+p.text()+"</div></div>").click(function(){document.location.href=p.attr("href")}).appendTo(o)});o.append(h("<div class='clearfix'></div>"));h("#icons").append(o)}function m(){k();n();h("#viewdetails").closest("li").click(function(){a("details")});h("#viewicons").closest("li").click(function(){a("icons")})}function j(){try{h.ajax({url:d.customHeader,dataType:"html",success:function(p){h("#content > header").append(h(p)).show()}})}catch(o){}try{h.ajax({url:d.customFooter,dataType:"html",success:function(p){h("#content > footer").prepend(h(p)).show()}})}catch(o){}}})(jQuery);
|
||||
(function(a){a(function(){a.h5ai=new H5ai()});H5ai=function(r){var e={columnClasses:["icon","name","date","size"],defaultSortOrder:"C=N;O=A",viewmodes:["details","icons"],store:{viewmode:"h5ai.viewmode"},icons:{crumb:"/h5ai/icons/crumb.png",ascending:"/h5ai/icons/ascending.png",descending:"/h5ai/icons/descending.png"},customHeader:"h5ai.header.html",customFooter:"h5ai.footer.html",callbacks:{folderClick:[],fileClick:[]}};this.folderClick=function(s){if(typeof s==="function"){e.callbacks.folderClick.push(s)}return this};this.fileClick=function(s){if(typeof s==="function"){e.callbacks.fileClick.push(s)}return this};var p=function(){b();h();n();k()};var o=function(s){for(idx in e.callbacks.folderClick){e.callbacks.folderClick[idx].call(window,s)}};var g=function(s){for(idx in e.callbacks.fileClick){e.callbacks.fileClick[idx].call(window,s)}};var i=function(){var s=localStorage.getItem(e.store.viewmode);if(a.inArray(s,e.viewmodes)){return s}return e.viewmodes[0]};var b=function(s){if(s!==undefined){localStorage.setItem(e.store.viewmode,s)}if(i()==="icons"){a("#details").hide();a("#icons").show()}else{a("#details").show();a("#icons").hide()}};var h=function(){a("#domain span").text(document.domain);var w=decodeURI(document.location.pathname);var v=w.split("/");var u="/";var t=a("nav ul");for(idx in v){var s=v[idx];if(s!==""){u+=s+"/";t.append(a("<li class='crumb'><a href='"+u+"'><img src='"+e.icons.crumb+"' alt='>' />"+s+"</a></li>"))}}a("nav li a").closest("li").click(function(){document.location.href=a(this).find("a").attr("href")});document.title=document.domain+w};var d=function(){a("#details td").removeAttr("align").removeAttr("valign")};var j=function(s){if(s>=0&&s<e.columnClasses.length){return e.columnClasses[s]}return"unknown"};var c=function(){a("#details tr").each(function(){var s=0;a(this).find("th,td").each(function(){a(this).addClass(j(s));s++})})};var m=function(){a("#details th a").closest("th").addClass("header").click(function(){document.location.href=a(this).find("a").attr("href")});a("#details td.name a").closest("tr").addClass("entry").click(function(){document.location.href=a(this).find("td.name a").attr("href")});a("#details tr.entry").each(function(){var s=a(this);s.find("td.name a").addClass("label");if(s.find("td.icon img").attr("alt")==="[DIR]"){s.addClass("folder")}else{s.addClass("file")}});$entries=a("#details tr.entry");if($entries.size()===0||$entries.size()===1&&$entries.find("td.name a").text()==="Parent Directory"){a("#details").append(a("<div class='empty'>empty</div>"))}};var f=function(){var s=document.location.search;if(s===""){s=e.defaultSortOrder}var t;if(s.indexOf("O=A")>=0){t=a("<img src='"+e.icons.ascending+"' class='sort' alt='ascending' />")}else{t=a("<img src='"+e.icons.descending+"' class='sort' alt='descending' />")}if(s.indexOf("C=N")>=0){a("#details th.name a").append(t)}else{if(s.indexOf("C=M")>=0){a("#details th.date a").prepend(t)}else{if(s.indexOf("C=S")>=0){a("#details th.size a").prepend(t)}}}};var l=function(){d();c();m();f()};var q=function(){var s=a("<div></div>");a("#details td.name a").closest("tr").each(function(){var w=a(this);var v=w.find("td.icon img").attr("src").replace("icons","images");var t=w.find("td.name a");var u=a("<div class='entry'><img src='"+v+"' /><div class='label'>"+t.text()+"</div></div>").click(function(){document.location.href=t.attr("href")}).appendTo(s);if(w.hasClass("folder")){u.addClass("folder")}else{u.addClass("file")}});if(a("#details .empty").size()>0){s.append(a("<div class='empty'>empty</div>"))}s.append(a("<div class='clearfix'></div>"));a("#icons").append(s)};var n=function(){l();q();a("#content .entry.folder").click(function(){o(a(this).find(".label").text())});a("#content .entry.file").click(function(){g(a(this).find(".label").text())});a("#viewdetails").closest("li").click(function(){b("details")});a("#viewicons").closest("li").click(function(){b("icons")})};var k=function(){a.ajax({url:e.customHeader,dataType:"html",success:function(s){a("#content > header").append(a(s)).show()}});a.ajax({url:e.customFooter,dataType:"html",success:function(s){a("#content > footer").prepend(a(s)).show()}})};p()}})(jQuery);
|
Reference in New Issue
Block a user