Blame view

sources/apps/notify/js/personalSettings.js 1009 Bytes
42e4f8d60   Kload   add all apps
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
  $(document).ready(function() {
  	$('tr.notificationClass input[type="checkbox"]').change(function(e) {
  		var block = $(this).is(':checked');
  		var id = parseInt($(this).parentsUntil('tr').parent().toggleClass('notify-blocked', block).attr('data-notify-class-id'));
  		$.post(
  			OC.filePath('notify', 'ajax', 'blacklist.php'),
  			{id: id, block: block ? 1 : 0},
  			function(data) {
  				if(data.status != "success") {
  					OC.dialogs.alert(data.message, 'Error');
  					$(this).attr('checked', !block).parentsUntil('tr').parent().toggleClass('notify-blocked', !block);
  				}
  			}
  		);
  	});
  	$('#notify-block-all').change(function(e) {
  		var blockAll = $(this).is(':checked');
  		$('.notificationClass input[type="checkbox"]').each(function(i, el) {
  			if(blockAll != $(el).is(':checked')) {
  				$(el).attr('checked', blockAll).change();
  			}
  		});
  	});
  	$('tr.notificationClass').click(function(e) {
  		var box = $(this).find('input[type="checkbox"]');
  		box.attr('checked', !box.is(':checked')).change();
  	});
  });