| 3830 |
chandransh |
1 |
$(function(){
|
| 4180 |
rajveer |
2 |
$("#userSelector .default").truncate({addtitle: true});
|
| 3966 |
varun.gupt |
3 |
|
|
|
4 |
function submitSeachForm() {
|
|
|
5 |
var query = $.trim($('#query').val());
|
|
|
6 |
|
|
|
7 |
if(query != '' && query != 'Search for more items...') {
|
|
|
8 |
$('#formSearch').submit();
|
|
|
9 |
} else {
|
|
|
10 |
$('#query').focus();
|
|
|
11 |
}
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
$('body').mouseup(function(){
|
|
|
15 |
var categorySelector = $('#categorySelector');
|
|
|
16 |
var isMouseOnCategorySelector = $(categorySelector).data('is_mouse_on_category_selector');
|
|
|
17 |
|
|
|
18 |
if (typeof(isMouseOnCategorySelector) == 'boolean' && !isMouseOnCategorySelector) {
|
|
|
19 |
$(categorySelector).children('ul').hide();
|
|
|
20 |
$(categorySelector).data('menustate', false);
|
|
|
21 |
}
|
|
|
22 |
});
|
|
|
23 |
|
| 3830 |
chandransh |
24 |
/** Search in Header **/
|
|
|
25 |
$('#query').val('Search for more items...')
|
|
|
26 |
.focus(function(){
|
|
|
27 |
$(this).val('');
|
|
|
28 |
})
|
|
|
29 |
.blur(function(){
|
|
|
30 |
if ($(this).val() == '') $(this).val('Search for more items...');
|
|
|
31 |
});
|
|
|
32 |
|
|
|
33 |
$('#searchButton').click(function(){
|
| 3966 |
varun.gupt |
34 |
submitSeachForm();
|
| 3830 |
chandransh |
35 |
});
|
|
|
36 |
|
| 3966 |
varun.gupt |
37 |
$('#categorySelector').click(function(){
|
|
|
38 |
|
|
|
39 |
var menuState = $(this).data('menustate');
|
|
|
40 |
|
|
|
41 |
if (typeof(menuState) == 'undefined' || !menuState) {
|
|
|
42 |
$(this).children('ul').show();
|
|
|
43 |
$(this).data('menustate', true);
|
|
|
44 |
} else {
|
|
|
45 |
$(this).children('ul').hide();
|
|
|
46 |
$(this).data('menustate', false);
|
|
|
47 |
}
|
|
|
48 |
}).hover(function(){
|
|
|
49 |
$(this).data('is_mouse_on_category_selector', true);
|
|
|
50 |
}, function(){
|
|
|
51 |
$(this).data('is_mouse_on_category_selector', false);
|
| 3830 |
chandransh |
52 |
});
|
| 3966 |
varun.gupt |
53 |
|
|
|
54 |
$('.search-in-dropdown-options li').click(function(){
|
|
|
55 |
var category = $(this).attr('id').split('_')[2];
|
|
|
56 |
$('input[name="category"]').val(category);
|
|
|
57 |
submitSeachForm();
|
|
|
58 |
});
|
| 4180 |
rajveer |
59 |
|
|
|
60 |
$('body').mouseup(function(){
|
|
|
61 |
var userSelector = $('#userSelector');
|
|
|
62 |
var isMouseOnUserSelector = $(userSelector).data('is_mouse_on_user_selector');
|
|
|
63 |
|
|
|
64 |
if (typeof(isMouseOnUserSelector) == 'boolean' && !isMouseOnUserSelector) {
|
|
|
65 |
$(userSelector).children('ul').hide();
|
|
|
66 |
$(userSelector).data('usermenustate', false);
|
|
|
67 |
$(userSelector).removeClass('active');
|
|
|
68 |
}
|
|
|
69 |
});
|
|
|
70 |
|
|
|
71 |
$('#userSelector').click(function(){
|
|
|
72 |
|
|
|
73 |
var userMenuState = $(this).data('usermenustate');
|
|
|
74 |
|
|
|
75 |
if (typeof(userMenuState) == 'undefined' || !userMenuState) {
|
|
|
76 |
$(this).addClass('active');
|
|
|
77 |
$(this).children('ul').show();
|
|
|
78 |
$(this).data('usermenustate', true);
|
|
|
79 |
} else {
|
|
|
80 |
$(this).removeClass('active');
|
|
|
81 |
$(this).children('ul').hide();
|
|
|
82 |
$(this).data('usermenustate', false);
|
|
|
83 |
}
|
|
|
84 |
}).hover(function(){
|
|
|
85 |
$(this).data('is_mouse_on_user_selector', true);
|
|
|
86 |
}, function(){
|
|
|
87 |
$(this).data('is_mouse_on_user_selector', false);
|
|
|
88 |
});
|
|
|
89 |
|
| 3830 |
chandransh |
90 |
});
|