[Koha] JS Add links out to Wikipedia for authors broken in 19.11 with bug 25237

Katrin Fischer katrin.fischer.83 at web.de
Sat Sep 12 21:45:22 NZST 2020


Hi Alvaro,

please try this:

var names = $('span.author a').not('.authlink');

You might also want to take a look at how jQuery selectors work, the
documentation has a lot of examples. You need to differentiate by tags,
classes and ids in this case.

Hope this helps,

Katrin


var names = $('h5.author a').not('.authlink');



On 12.09.20 08:48, Alvaro Cornejo wrote:
> Hi
>
> After Bug 25237, the JS
> https://wiki.koha-community.org/wiki/JQuery_Library#Add_links_out_to_Wikipedia_for_authors
> stopped working.
>
> the bug changed the <h5 ...> for <span ...>
>         -     <h5 class="author">
>         +    <span class="results_summary author h3">
>
>         -                 [% IF ( author ) %]<h5 class="author">by <a
> href="/cgi-bin/koha/opac-search.pl?q=au:[% author |url %]">[% author | html
> %]</a></h5>[% END %]
>          +                [% IF ( author ) %]<span class="results_summary
> author h3">by <a class="contributors" href="/cgi-bin/koha/
> opac-search.pl?q=au:[% author |url %]">[% author | html %]</a></span>[% END
> %]
>
> among others similar changes. This breaks the JS "hook"
>
> var names = $('h5.author a').not('.authlink');
>
> How can I hook it to the <span> ?
>
> I tried several combinations like
>
>    var names = $('h3.author a').not('.authlink');
>    var names = $('result_summary.author a').not('.authlink');
>    var names = $('getElementsByClassName(' result_summary author
> h3')[1]').not('.authlink');
>
> But have not succeeded. I´m pretty sure is something trivial but didn't see
> it
>
> Regards
>
> Alvaro
>
> |----------------------------------------------------------------------------------------|
>   Stay safe / Cuídate/  Reste sécurisé
> *7* Switch off as you go / Apaga lo que no usas /  Débranchez au fur et à
> mesure.
>   *q *Recycle always / Recicla siempre / Recyclez toujours
>   P Print only if absolutely necessary / Imprime solo si es necesario /
> Imprimez seulement si nécessaire
> _______________________________________________
>
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha


More information about the Koha mailing list