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

introduce light/dark theme responsiveness #9

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
24 changes: 12 additions & 12 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@
### Clone this repo (Windows)
1. Clone or download this repo as a .ZIP
2. Move it somewhere where qBittorrent can find it.
3. Ensure you use a trailing slash.

### Clone this repo (Linux)
1. `cd /opt`
2. `sudo git clone https://github.com/repslet/nightwalker.git`
3. `sudo chmod -R 777 nightwalker`
1. `sudo git clone https://github.com/brettpetch/nightwalker.git /opt/nightwalker`
3. `sudo chown -R nobody:nogroup /opt/nightwalker/`

### Activate Alterative WebUI in qBittorrent
1. Under `Tools->Preferences->WebUI` enable `Use alternative WebUI`.
2. Choose a location that points to the `Nightwalker` folder, i.e. `/opt/nightwalker`
2. Choose a location that points to the `nightwalker` folder, i.e. `/opt/nightwalker/`
3. Restart qBittorrent or refresh your browser for changes to take effect.

You can also change these settings via the config file. The relevant entries are:

- WebUI\AlternativeUIEnabled=true
- WebUI\RootFolder=/path/to/Nightwalker
- `WebUI\AlternativeUIEnabled=true`
- `WebUI\RootFolder=/opt/nightwalker/`

### Update theme (Linux)
1. `cd /opt/nightwalker`
2. `git checkout main`
3. `git fetch origin main`
4. `git reset --hard origin/main`
1. `git -C /opt/nightwalker checkout main`
2. `git -C /opt/nightwalker fetch origin main`
3. `git -C /opt/nightwalker reset --hard origin/main`
4. `sudo chown -R nobody:nogroup /opt/nightwalker`

### Tested
Based on the standard qBittorrent WebUI theme (4.3.2 release).
Tested in 4.3.1 and 4.3.2
Based on the standard qBittorrent WebUI theme (4.3.8 release).
Tested in Updated to 4.3.8

#### A note for those who used the [Theme Park][theme.park] nginx mod
Modify your nginx config and remove the lines that introduced the external css, anything after `rewrite ^/qbittorrent/(.*) /$1 break; ` (non inclusive) is something that can be removed. Do not leave -modded, or any other files that are not necessary for nginx to function in the `/etc/nginx/apps/` directory. Reload nginx after making changes by doing `sudo service nginx configtest`, if it returns OK, then proceed and do `sudo service nginx reload`.
Expand Down
116 changes: 59 additions & 57 deletions private/addpeers.html
Original file line number Diff line number Diff line change
@@ -1,70 +1,72 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/nightwalker.css?v=${CACHEID}" />
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
<script>
'use strict';

