2017-11-02 12:14:27 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="${LANG}">
|
2015-02-14 18:19:54 -03:00
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
2017-05-01 01:45:02 +03:00
|
|
|
<title>QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]</title>
|
2015-02-14 18:19:54 -03:00
|
|
|
<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">
|
2016-02-09 11:56:48 +03:00
|
|
|
var newCategoryKeyboardEvents = new Keyboard({
|
2016-01-29 18:02:36 +03:00
|
|
|
defaultEventType: 'keydown',
|
|
|
|
events: {
|
|
|
|
'enter': function (event) {
|
2016-02-09 11:56:48 +03:00
|
|
|
$('newCategoryButton').click();
|
2016-01-29 18:02:36 +03:00
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2016-02-09 11:56:48 +03:00
|
|
|
newCategoryKeyboardEvents.activate();
|
2016-01-29 18:02:36 +03:00
|
|
|
|
2015-07-16 01:04:53 +02:00
|
|
|
window.addEvent('domready', function() {
|
2016-02-09 11:56:48 +03:00
|
|
|
$('newCategory').focus();
|
|
|
|
$('newCategoryButton').addEvent('click', function(e) {
|
2015-07-16 01:04:53 +02:00
|
|
|
new Event(e).stop();
|
2015-02-14 18:19:54 -03:00
|
|
|
// check field
|
2016-02-09 11:56:48 +03:00
|
|
|
var categoryName = $('newCategory').value.trim();
|
|
|
|
if (categoryName == null || categoryName == "")
|
2015-02-14 18:19:54 -03:00
|
|
|
return false;
|
2016-02-09 11:56:48 +03:00
|
|
|
if (categoryName.match("^([^\\\\\\/]|[^\\\\\\/]([^\\\\\\/]|\\/(?=[^\\/]))*[^\\\\\\/])$") === null) {
|
2017-05-01 01:45:02 +03:00
|
|
|
alert("QBT_TR(Invalid category name:\nPlease do not use any special characters in the category name.)QBT_TR[CONTEXT=HttpServer]");
|
2015-02-14 18:19:54 -03:00
|
|
|
return false;
|
|
|
|
}
|
2015-07-16 01:04:53 +02:00
|
|
|
var hashesList = new URI().getData('hashes');
|
2016-01-21 15:32:13 +03:00
|
|
|
if (!hashesList) {
|
|
|
|
new Request({
|
2017-10-14 16:27:21 +03:00
|
|
|
url: 'api/v2/torrents/createCategory',
|
2016-01-21 15:32:13 +03:00
|
|
|
method: 'post',
|
|
|
|
data: {
|
|
|
|
category: categoryName
|
|
|
|
},
|
|
|
|
onComplete: function () {
|
|
|
|
window.parent.closeWindows();
|
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new Request({
|
2017-10-14 16:27:21 +03:00
|
|
|
url: 'api/v2/torrents/setCategory',
|
2016-01-21 15:32:13 +03:00
|
|
|
method: 'post',
|
|
|
|
data: {
|
|
|
|
hashes: hashesList,
|
|
|
|
category: categoryName
|
|
|
|
},
|
|
|
|
onComplete: function () {
|
|
|
|
window.parent.closeWindows();
|
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
}
|
2015-02-14 18:19:54 -03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2015-07-16 01:04:53 +02:00
|
|
|
<div style="padding: 10px 10px 0px 10px;">
|
2017-05-01 01:45:02 +03:00
|
|
|
<p style="font-weight: bold;">QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget]:</p>
|
2016-02-09 11:56:48 +03:00
|
|
|
<input type="text" id="newCategory" value="" maxlength="100" style="width: 220px;"/>
|
2017-08-06 05:04:39 -04:00
|
|
|
<div style="text-align: center; padding-top: 10px;">
|
2017-05-01 01:45:02 +03:00
|
|
|
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="newCategoryButton"/>
|
2015-07-16 01:04:53 +02:00
|
|
|
</div>
|
2015-02-14 18:19:54 -03:00
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|