blog.js
3.6 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* Additional function for manageblog.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(){
///// load ajax/blog/allposts.html /////
jQuery.post('ajax/blog/allposts.html', function(data){
jQuery('#contentwrapper').html(data);
jQuery('.stdtable input:checkbox').uniform(); //restyling checkbox
});
jQuery('.checkall, .checkall2').live('click',function(){
if(!jQuery(this).is(':checked')) {
checkbox(jQuery(this),false);
} else {
checkbox(jQuery(this),true);
}
});
function checkbox(t,v) {
t.parents('table').find('input[type=checkbox]').each(function(){
if(!jQuery(this).parents('tr').hasClass('togglerow')) {
jQuery(this).attr('checked',v);
}
jQuery.uniform.update();
});
}
///// DELETE A SINGLE BLOG LIST /////
jQuery('.stdtable .delete').live('click',function(){
var p = jQuery(this).parents('tr');
jConfirm('Are you sure you want to delete this post?', 'Delete Post', function(r) {
if(r) {
if(p.next().hasClass('togglerow'))
p.next().remove();
p.fadeOut(function(){
jQuery(this).remove();
});
}
});
return false;
});
///// QUICK VIEW /////
jQuery('.quickview').live('click', function(){
var parent = jQuery(this).parents('tr');
var parentTable = jQuery(this).parents('table');
var url = jQuery(this).attr('href');
jQuery.post(url,function(data){
parent.after('<tr class="togglerow"><td colspan="5">'+data+'</td></tr>');
parentTable.find('.togglerow').each(function(){
jQuery(this).hide();
});
parent.next().show();
jQuery('.quickedit-date, input:checkbox, input:radio').uniform(); //restyling select element
});
return false;
});
///// QUICK VIEW UPDATE BUTTON /////
jQuery('.quickformbutton .update').live('click',function(){
jQuery(this).parent().find('.loading').show();
return false;
});
///// QUICK VIEW CANCEL BUTTONS /////
jQuery('.quickformbutton .cancel').live('click', function(){
jQuery(this).parents('tr.togglerow').remove();
return false;
});
///// SWITCHING LIST FROM 3 COLUMNS TO 2 COLUMN LIST /////
function shortenedTab() {
if(jQuery(window).width() < 450) {
if(!jQuery('.hornav').hasClass('shortened')) { //checked to prevent running multiple times when resizing windows
jQuery('.hornav').addClass('shortened');
jQuery('.hornav').append('<li class="more"><a>More</a><ul></ul></li>');
var count = 0;
jQuery('.hornav li').each(function(){
if(count > 1) {
if(!jQuery(this).hasClass('more'))
jQuery('.hornav li.more ul').append(jQuery(this));
}
count++;
});
}
} else {
if(jQuery('.hornav').hasClass('shortened')) { //checked to prevent running multiple times when resizing windows
jQuery('.hornav').removeClass('shortened');
jQuery('.hornav li.more ul li').each(function(){
jQuery('.hornav').append(jQuery(this));
});
jQuery('.hornav li.more').remove();
}
}
}
///// MORE DROPDOWN MENU IN HORIZONTAL MENU /////
jQuery('.hornav li.more > a').live('click',function(){
if(!jQuery('.hornav li.more ul').is(':visible')) {
jQuery('.hornav li').removeClass('current');
jQuery(this).parent().addClass('current');
jQuery(this).parent().find('ul').show();
} else {
jQuery('.hornav li.more ul').hide();
}
});
shortenedTab();
///// ON RESIZE WINDOW /////
jQuery(window).resize(function(){
shortenedTab();
});
});