JQuery Library

From Koha Wiki

Jump to: navigation, search
Home > Documentation
Home > Documentation
Resources
Tips & Tricks > Tips & Tricks/Customising Notices and Slips > Tips & Tricks

JQuery modifications are a great way to customize the look and feel of your Koha install. There are a few tips to remember when writing JQuery modifications:

  • For the staff side, all JQuery statements go in the IntranetUserJS system preference
  • For the OPAC, all JQuery statements go in the OPACUserJS system preference
  • You must include
     $(document).ready(function(){ <multiple statements go here> });
    inside the preference, around your statements. Examples listed below are considered "statements."
  • Clients must have Javascript enabled in their browsers for these changes to take effect.


Contents

Template

Developers: Please use the following template to add your JQuery statements to the wiki.

JQuery Title

  • Developer: Name of JQuery developer
  • Creation Date: the date you entered the script (YYYY-MM-DD)
  • Purpose: Purpose of the JQuery script
  • Status: Completed / In progress
  • Intranet or OPAC?:
  • Version: (The Koha version you are using this with, or Any, if applicable)
  Some JQuery code



Intranet JQuery Statements

Hide a dataTable column

  • Developer: Kyle M Hall
  • Purpose: To hide a column of a dataTable with jQuery
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any

In this example, we are hiding the 3rd column ("base-level allocated") of the budgets table in acquisitions

$( document ).ready(function() {
 $('#budgeth').on( 'init.dt', function () {
    $('#budgeth').dataTable().fnSetColumnVis( 4, false );
 });
});

Uncheck renew by default

  • Developer: Kyle M Hall
  • Purpose: Stop renew checkboxes from being checked by default on check out page
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
$( document ).ready(function() {
 $('#issues-table').on( 'init.dt', function () {
   $('.renew').attr('checked', false);
 });
});

Hide patron messages for library

  • Developer: Kyle M Hall
  • Purpose: To hide non-public patron messages from rubbernecking patrons, displaying the message only after clicking a "Show message" link
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
$(document).ready(function(){
  if (window.location.href.indexOf("circ/circulation.pl") > -1) {
    $("#messages .circ-hlt i").addClass("hidden-message").hide();
    $("#messages .circ-hlt i").parent().append("<a class='show-hidden-message' href=''>[Show Message]</a>");
    $(".show-hidden-message").on('click', function() {
      $(this). parent().children('.hidden-message').show();
      $(this). parent().children('.show-hidden-message').hide();
      return false;
    });
  }
});

Set all library pulldowns to the logged in library

  • Developer: Kyle M Hall
  • Purpose: To set all library pulldowns to the logged in library by default
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  $( document ).ready(function() {
    var library_name = $.trim($('#drop3 strong').text());
    $(document.body).find('option').filter(function(index) {
        return library_name === $(this).text();
    }).attr("selected", "selected")
  });

Modify Labels on memberentry.pl (Patron edit screen)

  • Developer: Liz Rea (NEKLS)
  • Purpose: To change phone/email labels from Home/Mobile Phone to Phone/Email (primary) and Phone/Email (secondary). Also adds a helpful tip as to which field will be printed on transit slips.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  $("#memberentry_contact label[for='phone']").html("Primary Phone :");
  $("#memberentry_contact label[for='email']").html("Primary Email :");
  $("#memberentry_contact label[for='emailpro']").html("Alternate Email :");
  $("#memberentry_contact li:contains('Primary Phone')").append("<strong><em> Shows on transit slips</em></strong>");
  $("#memberentry_contact li:contains('Primary Email')").append("<strong><em> Shows on transit slips</em></strong>");

This second bit changes the labels on the patron detail page:

 $("#patron-information .label:contains('Home:')").html('Primary Phone:');
 $("#patron-information .label:contains('Work:')").html('Alternate Phone:');
 $("#patron-information .label:contains('Email (work):')").html('Alternate Email:');
 $("#patron-information .label:contains('Email (home):')").html('Primary Email:');


Style required Patron Attribute as Required

  • Developer: Owen Leonard with Nicole Engard
  • Purpose: You can mark an attribute required in the system preferences, but it doesn't highlight it in red. This will add the required class to the attribute.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
//style attribute in red since it's required
 $("#memberentry_patron_attributes label[for='patron_attr_4']").addClass("required");

Relabel Sort1 on Patron Record

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: This will allow you to relabel the sort 1 field on the patron add form and patron display to 'Jurisdiction' (just replace with your own label).
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
 $("#memberentry_library_management label[for='sort1']").html("Jurisdiction:");
 $("#patron-library-details .label:contains('Sort field 1:')").html('Jurisdiction:');
 $("fieldset.rows label[for='sort1']").html("Jurisdiction:");

Remove Upcoming Events row from the messaging preferences table

  • Developer: Liz Rea (NEKLS)
  • Purpose: Remove the Upcoming Events row from the messaging prefs table. This was confusing because upcoming events notification requires additional software, but was always offered even if the additional software wasn't installed. This JQuery removes that row in the preferences table.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  $("#memberentry_messaging_prefs tr:contains('Upcoming Events')").empty();
  $("#patron-messaging-prefs tr:contains('Upcoming Events')").empty();


