Added folder effects to details and icons view. Moved some icons.
|
@ -44,6 +44,12 @@
|
|||
color: #e80;
|
||||
}
|
||||
}
|
||||
&.notListable {
|
||||
> a, > a:visited {
|
||||
opacity: 0.7;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
.icon, .label, .date, .size {
|
||||
padding: 6px;
|
||||
|
@ -69,6 +75,11 @@
|
|||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-align: left;
|
||||
.error {
|
||||
font-size: 0.9em;
|
||||
font-style: italic;
|
||||
color: #c55;
|
||||
}
|
||||
}
|
||||
.date {
|
||||
position: absolute;
|
||||
|
@ -150,11 +161,22 @@
|
|||
.label {
|
||||
display: block;
|
||||
word-wrap: break-word;
|
||||
.error {
|
||||
font-size: 0.9em;
|
||||
font-style: italic;
|
||||
color: #c55;
|
||||
}
|
||||
}
|
||||
.date, .size {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&.notListable {
|
||||
> a, > a:visited {
|
||||
opacity: 0.7;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 587 B |
BIN
src/h5ai/icons/48x48/folder-open.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
src/h5ai/icons/48x48/folder-page.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 409 B |
Before Width: | Height: | Size: 697 B |
|
@ -69,7 +69,7 @@ var File = function ( utils, folder, tableRow ) {
|
|||
if ( this.isFolder ) {
|
||||
$entry.addClass( "folder" );
|
||||
if ( this.absHref === document.location.pathname ) {
|
||||
$a.find( ".icon img" ).attr( "src", "/h5ai/images/folder-open.png" );
|
||||
$a.find( ".icon img" ).attr( "src", "/h5ai/icons/16x16/folder-open.png" );
|
||||
$entry.addClass( "current" );
|
||||
};
|
||||
if ( this.content instanceof Array ) {
|
||||
|
@ -80,7 +80,7 @@ var File = function ( utils, folder, tableRow ) {
|
|||
} 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.find( ".icon img" ).attr( "src", "/h5ai/icons/16x16/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>" ) );
|
||||
|
|
|
@ -254,12 +254,21 @@ var H5ai = function ( options ) {
|
|||
|
||||
$( "#extended" ).append( $ul );
|
||||
|
||||
// empty
|
||||
$entries = $( "#extended .entry" );
|
||||
|
||||
// empty
|
||||
if ( $entries.size() === 0 || $entries.size() === 1 && $entries.find( ".label" ).text() === "Parent Directory" ) {
|
||||
$( "#extended" ).append( $( "<div class='empty'>empty</div>" ) );
|
||||
};
|
||||
|
||||
// parent folder
|
||||
if ( $entries.size() > 0 ) {
|
||||
$entry0 = $( $entries.get(0) );
|
||||
if ( $entry0.find( ".label" ).text() === "Parent Directory" ) {
|
||||
$entry0.addClass( "parentfolder" );
|
||||
};
|
||||
};
|
||||
|
||||
// in case of floats
|
||||
$( "#extended" ).append( $( "<div class='clearfix' />" ) );
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ var Tree = function ( utils, h5ai ) {
|
|||
|
||||
if ( h5ai.config.showTree ) {
|
||||
this.checkCrumb();
|
||||
this.checkCurrentFolder();
|
||||
this.initShifting();
|
||||
this.populateTree();
|
||||
};
|
||||
|
@ -32,6 +33,32 @@ var Tree = function ( utils, h5ai ) {
|
|||
};
|
||||
|
||||
|
||||
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" );
|
||||
thistree.checkPathname( pathname, function ( 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 if ( status !== 0 ) {
|
||||
$entry.addClass( "notListable" );
|
||||
$a.find( ".label" )
|
||||
.append( " " )
|
||||
.append( $( "<span class='error'>" + status + "</span>" ) );
|
||||
};
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
this.shiftTree = function ( show ) {
|
||||
|
||||
var $tree = $( "#tree" );
|
||||
|
@ -161,23 +188,31 @@ var Tree = function ( utils, h5ai ) {
|
|||
} );
|
||||
};
|
||||
|
||||
|
||||
var pathnameCache = {};
|
||||
|
||||
this.checkPathname = function ( pathname, callback ) {
|
||||
|
||||
if ( h5ai.config.folderStatus[ pathname ] !== undefined ) {
|
||||
callback( h5ai.config.folderStatus[ pathname ] );
|
||||
} else {
|
||||
$.ajax( {
|
||||
url: pathname,
|
||||
type: "HEAD",
|
||||
complete: function ( xhr ) {
|
||||
if ( xhr.status === 200 && contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) {
|
||||
callback( 0 );
|
||||
} else {
|
||||
callback( xhr.status );
|
||||
};
|
||||
}
|
||||
} );
|
||||
if ( pathnameCache[ pathname ] !== undefined ) {
|
||||
callback( pathnameCache[ pathname ] );
|
||||
} else {
|
||||
$.ajax( {
|
||||
url: pathname,
|
||||
type: "HEAD",
|
||||
complete: function ( xhr ) {
|
||||
if ( xhr.status === 200 && contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) {
|
||||
pathnameCache[ pathname ] = 0;
|
||||
callback( 0 );
|
||||
} else {
|
||||
pathnameCache[ pathname ] = xhr.status;
|
||||
callback( xhr.status );
|
||||
};
|
||||
}
|
||||
} );
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ h5aiOptions = {
|
|||
* to the folders, and therefore will invoke index.php scripts. Use
|
||||
* folderStatus below to avoid such requests.
|
||||
*/
|
||||
showTree: false,
|
||||
showTree: true,
|
||||
|
||||
/*
|
||||
* Associative array of folders and their HTTP status codes to
|
||||
|
|
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 587 B |
BIN
target/h5ai/icons/48x48/folder-open.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
target/h5ai/icons/48x48/folder-page.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 409 B |
Before Width: | Height: | Size: 697 B |