[Koha-bugs] [Bug 7594] Google Cover CSS suggestions

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Mar 6 22:01:54 CET 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7594

--- Comment #2 from Owen Leonard <oleonard at myacpl.org> ---
(In reply to comment #0)
> In google-jackets.js there is hard coded "style" on line 48 using...
> http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=koha-tmpl/opac-
> tmpl/prog/en/js/google-jackets.js;h=70b1b84337c4c3807cd8e1997a2fda6cd9563004;
> hb=HEAD

The line in question reads:

$("."+book.bib_key).each(function() {

This is the script's way of looping over elements with that particular class
(i.e. any title with that same ISBN.). There is nothing at that line which sets
a hard-coded style.

There is an invalid style hard-coded in opac-results.tt at line 542 and 543 (in
master):

<div style="block"...

The correct way to say that would be <div style="display:block"... but that is
redundant for divs, so I recommend we remove the style attribute.

> Finally, the "No Image Available" does not appear in the HTML source code.

It does in two places. In the template (opac-results.tt) it is output if the
record has no ISBN:

[% IF ( SEARCH_RESULT.normalized_isbn ) %]...[% ELSE %]
<span class="no-image">No cover image available</span>[% END %]

Then the various scripts output the same thing if they don't return an image.
For instance, in google-jackets.js:

    var message = document.createElement("span");
    $(message).attr("class","no-image");
    $(message).html(NO_GOOGLE_JACKET);
    $(this).append(message);

This creates the <span> element, adds the "no-image" class, fills the tag with
the NO_GOOGLE_JACKET message (specified in opac-result.tt) and appends the
newly-built <span> to the <div>.

The "no-image" class can be modified globally, but if you want multiple cover
sources enabled at the same time and want the messages styled differently
you'll have to add another class as well, both in the JS and the template:

    $(message).attr("class","no-image google");

Then your custom stylesheet could address it:

span.no-image.google { border: 3px dotted blue; }

And you could write some JS for OpacUserJS to change the message using that
class to target it.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list