mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-10 17:35:00 -06:00
Prepare WebUI resources.
Html/Css/JavaScript files displacement. Also add new icon.
This commit is contained in:
61
src/webui/www/public/upload.html
Normal file
61
src/webui/www/public/upload.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>_(Download local torrent)</title>
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
||||
<script type="text/javascript" src="scripts/mootools-1.2-core-yc.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function stateChangeHandler() {
|
||||
if (this.readyState == this.DONE) {
|
||||
if (this.status == 200)
|
||||
window.parent.closeWindows();
|
||||
else
|
||||
alert("Upload Failed!");
|
||||
}
|
||||
}
|
||||
|
||||
function uploadFiles(files) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
if (xhr.upload) {
|
||||
// start upload
|
||||
var formData = new FormData();
|
||||
for (var i = 0, file; file = files[i]; ++i)
|
||||
formData.append(file.name, file);
|
||||
xhr.onreadystatechange = stateChangeHandler;
|
||||
xhr.open("POST", "command/upload");
|
||||
// Bypass cache
|
||||
xhr.setRequestHeader("Cache-Control", "no-cache");
|
||||
xhr.send(formData);
|
||||
}
|
||||
}
|
||||
|
||||
// file selection
|
||||
function fileSelectHandler(e) {
|
||||
// fetch FileList object
|
||||
var files = e.target.files || e.dataTransfer.files;
|
||||
// process all File objects
|
||||
uploadFiles(files);
|
||||
}
|
||||
|
||||
window.addEvent('load', function() {
|
||||
$('fileselect').addEvent('change', fileSelectHandler);
|
||||
// is XHR2 available?
|
||||
var xhr = new XMLHttpRequest();
|
||||
if (xhr.upload)
|
||||
$('submitbutton').addClass("invisible");
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<br/>
|
||||
<iframe id="upload_frame" name="upload_frame" style="width:1px;height:1px;border:0px;" src="javascript:false;"></iframe>
|
||||
<form action="command/upload" enctype="multipart/form-data" method="post" id="uploadForm" target="upload_frame">
|
||||
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" /><br/>
|
||||
<div id="submitbutton">
|
||||
<button type="submit">_(Upload Torrents)</button>
|
||||
</div
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user