From 2842310b7c0ab9e586ecf147d79fe67ea2357575 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Tue, 19 Nov 2013 12:07:59 +0000
Subject: [PATCH] [PASSED QA] Bug 6149: Follow-up [grouped] - Stopwords for
 Result Highlighting

- Added functionaility to opac-results-grouped page

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
---
 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt | 8 ++++++--
 koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt      | 6 +++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt
index c0b37f2..1023936 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt
@@ -349,8 +349,12 @@ function highlightOff() {
 function highlightOn() {
     var x;
     for (x in q_array) {
-        q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1");
-        $("td").highlight(q_array[x]);
+	    q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1");
+	    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) ) {
+		    $("td").highlight(q_array[x]);
+	    }
     }
     $(".highlight_toggle").toggle();
 }
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt
index 14faf58..9eb5045 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt
@@ -84,7 +84,11 @@ function highlightOn() {
     var x;
     for (x in q_array) {
         q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1");
-        $("td").highlight(q_array[x]);
+        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) ) {
+            $("td").highlight(q_array[x]);
+        }
     }
     $(".highlight_toggle").toggle();
 }
-- 
1.9.1