Wednesday, March 21, 2012

Changing Koha's default logo

Koha's system preference "opacsmallimage" has always
amused me because of its limitation of size. Most of the time it won't
fit your libraries logo.
Here I have a jquery based script that can be used in "opacuserjs"
which overcomes this limitation. While replacing Koha logo the script
also adds a "Powered by Koha" with Koha logo and a link back to the
koha-community.org site at the bottom of the page. The script takes
care to add it below any credits you might have added by using the
"opaccredits" syspref.
Here goes the script that goes in your opacuserjs syspref..

$(document).ready(function(){

var logo='http://www.anantcorp.com/images/resized/anant-logo.gif';

var bkgnd=$("#opac-main-search").css("background-color");

var frgnd=$("#moresearches").css("color");

$("#opac-main-search").find("h1").remove();

$("#opac-main-search").prepend("<a
id='#libraryname' href='/cgi-bin/koha/opac-main.pl' style='float: left;
padding: 0pt; display: inline; margin: 0em 1em 0.3em 0.1em;'><img
src="+logo+" /></a>");

$("#fluid-offset").css({ "float":"left","width":"75%" });

if($(".ft").length != 0) {

$(".ft").after("<div
id='kohacredit'><center><b
style='color:"+frgnd+";'>Powered By :</b><a
href='http://www.koha-community.org' style='text-decoration:none;'
target='_blank' > <img src='/opac-tmpl/prog/images/koha-logo.gif'
alt='Koha' ALIGN='ABSMIDDLE'
style='background:"+bkgnd+";'/>&nbsp;</a></center></div>");

}

else {

$("div#bd").after("<div
id='kohacredit'><center><b
style='color:"+frgnd+";'>Powered By :</b><a
href='http://www.koha-community.org' style='text-decoration:none;'
target='_blank' > <img src='/opac-tmpl/prog/images/koha-logo.gif'
alt='Koha' ALIGN='ABSMIDDLE'
style='background:"+bkgnd+";'/>&nbsp;</a></center></div>");

}

});

On line number two of the script you can give link to your logo.
On line three you can set the background color for the transparent Koha
logo image and on line four the color of the words "Powered by :" is
set. I have tried to read in the values of Koha OPAC's search block's
background and text color here but you can simply replace these with
your favorite colors.
Enjoy..
Regards
KK

No comments:

Post a Comment