naiveproxy/net/base/dir_header.html
2018-08-11 05:35:24 +00:00

224 lines
7.0 KiB
HTML

<!DOCTYPE html>
<html dir="$i18n{textdirection}" lang="$i18n{language}">
<head>
<meta charset="utf-8">
<meta name="google" value="notranslate">
<script>
function addRow(name, url, isdir,
size, size_string, date_modified, date_modified_string) {
if (name == "." || name == "..")
return;
var root = document.location.pathname;
if (root.substr(-1) !== "/")
root += "/";
var tbody = document.getElementById("tbody");
var row = document.createElement("tr");
var file_cell = document.createElement("td");
var link = document.createElement("a");
link.className = isdir ? "icon dir" : "icon file";
if (isdir) {
name = name + "/";
url = url + "/";
size = 0;
size_string = "";
} else {
link.draggable = "true";
link.addEventListener("dragstart", onDragStart, false);
}
link.innerText = name;
link.href = root + url;
file_cell.dataset.value = name;
file_cell.appendChild(link);
row.appendChild(file_cell);
row.appendChild(createCell(size, size_string));
row.appendChild(createCell(date_modified, date_modified_string));
tbody.appendChild(row);
}
function onDragStart(e) {
var el = e.srcElement;
var name = el.innerText.replace(":", "");
var download_url_data = "application/octet-stream:" + name + ":" + el.href;
e.dataTransfer.setData("DownloadURL", download_url_data);
e.dataTransfer.effectAllowed = "copy";
}
function createCell(value, text) {
var cell = document.createElement("td");
cell.setAttribute("class", "detailsColumn");
cell.dataset.value = value;
cell.innerText = text;
return cell;
}
function start(location) {
var header = document.getElementById("header");
header.innerText = header.innerText.replace("LOCATION", location);
document.getElementById("title").innerText = header.innerText;
}
function onHasParentDirectory() {
var box = document.getElementById("parentDirLinkBox");
box.style.display = "block";
var root = document.location.pathname;
if (!root.endsWith("/"))
root += "/";
var link = document.getElementById("parentDirLink");
link.href = root + "..";
}
function onListingParsingError() {
var box = document.getElementById("listingParsingErrorBox");
box.innerHTML = box.innerHTML.replace("LOCATION", encodeURI(document.location)
+ "?raw");
box.style.display = "block";
}
function sortTable(column) {
var theader = document.getElementById("theader");
var oldOrder = theader.cells[column].dataset.order || '1';
oldOrder = parseInt(oldOrder, 10)
var newOrder = 0 - oldOrder;
theader.cells[column].dataset.order = newOrder;
var tbody = document.getElementById("tbody");
var rows = tbody.rows;
var list = [], i;
for (i = 0; i < rows.length; i++) {
list.push(rows[i]);
}
list.sort(function(row1, row2) {
var a = row1.cells[column].dataset.value;
var b = row2.cells[column].dataset.value;
if (column) {
a = parseInt(a, 10);
b = parseInt(b, 10);
return a > b ? newOrder : a < b ? oldOrder : 0;
}
// Column 0 is text.
if (a > b)
return newOrder;
if (a < b)
return oldOrder;
return 0;
});
// Appending an existing child again just moves it.
for (i = 0; i < list.length; i++) {
tbody.appendChild(list[i]);
}
}
</script>
<style>
h1 {
border-bottom: 1px solid #c0c0c0;
margin-bottom: 10px;
padding-bottom: 10px;
white-space: nowrap;
}
table {
border-collapse: collapse;
}
th {
cursor: pointer;
}
td.detailsColumn {
-webkit-padding-start: 2em;
text-align: end;
white-space: nowrap;
}
a.icon {
-webkit-padding-start: 1.5em;
text-decoration: none;
}
a.icon:hover {
text-decoration: underline;
}
a.file {
background : url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAABHUlEQVR42o2RMW7DIBiF3498iHRJD5JKHurL+CRVBp+i2T16tTynF2gO0KSb5ZrBBl4HHDBuK/WXACH4eO9/CAAAbdvijzLGNE1TVZXfZuHg6XCAQESAZXbOKaXO57eiKG6ft9PrKQIkCQqFoIiQFBGlFIB5nvM8t9aOX2Nd18oDzjnPgCDpn/BH4zh2XZdlWVmWiUK4IgCBoFMUz9eP6zRN75cLgEQhcmTQIbl72O0f9865qLAAsURAAgKBJKEtgLXWvyjLuFsThCSstb8rBCaAQhDYWgIZ7myM+TUBjDHrHlZcbMYYk34cN0YSLcgS+wL0fe9TXDMbY33fR2AYBvyQ8L0Gk8MwREBrTfKe4TpTzwhArXWi8HI84h/1DfwI5mhxJamFAAAAAElFTkSuQmCC ") left top no-repeat;
}
a.dir {
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;
}
a.up {
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;
}
html[dir=rtl] a {
background-position-x: right;
}
#parentDirLinkBox {
margin-bottom: 10px;
padding-bottom: 10px;
}
#listingParsingErrorBox {
border: 1px solid black;
background: #fae691;
padding: 10px;
display: none;
}
</style>
<title id="title"></title>
</head>
<body>
<div id="listingParsingErrorBox">$i18nRaw{listingParsingErrorBoxText}</div>
<h1 id="header">$i18n{header}</h1>
<div id="parentDirLinkBox" style="display:none">
<a id="parentDirLink" class="icon up">
<span id="parentDirText">$i18n{parentDirText}</span>
</a>
</div>
<table>
<thead>
<tr class="header" id="theader">
<th onclick="javascript:sortTable(0);">$i18n{headerName}</th>
<th class="detailsColumn" onclick="javascript:sortTable(1);">
$i18n{headerSize}
</th>
<th class="detailsColumn" onclick="javascript:sortTable(2);">
$i18n{headerDateModified}
</th>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</body>
</html>