Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented RSS reader and auto downloader in reference WebUI #12557

Merged
merged 1 commit into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions src/webui/www/private/confirmfeeddeletion.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="${LANG}">

<head>
<meta charset="UTF-8" />
<title>QBT_TR(Deletion confirmation)QBT_TR[CONTEXT=RSSWidget]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" 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>
'use strict';

window.addEvent('domready', () => {
const paths = decodeURIComponent(new URI().getData('paths')).split('|');
$('cancelBtn').focus();
$('cancelBtn').addEvent('click', (e) => {
new Event(e).stop();
window.parent.closeWindows();
});
$('confirmBtn').addEvent('click', (e) => {
new Event(e).stop();
let completionCount = 0;
paths.forEach((path) => {
new Request({
url: '/api/v2/rss/removeItem',
noCache: true,
method: 'post',
data: {
path: path
},
onComplete: (response) => {
++completionCount;
if (completionCount === paths.length) {
window.parent.qBittorrent.Rss.updateRssFeedList();
window.parent.closeWindows();
}
}
}).send();
});
});
});
</script>
</head>

<body>
<div style="padding: 10px 10px 0px 10px;">
<p>QBT_TR(Are you sure you want to delete the selected RSS feeds?)QBT_TR[CONTEXT=RSSWidget]</p>
<div style="text-align: right;">
<input type="button" id="cancelBtn" value="QBT_TR(No)QBT_TR[CONTEXT=MainWindow]" />
<input type="button" id="confirmBtn" value="QBT_TR(Yes)QBT_TR[CONTEXT=MainWindow]" />
</div>
</div>
</body>

</html>
48 changes: 48 additions & 0 deletions src/webui/www/private/confirmruleclear.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="${LANG}">

<head>
<meta charset="UTF-8" />
<title>QBT_TR(Clear downloaded episodes)QBT_TR[CONTEXT=AutomatedRssDownloader]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" 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>
'use strict';

window.addEvent('domready', () => {
const rules = decodeURIComponent(new URI().getData('rules')).split('|');

$('cancelBtn').focus();
$('cancelBtn').addEvent('click', (e) => {
new Event(e).stop();
window.parent.MochaUI.closeWindow(window.parent.$('clearRulesPage'));
});
$('confirmBtn').addEvent('click', (e) => {
new Event(e).stop();
let completionCount = 0;
rules.forEach((rule) => {
window.parent.qBittorrent.RssDownloader.modifyRuleState(rule, 'previouslyMatchedEpisodes', [], () => {
++completionCount;
if (completionCount === rules.length) {
window.parent.qBittorrent.RssDownloader.updateRulesList();
window.parent.MochaUI.closeWindow(window.parent.$('clearRulesPage'));
}
});
});
});
});
</script>
</head>

<body>
<div style="padding: 10px 10px 0px 10px;">
<p>QBT_TR(Are you sure you want to clear the list of downloaded episodes for the selected rule?)QBT_TR[CONTEXT=AutomatedRssDownloader]</p>
<div style="text-align: right;">
<input type="button" id="cancelBtn" value="QBT_TR(No)QBT_TR[CONTEXT=MainWindow]" />
<input type="button" id="confirmBtn" value="QBT_TR(Yes)QBT_TR[CONTEXT=MainWindow]" />
</div>
</div>
</body>

</html>
56 changes: 56 additions & 0 deletions src/webui/www/private/confirmruledeletion.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="${LANG}">

<head>
<meta charset="UTF-8" />
<title>QBT_TR(Rule deletion confirmation)QBT_TR[CONTEXT=AutomatedRssDownloader]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" 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>
'use strict';

window.addEvent('domready', () => {
const rules = decodeURIComponent(new URI().getData('rules')).split('|');

$('cancelBtn').focus();
$('cancelBtn').addEvent('click', (e) => {
new Event(e).stop();
window.parent.MochaUI.closeWindow(window.parent.$('removeRulePage'));
});
$('confirmBtn').addEvent('click', (e) => {
new Event(e).stop();
let completionCount = 0;
rules.forEach((rule) => {
new Request({
url: '/api/v2/rss/removeRule',
noCache: true,
method: 'post',
data: {
ruleName: rule
},
onComplete: (response) => {
++completionCount;
if (completionCount === rules.length) {
window.parent.qBittorrent.RssDownloader.updateRulesList();
window.parent.MochaUI.closeWindow(window.parent.$('removeRulePage'));
}
}
}).send();
});
});
});
</script>
</head>

<body>
<div style="padding: 10px 10px 0px 10px;">
<p>QBT_TR(Are you sure you want to remove the selected download rules?)QBT_TR[CONTEXT=AutomatedRssDownloader]</p>
<div style="text-align: right;">
<input type="button" id="cancelBtn" value="QBT_TR(No)QBT_TR[CONTEXT=MainWindow]" />
<input type="button" id="confirmBtn" value="QBT_TR(Yes)QBT_TR[CONTEXT=MainWindow]" />
</div>
</div>
</body>

</html>
1 change: 0 additions & 1 deletion src/webui/www/private/css/Tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Required by:
}

