diff --git a/README.md b/README.md index 104ae1d8..be6c59e7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# h5ai v0.5.2   ·   a beautified Apache index +# h5ai v0.5.3   ·   a beautified Apache index ## Screenshots @@ -47,6 +47,13 @@ please respect their rights. ## Changelog +### v0.5.3 +*2011-07-04* + +* refactored js +* added basic options support + + ### v0.5.2 *2011-07-02* diff --git a/build.properties b/build.properties index 4643659e..5c8790e2 100644 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ custom = true # project project.name = h5ai -project.version = 0.5.2 +project.version = 0.5.3 # src diff --git a/src/h5ai/footer.html b/src/h5ai/footer.html index f864ab22..5f5025b7 100644 --- a/src/h5ai/footer.html +++ b/src/h5ai/footer.html @@ -15,8 +15,9 @@ using Faenza icons - + + \ No newline at end of file diff --git a/src/h5ai/js/inc/file.js b/src/h5ai/js/inc/file.js new file mode 100644 index 00000000..58d6ab33 --- /dev/null +++ b/src/h5ai/js/inc/file.js @@ -0,0 +1,99 @@ + +var File = function ( utils, folder, tableRow ) { + + if ( ! /\/$/.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 = 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.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 = $( "
" ); + + try { + var $a = $( "" ) + .appendTo( $entry ) + .append( $( "" ) ) + .append( $( "" + this.label + "" ) ); + + 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 = $( "