mirror of
https://github.com/Carve/qbittorrent-webui-cjratliff.com.git
synced 2024-11-14 18:57:36 +01:00
77 lines
2.5 KiB
HTML
77 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="${LANG}">
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>Rename</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) {
|
|
$('renameButton').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 name = new URI().getData('name');
|
|
// set text field to current value
|
|
if (name)
|
|
$('rename').value = name;
|
|
|
|
$('rename').focus();
|
|
$('renameButton').addEvent('click', function(e) {
|
|
new Event(e).stop();
|
|
// check field
|
|
const name = $('rename').value.trim();
|
|
if (name === null || name === "")
|
|
return false;
|
|
|
|
const hash = new URI().getData('hash');
|
|
if (hash) {
|
|
new Request({
|
|
url: 'api/v2/torrents/rename',
|
|
method: 'post',
|
|
data: {
|
|
hash: hash,
|
|
name: name
|
|
},
|
|
onComplete: function() {
|
|
window.parent.closeWindows();
|
|
}
|
|
}).send();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div style="padding: 10px 10px 0px 10px;">
|
|
<p style="font-weight: bold;">New name:</p>
|
|
<input type="text" id="rename" style="width: 99%;" />
|
|
<div style="text-align: center; padding-top: 10px;">
|
|
<input class="button" type="button" value="Save" id="renameButton" />
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|