diff options
| author | Roland Reichwein <mail@reichwein.it> | 2020-05-10 16:51:20 +0200 | 
|---|---|---|
| committer | Roland Reichwein <mail@reichwein.it> | 2020-05-10 16:51:20 +0200 | 
| commit | 5b32a4415c9776dd6cae859c8d718b5e68f01d81 (patch) | |
| tree | 9c9684367a1d415b1d836065daca2e8789fcd1a5 /plugins/webbox/html | |
| parent | eb7c96f1ee9cf3eff2dd86f2a1b6ea46a80e41c8 (diff) | |
Move webbox to root to make index
Diffstat (limited to 'plugins/webbox/html')
| -rw-r--r-- | plugins/webbox/html/index.html | 9 | ||||
| -rw-r--r-- | plugins/webbox/html/webbox.js | 33 | 
2 files changed, 25 insertions, 17 deletions
diff --git a/plugins/webbox/html/index.html b/plugins/webbox/html/index.html index e9ea819..cc1cf12 100644 --- a/plugins/webbox/html/index.html +++ b/plugins/webbox/html/index.html @@ -4,22 +4,23 @@  		<meta charset="utf-8"/>  		<meta name="viewport" content="width=device-width, initial-scale=1">  		<title>Webbox</title> -		<link rel="stylesheet" type="text/css" href="webbox.css"/> -		<script src="webbox.js"></script> +		<link rel="stylesheet" type="text/css" href="webbox-html/webbox.css"/> +		<link rel="shortcut icon" href="webbox-html/favicon.ico" type="image/x-icon"/> +		<script src="webbox-html/webbox.js"></script>  	</head>  	<body onload="initMainpage();">  		<div>  			<table>  				<tr>  				<td class="title">Webbox</td> -				<td class="menusymbol" onclick="showMenu();"><img src="menu.png" alt=""/></td> +				<td class="menusymbol" onclick="showMenu();"><img src="webbox-html/menu.png" alt=""/></td>  				</tr>  			</table>  			<input id="uploadfile" type="file" onchange="onUploadFile();" multiple hidden/>  			<table class="menu">  				<tr>  					<td class="firsttd"></td> -					<td class="entry" onclick="refresh();"><img src="refresh-inverted.png" alt=""/></td> +					<td class="entry" onclick="refresh();"><img src="webbox-html/refresh-inverted.png" alt=""/></td>  				</tr>  			</table>  		</div> diff --git a/plugins/webbox/html/webbox.js b/plugins/webbox/html/webbox.js index 9a38051..602f76d 100644 --- a/plugins/webbox/html/webbox.js +++ b/plugins/webbox/html/webbox.js @@ -4,6 +4,13 @@ var numberOfSelectedRows = 0;  var username = "notaname";  var password = "password"; +function relativePath(path) { + if (path.startsWith("/")) +  return path.substr(1); + else +  return path; +} +  function clearContents() {  	var result = "<table class=\"list\">";  	// empty list @@ -35,9 +42,9 @@ function loadContents(dir) {  			for (var i = 0; i < listElements.length; i++) {  				var type = listElements[i].getAttribute("type");  				if (type == "file") { -					type = "<img src=\"file.png\"/>"; +					type = "<img src=\"webbox-html/file.png\"/>";  				} else if (type == "dir") { -					type = "<img src=\"directory.png\"/>"; +					type = "<img src=\"webbox-html/directory.png\"/>";  				} else {  					type = "";  				} @@ -57,7 +64,7 @@ function loadContents(dir) {  	} -	xhr.open("GET", "bin" + dir + "?command=list", true); +	xhr.open("GET", relativePath(dir) + "?command=list", true);  	xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  	xhr.send();  } @@ -329,7 +336,7 @@ function initMainpage() {  		initMainpage2();  	} -	xhrTitle.open("GET", "bin?command=server-info", true); +	xhrTitle.open("GET", "?command=server-info", true);  	xhrTitle.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  	xhrTitle.send(); @@ -350,7 +357,7 @@ function initMainpage2() {  		document.getElementsByClassName("footer")[0].innerHTML = xhrFooter.responseText;  	} -	xhrFooter.open("GET", "bin?command=version", true); +	xhrFooter.open("GET", "?command=version", true);  	xhrFooter.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  	xhrFooter.send(); @@ -431,7 +438,7 @@ function download(filename) {  				filesElement.appendChild(fileElement);  			} -			xhr.open("POST", "bin" + currentDir + "?command=download-zip", true); +			xhr.open("POST", relativePath(currentDir) + "?command=download-zip", true);  			xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  			xhr.setRequestHeader("Content-type", "text/xml");  			xhr.responseType = 'blob'; @@ -458,7 +465,7 @@ function download(filename) {  			dir += "/"  		}  		progressOn(); -		xhr.open("GET", "bin" + dir + filename, true); +		xhr.open("GET", relativePath(dir) + filename, true);  		xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  		xhr.responseType = 'blob';  		xhr.send(); @@ -493,7 +500,7 @@ function createDir() {  		dirElement.appendChild(document.createTextNode(document.getElementById("newdir").value)); -		xhr.open("POST", "bin" + currentDir + "?command=newdir", true); +		xhr.open("POST", relativePath(currentDir) + "?command=newdir", true);  		xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  		xhr.setRequestHeader("Content-type", "text/xml");  		xhr.send(xmlDocument); @@ -557,7 +564,7 @@ function onUploadFile() {          	formData.append("uploadfile", uploadfile.files[i]);  	} -        xhr.open("POST", "bin" + currentDir + "?command=upload", true); +        xhr.open("POST", relativePath(currentDir) + "?command=upload", true);  	xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));          xhr.send(formData);  } @@ -607,7 +614,7 @@ function deleteItems() {  			filesElement.appendChild(fileElement);  		} -		xhr.open("POST", "bin" + currentDir + "?command=delete", true); +		xhr.open("POST", relativePath(currentDir) + "?command=delete", true);  		xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  		xhr.setRequestHeader("Content-type", "text/xml");  		xhr.send(xmlDocument); @@ -672,7 +679,7 @@ function move() {  			filesElement.appendChild(fileElement);  		} -		xhr.open("POST", "bin" + currentDir + "?command=move", true); +		xhr.open("POST", relativePath(currentDir) + "?command=move", true);  		xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  		xhr.setRequestHeader("Content-type", "text/xml");  		xhr.send(xmlDocument); @@ -736,7 +743,7 @@ function rename() {  		newnameElement.appendChild(document.createTextNode(document.getElementById("renamenew").value));  		filesElement.appendChild(newnameElement); -		xhr.open("POST", "bin" + currentDir + "?command=rename", true); +		xhr.open("POST", relativePath(currentDir) + "?command=rename", true);  		xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  		xhr.setRequestHeader("Content-type", "text/xml");  		xhr.send(xmlDocument); @@ -784,7 +791,7 @@ function info() {  		filesElement.appendChild(fileElement);  	} -	xhr.open("POST", "bin" + currentDir + "?command=info", true); +	xhr.open("POST", relativePath(currentDir) + "?command=info", true);  	xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));  	xhr.setRequestHeader("Content-type", "text/xml");  	xhr.send(xmlDocument);  | 