.tab-menu li {
display: block;
float: left;
margin: 0 0 5px 0;
cursor: pointer;
Expand Down
2 changes: 2 additions & 0 deletions src/webui/www/private/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ <h1 class="applicationTitle">qBittorrent Web User Interface <span class="version
<li><a id="showStatusBarLink"><img class="MyMenuIcon" src="icons/checked.svg" alt="QBT_TR(Status Bar)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Status Bar)QBT_TR[CONTEXT=MainWindow]</a></li>
<li><a id="speedInBrowserTitleBarLink"><img class="MyMenuIcon" src="icons/checked.svg" alt="QBT_TR(Speed in Title Bar)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Speed in Title Bar)QBT_TR[CONTEXT=MainWindow]</a></li>
<li class="divider"><a id="showSearchEngineLink"><img class="MyMenuIcon" src="icons/checked.svg" alt="QBT_TR(Search Engine)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Search Engine)QBT_TR[CONTEXT=MainWindow]</a></li>
<li><a id="showRssReaderLink"><img class="MyMenuIcon" src="icons/checked.svg" alt="QBT_TR(RSS)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(RSS Reader)QBT_TR[CONTEXT=MainWindow]</a></li>
<li class="divider"><a id="StatisticsLink"><img class="MyMenuIcon" src="icons/view-statistics.svg" alt="QBT_TR(Statistics)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Statistics)QBT_TR[CONTEXT=MainWindow]</a></li>
</ul>
</li>
Expand Down Expand Up @@ -112,6 +113,7 @@ <h1 class="applicationTitle">qBittorrent Web User Interface <span class="version
<ul id="mainWindowTabsList" class="tab-menu">
<li id="transfersTabLink" class="selected"><a class="tab">QBT_TR(Transfers)QBT_TR[CONTEXT=MainWindow]</a></li>
<li id="searchTabLink"><a class="tab">QBT_TR(Search)QBT_TR[CONTEXT=MainWindow]</a></li>
<li id="rssTabLink"><a class="tab">QBT_TR(RSS)QBT_TR[CONTEXT=MainWindow]</a></li>
</ul>
<div class="clear"></div>
</div>
Expand Down
78 changes: 78 additions & 0 deletions src/webui/www/private/newfeed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="${LANG}">

<head>
<meta charset="UTF-8" />
<title>QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" 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 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.closeWindows();
event.preventDefault();
},
'Esc': (event) => {
window.parent.closeWindows();
event.preventDefault();
}
}
}).activate();
window.addEvent('domready', () => {
$('feedURL').focus();
const path = decodeURIComponent(new URI().getData('path'));
$('submitButton').addEvent('click', (e) => {
new Event(e).stop();
// check field
const feedURL = $('feedURL').value.trim();
if (feedURL === '') {
alert('QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]');
Chocobo1 marked this conversation as resolved.
Show resolved Hide resolved
return;
}

$('submitButton').disabled = true;

new Request({
url: '/api/v2/rss/addFeed',
noCache: true,
method: 'post',
data: {
url: feedURL,
path: path ? (path + '\\' + feedURL) : ''
},
onSuccess: (response) => {
window.parent.qBittorrent.Rss.updateRssFeedList();
window.parent.closeWindows();
},
onFailure: (response) => {
if (response.status === 409)
alert(response.responseText);
$('submitButton').disabled = false;
}
}).send();
});
});
</script>
</head>

<body>
<div style="padding: 10px 10px 0px 10px;">
<p style="font-weight: bold;">QBT_TR(Feed URL:)QBT_TR[CONTEXT=RSSWidget]</p>
<input type="text" id="feedURL" value="" maxlength="100" style="width: 320px;" />
<div style="text-align: center; padding-top: 10px;">
<input type="button" value="QBT_TR(OK)QBT_TR[CONTEXT=HttpServer]" id="submitButton" />
</div>
</div>
</body>

</html>
77 changes: 77 additions & 0 deletions src/webui/www/private/newfolder.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="${LANG}">

<head>
<meta charset="UTF-8" />
<title>QBT_TR(Please choose a folder name)QBT_TR[CONTEXT=RSSWidget]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" 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 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.closeWindows();
event.preventDefault();
},
'Esc': (event) => {
window.parent.closeWindows();
event.preventDefault();
}
}
}).activate();
window.addEvent('domready', () => {
$('folderName').focus();
const path = decodeURIComponent(new URI().getData('path'));
$('submitButton').addEvent('click', (e) => {
new Event(e).stop();
// check field
const folderName = $('folderName').value.trim();
if (folderName === '') {
alert('QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]');
return;
}

$('submitButton').disabled = true;

new Request({
url: '/api/v2/rss/addFolder',
noCache: true,
method: 'post',
data: {
path: path ? (path + '\\' + folderName) : folderName
},
onSuccess: (response) => {
window.parent.qBittorrent.Rss.updateRssFeedList();
window.parent.closeWindows();
},
onFailure: (response) => {
if (response.status === 409)
alert(response.responseText);
$('submitButton').disabled = false;
}
}).send();
});
});
</script>
</head>

<body>
<div style="padding: 10px 10px 0px 10px;">
<p style="font-weight: bold;">QBT_TR(Folder name:)QBT_TR[CONTEXT=RSSWidget]</p>
<input type="text" id="folderName" value="" maxlength="100" style="width: 320px;" />
<div style="text-align: center; padding-top: 10px;">
<input type="button" value="QBT_TR(OK)QBT_TR[CONTEXT=HttpServer]" id="submitButton" />
</div>
</div>
</body>

</html>
Loading