Merge pull request #5205 from solgenomics/topic/generic_trial_upload
[sgn.git] / mason / site / toolbar / search.mas
blob1c79aeaa07a08adb6004fa73e1109421a329a0ad
2 <li style="height:100%">
3   <form id="toolbar_search_form" class="navbar-form navbar-left form-inline" role="search" action="/search/quick_search.pl" style="padding-right: 2px;height:100%">
4     <div class="input-group">
5       <span id="advanced_search_li" class="btn btn-default input-group-addon" style="display:none" onclick="location.href='/search';">Advanced</span>
6       <input id="quick_search_input" style="display:none;" type="text" name="term" class="form-control" placeholder="">
7       <span id="quick_search_icon" class="btn btn-default" style="height:34px; font-size:16; padding-top:8px;" title="Search"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
8     </div>
9   </form>
10 </li>
12 <script defer="defer">
13   jQuery(document).ready(function() {
14     
15     jQuery('#quick_search_icon').click(function () {
16       
17       //open the search box
18       if (jQuery('#quick_search_input').attr("placeholder") == "") {
19         jQuery('#quick_search_input').attr("placeholder","Search");
20         
21         jQuery('#quick_search_icon').addClass("input-group-addon");
22         
23         jQuery('#advanced_search_li').css("display","table-cell");
24         jQuery('#quick_search_input').css("display","table-cell");
25         jQuery('#quick_search_input').css("width","0px");
26         jQuery('#quick_search_input').animate({
27           width: '150px'
28         }, 400);
30       }
31       else {
32         //close the search box if empty
33         var search_val = jQuery('#quick_search_input').val();
34         // alert("search_val: "+search_val);
36         if (search_val) {
37           jQuery('#toolbar_search_form').submit();
38         }
39         else {
41           jQuery('#quick_search_input').animate({
42             width: '0px'
43           }, 400, function(){
44             // callback function
45             jQuery('#quick_search_input').attr("placeholder","");
46             jQuery('#quick_search_input').css("display","none");
47             jQuery('#advanced_search_li').css("display","none");
48             jQuery('#quick_search_icon').removeClass("input-group-addon");
49           });
51         } //close search_val else
52       }
53     });
54     
55   });
56 </script>