Skip to content

Commit 6cf7a7c

Browse files
authored
Add exclude list (#83)
1 parent f1702be commit 6cf7a7c

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

ui/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ <h1 id="title">PC-Miner</h1>
104104
<td>
105105
<div id="wordCloud" style="width: 400px; height: 175px; margin-left: 10%;"></div>
106106
</td>
107+
<td>
108+
<div style="margin-left: 120px;">
109+
<label for="excludeTextBox">Exclude list:</label><br>
110+
<textarea id="excludeTextBox" rows="10" cols="40" style="font-family: Arial;"></textarea><br>
111+
<button onclick="pcminer.updateExcluded(document.getElementById('excludeTextBox').value)">Update</button>
112+
</div>
113+
</td>
107114
</tr>
108115
</table>
109116

ui/js/code.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ var pcminer = (function () {
406406
'<span float="left">' + nrC + " committee records selected</span>";
407407
}
408408

409-
// Updated decodeHtml function using DOMParser
410409
function decodeHtml(html) {
410+
html = html.replace("&oslash;", "o");
411411
const parser = new DOMParser();
412412
const doc = parser.parseFromString(html, "text/html");
413413
return doc.documentElement.textContent;
@@ -427,7 +427,6 @@ var pcminer = (function () {
427427

428428
function nameStartsWith(fullName, prefix) {
429429
// Decode HTML entities (e.g. converting "&oslash;" into "ø").
430-
fullName = fullName.replace("&oslash;", "o");
431430
const decodedFullName = decodeHtml(fullName);
432431

433432
// Split the decoded name into words and filter out any empty strings.
@@ -461,11 +460,15 @@ var pcminer = (function () {
461460
clip.append("<p>");
462461
for (var i = 0; i < list.length; i++) {
463462
var x = list[i];
464-
if (nameFilter == "" || nameStartsWith(x.author, nameFilter)) {
463+
const author = x.author;
464+
if (
465+
(nameFilter == "" || nameStartsWith(author, nameFilter)) &&
466+
!excluded.has(normalizeString(decodeHtml(author)))
467+
) {
465468
if (nrPublicationsAndCommittees(x) > 0 && eval(conditionFilter)) {
466469
// evil call to eval()
467-
selector.append("<option>" + x.author + "</option>");
468-
clip.append(x.author + ","); //REJ
470+
selector.append("<option>" + author + "</option>");
471+
clip.append(author + ","); //REJ
469472
for (var j = 0; j < x.committees.length; j++) {
470473
clip.append(
471474
x.committees[j].conference.series +
@@ -694,6 +697,14 @@ var pcminer = (function () {
694697
}
695698
}
696699

700+
var excluded = new Set();
701+
702+
function updateExcluded(input) {
703+
const excludedList = input.split("\n").map(normalizeString);
704+
excluded = new Set(excludedList);
705+
resetSelector();
706+
}
707+
697708
function encodeForUrl(input) {
698709
// Decode HTML entities first
699710
const doc = new DOMParser().parseFromString(input, "text/html");
@@ -934,6 +945,7 @@ var pcminer = (function () {
934945
confSelected: confSelected,
935946
confsSelected: confsSelected,
936947
copyToClipboard: copyToClipboard,
948+
updateExcluded: updateExcluded,
937949
main: main,
938950
};
939951
})();

0 commit comments

Comments
 (0)