Koha/koha-tmpl/opac-tmpl/lib
Andreas Roussos bee56606a6
Bug 29578: Upgrade the jQuery highlighter plugin
Under certain conditions, the jQuery term highlighter
can break and in the process make the "Highlight" /
"Unhighlight" button disappear altogether. This affects
catalog searches in both the OPAC and the Staff Client,
with UNIMARC-based instances affected the most as the
"Highlight" / "Unhighlight" button disappears if you
perform a specific OPAC search (see Test plan below).

This patch fixes that by upgrading the highlighter
plugin to its latest version for both the OPAC and
the Staff interface. Then, the changes from commit
2e4b574074 (Bug 5844) are applied to the plugin code.
Also, Koha uses "term" instead of "highlight" as the
class name for the <span> highlighting elements, so
the plugin code is modified for that aspect, too.
Finally, the plugin file is renamed to reflect the
version change (v3 -> v5) and all references to the
old filename in the Template files are updated.

Test plan:

0) In a UNIMARC instance, catalogue two books using
   the titles given below (Title subfield = 200$a):

   Book 1: Συλλογής των εν επιτομή τοῖς πάλαι γεωγραφηθέντων
   Book 2: Επιτομή της ιστορίας των Βαλκανικών Πολέμων (1912-1913)

1) OpacHighlightedWords and StaffHighlightedWords
   should both be set to "Highlight".

2) Search the OPAC for "επιτομή των" (without the
   quotes). In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) the "Highlight" / "Unhighlight" button vanishes
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

3) Repeat the same search in the Staff interface.
   In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) Even though some terms are highlighted, the
      button still says "Highlight"
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

4) Apply this patch.

5) Repeat the searches (you may have to press CTRL-F5
   to reload the JavaScript code). This time the
   "Highlight" / "Unhighlight" button is displayed
   in the OPAC, and all your search terms should be
   highlighted in yellow. Toggling the highlight
   should cause no problems, and there shouldn't be
   any errors logged in your browser's Console.

Signed-off-by: Christian Nelson <christian.nelson@uwasa.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-08-29 14:37:09 -03:00
..
bootstrap/js Bug 32998: Consolidate opac-tmpl/lib and opac-tmpl/bootstrap/lib 2023-04-13 11:47:57 -03:00
Chocolat Bug 28180: (follow-up) Updates to styling of lightbox controls 2021-10-21 12:24:04 +02:00
dayjs Bug 30310: Add missing utc plugin 2023-01-31 10:19:45 -03:00
emoji-picker Bug 25350: Load Emoji picker assets more efficiently 2020-05-04 09:44:45 +01:00
famfamfam Bug 32998: Consolidate opac-tmpl/lib and opac-tmpl/bootstrap/lib 2023-04-13 11:47:57 -03:00
flatpickr Bug 29212: Use Flatpickr on OPAC pages 2022-01-31 21:55:40 -10:00
fontawesome Bug 32910: (follow-up) Remove unused Font Awesome assets 2023-06-12 11:52:12 -03:00
greybox Bug 32998: Consolidate opac-tmpl/lib and opac-tmpl/bootstrap/lib 2023-04-13 11:47:57 -03:00
jquery Bug 29578: Upgrade the jQuery highlighter plugin 2023-08-29 14:37:09 -03:00
js-cookie Bug 29940: Phase out jquery.cookie.js in the OPAC 2022-03-22 10:17:34 -10:00
kjua
verovio
enquire.js Bug 32998: Consolidate opac-tmpl/lib and opac-tmpl/bootstrap/lib 2023-04-13 11:47:57 -03:00
enquire.min.js Bug 32998: Consolidate opac-tmpl/lib and opac-tmpl/bootstrap/lib 2023-04-13 11:47:57 -03:00
fontfaceobserver.min.js Bug 32998: Consolidate opac-tmpl/lib and opac-tmpl/bootstrap/lib 2023-04-13 11:47:57 -03:00
hc-sticky.js
media.match.js Bug 32998: Consolidate opac-tmpl/lib and opac-tmpl/bootstrap/lib 2023-04-13 11:47:57 -03:00
media.match.min.js Bug 32998: Consolidate opac-tmpl/lib and opac-tmpl/bootstrap/lib 2023-04-13 11:47:57 -03:00