Bug 15400: (follow-up) Restore 'years' string, remove untranslatable string
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / includes / js_includes.inc
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AudioAlerts %]
4 [% USE To %]
5 [%# Prevent XFS attacks -%]
6 [% UNLESS popup %]
7     <script>
8        if (self === top) {
9            var antiClickjack = document.getElementById("antiClickjack");
10            antiClickjack.parentNode.removeChild(antiClickjack);
11        } else {
12            top.location = self.location;
13        }
14     </script>
15 [% END %]
16
17 [% Asset.js("lib/jquery/jquery-2.2.3.min.js") | $raw %]
18 [% Asset.js("lib/jquery/jquery-migrate-1.3.0.min.js") | $raw %]
19 [% Asset.js("lib/jquery/jquery-ui-1.11.4.min.js") | $raw %]
20 [% Asset.js("lib/shortcut/shortcut.js") | $raw %]
21 [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
22 [% Asset.js("lib/js-cookie/js.cookie-2.2.1.min.js") | $raw %]
23 [% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") | $raw %]
24 [% Asset.js("lib/bootstrap/bootstrap.min.js") | $raw %]
25 [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %]
26 <!-- koha core js -->
27 [% Asset.js("js/staff-global.js") | $raw %]
28
29 [% INCLUDE 'validator-strings.inc' %]
30 [% IF ( IntranetUserJS ) %]
31     <!-- js_includes.inc: IntranetUserJS -->
32     <script>
33     [% IntranetUserJS | $raw %]
34     </script>
35     <!-- / js_includes.inc: IntranetUserJS -->
36 [% END %]
37
38 <!-- js_includes.inc -->
39 [% IF ( virtualshelves || intranetbookbag ) %]
40     <script>
41         // virtualshelves || intranetbookbag
42         var MSG_BASKET_EMPTY = _("Your cart is currently empty");
43         var MSG_RECORD_IN_BASKET = _("This item is already in your cart");
44         var MSG_RECORD_ADDED = _("This item has been added to your cart");
45         var MSG_NRECORDS_ADDED = _("%s item(s) added to your cart");
46         var MSG_NRECORDS_IN_BASKET = _("%s already in your cart");
47         var MSG_NO_RECORD_SELECTED = _("No item was selected");
48         var MSG_NO_RECORD_ADDED = _("No item was added to your cart (already in your cart)!");
49         var MSG_CONFIRM_DEL_BASKET = _("Are you sure you want to empty your cart?");
50         var MSG_CONFIRM_DEL_RECORDS = _("Are you sure you want to remove the selected items?");
51         var MSG_IN_YOUR_CART = _("Items in your cart: %s");
52         var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved.");
53         var MSG_ITEM_NOT_IN_CART = _("Add to cart");
54         var MSG_ITEM_IN_CART = _("In your cart");
55         var MSG_RECORD_REMOVED = _("The item has been removed from your cart");
56     </script>
57
58     [% Asset.js("js/basket.js") | $raw %]
59 [% END %]
60
61 [% IF LocalCoverImages %]
62     [% Asset.js("js/localcovers.js") | $raw %]
63     <script>
64         // LocalCoverImages
65         var NO_LOCAL_JACKET = _("No cover image available");
66     </script>
67 [% END %]
68
69 [% IF Koha.Preference('AudioAlerts') || AudioAlertsPage %]
70     <script>
71         // AudioAlerts
72         var AUDIO_ALERT_PATH = '[% interface | html %]/[% theme | html %]/sound/';
73         var AUDIO_ALERTS = JSON.parse( "[% To.json(AudioAlerts.AudioAlerts) | $raw %]" );
74
75         $( document ).ready(function() {
76             if ( AUDIO_ALERTS ) {
77                 for ( var k in AUDIO_ALERTS ) {
78                     var alert = AUDIO_ALERTS[k];
79                     if ( $( alert.selector ).length ) {
80                         playSound( alert.sound );
81                         break;
82                     }
83                 }
84             }
85         });
86     </script>
87 [% END %]
88
89 [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
90     [% IF ( PatronAutoComplete ) %]
91         <script>
92             // PatronAutoComplete && CAN_user_circulate_circulate_remaining_permissions
93             $(document).ready(function(){
94                 var obj = $( "#findborrower" ).autocomplete({
95                     source: "/cgi-bin/koha/circ/ysearch.pl",
96                     minLength: 3,
97                     select: function( event, ui ) {
98                         window.location.href = ui.item.link;
99                     }
100                 }).data( "ui-autocomplete" );
101                 if( obj ) {
102                     obj._renderItem = function( ul, item ) {
103                         item.link = "/cgi-bin/koha/circ/circulation.pl?borrowernumber=" + item.borrowernumber;
104                         var cardnumber = "";
105                         if( item.cardnumber != "" ){
106                             // Display card number in parentheses if it exists
107                             cardnumber = " (" + item.cardnumber + ") ";
108                         }
109                         var itemString = "<a href=\"" + item.link + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>";
110                         if( item.dateofbirth ) {
111                             itemString += item.dateofbirth + " (" + item.age + " " +  _("years") + "), ";
112                         }
113                         itemString += item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>";
114                         return $( "<li></li>" )
115                         .data( "ui-autocomplete-item", item )
116                         .append( itemString )
117                         .appendTo( ul );
118                     };
119                 }
120             });
121         </script>
122     [% END %]
123 [% END %]
124 [% IF ( PatronAutoComplete ) %]
125     <script>
126     // PatronAutoComplete
127     $(document).ready(function(){
128         var obj = $( "#searchmember" ).autocomplete({
129             source: "/cgi-bin/koha/circ/ysearch.pl",
130             minLength: 3,
131             select: function( event, ui ) {
132                 window.location.href = ui.item.link;
133             }
134         }).data( "ui-autocomplete" );
135         if( obj ) {
136             obj._renderItem = function( ul, item ) {
137                 item.link = "/cgi-bin/koha/circ/circulation.pl?borrowernumber=" + item.borrowernumber;
138                 var cardnumber = "";
139                 if( item.cardnumber != "" ){
140                     // Display card number in parentheses if it exists
141                     cardnumber = " (" + item.cardnumber + ") ";
142                 }
143                 return $( "<li></li>" )
144                 .data( "ui-autocomplete-item", item )
145                 .append( "<a href=\"" + item.link + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
146                 .appendTo( ul );
147             };
148         }
149     });
150     </script>
151 [% END %]
152 <!-- / js_includes.inc -->