Skip to content

Commit 7374a2f

Browse files
author
Nemesis
committed
(DEV) Blacklisting
1 parent 32d4a10 commit 7374a2f

File tree

3 files changed

+62
-18
lines changed

3 files changed

+62
-18
lines changed

src/assets/css/index.css

+16-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@
1414
background-color: #242424;
1515
}
1616

17-
body::-webkit-scrollbar {background-color: #242424; width: 0.5em;}
18-
body::-webkit-scrollbar-thumb {background-color: #6688EC;}
19-
ul.sidenav::-webkit-scrollbar {background-color: #242424; width: 0.5em;}
20-
ul.sidenav::-webkit-scrollbar-thumb {background-color: #6688EC;}
21-
ul#dropdownTagsParent::-webkit-scrollbar {background-color: #242424; width: 0.5em;}
22-
ul#dropdownTagsParent::-webkit-scrollbar-thumb {background-color: #6688EC;}
17+
*::-webkit-scrollbar {background-color: #242424; width: 0.5em;}
18+
*::-webkit-scrollbar-thumb {background-color: #6688EC;}
2319
::selection {background: #FFF;}
2420

2521
body {
@@ -128,6 +124,20 @@ div#loading {
128124
filter: brightness(80%)
129125
}
130126

127+
.modal h1 {
128+
font-weight: 600;
129+
margin: 0;
130+
}
131+
132+
.modal .modalClose {
133+
display: flex;
134+
justify-content: center;
135+
margin-top: 24px;
136+
}
137+
138+
.modal .input-field {
139+
margin-top: 2rem;
140+
}
131141

132142
/*
133143
* MATERIALIZE CSS

src/index.html

+26-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<li><a class="subheader">Settings</a></li>
5555
<li><a onclick="dontExist()" class="waves-effect"><i class="material-icons left">favorite</i>Favorites</a></li>
5656
<li><a onclick="dontExist()" class="waves-effect"><i class="material-icons left">folder</i>Change download folder</a></li>
57-
<li><a onclick="dontExist()" class="waves-effect"><i class="material-icons left">label</i>Exclude tags</a></li>
57+
<li><a onclick="openBlacklistModal()" class="waves-effect modal-trigger"><i class="material-icons left">label</i>Exclude tags</a></li>
5858
<li><a onclick="dontExist()" class="waves-effect"><i class="material-icons left">library_add</i>Add sources</a></li>
5959
<li><a onclick="handleTheme()" id="displayTheme" class="waves-effect"><i class="material-icons left">invert_colors</i>Enable light theme</a></li>
6060
<li><div class="divider"></div></li>
@@ -110,6 +110,31 @@
110110
</ul>
111111
</ul>
112112
<!-- [End Sidenav with image details ] -->
113+
114+
<!-- Blacklist tags modal -->
115+
<div id="blacklist" class="modal">
116+
<div class="modal-content">
117+
<div class="row">
118+
119+
<div class="col s12 center">
120+
<h1>Your Blacklist</h1>
121+
</div>
122+
123+
<div class="col s10 offset-s1 modalInput">
124+
<div class="input-field">
125+
<textarea id="blacklistTags" class="materialize-textarea"></textarea>
126+
<label for="blacklistTags">Enter blacklisted tags separated with space</label>
127+
</div>
128+
</div>
129+
130+
<div class="modalClose col s10 offset-s1">
131+
<a href="#" onclick="updateBlacklist()" class="modal-action modal-close waves-effect btn">Update Blacklist</a>
132+
</div>
133+
134+
</div>
135+
</div>
136+
</div>
137+
<!-- [End Blacklist tags modal] -->
113138

114139
</main>
115140
<!-- [END MAIN] -->

src/renderer.js

+20-11
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
rating = "rating:safe",
2828
imgLimit = 10,
2929
view = 'one_column'
30-
pid = 1;
30+
pid = 1,
31+
blacklistTags;
3132

3233
// Store
3334

@@ -100,6 +101,20 @@ var lastTheme = store.get('theme');
100101
getResults(url);
101102
}
102103

104+
function openBlacklistModal()
105+
{
106+
const blacklistModal = document.querySelector('#blacklist.modal');
107+
const instanceBlacklistModal = M.Modal.init(blacklistModal);
108+
instanceBlacklistModal.open();
109+
}
110+
111+
function updateBlacklist()
112+
{
113+
blacklistTags = document.getElementById('blacklistTags').value;
114+
blacklistTags.split(' ');
115+
console.log(blacklistTags);
116+
}
117+
103118
// Sidenav image details
104119

105120
function openImageDetails(event)
@@ -129,7 +144,7 @@ var lastTheme = store.get('theme');
129144
});
130145
// Open sidenav
131146
const sidenavImageDetails = document.querySelector('#sidenavImageDetails.sidenav');
132-
var instanceSidenavImageDetails = M.Sidenav.init(sidenavImageDetails);
147+
const instanceSidenavImageDetails = M.Sidenav.init(sidenavImageDetails);
133148
instanceSidenavImageDetails.open();
134149
}
135150

@@ -299,7 +314,6 @@ var lastTheme = store.get('theme');
299314

300315
// Handle links
301316
document.addEventListener('click', (event) => {
302-
console.log(event);
303317
if (event.target.tagName === 'A')
304318
{
305319
if (event.target.href.startsWith('https://gelbooru.com/') || event.target.href.startsWith('https://github.com/'))
@@ -410,15 +424,10 @@ function getUrl(tags = '', imgLimit = 10, rating = 'rating:safe', pid = 1)
410424
var url = `https://gelbooru.com/index.php?page=dapi&s=post&q=index&json=1&limit=${imgLimit}`;
411425
if (tags != '')
412426
{
413-
if (tags.includes('webm'))
414-
{
415-
url += `&tags=${tags.replace(/\s/g, '+')}`;
416-
url += `+${rating}`;
417-
}
418-
else
427+
url += `&tags=${tags.replace(/\s/g, '+')}+${rating}+${blacklistTags}`;
428+
if (!tags.includes('webm'))
419429
{
420-
url += `&tags=${tags.replace(/\s/g, '+')}`;
421-
url += `+${rating}+-webm`;
430+
url += `+-webm`;
422431
}
423432
}
424433
else

0 commit comments

Comments
 (0)