Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Commit 19a19e0

Browse files
committed
list.html: list within a subfolder
This uses the 'prefix' argument to list only the contents below a certain subfolder. The behavior is still highly non-intuitive for most web users when given deep directory trees.
1 parent a40f093 commit 19a19e0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

list.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
/* The variable http will hold our new XMLHttpRequest object. */
8282
var http = createRequestObject();
8383
function getList(){
84-
http.open('get', location.protocol+'//'+location.hostname);
84+
http.open('get', location.protocol+'//'+location.hostname+'/?prefix='+location.pathname.replace(/list.html$/, '').replace(/^\//, ''));
8585
http.onreadystatechange = handleList;
8686
http.send(null);
8787
}
@@ -96,7 +96,7 @@
9696
4: Finished */
9797
if(http.readyState == 4){ //Finished loading the response
9898
/* We have got the response from the server-side script,
99-
let's see just what it was. using the responseText property of
99+
let us see just what it was. using the responseText property of
100100
the XMLHttpRequest object. */
101101
var response = http.responseXML;
102102

@@ -111,7 +111,7 @@
111111
size = filex[i].getElementsByTagName('Size')[0].firstChild.data;
112112
name = filex[i].getElementsByTagName('Key')[0].firstChild.data;
113113
lastmod = filex[i].getElementsByTagName('LastModified')[0].firstChild.data;
114-
link = "<A HREF=\""+name.replace(/\+/g, '%2B')+"\">"+name+"</A>";
114+
link = '<A HREF="'+location.protocol+'//'+location.hostname+'/'+name.replace(/\+/g, '%2B')+'">'+name+'</A>';
115115
fileData[0] = name;
116116
fileData[1] = size;
117117
fileData[2] = lastmod;

0 commit comments

Comments
 (0)