Bug 5287: Add floating toolbar to search results in OPAC
[koha-equinox.git] / koha-tmpl / opac-tmpl / bootstrap / js / script.js
1 enquire.register("screen and (max-width:608px)", {
2     match : function() {
3         $("#masthead_search").insertAfter("#select_library");
4         if($("body.scrollto").length > 0){
5             $("body.scrollto").animate({
6                 scrollTop: $(".maincontent").offset().top
7             }, 10);
8         }
9     },
10     unmatch : function() {
11     }
12 });
13
14 enquire.register("screen and (min-width:768px)", {
15     match : function() {
16         $(".menu-collapse").show();
17     },
18     unmatch : function() {
19         $(".menu-collapse").hide();
20     }
21 });
22
23 $(document).ready(function(){
24     $(".close").click(function(){
25         window.close();
26     });
27     $(".focus").focus();
28
29     // clear the basket when user logs out
30     $("#logout").click(function(){
31         var nameCookie = "bib_list";
32         var valCookie = readCookie(nameCookie);
33         if (valCookie) { // basket has contents
34             updateBasket(0,null);
35             delCookie(nameCookie);
36             return true;
37         } else {
38             return true;
39         }
40     });
41     $("#user-menu-trigger").on("click",function(){
42         var mem = $("#members");
43         if(mem.is(":hidden")){
44             mem.show();
45         } else {
46             mem.removeAttr("style");
47         }
48     });
49     $(".menu-collapse-toggle").on("click",function(e){
50         e.preventDefault();
51         $(this).toggleClass("menu-open");
52         $(".menu-collapse").toggle();
53     });
54     $(".loginModal-trigger").on("click",function(e){
55         e.preventDefault();
56         $("#loginModal").modal("show");
57         $("#members").removeAttr("style");
58     });
59     $("#loginModal").on("hide",function(){
60         if($("#user-menu-trigger").is(":hidden")){
61             $("#members").removeAttr("style");
62         }
63     });
64 });