Remove Return All functionality from check out screen/Patron Detail page

  • Developer: Liz Rea (NEKLS)
  • Purpose: Since the Return All functionality is only partially complete (it doesn't process holds correctly when used, a big problem in our system) we have chosen to remove the column for Return all, and the associated button.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  $("#finesholdsissues #issuest").find("tbody td:last-child,thead th:last-child").hide();
  $("#finesholdsissues").find('input[id=return_all]').hide();
  $("#patronlists #issuest").find("tbody td:last-child,thead th:last-child").hide();


Remove Delete link from the News items on the Staff home screen

  • Developer: Liz Rea (NEKLS)
  • Purpose: Some of our librarians were deleting news items, we wanted to remove the link.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
 $(".newsfooter a:contains('Delete')").hide();


Adds Focus to Cataloging Search

  • Developer: Liz Rea (NEKLS)
  • Purpose: The cataloging search didn't seem to get focus after adding a bib. This adds that functionality.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.0.x (afaik)
  $("#addbooks_search input[name=q]:eq(0)").focus();


Hide a field on Patron detail screen

  • Developer: Liz Rea (NEKLS)
  • Purpose: Hide a desired field on the Patron detail screen
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  $("#patron-information li:contains('Mobile:')").hide();


Hide left side menu on given page in staff client to have more space for contents

  • Developer: Marc Véron
  • Purpose: Hide th menu in the left column to get more space for big table e.g. in Administration->Circulation and fine rules
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
 if ((""+window.location).indexOf("smart-rules.pl")>=0) {
     $("#navmenu").hide();
     $(".yui-t1 #yui-main .yui-b").css("margin-left", "1em"); 
 }

Change the staff client's "Change Password" field to password type input

  • Developer: Owen Leonard (Nelsonville Public Library)
  • Purpose: Change the staff client's "Change Password" field to password type input. Useful if your staff client terminal is viewable by the public. This also removes Koha's default "suggested password" from the field.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.2
  $(document).ready(function(){
  $("#newpassword").parent().append("<input type=\"password\" value=\"\" size=\"20\" id=\"newpassword\" name=\"newpassword\">").end().remove();
  });


Add additional searches to Intranet

  • Developer: Magnus Enger, but based on "Add additional searches to OPAC" by Jared Camins-Esakov above
  • Purpose: Adds additional searches to the Intranet Search type dropdown, in a specific place in the drop down
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  • Note: The goal here is to add the Dewey index after the "Subject as Phrase" index, and indent it to the same level as that index. Since matching is done on the values of elements in the list of options (and not on the text labels) this should work across translations too.
  $('option[value="su,phr"]').after("<option value='Dewey-classification'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dewey</option>");


Remove link to Holds to pull page

  • Developer: Ian Walls
  • Purpose: Removes "Holds to pull" link from the circulation page
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  • Note: Often, the Holds to pull list is deprecated for library use vs. the Holds Queue. This query removes the link in an effort to remove staff confusion. Sponsored by MassCat.
 $("ul li:contains('Holds to pull')").remove();


Streamline Import Patrons page

  • Developer: Daniel Grobani
  • Purpose: removes unneeded fields and sets desired values
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: LLEK 4.0200019
  // remove "default values" fieldset
  $('form[action] legend:contains("Default values")').parent().remove();
 
  // set record matching field to ID
  $('fieldset:has(legend:contains("Field to use for record matching")) #matchpoint').val("ID");
 
  // overwrite matching record
  $('#overwrite_cardnumberno').attr('checked', 'false');
  $('#overwrite_cardnumberyes').attr('checked', 'true');
 
  // replace only included extended attributes
  $('#ext_preserve_0').attr('checked', 'false');
  $('#ext_preserve_1').attr('checked', 'true');


Point out there is a button for renewing items at bottom of patron page

  • Developer: Jared Camins-Esakov, ByWater Solutions
  • Purpose: Alerting staff to the fact that they can renew/return items directly from the patron record; particularly relevant for patrons with huge numbers of items checked out, where staff might forget about the renewal button at the bottom
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.4
  $("#issuest").parent().prepend("<div id='renewref'>See below to renew all or selected items.</div>");


Don't Allow Checkout Overrides

  • Developer: Scott Merrill , CAUSE
  • Purpose: Removes the override option for circulation rules that block checkouts... right now, if you have a maximum line of X item type out to a patron type, you'll always get a prompt asking if you want to override, this removes the prompt
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.4+
$("#circ_needsconfirmation ul li:contains('This patron can\'t check out this
item per library circulation policy')").parent().siblings().hide();


Hide Streetnumber field on Patron edit screen

  • Developer: Joy Nelson, ByWater Solutions
  • Purpose: Remove the Street Number field from the patron edit screen.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.6+
$("#entryform #streetnumber").parent().hide();


Hide the Patron column in the Holds Que report

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: Hides the Patron column in the Holds Que report but could be changed to hide any column within the report.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.6+
$("#holdst .hq-patron").hide();


Add a link to self checkout on intranet login screen

  • Developer: Koha Community
  • Purpose: Add a link to the built-in self checkout function to the intranet login screen
  • Status: Completed
  • Intranet
  • Version: Any
  $("#login .submit").parent().after("<p><a href=\"http://YOUR_KOHA_OPAC_URL/cgi-bin/koha/sco/sco-main.pl\" target=\"_blank\">Self-Checkout</a></p>");


Keyboard shortcuts to quickly change tab while showing or editing MARC records

  • Developer: Stefano Bargioni (Pontificia Università della Santa Croce) - 2012-04-26
  • Purpose: Keyboard shortcuts to change tab while showing or editing MARC records
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
// MARC bib edit
if (location.pathname.indexOf('cataloguing/addbiblio.pl')>-1) {
	$(document).keydown(function(e) {
		if (e.target.tagName == 'INPUT') return;
		if (e.target.tagName == 'TEXTAREA') return;
		var f = 0; // flag
		var c = e.which; // code key pressed
		if (c>=48 && c<=57)  {f=1; c-=48;} // 0..9 keyboard
		if (c>=96 && c<=105) {f=1; c-=96;} // 0..9 keypad
		if (f==0) return;
		var marc_sections = $('#addbibliotabs ul li a').text().replace(/[^0-9]/g,'');
		var marc_section = marc_sections.indexOf(c);
		if (marc_section == -1) return;
		$($('#addbibliotabs ul li a')[marc_section]).click();
	});
}
// MARC bib show
if (location.pathname.indexOf('catalogue/MARCdetail.pl')>-1) {
	$(document).keydown(function(e) {
		if (e.target.tagName == 'INPUT') return;
		if (e.target.tagName == 'TEXTAREA') return;
		var f = 0; // flag
		var c = e.which; // code key pressed
		if (c>=48 && c<=57)  {f=1; c-=48;} // 0..9 keyboard
		if (c>=96 && c<=105) {f=1; c-=96;} // 0..9 keypad
		if (f==0) return;
		var marc_sections = $('#bibliotabs ul li a').text().replace(/[^0-9]/g,'');
		var marc_section = marc_sections.indexOf(c);
		if (marc_section == -1) return;
		$($('#bibliotabs ul li a')[marc_section]).click();
	});
}
// MARC auth show
if (location.pathname.indexOf('authorities/detail.pl')>-1) {
	$(document).keydown(function(e) {
		if (e.target.tagName == 'INPUT') return;
		if (e.target.tagName == 'TEXTAREA') return;
		var f = 0; // flag
		var c = e.which; // code key pressed
		if (c>=48 && c<=57)  {f=1; c-=48;} // 0..9 keyboard
		if (c>=96 && c<=105) {f=1; c-=96;} // 0..9 keypad
		if (f==0) return;
		var marc_sections = $('#authoritiestabs ul li a').text().replace(/[^0-9]/g,'');
		var marc_section = marc_sections.indexOf(c);
		if (marc_section == -1) return;
		$($('#authoritiestabs ul li a')[marc_section]).click();
	});
}
// MARC auth edit
if (location.pathname.indexOf('authorities/authorities.pl')>-1) {
	$(document).keydown(function(e) {
		if (e.target.tagName == 'INPUT') return;
		if (e.target.tagName == 'TEXTAREA') return;
		var f = 0; // flag
		var c = e.which; // code key pressed
		if (c>=48 && c<=57)  {f=1; c-=48;} // 0..9 keyboard
		if (c>=96 && c<=105) {f=1; c-=96;} // 0..9 keypad
		if (f==0) return;
		var marc_sections = $('#authoritytabs ul li a').text().replace(/[^0-9]/g,'');
		var marc_section = marc_sections.indexOf(c);
		if (marc_section == -1) return;
		$($('#authoritytabs ul li a')[marc_section]).click();
	});
}


Hide SQL statement when running guided report

  • Developer: Galen Charlton
  • Purpose: Hide the SQL query when running a guided report
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.4.x and later
  $("#sql_output").hide();


Set sort order to ascending call number if selecting call number search in the staff interface

  • Developer: Galen Charlton
  • Purpose: Set sort order to ascending call number if selecting call number search in the staff interface
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.0.x and later (tested in 3.8.x)
  $("select.advsearch").change(function() {
      var idx = $(this).val();
      if (idx.substring(0, 7) == 'callnum') {
         $("select#sort_by").val('call_number_asc');
      }
  });


Add a filter to the patron various tables in staff interface

  • Developer: Christopher Brannon (Coeur d'Alene Public Library), based of original code by Kobi Lidershnider at http://kobikobi.wordpress.com/2008/09/15/using-jquery-to-filter-table-rows/
  • Purpose: To help find information in various tables, such as the Account and Pay fines portions of patron Fines, Edit items in cataloging, or the details screen for a bib in the staff catalog.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
//Add filter to various tables
$("#yui-main div[class='tabs-container'] table").attr("class","filterable"); //filter for fines
$("#yui-main div[id='cataloguing_additem_itemlist'] table").attr("class","filterable"); //filter for Edit items in cataloging
$("#yui-main div[id='bibliodetails'] table").attr("class","filterable"); //filter for bib items in staff catalog
 
$("<i>Filter: </i><input type='text' id='FilterTextBox' name='FilterTextBox' /><a href='#' class='clear' rel='nofollow'>  Clear</a></p>").insertBefore("#yui-main table[class='filterable']");
 
$(".filterable tr:has(td)").each(function(){var t = $(this).text().toLowerCase();
$("<td class='indexColumn'></td>").hide().text(t).appendTo(this);
});//each tr
 $("#FilterTextBox").keyup(function(){
   var s = $(this).val().toLowerCase().split(" ");
   //show all rows.
   $(".filterable tr:hidden").show();
   $.each(s, function(){
       $(".filterable tr:visible .indexColumn:not(:contains('"
          + this + "'))").parent().hide();
   });//each
 });//key up.
 
$(".clear").click(function(){
    $("#FilterTextBox").val("").keyup();
    return false;
  });
//end filters


Clean up patron details screen

  • Developer: Christopher Brannon (Coeur d'Alene Public Library)
  • Purpose: Remove unused lines in the Alternate address or Alternative contact sections of the Patron Details screen.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
//Condense Patron Display
$("#patron-alternate-address,#patron-alternative-contact").find("li").hide();
$("#patron-alternate-address li,#patron-alternative-contact li") 
  .contents() 
  .filter(function() { 
    return this.nodeType == Node.TEXT_NODE; 
  }).wrap("<span class='availablecontent'/>"); 
$("#patron-alternate-address,#patron-alternative-contact").find(".availablecontent").each(function() {
$(this).parent("li").show();
});
//end Condense Patron Display


Alert staff about missing email or phone upon checkout

  • Developer: Paul Landers - Texas Tech University Health Sciences Center
  • Purpose: Alert staff about missing email or phone upon checkout.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  • Note: Alert staff upon item checkout that a patron's email or phone is blank.
// Confirm that we're on the "Checking Out" page
myvar0 = /circulation\.pl/.test(window.location.pathname);
// is there a mailto: link on this page?
myvar1 = $('a[href*="mailto"]').length;
myvar2 = $("#nophonestored").length;
if(myvar0 != 0 && myvar1 == 0) {
                alert('Patron email is blank!');
        }
if(myvar0 != 0 && myvar2 != 0) {
                alert('Phone number is missing!');
        }

Alert inattentive staff to read patron notes

  • Developer: Paul Landers - Texas Tech University Health Sciences Center
  • Purpose: Alert staff about blank email upon checkout.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  • Note: Alert inattentive staff to read and resolve patron notes upon item checkout. This alert is repeated upon every page reload.
    // alert any circulation notes
    // Confirm that we're on the "Checking Out" page
    myvar0 = /circulation\.pl/.test(window.location.pathname);
	myvar4 = $('#circnotes').length;
            if (myvar0 != 0 && myvar4 != 0) {
		myvar5 = $('#circnotes span.circ-hlt').text();
		alert(myvar5);
	}

Add 'Hide/Unhide $0.00 balances' toggle button to fines screen

  • Developer: George H. Williams - Latah County Library District / VALNet library consortium
  • Purpose: Creates a toggle button that hides or shows any lines from the patron fines table that have been paid in full.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.8
  • Note: The button requires 2 parts. The first part adds a Jquery selector called 'contentIs.' The second statement creates the toggle button. For the button to work correctly you must include the statement to create the 'contentIs' selector.
//add the “contentIs” selector to return exact matches
$.expr[':'].contentIs = function(el, idx, meta) {
    return $(el).text() === meta[3];
};
//end “contentIs” selector
 
//begin Zero Balance Button
//Adds a toggle button to the account tab on the patron fines screen that hides or shows any lines in a patron's account with an outstanding balance of zero
var new_btn = $('<button id="0hide">Hide/Unhide $0.00 balances</button>');
new_btn.insertBefore('#PatronAccountTable:first');
$('#0hide').click(function() {
$(".credit:contentIs(0.00)").parents("tr").toggle();
});
//end Zero Balance Button


Change Manual Credit to Add Note

  • Developer: Paul Landers - Texas Tech University Health Sciences Center
  • Purpose: Change the Manual Credit function to an Add Note function.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
  • Note: Manual Credit was problematic for us, especially in reporting. Our staff used it only because of the notes field in order to give a reason when writing off a fine. Since the form assumes $0.00 upon submission, we just hide the amount field and then change the text on various elements.
//rename the tab from "Create manual credit" to "Add note"
        $('a[href*="mancredit"]').text('Add note');
// Also if we're on the "Create manual credit" subpage:             
    myvar0 = /mancredit\.pl/.test(window.location.pathname);
        if(myvar0 != 0) {
                $("li:contains('Amount: ')").hide();
                $("legend:contains('Manual credit')").text('Add note');
                $("input[name='add']").val('Create note');
                        }

Remove 23:59 time dues from Circ and Catalogue when hourly loans are not in use

  • Developer: Liz Rea (Catalyst IT)
  • Purpose: Remove the time due from intranet detail and circulation pages.
  • Intranet or OPAC?: Intranet
  • Version: 3.8+
 $("#issuest td:contains('23:59')").each(function() {
 var text = $(this).text().replace('23:59', '');
 $(this).text(text);
 });
 $(".datedue:contains('23:59')").each(function() {
 var text = $(this).text().replace('23:59', '');
 $(this).text(text);
 });


Force Staff to use Datepicker when altering due dates, renewal dates, and suspend until dates

  • Developer: George H. Williams - Latah County Library District / VALNet library consortium
  • Purpose: Since incorrectly formatted due dates can be entered in the "specify due date", "renewal date", and "suspend until" input boxes (and incorrectly formatted dates can cause system errors), this jQuery forces staff to use the calendar datepicker to choose dates for these options.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.8
//BEGIN Force staff to use datepicker for altering due dates, renewal dates, and suspend unitl dates
$("#duedatespec").attr("readonly", "readonly");
$("#newduedate").attr("readonly", "readonly");
$("#suspend_until").attr("readonly", "readonly");
$(".hint:contains('Specify due date (MM/DD/YYYY):')").text('Use calendar button to choose new Due Date');
$("p:contains(Renewal due date:)").prepend('Use calendar button to choose ');
$(".hint:contains('Specify date on which to resume (MM/DD/YYYY):')").text('Use calendar button to specify the date when holds will resume');
//END Force staff to use datepicker for altering due dates, renewal dates, and suspend unitl dates


Hide some of the displayed fields when adding or editing an item

  • Developer: George H. Williams - Latah County Library District / VALNet library consortium
  • Purpose: Hides selected fields in the "Add item" and "Edit item" pages.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10
  • Note: Catalogers in our consortium want the default display of these screens to be shorter but they also need the ability to look at all fields if necessary. This example hides the 0, 1, 4, f, and j subfields. To remove different fields from the default display when the page loads add "li:contains(SUBFIELD -)" to the selector.
//BEGIN Hide and Show All Fields buttons for Catalogers
$(".yui-u #cataloguing_additem_newitem .rows li:contains('0 - '), li:contains('1 - '), li:contains('4 - '), li:contains('f - '), li:contains('j - ')").hide();
var new_btn = $('<button id="cataddhide">Show all fields</button>');
new_btn.prependTo('.yui-u #cataloguing_additem_newitem .rows');
$('#cataddhide').click(function(e) {
e.preventDefault();
$(".yui-u #cataloguing_additem_newitem .rows li:contains(' ')").show();
$('#cataddhide').fadeOut();
});
//END Show All Fields buttons for Catalogers

Preview OPAC syspref changes

  • Developer: Jared Camins-Esakov, C & P Bibliography Services
  • Purpose: Provides a preview for basic OPAC customizations on the OPAC syspref page.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10+ with bug 10405 and a special web server configuration
  • Note: You will need to adjust the preview URLs for your particular installation. The URLs used in this sample were especially configured so that /cgi-bin/koha/opac/ would be forwarded to the OPAC. Also be aware that only part of the script goes in $(document).ready(..). To make this clear, I have included the $(document).ready(...) in the script.
function showPreview(url) {
    document.getElementById('opac-preview').src = url;
    $('#preview-loading').show();
    $('#opac-preview').load(function () {
        $('#opac-preview').show();
        $('#region-opaccredits', $('#opac-preview').contents()).html($('#pref_opaccredits').val());
        $('#region-opacheader', $('#opac-preview').contents()).html($('#pref_opacheader').val());
        $('#opacmainuserblock', $('#opac-preview').contents()).html($('#pref_OpacMainUserBlock').val());
        $('#opacmainuserblockmobile', $('#opac-preview').contents()).html($('#pref_OpacMainUserBlockMobile').val());
        $('#region-opacnav', $('#opac-preview').contents()).html($('#pref_OpacNav').val());
        $('#region-opacnavbottom', $('#opac-preview').contents()).html($('#pref_OpacNavBottom').val());
        $('#opacrightsidebar', $('#opac-preview').contents()).html($('#pref_OpacNavRight').val());
        $('#noresultsfound', $('#opac-preview').contents()).html($('#pref_OPACNoResultsFound').val());
        $('#opacresultssidebar', $('#opac-preview').contents()).html($('#pref_OPACResultsSidebar').val());
        $('#region-opacusercss', $('#opac-preview').contents()).replaceWith('<style id="region-opacusercss" type="text/css">' + $('#pref_OPACUserCSS').val() + '</style>');
 
        $('#region-opacuserjs', $('#opac-preview').contents()).replaceWith('<' + 'script id="region-opacuserjs" type="text/javascript">' + $('#pref_opacuserjs').val() + '<' + '/script>');
        $('#preview-loading').hide();
    });
}
 
$(document).ready(function () {
    if ($('#pref_OpacNav').size() > 0) {
        $('#doc3').after('<div class="navbar navbar-fixed-bottom" style="z-index: 10000;"><div id="preview-pane" class="navbar-inner"><h4 style="float: left; margin-right: 2em;">Preview changes</h4><div class="btn-group" data-toggle="buttons-radio"><button type="button" class="btn" id="preview-main">Main page</button><button type="button" class="btn" id="preview-results">Results</button><button type="button" class="btn" id="preview-details">Details</button><button type="button" class="btn active" id="preview-hide">Hide</button></div><img id="preview-loading" style="display: none;" src="/intranet-tmpl/prog/img/loading-small.gif"/><iframe id="opac-preview" style="height: 20em; width: 100%; display: none;"></iframe></div></div>');
 
        $('#preview-main').click(function () {
            showPreview('/cgi-bin/koha/opac/opac-main.pl');
        });
        $('#preview-results').click(function () {
            showPreview('/cgi-bin/koha/opac/opac-search.pl?idx=&q=pqf%3D%40attr+1%3D_ALLRECORDS+%40attr+2%3D103+%22%22&branch_group_limit=');
        });
        $('#preview-details').click(function () {
            showPreview('/cgi-bin/koha/opac/opac-detail.pl?biblionumber=1');
        });
        $('#preview-hide').click(function () {
            $('#opac-preview').hide();
        });
    }
});


Populate Username with Cardnumber

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: Copy cardnumber to username field on new patron form
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
//Causes the user cardnumber to auto populate to the Username.
$("#entryform #cardnumber").blur(function(){
$("#entryform #userid").val($("#entryform #cardnumber").val());
});

Validate patron data fields

  • Developer: Paul Landers - Texas Tech University Health Sciences Center
  • Purpose: Validate data when creating or editing patron records.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.12
  • Note: Koha performs only basic validation (i.e. required fields). This jQuery script replaces the default SAVE button with a VALIDATE button which runs a custom validation using regular expressions. Upon successful validation it submits the form data. NOTE - this script is very large and will require additional customization to fit your library, since it contains our library's unique patron categorycodes and our validation definitions. For example, we require 2 email addresses for all patrons, but allow the 2 addresses to be the same for only some categorycodes, while requiring them to be different for other categorycodes.
    //hide the miniature EDIT links on the patron details screen
    $("#patron-alternate-address").next('div').hide();
    $("#patron-alternative-contact").next('div').hide();
    $("#patron-messaging-prefs").next('div').hide();
    $('div.yui-u div.action a:contains("Edit")').hide();
    $('#patron-information a:contains("Edit")').hide();
 
    // validate patron EDIT data by hiding the SAVE button, running an inline validation script, then submitting the form if it passes validation.
    //we can secretly bypass validation if the shift key is pressed, so we bind the keydown event to a specific textarea in order to check for a pressed SHIFT key
    $('textarea#patron_attr_4').keyup(function (e) {
        if (e.which == 16) $.isShift = false;
    }).keydown(function (e) {
        if (e.which == 16) $.isShift = true;
    });
 
    // create the validation function
    patronValidate = function () {
 
        //if the shift key is pressed then skip validation
        if ($.isShift) {
            return check_form_borrowers();
        } else {
 
            //start with an empty alert message
            var mes = "";
 
            //get all our variables
            var surname = $('input[id=surname]').val();
            var firstname = $('input[id=firstname]').val();
            var address = $('input[id=address]').val();
            var city = $('input[id=city]').val();
            var state = $('input[id=state]').val();
            var zipcode = $('input[id=zipcode]').val();
            var phone = $('input[id=phone]').val();
            var phonepro = $('input[id=phonepro]').val();
            var email = $('input[id=email]').val();
            var emailpro = $('input[id=emailpro]').val();
            var cardnumber = $('input[id=cardnumber]').val();
            var categorycode = $('select[id=categorycode]').val();
            var dateexpiry = $('input[id=to]').val();
            var userid = $('input[id=userid]').val();
            var school = $('select[id=patron_attr_3]').val();
            var rnumber = $('textarea[id=patron_attr_2]').val();
 
            //create our arrays for expiration dates and eRaider validation
            var fullYear = ['ADMIN', 'EMPLOYEE', 'FACULTY', 'RETIRED', 'STAFF'];
            var nonTTUHSC = ['CLINFAC', 'CONTRACTS', 'DEBTORS', 'FRIEND', 'PRECEPTOR', 'HOSPITAL'];
 
            //create our regexes
 
            // case-sensitive regexes
            var cardnumberReg = /(^P[A-Z0-9]{5}$)|(^R[0-9]{8}$)/;
            var stateReg = /^([A-Z]{2}$)/;
            var useridReg = /^([a-z0-9_]{3,8})$/;
 
            // case-insensitive regexes
            var surnameReg = /^[a-zA-Z\-\\'\ ]+$/;
            var firstnameReg = /^[a-zA-Z\-]+$/;
            var cityReg = /^[a-zA-Z ]+$/;
            var addressReg = /^(([0-9]{1,5}|POB|RT) .+)/;
            var zipReg = /(^[0-9]{5}(-[0-9]{4})?$)/;
            var phoneReg = /^([2-9][0-9]{2}-[0-9]{3}-[0-9]{4})$/;
            var emailReg = /^([a-z0-9\-]+\.([a-z]\.)?[a-z\-]+@ttuhsc\.edu)$/i;
            var emailReg2 = /^(.+@.+\.[a-z]{2,3})$/i;
            var alumniReg = /^((11\/30\/20[0-9]{2})|(02\/15\/20[0-9]{2})|(06\/30\/20[0-9]{2}))$/;
            var clinfacReg = /^(08\/31\/20[0-9]{2}$)/;
            var higheredReg = /^(06\/30\/20[0-9]{2}$)/;
            var hospitalReg = /^(12\/31\/20[0-8][0-9]$)/;
            var studentReg = /^((05\/31\/20[0-9]{2})|(08\/15\/20[0-9]{2})|(12\/31\/20[0-8][0-9]))$/;
            var rnumblankReg = /^$/
            var rnumReg = /^(R[0-9]{8})$/;
 
            // validate surname
            if (!surnameReg.test(surname)) {
                mes = mes + "\nLast name contains invalid characters.\n";
            }
 
            // validate firstname
            if (!firstnameReg.test(firstname)) {
                mes = mes + "\nFirst name contains invalid characters (e.g. spaces).\n";
            }
 
            // validate city
            if (!cityReg.test(city)) {
                mes = mes + "\nCity contains invalid characters.\n";
            }
 
            // validate street address
            if (!addressReg.test(address)) {
                mes = mes + "\nStreet address must begin with a number, POB or RT\n";
            }
 
            // validate state
            if (!stateReg.test(state)) {
                mes = mes + "\nState abbreviation must be exactly 2 uppercase characters.\n";
            }
 
            // validate zipcode
            if (!zipReg.test(zipcode)) {
                mes = mes + "\nZip code looks invalid.\n";
            }
            // validate primary phone
            if (!phoneReg.test(phone)) {
                mes = mes + "\nPrimary phone must be exactly XXX-XXX-XXXX\n";
            }
 
            // validate secondary phone
            if (!phoneReg.test(phonepro)) {
                mes = mes + "\nSecondary phone must be exactly XXX-XXX-XXXX\n";
            }
 
            // validate both email addresses
            if (!emailReg2.test(email)) {
                mes = mes + "\nPrimary email looks invalid.\n";
            }
            if (!emailReg2.test(emailpro)) {
                mes = mes + "\nSecondary email looks invalid.\n";
            }
 
            /* some categorycodes require 2 email addresses
        if ((nonTTUHSC.indexOf(categorycode) == -1 || categorycode == 'ALUMNI' ) && email == emailpro) {
            mes = mes + "\nPatron class \'" +
	categorycode + "\' requires 2 distinct email addresses.\n";
        }*/
 
            //validate the cardnumber
            if (!cardnumberReg.test(cardnumber)) {
                mes = mes + "\nCardnumber is invalid.\n";
            }
 
            //validate the userid if affiliated
            if (nonTTUHSC.indexOf(categorycode) == -1 && !useridReg.test(userid)) {
                mes = mes + "\nUsername \(eRaider\) must be lowercase letters and numbers only.\n";
            }
 
            //validate the school
            if (school == '') {
                mes = mes + "\nYou must chose a school or choose \'Other\'.\n";
            }
 
            //set or check dateexpiry based upon categorycode
            if (fullYear.indexOf(categorycode) != -1) {
                $('input[id=to]').val('12/31/2099');
            }
            if (categorycode == 'CLINFAC' && !clinfacReg.test(dateexpiry)) {
                mes = mes + "\nClinical Faculty must expire on exactly 08\/31\/20xx.\n";
            }
            if (categorycode == 'HIGHERED' && !higheredReg.test(dateexpiry)) {
                mes = mes + "\nResidents and Fellows must expire on exactly 06\/30\/20xx.\n";
            }
            if (categorycode == 'HOSPITAL' && !hospitalReg.test(dateexpiry)) {
                mes = mes + "\nHospital employees must expire on exactly 12\/31\/20xx.\n";
            }
            if (categorycode == 'ALUMNI' && !alumniReg.test(dateexpiry)) {
                mes = mes + "\nAlumni must expire on exactly 02\/15\/20xx, or 06\/30\/20xx, or 11\/30\/20xx.\n";
            }
 
            if (categorycode == 'STUDENT' && !studentReg.test(dateexpiry)) {
                mes = mes + "\nStudents must expire on exactly 05\/31\/20xx, or 08\/15\/20xx, or 12\/31\/20xx.\n";
            }
 
            //R numbers are not required,
            //but if used, they should validate
            if (!rnumblankReg.test(rnumber) && !rnumReg.test(rnumber)) {
                mes = mes + "\nR number must begin with \'R\' and be 8 digits.\n";
            }
 
 
            // display the alert
            if (mes != "") {
                alert(mes);
                return false;
            } else {
                alert("All data looks good!");
 
                // submit the validated form
                check_form_borrowers();
            }
        }
    };
 
    // Hide the SAVE button, create the VALIDATE button
    $('#entryform > fieldset.action').prepend('<input id="validate" type="submit" value="Validate" onclick="return patronValidate();" name="validate">');
    $('#entryform input[name=save]').hide();

Hide Add Child from Patron Page

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Hide the add child button
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.12+
$("a#addchild.btn.btn-small").hide();

Hide Duplicate from Patron Page

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Hide the duplicate button
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.12+
$("a#duplicate.btn.btn-small").hide();

Hide Duplicate and Add Child from Patron Page

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Hide the duplicate and add child buttons
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10- and below
$("#addchild,#duplicate").closest("li").hide();

Rename Renew All Button

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Rename 'renew or return checked items' button
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10+
 $("input[value='Renew or return checked items']").attr("value","Renew checked items");
 $("input[value='Renew or Return checked items']").attr("value","Renew checked items");


Hide current location column in holdings table (3.10)

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: Removes the Current location column in Holdings table
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10
$("#holdings tr td:nth-child(2)").remove();
$("#holdings tr th:nth-child(2)").remove();


Hide current location column in holdings table (3.12)

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Removes the Current location column in Holdings table
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.12+
$("#holdings td.location").hide(); 
$("#holdings th:contains('Current location')").hide();

Hide Topic & Places Facets

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Removes the Current location column in Holdings table
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10+
$("li#su-geo_id").hide();
$("li#su-to_id").hide();

Select an attribute value by default

  • Developer: Owen Leonard & Nicole C. Engard
  • Purpose: This assumes that you have a patron attribute with an authorized value and selects a default value for you
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10+
$("#patron_attr_1").find("option[value='VALUEHERE']").attr("selected","selected");

Interrupt check-in process for hold/transfer confirmations

  • Developer: Christopher Brannon
  • Purpose: Stop staff from overlooking a hold/transfer confirmation during the check-in process.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10+
  • Note: This will interrupt the process of check-in by taking the focus away from the check-in text box if a confirmation screen appears for holds or transfers. If another book is scanned, nothing will happen. I've also colored the print button green to draw attention to the message. This is the preferred button for us. You can change the color of a different button if your workflow is different.
//Check for Check-In Alerts
if ($('#return2,#hold-found1,#hold-found2,#item-transfer').length){
$("#barcode").blur();
$("input[class='print']").css({backgroundColor: 'lightgreen'});
}
//end Checking for Alerts

Passing Cardnumber/barcode through to UserID

  • Developer: Ed Veal, ByWater Solutions
  • Creation Date: 2013-10-17
  • Purpose: Using Cardnumber/Barcode for UserId
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.8 and 3.10 (not tested in 3.12)
  $("#entryform #cardnumber").blur(function(){
$("#entryform #userid").val($("#entryform #cardnumber").val());
});


Find string and add a span around it

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Add a class tag to an element without one by finding it. In this case find the string rcvd and add a around it.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10
$(document).ready(function(){
$('p').html(function(i,h){
return h.replace('(rcvd)', '<span class="receivedlabel">(rcvd)</span>');
});
});


Highlight patron's home library

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Add a class tag to an element without one by finding it. In this case find the string rcvd and add a around it.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10
$(document).ready(function(){
//highlight the home library on the left of the patron record in red
$('ul').html(function(i,h){
return h.replace('<li>Home library:', '<li style="color: red; font-weight: bolder;">Home library:');
});
});

Hide price column on check out summary

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: This hides the Price column found when looking at patron's checkouts
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.12
$("#issuest tr td:nth-child(8)").hide();
$("#issuest th:contains('Price')").hide();
$("#issuest tfoot tr td:nth-child(3)").hide();

Highlight return notice for items previously lost "Item was lost, now found"

  • Developer: Chris Meech
  • Purpose: Increase viability of returns notice for lost items -"Item was lost, now found"
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.10
//Highlight return notice Item was lost, now found
$(document).ready(function(){ 
$( ".problem:contains('Item was lost, now found')" ).css({"backgroundColor": "black", "color": "white", "font-size":"200%"})
 });

Hide default framework in cataloging

  • Developer: Olugbenga Adara, Projektlink Konsult Limited
  • Creation Date: 2014-03-26
  • Purpose: This will hide the Default Framework options on addbiblio.pl and addbooks.pl pages
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14 (AFAIK)
  $("a[href$='frameworkcode=']").hide();
  $("#Frameworks option[value=Default]").hide();
  $('li.z3950searchFw:first').hide();


Hide non-local copies when searching staff interface

  • Developer: Nick Clemens, VOKAL
  • Creation Date: 2014-03-29
  • Purpose: Hides non-local copies, by logged in library, in staff search results and adds a button to show them
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
//Add button to revert view 
$("#catalog_results #selection_ops").append('<div class="btn-group"><a class="btn btn-mini" id="plain_old_results" href="#"> Brief/Full Results</a></div>');
 
$("#plain_old_results").click(function(){
    $(".availability").children("ul").toggle();
    $(".availability strong").toggle();
    $(".availability .status").toggle();
    $(".unavailable").toggle();
    return false;
});
 
//Show only ‘Owned by [logged in library]’ or ‘No Local Copies’ in staff search results
        var loglibnode=$(".loggedinusername").nextAll().eq(1);
        var loglibtext=$.trim(loglibnode.text());
    $(".availability").each(function(){
        var ownedlocal=false;
        var our_copy_item;
        $(this).children("ul").each(function(){
            our_copy_item=$(this).find('li:contains("'+loglibtext+'")')
            if(our_copy_item.length){
		ownedlocal=true;
                $(this).parent('.availability').after("<ul>",our_copy_item,"</ul>");
            } 
        });
        $(this).append("<br>Click title for full availability");
        if(ownedlocal){$(this).append("<p><span style='color:green; font-weight:bold;'>Local Copies:</span></p>");}
        else{$(this).prepend('No Local Copies<p>');}
 
    });
    $(".availability").children("ul").hide();
    $(".availability strong").hide();
    $(".availability .status").hide();
    $(".unavailable").hide();

Allow only a supervisor to write off a fine

  • Developer: Paul Landers - Texas Tech University Health Sciences Center
  • Creation Date: 2014-04-11
  • Purpose: Koha 3.12 does not allow for granular control over the Write Off functions. This code mimics supervisory control by hiding the Write Off All and Write Off buttons, then requiring the input of a secret supervisor code to unhide the Write Off button.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.12
    //create the writeoffallow function
    function writeoffallow() {
        var superid = prompt('Enter your supervisor ID:');
    // use your own secret code here in place of 9999
        if (superid == '9999') {
            $('input[type="submit"][value="Write off"]').show();
        } else {
            alert('Incorrect Supervisor ID');
        }
    }
 
    //hide the Write Off All button
    $('#woall').hide();
 
    //hide the Write off button
    $('input[type="submit"][value="Write off"]').hide();
 
    //create the supervisor link
    $('#payselected').after('  <a id="supervisor" href="#">Supervisor</a> ');
 
    //assign the click handler
    $("#supervisor").click(writeoffallow);


Allow only a supervisor to lift a manual restriction

  • Developer: Paul Landers - Texas Tech University Health Sciences Center
  • Creation Date: 2014-04-16
  • Purpose: Koha 3.14 does not allow for granular control over the new Manual Restriction functions. This code mimics supervisory control by hiding the remove links, then requiring the input of a secret supervisor code to unhide the remove links.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
//create the superlift function
    function superlift() {
        var superid = prompt('Enter your supervisor ID:');
    // use your own secret code here in place of 9999
        if (superid == '9999') {
$('a.remove_restriction').show();
        } else {
            alert('Incorrect Supervisor ID');
        }
    }
 
// hide the REMOVE RESTRICTION links
$('a.remove_restriction').hide();
 
// create the SUPERVISOR link
$('#add_manual_restriction').after(' | <a id="supervisor2" href="#">Supervisor</a> ');
 
    //assign the click handler
    $("#supervisor2").click(superlift);
 
// hide the Patron Flags section on the Patron Edit screen because we do not use them
$('legend:contains("Patron account flags")').parent().hide();
 
// hide the Patron Restrictions section on the Patron Edit screen
$('legend:contains("Patron restrictions")').parent().hide();



Change default encoding to MARC-8

  • Developer: Nicole Engard, ByWater Solutions
  • Creation Date: 2014-05-10
  • Purpose: Make the default encoding when staging records Marc8 instead of UTF8
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
$(document).ready(function(){
if (window.location.href.indexOf("tools/stage-marc-import.pl") > -1) {
$("#encoding option[value='utf8']").removeAttr("selected");
$("#encoding option[value='MARC-8']").attr("selected","selected");
}
 });


Focus on 'add to basket' instead of vendor search

  • Developer: Nicole Engard, ByWater Solutions
  • Creation Date: 2014-05-10
  • Purpose: Move focus from search box on basket page and to the add item to basket area
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
 $(document).ready(function(){
if (window.location.href.indexOf("acqui/basket.pl") > -1) {
 
$("input[name='supplier']").blur();
$("input[name='q']").focus();
}
 });


Focus on add to list

  • Developer: Nicole Engard, ByWater Solutions
  • Creation Date: 2014-05-10
  • Purpose: Add focus lists page and to the add item to list area
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
 $(document).ready(function(){
if (window.location.href.indexOf("virtualshelves/shelves.pl") > -1) {
$("input[name='addbarcode']").focus();
}
 });

Change default tab on the main page to Search

  • Developer: Fridolin SOMERS, Biblibre and Nicole Engard, ByWater Solutions
  • Creation Date: 2014-06-03
  • Purpose: Makes it so that the tab fixed on the main page of the staff client is the 'search the catalog' tab.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.16
$(document).ready(function(){
if (window.location.href.indexOf("cgi-bin/koha/mainpage.pl") > -1) {
$("#header_search a[href='#catalog_search']").click();
}
});


Add hotkeys to staff client

  • Developer: Mark Lesniak, Rahway Public Library
  • Creation Date: 2014-06-25
  • Purpose: Adds hot keys to the staff client
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
$(document).bind('keydown', function(e) {
 
// Shift + escape to return home (just escape in
// Google Chrome)
 
if(e.which === 27){
window.location.href = "http://" + document.domain; // Return to domain root
}
 
if(e.altKey){
 
switch (e.which)
{
 
// Alt + w = Print page
case 87:
printx_window("page");
break;
 
// Alt + p = Print Quickslip
case 80:
printx_window("qslip");
break;
 
// Alt + m = Print summary
case 77:
printx_window("slip");
break;
}
 
} // End alternate key
 
}); // End keypress bindings

Change "Available" to "Checked in or on hold"

  • Developer: George H. Williams - Latah County Library District / VALNet library consortium
  • Purpose: Changes "XX Items available" to "XX Items checked in or on hold" in the search results in the staff client in the right hand column.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
//BEGIN Change "available" in search results to "checked in/on hold"
$("#searchresults .availability strong:contains('available')").text(function () {
    return $(this).text().replace("available", "checked in or waiting on hold"); 
});
//END Change "available" in search results to "checked in/on hold"

Hide locations/copies on Staff search results

  • Developer: Christopher Brannon - Coeur d'Alene Public Library/CIN
  • Purpose: Condenses copy information so staff don't have to scroll so much through search results.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
//Condense Locations on Staff Catalog Results
$("#bookbag_form div[class='availability']").children("ul").hide();
$("#bookbag_form div[class='availability'] strong").wrap("<a class='viewLocations' />");
$("#bookbag_form div[class='availability'] strong").append("<span class='instruct'> (+)</span><span class='instruct' style='display: none;'> (-)</span>");
$("#bookbag_form div[class='availability']").parent("td").attr('width','290');
 
//Trigger for condensed locations
$(".viewLocations").click(function() {
$(this).find(".instruct").toggle();
$(this).parent().parent().find("ul").toggle("slow");
});
//end Condense Locations

Remove links for staff to change logged in location

  • Developer: Christopher Brannon - Coeur d'Alene Public Library/CIN
  • Purpose: Reduce the ability for staff to change their circing/cataloging location easily. This will not prevent staff from changing the home location in the patron edit screen.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
//Remove library and label from login
$("#loginform label[for='branch']").hide();
$("#loginform #branch").hide();
//end Remove library from login
 
//Remove Set Library from Circulation page
$("#bd div[class='yui-u first'] li:contains('Set library')").hide();
//end Remove Set Library
 
//Remove Set Library from main page
$("#header ul[class='dropdown-menu'] li:contains('Set library')").hide();
//end Remove Set Library
};
//end Exclusion

Show Local Copy Status in Staff Search Results, Hide all others

  • Developer: Ryan Sipes/Heather Braum, NEKLS + Christopher Brannon Coeur d'Alene Public Library/CIN + Nick Clemens, VOKAL
  • Creation Date: 2014-09-03
  • Purpose: This script combines earlier work done by Christopher Brannon (Hide locations/copies on Staff search results) and Nick Clemens (Hide non-local copies when searching staff interface), and changes the location column in the staff search results to (1) show total copy counts, (2) show the holdingbranch items for the logged in staff user, (3) hide all other items at other locations, if no copies are at/checked out at the logged in library, (4) display a "no local copies available" message displays, (5) provide a trigger to show all items on a single result and (6) provide a button to show the original, full search results.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
//Show only ‘Local Copies [logged in library]’ or ‘No Local Copies’ in staff search results
        var loglibnode=$(".loggedinusername").nextAll().eq(1);
        var loglibtext=$.trim(loglibnode.text());
    $(".availability").each(function(){
        var ownedlocal=false;
        var our_copy_item;
        $(this).children("ul").each(function(){
            our_copy_item=$(this).find('li:contains("'+loglibtext+'")')
            if(our_copy_item.length){
		ownedlocal=true;
                $(this).parent('.availability').after("<ul>",our_copy_item,"</ul>");
            } 
        });
        $(this).append("<br>Click + OR title for full availability");
        if(ownedlocal){$(this).append("<h4><span style='color:green; font-weight:bolder;'>Local Copies:</span></h4>");}
        else{$(this).append("<br/><p><span style='color:red; font-weight:bold;'>No Local Copies </span></p>");}
 
    });
    //$(".availability").children("ul").hide();
    //$(".availability strong").hide();
    //$(".availability .status").hide();
    //$(".unavailable").hide();
 
//Condense Locations on Staff Catalog Results
$("#bookbag_form div[class='availability']").children("ul").hide();
$("#bookbag_form div[class='availability'] strong").wrap("<a class='viewLocations' />");
$("#bookbag_form div[class='availability'] strong").append("<span class='instruct'> (+)</span><span class='instruct' style='display: none;'> (-)</span>");
$("#bookbag_form div[class='availability']").parent("td").attr('width','290');
 
  //Trigger for condensed locations
  $(".viewLocations").click(function() {
  $(this).find(".instruct").toggle();
  $(this).parent().parent().find("ul").toggle("slow");
  });

Show Local Copy Status in Staff Search Results, Hide all others (Variation)

  • Developer: Ryan Sipes/Heather Braum, NEKLS + Christopher Brannon Coeur d'Alene Public Library/CIN + Nick Clemens, VOKAL
  • Creation Date: 2014-10-16
  • Purpose: This script combines earlier work done by Christopher Brannon (Hide locations/copies on Staff search results) and Nick Clemens (Hide non-local copies when searching staff interface), and changes the location column in the staff search results to (1) show total copy counts, (2) show the holdingbranch items for the logged in staff user, (3) hide all other items at other locations, if no copies are at/checked out at the logged in library, (4) display a "no local copies available" message displays, (5) provide a trigger to show all items on a single result and (6) provide a button to show the original, full search results.

This variation is an attempt to streamline the code and reduce leftover elements in the rearrangement of information. Layout, labels and visuals are a bit different in this variation.

  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
//Condense Locations on Staff Catalog Results
var loggedlib=$(".loggedinusername").nextAll().eq(1).text().trim();
$("#bookbag_form .availability strong").nextUntil("span","ul").attr("class","AvailableGroup AvailStatus")
$("#bookbag_form .status").nextUntil("span","ul").attr("class","LoanedGroup AvailStatus");
$("#bookbag_form .unavailable").nextUntil("span","ul").attr("class","UnavailableGroup AvailStatus");
$(".AvailStatus").prepend("<ul class='LocalGroup'></ul><ul class='OtherGroup' style='display:none'></ul>");
$(".AvailStatus").each(function(){
   $('.AvailStatus li:contains("'+loggedlib+'")').attr("class","LocalItem");
   $('.AvailStatus li:not(".LocalItem")').attr("class","OtherItem").attr("style","color:brown");
   $(this).find(".LocalItem").appendTo($(this).find(".LocalGroup"));
   $(this).find(".OtherItem").appendTo($(this).find(".OtherGroup"));
});
$("#bookbag_form div[class='availability'] strong").wrap("<a class='viewLocations' />").append("<span class='instruct'> (+)</span><span class='instruct' style='display: none;'> (-)</span>").prepend("All Libraries: ");
 
//Trigger for condensed locations
$(".viewLocations").click(function() {
   $(this).find(".instruct").toggle();
   $(this).parent().find(".OtherGroup").toggle("slow");
});
//end Trigger
//end Condense Locations

Fix Subject Search Links

  • Developer: Christopher Brannon - Coeur d'Alene Public Library/CIN
  • Purpose: Subject search links in records break if the subject contains parenthesis. This jquery strips the parenthesis from the url link, making the link usable again.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
//Fix subject search by striping parenthesis from url links
$('#catalogue_detail_biblio a[href*="su:"]').attr('href', function(_,v){
    return v.replace(/(\w)(\(|\))(\w)/g,'$1 $3')
}).attr('href', function(_,v){
    return v.replace(/(\(|\))/g,'')
});
//End fix subject search

Enhance Expiration Date on Patron Details Screen

  • Developer: Christopher Brannon - Coeur d'Alene Public Library/CIN
  • Purpose: Helps expired or soon to be expired date stand out on the Patron Details screen. The value in line 8 (+30) should reflect the same value you have set for NotifyBorrowerDeparture preference.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.14
//Enhance expiration date on patron details page
$("#patron-library-details li:contains('Expiration date: ')").attr('id','patronExpiration');
var ed=new Date();
var edat=( '0' + (ed.getDate()) ).slice( -2 );
var emon=( '0' + (ed.getMonth()+1) ).slice( -2 );
var eyear=ed.getFullYear();
var todaysDate=eyear+'-'+emon+'-'+edat;
ed.setDate(ed.getDate()+30);
edat=( '0' + (ed.getDate()) ).slice( -2 );
emon=( '0' + (ed.getMonth()+1) ).slice( -2 );
eyear=ed.getFullYear();
var expireSoon=eyear+'-'+emon+'-'+edat;
ed=new Date($("#patronExpiration").text().match(/\d{2}\/\d{2}\/\d{4}/g));
edat=( '0' + (ed.getDate()) ).slice( -2 );
emon=( '0' + (ed.getMonth()+1) ).slice( -2 );
eyear=ed.getFullYear();
var expireDate=eyear+'-'+emon+'-'+edat;
if(expireDate >= todaysDate && expireDate < expireSoon){
$("#patronExpiration").attr('style','color: red;').append(' <b><i>(Expires soon!)</i></b>');
}
if(expireDate < todaysDate){
$("#patronExpiration").attr('style','color: red;').append(' <b><i>(EXPIRED!)</i></b>');
};
//End enhance expiration date

Hide Check in Column on Checkout Table

  • Developer: Christopher Brannon - Coeur d'Alene Public Library/CIN + Kyle Hall - ByWater Solutions
  • Purpose: Hides the check in column in the patron checkout Ajax table. The check in feature in this screen tends to skip hold and transfer actions, which is why we hide it. Traditional jQuery can't catch adjust this table because the table is populated after the page is loaded, so it was necessary to watch for Ajax events. Thanks to Kyle Hall for figuring out the logistics with capturing the Ajax events for me. This code also disables the forgive fines checkbox and rewords the button below the table. The first function using "ajaxSend.dt" will catch elements in the rendered table structure before the table is populated. The function using "init.dt" will catch everything else once the table is populated.
  • Creation Date: 2014-10-28
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.16
//Hide check-in column in patron account screens
  $('#issues-table').on( 'ajaxSend.dt', function () {
  $("#issues-table th:last-child").hide();
  $("#issues-table #exemptfine").parent().hide();
  $("#RenewCheckinChecked").html("<i class='icon-check'/> Renew checked items");
});
$('#issues-table').on( 'init.dt', function () {
  $("#issues-table").find("tbody tr:gt(0) td:last-child").hide();
});
//end Hide check-in

Move overdue items to the top of the current checkouts table

  • Developer: George H. Williams - Latah County Library District / VALNet library consortium
  • Purpose: In Koha 3.16 the new checkouts table sorts all of the patrons items by date checked out. This means that if the patron has any overdue items, they appear at the bottom of the table and if the patron has a lot of checkouts it can take a lot of scrolling to find the overdues. This code groups any overdue checkouts at the top of the table under a big pink banner that says "Patron has overdue items." It also, thanks to some advice from Christopher Brannon at CIN, disables the column sort on the due date column sine that sort does not work correctly.
  • Creation Date: 2014-11-06
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.16
//BEGIN Move overdues to the top of the table
   $('#issues-table').on( 'init.dt', function () {
      $("#issues-table:has(.overdue)").attr('od','overduetable');
      if($("#issues-table").attr('od')) {
         $("#issues-table tbody").attr("class","checkoutbody");
         $('.checkoutbody tr:first').before('<tr id="overduetr"><td colspan="10" style="background-color:pink; font-size: x-large"><strong>Patron has overdue items</strong></td></tr>');
         $("#issues-table .overdue").parents("tr").insertAfter("#overduetr");
         };
      $("#issues-table th:first").off("click").removeClass();
   });
//END Move overdues to the top of the table

Move filter bar to the top of the "Saved reports" table

  • Developer: George H. Williams - Latah County Library District / VALNet library consortium
  • Purpose: Moves the filter bar from the bottom of the "Saved reports" table to the top of that table.
  • Creation Date: 2014-11-04
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.16
//BEGIN Move reports filter tool to top of reports table
   $(window).bind("load", function() {
      $("#table_reports_wrapper .bottom.pager").insertBefore("#table_reports");
   });
//END Move reports filter tool to top of reports table

Relabel state to be Province

  • Developer: Nicole Engard
  • Purpose: Relabel state to be Province
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
$(document).ready(function(){
 $("#memberentry_mainaddress label[for='state']").html("Province:");
 $("#table_cities th:contains('State')").html("Province");
 $("label[for='city_state']").html("Province:");
});

Hide sort fields from patron screen

  • Developer: David Roberts (PTFS Europe)
  • Creation Date: 2015-02-05
  • Purpose: Hide sort 1 and sort 2 fields from patron registration
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.18
$("#memberentry_library_management label[for='sort1']").hide();
$("#memberentry_library_management label[for='sort2']").hide();
$("#memberentry_library_management #sort1").hide();
$("#memberentry_library_management #sort2").hide();


MARC21 documentation links while adding an authority

  • Developer: Stefano Bargioni
  • Creation Date: 2013-12-06
  • Purpose: Show MARC21 documentation links while adding an authority
  • Status: Complete. Will become unuseful when Bug 10941 will be pushed to master.
  • Intranet or OPAC?: Intranet
  • Version: 3.18
if (location.pathname.indexOf('authorities/authorities.pl')>-1) {
	var tags = $('div[id^=div_indicator_tag_]');
	for (var i=0; i < tags.length; i++) {
		var t = $(tags[i]);
		var tag_name = t.attr('id').replace(/div_indicator_tag_/,'').substr(0,3);
		t.find('span:first').after('<a href="#" class="marcdocs" title="LC MARC auth specifications" onclick="MARC21FieldAuth(\''+tag_name+'\'); return false"> ?</a>');
	}
	$('.marcdocs').css({'color':'blue','font-weight':'bold'});
}
 
function MARC21FieldAuth(tag_name) {
  if (tag_name == '000') {
    window.open("http://www.loc.gov/marc/authority/adleader.html");
  }
  else if (tag_name.search('09') == 0) {
    window.open("http://www.loc.gov/marc/authority/ad09x.html");
  }
  else {
    window.open("http://www.loc.gov/marc/authority/ad"+("000"+tag_name).slice(-3) + ".html");
  }
}

Add search by biblionumber option to staff client search drop-down

  • Developer: Indranil Das Gupta, L2C2 Technologies. (based on "Add additional searches to OPAC" by Jared Camins-Esakov)
  • Purpose: To append a search by biblionumber option to the search options drop-down on staff client search page.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: Any
$(document).ready(function(){
  $("select[name='idx']").append("<option value='biblionumber'>Biblionumber</option>");
});

Hides Auto renew option

  • Developer: Ed Veal
  • Purpose: Hides the “Auto renew” option from the checkout screen
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: tested 3.18
// Hides the Auto-renew feature 
$(document).ready(function(){ 
$("div.date-select label[for='auto_renew']").remove();
$("div.date-select input[id='auto_renew']").remove(); 
});

Show cost of checkouts on print slips

  • Developer: Kyle M Hall
  • Purpose: Shows what it would have cost to purchase all the items checked out today, based on the items.price field. This should work in the regular checkouts slip and also the quick slip.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: tested 3.18

First, add this to your checkedout block on your slip:

<span class="price" style="display: none;"><<items.price>></span>

items.replacementprice could also be used instead of items.price

Next, add this somewhere on the slip:

Cost of buying these items:<br/>
$<span id="price"></span><br/>
Cost of using the library:<br/>
Priceless!<br/>

Lastly, add this to the bottom of your slip:

<script type="text/javascript">
var x = document.getElementsByClassName("price");
var i;
var total = 0;
for (i = 0; i < x.length; i++) {
   var cost = parseFloat( x[i].innerHTML );
   if ( ! isNaN( cost ) ) {
       total += cost;
    }
}
document.getElementById("price").innerHTML = total.toFixed(2);
</script>

Show only last four digits of cardnumber on slip

  • Developer: Kyle M Hall
  • Purpose: Replace all but the last four digits of a cardnumber with asterisks on a print slip
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: tested 3.20

First, add this to your slip:

Cardnumber: <span id="cardnumber"><<borrowers.cardnumber>></span><br/>

Next, add this to the bottom of the slip:

<script type="text/javascript">
var cardnumber = document.getElementById("cardnumber");
var inner_html = cardnumber.innerHTML;
var length = inner_html.length - 4;
var last_four = inner_html.substring( length );
var stars = Array(length).join("*")
cardnumber.innerHTML = stars + last_four;
</script>

Copy Input to All Textboxes in Header Search

  • Developer: Christopher Brannon
  • Purpose: Copy your input in the header search to all four search boxes so you dont have to start over if you find you are on the wrong tab
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: tested 3.18
//Copy Header Search Input Box
  $('#header_search input:not(.submit)').keyup(function() {
    var txtClone = $(this).val();
    $('#header_search #findborrower,#header_search #ret_barcode,#header_search #searchmember,#header_search #search-form').val(txtClone);
  });
//End copy

Enhance No item with barcode message

  • Developer: Christopher Brannon - Coeur dAlene Public Library - Cooperative Information Network
  • Creation Date: 2016-03-01
  • Purpose: Make messages alerting staff that item/barcode is not found stand out from other alerts
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: tested 3.18
  //Enhance No item with barcode message
$("p.problem:contains('No item with barcode:')").parent("div").removeClass("alert").css("background-color","red").css("border","1px solid #e0c726").css("background","rgba(0, 0, 0, 0) -moz-linear-gradient(center top , #FAECEC 0%, #FAECEC 9%, #FC1B1B 89%, #FA2A2A 100%) repeat scroll 0 0");
  //End Enhance

Copy mobile phone to SMS field

  • Developer: Nicole Engard ByWater Solutions
  • Creation Date: 2016-03-29
  • Purpose: Take the contents of the mobile phone field and populate the SMS field with a +1 and the number
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.22
//Add the +1 to the SMS number field and SMS to fill in with Mobile
if ($("#memberentry_messaging_prefs input[id='SMSnumber']").val() == '' ) {
$("#entryform #mobile").blur(function(){
	$("#memberentry_messaging_prefs input[id='SMSnumber']").val("+1"+$("#entryform #mobile").val());
});
  }

Add a check/uncheck all libraries button to export.pl

  • Developer: Nick Clemens. ByWater Solutions
  • Creation Date: 2016-04-15
  • Purpose: Add a button to allow for checking/unchecking all libraries on the export tool
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version:
$("#tools_export label:contains('Library:')").append("<button id='libcheck' type='button'>Uncheck all</button>");
$("#libcheck").click( function() {
   if( $(this).text() == "Check all" ) {
  $(".branchgriditem input").prop('checked',true);
  $(this).text('Uncheck all');
  }
  else {
$(".branchgriditem input").prop('checked',false);
  $(this).text('Check all'); 
}

Fill in default values for indicators and hide them from catalographers

  • Developer: Joachim Ganseman. Koninklijk Conservatorium Brussel
  • Creation Date: 2016-06-23
  • Purpose: Speed up catalography by automatically filling in indicators for fields where they are always the same.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 16.05
if ( $("#cat_addbiblio") ) {	// only do this in the addbiblio form
  // Fill in default values for some indicators
  $("input[name^='tag_028_indicator1']").val("2"); // Field 028 : Default to plate nr
  $("input[name^='tag_028_indicator2']").val("0");
  $("input[name^='tag_100_indicator1']").val("1"); // Field 100 : Default to Family Name
  $("input[name^='tag_490_indicator1']").val("0"); // Field 490 : Default to untraced series
  $("input[name^='tag_542_indicator1']").val("1"); // Field 542 : Default to publicly available info
  $("input[name^='tag_650_indicator1']").val("0"); // Field 650 : Default to "undefined level, no thesaurus"
  $("input[name^='tag_650_indicator2']").val("4");	
  $("input[name^='tag_700_indicator1']").val("1"); // Field 700 : Default to Family Name
 
  // Now hide all indicator elements in the input form from the user. 
  $("input[class~='indicator']").hide();
};   // end if

Check validity of ISBN, ISSN, ISMN and URL before submitting the addbiblio form

  • Developer: Joachim Ganseman. Koninklijk Conservatorium Brussel
  • Creation Date: 2016-06-23
  • Purpose: Avoid incorrect numbers or URLs to be added to the database.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 16.05
if ( $("#cat_addbiblio") )	// only do this in the addbiblio form
{
  // add an additional event handler to the save buttons ( one already exists: .onOption() )  
  $("#saverecord, #saveandview, #saveanditems, #saveandcontinue").click( function( event ) {
    var mes = "";
    // run all tests as functions which might add a new error message to the existing ones
    mes = test020a( mes ); 
    mes = test022a( mes );
    mes = test024a( mes );
    mes = test856a( mes );
 
    if (mes != "") {
      alert(mes);
      event.stopImmediatePropagation();	// block the other event handlers which trigger submission of the form
      return false;
    } else {
      return true;
    }
  });
};   // end if in addbiblio form
 
/* Helper function to test whether ISBN is correctly prefixed 10- or 13-digit. Does not calculate checksum. */
// regex adapted from http://regexlib.com/REDetails.aspx?regexp_id=1640
var test020a = function( mes ) {
  var ISBNregex = /^(97(8|9))?\d{9}(\d|X)$/;
  $("[id^='tag_020_subfield_a']").each( function() {     // loop over all ISBN fields
    var value = $(this).val();
    if (!value || value == "") { return true; };    // 'continue' statement
    if (!ISBNregex.test(value)) {
      $(this).addClass("subfield_not_filled");    // color the background of this field
      mes += "Field 020$a: Invalid ISBN format! Please correct, or put it in subfield $z.\n";
    } else {
      $(this).removeClass("subfield_not_filled");   // reset background of this field
    }
  });
  return mes;
};
 
/* Helper function to test whether ISSN is formatted as '1234-5678' */  
var test022a = function( mes ) {
  var ISSNregex = /^\d{4}-\d{3}(\d|X)$/;
  $("[id^='tag_022_subfield_a']").each( function() {     // loop over all ISSN fields
    var value = $(this).val();
    if (!value || value == "") { return true; };    // 'continue' statement
    if (!ISSNregex.test(value)) {
      $(this).addClass("subfield_not_filled");
      mes += "Field 022$a: Invalid ISSN format! Please correct, or put it in subfield $y.\n";
    } else {
      $(this).removeClass("subfield_not_filled");
    }
  });
  return mes;
};
 
/* Helper function to test whether ISMN is properly formatted */
// note: this assumes field 024 is only used for ISMN and not for any other std number.  
var test024a = function( mes ) {
  var ISMNregex = /^((9790)|M)\d{9}$/;
  $("[id^='tag_024_subfield_a']").each( function() {     // loop over all ISMN fields
    var value = $(this).val();
    if (!value || value == "") { return true; };    // 'continue' statement
    if (!ISMNregex.test(value)) {
      $(this).addClass("subfield_not_filled");
      mes += "Field 024$a: Invalid ISMN format! Please correct, or put it in subfield $z.\n";
    } else {
      $(this).removeClass("subfield_not_filled");
    }
  });
  return mes;
};  
 
/* Helper function for formatting of URLs (currently only supporting https, http, ftp) */
// Regex adapted from http://regexlib.com/REDetails.aspx?regexp_id=1048     
var test856u = function( mes ) {
  var uriRegex = /^(((ht|f)tp(s?))\:\/\/)?((([a-zA-Z0-9_\-]{1,}\.)+[a-zA-Z]{2,})|((?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(\?(\.?\d)\.)){4}))(:[a-zA-Z0-9]+)?(\/[a-zA-Z0-9\-\._\?\,\'/\\\+&amp;%\$#\=~]*)?$/;
  $("[id^='tag_856_subfield_u']").each ( function() {
    var value = $(this).val();
    if (!value || value == "") { return true; };      // continue statement
    if (!uriRegex.test(value)) {
      $(this).addClass("subfield_not_filled");
      mes += "Field 856$u: Invalid URL. \n";
    } else {
      $(this).removeClass("subfield_not_filled");
    }
  });
  return mes;
};

Pass data from the addbiblio to the additem form

  • Developer: Joachim Ganseman. Koninklijk Conservatorium Brussel
  • Creation Date: 2016-06-23
  • Purpose: Speed up catalography by automatically filling fields of the additem form with data from the addbiblio form.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 16.05
if ( $("#cat_addbiblio") ) {  // only do this in the addbiblio form
  // add an additional event handler to the save buttons: when saved, store data in browser. 
  $("#saverecord, #saveandview, #saveanditems, #saveandcontinue").click( function( event ) {
    // copy values that need to be available in additem.pl to HTML5 sessionStorage (no need for cookies)
    sessionStorage.setItem( "current_callnumber",  $("[id^='tag_001_subfield_00']").val() );    // our callnumber is recorded in 001
    sessionStorage.setItem( "current_accessrestriction",  $("[id^='tag_506_subfield_a']").val() );    // our accessrestriction is recorded in 506
    sessionStorage.setItem( "current_status",  $("[id^='tag_583_subfield_l']").val() );    // our lost status is recorded in 583
    return true;
  }
}; // end if in the addbiblio form
 
if ( $("#cat_additem") ) {  // only do this in the additem form.
  // pre-fill the 952$1 "lost status". In Koha default settings, this is encoded as "1" in subfield 1.
  $("[id^='tag_952_subfield_1']").val( (sessionStorage.getItem("current_status") == "LOST") ? "1" : "" );
  // pre-fill the 952$7 "not for loan status". In Koha default settings, this is encoded as "1" in subfield 7.
  $("[id^='tag_952_subfield_7']").val( (sessionStorage.getItem("current_accessrestriction") != "") ? "1" : "" );
  // pre-fill the 952$o "full call number" field.
  $("[id^='tag_952_subfield_o']").val( sessionStorage.getItem("current_callnumber") );
}; // end if in the additem form

Copy data entered in one field to another

  • Developer: Joachim Ganseman. Koninklijk Conservatorium Brussel
  • Creation Date: 2016-06-23
  • Purpose: Speed up catalography by automatically filling in duplicated fields.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 16.05
// Example: in addbiblio form, copy data from field 001, once entered, into field 590$a
$("[id^='tag_001_subfield_00']").blur( function() {
  $("[id^='tag_590_subfield_a']").val( $("[id^='tag_001_subfield_00']").val() );
});

Autofill catalographer information in the addbiblio form

  • Developer: Joachim Ganseman. Koninklijk Conservatorium Brussel
  • Creation Date: 2016-06-23
  • Purpose: Automatically add data that records who did the catalography to a bibliographic record.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 16.05
if ( $("#cat_addbiblio") ) {        // only do this in the addbiblio form
  // put string "Catalography:" in field 583$a
  $("[id^='tag_583_subfield_a']").val("Catalography:");
  // copy login of the current user to field 583$k 
  $("[id^='tag_583_subfield_k']").val( $(".loggedinusername").text() );
  // if not yet set, copy current date in yyyymmdd format to field 583$c
  var yyyymmdd = (new Date()).toISOString().slice(0,10).replace(/-/g,""); // note: this is the GMT date!
  var currentdate = $("[id^='tag_583_subfield_c']").val();
  if (!currentdate || currentdate == "") 
  {
    $("[id^='tag_583_subfield_c']").val(yyyymmdd);
  }
};   // end if addbiblio

Remove "Pay selected" button from "Pay fines" tab in Fines module

  • Developer: George H. Williams - Northeast Kansas Library System
  • Purpose: Removes the "Pay selected" button - There is a bug in 3.22 (see https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15397) that is causing fee payment problems with the "Pay selected" button. This jQuery should remove that button until the bug can be fixed which should prevent new problems from being created
  • Creation Date: 2016.07.18
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.22
//BEGIN Hides "Pay selected" button on the Pay fines tab in the Fines module
     $('#payselected').hide();
//END

Change where the patron link on returns.pl points

  • Developer: Jason Robb (SEKLS)
  • Purpose: In the table generated by check-ins on returns.pl, the patron link directs to the moremember.pl for the patron. This code causes that link to instead point to circulation.pl for the patron.
  • Creation Date: 8/11/2016
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.22
var0 = $('body').is("#circ_returns");
if(var0 !=0) {
$('a').each(function() {
        this.href = this.href.replace('members/moremember.pl', 'circ/circulation.pl');
		}
	)}

Hide fields on add/edit items page based on field label

  • Developer: Jason Robb (SEKLS)
  • Purpose: Hides fields on the add/edit items screen (additem.pl). Streamlines workflow and prevents data from being entered into the wrong field.
  • Creation Date: 8/11/2016
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.22
  • Note: Some fields are hidden by default via the frameworks. I still included those in this as removing them in this manner also removes the extra space their absence creates which makes the screen look cleaner.
var0 = $('body').is("#cat_additem");
if(var0 !=0) {
          $('span:contains("Source of classification or shelving scheme")').parent().parent().parent().hide();
          $('span:contains("Materials specified (bound volume or other part)")').parent().parent().parent().hide();
          $('span:contains("Use restrictions")').parent().parent().parent().hide();
          $('span:contains("Uniform Resource Identifier")').parent().parent().parent().hide();
          $('span:contains("Price effective from")').parent().parent().parent().hide();
          $('span:contains("Price effective from")').parent().parent().parent().hide();
          $('span:contains("Price effective from")').parent().parent().parent().hide();
          $('span:contains("Inventory number")').parent().parent().parent().hide();
          $('span:contains("Shelving control number")').parent().parent().parent().hide();
          $('span:contains("Date last checked out")').parent().parent().parent().hide();
          $('span:contains("Total Checkouts")').parent().parent().parent().hide();
          $('span:contains("Total Renewals")').parent().parent().parent().hide();
          $('span:contains("Total Holds")').parent().parent().parent().hide();
          $('span:contains("Checked out")').parent().parent().parent().hide();
          $('span:contains("Date last seen")').parent().parent().parent().hide();
          $('span:contains("Coded location qualifier")').parent().parent().parent().hide();
             }


Add clear and preset permission buttons to user permissions page

  • Developer: Christopher Brannon (CIN/CDA)
  • Purpose: Adds permission clear and preset buttons to user permissions page.
  • Creation Date: 2/21/17
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 16.x
  • Note: If you want to use this on 3.22, change out all instances of input.flag with input[name="flag"].
$('#pat_member-flags #permissionstree').before('<button id="cleartree" type="button" style="font-size:14px">Clear All Flags</button>&nbsp;<button id="setcirc" type="button" style="font-size:14px">Set Basic Circ</button>&nbsp;<button id="setmanager" type="button" style="font-size:14px">Set Basic Manager</button>');
$( "#cleartree" ).click(function() {
  $('#pat_member-flags input.flag').removeAttr('checked');
  $('#pat_member-flags li.collapsable').find('div').click();
});
$( "#setcirc" ).click(function() {
  $('#pat_member-flags input.flag').removeAttr('checked').removeAttr('disabled');
  $('#pat_member-flags').find('#circulate_circulate_remaining_permissions, #circulate_force_checkout, #circulate_manage_restrictions, #flag-2, #flag-4, #reserveforothers_place_holds, #flag-10, #reports_execute_reports').each(function() {
	$(this).click();
        $(this).closest('li.expandable').find('div').click();
  });
});
$( "#setmanager" ).click(function() {
  $('#pat_member-flags input.flag').removeAttr('checked').removeAttr('disabled');
  $('#pat_member-flags').find('#circulate_circulate_remaining_permissions, #circulate_force_checkout, #circulate_manage_restrictions, #flag-2, #flag-4, #flag-6, #flag-9, #flag-10, #tools_inventory, #tools_items_batchmod, #reports_execute_reports').each(function() {
	$(this).click();
        $(this).closest('li.expandable').find('div').click();
  });
});

OPAC JQuery Statements

Changing the logo in Koha’s OPAC

  • Developer: Koustubha Kale (anantcorp.com)
  • Purpose: Changing the logo in Koha’s OPAC
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any

A jquery based script that can be used in “opacuserjs” syspref which overcomes the image size limitation of "opacsmallimage" syspref. This script allows you to put your own logo in place of the default Koha logo while it shifts the Koha logo, prepending it with text “Powered by :” 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.

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 one of the script you can give link to your logo. On line two you can set the background color for the transparent Koha logo image and on line three 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.

Don't forget to surround the code above in
 $(document).ready(function(){ and });
inside the "opacuserjs" preference.


Change the text of the OPAC login link

  • Developer: Owen Leonard (Nelsonville Public Library)
  • Purpose: Change the text of the OPAC login link
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any
  $("#members a:contains('Log in to Your Account')").text("Log In");


Add AuthorAlerts.org links to the OPAC

  • Developer: Kyle M Hall
  • Purpose: Adds links to authoralerts.org to OPAC search results and details ( make sure to change YOUR_SITE_ID to your actual siteid )
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any
  // add Author Alerts to search results
  $("span.author").each(function(){
    var author = $(this).text().trim();
    var gp = $(this).parent().parent();
    gp.children(".actions-menu").append('<span class="actions"><a href="http://authoralerts.org/?YOUR_SITE_ID=7019&AuthorName=' + author + '"><i class="icon-user"></i> Add author alert</a></span>');
  });
 
  // add Author Alerts to record details
  $( "span[property='author'] span[property='name']" ).each(function(){
    var author = $(this).text().trim();
    console.log( author );
    $("a.addtocart").parent().append('<li>  <a href="http://authoralerts.org/?YOUR_SITE_ID=7019&AuthorName=' + author + '"><i class="icon-user"></i>   Add author alert</a></li>');
  });


Change the text of the OPAC login form

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Change the text of the Log in form on the right of the homepage
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any (prog and ccsr)
$(document).ready(function(){
  $("#auth legend:contains('Log in to your account')").text("Log in to your library account");
  $("#auth label[for='userid']").html("Library Card Number:");
  $("#auth label[for='password']").html("PIN:");
});


Change the text of the OPAC login form (Bootstrap)

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Change the text of the Log in form on the right of the homepage and the pop up box
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+ (bootstrap)
//relabel login boxes
  $("#auth label[for='userid']").html("Card number:");
  $("#auth label[for='password']").html("Last name:");
  $("#modalAuth label[for='muserid']").html("Card number:");
  $("#modalAuth label[for='mpassword']").html("Last name:");

Replaces text below login form for private OPAC's

  • Developer: Christopher Vella, CALYX: Information Essentials
  • Purpose: Replaces the helper text below the login box on for private OPAC's.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.16+
  $(document).ready(function(){
     $("#nologininstructions").html("<p>Add some html here</p>");
  });

Rename 'Place Hold' in OPAC to 'Get It Now!'

  • Developer: Owen Leonard (Nelsonville Public Library)
  • Purpose: Change the 'Place Hold' text throuhgout the OPAC with 'Get it Now!'
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.2
  $(document).ready(function(){
  var holdlinks = $("a:contains('Place Hold'),a:contains('Place hold')");
  $(holdlinks).text("Get It Now!");
  });
  $(window).load(function(){
  $("input[value='Place Hold']").attr("value","Get  It Now!");
  });


Rename 'Browse Shelf' in OPAC to 'See Similar Items'

  • Developer: Ian Walls (ByWater Solutions)
  • Purpose: Change the 'Browse Shelf' text after the callnumber in opac-detail to 'See Similar Items'
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.4
  $(document).ready(function(){
    $("a:contains('Browse Shelf')").text("See Similar Items");
  });


Add a link to the header only if a patron is logged into the OPAC

  • Developer: Galen Charlton
  • Purpose: Adds a link to the OPAC masthead only if the patron is logged into the OPAC.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any
  • Note: This can be generalized to alter behavior or display when a patron is logged in. For this specific example, note that somebody viewing source can see the link's URL, so be careful if using this to present super-sekrit (sic) stuff only to logged-in patrons.
  if ($("#logout").length) {
     $("#moresearches").append("<span class=\"pipe\"> | </span><a href=\"http://bursar.example.edu/\">Pay fines</a>");
  }


Change where the header logo link goes

  • Developer: D Ruth Bavousett, ByWater Solutions
  • Purpose: Reroute the link on the logo to someplace other than opac-main
  • Status: Completed /
  • Intranet or OPAC?: OPAC
  • Version: 3.2+, but will probably work way, way back.
  $("#libraryname a").attr('href','http://your.link.here');


Remove the textual item type description from the OPAC holdings table

  • Developer: Jared Camins-Esakov (ByWater Solutions)
  • Purpose: Remove the textual item type description from the OPAC holdings table
  • Status: Completed /
  • Intranet or OPAC?: OPAC
  • Version: 3.2+
  • Programming notes: The magic number '3' is used instead of Node.TEXT_NODE because Internet Explorer apparently does not export that constant into the global namespace.
  $("#holdingst tbody tr td:nth-child(1)").contents().filter(function() { return this.nodeType == 3; }).remove();


Replace '--' with carriage returns in title notes on OPAC details

  • Developer: D Ruth Bavousett, ByWater Solutions
  • Purpose: formatting/layout hack for Title Notes section
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any
  $("#descriptions .content_set").html($("#descriptions .content_set").html().replace(/--/g,'<br />'));


Force suggestions table in OPAC to show "Library Staff" as manager

  • Developer: D Ruth Bavousett, ByWater Solutions
  • Purpose: Library desires to not name names for who managed suggestions--"Library Staff" should be shown for all
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.4
 $('#suggestt tr').each(function() {
    $(this).find("td:nth-child(4)").html("Library Staff");    
});


Change "Available for reference" note in search results to something more appropriate to ebooks

  • Developer: Jared Camins-Esakov, ByWater Solutions
  • Purpose: Change the text of the "Available for reference" note in OPAC search results to something more appropriate for ebooks, which may not actually be available as a physical book in the library at all.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.2+
  $(".available b:contains('reference')").text("View e-resources online; If available in print, one or more copies may only be used in: ");


Hide 'Save Record' Box in OPAC

  • Developer: Joy Nelson, ByWater Solutions
  • Purpose: Remove the 'Save Record' box on the bib detail in the OPAC.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.4+
$(document).ready(function(){
$("#export").remove();
});


Change Text in Drop Down list for 'Save Record' (3.4+)

  • Developer: Joy Nelson, ByWater Solutions
  • Purpose: Change Text in Drop Down list for 'Save Record' from BIBTEX to Endnote
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.4+
$('#export option[value="bibtex"]').text('EndNote');

Change Text in Drop Down list for 'Save Record' (3.14+)

  • Developer: Nicole Engard, ByWater Solutions
  • Purpose: Change Text in Drop Down list for 'Save Record' from BIBTEX to RefWorks
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+
//change bibtex to refworks
$("#export a:contains('BIBTEX')").html('                                        RefWorks');

Break OPAC SearchForTitleIn out of dropdown

  • Developer: Ian Walls, ByWater Solutions
  • Purpose: Make the content in SearchForTitleIn always visible, instead of appearing only when the "more searches" button is clicked
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.4+
$("a#furthersearches").parent().hide();
$("#furtherm").attr("class","").attr("style","");
$("#furtherm div ul li").attr("style", "list-style:none");

Hiding a library from the list in the drop-down in the OPAC

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: This hides a library branch from the drop-down selection on the search main screen. You will need to identify the branch code and replace "CODE" with the appropriate code for the branch you wish to hide.
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: 3.6+
$("#select_library option[value='branch:CODE']").remove();


Move Navigation

  • Developer: Elliott Davis (UT Tyler)
  • Purpose: Move Navigation Menu Below OpacMainSearch
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: All
   $('#header-wrapper').append($('#navigation'));


Move List Dropdown

  • Developer: Elliott Davis (UT Tyler)
  • Purpose: Move lists dropdown to main menu
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: All
   $('#listsmenulink').appendTo('.main-menu > .last');


Opac Search Results Sort

  • Developer: Elliott Davis (UT Tyler)
  • Purpose: Change wording in call number sort
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: All
    $("option[value='call_number_asc']").html("Call Number Ascending");
    $("option[value='call_number_dsc']").html("Call Number Descending");


Add a bookplate when cover images are not found

  • Developer: Jared Camins-Esakov, C & P Bibliography Services
  • Purpose: Replace the "No cover image" message on the OPAC with a custom bookplate
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: All
  • Note: Replace "bookplate.jpg" in the script with the URL to the image you want to use
    $('.no-image').css('background-image','url(bookplate.jpg)');


Show nothing when cover images are not found

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Remove the "No cover image" message on the OPAC
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: All
$(document).ready(function(){
    $('.no-image').remove();
});

Alert patrons about exhausting their renewals early when they login to the OPAC

  • Developer: Paul Landers - Texas Tech University Health Sciences Center
  • Purpose: Adds an alert to the top of the OPAC only if the patron is logged into the OPAC.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any
  • Note: When the OPAC RenewalPeriodBase preference is set to the current date, patrons can accidently exhaust their renewals early. This code will place a prominent alert at the top of the OPAC upon patron login. This code is a modified version of Galen Charlton's code Add a link to the header only if a patron is logged into the OPAC
  if ($("#logout").length) {
     $("#members").prepend("<p style=\"text-align:center;font-size:20px;background:red;color:white;margin-right:25%;margin-left:25%\">ALERT - renewing your items early or clicking 'renew' more than once will reduce your total checkout time.</p>");
  }

Move OPACResultsSidebar to the top

  • Developer: Derryn Jones
  • Purpose: Moves the OPACResultsSidebar to the top
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any (Tested on 3.6 - 3.10)
    $("#facetcontainer.container").prepend($("#opacresultssidebar"));


Remove all links on SCO (Self-Checkout)

  • Developer: Derryn Jones
  • Creation Date: 2013-03-26
  • Purpose: Removes all links on SCO page to stop people using the SCO as a browser (Very useful if you're using a kiosk with no back/forward buttons)
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any (Tested on 3.10)
if(/sco-main/.test(self.location.href))
{
$('a').removeAttr('href')
}


Hiding a library from the pickup location drop-down in the OPAC "Place Hold" screen

  • Developer: George H. Williams, Latah County Library District
  • Purpose: This hides a library branch from the pickup location drop-down in the "Place Hold" screen in the OPAC. This prevents patrons from having a hold delivered to the branch you specify unless that branch is their home library. Replace "BRANCHCODE" with the code for the branch you wish to remove from the drop-down.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.8
$("#bibitemloop option[value='BRANCHCODE']").hide();

Hiding a library from the pickup location drop-down in the OPAC "Place Hold" screen (3.18+)

  • Developer: David Roberts, PTFS Europe
  • Purpose: This hides a library branch from the pickup location drop-down in the "Place Hold" screen in the OPAC. This prevents patrons from having a hold delivered to the branch you specify unless that branch is their home library. Replace "BRANCHCODE" with the code for the branch you wish to remove from the drop-down.
  • Creation Date: (2015-02-10)
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.18+
$("[id^=branch] option[value='BRANCHCODE']").remove();

Hide the CART button

  • Developer: Paul Landers - Texas Tech University Health Sciences Center
  • Purpose: Hide the CART button.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any
  • Note: Hide the CART button.
$('#cmspan').hide();

Change Browse Authorities to say Search

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: The link to search the authorities says 'browse' but it's a search, so this changes it to be clearer.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any


    $("a:contains('Browse by author or subject')").text("Search authorities");

Make the opac more multilingual

  • Developer: Jonathan Druart, Gaetan Boisson, BibLibre
  • Creation Date: (2013-06-06), updated 2013-06-18
  • Purpose: The system preferences for customizing OPAC regions only allow for one language, so an opac with several languages will always show the same text here whatever the language selected by the user. This allows for switching to a different language when using the selector at the bottom of the screen. To achieve this, you will need to put each language in a separate div in the concerned system preference, each div will have a class named after the value the KohaOpacLanguage cookie will take when this language is selected. You will also need to add a bit of css so that all those divs are hidden by default. (Such as "div.en, div.ar-Arab {display:none;}"). If not language is set, the default is set to english, be sure to change this if your opac doesn't use this language, as it will be used when a user first land on the website.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10.04
$(document).ready(function(){
var myLang = $('html').attr('lang');
$("div."+myLang).show();
});

On our first iteration we used the values in the cookie, here is the code for reference, which shows how to fetch the information from cookies, but the new version above is obviously much more simple and fool proof (you don't need to set a default value as it seems this attribute is always set).

$(document).ready(function(){
var url = 'https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js';
$.getScript( url, function(){
  var myLang = jQuery.cookie('KohaOpacLanguage');
  if(!myLang) myLang = "en";
  $("div."+myLang).show();
  });
});

Hide Location Column

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: This hides the location column in the holdings table in the OPAC.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10.x


//Hide Location Column
$("th#item_location").hide();
$("td.location").hide();

Hide Collection Column

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: This hides the collection column in the holdings table in the OPAC.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10.x


//Hide Collection Column
$("th#item_ccode").hide();
$("td.collection").hide();

Change "Quote of the Day" Label

  • Developer: Galen Charlton, Equinox Software
  • Purpose: This changes the text of the Quote of the Day label in the OPAC.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10.x+
  $('#daily-quote h1').text('Wisdom of the Day');


Hide Login Help

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Hide the login help text from the OPAC login page
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+
 $("#nologininstructions").hide();


Change Login Help

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: Change the login help text from the OPAC login page
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+
$("#nologininstructions").html("<h5>Do not have a password yet?</h5><p>If you do not have a password yet, give us a call at XXX or email us at XXX.</p><h5>Do not have a library card?</h5><p> If you do not have a library card, stop by your local library to sign up.  </p>");

Hide OPAC Login on Right

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Hide the login box on the main opac page
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.8+
  $("#login").hide();

Add Title Phrase to the simple search

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: Adds Title Phrase to the simple search
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+
$("#masthead_search option[value='ti']").after("<option value=\'ti,phr\'>Title Phrase</option>");
 
$("select[name='idx']:eq(0)").val("ti").attr("selected","selected");
 
$("select[name='idx']:eq(1)").val("ti,phr").attr("selected","selected");

Change 'my fines' to 'my charges'

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: Change tab on patron's record from 'my fines' to 'my charges'
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+


$("#menu [href='/cgi-bin/koha/opac-account.pl']").text('my charges');

Change all occurrences of the word 'Fines' to 'Charges' in My Account

  • Developer: David Roberts, PTFS Europe
  • Purpose: Change all occurrences of the word 'Fines' to 'Charges' in My Account
  • Creation Date: 2015-03-05
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Theme: BootStrap
  • Version: 3.18
$("#menu ul > li > a:contains('your fines')").html('your charges');
$("#opac-user-views th:contains('Fines')").html('Charges');
$("#opac-user-views ul > li > a:contains('Fines')").text(function () {
    return $(this).text().replace("Fines", "Charges");
      });


Change "purchase suggestion" to "request for this item"

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: Change tab on patron's record from 'my fines' to 'my charges'
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+


    $('a[href="/cgi-bin/koha/opac-suggestions.pl?op=add"]').text('request for this item');


Change "purchase suggestion" to "request for this item"

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Change privacy list items on 'my privacy' tab
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+


 $("li.privacy0").html("Forever - Keep my reading history until I choose to delete it.");
 $("li.privacy1").html("Default - Keep my reading history until the end of the current semester or summer or until I choose to delete it.");
 $("li.privacy2").html("Never - Delete my reading history immediately. Upon check-in, my name will not display and the item will never appear in my reading history.");


Hide branch from search pulldown

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: Hide a branch from the search pull down
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+


$("#select_library option[value='branch:BRANCHCODE']").hide();


Change comment pending text

  • Developer: Ed Veal, ByWater Solutions
  • Purpose: Change the text that appears when a comment is pending
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+


$("#reviewf p").replaceWith("<p>Your comment, once approved by a librarian, will be made public in the library’s web-based catalog.  Your full name will be associated with your comment.  The library respects the right of its users to express themselves but will not tolerate abusive behavior.  Reviews may not include profanity, obscenities, spiteful remarks, personal information, URLs or email addresses.</p>");


Hide Topic & Places Facets

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Removes the Current location column in Holdings table
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+
$("li#su-geo_id").hide();
$("li#su-to_id").hide();

Hide home link on home page (CCSR)

  • Developer: Owen Leonard
  • Purpose: Removes the link to Home from the CCSR opac homepage
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+
$("#opac-main #breadcrumbs").hide();

Hide home link on home page (Bootstrap)

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Removes the link to Home from the Bootstrap opac homepage
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+
if (window.location.href.indexOf("/koha/opac-main.pl") > -1) {
$("ul.breadcrumb").remove();
}

Relabel Acquisitions Date Sort Options

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Changing the acquisition date sort options to read 'date added' instead
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+
$('#sort_by option[value="acqdate_dsc"]').text('Date added: Newest to oldest');
$('#sort_by option[value="acqdate_asc"]').text('Date added: Oldest to newest');

Relabel Holds as Requests

  • Developer: Nicole C. Engard, ByWater Solutions with Owen Leonard (additions by Liz Rea, Catalyst IT)
  • Purpose: This will change all occurrences of the word Holds in the OPAC to Request
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.12+
$("input[value='Place hold']").attr("value","Place Request");
$("a#ui-id-3:contains('Holds')").html('Requests');
$("input[value='Suspend all holds']").attr("value","Suspend all requests");
$("input[value='Resume all suspended holds']").attr("value","Resume all suspended requests");
$("input[value='Place Hold']").attr("value","Place Request");
var holdcount = $("#holdst caption .count").text();
$("#holdst caption").text("Requests " + holdcount);
$("a[href='#opac-user-holds']").text("Requests ");
var holdlinks = $("a:contains('Place Hold'),a:contains('Place hold')");
$(holdlinks).text("Request Item");
$("#opac-holds h3:contains('holds')").html("Confirm requests: ");
$("#opac-holds .priority span.label").html("Requests and priority:");
$("#opac-holds .hold-options label:contains('Hold not needed after:')").text("Request not needed after: ");

In the opaccredits, put:

<script type="text/javascript">
$(document).ready(function () { $('.confirmjs_hold label').contents().filter(function () { return this.nodeType === 3; }).replaceWith(' Place a request for '); });
</script>

Open item specific links in a new tab

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: This will make links in the holdings table (urls on items) open in a new tab
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.12+
 $("td.url a").attr('target', '_blank');

Disable External Links on SCO

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: This assumes that the header is linked and that you have the 'powered by koha' link. Both links will be disabled with this jquery on the self check page.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+
/* remove the ability to click links out of the self check */
if (window.location.href.indexOf("sco/sco-main.pl") > -1) {
$('#opacheader').bind('click', false);
$('#koha_url').bind('click', false);
}

Add Start Over Link Below Search Bar

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Adds a start over link right below the search bar
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+
//Adds "Start over" to moresearches
$("#moresearches ul").prepend('<li><a href="/" >Start Over</a></li>');

Pre-fill the UserID fields with a library card prefix

  • Developer: Aaron Sakovich
  • Purpose: Pre-fills the User ID fields with a library card prefix or other value.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+
  • Theme: BootStrap
  • Note: If your system uses a standard prefix for library cards, this can save your patrons a little bit of typing while also providing them a visual cue as to where to enter their card number when logging in to the OPAC. Note in the sample code below, the 7 digit prefix used is 1234567; this should be changed for your prefix or other value you'd like.
$(document).ready(function () {
    var userIDField = document.getElementById("userid");
    if ($('#userid').length > 0) {userIDField.value = "1234567";}
    var muserIDField = document.getElementById("muserid");
    if ($('#muserid').length > 0) {muserIDField.value = "1234567";}
});


Add a link to the more searches menu

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Adds link to the more searches menu
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+
//add faq link to menu at top
$("#moresearches li:contains('Course reserves')").after("<a href='http://FAQLINK'>Library Catalog FAQ</a></li>");

Change more searches capitalization

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Changes more searches to title case
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+
//capitalize more searches links
$("#moresearches a:contains('Course reserves')").html('Course Reserves');
$("#moresearches a:contains('Advanced search')").html('Advanced Search');

Fix Subject Search Links

  • Developer: Christopher Brannon - Coeur d'Alene Public Library/CIN
  • Purpose: Subject search links in records break if the subject contains parenthesis. This jquery strips the parenthesis from the url link, making the link usable again.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14
//Fix subject search by striping parenthesis from url links
$('#catalogue_detail_biblio a[href*="su:"]').attr('href', function(_,v){
    return v.replace(/(\w)(\(|\))(\w)/g,'$1 $3')
}).attr('href', function(_,v){
    return v.replace(/(\(|\))/g,'')
});
//End fix subject search


Hide Marc & ISBD view from OPAC

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Hide Marc & ISBD view from OPAC
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+
 $(".view a:contains('MARC view')").hide();
 $(".view a:contains('ISBD view')").hide();


Change URL in Holdings to Text

  • Developer: Nicole C. Engard, ByWater Solutions
  • Purpose: Make the URL in the item holdings table show as linked text instead of a long URL
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.14+
//change item url to say visit site
$("td.url a").text("Visit site");

Rename the Cart (multilang)

  • Developer: Zeno Tajoli, an expand of A. Longoria, Texas State Law Library, work
  • Purpose: Rename the Cart in the OPAC to My Books and use a folder icon and manage more than one languages
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.18 (only, modify for others versions)
  • Note: YOu MUST use it OUTSIDE $(document).ready(function(){ ... });. Because it use global variables and strings override
var myLang = $('html').attr('lang');
if (myLang === 'en') {
  /* re-define the messages */
  MSG_BASKET_EMPTY = _("My Books is currently empty");
  MSG_RECORD_IN_BASKET = _("This item is already in My Books");
  MSG_RECORD_ADDED = _("This item has been added to My Books");
  MSG_RECORD_REMOVED = _("The item has been removed from My Books");
  MSG_NRECORDS_ADDED = _(" item(s) added to My Books");
  MSG_NRECORDS_IN_BASKET = _("already in My Books");
  MSG_NO_RECORD_ADDED = _("No item was added to My Books");
  MSG_CONFIRM_DEL_BASKET = _("Are you sure you want to empty My Books?");
  MSG_ITEM_IN_CART = _("Already in My Books");
  MSG_IN_YOUR_CART = _("Items in My Books: ");
  MSG_ITEM_NOT_IN_CART = _("Add to My Books");
 
  /* change the links in OPAC search results and details page */
  $('a.addtocart').each(function() {
    var msg = $(this).text();
    if(msg === 'Add to cart' || msg === 'Add to your cart')
      $(this).text(MSG_ITEM_NOT_IN_CART);
    else if (msg === 'In your cart')
      $(this).text(MSG_ITEM_IN_CART);
    });
 
  /* links in the item details page */
  $('a.incart').each(function() {
    var msg = $(this).text();
    if(msg === 'In your cart')
      $(this).text(MSG_ITEM_IN_CART);
    });
  /* Title in display of cart */
  $("#userbasket h2:contains('Your cart')").html('My Books');
 
  $("span.addto").on('click', function() {
    $("select#addto > option:contains('Cart')").html("My Books");
  });
 
  top_button_convert = function() {
    var basketcount = '';
    if($('#basketcount').text())
    basketcount = $('#basketcount').html();
    $("#cartmenulink").html(
    '<i id="carticon" class="icon-folder-open icon-white"></i><span> My Books<span id="basketcount">' + basketcount + '</span></span>');
  };
 
  top_button_convert(); // run once 
 
  $("a.addtocart").on('click', function() {
    top_button_convert();  // run on given clicks
  });
};
 
if (myLang === 'it-IT') {
  /* re-define the messages */
  MSG_BASKET_EMPTY = _("My Books è vuoto");
  MSG_RECORD_IN_BASKET = _("Questa copia è gia in My Books");
  MSG_RECORD_ADDED = _("Questa copia è stata aggiunta a My Books");
  MSG_RECORD_REMOVED = _("Questa copia è stata rimossa da My Books");
  MSG_NRECORDS_ADDED = _(" copia(e) aggiunta(e) a My Books");
  MSG_NRECORDS_IN_BASKET = _("già  in My Books");
  MSG_NO_RECORD_ADDED = _("Nessuna copia aggiunta a My Books");
  MSG_CONFIRM_DEL_BASKET = _("Sei sicuro di svuotare My Books?");
  MSG_ITEM_IN_CART = _("Già in My Books");
  MSG_IN_YOUR_CART = _("Copia in My Books: ");
  MSG_ITEM_NOT_IN_CART = _("Aggiungi a My Books");
 
  /* change the links in OPAC search results and details page */
  $('a.addtocart').each(function() {
    var msg = $(this).text();
    if(msg === 'Aggiungi al carrello' || msg === 'Clicca per aggiungere al carrello')
      $(this).text(MSG_ITEM_NOT_IN_CART);
    else if (msg === 'Nel tuo carrello')
     $(this).text(MSG_ITEM_IN_CART);
  });
 
  /* links in the item details page */
  $('a.incart').each(function() {
    var msg = $(this).text();
    if(msg === 'Nel tuo carrello')
      $(this).text(MSG_ITEM_IN_CART);
    if(msg === 'Il tuo carrello')
      $(this).text('My Books');
  });
 
  $("#userbasket h2:contains('Il tuo carrello')").html('My Books');
 
  $("span.addto").on('click', function() {
    $("select#addto > option:contains('Cart')").html("My Books");
  });
 
  top_button_convert = function() {
    var basketcount = '';
    if($('#basketcount').text())
    basketcount = $('#basketcount').html();
    $("#cartmenulink").html(
    '<i id="carticon" class="icon-folder-open icon-white"></i><span> My Books<span id="basketcount">' + basketcount + '</span></span>');
  };
 
  top_button_convert(); // run once 
 
  $("a.addtocart").on('click', function() {
    top_button_convert();  // run on given clicks
  });
};

Rename the Cart

  • Developer: A. Longoria, Texas State Law Library, expanding on code from the Brooklyn School of Law OPAC
  • Purpose: Rename the Cart in the OPAC to My Books and use a folder icon instead of shopping cart.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.16
  • Note: Renames the Cart to My Books in the OPAC and changes its icon. Started with code found at http://sara.brooklaw.edu
/* re-define the messages */
MSG_BASKET_EMPTY = _("My Books is currently empty");
MSG_RECORD_IN_BASKET = _("This item is already in My Books");
MSG_RECORD_ADDED = _("This item has been added to My Books");
MSG_RECORD_REMOVED = _("The item has been removed from My Books");
MSG_NRECORDS_ADDED = _(" item(s) added to My Books");
MSG_NRECORDS_IN_BASKET = _("already in My Books");
MSG_NO_RECORD_ADDED = _("No item was added to My Books");
MSG_CONFIRM_DEL_BASKET = _("Are you sure you want to empty My Books?");
MSG_ITEM_IN_CART = _("Already in My Books");
MSG_IN_YOUR_CART = _("Items in My Books: ");
MSG_ITEM_NOT_IN_CART = _("Add to My Books");
 
/* change the links in OPAC search results and details page */
$('a.addtocart').each(function() {
 var msg = $(this).text();
 if(msg === 'Add to cart' || msg === 'Add to your cart')
  $(this).text(MSG_ITEM_NOT_IN_CART);
 else if (msg === 'In your cart')
  $(this).text(MSG_ITEM_IN_CART);
});
 
/* links in the item details page */
$('a.incart').each(function() {
 var msg = $(this).text();
 if(msg === 'In your cart')
  $(this).text(MSG_ITEM_IN_CART);
});
 
$(".container > h1:contains('Your Cart')").html("My Books");
 
$("span.addto").on('click', function() {
 $("select#addto > option:contains('Cart')").html("My Books");
});
 
top_button_convert = function() {
 var basketcount = '';
 if($('#basketcount').text())
  basketcount = $('#basketcount').html();
 $("#cartmenulink").html(
'<i id="carticon" class="icon-folder-open icon-white"></i><span> My Books<span id="basketcount">' + basketcount + '</span></span>'
 );
};
 
top_button_convert(); // run once 
 
$("a.addtocart").on('click', function() {
 top_button_convert();  // run on given clicks
});


Filter Courses

  • Developer: Switch Consortium
  • Purpose: Add pull down at the top of the course reserves list to select department/library and filter the list of courses
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.20
  • Note: Assumes that you're using branches as the departments
//Drop down for course reserves
$('#course_reserves_table_filter').before('<label style="font-weight:bold; font-size:12px;">Select Reserves by Library: <select class="deptSearch"><option value="">All libraries</option><option value="YOUR BRANCHCODE">YOUR LIBRARY NAME</option></select></label>');
 
$(".deptSearch").change(function(){
   $('#course_reserves_table').DataTable().column(1).search(this.value); 
   $('#course_reserves_table').DataTable().draw();
});

Blank the Home library dropdown on self-registration

  • Developer: Jason Robb (SEKLS)
  • Purpose: On self-registration, makes the first option in the Home library dropdown a blank so patrons are forced to choose a library rather than defaulting to the first library in the list.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.22
var0 = $('body').is("#opac-patron-registration.opac"); //Makes sure the change only happens on self-registration
if(var0 !=0) {
    $("#borrower_branchcode").prepend("<option value=''></option>").val('');
}

Search-related customizations for the OPAC

Add additional searches to OPAC

  • Developer: Jared Camins-Esakov
  • Purpose: Adds additional searches to the OPAC Search type dropdown
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any
  • Note: Both indexes used here are custom. In order to use the Auction date index, MARC21 field 033$a would need to be indexed and linked to CCL search prefix 'adate:'. In order to use the Journal title index, MARC21 field 773$t would need to be indexed and linked to CCL search prefix 'Host-item:'.
  $("select[name='idx']").append("<option value='adate'>Auction date</option><option value='Host-item,wrdl'>Journal title</option>");


Add focus to OPAC Search

  • Developer: Jared Camins-Esakov
  • Purpose: The opac search didn't seem to get focus. This adds that functionality.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.2.x (afaik)
$("#transl1").focus();


Append text to the OPAC search results

  • Developer: Owen Leonard (Nelsonville Public Library)
  • Purpose: Append text to the OPAC search results. Useful if you want to promote an alternate means of finding results (interlibrary loan?) or point the user to more resources (chat with a librarian?).
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any
  $(".searchresults").after("<p>Not finding what you\'re looking for? Make a <a href=\"http://koha.example.org/cgi-bin/koha/opac-suggestions.pl\">purchase suggestion</a></p>");


Change "Library Catalog" to "Keyword" in OPAC main search

  • Developer: Jared Camins-Esakov
  • Purpose: Changes the string "Library Catalog" to "Keyword" in the OPAC main search.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: Any
  $("select[name='idx'] option:first").text('Keyword');


Remove language selection fieldset from OPAC advanced Search

  • Developer: Liz Rea
  • Purpose: remove language selection fieldset from OPAC advanced search
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: tested 3.4
$("#advsearch legend:contains('Language')").parent().hide();


Remove Subtype Limits from OPAC Advanced Search

  • Developer: Nicole Engard
  • Purpose: remove subtype selection fieldset from OPAC advanced search
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: tested 3.4
$("#advsearch legend:contains('Subtype limits')").parent().hide();

Change Availability Display in Search Results

  • Developer: Nick Clemens
  • Purpose: Hide Library names/call numbers from availability and encourage user to click on title for details. If search is branch limited show only 'Owned by Library X'
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: tested 3.12 with XSLT
    var limitexist = $("title").text().match(/'.*branch:([\w- ]*)( .*:.*)*'/);
 
    if(limitexist==null){
        $(".results_summary.availability > .label").text("Total Availability (Click title for details): ");
        $(".available").each( function(){
            $(this).text("Libraries with copies available ("+($(this).text().split('(').length-1)+") ");
        });
    }
    else{
        $(".results_summary.availability > .label").text("Owned by "+limitexist[1]+" - click on title for availability");
        $(".available").hide();
        $(".unavailable").hide();
    }

Enhanced content for the OPAC

Add direct export to RefWorks link to OPAC

  • Developer: Jared Camins-Esakov, ByWater Solutions
  • Purpose: Add a link to directly export a citation to RefWorks
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.2+
  function getParameterByName( name )
  {
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results == null )
      return "";
    else
      return decodeURIComponent(results[1].replace(/\+/g, " "));
  }
 
  $(document).ready(function(){
  $("<div id='refworks'><a href='http://www.refworks.com/express/expressimport.asp?vendor=Koha&filter=RIS%20Format&encoding=65001&url=http%3A%2F%2F" + location.host + "%2Fcgi-bin%2Fkoha%2Fopac-export.pl%3Fop%3Dexport%26format%3Dris%26bib%3D" + getParameterByName('biblionumber') + "' target='RefWorksMain'>Export to RefWorks</a></div>").appendTo("#export");
  $("#userbasket #toolbar .download").parent().after("<li><a class='download' href='http://www.refworks.com/express/expressimport.asp?vendor=Koha&filter=RIS%20Format&encoding=65001&url=http%3A%2F%2F" + location.host + "%2Fcgi-bin%2Fkoha%2Fopac-downloadcart.pl%3Fformat%3Dris%26bib_list%3D" + encodeURIComponent(getParameterByName('bib_list')) + "' target='RefWorksMain'>Export to RefWorks</a></li>")
  $("#usershelves #toolbar .download").after("<span id='refworks'><a class='download tag_hides' href='http://www.refworks.com/express/expressimport.asp?vendor=Koha&filter=RIS%20Format&encoding=65001&url=http%3A%2F%2F" + location.host + "%2Fcgi-bin%2Fkoha%2Fopac-downloadshelf.pl%3Fformat%3Dris%26shelfid%3D" + encodeURIComponent(getParameterByName('viewshelf')) + "' target='RefWorksMain'>Export to RefWorks</a></span>");
  });


Add a link to map the publisher's location

  • Developer: Jared Camins-Esakov, C & P Bibliography Services
  • Purpose: Add a link to map the publisher's location.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: All


  • Note: This particular implementation is for MARC21, and retrieves the location from an authority-controlled 751. In order to identify the correct 751, it looks for the relator code 'pup' (place of publication).
    $.get("/cgi-bin/koha/opac-export.pl",
        { bib: $("input[name='bib']").val(), format: "marcxml" },
        function(data){
            $(".publisher > span[class='label']:first").append("<a target='_blank' href='http://maps.google.com/maps?q=" + $(data).find("datafield[tag='751'] > subfield[code='4']:contains('pup')").parent().find("subfield[code='a']").text() + "'><img src='/opac-tmpl/prog/famfamfam/MP.png' alt='Show publisher on map' title='Show publisher on map' /></a>");
        }
    );
  • Note: This particular implementation is for MARC21, and retrieves the location from the 260$a, then removes any trailing punctuation. For all but the most recent of books, this is likely to result in an inaccurate (or useless) map.
  $.get("/cgi-bin/koha/opac-export.pl",
    { bib: $("input[name='bib']").val(), format: "marcxml" },
    function(data){
      $(".publisher > span[class='label']:first").append("<a target='_blank' href='http://maps.google.com/maps?q=" + $(data).find("datafield[tag='260'] > subfield[code='a']").text().replace(/\W+$/, '') + "'><img src='/opac-tmpl/prog/famfamfam/MP.png' alt='Show publisher on map' title='Show publisher on map' /></a>");
    }
  );


Add links out to Wikipedia for authors

  • Developer: Stefano Bargioni (Pontificia Università della Santa Croce)
  • Creation Date: 2014-02-14
  • Purpose: Add a link for each author to bring the user to a Wikipedia search
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: all (tested in 3.12)
var names = $('h5.author a').not('.authlink');
for (var i=0; i < names.length; i++) {
	var name_string = $(names[i]).text(); // mostly surname, name
	var fs = (name_string+', ').split(', ');
	var H = new Array;
	H.push(' <span title="Search for this person in Wikipedia">');
	H.push('<a target="_blank" href="http://en.wikipedia.org/w/index.php?title=Special%3ASearch&search=');
	H.push(encodeURIComponent(fs[1]+' '+fs[0]));
	H.push('"><img src="http://upload.wikimedia.org/wikipedia/commons/b/b0/Wikipedia-favicon.png"/></a>');
	H.push('</span>');
	$(names[i]).after(H.join(''));
};
  • Developer: Jared Camins-Esakov, C & P Bibliography Services
  • Purpose: Add a link for each author to bring the user to a Wikipedia search [obsolete]
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: before 3.12
    $("h5.author > a").each(function() {
        $("<a href='http://en.wikipedia.org/wiki/Special:Search?search=" + encodeURI($(this).text().replace(/\[.*\]/g, '').replace(/[\W\d]+$/, '')) + "' title='Search for this person in Wikipedia'><img src='http://upload.wikimedia.org/wikipedia/commons/b/b0/Wikipedia-favicon.png'/></a>").insertAfter($(this));
    });



Add iDreamBooks.com Readometer to OPAC

  • Developer: C & P Bibliography Services
  • Purpose: Add a "Readometer" from iDreamBooks.com to the OPAC to show aggregated information about reviews of the book by professional critics.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.6+ with XSLT enabled for the OPAC details page
  • Note: This is an updated version that offers better web browser compatibility. Anyone using the iFrame version originally posted should switch.
        var isbn = $(".isbn:last").text().split(" ")[1];
        if (isbn) {
        isbn = isbn.replace(/\W*$/, '');
 
        if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
        // Use Microsoft XDR for IE version 8 or above
            var xdr = new XDomainRequest();
            xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
            xdr.onload = function() {
                if (! typeof(json) == 'undefined') {
                    json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
                    eval(json); // json is now a regular JSON object
                    $(".title").append('<a href="'+json.book.detail_link+'" id="idreambooksreadometer"><img src="http://idreambooks.com/remotereadometer/'+isbn+'.jpg" alt="'+json.book.title+' by '+json.book.author+'" title="Rating based on reviews of '+json.book.title+'"></a>');
                }
            }
            xdr.send();
        } else {
            $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
                if (! typeof(json) == 'undefined') {
                    $(".title").append('<a href="'+json.book.detail_link+'" id="idreambooksreadometer"><img src="http://idreambooks.com/remotereadometer/'+isbn+'.jpg" alt="'+json.book.title+' by '+json.book.author+'" title="Rating based on reviews of '+json.book.title+'"></a>');
                }
            });
        }
    }

You will also need the following line of CSS in your OPACUserCSS:

#idreambooksreadometer {
    float: right;
}

Add iDreamBooks.com reviews tab to OPAC (3.6-3.8)

  • Developer: C & P Bibliography Services
  • Purpose: Add a tab with snippets of reviews from iDreamBooks.com to the OPAC
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.6-3.8 with XSLT enabled for the OPAC details page (3.10 script below)
var isbn = $(".isbn:last").text().split(" ")[1];
if (isbn) {
    isbn = isbn.replace(/\W*$/, '');
 
    if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
    // Use Microsoft XDR for IE version 8 or above
        var xdr = new XDomainRequest();
        xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
        xdr.onload = function() {
            json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
            eval(json); // json is now a regular JSON object
            parseIDBJSON(json); // parse using same function as for jQuery's success event
        }
        xdr.send();
    } else {
        $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
            parseIDBJSON(json);
        });
    }
}
 
// NOTE THAT THE CODE BELOW SHOULD NOT GO IN $(document).ready.
function parseIDBJSON( json ) {
    if(json.total_results > 0 && json.book.rating > 0){
        var isbn = $(".isbn:last").text().split(" ")[1];
        //build new tab for critic reviews
        $("#bibliodescriptions").append('<div id="idb_critic_reviews"><div id="idb_review_snippets"></div><span><a id="seemoreidb">More book reviews at iDreamBooks.com</a></span></div>');
 
        $("#bibliodescriptions ul").tabs('add', '#idb_critic_reviews', 'Book reviews by critics ( '+json.book.review_count+' )');
        //append happy-sad cloud review
        $("#catalogue_detail_biblio").append("<span class='idreambookssummary results_summary'><a href='"+json.book.detail_link+"'><img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+" by "+json.book.author+"' title='Rating based on reviews of "+json.book.title+"'>"+json.book.rating+"%</a> <a href='http://www.idreambooks.com/'>rating based on reviews at iDreamBooks.com</a></span>");
        //insert data into Book reviews tab
        $.each(json.book.critic_reviews, function(){
                $("#idb_review_snippets").append("<div class='review'><div><a href='"+this.review_link+"'>"+this.source+"</a></div><div>\"..."+this.snippet+"...\"</div><div>Review date: "+this.review_date+"</div><div><a class='reviewlink' href='"+json.book.detail_link+"'>Review result: "+this.pos_or_neg+" <img src='"+this.smiley_or_sad_small+"' alt='iDreamBooks.com rating' title='"+this.pos_or_neg+"' /></a></div></div>");
                });
        $("#seemoreidb").attr('href', json.book.detail_link);
    }
}

You will also need the following CSS added to your OPACUserCSS syspref:

.review {
    margin-bottom: 20px;
}
 
a.idreambooksrating {
    font-size: 30px;
    color: #29ADE4;
    padding-left: 85px;
    line-height: 30px;
    text-decoration: none;
}
 
.idreambookslegend {
    font-size: small;
}
 
a.reviewlink,a.reviewlink:visited {
    text-decoration: none;
    color: black;
    font-weight: normal;
}
 
.idreambookssummary a {
    color: #707070;
    text-decoration: none;
}
 
.idreambookssummary img, .idbresult img {
    vertical-align: middle;
}
 
.idbresult {
    color: #29ADE4;
    text-align: center;
    margin: 0.5em;
    padding: 0.5em;
}
 
.idbresult a, .idbresult a:visited {
    text-decoration: none;
    color: #29ADE4;
}
 
.idbresult img {
    padding-right: 6px;
}


Add iDreamBooks.com reviews tab to OPAC (3.10+)

  • Developer: C & P Bibliography Services
  • Purpose: Add a tab with snippets of reviews from iDreamBooks.com to the OPAC
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.10+ with XSLT enabled for the OPAC details page (3.6-3.8 script above)
var isbn = $(".isbn:last").text().split(" ")[1];
if (isbn) {
    isbn = isbn.replace(/\W*$/, '');
 
    if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
    // Use Microsoft XDR for IE version 8 or above
        var xdr = new XDomainRequest();
        xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
        xdr.onload = function() {
            json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
            eval(json); // json is now a regular JSON object
            parseIDBJSON(json); // parse using same function as for jQuery's success event
        }
        xdr.send();
    } else {
        $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
            parseIDBJSON(json);
        });
    }
}
 
function parseIDBJSON( json ) {
    if(json.total_results > 0 && json.book.rating > 0){
        var isbn = $(".isbn:last").text().split(" ")[1];
        //build new tab for critic reviews
        $("#bibliodescriptions").append('<div id="idb_critic_reviews"><div id="idb_review_snippets"></div><span><a id="seemoreidb">More book reviews at iDreamBooks.com</a></span></div>');
 
        $("#bibliodescriptions").tabs('add', '#idb_critic_reviews', 'Book reviews by critics ( '+json.book.review_count+' )');
        //append happy-sad cloud review
        $("#catalogue_detail_biblio").append("<span class='idreambookssummary results_summary'><a href='"+json.book.detail_link+"'><img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+" by "+json.book.author+"' title='Rating based on reviews of "+json.book.title+"'>"+json.book.rating+"%</a> <a href='http://www.idreambooks.com/'>rating based on reviews at iDreamBooks.com</a></span>");
        //insert data into Book reviews tab
        $.each(json.book.critic_reviews, function(){
                $("#idb_review_snippets").append("<div class='review'><div><a href='"+this.review_link+"'>"+this.source+"</a></div><div>\"..."+this.snippet+"...\"</div><div>Review date: "+this.review_date+"</div><div><a class='reviewlink' href='"+json.book.detail_link+"'>Review result: "+this.pos_or_neg+" <img src='"+this.smiley_or_sad_small+"' alt='iDreamBooks.com rating' title='"+this.pos_or_neg+"' /></a></div></div>");
                });
        $("#seemoreidb").attr('href', json.book.detail_link);
        $("#tab_idb_critic_reviews").show();
    }
}

You will also need the following CSS added to your OPACUserCSS syspref:

.review {
    margin-bottom: 20px;
}
 
a.idreambooksrating {
    font-size: 30px;
    color: #29ADE4;
    padding-left: 85px;
    line-height: 30px;
    text-decoration: none;
}
 
.idreambookslegend {
    font-size: small;
}
 
a.reviewlink,a.reviewlink:visited {
    text-decoration: none;
    color: black;
    font-weight: normal;
}
 
.idreambookssummary a {
    color: #707070;
    text-decoration: none;
}
 
.idreambookssummary img, .idbresult img {
    vertical-align: middle;
}
 
.idbresult {
    color: #29ADE4;
    text-align: center;
    margin: 0.5em;
    padding: 0.5em;
}
 
.idbresult a, .idbresult a:visited {
    text-decoration: none;
    color: #29ADE4;
}
 
.idbresult img {
    padding-right: 6px;
}

Duplicate Novelist readalikes into the right sidebar on opac-detail.pl

  • Developer: Jason Robb (SEKLS)
  • Purpose: Creates a brief preview of Novelist content on the right sidebar in opac-detail.pl to lure patrons down the page for full content.
  • Status: Completed
  • Intranet or OPAC?: OPAC
  • Version: 3.22 (Requires Novelist Select subscription)
  • Note: I could only get this to work with two separate document.ready clauses. You can see the intended result in my OPAC.
//Wrap this in the first $(document).ready()
$("#NovelistSelect").clone().prop({ id: "NovSidebar"}).appendTo("#ulactioncontainer"); //Duplicates Novelist content and adds it to the right side of the page
 
//Wrap this in the second $(document).ready()
$(window).load(function() {
if ($(".NovSimilarTitles").length) {
    $("#NovSidebar h3").text("You might also like...");
    $("#NovSidebar").append("<a href='#NovelistSelect' name='#NovelistSelect' id='MoreBelow'>See more recommendations</a>");
    $('#MoreBelow').click(function(){
        $('html, body').animate({
            scrollTop: $( $.attr(this, 'href') ).offset().top
        }, 500);
        return false;
	});
	} else {
		$("#NovSidebar h3").hide();
		$("#NovelistSelect h3").hide();
	}
});

I adjusted some styles for a cleaner look. It hides much of the cloned content and formats what's left. The styles are somewhat specific to my OPAC so they'll likely need tweaked. This goes in the OPACUserCSS syspref.

#NovSidebar .NovSeriesInfo, #NovSidebar .NovSimilarSeries, #NovSidebar .NovSimilarAuthors, #NovSidebar .NovAppeals, #NovSidebar .NovGoodReads, #NovSidebar .NovLibraryAwareNewsletter, #NovSidebar .NoveResourceRecommendation, #NovSidebar .NovRelatedFeatures, #NovSidebar .NovLexileInfo, #NovSidebar em, .NovSimilarTitles > .NovSectionHeader, .NovSimilarTitles > .NovSectionBody > div  {
	display: none;
	}
 
#NovSidebar > div {
    margin-bottom: -75px;
        }
 
