PageSourceSearch

https://majalaya.desa.id/assets/js/anti-csrf.js?ve350fadc65507170cac25c1546763ff9

js majalaya.desa.id collected 2026-10-03 18:46:02 UTC 1,344 bytes, 57 lines download raw bytes

1// automatically send CSRF token for all AJAX and POST requests
2
3function addCsrfField(form) {
4	if (form.method.toUpperCase() !== 'GET') {
5		// Check if the input with the name csrfParam already exists
6		let input = form.querySelector(`input[name="${csrfParam}"]`);
7		if (! input) {
8			input = document.createElement('input');
9			input.type = 'hidden';
10			input.name = csrfParam;
11			input.value = getCsrfToken();
12
13			form.append(input);
14		}
15	}
16}
17
18function csrf_semua_form()
19{
20	document.querySelectorAll('form').forEach((form) => {
21		addCsrfField(form)
22		form.addEventListener('submit', (e) => addCsrfField(e.target))
23	})	
24
25	document.addEventListener('submit', (e) => {
26		if (e.target.nodeName === 'FORM') {
27			addCsrfField(e.target)
28		}
29	})
30}
31
32function refreshFormCsrf() {
33	$('form')
34		.find('input[type="hidden"]')
35		.filter(`[name="${csrfParam}"]`)
36		.val($.cookie(csrfParam));
37}
38
39$('document').ready(function() {
40	csrf_semua_form();
41
42	$(document).ajaxComplete(function() {
43		refreshFormCsrf();
44	});
45
46	$.ajaxPrefilter((opts, origOpts, xhr) => {
47		if (!opts.crossDomain && !['HEAD', 'GET', 'OPTIONS'].includes(opts.type)) {
48			const csrfToken = $.cookie(csrfParam);
49
50			if (opts.data instanceof FormData) {
51				opts.data.append(csrfParam, csrfToken);
52			} else {
53				opts.data = `${opts.data || ''}&${csrfParam}=${csrfToken}`;
54			}
55		}
56	})
57})

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.