qbittorrent-webui-cjratliff.../private/newrule.html
2023-06-18 23:32:21 -03:00

72 lines
2.5 KiB
HTML

<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>New rule name</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': (event) => {
$('submitButton').click();
event.preventDefault();
},
'Escape': (event) => {
window.parent.MochaUI.closeWindow(window.parent.$('newRulePage'));
event.preventDefault();
},
'Esc': (event) => {
window.parent.MochaUI.closeWindow(window.parent.$('newRulePage'));
event.preventDefault();
}
}
}).activate();
window.addEvent('domready', () => {
$('name').focus();
$('submitButton').addEvent('click', (e) => {
new Event(e).stop();
// check field
const name = $('name').value.trim();
if (name === '') {
alert('Name cannot be empty');
return;
}
$('submitButton').disabled = true;
new Request({
url: 'api/v2/rss/setRule',
noCache: true,
method: 'post',
data: {
ruleName: name,
ruleDef: '{}'
},
onSuccess: (response) => {
window.parent.qBittorrent.RssDownloader.updateRulesList();
window.parent.MochaUI.closeWindow(window.parent.$('newRulePage'));
}
}).send();
});
});
</script>
</head>
<body>
<div style="padding: 10px 10px 0px 10px;">
<p>Please type the name of the new download rule.</p>
<input type="text" id="name" style="width: 320px;" />
<div style="text-align: center; padding-top: 10px;">
<input class="button" type="button" value="OK" id="submitButton" />
</div>
</div>
</body>
</html>