1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-15 17:20:06 +00:00
qBittorrent/src/webui/www/private/newcategory.html
Vladimir Golovnev (Glassez) 27d8dbf13b
Redesign Web API
Normalize Web API method names.
Allow to use alternative Web UI.
Switch Web API version to standard form (i.e. "2.0").
Improve Web UI translation code.
Retranslate changed files.
Add Web API for RSS subsystem.
2018-01-28 19:16:24 +03:00

74 lines
3.0 KiB
HTML

<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script type="text/javascript" src="scripts/mootools-1.2-core-yc.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/mootools-1.2-more.js" charset="utf-8"></script>
<script type="text/javascript">
var newCategoryKeyboardEvents = new Keyboard({
defaultEventType: 'keydown',
events: {
'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');
if (!hashesList) {
new Request({
url: 'api/v2/torrents/createCategory',
method: 'post',
data: {
category: categoryName
},
onComplete: function () {
window.parent.closeWindows();
}
}).send();
}
else
{
new Request({
url: 'api/v2/torrents/setCategory',
method: 'post',
data: {
hashes: hashesList,
category: categoryName
},
onComplete: function () {
window.parent.closeWindows();
}
}).send();
}
});
});
</script>
</head>
<body>
<div style="padding: 10px 10px 0px 10px;">
<p style="font-weight: bold;">QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget]:</p>
<input type="text" id="newCategory" value="" maxlength="100" style="width: 220px;"/>
<div style="text-align: center; padding-top: 10px;">
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="newCategoryButton"/>
</div>
</div>
</body>
</html>