Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1435)

Unified Diff: net/base/dir_header.html

Issue 2792533003: Separate the parent directory link in FTP listings. (Closed)
Patch Set: Fix comment not converted by Blink mass reformatting Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/ftp_directory_listing_response_delegate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/dir_header.html
diff --git a/net/base/dir_header.html b/net/base/dir_header.html
index 8bb1f1ef7af7f5e38db3918b89477615c58774ee..b4cefe5db06017ec050ab55476ba2f0419ec7415 100644
--- a/net/base/dir_header.html
+++ b/net/base/dir_header.html
@@ -9,7 +9,7 @@
<script>
function addRow(name, url, isdir,
size, size_string, date_modified, date_modified_string) {
- if (name == ".")
+ if (name == "." || name == "..")
return;
var root = document.location.pathname;
@@ -23,27 +23,18 @@ function addRow(name, url, isdir,
link.className = isdir ? "icon dir" : "icon file";
- if (name == "..") {
- link.href = root + "..";
- link.innerText = document.getElementById("parentDirText").innerText;
- link.className = "icon up";
+ if (isdir) {
+ name = name + "/";
+ url = url + "/";
size = 0;
size_string = "";
- date_modified = 0;
- date_modified_string = "";
} else {
- 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;
+ link.draggable = "true";
+ link.addEventListener("dragstart", onDragStart, false);
}
+ link.innerText = name;
+ link.href = root + url;
+
file_cell.dataset.value = name;
file_cell.appendChild(link);
@@ -77,6 +68,18 @@ function start(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)
@@ -108,14 +111,11 @@ function sortTable(column) {
}
// Column 0 is text.
- // Also the parent directory should always be sorted at one of the ends.
- if (b == ".." | a > b) {
+ if (a > b)
return newOrder;
- } else if (a == ".." | a < b) {
+ if (a < b)
return oldOrder;
- } else {
- return 0;
- }
+ return 0;
});
// Appending an existing child again just moves it.
@@ -173,6 +173,11 @@ function sortTable(column) {
background-position-x: right;
}
+ #parentDirLinkBox {
+ margin-bottom: 10px;
+ padding-bottom: 10px;
+ }
+
#listingParsingErrorBox {
border: 1px solid black;
background: #fae691;
@@ -189,10 +194,14 @@ function sortTable(column) {
<div id="listingParsingErrorBox" i18n-values=".innerHTML:listingParsingErrorBoxText"></div>
-<span id="parentDirText" style="display:none" i18n-content="parentDirText"></span>
-
<h1 id="header" i18n-content="header"></h1>
+<div id="parentDirLinkBox" style="display:none">
+ <a id="parentDirLink" class="icon up">
+ <span id="parentDirText" i18n-content="parentDirText"></span>
+ </a>
+</div>
+
<table>
<thead>
<tr class="header" id="theader">
« no previous file with comments | « content/child/ftp_directory_listing_response_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698