Skip to content

Commit

Permalink
Merge pull request #3825 from jamesachamp/3665/bug/fix-manage-covers
Browse files Browse the repository at this point in the history
Correct undefined URL error
  • Loading branch information
mekarpeles authored Sep 22, 2020
2 parents 13228ae + 7cdb749 commit e16e52e
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions openlibrary/plugins/openlibrary/js/SearchUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ export function addModeInputsToForm($form, searchMode) {
$('input[name=\'has_fulltext\']').remove();

let url = $form.attr('action');
url = removeURLParameter(url, 'm');
url = removeURLParameter(url, 'has_fulltext');
url = removeURLParameter(url, 'subject_facet');
if (url) {
url = removeURLParameter(url, 'm');
url = removeURLParameter(url, 'has_fulltext');
url = removeURLParameter(url, 'subject_facet');

if (searchMode !== 'everything') {
$form.append('<input type="hidden" name="has_fulltext" value="true"/>');
url = `${url + (url.indexOf('?') > -1 ? '&' : '?')}has_fulltext=true`;
}
if (searchMode === 'printdisabled') {
$form.append('<input type="hidden" name="subject_facet" value="Protected DAISY"/>');
url += `${url.indexOf('?') > -1 ? '&' : '?'}subject_facet=Protected DAISY`;
}

if (searchMode !== 'everything') {
$form.append('<input type="hidden" name="has_fulltext" value="true"/>');
url = `${url + (url.indexOf('?') > -1 ? '&' : '?')}has_fulltext=true`;
$form.attr('action', url);
}
if (searchMode === 'printdisabled') {
$form.append('<input type="hidden" name="subject_facet" value="Protected DAISY"/>');
url += `${url.indexOf('?') > -1 ? '&' : '?'}subject_facet=Protected DAISY`;
}

$form.attr('action', url);
}


Expand Down

0 comments on commit e16e52e

Please sign in to comment.