Lines 889-940
$(document).ready(function(){
Link Here
|
889 |
$("#highlight_toggle_off").show().click(function() {highlightOff();}); |
889 |
$("#highlight_toggle_off").show().click(function() {highlightOff();}); |
890 |
[% END %] |
890 |
[% END %] |
891 |
[% IF ( OverDriveEnabled ) %] |
891 |
[% IF ( OverDriveEnabled ) %] |
892 |
var $overdrive_results = $( '<div id="overdrive-results">' + _( 'Searching OverDrive...' ) + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' ); |
892 |
var $overdrive_results = $( '<div id="overdrive-results">' + MSG_SEARCHING.format('OverDrive') + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' ); |
893 |
$( '#numresults' ) .append( ' ' ) |
893 |
$( '#numresults' ) .append( ' ' ) |
894 |
.append( $overdrive_results ); |
894 |
.append( $overdrive_results ); |
895 |
KOHA.OverDrive.Search( "[% OverDriveLibraryID %]", querystring, 1, 0, function( data ) { |
895 |
KOHA.OverDrive.Search( "[% OverDriveLibraryID %]", querystring, 1, 0, function( data ) { |
896 |
if ( data.error ) { |
896 |
if ( data.error ) { |
897 |
$overdrive_results.html( _( 'Error searching OverDrive collection' ) ); |
897 |
$overdrive_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OverDrive') ); |
898 |
return; |
898 |
return; |
899 |
} |
899 |
} |
900 |
|
900 |
|
901 |
if ( data.totalItems ) { |
901 |
if ( data.totalItems ) { |
902 |
$overdrive_results.html( _( 'Found' ) + ' <a href="/cgi-bin/koha/opac-overdrive-search.pl?q=' + escape( querystring ) + '">' + data.totalItems + ' ' + _( 'results' ) + '</a> ' + _( 'in OverDrive collection' ) ); |
902 |
$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>' ); |
903 |
} else { |
903 |
} else { |
904 |
$overdrive_results.remove(); |
904 |
$overdrive_results.remove(); |
905 |
} |
905 |
} |
906 |
} ); |
906 |
} ); |
907 |
[% END %] |
907 |
[% END %] |
908 |
[% IF ( RecordedBooksEnabled ) %] |
908 |
[% IF ( RecordedBooksEnabled ) %] |
909 |
var $recordedbooks_results = $( '<div id="recordedbooks-results">' + _( "Searching RecordedBooks..." ) + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' ); |
909 |
var $recordedbooks_results = $( '<div id="recordedbooks-results">' + MSG_SEARCHING.format('RecordedBooks') + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' ); |
910 |
$( '#numresults' ) .append( ' ' ) |
910 |
$( '#numresults' ) .append( ' ' ) |
911 |
.append( $recordedbooks_results ); |
911 |
.append( $recordedbooks_results ); |
912 |
KOHA.RecordedBooks.search( querystring, [% OPACnumSearchResults || "null" %], null, function( data ) { |
912 |
KOHA.RecordedBooks.search( querystring, [% OPACnumSearchResults || "null" %], null, function( data ) { |
913 |
if ( data.error ) { |
913 |
if ( data.error ) { |
914 |
$recordedbooks_results.html( _( "Error searching RecordedBooks collection: %s" ).format( data.error ) ); |
914 |
$recordedbooks_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('RecordedBooks') + ': ' + data.error); |
915 |
return; |
915 |
return; |
916 |
} |
916 |
} |
917 |
|
917 |
|
918 |
// data.total can be either 42 or "60+" |
918 |
// data.total can be either 42 or "60+" |
919 |
if ( typeof(data.total) === 'string' && data.total.charAt(0) > 0 || typeof(data.total) === 'number' && data.total > 0 ) { |
919 |
if ( typeof(data.total) === 'string' && data.total.charAt(0) > 0 || typeof(data.total) === 'number' && data.total > 0 ) { |
920 |
$recordedbooks_results.html( _( "Found %s results in RecordedBooks collection" ).format('<a href="/cgi-bin/koha/opac-recordedbooks-search.pl?q=' + escape( querystring ) + '">' + data.total + '</a>') ); |
920 |
$recordedbooks_results.html( '<a href="/cgi-bin/koha/opac-recordedbooks-search.pl?q=' + escape( querystring ) + '">' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, 'RecordedBooks') + '</a>' ); |
921 |
} else { |
921 |
} else { |
922 |
$recordedbooks_results.remove(); |
922 |
$recordedbooks_results.remove(); |
923 |
} |
923 |
} |
924 |
} ); |
924 |
} ); |
925 |
[% END %] |
925 |
[% END %] |
926 |
[% IF ( OpenLibrarySearch ) %] |
926 |
[% IF ( OpenLibrarySearch ) %] |
927 |
var $openlibrary_results = $( '<div id="openlibrary-results">' + _( 'Searching Open Library...' ) + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' ); |
927 |
var $openlibrary_results = $( '<div id="openlibrary-results">' + MSG_SEARCHING.format('OpenLibrary' ) + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' ); |
928 |
$( '#numresults' ) .append( ' ' ) |
928 |
$( '#numresults' ) .append( ' ' ) |
929 |
.append( $openlibrary_results ); |
929 |
.append( $openlibrary_results ); |
930 |
KOHA.OpenLibrary.search( querystring, null, function( data ) { |
930 |
KOHA.OpenLibrary.search( querystring, null, function( data ) { |
931 |
if ( data.error ) { |
931 |
if ( data.error ) { |
932 |
$openlibrary_results.html( _( 'Error searching OpenLibrary collection' ) ); |
932 |
$openlibrary_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OpenLibrary') ); |
933 |
return; |
933 |
return; |
934 |
} |
934 |
} |
935 |
|
935 |
|
936 |
if ( data.numFound > 0 ) { |
936 |
if ( data.numFound > 0 ) { |
937 |
$openlibrary_results.html( _( 'Found' ) + ' <a href="' + KOHA.OpenLibrary.searchUrl(querystring) + '" target="openlibrary">' + data.numFound + ' ' + _( 'results' ) + '</a> ' + _( 'in OpenLibrary collection' ) ); |
937 |
$openlibrary_results.html( '<a href="' + KOHA.OpenLibrary.searchUrl(querystring) + '" target="openlibrary">' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.numFound, 'OpenLibrary') + '</a>' ); |
938 |
} else { |
938 |
} else { |
939 |
$openlibrary_results.remove(); |
939 |
$openlibrary_results.remove(); |
940 |
} |
940 |
} |