Bug 25749 - "Unhighlight" action doesn't work - "Uncaught TypeError: $(...).removeHighlight is not a function"
Summary: "Unhighlight" action doesn't work - "Uncaught TypeError: $(...).removeHighlig...
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: 19.11
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-14 16:33 UTC by Eric Phetteplace
Modified: 2021-06-14 21:28 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Screenshot just after Unhighlight button was clicked (533.15 KB, image/png)
2020-06-14 16:33 UTC, Eric Phetteplace
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Phetteplace 2020-06-14 16:33:23 UTC
Created attachment 105861 [details]
Screenshot just after Unhighlight button was clicked

Steps to recreate:

  - set OpacHighlightedWords to "Highlight"
  - Search any text that yields results, then view one of the result's bib details pages
  - Search terms are highlighted
  - Select the "Unhighlight" action from the list on the right
  - Nothing happens
  - View your JavaScript console, see this error:
opac-detail.pl?biblionumber=XXXX&query_desc=books:1485 Uncaught TypeError: $(...).removeHighlight is not a function
    at highlightOff (opac-detail.pl?biblionumber=7500&query_desc=books:1485)
    ...

What's odd about this is that the highlight jQuery plugin at /opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3_19.1106000.js does appear to be loaded; it's in the list of files under Chrome's "Network" tab. If you copy-paste its contents into your JS console, then the highlight toggle works as expected. My guess is this has something to do with the plugin not being defined on the same version of jQuery that is being used in the highlightOff() function.
Comment 1 Owen Leonard 2020-06-15 11:44:44 UTC
Exactly what version are you using? I'm not able to reproduce this problem on 19.11.x
Comment 2 Eric Phetteplace 2020-06-15 16:03:46 UTC
About Koha says 19.11.06.000

You can see it in our OPAC - https://library.cca.edu/cgi-bin/koha/opac-detail.pl?biblionumber=7500&query_desc=books

We have a lot of JS in OpacUserJS, it seems like this must be a conflict introduced there but I have no idea what it could be.
Comment 3 Jonathan Druart 2020-06-16 09:13:15 UTC
Eric, you have a syntax error on a JS code that is not part of Koha.
You should contact the mailing list instead.
Comment 4 Eric Phetteplace 2020-06-16 16:29:29 UTC
My apologies, I should have investigated further before reporting this. For the record, it turned out to be a jQuery version conflict with a Tampermonkey script that was loading another jQuery without calling $.noConflict().