1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-03 02:14:16 +00:00
qBittorrent/src/webui/www/private/newcategory.html

76 lines
2.9 KiB
HTML
Raw Normal View History

2017-11-02 12:14:27 +03:00
<!DOCTYPE html>
<html lang="${LANG}">
2018-04-05 11:59:31 +08:00
<head>
<meta charset="UTF-8" />
<title>QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
<script>
var newCategoryKeyboardEvents = new Keyboard({
defaultEventType: 'keydown',
events: {
2018-04-05 11:59:31 +08:00
'enter': function(event) {
$('newCategoryButton').click();
event.preventDefault();
}
}
});
newCategoryKeyboardEvents.activate();
window.addEvent('domready', function() {
$('newCategory').focus();
$('newCategoryButton').addEvent('click', function(e) {
new Event(e).stop();
// check field
var categoryName = $('newCategory').value.trim();
if (categoryName == null || categoryName == "")
return false;
if (categoryName.match("^([^\\\\\\/]|[^\\\\\\/]([^\\\\\\/]|\\/(?=[^\\/]))*[^\\\\\\/])$") === null) {
alert("QBT_TR(Invalid category name:\nPlease do not use any special characters in the category name.)QBT_TR[CONTEXT=HttpServer]");
return false;
}
var hashesList = new URI().getData('hashes');
2016-01-21 15:32:13 +03:00
if (!hashesList) {
new Request({
url: 'api/v2/torrents/createCategory',
2016-01-21 15:32:13 +03:00
method: 'post',
data: {
category: categoryName
},
2018-04-05 11:59:31 +08:00
onComplete: function() {
2016-01-21 15:32:13 +03:00
window.parent.closeWindows();
}
}).send();
}
2018-04-05 11:59:31 +08:00
else {
2016-01-21 15:32:13 +03:00
new Request({
url: 'api/v2/torrents/setCategory',
2016-01-21 15:32:13 +03:00
method: 'post',
data: {
hashes: hashesList,
category: categoryName
},
2018-04-05 11:59:31 +08:00
onComplete: function() {
2016-01-21 15:32:13 +03:00
window.parent.closeWindows();
}
}).send();
}
});
});
</script>
</head>
2018-04-05 11:59:31 +08:00
<body>
<div style="padding: 10px 10px 0px 10px;">
<p style="font-weight: bold;">QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget]:</p>
2018-04-05 11:59:31 +08:00
<input type="text" id="newCategory" value="" maxlength="100" style="width: 220px;" />
<div style="text-align: center; padding-top: 10px;">
2018-04-05 11:59:31 +08:00
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="newCategoryButton" />
</div>
</div>
</body>
2018-04-05 11:59:31 +08:00
</html>