2 if ( KOHA === undefined ) var KOHA = {};
4 function _(s) { return s; } // dummy function for gettext
6 $(document).ready(function() {
7 $('#header_search').tabs().bind('tabsshow', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); });
9 $(".close").click(function(){ window.close(); });
11 if($("#header_search #checkin_search").length > 0){ shortcut.add('Alt+r',function (){ $("#header_search").tabs("select","#checkin_search"); $("#ret_barcode").focus(); }); } else { shortcut.add('Alt+r',function (){ location.href="/cgi-bin/koha/circ/returns.pl"; }); }
12 if($("#header_search #circ_search").length > 0){ shortcut.add('Alt+u',function (){ $("#header_search").tabs("select","#circ_search"); $("#findborrower").focus(); }); } else { shortcut.add('Alt+u',function(){ location.href="/cgi-bin/koha/circ/circulation.pl"; }); }
13 if($("#header_search #catalog_search").length > 0){ shortcut.add('Alt+q',function (){ $("#header_search").tabs("select","#catalog_search"); $("#search-form").focus(); }); } else { shortcut.add('Alt+q',function(){ location.href="/cgi-bin/koha/catalogue/search.pl"; }); }
16 $(".validated").validate();
18 $("#logout").on("click",function(){
21 $("#helper").on("click",function(){
26 $('.noEnterSubmit').keypress(function(e){
27 if ( e.which == 13 ) return false;
31 // http://jennifermadden.com/javascript/stringEnterKeyDetector.html
32 function checkEnter(e){ //e is event object passed from function invocation
33 var characterCode; // literal character code will be stored in this variable
34 if(e && e.which){ //if which property of event object is supported (NN4)
36 characterCode = e.which; //character code is contained in NN4's which property
39 characterCode = e.keyCode; //character code is contained in IE's keyCode property
42 if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
49 function clearHoldFor(){
50 $.cookie("holdfor",null, { path: "/", expires: 0 });
54 if( typeof delBasket == 'function' ){
55 delBasket('main', true);
61 openWindow("/cgi-bin/koha/help.pl","Koha help",600,600);
64 jQuery.fn.preventDoubleFormSubmit = function() {
65 jQuery(this).submit(function() {
66 $("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting');
67 if (this.beenSubmitted)
70 this.beenSubmitted = true;
74 function openWindow(link,name,width,height) {
75 name = (typeof name == "undefined")?'popup':name;
76 width = (typeof width == "undefined")?'600':width;
77 height = (typeof height == "undefined")?'400':height;
78 var newin=window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
81 // Use this function to remove the focus from any element for
82 // repeated scanning actions on errors so the librarian doesn't
83 // continue scanning and miss the error.
84 function removeFocus() {