Added folder effects to details and icons view. Moved some icons.

This commit is contained in:
Lars Jung 2011-07-04 20:14:24 +02:00
parent faaddd8d60
commit e54abe08ca
19 changed files with 83 additions and 17 deletions

View file

@ -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;
}
}
}
}
}

View file

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View file

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

View file

@ -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>" ) );

View file

@ -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' />" ) );

View file

@ -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 );
};
}
} );
};
};
};
};

View file

@ -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

File diff suppressed because one or more lines are too long

View file

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View file

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

File diff suppressed because one or more lines are too long