mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 06:28:03 -06: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:
@@ -36,32 +36,33 @@ function uploadFiles(files) {
|
||||
}
|
||||
}
|
||||
|
||||
// file selection
|
||||
function fileSelectHandler(e) {
|
||||
function fileHandler(e) {
|
||||
e.preventDefault();
|
||||
// fetch FileList object
|
||||
var files = e.target.files || e.dataTransfer.files;
|
||||
var files = $('fileselect').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");
|
||||
else
|
||||
$('upload_frame').addEvent('load', function(e) { window.parent.closeWindows(); });
|
||||
if (xhr.upload) {
|
||||
$('uploadForm').addEvent('submit', fileHandler);
|
||||
} else {
|
||||
$('upload_frame').addEvent('load', function() { window.parent.closeWindows(); });
|
||||
}
|
||||
});
|
||||
</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>
|
||||
<iframe id="upload_frame" name="upload_frame" class="invisible" src="javascript:false;"></iframe>
|
||||
<form action="command/upload" enctype="multipart/form-data" method="post" id="uploadForm" target="upload_frame" style="text-align: center;">
|
||||
<div style="margin-top: 25px; display: inline-block; border: 1px solid lightgrey; border-radius: 4px;">
|
||||
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />
|
||||
</div>
|
||||
<div id="submitbutton" style="margin-top: 30px;">
|
||||
<button type="submit" style="font-size: 1em;">_(Upload Torrents)</button>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user