#NovSidebar .NovSimilarTitles {
    margin-top: -30px;
    margin-bottom: 25px;
    overflow-y: hidden;
    padding-bottom: 0px;
       }
 
#MoreBelow {
    background: #fcb03f;
    color: white;
    display: block;
    float: right;
    font-size: medium;
    font-variant: unicase;
    font-weight: bolder;
    margin-right: -208px;
    margin-top: -145px;
    padding: 10px 0 10px 46px;
    transform: rotate(-90deg);
    width: 290px;
    transition: margin-top 0.5s ease;
	}
 
#MoreBelow:hover {
    margin-top: -135px;
	}

Enhanced content for the Staff

Add ability to search authority records through ID

  • Developer: Stefano Bargioni (Pontificia Università della Santa Croce) - 2013-12-06
  • Purpose: Allow cataloguers to search authority records through ID
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: tested on Koha 3.12
if (location.pathname.indexOf('authorities/authorities-home.pl')>-1 || location.pathname.indexOf('authorities/detail.pl')>-1) {
	$('#breadcrumbs').before('<form action="detail.pl"><div id="authid">Search by authority ID: <input size="8" name="authid"> <input value="Submit" type="submit" class="submit"></div></form>'); $('#authid').css('margin-left','200px');
}

Add VIAF autosuggest for new NAME authorities

  • Developer: Stefano Bargioni (Pontificia Università della Santa Croce) - 2013-12-02
  • Purpose: Allow cataloguers to search VIAF database while creating new NAME authorities
  • Status: Completed
  • Intranet or OPAC?: Intranet
  • Version: tested on Koha 3.2, Koha 3.12, Koha 3.16, Koha 3.22
