OPAC: Display Icons Based on Location
[This article was copied from the Voyager Wiki.]
You can use different icons for search results based on location rather than bib format. For example, we wanted to use a different icon for our ebooks but the bib format is not unique. Our library's ebooks have a location of "Electronic Books" so we can use javascript to change the icon based on that.
First, upload your new icon into ui/YOURSKIN/images/bibFormat/
Second, add these lines to ui/YOURSKIN/xsl/pageTools/frameWork.xsl above the </head> tag
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"/>
<script type="text/javascript" src="{$jscript-loc}local.js"/>
The first line includes the jquery library that is hosted by google. Create ui/YOURSKIN/jscripts/local.js and include the following
function setEbookIcons() {
$("div.line5Link:contains('Electronic Book')")
.parent().parent()
.siblings(".resultListIcon")
.children("img").attr("src","ui/YOURSKIN/images/bibFormat/icon_www.gif");
}
$(document).ready(function() {
setEbookIcons();
});
Simply change 'Electronic Book' to the location text you want to match against and 'icon_www.gif' to the name of your icon image.
Note: this works with version 7.1.0 . It may work with other Tomcat OPAC versions if the markup hasn't changed but I haven't tested.