PageSourceSearch

https://www.water.gov.my/assets/modules/notifications/scripts/notification.js

js water.gov.my collected 2026-10-01 11:25:48 UTC 3,024 bytes, 143 lines download raw bytes

1$(document).ready(function(){
2
3	notifications_scrollbar();
4	//temporary turn on notification
5	getUnreadNotification();
6	get_more_days();
7	get_more_notification();
8
9});
10
11
12function getUnreadNotification(){
13
14	refreshInterval = 120000; // 2 minutes
15	actionUrl = site_url('ajax/notifications');
16
17	// var snd = new Audio("assets/shared/notification.mp3");
18
19	$.ajax({
20		type: "POST",
21		url: actionUrl,
22		data: "action=unread",
23		dataType: 'json',
24		success: function(data){
25			// $('#notification_empty').hide();
26			// $('#notification_count').html('('+data+')');
27
28			if(data > 0)
29			{
30				$('#notification-unread').show()
31				$('#notification-unread').html(data)
32			    // snd.play();
33			}
34			else
35				$('#notification-unread').hide()
36		},
37
38		complete : function(){
39			//alert('complete');
40			setTimeout('getUnreadNotification()',refreshInterval);
41		}
42	});
43}
44
45//edited by NICK changed the class name to enable to avoid class clashes 
46function getNotifications() {
47
48	actionUrl = site_url('ajax/notifications');
49	//alert('getnotification');
50	$.ajax({
51		type: "POST",
52		url: actionUrl,
53		data: "action=get",
54		dataType: 'json',
55		success: function(data){
56
57			//code for displaying the notification message here
58			if($('#notifications .dropdown-content').hasClass('show-notification')) {
59
60				$('#notifications .dropdown-content').removeClass('show-notification')
61
62			} else {
63
64				var html_syntax = '';
65
66				$.each(data, function(i,item) {
67
68					if(item.is_read == 0)
69					{
70						class_msg = 'msg unread';
71					}
72					else
73						class_msg = 'msg';
74
75					html_syntax += '<div class="' + class_msg + '">'+
76										'<span class="msg-title">' + item.content + '</span>' +
77										'<span class="msg-time">' + item.date + '</span>' +
78									'</div>';
79					
80					$('#notifications .dropdown-notification-content').html(html_syntax);
81				});
82
83				$('#notifications .dropdown-notification-content').lionbars();
84				$('#notifications .dropdown-content').addClass('show-notification');
85
86				read_all()
87			}
88		}
89	});
90}
91
92function get_more_days(){
93
94	$('#show_more').click(function(e){
95
96		$.ajax({
97			url: site_url('notifications/get_more_days'),
98			type: 'POST',
99			data: 'show=5',
100			success: function(result){
101				$('#result').append(result);
102			}
103		});
104
105		e.preventDefault();
106	});
107}
108
109function get_more_notification(){
110
111	$('.see_more').live('click',function(){
112		var id = $(this).attr('id');
113
114		$.ajax({
115			url: site_url('notifications/get_more_notifications'),
116			type: 'POST',
117			data: {show:5,id:id},
118			success: function(result){
119				$('#result-'+id).append(result);
120			}
121
122		});
123
124	});
125}
126
127function notifications_scrollbar(){
128	$('#notification_scrollbox').lionbars();
129}
130
131function read_all()
132{
133	actionUrl = site_url('notifications/read_all');
134
135	$.ajax({
136		type: "POST",
137		url: actionUrl,
138		dataType: 'json',
139		success: function(data){
140			$('#notification-unread').html('0').hide();
141		}
142	});
143}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.