[Koha-bugs] [Bug 11602] New: Fix localcover display

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jan 23 06:26:12 CET 2014


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

            Bug ID: 11602
           Summary: Fix localcover display
 Change sponsored?: ---
           Product: Koha
           Version: 3.14
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: OPAC
          Assignee: oleonard at myacpl.org
          Reporter: vanoudt at gmail.com
        QA Contact: testopia at bugs.koha-community.org

I'm busy playing around with updating to the nice new bootstrap theme. We use
google jackets most of the time, but have some localcovers stored too. 

I want to style the localcover imgs the same as any other bookmark. Ideally,
they need a thumbnail class. But the 1px image that is returned causes
(potentially, at least in my case) things like empty borders.

Could the Locacovers.js function be modified to
a) include a class of thumbnail for the image
b) not insert the image when it is 1px in size.

The following function would do that...

    /**
     * Search all:
     *    <div title="biblionumber" id="isbn"
class="openlibrary-thumbnail"></div>
     * or
     *    <div title="biblionumber" id="isbn"
class="openlibrary-thumbnail-preview"></div>
     * and run a search with all collected isbns to Open Library Book Search.
     * The result is asynchronously returned by OpenLibrary and catched by
     * olCallBack().
     */
GetCoverFromBibnumber: function(uselink) {
       
$("div[id^=local-thumbnail],span[id^=local-thumbnail]").each(function(i) {
            var mydiv = this;
            var message = document.createElement("span");
            $(message).attr("class","no-image");
            $(message).html(NO_LOCAL_JACKET);
            $(mydiv).append(message);
            var img = $("<img />").attr('src',
                '/cgi-bin/koha/opac-image.pl?thumbnail=1&biblionumber=' +
$(mydiv).attr("class"))
                .load(function () {
                    this.setAttribute("class", "thumbnail");
                    if (!this.complete || typeof this.naturalWidth ==
"undefined" || this.naturalWidth == 0) {
                        //IE HACK
                        try {
                            $(mydiv).append(img);
                            $(mydiv).children('.no-image').remove();
                        }
                        catch(err){
                        };
                    } else if (this.width > 1) { // don't show the silly 1px
"no image" img
                        if (uselink) {
                            var a = $("<a />").attr('href',
'/cgi-bin/koha/opac-imageviewer.pl?biblionumber=' + $(mydiv).attr("class"));
                            $(a).append(img);
                            $(mydiv).empty().append(a);
                        } else {
                            $(mydiv).empty().append(img);
                        }
                        $(mydiv).children('.no-image').remove();
                    }
                })
        });
    }

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


More information about the Koha-bugs mailing list