( function( $ ) { // v2.2 (function($){$.toJSON=function(o) {if(typeof(JSON)=='object'&&JSON.stringify) return JSON.stringify(o);var type=typeof(o);if(o===null) return"null";if(type=="undefined") return undefined;if(type=="number"||type=="boolean") return o+"";if(type=="string") return $.quoteString(o);if(type=='object') {if(typeof o.toJSON=="function") return $.toJSON(o.toJSON());if(o.constructor===Date) {var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+ hours+':'+minutes+':'+seconds+'.'+milli+'Z"';} if(o.constructor===Array) {var ret=[];for(var i=0;i path this.html = { $crumb: undefined, $extended: undefined, $tree: undefined }; this.treeOpen = false; this.isEmpty = function() { return this.content === undefined || $.isEmptyObject( this.content ); }; this.onClick = function ( context ) { pathCache.storeCache(); h5ai.triggerPathClick( this, context ); }; this.onHoverIn = function () { if ( h5ai.config.linkHoverStates ) { for ( ref in this.html ) { $ref = this.html[ref]; if ( $ref !== undefined ) { $ref.find( "> a" ).addClass( "hover" ); }; }; }; }; this.onHoverOut = function () { if ( h5ai.config.linkHoverStates ) { for ( ref in this.html ) { $ref = this.html[ref]; if ( $ref !== undefined ) { $ref.find( "> a" ).removeClass( "hover" ); }; }; }; }; this.updateHtml = function () { this.updateCrumbHtml(); this.updateExtendedHtml(); this.updateTreeHtml(); }; this.updateCrumbHtml = function () { var $html = $( "
  • " ).data( "path", this ); try { $html.addClass( this.isFolder ? "folder" : "file" ); var $a = $( ">" + this.label + "" ); $a.click( $.proxy( function() { this.onClick( "crumb" ); }, this ) ); $a.hover( $.proxy( function() { this.onHoverIn( "crumb" ); }, this ), $.proxy( function() { this.onHoverOut( "crumb" ); }, this ) ); $html.append( $a ); if ( this.isDomain ) { $html.addClass( "domain" ); $a.find( "img" ).attr( "src", "/h5ai/images/home.png" ); }; if ( this.isCurrentFolder ) { $html.addClass( "current" ); }; if ( !isNaN( this.status ) ) { if ( this.status === 200 ) { $( "not listable" ).appendTo( $a ); } else { $( "(" + this.status + ")" ).appendTo( $a ); }; }; } catch( err ) { console.log( "updateCrumbHtml failed", err ); $( "failed" ).appendTo( $html ); }; if ( this.html.$crumb !== undefined ) { this.html.$crumb.replaceWith( $html ); }; this.html.$crumb = $html; return $html; }; this.updateExtendedHtml = function () { var $html = $( "
  • " ).data( "path", this ); try { $html.addClass( this.isFolder ? "folder" : "file" ); var $a = $( "" ).appendTo( $html ); $a.click( $.proxy( function() { this.onClick( "extended" ); }, this ) ); $a.hover( $.proxy( function() { this.onHoverIn( "extended" ); }, this ), $.proxy( function() { this.onHoverOut( "extended" ); }, this ) ); $( "" + this.alt + "" ).appendTo( $a ); $( "" + this.alt + "" ).appendTo( $a ); var $label = $( "" + this.label + "" ).appendTo( $a ); $( "" + this.date + "" ).appendTo( $a ); $( "" + this.size + "" ).appendTo( $a ); if ( this.isParentFolder ) { if ( !h5ai.config.setParentFolderLabels ) { $label.addClass( "l10n-parentDirectory" ); }; $html.addClass( "parentfolder" ); }; if ( !isNaN( this.status ) ) { if ( this.status === 200 ) { $html.addClass( "page" ); $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 { $html.addClass( "error" ); $label.append( $( " " + this.status + " " ) ); }; }; } catch( err ) { console.log( "updateExtendedHtml failed", err ); $( "failed" ).appendTo( $html ); }; if ( this.html.$extended !== undefined ) { this.html.$extended.replaceWith( $html ); }; this.html.$extended = $html; return $html; }; this.updateTreeHtml = function () { var $html = $( "
    " ).data( "path", this ); var $blank = $( "" ).appendTo( $html ); try { $html.addClass( this.isFolder ? "folder" : "file" ); var $a = $( "" ) .appendTo( $html ) .append( $( "" ) ) .append( $( "" + this.label + "" ) ); $a.click( $.proxy( function() { this.onClick( "tree" ); }, this ) ); $a.hover( $.proxy( function() { this.onHoverIn( "tree" ); }, this ), $.proxy( function() { this.onHoverOut( "tree" ); }, this ) ); if ( this.isFolder ) { // indicator if ( this.status === undefined || !this.isEmpty() ) { var $indicator = $( "" ); if ( this.status === undefined ) { $indicator.addClass( "unknown" ); } else if ( this.treeOpen ) { $indicator.addClass( "open" ); }; $indicator.click( $.proxy( function( event ) { if ( $indicator.hasClass( "unknown" ) ) { tree.fetchStatusAndContent( this.absHref, false, $.proxy( function ( status, content ) { this.status = status; this.content = content; this.treeOpen = true; this.updateTreeHtml(); }, this ) ); } else if ( $indicator.hasClass( "open" ) ) { this.treeOpen = false; $indicator.removeClass( "open" ); $html.find( "> ul.content" ).slideUp(); } else { this.treeOpen = true; $indicator.addClass( "open" ); $html.find( "> ul.content" ).slideDown(); }; }, this ) ); $blank.replaceWith( $indicator ); }; // is this the domain? if ( this.isDomain ) { $html.addClass( "domain" ); $a.find( ".icon img" ).attr( "src", "/h5ai/icons/16x16/folder-home.png" ); }; // is this the current folder? if ( this.isCurrentFolder ) { $html.addClass( "current" ); $a.find( ".icon img" ).attr( "src", "/h5ai/icons/16x16/folder-open.png" ); }; // does it have subfolders? if ( !this.isEmpty() ) { var $ul = $( "