Skip to content

Commit

Permalink
Handle escaped characters when filtering (#51) [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
hkalexling committed Jun 2, 2020
1 parent e214e00 commit 06fe2cc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion public/js/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ const buildTable = () => {
Object.entries(filters).forEach(([k, v]) => {
if (v === 'All') return;
if (k === 'group') {
chapters = chapters.filter(c => v in c.groups);
chapters = chapters.filter(c => {
unescaped_groups = Object.entries(c.groups).map(([g, id]) => unescapeHTML(g));
return unescaped_groups.indexOf(v) >= 0;
});
return;
}
if (k === 'lang') {
Expand Down Expand Up @@ -297,3 +300,9 @@ const buildTable = () => {
});
$('#selection-controls').removeAttr('hidden');
};

const unescapeHTML = (str) => {
var elt = document.createElement("span");
elt.innerHTML = str;
return elt.innerText;
};

0 comments on commit 06fe2cc

Please sign in to comment.