-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnotices.js
More file actions
49 lines (44 loc) · 1.31 KB
/
notices.js
File metadata and controls
49 lines (44 loc) · 1.31 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
/**
* @file
* Attaches behaviors for the Notices module.
*/
(function ($) {
/**
* Implements Drupal.behaviors for the Notices module.
*/
Drupal.behaviors.notices = {
attach: function (context, settings) {
$("div.notice-new a.notice-mark-read").bind("click", function() {
var id = $(this).attr('rel');
$("#notice-" + id).removeClass('notice-new');
$("#notice-" + id).find("span.new").hide();
$(this).hide();
// Submit ajax mark read.
$.get('/ajax/notices/notices-mark-as-read/' + id);
return false;
});
$("div.notice a.notice-remove").bind("click", function() {
var id = $(this).attr('rel');
$("#notice-" + id).toggle("fast");
// Submit ajax mark removed.
$.ajax({
url: '/ajax/notices/notices-remove/' + id + '/' + $("#notices").attr('rel'),
dataType: 'json',
type: "get",
success: function(data) {
$('#notices').append(data.data);
}
});
return false;
});
$("#notices-mark-as-read").bind("click", function() {
$('div.notice-new').find('span.new').hide();
$('div.notice-new').removeClass('notice-new');
$('a.notice-mark-read').hide();
// Submit ajax mark read.
$.get('/ajax/notices/notices-mark-as-read');
return false;
});
}
};
})(jQuery);