Bugzilla – Attachment 128150 Details for
Bug 29578
Search term highlighting breaks with titles containing characters with Greek diacritics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29578: Upgrade the jQuery highlighter plugin
Bug-29578-Upgrade-the-jQuery-highlighter-plugin.patch (text/plain), 3.80 KB, created by
Thibaud Guillot (thibaud_g)
on 2021-12-02 10:48:18 UTC
(
hide
)
Description:
Bug 29578: Upgrade the jQuery highlighter plugin
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2021-12-02 10:48:18 UTC
Size:
3.80 KB
patch
obsolete
>From 036c9f8701d0bde45f832010b4e72e30bdb85de4 Mon Sep 17 00:00:00 2001 >From: Andreas Roussos <a.roussos@dataly.gr> >Date: Sat, 27 Nov 2021 07:38:44 +0100 >Subject: [PATCH] Bug 29578: Upgrade the jQuery highlighter plugin >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Under certain conditions, the jQuery term highlighter can break and >in the process actually make the "Highlight"/"Unhighlight" button >disappear altogether. This affects catalog searches in both the OPAC >and the Staff Client. > >This patch fixes that by upgrading the plugin to its latest version. > >Test plan: > >0) Catalogue two books using the titles below, one of which includes > a word ("Ïοá¿Ï") containing Greek diacritics: > Book #1 title: ΣÏÎ»Î»Î¿Î³Î®Ï ÏÏν εν εÏιÏομή Ïοá¿Ï Ïάλαι γεÏγÏαÏηθÎνÏÏν > Book #2 title: ÎÏιÏομή ÏÎ·Ï Î¹ÏÏοÏÎ¯Î±Ï ÏÏν ÎαλκανικÏν ΠολÎμÏν (1912-1913) > Then, perform a catalog search for "εÏιÏομή ÏÏν" (without the quotes). > In the results page, notice that: > a) the "Highlight"/"Unhighlight" button has disappeared, and > b) not all search terms are highlighted (e.g. "ÏÏν" in the 2nd book) >1) Apply this patch. >2) Repeat the same search (remember to press CTRL-F5 to refresh JS code). > This time the "Highlight"/"Unhighlight" button is displayed normally, > and all instances of your search terms are highlighted in the results. > >Signed-off-by: ThibaudGLT <thibaud.guillot@biblibre.com> >Work on Firefox 94.0-Ubuntu 20.04LTS >--- > .../intranet-tmpl/lib/jquery/plugins/jquery.highlight-3.js | 7 ++++--- > .../bootstrap/lib/jquery/plugins/jquery.highlight-3.js | 7 ++++--- > 2 files changed, 8 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.highlight-3.js b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.highlight-3.js >index 8eabca4bfd..578da60639 100644 >--- a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.highlight-3.js >+++ b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.highlight-3.js >@@ -1,6 +1,6 @@ > /* > >-highlight v3 >+highlight v5 > > Highlights arbitrary terms. > >@@ -19,6 +19,7 @@ jQuery.fn.highlight = function(pat) { > var skip = 0; > if (node.nodeType == 3) { > var pos = node.data.toUpperCase().indexOf(pat); >+ pos -= (node.data.substr(0, pos).toUpperCase().length - node.data.substr(0, pos).length); > if (pos >= 0) { > var spannode = document.createElement('span'); > spannode.className = 'term'; >@@ -37,9 +38,9 @@ jQuery.fn.highlight = function(pat) { > } > return skip; > } >- return this.each(function() { >+ return this.length && pat && pat.length ? this.each(function() { > innerHighlight(this, pat.toUpperCase()); >- }); >+ }) : this; > }; > > jQuery.fn.removeHighlight = function() { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js b/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js >index 8eabca4bfd..578da60639 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js >@@ -1,6 +1,6 @@ > /* > >-highlight v3 >+highlight v5 > > Highlights arbitrary terms. > >@@ -19,6 +19,7 @@ jQuery.fn.highlight = function(pat) { > var skip = 0; > if (node.nodeType == 3) { > var pos = node.data.toUpperCase().indexOf(pat); >+ pos -= (node.data.substr(0, pos).toUpperCase().length - node.data.substr(0, pos).length); > if (pos >= 0) { > var spannode = document.createElement('span'); > spannode.className = 'term'; >@@ -37,9 +38,9 @@ jQuery.fn.highlight = function(pat) { > } > return skip; > } >- return this.each(function() { >+ return this.length && pat && pat.length ? this.each(function() { > innerHighlight(this, pat.toUpperCase()); >- }); >+ }) : this; > }; > > jQuery.fn.removeHighlight = function() { >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29578
:
128034
|
128035
|
128053
|
128055
|
128067
|
128068
|
128150
|
131153
|
147088
|
147089
|
147090
|
154146
|
154494
|
154807