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

Side by Side Diff: net/base/dir_header.html

Issue 196019: Properly concatenate URL components in directory listing. (Closed)
Patch Set: Created 11 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 4
5 <script> 5 <script>
6 function addRow(name, url, isdir, size, date_modified) { 6 function addRow(name, url, isdir, size, date_modified) {
7 if (name == ".") 7 if (name == ".")
8 return; 8 return;
9 9
10 var root = "" + document.location;
wtc 2009/09/04 18:08:09 Just curious, why do we need the ""? Would "paren
eroman 2009/09/04 18:50:33 Instead of document.location, you can use document
11 if (root.substr(-1) !== "/")
12 root += "/";
13
10 var table = document.getElementById("table"); 14 var table = document.getElementById("table");
11 var row = document.createElement("tr"); 15 var row = document.createElement("tr");
12 var file_cell = document.createElement("td"); 16 var file_cell = document.createElement("td");
13 var link = document.createElement("a"); 17 var link = document.createElement("a");
14 if (name == "..") { 18 if (name == "..") {
15 link.href = document.location + "/.."; 19 link.href = root + "..";
16 link.innerText = document.getElementById("parentDirText").innerText; 20 link.innerText = document.getElementById("parentDirText").innerText;
17 size = ""; 21 size = "";
18 date_modified = ""; 22 date_modified = "";
19 } else { 23 } else {
20 if (isdir) { 24 if (isdir) {
21 name = name + "/"; 25 name = name + "/";
22 url = url + "/"; 26 url = url + "/";
23 size = ""; 27 size = "";
24 } 28 }
25 link.innerText = name; 29 link.innerText = name;
26 link.href = document.location + "/" + url; 30 link.href = root + url;
27 } 31 }
28 file_cell.appendChild(link); 32 file_cell.appendChild(link);
29 33
30 row.appendChild(file_cell); 34 row.appendChild(file_cell);
31 row.appendChild(createCell(size)); 35 row.appendChild(createCell(size));
32 row.appendChild(createCell(date_modified)); 36 row.appendChild(createCell(date_modified));
33 37
34 table.appendChild(row); 38 table.appendChild(row);
35 } 39 }
36 40
(...skipping 24 matching lines...) Expand all
61 <hr/> 65 <hr/>
62 <table id="table"> 66 <table id="table">
63 <tr style="font-weight: bold"> 67 <tr style="font-weight: bold">
64 <td i18n-content="headerName"></td> 68 <td i18n-content="headerName"></td>
65 <td class="sizeColumn" i18n-content="headerSize"></td> 69 <td class="sizeColumn" i18n-content="headerSize"></td>
66 <td class="sizeColumn" i18n-content="headerDateModified"></td> 70 <td class="sizeColumn" i18n-content="headerDateModified"></td>
67 </tr> 71 </tr>
68 </table> 72 </table>
69 </body> 73 </body>
70 </html> 74 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698