github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/lib/http/templates/index.html (about) 1 <!-- 2 // Copyright 2015 Matthew Holt and The Caddy Authors 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 Modifications: Adapted to rclone markup --> 16 17 <!DOCTYPE html> 18 <html> 19 <head> 20 <title>{{html .Name}}</title> 21 <meta charset="utf-8"> 22 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 23 <meta name="google" content="notranslate"> 24 <style> 25 * { padding: 0; margin: 0; } 26 body { 27 font-family: sans-serif; 28 text-rendering: optimizespeed; 29 background-color: #ffffff; 30 } 31 a { 32 color: #006ed3; 33 text-decoration: none; 34 } 35 a:hover, 36 h1 a:hover { 37 color: #319cff; 38 } 39 header, 40 #summary { 41 padding-left: 5%; 42 padding-right: 5%; 43 } 44 th:first-child, 45 td:first-child { 46 width: 1%; /* tighter for mobile */ 47 } 48 th:last-child, 49 td:last-child { 50 width: 1%; /* tighter for mobile */ 51 } 52 header { 53 padding-top: 25px; 54 padding-bottom: 15px; 55 background-color: #f2f2f2; 56 } 57 h1 { 58 font-size: 20px; 59 font-weight: normal; 60 white-space: nowrap; 61 overflow-x: hidden; 62 text-overflow: ellipsis; 63 color: #999; 64 } 65 h1 a { 66 color: #000; 67 margin: 0 4px; 68 } 69 h1 a:hover { 70 text-decoration: underline; 71 } 72 h1 a:first-child { 73 margin: 0; 74 } 75 main { 76 display: block; 77 } 78 .meta { 79 font-size: 12px; 80 font-family: Verdana, sans-serif; 81 border-bottom: 1px solid #9C9C9C; 82 padding-top: 10px; 83 padding-bottom: 10px; 84 } 85 .meta-item { 86 margin-right: 1em; 87 } 88 #filter { 89 padding: 4px; 90 border: 1px solid #CCC; 91 } 92 table { 93 width: 100%; 94 border-collapse: collapse; 95 } 96 tr { 97 border-bottom: 1px dashed #dadada; 98 } 99 tbody tr:hover { 100 background-color: #ffffec; 101 } 102 th, 103 td { 104 text-align: left; 105 padding: 10px 2px; /* Changed from 0 to 2 */ 106 } 107 th { 108 padding-top: 10px; 109 padding-bottom: 10px; 110 font-size: 16px; 111 white-space: nowrap; 112 } 113 th a { 114 color: black; 115 } 116 th svg { 117 vertical-align: middle; 118 } 119 td { 120 white-space: nowrap; 121 font-size: 14px; 122 } 123 td:nth-child(2) { 124 width: 80%; 125 } 126 td:nth-child(3) { 127 padding: 0 20px 0 20px; 128 } 129 th:nth-child(4), 130 td:nth-child(4) { 131 text-align: right; 132 } 133 td:nth-child(2) svg { 134 position: absolute; 135 } 136 td .name, 137 td .goup { 138 margin-left: 1.75em; 139 word-break: break-all; 140 overflow-wrap: break-word; 141 white-space: pre-wrap; 142 } 143 .icon { 144 margin-right: 5px; 145 } 146 .icon.sort { 147 display: inline-block; 148 width: 1em; 149 height: 1em; 150 position: relative; 151 top: .2em; 152 } 153 .icon.sort .top { 154 position: absolute; 155 left: 0; 156 top: -1px; 157 } 158 .icon.sort .bottom { 159 position: absolute; 160 bottom: -1px; 161 left: 0; 162 } 163 footer { 164 padding: 40px 20px; 165 font-size: 12px; 166 text-align: center; 167 } 168 @media (max-width: 600px) { 169 /* .hideable { 170 display: none; 171 } removed to keep dates on mobile */ 172 td:nth-child(2) { 173 width: auto; 174 } 175 th:nth-child(3), 176 td:nth-child(3) { 177 padding-right: 5%; 178 text-align: right; 179 } 180 h1 { 181 color: #000; 182 } 183 h1 a { 184 margin: 0; 185 } 186 #filter { 187 max-width: 100px; 188 } 189 } 190 </style> 191 </head> 192 <body onload='filter();toggle("order");changeSize()'> 193 <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="0" width="0" style="position: absolute;"> 194 <defs> 195 <!-- Folder --> 196 <g id="folder" fill-rule="nonzero" fill="none"> 197 <path d="M285.22 37.55h-142.6L110.9 0H31.7C14.25 0 0 16.9 0 37.55v75.1h316.92V75.1c0-20.65-14.26-37.55-31.7-37.55z" fill="#FFA000"/> 198 <path d="M285.22 36H31.7C14.25 36 0 50.28 0 67.74v158.7c0 17.47 14.26 31.75 31.7 31.75H285.2c17.44 0 31.7-14.3 31.7-31.75V67.75c0-17.47-14.26-31.75-31.7-31.75z" fill="#FFCA28"/> 199 </g> 200 <g id="folder-shortcut" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 201 <g id="folder-shortcut-group" fill-rule="nonzero"> 202 <g id="folder-shortcut-shape"> 203 <path d="M285.224876,37.5486902 L142.612438,37.5486902 L110.920785,0 L31.6916529,0 C14.2612438,0 0,16.8969106 0,37.5486902 L0,112.646071 L316.916529,112.646071 L316.916529,75.0973805 C316.916529,54.4456008 302.655285,37.5486902 285.224876,37.5486902 Z" id="Shape" fill="#FFA000"></path> 204 <path d="M285.224876,36 L31.6916529,36 C14.2612438,36 0,50.2838568 0,67.7419039 L0,226.451424 C0,243.909471 14.2612438,258.193328 31.6916529,258.193328 L285.224876,258.193328 C302.655285,258.193328 316.916529,243.909471 316.916529,226.451424 L316.916529,67.7419039 C316.916529,50.2838568 302.655285,36 285.224876,36 Z" id="Shape" fill="#FFCA28"></path> 205 </g> 206 <path d="M126.154134,250.559184 C126.850974,251.883673 127.300549,253.006122 127.772602,254.106122 C128.469442,255.206122 128.919016,256.104082 129.638335,257.002041 C130.559962,258.326531 131.728855,259 133.100057,259 C134.493737,259 135.415364,258.55102 136.112204,257.67551 C136.809044,257.002041 137.258619,255.902041 137.258619,254.577551 C137.258619,253.904082 137.258619,252.804082 137.033832,251.457143 C136.786566,249.908163 136.561779,249.032653 136.561779,248.583673 C136.089726,242.814286 135.864939,237.920408 135.864939,233.273469 C135.864939,225.057143 136.786566,217.514286 138.180246,210.846939 C139.798713,204.202041 141.889234,198.634694 144.429328,193.763265 C147.216689,188.869388 150.678411,184.873469 154.836973,181.326531 C158.995535,177.779592 163.626149,174.883673 168.481552,172.661224 C173.336954,170.438776 179.113983,168.665306 185.587852,167.340816 C192.061722,166.218367 198.760378,165.342857 205.481514,164.669388 C212.18017,164.220408 219.598146,163.995918 228.162535,163.995918 L246.055591,163.995918 L246.055591,195.514286 C246.055591,197.736735 246.752431,199.510204 248.370899,201.059184 C250.214153,202.608163 252.079886,203.506122 254.372715,203.506122 C256.463236,203.506122 258.531277,202.608163 260.172223,201.059184 L326.102289,137.797959 C327.720757,136.24898 328.642384,134.47551 328.642384,132.253061 C328.642384,130.030612 327.720757,128.257143 326.102289,126.708163 L260.172223,63.4469388 C258.553756,61.8979592 256.463236,61 254.395194,61 C252.079886,61 250.236632,61.8979592 248.393377,63.4469388 C246.77491,64.9959184 246.07807,66.7693878 246.07807,68.9918367 L246.07807,100.510204 L228.162535,100.510204 C166.863084,100.510204 129.166282,117.167347 115.274437,150.459184 C110.666301,161.54898 108.350993,175.310204 108.350993,191.742857 C108.350993,205.279592 113.903236,223.912245 124.760454,247.438776 C125.00772,248.112245 125.457294,249.010204 126.154134,250.559184 Z" id="Shape" fill="#FFFFFF" transform="translate(218.496689, 160.000000) scale(-1, 1) translate(-218.496689, -160.000000) "></path> 207 </g> 208 </g> 209 <!-- File --> 210 <g id="file" stroke="#000" stroke-width="25" fill="#FFF" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> 211 <path d="M13 24.12v274.76c0 6.16 5.87 11.12 13.17 11.12H239c7.3 0 13.17-4.96 13.17-11.12V136.15S132.6 13 128.37 13H26.17C18.87 13 13 17.96 13 24.12z"/> 212 <path d="M129.37 13L129 113.9c0 10.58 7.26 19.1 16.27 19.1H249L129.37 13z"/> 213 </g> 214 <g id="file-shortcut" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 215 <g id="file-shortcut-group" transform="translate(13.000000, 13.000000)"> 216 <g id="file-shortcut-shape" stroke="#000000" stroke-width="25" fill="#FFFFFF" stroke-linecap="round" stroke-linejoin="round"> 217 <path d="M0,11.1214886 L0,285.878477 C0,292.039924 5.87498876,296.999983 13.1728373,296.999983 L225.997983,296.999983 C233.295974,296.999983 239.17082,292.039942 239.17082,285.878477 L239.17082,123.145388 C239.17082,123.145388 119.58541,2.84217094e-14 115.369423,2.84217094e-14 L13.1728576,2.84217094e-14 C5.87500907,-1.71479982e-05 0,4.96022995 0,11.1214886 Z" id="rect1171"></path> 218 <path d="M116.37005,0 L116,100.904964 C116,111.483663 123.258008,120 132.273377,120 L236,120 L116.37005,0 L116.37005,0 Z" id="rect1794"></path> 219 </g> 220 <path d="M47.803141,294.093878 C48.4999811,295.177551 48.9495553,296.095918 49.4216083,296.995918 C50.1184484,297.895918 50.5680227,298.630612 51.2873415,299.365306 C52.2089688,300.44898 53.3778619,301 54.7490634,301 C56.1427436,301 57.0643709,300.632653 57.761211,299.916327 C58.4580511,299.365306 58.9076254,298.465306 58.9076254,297.381633 C58.9076254,296.830612 58.9076254,295.930612 58.6828382,294.828571 C58.4355724,293.561224 58.2107852,292.844898 58.2107852,292.477551 C57.7387323,287.757143 57.5139451,283.753061 57.5139451,279.95102 C57.5139451,273.228571 58.4355724,267.057143 59.8292526,261.602041 C61.44772,256.165306 63.5382403,251.610204 66.0783349,247.62449 C68.8656954,243.620408 72.3274172,240.35102 76.4859792,237.44898 C80.6445412,234.546939 85.2751561,232.177551 90.1305582,230.359184 C94.9859603,228.540816 100.76299,227.089796 107.236859,226.006122 C113.710728,225.087755 120.409385,224.371429 127.13052,223.820408 C133.829177,223.453061 141.247152,223.269388 149.811542,223.269388 L167.704598,223.269388 L167.704598,249.057143 C167.704598,250.87551 168.401438,252.326531 170.019905,253.593878 C171.86316,254.861224 173.728893,255.595918 176.021722,255.595918 C178.112242,255.595918 180.180284,254.861224 181.82123,253.593878 L247.751296,201.834694 C249.369763,200.567347 250.291391,199.116327 250.291391,197.297959 C250.291391,195.479592 249.369763,194.028571 247.751296,192.761224 L181.82123,141.002041 C180.202763,139.734694 178.112242,139 176.044201,139 C173.728893,139 171.885639,139.734694 170.042384,141.002041 C168.423917,142.269388 167.727077,143.720408 167.727077,145.538776 L167.727077,171.326531 L149.811542,171.326531 C88.5120908,171.326531 50.8152886,184.955102 36.9234437,212.193878 C32.3153075,221.267347 30,232.526531 30,245.971429 C30,257.046939 35.5522422,272.291837 46.4094607,291.540816 C46.6567266,292.091837 47.1063009,292.826531 47.803141,294.093878 Z" id="Shape-Copy" fill="#000000" fill-rule="nonzero" transform="translate(140.145695, 220.000000) scale(-1, 1) translate(-140.145695, -220.000000) "></path> 221 </g> 222 </g> 223 <!-- Up arrow --> 224 <g id="up-arrow" transform="translate(-279.22 -208.12)"> 225 <path transform="matrix(.22413 0 0 .12089 335.67 164.35)" stroke-width="0" d="m-194.17 412.01h-28.827-28.827l14.414-24.965 14.414-24.965 14.414 24.965z"/> 226 </g> 227 <!-- Down arrow --> 228 <g id="down-arrow" transform="translate(-279.22 -208.12)"> 229 <path transform="matrix(.22413 0 0 -.12089 335.67 257.93)" stroke-width="0" d="m-194.17 412.01h-28.827-28.827l14.414-24.965 14.414-24.965 14.414 24.965z"/> 230 </g> 231 </defs> 232 </svg> 233 <header> 234 <h1> 235 {{range $i, $crumb := .Breadcrumb}}<a href="{{html $crumb.Link}}">{{html $crumb.Text}}</a>{{if ne $i 0}}/{{end}}{{end}} 236 </h1> 237 </header> 238 <main> 239 <div class="meta"> 240 <div id="summary"> 241 <span class="meta-item"><input type="text" placeholder="filter" id="filter" onkeyup='filter()'></span> 242 </div> 243 </div> 244 <div class="listing"> 245 <table aria-describedby="summary"> 246 <thead> 247 <tr> 248 <th></th> 249 <th> 250 <a href="?sort=namedirfirst&order=asc" class="icon sort order"><svg class="top" width="1em" height=".5em" version="1.1" viewBox="0 0 12.922194 6.0358899"><use xlink:href="#up-arrow"></use></svg><svg class="bottom" width="1em" height=".5em" version="1.1" viewBox="0 0 12.922194 6.0358899"><use xlink:href="#down-arrow"></use></svg></a> 251 252 <a href="?sort=name&order=asc" class="order">Name</a> 253 </th> 254 <th> 255 <a href="?sort=size&order=asc" class="order">Size</a> 256 </th> 257 <th class="hideable"> 258 <a href="?sort=time&order=asc" class="order">Modified</a> 259 </th> 260 <th class="hideable"></th> 261 </tr> 262 </thead> 263 <tbody> 264 <tr> 265 <td></td> 266 <td> 267 <a href=".."> 268 <span class="goup">Go up</span> 269 </a> 270 </td> 271 <td>—</td> 272 <td class="hideable">—</td> 273 <td class="hideable"></td> 274 </tr> 275 {{- range .Entries}} 276 <tr class="file"> 277 <td> 278 </td> 279 <td> 280 {{- if .IsDir}} 281 <svg width="1.5em" height="1em" version="1.1" viewBox="0 0 317 259"><use xlink:href="#folder"></use></svg> 282 {{- else}} 283 <svg width="1.5em" height="1em" version="1.1" viewBox="0 0 265 323"><use xlink:href="#file"></use></svg> 284 {{- end}} 285 <span class="name"><a href="{{html .URL}}">{{html .Leaf}}</a></span> 286 </td> 287 {{- if .IsDir}} 288 <td data-order="-1">—</td> 289 {{- else}} 290 <td data-order="{{.Size}}"><size>{{.Size}}</size></td> 291 {{- end}} 292 {{- if .ModTime | afterEpoch }} 293 <td class="hideable"><time datetime="{{.ModTime }}">{{.ModTime }}</time></td> 294 {{- else}} 295 <td class="hideable">—</td> 296 {{- end}} 297 <td class="hideable"></td> 298 </tr> 299 {{- end}} 300 </tbody> 301 </table> 302 </div> 303 </main> 304 <script> 305 var filterEl = document.getElementById('filter'); 306 filterEl.focus(); 307 function filter() { 308 var q = filterEl.value.trim().toLowerCase(); 309 var elems = document.querySelectorAll('tr.file'); 310 elems.forEach(function(el) { 311 if (!q) { 312 el.style.display = ''; 313 return; 314 } 315 var nameEl = el.querySelector('.name'); 316 var nameVal = nameEl.textContent.trim().toLowerCase(); 317 if (nameVal.indexOf(q) !== -1) { 318 el.style.display = ''; 319 } else { 320 el.style.display = 'none'; 321 } 322 }); 323 } 324 function localizeDatetime(e, index, ar) { 325 if (e.textContent === undefined) { 326 return; 327 } 328 var d = new Date(e.getAttribute('datetime')); 329 if (isNaN(d)) { 330 d = new Date(e.textContent); 331 if (isNaN(d)) { 332 return; 333 } 334 } 335 e.textContent = d.toLocaleString([], {day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit"}); 336 } 337 var timeList = Array.prototype.slice.call(document.getElementsByTagName("time")); 338 timeList.forEach(localizeDatetime); 339 340 var getUrlParameter = function getUrlParameter(sParam) { 341 var sPageURL = window.location.search.substring(1), 342 sURLVariables = sPageURL.split('&'), 343 sParameterName, 344 i; 345 346 for (i = 0; i < sURLVariables.length; i++) { 347 sParameterName = sURLVariables[i].split('='); 348 349 if (sParameterName[0] === sParam) { 350 return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); 351 } 352 } 353 }; 354 function toggle(className){ 355 var order = getUrlParameter('order'); 356 var elements = document.getElementsByClassName(className); 357 for(var i = 0, length = elements.length; i < length; i++) { 358 var currHref = elements[i].href; 359 if(order=='desc'){ 360 var chg = currHref.replace('desc', 'asc'); 361 elements[i].href = chg; 362 } 363 if(order=='asc'){ 364 var chg = currHref.replace('asc', 'desc'); 365 elements[i].href = chg; 366 } 367 } 368 }; 369 function readableFileSize(size) { 370 var units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; 371 var i = 0; 372 while(size >= 1024) { 373 size /= 1024; 374 ++i; 375 } 376 return parseFloat(size).toFixed(2) + ' ' + units[i]; 377 } 378 379 function changeSize() { 380 var sizes = document.getElementsByTagName("size"); 381 382 for (var i = 0; i < sizes.length; i++) { 383 humanSize = readableFileSize(sizes[i].innerHTML); 384 sizes[i].innerHTML = humanSize 385 } 386 } 387 </script> 388 </body> 389 </html>