Skip to content

Commit

Permalink
Implementation for issue #267
Browse files Browse the repository at this point in the history
  • Loading branch information
craigsapp committed Feb 11, 2024
1 parent 465037e commit 07983dd
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 15 deletions.
3 changes: 2 additions & 1 deletion _includes/browse/filterByCentury.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ POPC2.prototype.filterByCentury = function (input) {
target = element.value;
}
if (target) {
this.VARS.SEARCH[type] = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.y = target.trim();
let output = [];
let re = new RegExp("^" + target);
for (let i=0; i<input.length; i++) {
Expand Down
5 changes: 2 additions & 3 deletions _includes/browse/filterByComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ POPC2.prototype.filterByComposer = function (input) {
target = element.value;
}
if (target) {
this.VARS.SEARCH.composer = target;
this.VARS.SEARCH_URL.c = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.c = target.trim();

if ((input.length == this.VARS.SEARCH_INDEX.length)
&& !this.IsEmptyObject(this.VARS.COMPOSER_INDEX)) {
Expand All @@ -48,7 +48,6 @@ POPC2.prototype.filterByComposer = function (input) {
}
}

this.VARS.SEARCH[type] = target;
let output = [];
for (let i=0; i<input.length; i++) {
let entry = input[i];
Expand Down
3 changes: 2 additions & 1 deletion _includes/browse/filterByGenre.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ POPC2.prototype.filterByGenre = function (input) {
target = element.value;
}
if (target) {
this.VARS.SEARCH[type] = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.g = target.trim();
let output = [];
let re = new RegExp("\\b" + target + "\\b");
for (let i=0; i<input.length; i++) {
Expand Down
3 changes: 2 additions & 1 deletion _includes/browse/filterByInstrument.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ POPC2.prototype.filterByInstrument = function (input) {
target = element.value;
}
if (target) {
this.VARS.SEARCH[type] = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.i = target.trim();
let output = [];
let re = new RegExp("\\b" + target + "\\b");
for (let i=0; i<input.length; i++) {
Expand Down
3 changes: 2 additions & 1 deletion _includes/browse/filterByLyrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ POPC2.prototype.filterByLyrics = function (input) {
}

if (lyricsTargets.length > 0) {
this.VARS.SEARCH[type] = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.l = target.trim();
let output = [];
for (let i=0; i<lyricsTargets.length; i++) {
let negate = false;
Expand Down
3 changes: 2 additions & 1 deletion _includes/browse/filterByMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ POPC2.prototype.filterByMode = function (input) {
target = element.value;
}
if (target) {
this.VARS.SEARCH[type] = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.m = target.trim();
let output = [];
let re;
if (target === "maj") {
Expand Down
3 changes: 2 additions & 1 deletion _includes/browse/filterByNationality.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ POPC2.prototype.filterByNationality = function (input) {
target = element.value;
}
if (target) {
this.VARS.SEARCH[type] = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.n = target.trim();
let output = [];
let re = new RegExp("\\b" + target + "\\b");
for (let i=0; i<input.length; i++) {
Expand Down
3 changes: 2 additions & 1 deletion _includes/browse/filterByPitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ POPC2.prototype.filterByPitch = function (input) {
let clean = this.sanitizePitchQuery(target);

if (clean.length > 0) {
this.VARS.SEARCH[type] = dirty;
this.VARS.SEARCH[type] = dirty.trim();
this.VARS.SEARCH_URL.p = dirty.trim();
let output = [];
let re = new RegExp(clean, "i");
for (let i=0; i<input.length; i++) {
Expand Down
5 changes: 2 additions & 3 deletions _includes/browse/filterBySiglum.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ POPC2.prototype.filterBySiglum = function (input) {
target = element.value;
}
if (target) {
this.VARS.SEARCH.siglum = target;
this.VARS.SEARCH_URL.s = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.s = target.trim();

this.VARS.SEARCH[type] = target;
let output = [];
let re = new RegExp("^" + target + "$");
for (let i=0; i<input.length; i++) {
Expand Down
3 changes: 2 additions & 1 deletion _includes/browse/filterByTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ POPC2.prototype.filterByTitle = function (input) {

target = target.trim();
if (target) {
this.VARS.SEARCH_URL.t = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.t = target.trim();
}
let pieces = target.replace(/-"/g, '"-').split(/\s*"+\s*/);
let titleTargets = [];
Expand Down
4 changes: 3 additions & 1 deletion _includes/browse/filterByTonic.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ POPC2.prototype.filterByTonic = function (input) {
target = element.value;
}
if (target) {
this.VARS.SEARCH[type] = target;
this.VARS.SEARCH[type] = target.trim();
this.VARS.SEARCH_URL.k = target.trim()

let output = [];
let re = new RegExp("^" + target, "i");
for (let i=0; i<input.length; i++) {
Expand Down

0 comments on commit 07983dd

Please sign in to comment.