Some changes related to recent commits to patron images: Markup and javascript change...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / js / staff-global.js
1 // staff-global.js
2
3 function _(s) { return s } // dummy function for gettext
4
5  $(document).ready(function() {
6         $(".focus").focus();
7         $('#header_search').tabs({
8                 onShow: function() {
9                 $('#header_search').find('div.residentsearch').not('.tabs-hide').find('input').eq(0).focus();
10             }   
11         });
12         $(".close").click(function(){
13                 window.close();
14         });
15  });
16  
17
18 // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
19 function verify_patron_images() {
20     for (var i = 0; i < document.images.length; i++) {
21         img = document.images[i];
22         if ((img.src.indexOf('patronimage') >= 0)) {
23                         w = img.width;
24             h = img.height;
25      if ((w == 0) && (h == 0) || ((img.complete != null) && (!img.complete))) {
26                img.src = '/intranet-tmpl/prog/img/patron-blank.png';
27                         }
28         }
29     }
30 }
31
32             YAHOO.util.Event.onContentReady("header", function () {
33                                 var oMoremenu = new YAHOO.widget.Menu("moremenu", { zindex: 2 });
34
35                                 function positionoMoremenu() {
36                                         oMoremenu.align("tl", "bl");
37                                 }
38
39                 oMoremenu.subscribe("beforeShow", function () {
40                     if (this.getRoot() == this) {
41                                                 positionoMoremenu();
42                     }
43                 });
44
45                                 oMoremenu.render();
46
47                 oMoremenu.cfg.setProperty("context", ["showmore", "tl", "bl"]);
48
49                                 function onShowMoreClick(p_oEvent) {
50                     // Position and display the menu        
51                     positionoMoremenu();
52                     oMoremenu.show();
53                     // Stop propagation and prevent the default "click" behavior
54                     YAHOO.util.Event.stopEvent(p_oEvent);       
55                                 }
56
57                                 YAHOO.util.Event.addListener("showmore", "click", onShowMoreClick);
58
59                 YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMoremenu);
60             });
61
62 YAHOO.util.Event.onContentReady("changelanguage", function () {
63                 var oMenu = new YAHOO.widget.Menu("sublangs", { zindex: 2 });
64
65                     function positionoMenu() {
66                     oMenu.align("bl", "tl");
67                 }
68
69                 oMenu.subscribe("beforeShow", function () {
70                     if (this.getRoot() == this) {
71                                                 positionoMenu();
72                     }
73                 });
74
75                 oMenu.render();
76
77                                 oMenu.cfg.setProperty("context", ["showlang", "bl", "tl"]);
78
79                                 function onYahooClick(p_oEvent) {
80                     // Position and display the menu        
81                     positionoMenu();
82                     oMenu.show();
83                     // Stop propagation and prevent the default "click" behavior
84                     YAHOO.util.Event.stopEvent(p_oEvent);
85                 }
86
87                                 YAHOO.util.Event.addListener("showlang", "click", onYahooClick);
88
89                                 YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
90             });