@@ -, +, @@ --- .../prog/en/modules/catalogue/results.tt | 5 +++++ .../prog/en/modules/opac-results-grouped.tt | 5 +++++ .../opac-tmpl/prog/en/modules/opac-results.tt | 5 +++++ 3 files changed, 15 insertions(+) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -96,6 +96,11 @@ $(".addtocart").show(); toHighlight = $("p,span.results_summary,a.title"); var query_desc = "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"; q_array = query_desc.split(" "); + // ensure that we don't have "" at the end of the array, which can + // break the highlighter + while (q_array.length > 0 && q_array[q_array.length-1] == "") { + q_array = q_array.splice(0,-1); + } highlightOn(); $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;}); $("#highlight_toggle_off").show().click(function() {highlightOff();}); --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt @@ -58,6 +58,11 @@ $(document).ready(function(){ [% IF ( query_desc ) %] var query_desc = "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"; q_array = query_desc.split(" "); + // ensure that we don't have "" at the end of the array, which can + // break the highlighter + while (q_array.length > 0 && q_array[q_array.length-1] == "") { + q_array = q_array.splice(0,-1); + } highlightOn(); $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;}); $("#highlight_toggle_off").show().click(function() {highlightOff();}); --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -203,6 +203,11 @@ $(document).ready(function(){ [% IF ( query_desc ) %][% IF ( OpacHighlightedWords ) %]var query_desc = "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"; q_array = query_desc.split(" "); + // ensure that we don't have "" at the end of the array, which can + // break the highlighter + while (q_array.length > 0 && q_array[q_array.length-1] == "") { + q_array = q_array.splice(0,-1); + } highlightOn(); $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;}); $("#highlight_toggle_off").show().click(function() {highlightOff();});[% END %][% END %] --