mirror of
https://github.com/Carve/qbittorrent-webui-cjratliff.com.git
synced 2024-11-15 03:07:38 +01:00
82 lines
2.9 KiB
HTML
82 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="${LANG}">
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>QBT_TR(Rule renaming)QBT_TR[CONTEXT=AutomatedRssDownloader]</title>
|
|
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
|
<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) => {
|
|
$('renameButton').click();
|
|
event.preventDefault();
|
|
},
|
|
'Escape': (event) => {
|
|
window.parent.MochaUI.closeWindow(window.parent.$('renameRulePage'));
|
|
event.preventDefault();
|
|
},
|
|
'Esc': (event) => {
|
|
window.parent.MochaUI.closeWindow(window.parent.$('renameRulePage'));
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
}).activate();
|
|
window.addEvent('domready', () => {
|
|
const oldName = new URI().getData('rule');
|
|
|
|
$('rename').value = oldName;
|
|
$('rename').focus();
|
|
$('rename').setSelectionRange(0, oldName.length);
|
|
|
|
$('renameButton').addEvent('click', (e) => {
|
|
new Event(e).stop();
|
|
// check field
|
|
const newName = $('rename').value.trim();
|
|
if (newName === '') {
|
|
alert('QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]');
|
|
return;
|
|
}
|
|
|
|
if (newName === oldName) {
|
|
alert('QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]');
|
|
return;
|
|
}
|
|
|
|
$('renameButton').disabled = true;
|
|
new Request({
|
|
url: 'api/v2/rss/renameRule',
|
|
noCache: true,
|
|
method: 'post',
|
|
data: {
|
|
ruleName: oldName,
|
|
newRuleName: newName
|
|
},
|
|
onSuccess: (response) => {
|
|
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
|
window.parent.MochaUI.closeWindow(window.parent.$('renameRulePage'));
|
|
}
|
|
}).send();
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div style="padding: 10px 10px 0px 10px;">
|
|
<p>QBT_TR(Please type the new rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]</p>
|
|
<input type="text" id="rename" style="width: 320px;" />
|
|
<div style="text-align: center; padding-top: 10px;">
|
|
<input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="renameButton" />
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|