Lines 914-927
Link Here
|
914 |
var $overdrive_results = $( '<div id="overdrive-results">' + MSG_SEARCHING.format('OverDrive') + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' ); |
914 |
var $overdrive_results = $( '<div id="overdrive-results">' + MSG_SEARCHING.format('OverDrive') + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' ); |
915 |
$( '#numresults' ) .append( ' ' ) |
915 |
$( '#numresults' ) .append( ' ' ) |
916 |
.append( $overdrive_results ); |
916 |
.append( $overdrive_results ); |
917 |
KOHA.OverDrive.Search( "[% Koha.Preference('OverDriveLibraryID') | html %]", querystring, 1, 0, function( data ) { |
917 |
//Clean querystring, first we remove CCL entitits, then decode HTML entitites, then swap double quotes for single quotes |
|
|
918 |
//as the overdrive API treats double quotes as a search term and returns extra results |
919 |
od_querystring = querystring.replace(/(?:^|\W)([\w-]+)(,[\w-]+)*([:=])/g,' '); |
920 |
od_querystring = new DOMParser().parseFromString( od_querystring, 'text/html').body.innerText; |
921 |
od_querystring = od_querystring.replace(/\"/g,"'"); |
922 |
KOHA.OverDrive.Search( "[% Koha.Preference('OverDriveLibraryID') | html %]", od_querystring, 1, 0, function( data ) { |
918 |
if ( data.error ) { |
923 |
if ( data.error ) { |
919 |
$overdrive_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OverDrive') ); |
924 |
$overdrive_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OverDrive') ); |
920 |
return; |
925 |
return; |
921 |
} |
926 |
} |
922 |
|
927 |
|
923 |
if ( data.totalItems ) { |
928 |
if ( data.totalItems ) { |
924 |
$overdrive_results.html( '<a href="/cgi-bin/koha/opac-overdrive-search.pl?q=' + escape( querystring ) + '">' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.totalItems, 'OverDrive') + '</a>' ); |
929 |
$overdrive_results.html( '<a href="/cgi-bin/koha/opac-overdrive-search.pl?q=' + escape( od_querystring ) + '">' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.totalItems, 'OverDrive') + '</a>' ); |
925 |
} else { |
930 |
} else { |
926 |
$overdrive_results.remove(); |
931 |
$overdrive_results.remove(); |
927 |
} |
932 |
} |
928 |
- |
|
|