diff --git a/target/h5ai/css/main.css b/target/h5ai/css/main.css index 5aeaf8ba..b1ebc61b 100644 --- a/target/h5ai/css/main.css +++ b/target/h5ai/css/main.css @@ -1,920 +1 @@ -/* HTML5 ✰ Boilerplate reset */ -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; -} -/* -html { overflow-y: scroll; } -*/ -a:hover, a:active { - outline: none; -} -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: 0px 0px 5px red; - -webkit-box-shadow: 0px 0px 5px red; - box-shadow: 0px 0px 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; -} -/** - * Primary styles - * - * Author: - */ -.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 all and (orientation:portrait) { - -} -@media all and (orientation:landscape) { - -} -@media screen and (max-device-width: 480px) { - /* html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */ -} -@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: 0.5cm; - } - p, h2, h3 { - orphans: 3; - widows: 3; - } - h2, h3 { - page-break-after: avoid; - } -} -/* END - HTML5 ✰ Boilerplate */ -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; -} -body > nav { - position: fixed; - z-index: 1; - width: 100%; - left: 0; - top: 0; - font-size: 0.85em; - background-color: #f1f1f1; - border-bottom: 2px solid #d2d2d2; -} -body > nav span.jsDisabledFallback { - display: block; - height: 30px; - line-height: 30px; - padding: 0 10px; - color: #999; -} -body > nav a, body > nav a:active, body > nav a:visited { - color: #555; - cursor: pointer; - text-decoration: none; - opacity: 0.7; - -moz-transition: all 0.2s ease-in-out; - -ms-transition: all 0.2s ease-in-out; - -o-transition: all 0.2s ease-in-out; - -webkit-transition: all 0.2s ease-in-out; - transition: all 0.2s ease-in-out; - display: block; - height: 30px; - line-height: 30px; - padding: 0 10px; -} -body > nav a:hover, -body > nav a:active:hover, -body > nav a:visited:hover, -body > nav a.hover, -body > nav a:active.hover, -body > nav a:visited.hover { - color: #e80; - background-color: rgba(255, 255, 255, 0.5); - opacity: 1.0; -} -body > nav .current a { - background-color: rgba(255, 255, 255, 0.5); - opacity: 1.0; -} -body > nav img { - width: 16px; - height: 16px; - vertical-align: bottom; - padding: 0 6px 6px 0; -} -body > nav .crumb { - float: left; - border-right: 1px solid #e7e7e7; -} -body > nav .crumb .hint { - margin-left: 8px; - font-style: italic; - color: #999; -} -body > nav .crumb img.hint { - width: 10px; - height: 10px; - vertical-align: baseline; - padding: 0px; -} -body > nav .view { - float: right; - border-left: 1px solid #e7e7e7; -} -#content { - max-width: 960px; - 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: none; -} -#table table th { - padding-bottom: 18px; - opacity: 0.4; - -moz-transition: all 0.2s ease-in-out; - -ms-transition: all 0.2s ease-in-out; - -o-transition: all 0.2s ease-in-out; - -webkit-transition: all 0.2s ease-in-out; - transition: all 0.2s ease-in-out; -} -#table table th:hover, #table table th:hover a { - color: #555; - cursor: pointer; - opacity: 0.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: none; -} -#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, #extended.details-view ul li.header a:active, #extended.details-view ul li.header a:visited { - padding-bottom: 18px; - color: #555; - text-decoration: none; - opacity: 0.4; - cursor: pointer; - -moz-transition: all 0.2s ease-in-out; - -ms-transition: all 0.2s ease-in-out; - -o-transition: all 0.2s ease-in-out; - -webkit-transition: all 0.2s ease-in-out; - transition: all 0.2s ease-in-out; -} -#extended.details-view ul li.header a:hover, #extended.details-view ul li.header a:active:hover, #extended.details-view ul li.header a:visited:hover { - color: #555; - opacity: 0.9; -} -#extended.details-view ul li.header a img, #extended.details-view ul li.header a:active img, #extended.details-view ul li.header a:visited 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, #extended.details-view ul li.entry a:active, #extended.details-view ul li.entry a:visited { - display: block; - color: #555; - text-decoration: none; - cursor: pointer; -} -#extended.details-view ul li.entry a:hover, -#extended.details-view ul li.entry a:active:hover, -#extended.details-view ul li.entry a:visited:hover, -#extended.details-view ul li.entry a.hover, -#extended.details-view ul li.entry a:active.hover, -#extended.details-view ul li.entry a:visited.hover { - background-color: #f6f6f6; - color: #e80; -} -#extended.details-view ul li.entry.error a, #extended.details-view ul li.entry.error a:active, #extended.details-view ul li.entry.error a:visited { - color: #aaa; -} -#extended.details-view ul li.entry.error a .label .hint, #extended.details-view ul li.entry.error a:active .label .hint, #extended.details-view ul li.entry.error a:visited .label .hint { - margin-left: 12px; - font-size: 0.9em; - color: #c55; -} -#extended.details-view ul li.entry.error a:hover, -#extended.details-view ul li.entry.error a:active:hover, -#extended.details-view ul li.entry.error a:visited:hover, -#extended.details-view ul li.entry.error a.hover, -#extended.details-view ul li.entry.error a:active.hover, -#extended.details-view ul li.entry.error a:visited.hover { - opacity: 1; - background-color: #f6f6f6; - color: #e80; -} -#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 .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: 3px; - 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, #extended.icons-view ul li.entry a:active, #extended.icons-view ul li.entry a:visited { - display: block; - margin: 8px; - padding: 8px; - width: 100px; - height: 120px; - float: left; - text-align: center; - text-decoration: none; - overflow: hidden; - border-radius: 5px; - color: #555; - cursor: pointer; - border: 2px solid rgba(0, 0, 0, 0); -} -#extended.icons-view ul li.entry a:hover, -#extended.icons-view ul li.entry a:active:hover, -#extended.icons-view ul li.entry a:visited:hover, -#extended.icons-view ul li.entry a.hover, -#extended.icons-view ul li.entry a:active.hover, -#extended.icons-view ul li.entry a:visited.hover { - color: #e80; - border-color: #eee; - background-color: #f6f6f6; -} -#extended.icons-view ul li.entry a .icon, #extended.icons-view ul li.entry a:active .icon, #extended.icons-view ul li.entry a:visited .icon { - display: block; -} -#extended.icons-view ul li.entry a .icon img, #extended.icons-view ul li.entry a:active .icon img, #extended.icons-view ul li.entry a:visited .icon img { - width: 48px; - height: 48px; - margin-bottom: 8px; -} -#extended.icons-view ul li.entry a .icon.small, #extended.icons-view ul li.entry a:active .icon.small, #extended.icons-view ul li.entry a:visited .icon.small { - display: none; -} -#extended.icons-view ul li.entry a .label, #extended.icons-view ul li.entry a:active .label, #extended.icons-view ul li.entry a:visited .label { - display: block; - word-wrap: break-word; -} -#extended.icons-view ul li.entry a .date, -#extended.icons-view ul li.entry a:active .date, -#extended.icons-view ul li.entry a:visited .date, -#extended.icons-view ul li.entry a .size, -#extended.icons-view ul li.entry a:active .size, -#extended.icons-view ul li.entry a:visited .size { - display: none; -} -#extended.icons-view ul li.entry.error a, #extended.icons-view ul li.entry.error a:active, #extended.icons-view ul li.entry.error a:visited { - color: #aaa; - text-decoration: none; -} -#extended.icons-view ul li.entry.error a .label .hint, #extended.icons-view ul li.entry.error a:active .label .hint, #extended.icons-view ul li.entry.error a:visited .label .hint { - padding: 0 6px; - font-size: 0.9em; - color: #c55; -} -#extended.icons-view ul li.entry.error a:hover, -#extended.icons-view ul li.entry.error a:active:hover, -#extended.icons-view ul li.entry.error a:visited:hover, -#extended.icons-view ul li.entry.error a.hover, -#extended.icons-view ul li.entry.error a:active.hover, -#extended.icons-view ul li.entry.error a:visited.hover { - color: #e80; - border-color: #eee; - background-color: #f6f6f6; -} -#extended.icons-view .empty { - padding: 16px; - height: 120px; - text-align: center; - color: #ddd; - font-size: 5em; - font-weight: bold; -} -#tree { - position: fixed; - left: -200px; - display: none; - left: 0; - top: 0; - overflow: auto; - font-size: 0.85em; - padding: 16px 32px 16px 16px; - background-color: #f1f1f1; - border: 2px solid #d2d2d2; - border-left: none; - -moz-border-radius: 0 15px 15px 0; - -webkit-border-radius: 0 15px 15px 0; - border-radius: 0 15px 15px 0; -} -#tree .entry .blank, #tree .entry .indicator { - display: inline-block; - width: 16px; - height: 25px; - float: left; -} -#tree .entry .indicator { - opacity: 0.7; - -moz-transition: all 0.2s ease-in-out; - -ms-transition: all 0.2s ease-in-out; - -o-transition: all 0.2s ease-in-out; - -webkit-transition: all 0.2s ease-in-out; - transition: all 0.2s ease-in-out; - cursor: pointer; -} -#tree .entry .indicator:hover { - opacity: 1; -} -#tree .entry .indicator img { - position: relative; - left: 0; - top: 3px; - width: 12px; - height: 12px; - vertical-align: bottom; - -moz-transition: all 0.2s ease-in-out; - -ms-transition: all 0.2s ease-in-out; - -o-transition: all 0.2s ease-in-out; - -webkit-transition: all 0.2s ease-in-out; - transition: all 0.2s ease-in-out; -} -#tree .entry .indicator.open img { - -moz-transform: rotate(90deg); - -o-transform: rotate(90deg); - -webkit-transform: rotate(90deg); - transform: rotate(90deg); -} -#tree .entry .indicator.unknown { - opacity: 0.3; -} -#tree .entry > a, #tree .entry > a:active, #tree .entry > a.visited { - margin-left: 16px; - padding: 4px 6px; - border: 1px solid rgba(0, 0, 0, 0); - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - border-radius: 5px; - display: block; - color: #555; - text-decoration: none; - opacity: 0.7; -} -#tree .entry > a:hover, -#tree .entry > a:active:hover, -#tree .entry > a.visited:hover, -#tree .entry > a.hover, -#tree .entry > a:active.hover, -#tree .entry > a.visited.hover { - color: #e80; - background-color: rgba(255, 255, 255, 0.5); - opacity: 1; -} -#tree .entry > a .label, #tree .entry > a:active .label, #tree .entry > a.visited .label { - display: inline-block; -} -#tree .entry > a .icon, #tree .entry > a:active .icon, #tree .entry > a.visited .icon { - display: inline-block; - width: 20px; -} -#tree .entry > a .icon img, #tree .entry > a:active .icon img, #tree .entry > a.visited .icon img { - width: 16px; - height: 16px; - vertical-align: bottom; -} -#tree .entry > a .hint, #tree .entry > a:active .hint, #tree .entry > a.visited .hint { - display: inline-block; - margin-left: 12px; - font-size: 0.9em; - color: #ccc; -} -#tree .entry > a .hint img, #tree .entry > a:active .hint img, #tree .entry > a.visited .hint img { - width: 10px; - height: 10px; - vertical-align: baseline; -} -#tree .entry.file { - display: none; -} -#tree .entry.current > a, #tree .entry.current > a:active, #tree .entry.current > a:visited { - border: 1px solid #dddddd; - background-color: rgba(255, 255, 255, 0.5); - opacity: 1; -} -#tree .entry.error > a, #tree .entry.error > a:active, #tree .entry.error > a:visited { - color: #999; -} -#tree .entry.error > a:hover, -#tree .entry.error > a:active:hover, -#tree .entry.error > a:visited:hover, -#tree .entry.error > a.hover, -#tree .entry.error > a:active.hover, -#tree .entry.error > a:visited.hover { - color: #e80; -} -#tree .entry.error .hint { - color: #c55; -} -#tree .entry .content { - list-style: none; - margin-left: 20px; -} -body > footer { - position: fixed; - z-index: 1; - width: 100%; - left: 0; - bottom: 0; - padding: 10px 0; - background-color: #f1f1f1; - border-top: 2px solid #d2d2d2; - color: #999; - font-size: 0.85em; - text-align: center; -} -body > footer a, body > footer a:active, body > footer a:visited { - color: #555; - text-decoration: none; - -moz-transition: all 0.2s ease-in-out; - -ms-transition: all 0.2s ease-in-out; - -o-transition: all 0.2s ease-in-out; - -webkit-transition: all 0.2s ease-in-out; - transition: all 0.2s ease-in-out; -} -body > footer a:hover, body > footer a:active:hover, body > footer a:visited:hover { - color: #e80; -} -#html5 { - position: absolute; - left: 6px; - bottom: 6px; - opacity: 0.4; - -moz-transition: all 0.2s ease-in-out; - -ms-transition: all 0.2s ease-in-out; - -o-transition: all 0.2s ease-in-out; - -webkit-transition: all 0.2s ease-in-out; - transition: all 0.2s ease-in-out; -} -#html5 img { - width: 20px; - height: 20px; -} -#html5:hover { - opacity: 0.8; -} +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}body>nav{position:fixed;z-index:1;width:100%;left:0;top:0;font-size:.85em;background-color:#f1f1f1;border-bottom:2px solid #d2d2d2}body>nav span.jsDisabledFallback{display:block;height:30px;line-height:30px;padding:0 10px;color:#999}body>nav a,body>nav a:active,body>nav a:visited{color:#555;cursor:pointer;text-decoration:none;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;display:block;height:30px;line-height:30px;padding:0 10px}body>nav a:hover,body>nav a:active:hover,body>nav a:visited:hover,body>nav a.hover,body>nav a:active.hover,body>nav a:visited.hover{color:#e80;background-color:rgba(255,255,255,0.5);opacity:1.0}body>nav .current a{background-color:rgba(255,255,255,0.5);opacity:1.0}body>nav img{width:16px;height:16px;vertical-align:bottom;padding:0 6px 6px 0}body>nav .crumb{float:left;border-right:1px solid #e7e7e7}body>nav .crumb .hint{margin-left:8px;font-style:italic;color:#999}body>nav .crumb img.hint{width:10px;height:10px;vertical-align:baseline;padding:0}body>nav .view{float:right;border-left:1px solid #e7e7e7}#content{max-width:960px;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,#extended.details-view ul li.header a:active,#extended.details-view ul li.header a:visited{padding-bottom:18px;color:#555;text-decoration:none;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:hover,#extended.details-view ul li.header a:active:hover,#extended.details-view ul li.header a:visited:hover{color:#555;opacity:.9}#extended.details-view ul li.header a img,#extended.details-view ul li.header a:active img,#extended.details-view ul li.header a:visited 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,#extended.details-view ul li.entry a:active,#extended.details-view ul li.entry a:visited{display:block;color:#555;text-decoration:none;cursor:pointer}#extended.details-view ul li.entry a:hover,#extended.details-view ul li.entry a:active:hover,#extended.details-view ul li.entry a:visited:hover,#extended.details-view ul li.entry a.hover,#extended.details-view ul li.entry a:active.hover,#extended.details-view ul li.entry a:visited.hover{background-color:#f6f6f6;color:#e80}#extended.details-view ul li.entry.error a,#extended.details-view ul li.entry.error a:active,#extended.details-view ul li.entry.error a:visited{color:#aaa}#extended.details-view ul li.entry.error a .label .hint,#extended.details-view ul li.entry.error a:active .label .hint,#extended.details-view ul li.entry.error a:visited .label .hint{margin-left:12px;font-size:.9em;color:#c55}#extended.details-view ul li.entry.error a:hover,#extended.details-view ul li.entry.error a:active:hover,#extended.details-view ul li.entry.error a:visited:hover,#extended.details-view ul li.entry.error a.hover,#extended.details-view ul li.entry.error a:active.hover,#extended.details-view ul li.entry.error a:visited.hover{opacity:1;background-color:#f6f6f6;color:#e80}#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 .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:3px;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,#extended.icons-view ul li.entry a:active,#extended.icons-view ul li.entry a:visited{display:block;margin:8px;padding:8px;width:100px;height:120px;float:left;text-align:center;text-decoration:none;overflow:hidden;border-radius:5px;color:#555;cursor:pointer;border:2px solid rgba(0,0,0,0)}#extended.icons-view ul li.entry a:hover,#extended.icons-view ul li.entry a:active:hover,#extended.icons-view ul li.entry a:visited:hover,#extended.icons-view ul li.entry a.hover,#extended.icons-view ul li.entry a:active.hover,#extended.icons-view ul li.entry a:visited.hover{color:#e80;border-color:#eee;background-color:#f6f6f6}#extended.icons-view ul li.entry a .icon,#extended.icons-view ul li.entry a:active .icon,#extended.icons-view ul li.entry a:visited .icon{display:block}#extended.icons-view ul li.entry a .icon img,#extended.icons-view ul li.entry a:active .icon img,#extended.icons-view ul li.entry a:visited .icon img{width:48px;height:48px;margin-bottom:8px}#extended.icons-view ul li.entry a .icon.small,#extended.icons-view ul li.entry a:active .icon.small,#extended.icons-view ul li.entry a:visited .icon.small{display:none}#extended.icons-view ul li.entry a .label,#extended.icons-view ul li.entry a:active .label,#extended.icons-view ul li.entry a:visited .label{display:block;word-wrap:break-word}#extended.icons-view ul li.entry a .date,#extended.icons-view ul li.entry a:active .date,#extended.icons-view ul li.entry a:visited .date,#extended.icons-view ul li.entry a .size,#extended.icons-view ul li.entry a:active .size,#extended.icons-view ul li.entry a:visited .size{display:none}#extended.icons-view ul li.entry.error a,#extended.icons-view ul li.entry.error a:active,#extended.icons-view ul li.entry.error a:visited{color:#aaa;text-decoration:none}#extended.icons-view ul li.entry.error a .label .hint,#extended.icons-view ul li.entry.error a:active .label .hint,#extended.icons-view ul li.entry.error a:visited .label .hint{padding:0 6px;font-size:.9em;color:#c55}#extended.icons-view ul li.entry.error a:hover,#extended.icons-view ul li.entry.error a:active:hover,#extended.icons-view ul li.entry.error a:visited:hover,#extended.icons-view ul li.entry.error a.hover,#extended.icons-view ul li.entry.error a:active.hover,#extended.icons-view ul li.entry.error a:visited.hover{color:#e80;border-color:#eee;background-color:#f6f6f6}#extended.icons-view .empty{padding:16px;height:120px;text-align:center;color:#ddd;font-size:5em;font-weight:bold}#tree{position:fixed;left:-200px;display:none;left:0;top:0;overflow:auto;font-size:.85em;padding:16px 32px 16px 16px;background-color:#f1f1f1;border:2px solid #d2d2d2;border-left:none;-moz-border-radius:0 15px 15px 0;-webkit-border-radius:0 15px 15px 0;border-radius:0 15px 15px 0}#tree .entry .blank,#tree .entry .indicator{display:inline-block;width:16px;height:25px;float:left}#tree .entry .indicator{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;cursor:pointer}#tree .entry .indicator:hover{opacity:1}#tree .entry .indicator img{position:relative;left:0;top:3px;width:12px;height:12px;vertical-align:bottom;-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}#tree .entry .indicator.open img{-moz-transform:rotate(90deg);-o-transform:rotate(90deg);-webkit-transform:rotate(90deg);transform:rotate(90deg)}#tree .entry .indicator.unknown{opacity:.3}#tree .entry>a,#tree .entry>a:active,#tree .entry>a.visited{margin-left:16px;padding:4px 6px;border:1px solid rgba(0,0,0,0);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;display:block;color:#555;text-decoration:none;opacity:.7}#tree .entry>a:hover,#tree .entry>a:active:hover,#tree .entry>a.visited:hover,#tree .entry>a.hover,#tree .entry>a:active.hover,#tree .entry>a.visited.hover{color:#e80;background-color:rgba(255,255,255,0.5);opacity:1}#tree .entry>a .label,#tree .entry>a:active .label,#tree .entry>a.visited .label{display:inline-block}#tree .entry>a .icon,#tree .entry>a:active .icon,#tree .entry>a.visited .icon{display:inline-block;width:20px}#tree .entry>a .icon img,#tree .entry>a:active .icon img,#tree .entry>a.visited .icon img{width:16px;height:16px;vertical-align:bottom}#tree .entry>a .hint,#tree .entry>a:active .hint,#tree .entry>a.visited .hint{display:inline-block;margin-left:12px;font-size:.9em;color:#ccc}#tree .entry>a .hint img,#tree .entry>a:active .hint img,#tree .entry>a.visited .hint img{width:10px;height:10px;vertical-align:baseline}#tree .entry.file{display:none}#tree .entry.current>a,#tree .entry.current>a:active,#tree .entry.current>a:visited{border:1px solid #ddd;background-color:rgba(255,255,255,0.5);opacity:1}#tree .entry.error>a,#tree .entry.error>a:active,#tree .entry.error>a:visited{color:#999}#tree .entry.error>a:hover,#tree .entry.error>a:active:hover,#tree .entry.error>a:visited:hover,#tree .entry.error>a.hover,#tree .entry.error>a:active.hover,#tree .entry.error>a:visited.hover{color:#e80}#tree .entry.error .hint{color:#c55}#tree .entry .content{list-style:none;margin-left:20px}body>footer{position:fixed;z-index:1;width:100%;left:0;bottom:0;padding:10px 0;background-color:#f1f1f1;border-top:2px solid #d2d2d2;color:#999;font-size:.85em;text-align:center}body>footer a,body>footer a:active,body>footer a:visited{color:#555;text-decoration:none;-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:active:hover,body>footer a:visited:hover{color:#e80}#html5{position:absolute;left:6px;bottom:6px;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 img{width:20px;height:20px}#html5:hover{opacity:.8} \ No newline at end of file diff --git a/target/h5ai/js/main.js b/target/h5ai/js/main.js index 0efdf50b..b615c291 100644 --- a/target/h5ai/js/main.js +++ b/target/h5ai/js/main.js @@ -1,946 +1 @@ -( 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<o.length;i++) -ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";} -var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number") -name='"'+k+'"';else if(type=="string") -name=$.quoteString(k);else -continue;if(typeof o[k]=="function") -continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);} -return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src) -{if(typeof(JSON)=='object'&&JSON.parse) -return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src) -{if(typeof(JSON)=='object'&&JSON.parse) -return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered)) -return eval("("+src+")");else -throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string) -{if(string.match(_escapeable)) -{return'"'+string.replace(_escapeable,function(a) -{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';} -return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery); - - -var PathCache = function () { - - - var pathnameRegEx = /^(\/(.*\/)*)([^\/]+\/?)$/; - - this.splitPathname = function ( pathname ) { - - if ( pathname === "/" ) { - return [ "", "/" ]; - }; - var match = pathnameRegEx.exec( pathname ); - return [ match[1], match[3] ]; - }; - - - this.cache = {}; - - - this.loadCache = function () { - - var json = localStorage.getItem( "h5ai.cache" ); - var objs = $.evalJSON( json ); - var cache = {}; - for ( idx in objs ) { - var obj = objs[idx]; - var path = this.objectToPath( obj ); - cache[path.absHref] = path; - }; - console.log( "loaded: ", cache ); - return cache; - }; - - - this.storeCache = function () { - - var objs = []; - for ( ref in this.cache ) { - var path = this.cache[ref]; - if ( path.isFolder ) { - objs.push( this.pathToObject( path ) ); - }; - }; - var json = $.toJSON( objs ); - localStorage.setItem( "h5ai.cache", json ); - }; - - - this.pathToObject = function ( path ) { - - var object = { - r: path.absHref, - s: path.status, - c: [], - o: path.treeOpen - }; - - if ( path.content !== undefined ) { - for ( ref in path.content ) { - object.c.push( ref ); - }; - }; - - return object; - }; - - - this.objectToPath = function ( obj ) { - - var path = this.getPathForFolder( obj.r ); - path.status = obj.s; - path.content = {}; - path.treeOpen = obj.o; - for ( idx in obj.c ) { - var href = obj.c[idx]; - path.content[href] = this.getPathForFolder( href ); - }; - return path; - }; - - - this.getPathForFolder = function ( folder ) { - - return this.getCachedPath( new Path( this, folder ) ); - }; - - - this.getPathForTableRow = function ( parentFolder, tableRow ) { - - return this.getCachedPath( new Path( this, parentFolder, tableRow ) ); - }; - - - this.getCachedPath = function ( path ) { - - if ( path.isParentFolder ) { - return path; - }; - - var cachedPath = this.cache[path.absHref]; - if ( cachedPath !== undefined ) { - return cachedPath; - }; - - this.cache[path.absHref] = path; - this.storeCache(); - return path; - }; - - this.cache = this.loadCache(); - -}; - - - -var Path = function ( pathCache, folder, tableRow ) { - - if ( ! /\/$/.test( folder ) ) { - folder += "/"; - }; - - if ( tableRow !== undefined ) { - var $tds = $( tableRow ).find( "td" ); - var $img = $tds.eq( 0 ).find( "img" ); - var $a= $tds.eq( 1 ).find( "a" ); - - this.parentFolder = folder; - this.icon16 = $img.attr( "src" ); - this.alt = $img.attr( "alt" ); - this.label = $a.text(); - this.href = decodeURI( $a.attr("href") ); - this.date = $tds.eq( 2 ).text(); - this.size = $tds.eq( 3 ).text(); - } else { - var splits = pathCache.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 + "/"; - }; - }; - - if ( /\/$/.test( this.label ) ) { - this.label = this.label.slice( 0, -1 ); - }; - - 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.isCurrentFolder = ( this.absHref === decodeURI( document.location.pathname ) ); - this.isDomain = ( this.absHref === "/" ); - - if ( this.isParentFolder && h5ai.config.setParentFolderLabels ) { - if ( this.isDomain ) { - this.label = decodeURI( document.domain ); - } else { - this.label = pathCache.splitPathname( pathCache.splitPathname( this.parentFolder )[0] )[1].slice( 0, -1 ); - }; - }; - - this.status = undefined; // undefined, "h5ai" or HTTP response code - this.content = undefined; // associative array path.absHref -> 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 = $( "<li class='crumb' />" ).data( "path", this ); - - try { - $html.addClass( this.isFolder ? "folder" : "file" ); - var $a = $( "<a href='" + this.absHref + "'><img src='/h5ai/images/crumb.png' alt='>' />" + this.label + "</a>" ); - $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 ) { - $( "<img class='hint' src='/h5ai/images/page.png' alt='not listable' />" ).appendTo( $a ); - } else { - $( "<span class='hint'>(" + this.status + ")</span>" ).appendTo( $a ); - }; - }; - } catch( err ) { - console.log( "updateCrumbHtml failed", err ); - $( "<span class='fail'>failed</span>" ).appendTo( $html ); - }; - - if ( this.html.$crumb !== undefined ) { - this.html.$crumb.replaceWith( $html ); - }; - this.html.$crumb = $html; - - return $html; - }; - - - this.updateExtendedHtml = function () { - - var $html = $( "<li class='entry' />" ).data( "path", this ); - - try { - $html.addClass( this.isFolder ? "folder" : "file" ); - var $a = $( "<a href='" + this.href + "' />" ).appendTo( $html ); - $a.click( $.proxy( function() { this.onClick( "extended" ); }, this ) ); - $a.hover( $.proxy( function() { this.onHoverIn( "extended" ); }, this ), $.proxy( function() { this.onHoverOut( "extended" ); }, this ) ); - - $( "<span class='icon small'><img src='" + this.icon16 + "' alt='" + this.alt + "' /></span>" ).appendTo( $a ); - $( "<span class='icon big'><img src='" + this.icon48 + "' alt='" + this.alt + "' /></span>" ).appendTo( $a ); - var $label = $( "<span class='label'>" + this.label + "</span>" ).appendTo( $a ); - $( "<span class='date'>" + this.date + "</span>" ).appendTo( $a ); - $( "<span class='size'>" + this.size + "</span>" ).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( $( "<span class='hint'> " + this.status + " </span>" ) ); - }; - }; - } catch( err ) { - console.log( "updateExtendedHtml failed", err ); - $( "<span class='fail'>failed</span>" ).appendTo( $html ); - }; - - if ( this.html.$extended !== undefined ) { - this.html.$extended.replaceWith( $html ); - }; - this.html.$extended = $html; - - return $html; - }; - - - this.updateTreeHtml = function () { - - var $html = $( "<div class='entry' />" ).data( "path", this ); - var $blank = $( "<span class='blank' />" ).appendTo( $html ); - - try { - $html.addClass( this.isFolder ? "folder" : "file" ); - var $a = $( "<a href='" + this.absHref + "' />" ) - .appendTo( $html ) - .append( $( "<span class='icon'><img src='" + this.icon16 + "' /></span>" ) ) - .append( $( "<span class='label'>" + this.label + "</span>" ) ); - $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 = $( "<span class='indicator'><img src='/h5ai/images/tree.png' /></span>" ); - 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 = $( "<ul class='content' />" ).appendTo( $html ); - for ( idx in this.content ) { - $( "<li />" ).append( this.content[idx].updateTreeHtml() ).appendTo( $ul ); - }; - if ( this.status === undefined || !this.treeOpen ) { - $ul.hide(); - }; - }; - - // reflect folder status - if ( !isNaN( this.status ) ) { - if ( this.status === 200 ) { - $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 { - $html.addClass( "error" ); - $a.append( $( "<span class='hint'>" + this.status + "</span>" ) ); - }; - }; - }; - } catch( err ) { - console.log( "updateTreeHtml failed", err ); - $( "<span class='fail'>failed</span>" ).appendTo( $html ); - }; - - if ( this.html.$tree !== undefined ) { - this.html.$tree.replaceWith( $html ); - }; - this.html.$tree = $html; - - return $html; - }; -}; - -var H5ai = function ( options, langs, pathCache ) { - - - /******************************* - * config - *******************************/ - - var defaults = { - defaultSortOrder: "C=N;O=A", - store: { - viewmode: "h5ai.viewmode" - }, - customHeader: "h5ai.header.html", - customFooter: "h5ai.footer.html", - callbacks: { - pathClick: [] - }, - - viewmodes: [ "details", "icons" ], - showTree: false, - folderStatus: { - }, - lang: undefined, - useBrowserLang: true, - setParentFolderLabels: true, - linkHoverStates: true - }; - this.config = $.extend( {}, defaults, options ); - - - - /******************************* - * public api - *******************************/ - - this.pathClick = function ( fn ) { - - if ( $.isFunction( fn ) ) { - this.config.callbacks.pathClick.push( fn ); - }; - return this; - }; - - - - /******************************* - * init - *******************************/ - - this.init = function () { - - document.title = document.domain + decodeURI( document.location.pathname ); - - this.applyViewmode(); - this.initBreadcrumb(); - this.initTopSpace(); - this.initViews(); - this.customize(); - this.localize( langs, this.config.lang, this.config.useBrowserLang ); - }; - - - - /******************************* - * callback triggers - *******************************/ - - this.triggerPathClick = function ( path, context ) { - - for ( idx in this.config.callbacks.pathClick ) { - this.config.callbacks.pathClick[idx].call( window, path, context ); - }; - }; - - - - /******************************* - * local stored viewmode - *******************************/ - - this.getViewmode = function () { - - var viewmode = localStorage.getItem( this.config.store.viewmode ); - return $.inArray( viewmode, this.config.viewmodes ) >= 0 ? viewmode : this.config.viewmodes[0]; - }; - - - this.applyViewmode = function ( viewmode ) { - - if ( viewmode !== undefined ) { - localStorage.setItem( this.config.store.viewmode, viewmode ); - }; - viewmode = this.getViewmode(); - - $( "body > nav li.view" ).hide().removeClass( "current" ); - - if ( this.config.viewmodes.length > 1 ) { - if ( $.inArray( "details", this.config.viewmodes ) >= 0 ) { - $( "#viewdetails" ).show(); - }; - if ( $.inArray( "icons", this.config.viewmodes ) >= 0 ) { - $( "#viewicons" ).show(); - }; - }; - - if ( viewmode === "details" ) { - $( "#viewdetails" ).closest( "li" ).addClass( "current" ); - $( "#table" ).hide(); - $( "#extended" ).addClass( "details-view" ).removeClass( "icons-view" ).show(); - } else if ( viewmode === "icons" ) { - $( "#viewicons" ).closest( "li" ).addClass( "current" ); - $( "#table" ).hide(); - $( "#extended" ).removeClass( "details-view" ).addClass( "icons-view" ).show(); - } else { - $( "#table" ).show(); - $( "#extended" ).hide(); - }; - }; - - - - /******************************* - * breadcrumb - *******************************/ - - this.initBreadcrumb = function () { - - var $ul = $( "body > nav ul" ); - - var pathname = "/"; - var path = pathCache.getPathForFolder( pathname ); - $ul.append( path.updateCrumbHtml() ); - - var pathnameParts = decodeURI( document.location.pathname ).split( "/" ); - for ( idx in pathnameParts ) { - var part = pathnameParts[idx]; - if ( part !== "" ) { - pathname += part + "/"; - var path = pathCache.getPathForFolder( pathname ); - $ul.append( path.updateCrumbHtml() ); - }; - }; - }; - - - - /******************************* - * top space, depending on nav height - *******************************/ - - this.initTopSpace = function () { - - function adjustTopSpace() { - - var winHeight = $( window ).height(); - var navHeight = $( "body > nav" ).outerHeight(); - var footerHeight = $( "body > footer" ).outerHeight(); - var contentSpacing = 50; - var treeSpacing = 50; - - $( "body" ) - .css( "margin-top", "" + ( navHeight + contentSpacing ) + "px" ) - .css( "margin-bottom", "" + ( footerHeight + contentSpacing ) + "px" ); - - $( "#tree" ) - .css( "top", "" + ( navHeight + treeSpacing ) + "px" ) - .css( "max-height", "" + ( winHeight - navHeight - footerHeight - 36 - 2 * treeSpacing ) + "px" ); - }; - - $( window ).resize( function () { - adjustTopSpace(); - } ); - adjustTopSpace(); - }; - - - - /******************************* - * table view - *******************************/ - - this.initTableView = function () { - - $( "#table td" ).removeAttr( "align" ).removeAttr( "valign" ); - }; - - - - /******************************* - * extended view - *******************************/ - - this.initExtendedView = function () { - - var $ul = $( "<ul/>" ); - - // headers - var $ths = $( "#table th" ); - var $label = $ths.eq( 1 ).find( "a" ); - var $date = $ths.eq( 2 ).find( "a" ); - var $size = $ths.eq( 3 ).find( "a" ); - var $li = $( "<li class='header' />" ).appendTo( $ul ); - $( "<a class='icon'></a>" ).appendTo( $li ); - $( "<a class='label' href='" + $label.attr( "href" ) + "'><span class='l10n-columnName'>" + $label.text() + "</span></a>" ).appendTo( $li ); - $( "<a class='date' href='" + $date.attr( "href" ) + "'><span class='l10n-columnLastModified'>" + $date.text() + "</span></a>" ).appendTo( $li ); - $( "<a class='size' href='" + $size.attr( "href" ) + "'><span class='l10n-columnSize'>" + $size.text() + "</span></a>" ).appendTo( $li ); - - // header sort icons - var order = document.location.search; - if ( order === "" ) { - order = this.config.defaultSortOrder; - }; - var $icon; - if ( order.indexOf( "O=A" ) >= 0 ) { - $icon = $( "<img src='/h5ai/images/ascending.png' class='sort' alt='ascending' />" ); - } else { - $icon = $( "<img src='/h5ai/images/descending.png' class='sort' alt='descending' />" ); - }; - if ( order.indexOf( "C=N" ) >= 0 ) { - $li.find( "a.label" ).append( $icon ); - } else if ( order.indexOf( "C=M" ) >= 0 ) { - $li.find( "a.date" ).prepend( $icon ); - } else if ( order.indexOf( "C=S" ) >= 0 ) { - $li.find( "a.size" ).prepend( $icon ); - }; - - // entries - $( "#table td" ).closest( "tr" ).each( function () { - var path = pathCache.getPathForTableRow( decodeURI( document.location.pathname ), this ); - $ul.append( path.updateExtendedHtml() ); - } ); - - $( "#extended" ).append( $ul ); - - // empty - if ( $ul.children( ".entry:not(.parentfolder)" ).size() === 0 ) { - $( "#extended" ).append( $( "<div class='empty'>empty</div>" ) ); - }; - - // in case of floats - $( "#extended" ).addClass( "clearfix" ); - }; - - - - /******************************* - * init views - *******************************/ - - this.initViews = function () { - - this.initTableView(); - this.initExtendedView(); - - $( "#viewdetails" ).closest( "li" ) - .click( $.proxy( function () { - this.applyViewmode( "details" ); - }, this ) ); - $( "#viewicons" ).closest( "li" ) - .click( $.proxy( function () { - this.applyViewmode( "icons" ); - }, this ) ); - }; - - - - /******************************* - * customize - *******************************/ - - this.customize = function () { - - $.ajax( { - url: this.config.customHeader, - dataType: "html", - success: function ( data ) { - $( "#content > header" ).append( $( data ) ).show(); - } - } ); - - $.ajax( { - url: this.config.customFooter, - dataType: "html", - success: function ( data ) { - $( "#content > footer" ).prepend( $( data ) ).show(); - } - } ); - }; - - - - /******************************* - * 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] ); - }; - }; - }; -}; - -var Tree = function ( pathCache, h5ai ) { - - var THIS = this; - var contentTypeRegEx = /^text\/html;h5ai=/; - - this.init = function () { - - if ( h5ai.config.showTree ) { - this.updatePaths(); - this.populateTree(); - }; - }; - - - this.updatePath = function ( path ) { - - if ( path.isFolder && !path.isParentFolder && path.status === undefined ) { - this.fetchStatus( path.absHref, function ( status ) { - if ( status !== "h5ai" ) { - path.status = status; - }; - path.updateHtml(); - } ); - }; - }; - - - this.updatePaths = function () { - - for ( var ref in pathCache.cache ) { - this.updatePath( pathCache.cache[ref] ); - }; - }; - - - this.populateTree = function () { - - var $tree = $( "#tree" ); - var $extended = $( "#extended" ); - var shiftTree = function ( show ) { - if ( $tree.outerWidth() < $extended.offset().left || show === true ) { - $tree.stop().animate( { left: 0 } ); - } else { - $tree.stop().animate( { left: 18 - $tree.outerWidth() } ); - }; - }; - - $tree.hover( function () { shiftTree( true ); }, function () { shiftTree(); } ); - $( window ).resize( function() { - shiftTree(); - } ); - - this.fetchTree( decodeURI( document.location.pathname ), function( path ) { - $tree.append( path.updateTreeHtml() ).show(); - shiftTree(); - } ); - }; - - - this.fetchTree = function ( pathname, callback, childPath ) { - - this.fetchPath( pathname, $.proxy( function ( path ) { - - path.treeOpen = true; - - if ( childPath !== undefined ) { - path.content[ childPath.absHref ] = childPath; - }; - - var parent = pathCache.splitPathname( pathname )[0]; - if ( parent === "" ) { - callback( path ); - } else { - this.fetchTree( parent, callback, path ); - }; - }, this ) ); - }; - - - this.fetchPath = function ( pathname, callback ) { - - this.fetchStatusAndContent( pathname, false, function ( status, content ) { - var path = pathCache.getPathForFolder( pathname ); - path.status = status; - path.content = content; - callback( path ); - } ); - }; - - - this.fetchStatusAndContent = function ( pathname, includeParent, callback ) { - - this.fetchStatus( pathname, function ( status ) { - - if ( status !== "h5ai" ) { - callback( status, {} ); - 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 content = {}; - $( html ).find( "#table td" ).closest( "tr" ).each( function () { - var path = pathCache.getPathForTableRow( pathname, this ); - if ( path.isFolder && ( !path.isParentFolder || includeParent ) ) { - content[path.absHref] = path; - THIS.updatePath( path ); - }; - } ); - callback( "h5ai", content ); - } - } ); - } ); - }; - - - var pathnameStatusCache = {}; - - this.fetchStatus = function ( pathname, callback ) { - - if ( h5ai.config.folderStatus[ pathname ] !== undefined ) { - callback( h5ai.config.folderStatus[ pathname ] ); - return; - } else if ( pathnameStatusCache[ pathname ] !== undefined ) { - callback( pathnameStatusCache[ pathname ] ); - return; - }; - - $.ajax( { - url: pathname, - type: "HEAD", - complete: function ( xhr ) { - var status = xhr.status; - if ( status === 200 && contentTypeRegEx.test( xhr.getResponseHeader( "Content-Type" ) ) ) { - status = "h5ai"; - }; - pathnameStatusCache[ pathname ] = status; - callback( status ); - } - } ); - }; -}; - - - /******************************* - * create - *******************************/ - - var pathCache = new PathCache(); - var h5ai = new H5ai( h5aiOptions, h5aiLangs, pathCache ); - var tree = new Tree( pathCache, h5ai ); - - - /******************************* - * register public api - *******************************/ - - $.h5ai = { - click: $.proxy( h5ai.pathClick, h5ai ) - }; - - $( ".l10n-footerUsing" ).click( function () { - console.log( "clean" ); - pathCache.cache = {}; - console.log( "store" ); - pathCache.storeCache(); - console.log( "load", pathCache.loadCache() ); - } ); - - - /******************************* - * init after dom load - *******************************/ - - $( function() { - h5ai.init(); - tree.init(); - } ); - -} )( jQuery ); \ No newline at end of file +(function($){(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<o.length;i++){ret.push($.toJSON(o[i])||"null")}return"["+ret.join(",")+"]"}var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number"){name='"'+k+'"'}else{if(type=="string"){name=$.quoteString(k)}else{continue}}if(typeof o[k]=="function"){continue}var val=$.toJSON(o[k]);pairs.push(name+":"+val)}return"{"+pairs.join(", ")+"}"}};$.evalJSON=function(src){if(typeof(JSON)=="object"&&JSON.parse){return JSON.parse(src)}return eval("("+src+")")};$.secureEvalJSON=function(src){if(typeof(JSON)=="object"&&JSON.parse){return JSON.parse(src)}var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,"@");filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(filtered)){return eval("("+src+")")}else{throw new SyntaxError("Error parsing JSON, source is not valid.")}};$.quoteString=function(string){if(string.match(_escapeable)){return'"'+string.replace(_escapeable,function(a){var c=_meta[a];if(typeof c==="string"){return c}c=a.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+string+'"'};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}})(jQuery);var PathCache=function(){var pathnameRegEx=/^(\/(.*\/)*)([^\/]+\/?)$/;this.splitPathname=function(pathname){if(pathname==="/"){return["","/"]}var match=pathnameRegEx.exec(pathname);return[match[1],match[3]]};this.cache={};this.loadCache=function(){var json=localStorage.getItem("h5ai.cache");var objs=$.evalJSON(json);var cache={};for(idx in objs){var obj=objs[idx];var path=this.objectToPath(obj);cache[path.absHref]=path}console.log("loaded: ",cache);return cache};this.storeCache=function(){var objs=[];for(ref in this.cache){var path=this.cache[ref];if(path.isFolder){objs.push(this.pathToObject(path))}}var json=$.toJSON(objs);localStorage.setItem("h5ai.cache",json)};this.pathToObject=function(path){var object={r:path.absHref,s:path.status,c:[],o:path.treeOpen};if(path.content!==undefined){for(ref in path.content){object.c.push(ref)}}return object};this.objectToPath=function(obj){var path=this.getPathForFolder(obj.r);path.status=obj.s;path.content={};path.treeOpen=obj.o;for(idx in obj.c){var href=obj.c[idx];path.content[href]=this.getPathForFolder(href)}return path};this.getPathForFolder=function(folder){return this.getCachedPath(new Path(this,folder))};this.getPathForTableRow=function(parentFolder,tableRow){return this.getCachedPath(new Path(this,parentFolder,tableRow))};this.getCachedPath=function(path){if(path.isParentFolder){return path}var cachedPath=this.cache[path.absHref];if(cachedPath!==undefined){return cachedPath}this.cache[path.absHref]=path;this.storeCache();return path};this.cache=this.loadCache()};var Path=function(pathCache,folder,tableRow){if(!/\/$/.test(folder)){folder+="/"}if(tableRow!==undefined){var $tds=$(tableRow).find("td");var $img=$tds.eq(0).find("img");var $a=$tds.eq(1).find("a");this.parentFolder=folder;this.icon16=$img.attr("src");this.alt=$img.attr("alt");this.label=$a.text();this.href=decodeURI($a.attr("href"));this.date=$tds.eq(2).text();this.size=$tds.eq(3).text()}else{var splits=pathCache.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+"/"}}if(/\/$/.test(this.label)){this.label=this.label.slice(0,-1)}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.isCurrentFolder=(this.absHref===decodeURI(document.location.pathname));this.isDomain=(this.absHref==="/");if(this.isParentFolder&&h5ai.config.setParentFolderLabels){if(this.isDomain){this.label=decodeURI(document.domain)}else{this.label=pathCache.splitPathname(pathCache.splitPathname(this.parentFolder)[0])[1].slice(0,-1)}}this.status=undefined;this.content=undefined;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=$("<li class='crumb' />").data("path",this);try{$html.addClass(this.isFolder?"folder":"file");var $a=$("<a href='"+this.absHref+"'><img src='/h5ai/images/crumb.png' alt='>' />"+this.label+"</a>");$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){$("<img class='hint' src='/h5ai/images/page.png' alt='not listable' />").appendTo($a)}else{$("<span class='hint'>("+this.status+")</span>").appendTo($a)}}}catch(err){console.log("updateCrumbHtml failed",err);$("<span class='fail'>failed</span>").appendTo($html)}if(this.html.$crumb!==undefined){this.html.$crumb.replaceWith($html)}this.html.$crumb=$html;return $html};this.updateExtendedHtml=function(){var $html=$("<li class='entry' />").data("path",this);try{$html.addClass(this.isFolder?"folder":"file");var $a=$("<a href='"+this.href+"' />").appendTo($html);$a.click($.proxy(function(){this.onClick("extended")},this));$a.hover($.proxy(function(){this.onHoverIn("extended")},this),$.proxy(function(){this.onHoverOut("extended")},this));$("<span class='icon small'><img src='"+this.icon16+"' alt='"+this.alt+"' /></span>").appendTo($a);$("<span class='icon big'><img src='"+this.icon48+"' alt='"+this.alt+"' /></span>").appendTo($a);var $label=$("<span class='label'>"+this.label+"</span>").appendTo($a);$("<span class='date'>"+this.date+"</span>").appendTo($a);$("<span class='size'>"+this.size+"</span>").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($("<span class='hint'> "+this.status+" </span>"))}}}catch(err){console.log("updateExtendedHtml failed",err);$("<span class='fail'>failed</span>").appendTo($html)}if(this.html.$extended!==undefined){this.html.$extended.replaceWith($html)}this.html.$extended=$html;return $html};this.updateTreeHtml=function(){var $html=$("<div class='entry' />").data("path",this);var $blank=$("<span class='blank' />").appendTo($html);try{$html.addClass(this.isFolder?"folder":"file");var $a=$("<a href='"+this.absHref+"' />").appendTo($html).append($("<span class='icon'><img src='"+this.icon16+"' /></span>")).append($("<span class='label'>"+this.label+"</span>"));$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){if(this.status===undefined||!this.isEmpty()){var $indicator=$("<span class='indicator'><img src='/h5ai/images/tree.png' /></span>");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)}if(this.isDomain){$html.addClass("domain");$a.find(".icon img").attr("src","/h5ai/icons/16x16/folder-home.png")}if(this.isCurrentFolder){$html.addClass("current");$a.find(".icon img").attr("src","/h5ai/icons/16x16/folder-open.png")}if(!this.isEmpty()){var $ul=$("<ul class='content' />").appendTo($html);for(idx in this.content){$("<li />").append(this.content[idx].updateTreeHtml()).appendTo($ul)}if(this.status===undefined||!this.treeOpen){$ul.hide()}}if(!isNaN(this.status)){if(this.status===200){$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{$html.addClass("error");$a.append($("<span class='hint'>"+this.status+"</span>"))}}}}catch(err){console.log("updateTreeHtml failed",err);$("<span class='fail'>failed</span>").appendTo($html)}if(this.html.$tree!==undefined){this.html.$tree.replaceWith($html)}this.html.$tree=$html;return $html}};var H5ai=function(options,langs,pathCache){var defaults={defaultSortOrder:"C=N;O=A",store:{viewmode:"h5ai.viewmode"},customHeader:"h5ai.header.html",customFooter:"h5ai.footer.html",callbacks:{pathClick:[]},viewmodes:["details","icons"],showTree:false,folderStatus:{},lang:undefined,useBrowserLang:true,setParentFolderLabels:true,linkHoverStates:true};this.config=$.extend({},defaults,options);this.pathClick=function(fn){if($.isFunction(fn)){this.config.callbacks.pathClick.push(fn)}return this};this.init=function(){document.title=document.domain+decodeURI(document.location.pathname);this.applyViewmode();this.initBreadcrumb();this.initTopSpace();this.initViews();this.customize();this.localize(langs,this.config.lang,this.config.useBrowserLang)};this.triggerPathClick=function(path,context){for(idx in this.config.callbacks.pathClick){this.config.callbacks.pathClick[idx].call(window,path,context)}};this.getViewmode=function(){var viewmode=localStorage.getItem(this.config.store.viewmode);return $.inArray(viewmode,this.config.viewmodes)>=0?viewmode:this.config.viewmodes[0]};this.applyViewmode=function(viewmode){if(viewmode!==undefined){localStorage.setItem(this.config.store.viewmode,viewmode)}viewmode=this.getViewmode();$("body > nav li.view").hide().removeClass("current");if(this.config.viewmodes.length>1){if($.inArray("details",this.config.viewmodes)>=0){$("#viewdetails").show()}if($.inArray("icons",this.config.viewmodes)>=0){$("#viewicons").show()}}if(viewmode==="details"){$("#viewdetails").closest("li").addClass("current");$("#table").hide();$("#extended").addClass("details-view").removeClass("icons-view").show()}else{if(viewmode==="icons"){$("#viewicons").closest("li").addClass("current");$("#table").hide();$("#extended").removeClass("details-view").addClass("icons-view").show()}else{$("#table").show();$("#extended").hide()}}};this.initBreadcrumb=function(){var $ul=$("body > nav ul");var pathname="/";var path=pathCache.getPathForFolder(pathname);$ul.append(path.updateCrumbHtml());var pathnameParts=decodeURI(document.location.pathname).split("/");for(idx in pathnameParts){var part=pathnameParts[idx];if(part!==""){pathname+=part+"/";var path=pathCache.getPathForFolder(pathname);$ul.append(path.updateCrumbHtml())}}};this.initTopSpace=function(){function adjustTopSpace(){var winHeight=$(window).height();var navHeight=$("body > nav").outerHeight();var footerHeight=$("body > footer").outerHeight();var contentSpacing=50;var treeSpacing=50;$("body").css("margin-top",""+(navHeight+contentSpacing)+"px").css("margin-bottom",""+(footerHeight+contentSpacing)+"px");$("#tree").css("top",""+(navHeight+treeSpacing)+"px").css("max-height",""+(winHeight-navHeight-footerHeight-36-2*treeSpacing)+"px")}$(window).resize(function(){adjustTopSpace()});adjustTopSpace()};this.initTableView=function(){$("#table td").removeAttr("align").removeAttr("valign")};this.initExtendedView=function(){var $ul=$("<ul/>");var $ths=$("#table th");var $label=$ths.eq(1).find("a");var $date=$ths.eq(2).find("a");var $size=$ths.eq(3).find("a");var $li=$("<li class='header' />").appendTo($ul);$("<a class='icon'></a>").appendTo($li);$("<a class='label' href='"+$label.attr("href")+"'><span class='l10n-columnName'>"+$label.text()+"</span></a>").appendTo($li);$("<a class='date' href='"+$date.attr("href")+"'><span class='l10n-columnLastModified'>"+$date.text()+"</span></a>").appendTo($li);$("<a class='size' href='"+$size.attr("href")+"'><span class='l10n-columnSize'>"+$size.text()+"</span></a>").appendTo($li);var order=document.location.search;if(order===""){order=this.config.defaultSortOrder}var $icon;if(order.indexOf("O=A")>=0){$icon=$("<img src='/h5ai/images/ascending.png' class='sort' alt='ascending' />")}else{$icon=$("<img src='/h5ai/images/descending.png' class='sort' alt='descending' />")}if(order.indexOf("C=N")>=0){$li.find("a.label").append($icon)}else{if(order.indexOf("C=M")>=0){$li.find("a.date").prepend($icon)}else{if(order.indexOf("C=S")>=0){$li.find("a.size").prepend($icon)}}}$("#table td").closest("tr").each(function(){var path=pathCache.getPathForTableRow(decodeURI(document.location.pathname),this);$ul.append(path.updateExtendedHtml())});$("#extended").append($ul);if($ul.children(".entry:not(.parentfolder)").size()===0){$("#extended").append($("<div class='empty'>empty</div>"))}$("#extended").addClass("clearfix")};this.initViews=function(){this.initTableView();this.initExtendedView();$("#viewdetails").closest("li").click($.proxy(function(){this.applyViewmode("details")},this));$("#viewicons").closest("li").click($.proxy(function(){this.applyViewmode("icons")},this))};this.customize=function(){$.ajax({url:this.config.customHeader,dataType:"html",success:function(data){$("#content > header").append($(data)).show()}});$.ajax({url:this.config.customFooter,dataType:"html",success:function(data){$("#content > footer").prepend($(data)).show()}})};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])}}}};var Tree=function(pathCache,h5ai){var THIS=this;var contentTypeRegEx=/^text\/html;h5ai=/;this.init=function(){if(h5ai.config.showTree){this.updatePaths();this.populateTree()}};this.updatePath=function(path){if(path.isFolder&&!path.isParentFolder&&path.status===undefined){this.fetchStatus(path.absHref,function(status){if(status!=="h5ai"){path.status=status}path.updateHtml()})}};this.updatePaths=function(){for(var ref in pathCache.cache){this.updatePath(pathCache.cache[ref])}};this.populateTree=function(){var $tree=$("#tree");var $extended=$("#extended");var shiftTree=function(show){if($tree.outerWidth()<$extended.offset().left||show===true){$tree.stop().animate({left:0})}else{$tree.stop().animate({left:18-$tree.outerWidth()})}};$tree.hover(function(){shiftTree(true)},function(){shiftTree()});$(window).resize(function(){shiftTree()});this.fetchTree(decodeURI(document.location.pathname),function(path){$tree.append(path.updateTreeHtml()).show();shiftTree()})};this.fetchTree=function(pathname,callback,childPath){this.fetchPath(pathname,$.proxy(function(path){path.treeOpen=true;if(childPath!==undefined){path.content[childPath.absHref]=childPath}var parent=pathCache.splitPathname(pathname)[0];if(parent===""){callback(path)}else{this.fetchTree(parent,callback,path)}},this))};this.fetchPath=function(pathname,callback){this.fetchStatusAndContent(pathname,false,function(status,content){var path=pathCache.getPathForFolder(pathname);path.status=status;path.content=content;callback(path)})};this.fetchStatusAndContent=function(pathname,includeParent,callback){this.fetchStatus(pathname,function(status){if(status!=="h5ai"){callback(status,{});return}$.ajax({url:pathname,type:"GET",dataType:"html",error:function(xhr){callback(xhr.status,{})},success:function(html,status,xhr){if(!contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))){callback(xhr.status,{});return}var content={};$(html).find("#table td").closest("tr").each(function(){var path=pathCache.getPathForTableRow(pathname,this);if(path.isFolder&&(!path.isParentFolder||includeParent)){content[path.absHref]=path;THIS.updatePath(path)}});callback("h5ai",content)}})})};var pathnameStatusCache={};this.fetchStatus=function(pathname,callback){if(h5ai.config.folderStatus[pathname]!==undefined){callback(h5ai.config.folderStatus[pathname]);return}else{if(pathnameStatusCache[pathname]!==undefined){callback(pathnameStatusCache[pathname]);return}}$.ajax({url:pathname,type:"HEAD",complete:function(xhr){var status=xhr.status;if(status===200&&contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))){status="h5ai"}pathnameStatusCache[pathname]=status;callback(status)}})}};var pathCache=new PathCache();var h5ai=new H5ai(h5aiOptions,h5aiLangs,pathCache);var tree=new Tree(pathCache,h5ai);$.h5ai={click:$.proxy(h5ai.pathClick,h5ai)};$(".l10n-footerUsing").click(function(){console.log("clean");pathCache.cache={};console.log("store");pathCache.storeCache();console.log("load",pathCache.loadCache())});$(function(){h5ai.init();tree.init()})})(jQuery); \ No newline at end of file diff --git a/target/h5ai/options.js b/target/h5ai/options.js index 9182f4b0..12164aa9 100644 --- a/target/h5ai/options.js +++ b/target/h5ai/options.js @@ -101,6 +101,26 @@ h5aiLangs = { columnSize: "Taille", footerUsing: "utilise", parentDirectory: "Dossier parent" + }, + + "nl": { + viewDetails: "details", + viewIcons: "iconen", + columnName: "Naam", + columnLastModified: "Laatste wijziging", + columnSize: "Grootte", + footerUsing: "gebruikt", + parentDirectory: "Bovenliggende map" + }, + + "sv": { + viewDetails: "detaljerad", + viewIcons: "ikoner", + columnName: "Filnamn", + columnLastModified: "Senast ändrad", + columnSize: "Filstorlek", + footerUsing: "använder", + parentDirectory: "Till överordnad mapp" } };