messages.js
3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* Additional function for message.html
* Written by ThemePixels
* http://themepixels.com/
*
* Copyright (c) 2012 ThemePixels (http://themepixels.com)
*
* Built for Amanda Premium Responsive Admin Template
* http://themeforest.net/category/site-templates/admin-templates
*/
jQuery(document).ready(function(){
///// CHECKBOX TRANSFORM /////
jQuery('input:checkbox').uniform();
///// STAR /////
jQuery('.msgstar').click(function(){
if(jQuery(this).hasClass('starred'))
jQuery(this).removeClass('starred');
else
jQuery(this).addClass('starred');
});
///// CHECK ALL /////
jQuery('.checkall, .checkall2').click(function(){
if(jQuery(this).is(':checked')) {
jQuery(this).parents('table')
.find('input:checkbox')
.each(function(){
jQuery(this).attr('checked',true);
//check if this checkbox is part of the list(tbody) not in the header/footer (thead/tfoot)
//this will add class "selected" in a row when checked
if(jQuery(this).parents('tbody').length > 0)
jQuery(this).parents('tr').addClass('selected');
});
} else {
jQuery(this).parents('table')
.find('input:checkbox')
.each(function(){
jQuery(this).attr('checked',false);
//check if this checkbox is part of the list(tbody) not in the header/footer (thead/tfoot)
//this will remove class "selected" in a row when unchecked
if(jQuery(this).parents('tbody').length > 0)
jQuery(this).parents('tr').removeClass('selected');
});
}
//this is needed to remain the checkbox in transformed (uniform) state
jQuery.uniform.update();
});
///// EACH CHECKBOX CLICK EVENT /////
jQuery('.mailinbox input:checkbox').each(function(){
jQuery(this).click(function(){
if(!jQuery(this).is(':checked')) {
//this will hide trash icon only when there are no selected row
var hidetrash = true;
jQuery('.mailinbox tbody input:checkbox').each(function(){
if(jQuery(this).is(':checked'))
hidetrash = false;
});
if(hidetrash)
jQuery('.dropdown_label, .reportspam, .msgtrash').hide();
//check if this checkbox is part of the list(tbody) not in the header/footer (thead/tfoot)
//this will remove class "selected" in a row when checked
if(jQuery(this).parents('tbody').length > 0)
jQuery(this).parents('tr').removeClass('selected');
} else {
//we use css({display:block}) instead of show() because show() is
//using display: inline to show element
jQuery('.dropdown_label, .reportspam, .msgtrash').css({display: 'block'});
//check if this checkbox is part of the list(tbody) not in the header/footer (thead/tfoot)
//this will add class "selected" in a row when checked
if(jQuery(this).parents('tbody').length > 0)
jQuery(this).parents('tr').addClass('selected');
}
});
});
///// SHOW DROP DOWN BUTTON /////
jQuery('.dropdown').each(function(){
var t = jQuery(this);
t.find('a.dropdown_label').click(function(){
if(!t.hasClass('open')) {
var h = t.height();
t.find('ul').show().css({top: h+2+'px'});
t.addClass('open');
} else {
t.find('ul').hide();
t.removeClass('open');
}
return false;
});
});
///// HIDE DROP DOWN BUTTON /////
jQuery(document).click(function(){
jQuery('.dropdown').removeClass('open').find('ul').hide();
});
});