Bug 11014 - Slip Print Problem in Chrome
[koha.git] / koha-tmpl / opac-tmpl / prog / en / js / script.js
1 function _(s) { return s } // dummy function for gettext
2 function confirmDelete(message) {
3         return (confirm(message) ? true : false);
4 }
5
6 function Dopop(link) {
7         newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes,resizeable=yes');
8 }
9
10 $(document).ready(function(){
11         $(".close").click(function(){
12                 window.close();
13         });
14         $(".focus").focus();
15
16         // clear the basket when user logs out
17         $("#logout").click(function(){
18                 var nameCookie = "bib_list";
19             var valCookie = readCookie(nameCookie);
20                 if (valCookie) { // basket has contents
21                         updateBasket(0,null);
22                         delCookie(nameCookie);
23                         return true;
24                 } else {
25                         return true;
26                 }
27         });
28 });
29
30 // build Change Language menus
31 YAHOO.util.Event.onContentReady("changelanguage", function () {
32         $(".sublangs").each(function(){
33                 var menuid = $(this).attr("id");
34                 var menuid = menuid.replace("show","");
35
36                 var oMenu = new YAHOO.widget.Menu("sub"+menuid, { zindex: 2 });
37                 function positionoMenu() {
38                         oMenu.align("bl", "tl");
39                 }
40                 oMenu.subscribe("beforeShow", function () {
41                 if (this.getRoot() == this) {
42                         positionoMenu();
43                 }
44                 });
45                 oMenu.render();
46                 oMenu.cfg.setProperty("context", ["show"+menuid, "bl", "tl"]);
47                 function onYahooClick(p_oEvent) {
48                         // Position and display the menu        
49                         positionoMenu();
50                         oMenu.show();
51                         // Stop propagation and prevent the default "click" behavior
52                         YAHOO.util.Event.stopEvent(p_oEvent);
53                 }
54                 YAHOO.util.Event.addListener("show"+menuid, "click", onYahooClick);
55                 YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
56                 
57         });
58 });
59                         
60 // Build lists menu
61 YAHOO.util.Event.onContentReady("listsmenu", function () {
62         YAHOO.widget.Menu.prototype.onRender = function () { };
63     $("#listsmenu").css("display","block").css("visibility","hidden");
64         $("#listsmenulink").attr("href","#");
65         var listMenu = new YAHOO.widget.Menu("listsmenu");
66                 listMenu.render();
67                 listMenu.cfg.setProperty("context", ["listsmenulink", "tr", "br"]);
68                 listMenu.cfg.setProperty("effect",{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.05});
69                 listMenu.subscribe("beforeShow",positionlistMenu);
70                 listMenu.subscribe("show", listMenu.focus);
71         function positionlistMenu() {
72                     listMenu.align("tr", "br");
73                 }
74                 YAHOO.util.Event.addListener("listsmenulink", "click", listMenu.show, null, listMenu);
75                 YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionlistMenu);
76  });
77
78 jQuery.fn.preventDoubleFormSubmit = function() {
79     jQuery(this).submit(function() {
80         if (this.beenSubmitted)
81             return false;
82         else
83             this.beenSubmitted = true;
84     });
85 };