if (document.location.href.indexOf('_NAME') == document.location.href.length-5 || // match /cgi-bin/koha/authorities/authorities.pl?authtypecode=....._NAME
	document.location.href.indexOf('authorities/authorities.pl?authid=')>-1) {
	if (document.location.href.indexOf('authorities/authorities.pl?authid=')>-1) {
		var title = $('h1').text();
		if (title.indexOf('Name')!=title.length-4) return; // not available for non-NAME headings
	}
	function myUpperCase(s) {
		if (s.indexOf('nli')>-1) return 'NLI'+s.substr(3);
		return s.toUpperCase();
	}
	function autoComplete() {
		$('head').append('<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/themes/base/jquery.ui.all.css">');
 
		// Koha 3.12.x
		$('#authoritytabs').prepend('\
			<div class="ui-widget">\
				<label for="viaf">VIAF Autosuggest:</label> <input type="text" style="font-size:0.9em" id="viaf" size="80" title="digitare almeno i primi 3 caratteri di un nome">\
			</div>\
		');
		// Koha 3.2
		$($('ul.toolbar')[0]).append('\
			<div class="ui-widget" style="margin-top:5px">\
				<label for="viaf">VIAF Autosuggest:</label> <input type="text" style="font-size:0.9em" id="viaf" size="80" title="digitare almeno i primi 3 caratteri di un nome">\
			</div>\
		');
		$(function() {
			$( "#viaf" ).autocomplete({
				source: function( request, response ) {
					$.ajax({
						url: "http://viaf.org/viaf/AutoSuggest",
						dataType: "jsonp",
						data: {
							query: request.term
						},
						success: function( data ) {
							if (!data.result) return false;
							response( $.map( data.result, function( item ) {
								return {
									label: item.term,
									value: item.term,
									item:  item
								}
							}));
						}
					});
				},
				minLength: 3,
				select: function( event, ui ) {
					$('#viaf_table').remove();
					var H = new Array;
					H.push('<table id="viaf_table">');
					H.push('<tr><td colspan="3">'+ui.item.item.term);
					var viafid = ui.item.item.viafid;
					// VIAF permalink
					H.push('<tr><td><a target="viaf" href="http://viaf.org/viaf/'+viafid+'"><img src="http://viaf.org/viaf/images/viaf-link.png" class="viaf_flag"></a><td>VIAF<td>'+viafid);
					for (var i in ui.item.item) {
						var flag = '<img src="http://viaf.org/viaf/images/flags/'+myUpperCase(i)+'.png" class="viaf_flag">';
						if (i!='viafid' && i!='term') {
							if (myUpperCase(i)=='LC') {
								// LoC permalink
								H.push('<tr><td><a target="loc" href="http://lccn.loc.gov/'+ui.item.item[i]+'">'+flag+'</a><td>'+myUpperCase(i)+'<td>'+ui.item.item[i]);
							}
							else {
								H.push('<tr><td>'+flag+'<td>'+myUpperCase(i)+'<td>'+ui.item.item[i]);
							}
						}
					}
					H.push('</table>');
					$('#viaf').after(H.join(''));
					$('#viaf_table').css('margin-top','5px');
					$('.viaf_flag').css('border','0');
				},
				open:  function() {$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" ); $('ul li').css('list-style-type','none'); },
				close: function() {$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );}
			});
		});
	}
 
	// load jquery-ui to get autocomplete method (for Koha without it)
	if (!jQuery.ui.version) {
		$.ajax({
			url: 'http://code.jquery.com/ui/1.11.1/jquery-ui.min.js',
			dataType: "script",
			success: autoComplete
		});
	}
	else { autoComplete() }
}

