ceffileschemedir.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function addRow(name, url, isdir, size, date_modified) {
  6. if (name == ".")
  7. return;
  8. var root = "" + document.location;
  9. if (root.substr(-1) !== "/")
  10. root += "/";
  11. var table = document.getElementById("table");
  12. var row = document.createElement("tr");
  13. var file_cell = document.createElement("td");
  14. var link = document.createElement("a");
  15. link.className = isdir ? "icon dir" : "icon file";
  16. if (name == "..") {
  17. link.href = root + "..";
  18. link.innerText = document.getElementById("parentDirText").innerText;
  19. link.className = "icon up";
  20. size = "";
  21. date_modified = "";
  22. } else {
  23. if (isdir) {
  24. name = name + "/";
  25. url = url + "/";
  26. size = "";
  27. }
  28. link.innerText = name;
  29. link.href = root + url;
  30. }
  31. file_cell.appendChild(link);
  32. row.appendChild(file_cell);
  33. row.appendChild(createCell(size));
  34. row.appendChild(createCell(date_modified));
  35. table.appendChild(row);
  36. }
  37. function createCell(text) {
  38. var cell = document.createElement("td");
  39. cell.setAttribute("class", "detailsColumn");
  40. cell.innerText = text;
  41. return cell;
  42. }
  43. function start(location) {
  44. var header = document.getElementById("header");
  45. header.innerText = header.innerText.replace("LOCATION", location);
  46. document.getElementById("title").innerText = header.innerText;
  47. }
  48. </script>
  49. <style>
  50. h1 {
  51. border-bottom: 1px solid #c0c0c0;
  52. margin-bottom: 10px;
  53. padding-bottom: 10px;
  54. white-space: nowrap;
  55. }
  56. table {
  57. border-collapse: collapse;
  58. }
  59. tr.header {
  60. font-weight: bold;
  61. }
  62. td.detailsColumn {
  63. padding-left: 2em;
  64. text-align: right;
  65. white-space: nowrap;
  66. }
  67. a.icon {
  68. padding-left: 1.5em;
  69. text-decoration: none;
  70. }
  71. a.icon:hover {
  72. text-decoration: underline;
  73. }
  74. a.file {
  75. background : url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAABHUlEQVR42o2RMW7DIBiF3498iHRJD5JKHurL+CRVBp+i2T16tTynF2gO0KSb5ZrBBl4HHDBuK/WXACH4eO9/CAAAbdvijzLGNE1TVZXfZuHg6XCAQESAZXbOKaXO57eiKG6ft9PrKQIkCQqFoIiQFBGlFIB5nvM8t9aOX2Nd18oDzjnPgCDpn/BH4zh2XZdlWVmWiUK4IgCBoFMUz9eP6zRN75cLgEQhcmTQIbl72O0f9865qLAAsURAAgKBJKEtgLXWvyjLuFsThCSstb8rBCaAQhDYWgIZ7myM+TUBjDHrHlZcbMYYk34cN0YSLcgS+wL0fe9TXDMbY33fR2AYBvyQ8L0Gk8MwREBrTfKe4TpTzwhArXWi8HI84h/1DfwI5mhxJamFAAAAAElFTkSuQmCC ") left top no-repeat;
  76. }
  77. a.dir {
  78. background : url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAd5JREFUeNqMU79rFUEQ/vbuodFEEkzAImBpkUabFP4ldpaJhZXYm/RiZWsv/hkWFglBUyTIgyAIIfgIRjHv3r39MePM7N3LcbxAFvZ2b2bn22/mm3XMjF+HL3YW7q28YSIw8mBKoBihhhgCsoORot9d3/ywg3YowMXwNde/PzGnk2vn6PitrT+/PGeNaecg4+qNY3D43vy16A5wDDd4Aqg/ngmrjl/GoN0U5V1QquHQG3q+TPDVhVwyBffcmQGJmSVfyZk7R3SngI4JKfwDJ2+05zIg8gbiereTZRHhJ5KCMOwDFLjhoBTn2g0ghagfKeIYJDPFyibJVBtTREwq60SpYvh5++PpwatHsxSm9QRLSQpEVSd7/TYJUb49TX7gztpjjEffnoVw66+Ytovs14Yp7HaKmUXeX9rKUoMoLNW3srqI5fWn8JejrVkK0QcrkFLOgS39yoKUQe292WJ1guUHG8K2o8K00oO1BTvXoW4yasclUTgZYJY9aFNfAThX5CZRmczAV52oAPoupHhWRIUUAOoyUIlYVaAa/VbLbyiZUiyFbjQFNwiZQSGl4IDy9sO5Wrty0QLKhdZPxmgGcDo8ejn+c/6eiK9poz15Kw7Dr/vN/z6W7q++091/AQYA5mZ8GYJ9K0AAAAAASUVORK5CYII= ") left top no-repeat;
  79. }
  80. a.up {
  81. background : url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAmlJREFUeNpsU0toU0EUPfPysx/tTxuDH9SCWhUDooIbd7oRUUTMouqi2iIoCO6lceHWhegy4EJFinWjrlQUpVm0IIoFpVDEIthm0dpikpf3ZuZ6Z94nrXhhMjM3c8895977BBHB2PznK8WPtDgyWH5q77cPH8PpdXuhpQT4ifR9u5sfJb1bmw6VivahATDrxcRZ2njfoaMv+2j7mLDn93MPiNRMvGbL18L9IpF8h9/TN+EYkMffSiOXJ5+hkD+PdqcLpICWHOHc2CC+LEyA/K+cKQMnlQHJX8wqYG3MAJy88Wa4OLDvEqAEOpJd0LxHIMdHBziowSwVlF8D6QaicK01krw/JynwcKoEwZczewroTvZirlKJs5CqQ5CG8pb57FnJUA0LYCXMX5fibd+p8LWDDemcPZbzQyjvH+Ki1TlIciElA7ghwLKV4kRZstt2sANWRjYTAGzuP2hXZFpJ/GsxgGJ0ox1aoFWsDXyyxqCs26+ydmagFN/rRjymJ1898bzGzmQE0HCZpmk5A0RFIv8Pn0WYPsiu6t/Rsj6PauVTwffTSzGAGZhUG2F06hEc9ibS7OPMNp6ErYFlKavo7MkhmTqCxZ/jwzGA9Hx82H2BZSw1NTN9Gx8ycHkajU/7M+jInsDC7DiaEmo1bNl1AMr9ASFgqVu9MCTIzoGUimXVAnnaN0PdBBDCCYbEtMk6wkpQwIG0sn0PQIUF4GsTwLSIFKNqF6DVrQq+IWVrQDxAYQC/1SsYOI4pOxKZrfifiUSbDUisif7XlpGIPufXd/uvdvZm760M0no1FZcnrzUdjw7au3vu/BVgAFLXeuTxhTXVAAAAAElFTkSuQmCC ") left top no-repeat;
  82. }
  83. #listingParsingErrorBox {
  84. border: 1px solid black;
  85. background: #fae691;
  86. padding: 10px;
  87. display: none;
  88. }
  89. </style>
  90. <title id="title"></title>
  91. </head>
  92. <body>
  93. <span id="parentDirText" style="display:none" i18n-content="parentDirText"></span>
  94. <h1 id="header" i18n-content="header"></h1>
  95. <table id="table">
  96. <tr class="header">
  97. <td i18n-content="headerName"></td>
  98. <td class="detailsColumn" i18n-content="headerSize"></td>
  99. <td class="detailsColumn" i18n-content="headerDateModified"></td>
  100. </tr>
  101. </table>
  102. </body>
  103. </html>
  104. <script>var templateData = {"header":"Index of LOCATION","headerDateModified":"Last Modified","headerName":"Name","headerSize":"Size","parentDirText":"[Parent directory]"};</script><script>
  105. // Copyright (c) 2010 The Chromium Authors. All rights reserved.
  106. // Use of this source code is governed by a BSD-style license that can be
  107. // found in the LICENSE file.
  108. /**
  109. * @fileoverview This is a simple template engine inspired by JsTemplates
  110. * optimized for i18n.
  111. *
  112. * It currently supports two handlers:
  113. *
  114. * * i18n-content which sets the textContent of the element
  115. *
  116. * <span i18n-content="myContent"></span>
  117. * i18nTemplate.process(element, {'myContent': 'Content'});
  118. *
  119. * * i18n-values is a list of attribute-value or property-value pairs.
  120. * Properties are prefixed with a '.' and can contain nested properties.
  121. *
  122. * <span i18n-values="title:myTitle;.style.fontSize:fontSize"></span>
  123. * i18nTemplate.process(element, {
  124. * 'myTitle': 'Title',
  125. * 'fontSize': '13px'
  126. * });
  127. */
  128. var i18nTemplate = (function() {
  129. /**
  130. * This provides the handlers for the templating engine. The key is used as
  131. * the attribute name and the value is the function that gets called for every
  132. * single node that has this attribute.
  133. * @type {Object}
  134. */
  135. var handlers = {
  136. /**
  137. * This handler sets the textContent of the element.
  138. */
  139. 'i18n-content': function(element, attributeValue, obj) {
  140. element.textContent = obj[attributeValue];
  141. },
  142. /**
  143. * This handler adds options to a select element.
  144. */
  145. 'i18n-options': function(element, attributeValue, obj) {
  146. var options = obj[attributeValue];
  147. options.forEach(function(values) {
  148. var option = typeof values == 'string' ? new Option(values) :
  149. new Option(values[1], values[0]);
  150. element.appendChild(option);
  151. });
  152. },
  153. /**
  154. * This is used to set HTML attributes and DOM properties,. The syntax is:
  155. * attributename:key;
  156. * .domProperty:key;
  157. * .nested.dom.property:key
  158. */
  159. 'i18n-values': function(element, attributeValue, obj) {
  160. var parts = attributeValue.replace(/\s/g, '').split(/;/);
  161. for (var j = 0; j < parts.length; j++) {
  162. var a = parts[j].match(/^([^:]+):(.+)$/);
  163. if (a) {
  164. var propName = a[1];
  165. var propExpr = a[2];
  166. // Ignore missing properties
  167. if (propExpr in obj) {
  168. var value = obj[propExpr];
  169. if (propName.charAt(0) == '.') {
  170. var path = propName.slice(1).split('.');
  171. var object = element;
  172. while (object && path.length > 1) {
  173. object = object[path.shift()];
  174. }
  175. if (object) {
  176. object[path] = value;
  177. // In case we set innerHTML (ignoring others) we need to
  178. // recursively check the content
  179. if (path == 'innerHTML') {
  180. process(element, obj);
  181. }
  182. }
  183. } else {
  184. element.setAttribute(propName, value);
  185. }
  186. } else {
  187. console.warn('i18n-values: Missing value for "' + propExpr + '"');
  188. }
  189. }
  190. }
  191. }
  192. };
  193. var attributeNames = [];
  194. for (var key in handlers) {
  195. attributeNames.push(key);
  196. }
  197. var selector = '[' + attributeNames.join('],[') + ']';
  198. /**
  199. * Processes a DOM tree with the {@code obj} map.
  200. */
  201. function process(node, obj) {
  202. var elements = node.querySelectorAll(selector);
  203. for (var element, i = 0; element = elements[i]; i++) {
  204. for (var j = 0; j < attributeNames.length; j++) {
  205. var name = attributeNames[j];
  206. var att = element.getAttribute(name);
  207. if (att != null) {
  208. handlers[name](element, att, obj);
  209. }
  210. }
  211. }
  212. }
  213. return {
  214. process: process
  215. };
  216. })();
  217. </script>
  218. <script>i18nTemplate.process(document, templateData);</script>