From e991eb209e3ef9d96a4184dc447ba3b2a40100f1 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 19 Nov 2013 13:08:32 +0000 Subject: [PATCH] Bug 6149: Follow-up - Stopwords for Result Highlighting Final follow-up: Refactors code to includes to simpify future maintainability. --- .../bootstrap/en/includes/opac-highlight.inc | 27 ++++++++++++++++++++ .../bootstrap/en/modules/opac-results-grouped.tt | 17 ------------ .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 26 ++----------------- .../opac-tmpl/prog/en/includes/opac-highlight.inc | 27 ++++++++++++++++++++ .../prog/en/modules/opac-results-grouped.tt | 17 ------------ .../opac-tmpl/prog/en/modules/opac-results.tt | 25 ++---------------- 6 files changed, 58 insertions(+), 81 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-highlight.inc create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/opac-highlight.inc diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-highlight.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-highlight.inc new file mode 100644 index 0000000..9eccfc8 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-highlight.inc @@ -0,0 +1,27 @@ + + + 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 e61c879..ac8e5a4 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 @@ -341,23 +341,6 @@ $(document).ready(function(){ $("#highlight_toggle_off").show().click(function() {highlightOff();}); [% END %] }); - -function highlightOff() { - $("td").removeHighlight(); - $(".highlight_toggle").toggle(); -} -function highlightOn() { - var x; - for (x in q_array) { - 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(); -} //]]> [% END %] 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 a870be7..9aeece9 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -551,8 +551,8 @@ [% IF ( OpacStarRatings == 'all' || Koha.Preference('Babeltheque') ) %][% END %] [% IF ( OverDriveEnabled ) %][% END %] -[% IF ( OpacHighlightedWords ) %] -[% END %] + + 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 8ceec20..29c7af2 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 @@ -75,23 +75,6 @@ $(document).ready(function(){ $("#highlight_toggle_off").show().click(function() {highlightOff();}); [% END %] }); - -function highlightOff() { - $("td").removeHighlight(); - $(".highlight_toggle").toggle(); -} -function highlightOn() { - var x; - for (x in q_array) { - 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.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt index fbe7bbe..22cf75f 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -18,8 +18,8 @@ -[% IF ( OpacHighlightedWords ) %] -[% END %]