new Keyboard({
defaultEventType: 'keydown',
events: {
'Escape': function(event) {
window.parent.closeWindows();
event.preventDefault();
},
'Esc': function(event) {
window.parent.closeWindows();
event.preventDefault();
}
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/nightwalker.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>
'use strict';

new Keyboard({
defaultEventType: 'keydown',
events: {
'Escape': function(event) {
window.parent.closeWindows();
event.preventDefault();
},
'Esc': function(event) {
window.parent.closeWindows();
event.preventDefault();
}
}).activate();
}
}).activate();

window.addEvent('domready', function() {
const hash = new URI().getData('hash');
if (!hash)
return false;
window.addEvent('domready', function() {
const hash = new URI().getData('hash');
if (!hash)
return false;

$('peers').focus();
$('peers').focus();

$('addPeersOk').addEvent('click', function(e) {
new Event(e).stop();
$('addPeersOk').addEvent('click', function(e) {
new Event(e).stop();

const peers = $('peers').get('value').trim().split(/[\r\n]+/);
if (peers.length === 0)
return
const peers = $('peers').get('value').trim().split(/[\r\n]+/);
if (peers.length === 0)
return

new Request({
url: 'api/v2/torrents/addPeers',
method: 'post',
data: {
hashes: hash,
peers: peers.join('|')
},
onFailure: function() {
alert("QBT_TR(Unable to add peers. Please ensure you are adhering to the IP:port format.)QBT_TR[CONTEXT=HttpServer]");
},
onSuccess: function() {
window.parent.closeWindows();
}
}).send();
});
new Request({
url: 'api/v2/torrents/addPeers',
method: 'post',
data: {
hashes: hash,
peers: peers.join('|')
},
onFailure: function() {
alert("QBT_TR(Unable to add peers. Please ensure you are adhering to the IP:port format.)QBT_TR[CONTEXT=HttpServer]");
},
onSuccess: function() {
window.parent.closeWindows();
}
}).send();
});
</script>
</head>
});
</script>
</head>

<body>
<div style="padding: 10px 10px 0px 10px;">
<p>QBT_TR(List of peers to add (one IP per line):)QBT_TR[CONTEXT=PeersAdditionDialog]</p>
<textarea id="peers" rows="10" style="width: 100%;" placeholder="QBT_TR(Format: IPv4:port / [IPv6]:port)QBT_TR[CONTEXT=PeersAdditionDialog]"></textarea>
<div style="margin-top: 10px; text-align: center;">
<button onclick="parent.closeWindows();">QBT_TR(Cancel)QBT_TR[CONTEXT=PeersAdditionDialog]</button>
<button id="addPeersOk">QBT_TR(Ok)QBT_TR[CONTEXT=PeersAdditionDialog]</button>
</div>
<body>
<div style="padding: 10px 10px 0px 10px;">
<p>QBT_TR(List of peers to add (one IP per line):)QBT_TR[CONTEXT=PeersAdditionDialog]</p>
<textarea id="peers" rows="10" style="width: 100%;" placeholder="QBT_TR(Format: IPv4:port / [IPv6]:port)QBT_TR[CONTEXT=PeersAdditionDialog]"></textarea>
<div style="margin-top: 10px; text-align: center;">
<button onclick="parent.closeWindows();">QBT_TR(Cancel)QBT_TR[CONTEXT=PeersAdditionDialog]</button>
<button id="addPeersOk">QBT_TR(Ok)QBT_TR[CONTEXT=PeersAdditionDialog]</button>
</div>
</body>
</div>
</body>

</html>
8 changes: 4 additions & 4 deletions private/addtrackers.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<title>QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDialog]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/nightwalker.css?v=${CACHEID}" />
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
<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>
'use strict';

Expand Down Expand Up @@ -48,10 +48,10 @@

<body>
<div style="text-align: center;">
<br/>
<br />
<h2 class="vcenter">QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDialog]</h2>
<textarea name="list" id="trackersUrls" rows="10" cols="1"></textarea>
<br/>
<br />
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addTrackersButton" />
</div>
</body>
Expand Down
8 changes: 4 additions & 4 deletions private/confirmdeletion.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<title>QBT_TR(Deletion confirmation - qBittorrent)QBT_TR[CONTEXT=confirmDeletionDlg]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/nightwalker.css?v=${CACHEID}" />
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
<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>
'use strict';

Expand Down Expand Up @@ -43,10 +43,10 @@
</head>

<body>
<br/>
<br />

<p>&nbsp;&nbsp;QBT_TR(Are you sure you want to delete the selected torrents from the transfer list?)QBT_TR[CONTEXT=HttpServer]</p>
&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="deleteFromDiskCB" /> <label for="deleteFromDiskCB"><i>QBT_TR(Also delete the files on the hard disk)QBT_TR[CONTEXT=confirmDeletionDlg]</i></label><br/><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="deleteFromDiskCB" /> <label for="deleteFromDiskCB"><i>QBT_TR(Also delete the files on the hard disk)QBT_TR[CONTEXT=confirmDeletionDlg]</i></label><br /><br />
<div style="text-align: right;">
<input type="button" id="cancelBtn" value="QBT_TR(No)QBT_TR[CONTEXT=MainWindow]" />&nbsp;&nbsp;<input type="button" id="confirmBtn" value="QBT_TR(Yes)QBT_TR[CONTEXT=MainWindow]" />&nbsp;&nbsp;
</div>
Expand Down
8 changes: 4 additions & 4 deletions private/confirmfeeddeletion.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<title>QBT_TR(Deletion confirmation)QBT_TR[CONTEXT=RSSWidget]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/nightwalker.css?v=${CACHEID}" />
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
<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>
'use strict';

window.addEvent('domready', () => {
const paths = decodeURIComponent(new URI().getData('paths')).split('|');
const paths = new URI().getData('paths').split('|');
$('cancelBtn').focus();
$('cancelBtn').addEvent('click', (e) => {
new Event(e).stop();
Expand All @@ -27,7 +27,7 @@
noCache: true,
method: 'post',
data: {
path: path
path: decodeURIComponent(path)
},
onComplete: (response) => {
++completionCount;
Expand Down
8 changes: 4 additions & 4 deletions private/confirmruleclear.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<title>QBT_TR(Clear downloaded episodes)QBT_TR[CONTEXT=AutomatedRssDownloader]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/nightwalker.css?v=${CACHEID}" />
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
<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>
'use strict';

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

$('cancelBtn').focus();
$('cancelBtn').addEvent('click', (e) => {
Expand All @@ -23,7 +23,7 @@
new Event(e).stop();
let completionCount = 0;
rules.forEach((rule) => {
window.parent.qBittorrent.RssDownloader.modifyRuleState(rule, 'previouslyMatchedEpisodes', [], () => {
window.parent.qBittorrent.RssDownloader.modifyRuleState(decodeURIComponent(rule), 'previouslyMatchedEpisodes', [], () => {
++completionCount;
if (completionCount === rules.length) {
window.parent.qBittorrent.RssDownloader.updateRulesList();
Expand Down
8 changes: 4 additions & 4 deletions private/confirmruledeletion.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<title>QBT_TR(Rule deletion confirmation)QBT_TR[CONTEXT=AutomatedRssDownloader]</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/nightwalker.css?v=${CACHEID}" />
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
<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>
'use strict';

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

$('cancelBtn').focus();
$('cancelBtn').addEvent('click', (e) => {
Expand All @@ -28,7 +28,7 @@
noCache: true,
method: 'post',
data: {
ruleName: rule
ruleName: decodeURIComponent(rule)
},
onComplete: (response) => {
++completionCount;
Expand Down
1 change: 0 additions & 1 deletion private/css/Layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ li.divider {
div.toolbox.divider { /* Have to specify div here for IE6's sake */
background: url(../images/toolbox-divider.gif) repeat-y;
padding-left: 8px;
display: none;
}

.toolbox img.disabled {
Expand Down
Loading