Change the default view on OPAC detail pages

  • Developer: Owen Leonard
  • Creation Date: 2012-10-19
  • Purpose: to change the default view on OPAC or Intranet detail pages from holdings to, in this case, the title notes tab. The "1" indicates the number of the tab, starting with 0, so for title notes, you would need tab 1.
  • Status: Completed
  • Intranet or OPAC?: OPAC or Intranet
  • Version:3.8.
 $('#bibliodescriptions > ul').tabs('select', 1);

In 3.10 use:

 $('#bibliodescriptions').tabs('select', 1);

In 3.12 use:

$('#bibliodescriptions').tabs({ active: 1 } );


SCO JQuery Statements

Hitting "Enter" key in the username field will jump focus to the password field instead of submitting form

  • Developer: Kyle M Hall
  • Purpose: To allow patrons to scan library cards into the login field
  • Status: Completed
  • Version: Any
$(document).ready(function(){
    $('#patronlogin').keypress(function(e){
        if (e.keyCode == 13){
            $('#patronpw').focus();
            return false;
        }
    }); 
});

Change wording on the self-check patron login screen

  • Developer: Jesse Maseto
  • Creation Date: 2017/01/10
  • Purpose: Allows the library to edit the wording on self-check patron login screen
  • Status: Completed
  • Version: any
