| 1 |
jQuery(document).ready(function($) { |
| 2 |
$('#ef-post_following_users_box ul').listFilterizer(); |
| 3 |
|
| 4 |
var params = { |
| 5 |
action: 'save_notifications', |
| 6 |
post_id: $('#post_ID').val(), |
| 7 |
}; |
| 8 |
|
| 9 |
$('.ef-post_following_list li input:checkbox, .ef-following_usergroups li input:checkbox').click(function() { |
| 10 |
var user_group_ids = []; |
| 11 |
var parent_this = $(this); |
| 12 |
params.ef_notifications_name = $(this).attr('name'); |
| 13 |
params._nonce = $("#ef_notifications_nonce").val(); |
| 14 |
|
| 15 |
$(this) |
| 16 |
.parent() |
| 17 |
.parent() |
| 18 |
.parent() |
| 19 |
.find('input:checked') |
| 20 |
.map(function(){ |
| 21 |
user_group_ids.push($(this).val()); |
| 22 |
}) |
| 23 |
|
| 24 |
params.user_group_ids = user_group_ids; |
| 25 |
|
| 26 |
$.ajax({ |
| 27 |
type : 'POST', |
| 28 |
url : (ajaxurl) ? ajaxurl : wpListL10n.url, |
| 29 |
data : params, |
| 30 |
success : function(x) { |
| 31 |
var backgroundColor = parent_this.css( 'background-color' ); |
| 32 |
$(parent_this.parent().parent()) |
| 33 |
.animate( { 'backgroundColor':'#CCEEBB' }, 200 ) |
| 34 |
.animate( { 'backgroundColor':backgroundColor }, 200 ); |
| 35 |
}, |
| 36 |
error : function(r) { |
| 37 |
$('#ef-post_following_users_box').prev().append(' <p class="error">There was an error. Please reload the page.</p>'); |
| 38 |
} |
| 39 |
}); |
| 40 |
}); |
| 41 |
}); |