From e4646734f2fa2b75827dc895f597d29be0f59931 Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Tue, 5 Jul 2011 01:39:45 +0200 Subject: [PATCH] Added localization. --- README.md | 9 +++- build.properties | 2 +- src/h5ai/css/inc/extended.less | 8 ++-- src/h5ai/footer.html | 2 +- src/h5ai/header.html | 12 +++-- src/h5ai/js/inc/h5ai.js | 40 ++++++++++++++-- src/h5ai/js/inc/tree.js | 87 +++++++++++++++++----------------- src/h5ai/options.js | 49 +++++++++++++++++-- target/dot.htaccess | 4 +- target/h5ai/css/main.css | 2 +- target/h5ai/footer.html | 4 +- target/h5ai/header.html | 14 ++++-- target/h5ai/js/main.js | 2 +- target/h5ai/options.js | 49 +++++++++++++++++-- 14 files changed, 211 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index 4b31760b..ded35c52 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# h5ai v0.5.3   ·   a beautified Apache index +# h5ai v0.6   ·   a beautified Apache index ## Screenshots @@ -47,6 +47,13 @@ please respect their rights. ## Changelog +### v0.6 +*2011-07-05* + +* refactored js +* added localization, see options.js + + ### v0.5.3 *2011-07-04* diff --git a/build.properties b/build.properties index 5c8790e2..a4f6a241 100644 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ custom = true # project project.name = h5ai -project.version = 0.5.3 +project.version = 0.6 # src diff --git a/src/h5ai/css/inc/extended.less b/src/h5ai/css/inc/extended.less index ec5072c6..8a0fee0e 100644 --- a/src/h5ai/css/inc/extended.less +++ b/src/h5ai/css/inc/extended.less @@ -71,7 +71,7 @@ } .label { display: block; - margin: 0 220px 0 24px; + margin: 0 270px 0 24px; overflow: hidden; white-space: nowrap; text-align: left; @@ -83,10 +83,10 @@ } .date { position: absolute; - right: 70px; + right: 100px; top: 0; text-align: right; - width: 140px; + width: 160px; white-space: nowrap; } .size { @@ -94,7 +94,7 @@ right: 0; top: 0; text-align: right; - width: 50px; + width: 80px; white-space: nowrap; } } diff --git a/src/h5ai/footer.html b/src/h5ai/footer.html index 5f5025b7..9625cdf0 100644 --- a/src/h5ai/footer.html +++ b/src/h5ai/footer.html @@ -12,7 +12,7 @@ html5-css3 h5ai - using + using Faenza icons diff --git a/src/h5ai/header.html b/src/h5ai/header.html index 8c7d8110..6318639d 100644 --- a/src/h5ai/header.html +++ b/src/h5ai/header.html @@ -16,9 +16,15 @@ diff --git a/src/h5ai/js/inc/h5ai.js b/src/h5ai/js/inc/h5ai.js index 1fc30586..a742c085 100644 --- a/src/h5ai/js/inc/h5ai.js +++ b/src/h5ai/js/inc/h5ai.js @@ -26,7 +26,9 @@ var H5ai = function ( options ) { viewmodes: [ "details", "icons" ], showTree: false, folderStatus: { - } + }, + lang: undefined, + useBrowserLang: true }; this.config = $.extend( {}, defaults, options ); @@ -65,6 +67,7 @@ var H5ai = function ( options ) { this.initBreadcrumb(); this.initViews(); this.customize(); + this.localize( h5aiLangs, this.config.lang, this.config.useBrowserLang ); }; @@ -202,9 +205,9 @@ var H5ai = function ( options ) { var $label = $( "th.name a" ); var $date = $( "th.date a" ); var $size = $( "th.size a" ); - $( "" + $label.text() + "" ).appendTo( $li ); - $( "" + $date.text() + "" ).appendTo( $li ); - $( "" + $size.text() + "" ).appendTo( $li ); + $( "" + $label.text() + "" ).appendTo( $li ); + $( "" + $date.text() + "" ).appendTo( $li ); + $( "" + $size.text() + "" ).appendTo( $li ); // header sort icons var order = document.location.search; @@ -265,6 +268,7 @@ var H5ai = function ( options ) { if ( $entries.size() > 0 ) { $entry0 = $( $entries.get(0) ); if ( $entry0.find( ".label" ).text() === "Parent Directory" ) { + $entry0.find( ".label" ).addClass( "l10n-parentDirectory" ); $entry0.addClass( "parentfolder" ); }; }; @@ -329,4 +333,32 @@ var H5ai = function ( options ) { } } ); }; + + + + /******************************* + * localization + *******************************/ + + this.localize = function ( data, lang, useBrowserLang ) { + + if ( useBrowserLang === true ) { + var browserLang = navigator.language; + if ( data[ browserLang ] !== undefined ) { + lang = browserLang; + } else if ( browserLang.length > 2 && data[ browserLang.substr( 0, 2 ) ] !== undefined ) { + lang = browserLang.substr( 0, 2 ); + }; + if ( lang === "en" ) { + lang = undefined; + }; + }; + + if ( data[ lang ] !== undefined ) { + var selected = data[ lang ]; + for ( key in selected ) { + $( ".l10n-" + key ).text( selected[key] ); + }; + }; + }; }; diff --git a/src/h5ai/js/inc/tree.js b/src/h5ai/js/inc/tree.js index 99bbb8d9..5a61a10d 100644 --- a/src/h5ai/js/inc/tree.js +++ b/src/h5ai/js/inc/tree.js @@ -159,32 +159,32 @@ var Tree = function ( utils, h5ai ) { console.log( "checkPathname", pathname, status ); if ( status !== 0 ) { callback( status ); - } else { - $.ajax( { - url: pathname, - type: "GET", - dataType: "html", - error: function ( xhr ) { - // since it was checked before this should never happen - callback( xhr.status ); - }, - success: function ( html, status, xhr ) { - if ( !contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) { - // since it was checked before this should never happen - callback( xhr.status ); - } else { - var entries = []; - $( html ).find( "#table table td" ).closest( "tr" ).each( function () { - var entry = new File( utils, pathname, this ); - if ( !entry.isParentFolder || includeParent ) { - entries.push( entry ); - }; - } ); - callback( entries ); - }; - } - } ); + return; }; + + $.ajax( { + url: pathname, + type: "GET", + dataType: "html", + error: function ( xhr ) { + callback( xhr.status ); // since it was checked before this should never happen + }, + success: function ( html, status, xhr ) { + if ( !contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) { + callback( xhr.status ); // since it was checked before this should never happen + return; + }; + + var entries = []; + $( html ).find( "#table table td" ).closest( "tr" ).each( function () { + var entry = new File( utils, pathname, this ); + if ( !entry.isParentFolder || includeParent ) { + entries.push( entry ); + }; + } ); + callback( entries ); + } + } ); } ); }; @@ -195,24 +195,25 @@ var Tree = function ( utils, h5ai ) { if ( h5ai.config.folderStatus[ pathname ] !== undefined ) { callback( h5ai.config.folderStatus[ pathname ] ); - } else { - 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 ); - }; - } - } ); - }; + return; }; + + if ( pathnameCache[ pathname ] !== undefined ) { + callback( pathnameCache[ pathname ] ); + return; + }; + + $.ajax( { + url: pathname, + type: "HEAD", + complete: function ( xhr ) { + var status = xhr.status; + if ( xhr.status === 200 && contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) { + status = 0; + }; + pathnameCache[ pathname ] = status; + callback( status ); + } + } ); }; }; diff --git a/src/h5ai/options.js b/src/h5ai/options.js index cf0981e7..c791fed2 100644 --- a/src/h5ai/options.js +++ b/src/h5ai/options.js @@ -2,7 +2,7 @@ h5aiOptions = { /* - * An array of view modes the user may chose from. Currently there + * An array of view modes the user may choose from. Currently there * are two possible values: "details" and "icons". The first value * indicates the default view mode. If only one value is given the * view mode is fixed and the selector buttons are hidden. @@ -15,9 +15,10 @@ h5aiOptions = { * Show a folder tree, boolean. * Note that this tree might have side effects as it sends HEAD requests * to the folders, and therefore will invoke index.php scripts. Use - * folderStatus below to avoid such requests. + * folderStatus below to avoid such requests. + * It might also affect performance significantly. */ - showTree: true, + showTree: false, /* * Associative array of folders and their HTTP status codes to @@ -34,6 +35,48 @@ h5aiOptions = { * for example: * "/some/folder/": 200 */ + }, + + /* + * Localization, for example "en", "de" etc. - see h5aiLangs below for + * possible values. Adjust it to your needs. If lang is not found in + * h5aiLangs the displayed labels stay unchanged. + */ + lang: undefined, + + /* + * Try to use browser language, falls back to previous specified lang. + */ + useBrowserLang: true +}; + + + +/* + * Available translations. + * "en" is just an example - see it as a reference. Those values + * are "hardcoded" and will be displayed if all labels stay unchanged. + */ +h5aiLangs = { + + "en": { + viewDetails: "details", + viewIcons: "icons", + columnName: "Name", + columnLastModified: "Last modified", + columnSize: "Size", + footerUsing: "using", + parentDirectory: "Parent Directory" + }, + + "de": { + viewDetails: "Details", + viewIcons: "Icons", + columnName: "Name", + columnLastModified: "Geändert", + columnSize: "Größe", + footerUsing: "nutzt", + parentDirectory: "Übergeordnetes Verzeichnis" } }; diff --git a/target/dot.htaccess b/target/dot.htaccess index 84c89b1e..5c6d8c96 100644 --- a/target/dot.htaccess +++ b/target/dot.htaccess @@ -1,5 +1,5 @@ ################################ -# h5ai 0.5.3 +# h5ai 0.6 # customized .htaccess ################################ @@ -56,7 +56,7 @@ IndexOrderDefault Ascending Name - IndexOptions Type=text/html;h5ai=0.5.3 + IndexOptions Type=text/html;h5ai=0.6 IndexOptions Charset=UTF-8 IndexOptions FancyIndexing IndexOptions HTMLTable diff --git a/target/h5ai/css/main.css b/target/h5ai/css/main.css index f8eda806..0ae3632f 100644 --- a/target/h5ai/css/main.css +++ b/target/h5ai/css/main.css @@ -1 +1 @@ -html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}ins{background-color:#ff9;color:#000;text-decoration:none}mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}table{border-collapse:collapse;border-spacing:0}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}input,select{vertical-align:middle}body{font:13px/1.231 sans-serif;*font-size:small}select,input,textarea,button{font:99% sans-serif}pre,code,kbd,samp{font-family:monospace,sans-serif}a:hover,a:active{outline:0}ul,ol{margin-left:2em}ol{list-style-type:decimal}nav ul,nav li{margin:0;list-style:none;list-style-image:none}small{font-size:85%}strong,th{font-weight:bold}td{vertical-align:top}sub,sup{font-size:75%;line-height:0;position:relative}sup{top:-0.5em}sub{bottom:-0.25em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word;padding:15px}textarea{overflow:auto}.ie6 legend,.ie7 legend{margin-left:-7px}input[type="radio"]{vertical-align:text-bottom}input[type="checkbox"]{vertical-align:bottom}.ie7 input[type="checkbox"]{vertical-align:baseline}.ie6 input{vertical-align:text-bottom}label,input[type="button"],input[type="submit"],input[type="image"],button{cursor:pointer}button,input,select,textarea{margin:0}input:invalid,textarea:invalid{border-radius:1px;-moz-box-shadow:0 0 5px red;-webkit-box-shadow:0 0 5px red;box-shadow:0 0 5px red}.no-boxshadow input:invalid,.no-boxshadow textarea:invalid{background-color:#f0dddd}::-moz-selection{background:#ff5e99;color:#fff;text-shadow:none}::selection{background:#ff5e99;color:#fff;text-shadow:none}a:link{-webkit-tap-highlight-color:#ff5e99}button{width:auto;overflow:visible}.ie7 img{-ms-interpolation-mode:bicubic}body,select,input,textarea{color:#444}h1,h2,h3,h4,h5,h6{font-weight:bold}a,a:active,a:visited{color:#607890}a:hover{color:#036}.ir{display:block;text-indent:-999em;overflow:hidden;background-repeat:no-repeat;text-align:left;direction:ltr}.hidden{display:none;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.clearfix:before,.clearfix:after{content:"\0020";display:block;height:0;overflow:hidden}.clearfix:after{clear:both}.clearfix{zoom:1}@media print{*{background:transparent!important;color:black!important;text-shadow:none!important;filter:none!important;-ms-filter:none!important}a,a:visited{color:#444!important;text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}@page{margin:.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}html.js .jsDisabledFallback{display:none}html.no-js body>nav ul{display:none}body{font-family:Ubuntu,sans-serif;font-size:16px;color:#555;margin:80px 30px}a,a:visited{color:#555;text-decoration:none}a:hover,a:visited:hover{color:#e80}body>nav{position:fixed;z-index:1;width:100%;left:0;top:0;font-size:.85em;background-color:#f0f0f0;border-bottom:1px solid #e1e1e1;-moz-box-shadow:0 0 30px #555;-webkit-box-shadow:0 0 30px #555;box-shadow:0 0 30px #555}body>nav span.jsDisabledFallback{display:block;height:30px;line-height:30px;padding:0 10px;color:#999}body>nav li{cursor:pointer;opacity:.7;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}body>nav li.crumb{float:left;border-right:1px dotted #e1e1e1}body>nav li.crumb .hint{margin-left:8px;font-style:italic;color:#999}body>nav li.crumb img.hint{width:10px;height:10px;vertical-align:baseline;padding:0}body>nav li.current{background-color:rgba(255,255,255,0.5);opacity:1.0}body>nav li.view{float:right;border-left:1px dotted #e1e1e1}body>nav li:hover,body>nav li:hover a{background-color:rgba(255,255,255,0.5);color:#e80;opacity:1.0}body>nav a{display:block;height:30px;line-height:30px;padding:0 10px}body>nav img{width:16px;height:16px;vertical-align:bottom;padding:0 6px 6px 0}#content{max-width:980px;margin:0 auto}#content>header{display:none;padding-bottom:10px;margin-bottom:80px;border-bottom:2px dashed #ddd}#content>footer{display:none;padding-top:10px;margin-top:80px;border-top:2px dashed #ddd}#table table{display:block;width:100%;border-collapse:collapse}#table table th,#table table td{padding:3px 6px;text-align:left;border:0}#table table th{padding-bottom:18px;opacity:.4;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#table table th:hover,#table table th:hover a{color:#555;cursor:pointer;opacity:.9}#table table th a,#table table th a:visited{color:#555;font-weight:normal}#table table th a img,#table table th a:visited img{width:12px;height:12px;padding:0 8px}#table table td{border:1px solid #ddd;border-left:none;border-right:0}#table table td:nth-child(1),#table table th:nth-child(1){text-align:center;width:16px}#table table td:nth-child(1) img,#table table th:nth-child(1) img{width:16px;height:16px;padding-top:2px}#table table td:nth-child(2),#table table th:nth-child(2){width:682px;max-width:682px;overflow:hidden;white-space:nowrap}#table table td:nth-child(3),#table table th:nth-child(3){text-align:right;width:160px;min-width:160px;white-space:nowrap}#table table td:nth-child(4),#table table th:nth-child(4){text-align:right;width:70px;min-width:70px;white-space:nowrap}#extended.details-view{display:none}#extended.details-view ul{margin:0;padding:0;list-style:none}#extended.details-view ul li{position:relative;white-space:nowrap;clear:both}#extended.details-view ul li.header a{padding-bottom:18px;color:#555;opacity:.4;cursor:pointer;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#extended.details-view ul li.header a:visited{color:#555}#extended.details-view ul li.header a:hover{color:#555;opacity:.9}#extended.details-view ul li.header a img{width:12px;height:12px;padding:0 8px}#extended.details-view ul li.entry{border-bottom:1px solid #ddd}#extended.details-view ul li.entry a{display:block;cursor:pointer}#extended.details-view ul li.entry a:hover{background-color:#f6f6f6;color:#e80}#extended.details-view ul li.entry.notListable>a,#extended.details-view ul li.entry.notListable>a:visited{opacity:.7;color:#999}#extended.details-view ul li .icon,#extended.details-view ul li .label,#extended.details-view ul li .date,#extended.details-view ul li .size{padding:6px}#extended.details-view ul li .icon{display:inline-block;position:absolute;left:0;top:2px;width:16px}#extended.details-view ul li .icon img{width:16px;height:16px}#extended.details-view ul li .icon.big{display:none}#extended.details-view ul li .label{display:block;margin:0 220px 0 24px;overflow:hidden;white-space:nowrap;text-align:left}#extended.details-view ul li .label .error{font-size:.9em;font-style:italic;color:#c55}#extended.details-view ul li .date{position:absolute;right:70px;top:0;text-align:right;width:140px;white-space:nowrap}#extended.details-view ul li .size{position:absolute;right:0;top:0;text-align:right;width:50px;white-space:nowrap}#extended.details-view .empty{text-align:center;margin:50px 0;color:#ddd;font-size:5em;font-weight:bold}#extended.icons-view{display:none;padding:10px;border:1px solid #eee;border-radius:15px}#extended.icons-view ul{margin:0;padding:0;list-style:none}#extended.icons-view ul li.header{display:none}#extended.icons-view ul li.entry{float:left}#extended.icons-view ul li.entry a{display:block;margin:8px;padding:8px;width:100px;height:120px;float:left;text-align:center;overflow:hidden;border-radius:5px;cursor:pointer;border:2px solid rgba(0,0,0,0)}#extended.icons-view ul li.entry a:hover{color:#e80;border-color:#eee;background-color:#f6f6f6}#extended.icons-view ul li.entry a .icon{display:block}#extended.icons-view ul li.entry a .icon img{width:48px;height:48px;margin-bottom:8px}#extended.icons-view ul li.entry a .icon.small{display:none}#extended.icons-view ul li.entry a .label{display:block;word-wrap:break-word}#extended.icons-view ul li.entry a .label .error{font-size:.9em;font-style:italic;color:#c55}#extended.icons-view ul li.entry a .date,#extended.icons-view ul li.entry a .size{display:none}#extended.icons-view ul li.entry.notListable>a,#extended.icons-view ul li.entry.notListable>a:visited{opacity:.7;color:#999}#extended.icons-view .empty{padding:16px;height:120px;text-align:center;color:#ddd;font-size:5em;font-weight:bold}#tree{display:none;position:fixed;left:0;top:80px;font-size:.85em;padding:16px 32px 16px 16px;background-color:#f0f0f0;border:1px solid #e1e1e1;border-left:none;-moz-border-radius:0 15px 15px 0;-webkit-border-radius:0 15px 15px 0;border-radius:0 15px 15px 0;-moz-box-shadow:0 0 30px #999;-webkit-box-shadow:0 0 30px #999;box-shadow:0 0 30px #999}#tree .entry>a,#tree .entry>a.visited{padding:4px 6px;border:1px solid rgba(0,0,0,0);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;display:block;opacity:.7}#tree .entry>a:hover,#tree .entry>a.visited:hover{background-color:rgba(255,255,255,0.5);opacity:1}#tree .entry>a .label,#tree .entry>a.visited .label{display:inline-block}#tree .entry>a .icon,#tree .entry>a.visited .icon{display:inline-block;width:20px}#tree .entry>a .icon img,#tree .entry>a.visited .icon img{width:16px;height:16px;vertical-align:bottom}#tree .entry>a .hint,#tree .entry>a.visited .hint{display:inline-block;margin-left:12px;font-style:italic;color:#ccc}#tree .entry>a .hint img,#tree .entry>a.visited .hint img{width:10px;height:10px;vertical-align:baseline}#tree .entry>a .error,#tree .entry>a.visited .error{color:#c55}#tree .entry.file{display:none}#tree .entry.current>a,#tree .entry.current>a:visited{border:1px solid rgba(0,0,0,0.1);background-color:rgba(255,255,255,0.5);opacity:1}#tree .entry.notListable>a,#tree .entry.notListable>a:visited{color:#999}#tree .entry ul{list-style:none;margin-left:20px}body>footer{position:fixed;z-index:1;width:100%;left:0;bottom:0;padding:10px 0;border-top:1px solid #e1e1e1;background-color:#f0f0f0;color:#999;font-size:.85em;text-align:center;-moz-box-shadow:0 0 30px #555;-webkit-box-shadow:0 0 30px #555;box-shadow:0 0 30px #555}body>footer a,body>footer a:visited{color:#555;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}body>footer a:hover,body>footer a:visited:hover{color:#e80}#html5{position:absolute;left:6px;bottom:6px;float:left}#html5 img{width:20px;height:20px;opacity:.4;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#html5:hover img{opacity:.8} \ No newline at end of file +html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}ins{background-color:#ff9;color:#000;text-decoration:none}mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}table{border-collapse:collapse;border-spacing:0}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}input,select{vertical-align:middle}body{font:13px/1.231 sans-serif;*font-size:small}select,input,textarea,button{font:99% sans-serif}pre,code,kbd,samp{font-family:monospace,sans-serif}a:hover,a:active{outline:0}ul,ol{margin-left:2em}ol{list-style-type:decimal}nav ul,nav li{margin:0;list-style:none;list-style-image:none}small{font-size:85%}strong,th{font-weight:bold}td{vertical-align:top}sub,sup{font-size:75%;line-height:0;position:relative}sup{top:-0.5em}sub{bottom:-0.25em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word;padding:15px}textarea{overflow:auto}.ie6 legend,.ie7 legend{margin-left:-7px}input[type="radio"]{vertical-align:text-bottom}input[type="checkbox"]{vertical-align:bottom}.ie7 input[type="checkbox"]{vertical-align:baseline}.ie6 input{vertical-align:text-bottom}label,input[type="button"],input[type="submit"],input[type="image"],button{cursor:pointer}button,input,select,textarea{margin:0}input:invalid,textarea:invalid{border-radius:1px;-moz-box-shadow:0 0 5px red;-webkit-box-shadow:0 0 5px red;box-shadow:0 0 5px red}.no-boxshadow input:invalid,.no-boxshadow textarea:invalid{background-color:#f0dddd}::-moz-selection{background:#ff5e99;color:#fff;text-shadow:none}::selection{background:#ff5e99;color:#fff;text-shadow:none}a:link{-webkit-tap-highlight-color:#ff5e99}button{width:auto;overflow:visible}.ie7 img{-ms-interpolation-mode:bicubic}body,select,input,textarea{color:#444}h1,h2,h3,h4,h5,h6{font-weight:bold}a,a:active,a:visited{color:#607890}a:hover{color:#036}.ir{display:block;text-indent:-999em;overflow:hidden;background-repeat:no-repeat;text-align:left;direction:ltr}.hidden{display:none;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.clearfix:before,.clearfix:after{content:"\0020";display:block;height:0;overflow:hidden}.clearfix:after{clear:both}.clearfix{zoom:1}@media print{*{background:transparent!important;color:black!important;text-shadow:none!important;filter:none!important;-ms-filter:none!important}a,a:visited{color:#444!important;text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}@page{margin:.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}html.js .jsDisabledFallback{display:none}html.no-js body>nav ul{display:none}body{font-family:Ubuntu,sans-serif;font-size:16px;color:#555;margin:80px 30px}a,a:visited{color:#555;text-decoration:none}a:hover,a:visited:hover{color:#e80}body>nav{position:fixed;z-index:1;width:100%;left:0;top:0;font-size:.85em;background-color:#f0f0f0;border-bottom:1px solid #e1e1e1;-moz-box-shadow:0 0 30px #555;-webkit-box-shadow:0 0 30px #555;box-shadow:0 0 30px #555}body>nav span.jsDisabledFallback{display:block;height:30px;line-height:30px;padding:0 10px;color:#999}body>nav li{cursor:pointer;opacity:.7;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}body>nav li.crumb{float:left;border-right:1px dotted #e1e1e1}body>nav li.crumb .hint{margin-left:8px;font-style:italic;color:#999}body>nav li.crumb img.hint{width:10px;height:10px;vertical-align:baseline;padding:0}body>nav li.current{background-color:rgba(255,255,255,0.5);opacity:1.0}body>nav li.view{float:right;border-left:1px dotted #e1e1e1}body>nav li:hover,body>nav li:hover a{background-color:rgba(255,255,255,0.5);color:#e80;opacity:1.0}body>nav a{display:block;height:30px;line-height:30px;padding:0 10px}body>nav img{width:16px;height:16px;vertical-align:bottom;padding:0 6px 6px 0}#content{max-width:980px;margin:0 auto}#content>header{display:none;padding-bottom:10px;margin-bottom:80px;border-bottom:2px dashed #ddd}#content>footer{display:none;padding-top:10px;margin-top:80px;border-top:2px dashed #ddd}#table table{display:block;width:100%;border-collapse:collapse}#table table th,#table table td{padding:3px 6px;text-align:left;border:0}#table table th{padding-bottom:18px;opacity:.4;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#table table th:hover,#table table th:hover a{color:#555;cursor:pointer;opacity:.9}#table table th a,#table table th a:visited{color:#555;font-weight:normal}#table table th a img,#table table th a:visited img{width:12px;height:12px;padding:0 8px}#table table td{border:1px solid #ddd;border-left:none;border-right:0}#table table td:nth-child(1),#table table th:nth-child(1){text-align:center;width:16px}#table table td:nth-child(1) img,#table table th:nth-child(1) img{width:16px;height:16px;padding-top:2px}#table table td:nth-child(2),#table table th:nth-child(2){width:682px;max-width:682px;overflow:hidden;white-space:nowrap}#table table td:nth-child(3),#table table th:nth-child(3){text-align:right;width:160px;min-width:160px;white-space:nowrap}#table table td:nth-child(4),#table table th:nth-child(4){text-align:right;width:70px;min-width:70px;white-space:nowrap}#extended.details-view{display:none}#extended.details-view ul{margin:0;padding:0;list-style:none}#extended.details-view ul li{position:relative;white-space:nowrap;clear:both}#extended.details-view ul li.header a{padding-bottom:18px;color:#555;opacity:.4;cursor:pointer;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#extended.details-view ul li.header a:visited{color:#555}#extended.details-view ul li.header a:hover{color:#555;opacity:.9}#extended.details-view ul li.header a img{width:12px;height:12px;padding:0 8px}#extended.details-view ul li.entry{border-bottom:1px solid #ddd}#extended.details-view ul li.entry a{display:block;cursor:pointer}#extended.details-view ul li.entry a:hover{background-color:#f6f6f6;color:#e80}#extended.details-view ul li.entry.notListable>a,#extended.details-view ul li.entry.notListable>a:visited{opacity:.7;color:#999}#extended.details-view ul li .icon,#extended.details-view ul li .label,#extended.details-view ul li .date,#extended.details-view ul li .size{padding:6px}#extended.details-view ul li .icon{display:inline-block;position:absolute;left:0;top:2px;width:16px}#extended.details-view ul li .icon img{width:16px;height:16px}#extended.details-view ul li .icon.big{display:none}#extended.details-view ul li .label{display:block;margin:0 270px 0 24px;overflow:hidden;white-space:nowrap;text-align:left}#extended.details-view ul li .label .error{font-size:.9em;font-style:italic;color:#c55}#extended.details-view ul li .date{position:absolute;right:100px;top:0;text-align:right;width:160px;white-space:nowrap}#extended.details-view ul li .size{position:absolute;right:0;top:0;text-align:right;width:80px;white-space:nowrap}#extended.details-view .empty{text-align:center;margin:50px 0;color:#ddd;font-size:5em;font-weight:bold}#extended.icons-view{display:none;padding:10px;border:1px solid #eee;border-radius:15px}#extended.icons-view ul{margin:0;padding:0;list-style:none}#extended.icons-view ul li.header{display:none}#extended.icons-view ul li.entry{float:left}#extended.icons-view ul li.entry a{display:block;margin:8px;padding:8px;width:100px;height:120px;float:left;text-align:center;overflow:hidden;border-radius:5px;cursor:pointer;border:2px solid rgba(0,0,0,0)}#extended.icons-view ul li.entry a:hover{color:#e80;border-color:#eee;background-color:#f6f6f6}#extended.icons-view ul li.entry a .icon{display:block}#extended.icons-view ul li.entry a .icon img{width:48px;height:48px;margin-bottom:8px}#extended.icons-view ul li.entry a .icon.small{display:none}#extended.icons-view ul li.entry a .label{display:block;word-wrap:break-word}#extended.icons-view ul li.entry a .label .error{font-size:.9em;font-style:italic;color:#c55}#extended.icons-view ul li.entry a .date,#extended.icons-view ul li.entry a .size{display:none}#extended.icons-view ul li.entry.notListable>a,#extended.icons-view ul li.entry.notListable>a:visited{opacity:.7;color:#999}#extended.icons-view .empty{padding:16px;height:120px;text-align:center;color:#ddd;font-size:5em;font-weight:bold}#tree{display:none;position:fixed;left:0;top:80px;font-size:.85em;padding:16px 32px 16px 16px;background-color:#f0f0f0;border:1px solid #e1e1e1;border-left:none;-moz-border-radius:0 15px 15px 0;-webkit-border-radius:0 15px 15px 0;border-radius:0 15px 15px 0;-moz-box-shadow:0 0 30px #999;-webkit-box-shadow:0 0 30px #999;box-shadow:0 0 30px #999}#tree .entry>a,#tree .entry>a.visited{padding:4px 6px;border:1px solid rgba(0,0,0,0);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;display:block;opacity:.7}#tree .entry>a:hover,#tree .entry>a.visited:hover{background-color:rgba(255,255,255,0.5);opacity:1}#tree .entry>a .label,#tree .entry>a.visited .label{display:inline-block}#tree .entry>a .icon,#tree .entry>a.visited .icon{display:inline-block;width:20px}#tree .entry>a .icon img,#tree .entry>a.visited .icon img{width:16px;height:16px;vertical-align:bottom}#tree .entry>a .hint,#tree .entry>a.visited .hint{display:inline-block;margin-left:12px;font-style:italic;color:#ccc}#tree .entry>a .hint img,#tree .entry>a.visited .hint img{width:10px;height:10px;vertical-align:baseline}#tree .entry>a .error,#tree .entry>a.visited .error{color:#c55}#tree .entry.file{display:none}#tree .entry.current>a,#tree .entry.current>a:visited{border:1px solid rgba(0,0,0,0.1);background-color:rgba(255,255,255,0.5);opacity:1}#tree .entry.notListable>a,#tree .entry.notListable>a:visited{color:#999}#tree .entry ul{list-style:none;margin-left:20px}body>footer{position:fixed;z-index:1;width:100%;left:0;bottom:0;padding:10px 0;border-top:1px solid #e1e1e1;background-color:#f0f0f0;color:#999;font-size:.85em;text-align:center;-moz-box-shadow:0 0 30px #555;-webkit-box-shadow:0 0 30px #555;box-shadow:0 0 30px #555}body>footer a,body>footer a:visited{color:#555;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}body>footer a:hover,body>footer a:visited:hover{color:#e80}#html5{position:absolute;left:6px;bottom:6px;float:left}#html5 img{width:20px;height:20px;opacity:.4;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#html5:hover img{opacity:.8} \ No newline at end of file diff --git a/target/h5ai/footer.html b/target/h5ai/footer.html index 18324b98..ec8bb6f2 100644 --- a/target/h5ai/footer.html +++ b/target/h5ai/footer.html @@ -11,8 +11,8 @@ html5-storage html5-css3 - h5ai - using + h5ai + using Faenza icons diff --git a/target/h5ai/header.html b/target/h5ai/header.html index 2b002613..e227fb71 100644 --- a/target/h5ai/header.html +++ b/target/h5ai/header.html @@ -3,7 +3,7 @@ Directory index · styled with h5ai - + @@ -16,9 +16,15 @@ diff --git a/target/h5ai/js/main.js b/target/h5ai/js/main.js index abbc47ea..2730ac91 100644 --- a/target/h5ai/js/main.js +++ b/target/h5ai/js/main.js @@ -1 +1 @@ -(function(g){var f=function(){var i=/^(\/(.*\/)*)([^\/]+\/?)$/;this.splitPathname=function(k){if(k==="/"){return["","/"]}var j=i.exec(k);return[j[1],j[3]]}};var d=function(i){var j={columnClasses:["icon","name","date","size"],defaultSortOrder:"C=N;O=A",store:{viewmode:"h5ai.viewmode"},icons:{crumb:"/h5ai/images/crumb.png",ascending:"/h5ai/images/ascending.png",descending:"/h5ai/images/descending.png"},customHeader:"h5ai.header.html",customFooter:"h5ai.footer.html",callbacks:{folderClick:[],fileClick:[]},viewmodes:["details","icons"],showTree:false,folderStatus:{}};this.config=g.extend({},j,i);this.folderClick=function(k){if(typeof k==="function"){this.config.callbacks.folderClick.push(k)}return this};this.fileClick=function(k){if(typeof k==="function"){this.config.callbacks.fileClick.push(k)}return this};this.init=function(){this.applyViewmode();this.initBreadcrumb();this.initViews();this.customize()};this.triggerFolderClick=function(k){for(idx in this.config.callbacks.folderClick){this.config.callbacks.folderClick[idx].call(window,k)}};this.triggerFileClick=function(k){for(idx in this.config.callbacks.fileClick){this.config.callbacks.fileClick[idx].call(window,k)}};this.getViewmode=function(){var k=localStorage.getItem(this.config.store.viewmode);if(g.inArray(k,this.config.viewmodes)>=0){return k}return this.config.viewmodes[0]};this.applyViewmode=function(k){if(k!==undefined){localStorage.setItem(this.config.store.viewmode,k)}g("body > nav li.view").hide();if(this.config.viewmodes.length>1){if(g.inArray("details",this.config.viewmodes)>=0){g("#viewdetails").show()}if(g.inArray("icons",this.config.viewmodes)>=0){g("#viewicons").show()}}g("body > nav li.view").removeClass("current");if(this.getViewmode()==="details"){g("#viewdetails").closest("li").addClass("current");g("#table").hide();g("#extended").addClass("details-view").removeClass("icons-view").show()}else{if(this.getViewmode()==="icons"){g("#viewicons").closest("li").addClass("current");g("#table").hide();g("#extended").removeClass("details-view").addClass("icons-view").show()}else{g("#table").show();g("#extended").hide()}}};this.initBreadcrumb=function(){g("#domain span").text(document.domain);var o=decodeURI(document.location.pathname);var n=o.split("/");var m="/";var l=g("nav ul");for(idx in n){var k=n[idx];if(k!==""){m+=k+"/";l.append(g("
  • >"+k+"
  • "))}}g("body > nav .crumb:last").addClass("current");document.title=document.domain+o};this.initTableView=function(){var l=this;function k(m){if(m>=0&&m");var r=g("
  • ").appendTo(o);g("").appendTo(r);var m=g("th.name a");var q=g("th.date a");var l=g("th.size a");g(""+m.text()+"").appendTo(r);g(""+q.text()+"").appendTo(r);g(""+l.text()+"").appendTo(r);var k=document.location.search;if(k===""){k=this.config.defaultSortOrder}var n;if(k.indexOf("O=A")>=0){n=g("ascending")}else{n=g("descending")}if(k.indexOf("C=N")>=0){r.find("a.label").append(n)}else{if(k.indexOf("C=M")>=0){r.find("a.date").prepend(n)}else{if(k.indexOf("C=S")>=0){r.find("a.size").prepend(n)}}}g("#table td.name a").closest("tr").each(function(){var z=g(this);var s=z.find("td.icon img");var t=s.attr("src");var v=t.replace("16x16","48x48");var y=s.attr("alt");var A=z.find("td.name a");var C=A.text();var u=A.attr("href");var x=z.find("td.date").text();var D=z.find("td.size").text();var B=g("
  • ").appendTo(o);if(y==="[DIR]"){B.addClass("folder")}else{B.addClass("file")}var w=g("").appendTo(B);g(""+y+"").appendTo(w);g(""+y+"").appendTo(w);g(""+C+"").appendTo(w);g(""+x+"").appendTo(w);g(""+D+"").appendTo(w)});g("#extended").append(o);$entries=g("#extended .entry");if($entries.size()===0||$entries.size()===1&&$entries.find(".label").text()==="Parent Directory"){g("#extended").append(g("
    empty
    "))}if($entries.size()>0){$entry0=g($entries.get(0));if($entry0.find(".label").text()==="Parent Directory"){$entry0.addClass("parentfolder")}}g("#extended").append(g("
    "));var p=this;g("#extended .entry.folder").click(function(){p.triggerFolderClick(g(this).find(".label").text())});g("#extended .entry.file").click(function(){p.triggerFileClick(g(this).find(".label").text())})};this.initViews=function(){this.initTableView();this.initExtendedView();var k=this;g("#viewdetails").closest("li").click(function(){k.applyViewmode("details")});g("#viewicons").closest("li").click(function(){k.applyViewmode("icons")})};this.customize=function(){g.ajax({url:this.config.customHeader,dataType:"html",success:function(k){g("#content > header").append(g(k)).show()}});g.ajax({url:this.config.customFooter,dataType:"html",success:function(k){g("#content > footer").prepend(g(k)).show()}})}};var c=function(j,l,i){if(!/\/$/.test(l)){l+="/"}if(i!==undefined){var n=g(i).find("td");var k=g(n.get(0)).find("img");var m=g(n.get(1)).find("a");this.parentFolder=l;this.icon16=k.attr("src");this.alt=k.attr("alt");this.label=m.text();this.href=m.attr("href");this.date=g(n.get(2)).text();this.size=g(n.get(3)).text()}else{var o=j.splitPathname(l);this.parentFolder=o[0];this.label=o[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 q=g("
    ");try{var s=g("").appendTo(q).append(g("")).append(g(""+this.label+""));if(this.isFolder){q.addClass("folder");if(this.absHref===document.location.pathname){s.find(".icon img").attr("src","/h5ai/icons/16x16/folder-open.png");q.addClass("current")}if(this.content instanceof Array){var p=g("