mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-09-08 03:52:26 +00:00
Upload torrents on user command
Don't upload the torrents as soon as they are selected. Also, adjust the HTML code to better place the upload button.
This commit is contained in:
parent
ee3a736787
commit
3d1617b2de
@ -36,32 +36,33 @@ function uploadFiles(files) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// file selection
|
function fileHandler(e) {
|
||||||
function fileSelectHandler(e) {
|
e.preventDefault();
|
||||||
// fetch FileList object
|
// fetch FileList object
|
||||||
var files = e.target.files || e.dataTransfer.files;
|
var files = $('fileselect').files
|
||||||
// process all File objects
|
// process all File objects
|
||||||
uploadFiles(files);
|
uploadFiles(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEvent('load', function() {
|
window.addEvent('load', function() {
|
||||||
$('fileselect').addEvent('change', fileSelectHandler);
|
// is XHR2 available?
|
||||||
// is XHR2 available?
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
if (xhr.upload)
|
if (xhr.upload) {
|
||||||
$('submitbutton').addClass("invisible");
|
$('uploadForm').addEvent('submit', fileHandler);
|
||||||
else
|
} else {
|
||||||
$('upload_frame').addEvent('load', function(e) { window.parent.closeWindows(); });
|
$('upload_frame').addEvent('load', function() { window.parent.closeWindows(); });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<br/>
|
<iframe id="upload_frame" name="upload_frame" class="invisible" src="javascript:false;"></iframe>
|
||||||
<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" style="text-align: center;">
|
||||||
<form action="command/upload" enctype="multipart/form-data" method="post" id="uploadForm" target="upload_frame">
|
<div style="margin-top: 25px; display: inline-block; border: 1px solid lightgrey; border-radius: 4px;">
|
||||||
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" /><br/>
|
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />
|
||||||
<div id="submitbutton">
|
</div>
|
||||||
<button type="submit">_(Upload Torrents)</button>
|
<div id="submitbutton" style="margin-top: 30px;">
|
||||||
|
<button type="submit" style="font-size: 1em;">_(Upload Torrents)</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user