$(document).ready(function(){ 
$(".sco_entry label[for='patronlogin']").html("Barcode:");
$(".sco_entry label[for='patronpw']").html("PIN:");
});


Audio Alerts JQuery Selectors

Returns screen 'problem messages

  • Developer: Nick Clemens
  • Purpose: Alter sound alert for checkin 'yellow' problem boxes
  • Status: Completed
  • Version: Any
Please return item to:
#circ_returns p.problem:contains('Please return item to:')
Not checked out.
#circ_returns p.problem:contains('Not checked out.')
Local use recorded
#circ_returns p.problem:contains('Local use recorded')
Item was lost, now found.
#circ_returns p.problem:contains(' Item was lost, now found.')
A refund has been applied to the borrowing patron's account.
#circ_returns p.problem:contains('A refund has been applied to the borrowing patron's account.')
Any lost item fees for this item will remain on the patron's account.
#circ_returns p.problem:contains('Any lost item fees for this item will remain on the patron's account.')
Item is withdrawn.
#circ_returns p.problem:contains('Item is withdrawn.')
<Patron> is now debarred until <DATE>
#circ_returns p.problem:contains('is now debarred until')
Patron was earlier restricted until<DATE>
#circ_returns p.problem:contains('Patron was earlier restricted until')
Patron has an indefinite restriction.
#circ_returns p.problem:contains('Patron has an indefinite restriction.')

Returns screen holds/transfer messages

  • Developer: Nick Clemens
  • Purpose: Alter sound alert for checkin holds boxes
  • Status: Completed
  • Version: Any
Waiting hold found
#circ_returns #hold-found1
Hold needs transfer
#circ_returns #transfer-needed
Transfer for hold
#circ_returns #item-transfer
Local hold found
#circ_returns #hold-found2
Return item to home library (per circ rules)
#circ_returns #return1

Checkout screen messages

  • Developer: Nick Clemens
  • Purpose: Alter sound alert for checkin holds boxes
  • Status: Completed
  • Version: Any
Patron is expired
#circ_circulation li:contains("Patron's card has expired.")
Patron is restricted
#circ_circulation li:contains("Patron's account is restricted")
Patron owes fines
#circ_circulation li:contains("Outstanding fees & charges")
Patron has overdues
#circ_circulation li:contains("Patron has ITEMS OVERDUE")

Personal tools