PageSourceSearch

https://www.ada.lk/assets/js/custom.js

js ada.lk collected 2026-10-02 13:36:38 UTC 4,929 bytes, 134 lines download raw bytes

1function postComment(article_id) {	
2	var valid = 1;
3	if($('#comment-name').val() == '') {
4		$('#comment-name-div').addClass('has-error');
5		$('#comment-name-help').html('නම ඇතුළත් කරන්න');
6		valid = 0;
7	} else {
8		$('#comment-name-div').removeClass('has-error');
9		$('#comment-name-help').html('');
10	}
11	
12	if($('#comment-email').val() == '') {
13		$('#comment-email-div').addClass('has-error');
14		$('#comment-email-help').html('විද්‍යුත් තැපැල් ලිපිනය ඇතුළත් කරන්න');
15		valid = 0;
16	} else {
17		$('#comment-email-div').removeClass('has-error');
18		$('#comment-email-help').html('');
19	}
20	
21	if($('#comment-message').val() == '') {
22		$('#comment-message-div').addClass('has-error');
23		$('#comment-message-help').html('ඔබේ ප්‍රතිචාරය ඇතුළත් කරන්න');
24		valid = 0;
25	} else {
26		$('#comment-message-div').removeClass('has-error');
27		$('#comment-message-help').html('');
28	}
29	
30	if(valid == 1) {
31		var dataurl = 'article_id='+article_id+'&parent_id='+$('#comment-parent').val()+'&name='+$('#comment-name').val()+'&email='+$('#comment-email').val()+'&message='+$('#comment-message').val();
32		var xhttp = new XMLHttpRequest();
33		xhttp.onreadystatechange = function() {
34			if (this.readyState == 4 && this.status == 200) {
35				var messageType = this.responseText.split('####')[0];
36                var message = this.responseText.split('####')[1];
37				$('#comment-response-message').html('<div class="alert alert-success"><strong> ස්තුතියි </strong> ඔබගේ ප‍්‍රතිචාරය අනුමැතිය සඳහා යොමුකර ඇත </div>');
38				if(messageType == 'success') {
39					$('#comment-name').val('');
40					$('#comment-email').val('');
41					$('#comment-message').val('');
42					
43					$('#comment-reply-div').addClass('hidden');
44					$('#comment-parent').val('0');
45					$('#comment-reply-name').html('');
46					$('#comment-reply-message').html('');
47				}
48				setTimeout(function(){ 
49					$('#comment-response-message').html('');
50				}, 5000);
51			}
52		};
53		xhttp.open("POST", static_url()+"staticfeeds/addComment", true);
54		xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
55		xhttp.send(dataurl);
56	} 
57}
58
59function replyComment(id, name, message){
60	$('#comment-reply-div').removeClass('hidden');
61	$('#comment-parent').val(id);
62	$('#comment-reply-name').html(name);
63	$('#comment-reply-message').html(message);
64}
65
66function cancelReply() {
67	$('#comment-reply-div').addClass('hidden');
68	$('#comment-parent').val('0');
69	$('#comment-reply-name').html('');
70	$('#comment-reply-message').html('');
71	
72	$('#comment-name').val('');
73	$('#comment-email').val('');
74	$('#comment-message').val('');
75	
76	$('#comment-name-div').removeClass('has-error');
77	$('#comment-name-help').html('');
78	$('#comment-email-div').removeClass('has-error');
79	$('#comment-email-help').html('');
80	$('#comment-message-div').removeClass('has-error');
81	$('#comment-message-help').html('');
82}
83
84function commentThumbs(article_id, comment_id, value) {
85	var dataurl = 'article_id='+article_id+'&comment_id='+comment_id+'&value='+value;
86	var xhttp = new XMLHttpRequest();
87	xhttp.onreadystatechange = function() {
88		if (this.readyState == 4 && this.status == 200) {
89			var messageType = this.responseText.split('####')[0];
90			var thumbs_ups = this.responseText.split('####')[1];
91			var thumbs_downs = this.responseText.split('####')[2];
92			if(messageType == 'success') {
93				$('#thumbs-ups-'+comment_id).html(thumbs_ups);
94				$('#thumbs-downs-'+comment_id).html(thumbs_downs);
95			}
96		}
97	};
98	xhttp.open("POST", static_url()+"staticfeeds/addThumbs", true);
99	xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
100	xhttp.send(dataurl);
101}
102
103function addPoll(poll_id) {
104	
105	var choice = 0;
106				var optionlength = document.getElementsByName('poll-radioG1').length;
107				for(var i=0; i<optionlength; i++){
108					if(document.getElementsByName('poll-radioG1')[i].checked) {
109						answer_id = document.getElementsByName('poll-radioG1')[i].value;
110					}
111				}
112	
113	var dataurl = 'poll_id='+poll_id+'&answer_id='+answer_id;
114	var xhttp = new XMLHttpRequest();
115	xhttp.onreadystatechange = function() {
116		if (this.readyState == 4 && this.status == 200) {
117			var messageType = this.responseText.split('####')[0];
118			var thumbs_ups = this.responseText.split('####')[1];
119			var thumbs_downs = this.responseText.split('####')[2];
120			if(messageType == 'success') {
121				//$('#thumbs-ups-'+comment_id).html(thumbs_ups);
122				//$('#thumbs-downs-'+comment_id).html(thumbs_downs);
123			}
124		}
125	};
126	xhttp.open("POST", static_url()+"staticfeeds/addPoll", true);
127	xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
128	xhttp.send(dataurl);
129}
130
131
132
133
134

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.