From 65d58b4ac0f7b56a590213619d10f2e0f0959f46 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 28 Oct 2013 12:12:30 +0000 Subject: [PATCH] Bug 6149: Follow-up - Stopwords for Result Highlighting (Bootstrap) --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 10 +++++++--- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 8b7cfdd..3c0947b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1269,9 +1269,13 @@ var x; for (x in q_array) { q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1"); - $(".title").highlight(q_array[x]); - $(".author").highlight(q_array[x]); - $(".results_summary").highlight(q_array[x]); + q_array[x] = q_array[x].toLowerCase(); + var myStopwords = "[% Koha.Preference('HighlightedStopWords') %]".toLowerCase().split('|'); + if( $.inArray(q_array[x], myStopwords) == -1 ) { + $(".title").highlight(q_array[x]); + $(".author").highlight(q_array[x]); + $(".results_summary").highlight(q_array[x]); + } } $(".highlight_toggle").toggle(); } diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 2ad3029..a870be7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -648,7 +648,9 @@ function highlightOn() { var x; for (x in q_array) { q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1"); - if ( q_array[x].length > 0 ) { + q_array[x] = q_array[x].toLowerCase(); + var myStopwords = "[% Koha.Preference('HighlightedStopWords') %]".toLowerCase().split('|'); + if ( (q_array[x].length > 0) && ($.inArray(q_array[x], myStopwords) == -1) ) { $(".title").highlight(q_array[x]); $(".author").highlight(q_array[x]); $(".results_summary").highlight(q_array[x]); -- 1.7.10.4