mirror of
https://github.com/Carve/qbittorrent-webui-cjratliff.com.git
synced 2024-11-14 18:57:36 +01:00
82 lines
2.9 KiB
HTML
82 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="${LANG}">
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>Set location</title>
|
|
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
|
<link rel="stylesheet" type="text/css" href="css/Core.css?v=${CACHEID}" />
|
|
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
|
<script>
|
|
'use strict';
|
|
|
|
new Keyboard({
|
|
defaultEventType: 'keydown',
|
|
events: {
|
|
'Enter': function(event) {
|
|
$('setLocationButton').click();
|
|
event.preventDefault();
|
|
},
|
|
'Escape': function(event) {
|
|
window.parent.closeWindows();
|
|
event.preventDefault();
|
|
},
|
|
'Esc': function(event) {
|
|
window.parent.closeWindows();
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
}).activate();
|
|
|
|
window.addEvent('domready', function() {
|
|
const path = new URI().getData('path');
|
|
|
|
// set text field to current value
|
|
if (path)
|
|
$('setLocation').value = decodeURIComponent(path);
|
|
|
|
$('setLocation').focus();
|
|
$('setLocationButton').addEvent('click', function(e) {
|
|
new Event(e).stop();
|
|
// check field
|
|
const location = $('setLocation').value.trim();
|
|
if ((location === null) || (location === "")) {
|
|
$('error_div').set('text', 'Save path is empty');
|
|
return false;
|
|
}
|
|
|
|
const hashesList = new URI().getData('hashes');
|
|
new Request({
|
|
url: 'api/v2/torrents/setLocation',
|
|
method: 'post',
|
|
data: {
|
|
hashes: hashesList,
|
|
location: location
|
|
},
|
|
onSuccess: function() {
|
|
window.parent.closeWindows();
|
|
},
|
|
onFailure: function(xhr) {
|
|
$('error_div').set('text', xhr.response);
|
|
}
|
|
}).send();
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div style="padding: 10px 10px 0px 10px;">
|
|
<p style="font-weight: bold;">Location:</p>
|
|
<input type="text" id="setLocation" autocorrect="off" autocapitalize="none" style="width: 99%;" />
|
|
<div style="float: none; width: 99%;" id="error_div"> </div>
|
|
<div style="text-align: center; padding-top: 10px;">
|
|
<input class="button" type="button" value="Save" id="setLocationButton" />
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|