PageSourceSearch

https://isb.edu.vn/wp-content/plugins/efw-crm/assets/js/crm.js?ver=1790243733

js isb.edu.vn collected 2026-09-24 09:56:05 UTC 22,828 bytes, 802 lines download raw bytes

1jQuery(document).ready(function ($) {
2	var urlParams = new URLSearchParams(window.location.search);
3	var langAttribute = $('html').attr('lang');
4	var d = new Date();
5
6	urlParams.forEach(function (value, key) {
7		if (key.startsWith('utm_')) {
8			localStorage.setItem('external_' + key, value);  // Sử dụng localStorage thay vì sessionStorage
9		}
10	});
11	$('.monthpicker').datepicker({
12		changeMonth: true,
13		changeYear: true,
14		closeText: "Chọn",
15		yearRange: "+0:+3",
16		showButtonPanel: true,
17		dateFormat: 'mm/yy',
18		onClose: function (dateText, inst) {
19
20
21
22			function isDonePressed() {
23				return ($('#ui-datepicker-div').html().indexOf('ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all ui-state-hover') > -1);
24			}
25
26			if (isDonePressed()) {
27
28				var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
29				var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
30				$(this).datepicker('setDate', new Date(year, month, 1));
31				console.log('Done is pressed')
32
33			}
34
35
36
37		}
38	});
39	$("#frmSubmit select").each(function () {
40		$this = $(this);
41		$parent_box = $this.closest('.group-form-other');
42		if ($this.val().search("Khác") === 0) {
43			$parent_box.addClass('show-other');
44		}
45		else
46
47			$parent_box.removeClass('show-other');
48	});
49	$("#frmSubmit").submit(function (e) {
50		e.preventDefault();
51		var cookieName = getCurrentSlug();
52		var timeNow = Date.now() / 1000;
53		var lastSubmitTime = getCookie(cookieName);
54		if (lastSubmitTime && (timeNow - parseInt(lastSubmitTime) < 300)) {
55			if (langAttribute === 'vi') {
56				$text_error = "Bạn đã thực hiện đăng ký. Vui lòng chờ 5 phút";
57			} else {
58				$text_error = "You have successfully registered. Please wait for 5 minutes.";
59			}
60			alert($text_error);
61
62			return false;
63		}
64
65		// time = d.getTime();
66		// if (getCookie('lasttime')) {
67		// 	if (time - parseInt(getCookie('lasttime')) < 300) {
68		// 		alert("Bạn đã thực hiện đăng ký. Vui lòng chờ 5 phút");
69		// 		return false;
70		// 	}
71
72		// }
73
74
75		$form = $(this);
76		$form.find('.error-label').remove();
77		$form.find('.item-error').removeClass('item-error');
78		$telephone = $form.find('input[name="lead[phone_mobile]"]').val();
79		if ($telephone[0] != '0' || $telephone.length < 10) {
80			alert("Số điện thoại không hợp lệ");
81			return false;
82		}
83
84
85		if ($form.find('input[name="lead[year_12_gpa]"]').length) {
86			$year_12_gpa = $form.find('input[name="lead[year_12_gpa]"]').val();
87			if ($year_12_gpa != '') {
88				if (isNaN($year_12_gpa)) {
89
90					errorLabel($form.find('input[name="lead[year_12_gpa]"]'), 'Điểm trung bình năm/học kỳ gần nhất không hợp lệ. Vui lòng điền cụ thể 1 số thập phân (Ví dụ: 7.5)');
91
92					return false;
93
94
95				}
96				else {
97					if ($year_12_gpa < 0) {
98						errorLabel($form.find('input[name="lead[year_12_gpa]"]'), 'Điểm trung bình năm/học kỳ gần nhất không hợp lệ. Vui lòng điền cụ thể 1 số thập phân (Ví dụ: 7.5)');
99						return false;
100					}
101				}
102
103
104			}
105		}
106		if ($form.find('input[name="lead[english_total]"]').length) {
107			$english_total = $form.find('input[name="lead[english_total]"]').val();
108			if ($english_total != '') {
109				if (isNaN($english_total)) {
110
111					errorLabel($form.find('input[name="lead[english_total]"]'), 'Điểm tiếng Anh không hợp lệ. Vui lòng điền dưới dạng con số (Ví dụ: 7.5 hay 750)');
112
113					return false;
114
115
116				}
117				else {
118
119				}
120
121
122			}
123		}
124
125
126		/*$attend_time=$form.find('input[name="lead[attend_time]"]').val();
127		if($attend_time)
128		{
129			if(!validDateAttend($attend_time))
130			{
131				$date = new Date();
132				if($date.getMonth()<10)
133					$month='0'+$date.getMonth();
134				else 
135					$month=$date.getMonth();
136				 errorLabel($form.find('input[name="lead[attend_time]"]'),'Thời gian nhập học không hợp lệ ('+$month+'/'+$date.getFullYear()+')');
137				return false;
138			}
139
140
141			 
142			 
143		}*/
144
145
146		$ot = 0;
147		$(".show-other").each(function () {
148			if ($(this).find('input').val() == "") {
149				errorLabel($(this).find('input'), 'Vui lòng nhập đầy đủ thông tin');
150				$ot++;
151				return false;
152			}
153		});
154		if ($ot) return false;
155
156		data_submit = $form.serialize() + "&action=crmsync&type=crmsync&tracking=" + window.location.href + "&cookie_id=" + getAsmUid() + "&page_title=" + document.title;
157		if (getURLParameter('cdp_test'))
158			data_submit += "&cdp_test=" + getURLParameter('cdp_test');
159		var data_utm = '';
160		if (getURLParameter('utm_source')) {
161			data_utm += "&utm_source=" + getURLParameter('utm_source');
162		} else if (localStorage.getItem('external_utm_source')) {
163			data_utm += "&utm_source=" + localStorage.getItem('external_utm_source');
164		}
165		if (getURLParameter('utm_medium')) {
166			data_utm += "&utm_medium=" + getURLParameter('utm_medium');
167		} else if (localStorage.getItem('external_utm_medium')) {
168			data_utm += "&utm_medium=" + localStorage.getItem('external_utm_medium');
169		}
170		if (getURLParameter('utm_term')) {
171			data_utm += "&utm_term=" + getURLParameter('utm_term');
172		} else if (localStorage.getItem('external_utm_term')) {
173			data_utm += "&utm_term=" + localStorage.getItem('external_utm_term');
174		}
175		data_submit += data_utm;
176
177		localStorage.removeItem('external_utm_source');
178		localStorage.removeItem('external_utm_medium');
179		localStorage.removeItem('external_utm_term');
180
181		$.ajax({
182			url: flatsomeVars.ajaxurl,
183			type: "POST",
184			beforeSend: function () {
185				if ($form.find("#sub_form_register").length) {
186					$form.find('#sub_form_register').after('<i class="icofont-spinner ico-spin"></i>');
187					$form.find('#sub_form_register').hide();
188
189				}
190				else {
191					$form.find('button').after('<i class="icofont-spinner ico-spin"></i>');
192					$form.find('button').hide();
193				}
194				jQuery("#waitprocess").css({
195					display: "block",
196				});
197
198			},
199			complete: function () {
200				$form.find("button").show();
201				jQuery("#waitprocess").css({
202					display: "none",
203				});
204			},
205			dataType: "json",
206
207			data: data_submit,
208
209
210		})
211			.always(function (data) {
212				if (data.dims) {
213					if (typeof web_event !== 'undefined' && typeof web_event.track === 'function') {
214						web_event.track("user", "identify", {
215							dims: {
216								customers: {
217									customer_id: data.dims.customer_id,
218									name: data.dims.name,
219									phone: data.dims.phone
220								}
221							},
222							extra: {
223								identify_event: "user_identify",
224								identify_id: data.dims.customer_id
225							}
226						});
227					}
228				}
229				if (data.e == 0 && data.type_form) {
230					window.dataLayer = window.dataLayer || [];
231					window.dataLayer.push({
232						'event': data.type_form
233					});
234				}
235				if ($form.find("#sub_form_register").length) {
236					$form.find('#sub_form_register').next().remove();
237					$form.find('#sub_form_register').show();
238				}
239				else {
240					$form.find('button').next().remove();
241					$form.find('button').show();
242				}
243
244				$form.find('input[type="text"],textarea').each(function () {
245					$(this).val('');
246				});
247			})
248			.done(function (data) {
249				if (data.e == "1") {
250					alert(data.msg);
251				} else {
252					if (data.redirect) {
253						// setCookie('lasttime', time);
254						setCookie(cookieName, timeNow, 300);
255						window.location.href = data.redirect;
256					} else {
257						jQuery.colorbox({ html: "<div class='box-msg-success'>" + cmsg.success + "</div>", width: "360px" });
258					}
259				}
260
261
262			});
263		return false;
264	});
265	// begin - Đăng ký thành công
266	$("#frmSubmit_v2").submit(function (e) {
267		e.preventDefault();
268
269		var cookieName = getCurrentSlug();
270		var timeNow = Date.now() / 1000;
271		var lastSubmitTime = getCookie(cookieName);
272		if (lastSubmitTime && (timeNow - parseInt(lastSubmitTime) < 300)) {
273			if (langAttribute === 'vi') {
274				$text_error = "Bạn đã thực hiện đăng ký. Vui lòng chờ 5 phút";
275			} else {
276				$text_error = "You have successfully registered. Please wait for 5 minutes.";
277			}
278			alert($text_error);
279
280			return false;
281		}
282		// time = d.getTime();
283		// if (getCookie('lasttime')) {
284		// 	if (time - parseInt(getCookie('lasttime')) < 300) {
285		// 		alert("Bạn đã thực hiện đăng ký. Vui lòng chờ 5 phút");
286		// 		return false;
287		// 	}
288
289		// }
290
291
292		$form = $(this);
293		$form.find('.error-label').remove();
294		$form.find('.item-error').removeClass('item-error');
295		$telephone = $form.find('input[name="lead[phone_mobile]"]').val();
296		if ($telephone[0] != '0' || $telephone.length < 10) {
297			alert("Số điện thoại không hợp lệ");
298			return false;
299		}
300
301
302		if ($form.find('input[name="lead[year_12_gpa]"]').length) {
303			$year_12_gpa = $form.find('input[name="lead[year_12_gpa]"]').val();
304			if ($year_12_gpa != '') {
305				if (isNaN($year_12_gpa)) {
306
307					errorLabel($form.find('input[name="lead[year_12_gpa]"]'), 'Điểm trung bình năm/học kỳ gần nhất không hợp lệ. Vui lòng điền cụ thể 1 số thập phân (Ví dụ: 7.5)');
308
309					return false;
310
311
312				}
313				else {
314					if ($year_12_gpa < 0) {
315						errorLabel($form.find('input[name="lead[year_12_gpa]"]'), 'Điểm trung bình năm/học kỳ gần nhất không hợp lệ. Vui lòng điền cụ thể 1 số thập phân (Ví dụ: 7.5)');
316						return false;
317					}
318				}
319
320
321			}
322		}
323		if ($form.find('input[name="lead[english_total]"]').length) {
324			$english_total = $form.find('input[name="lead[english_total]"]').val();
325			if ($english_total != '') {
326				if (isNaN($english_total)) {
327
328					errorLabel($form.find('input[name="lead[english_total]"]'), 'Điểm tiếng Anh không hợp lệ. Vui lòng điền dưới dạng con số (Ví dụ: 7.5 hay 750)');
329
330					return false;
331
332
333				}
334				else {
335
336				}
337
338
339			}
340		}
341
342		$ot = 0;
343		$(".show-other").each(function () {
344			if ($(this).find('input').val() == "") {
345				errorLabel($(this).find('input'), 'Vui lòng nhập đầy đủ thông tin');
346				$ot++;
347				return false;
348			}
349		});
350		if ($ot) return false;
351
352		data_submit = $form.serialize() + "&action=crmsync&type=crmsync&tracking=" + window.location.href + "&cookie_id=" + getAsmUid() + "&page_title=" + document.title;
353		if (getURLParameter('cdp_test'))
354			data_submit += "&cdp_test=" + getURLParameter('cdp_test');
355		var data_utm = '';
356		if (getURLParameter('utm_source')) {
357			data_utm += "&utm_source=" + getURLParameter('utm_source');
358		} else if (localStorage.getItem('external_utm_source')) {
359			data_utm += "&utm_source=" + localStorage.getItem('external_utm_source');
360		}
361		if (getURLParameter('utm_medium')) {
362			data_utm += "&utm_medium=" + getURLParameter('utm_medium');
363		} else if (localStorage.getItem('external_utm_medium')) {
364			data_utm += "&utm_medium=" + localStorage.getItem('external_utm_medium');
365		}
366		if (getURLParameter('utm_term')) {
367			data_utm += "&utm_term=" + getURLParameter('utm_term');
368		} else if (localStorage.getItem('external_utm_term')) {
369			data_utm += "&utm_term=" + localStorage.getItem('external_utm_term');
370		}
371		data_submit += data_utm;
372
373		localStorage.removeItem('external_utm_source');
374		localStorage.removeItem('external_utm_medium');
375		localStorage.removeItem('external_utm_term');
376
377
378
379		$.ajax({
380			url: flatsomeVars.ajaxurl,
381			type: "POST",
382			beforeSend: function () {
383				if ($form.find("#sub_form_register").length) {
384					$form.find('#sub_form_register').after('<i class="icofont-spinner ico-spin"></i>');
385					$form.find('#sub_form_register').hide();
386				}
387				else {
388					$form.find('button').after('<i class="icofont-spinner ico-spin"></i>');
389					$form.find('button').hide();
390				}
391				jQuery('#waitprocess').css({
392					display: "block"
393				});
394
395			},
396			complete: function () {
397
398				$form.find('button').show();
399				jQuery('#waitprocess').css({
400					display: "none"
401				});
402			},
403			dataType: "json",
404
405			data: data_submit,
406
407
408		})
409			.always(function (data) {
410				if (data.dims) {
411					if (typeof web_event !== 'undefined' && typeof web_event.track === 'function') {
412						web_event.track("user", "identify", {
413							dims: {
414								customers: {
415									customer_id: data.dims.customer_id,
416									name: data.dims.name,
417									phone: data.dims.phone
418								}
419							},
420							extra: {
421								identify_event: "user_identify",
422								identify_id: data.dims.customer_id
423							}
424						});
425					}
426				}
427				if (data.e == 0 && data.type_form) {
428					window.dataLayer = window.dataLayer || [];
429					window.dataLayer.push({
430						'event': data.type_form
431					});
432				}
433				if ($form.find("#sub_form_register").length) {
434					$form.find('#sub_form_register').next().remove();
435					$form.find('#sub_form_register').show();
436				}
437				else {
438					$form.find('button').next().remove();
439					$form.find('button').show();
440				}
441
442				$form.find('input[type="text"],textarea').each(function () {
443					$(this).val('');
444				});
445
446			})
447			.done(function (data) {
448				if (data.e == "1")
449					alert(data.msg);
450
451				if (data.redirect) {
452					// setCookie('lasttime', time);
453					// window.location.href = data.redirect;
454					setCookie(cookieName, timeNow, 300);
455					window.location.href = data.redirect;
456				}
457
458			});
459		return false;
460	});
461	// end - Đăng ký thành công
462	// BEGIN - UNIPREP
463	$("#frmSubmit_v3").submit(function (e) {
464		e.preventDefault();
465
466		var cookieName = getCurrentSlug();
467		var timeNow = Date.now() / 1000;
468		var lastSubmitTime = getCookie(cookieName);
469		if (lastSubmitTime && (timeNow - parseInt(lastSubmitTime) < 300)) {
470			if (langAttribute === 'vi') {
471				$text_error = "Bạn đã thực hiện đăng ký. Vui lòng chờ 5 phút";
472			} else {
473				$text_error = "You have successfully registered. Please wait for 5 minutes.";
474			}
475			alert($text_error);
476
477			return false;
478		}
479
480		// time = d.getTime();
481		// if (getCookie('lasttime')) {
482		// 	if (time - parseInt(getCookie('lasttime')) < 300) {
483		// 		alert("Bạn đã thực hiện đăng ký. Vui lòng chờ 5 phút");
484		// 		return false;
485		// 	}
486
487		// }
488
489		$form = $(this);
490		$form.find('.error-label').remove();
491		$form.find('.item-error').removeClass('item-error');
492		$telephone = $form.find('input[name="lead[phone_mobile]"]').val();
493		if ($telephone) {
494			if ($telephone[0] != '0' || $telephone.length < 10) {
495				alert("Số điện thoại không hợp lệ");
496				return false;
497			}
498		}
499
500
501		if ($form.find('input[name="lead[year_12_gpa]"]').length) {
502			$year_12_gpa = $form.find('input[name="lead[year_12_gpa]"]').val();
503			if ($year_12_gpa != '') {
504				if (isNaN($year_12_gpa)) {
505
506					errorLabel($form.find('input[name="lead[year_12_gpa]"]'), 'Điểm trung bình năm/học kỳ gần nhất không hợp lệ. Vui lòng điền cụ thể 1 số thập phân (Ví dụ: 7.5)');
507
508					return false;
509
510
511				} else {
512					if ($year_12_gpa < 0) {
513						errorLabel($form.find('input[name="lead[year_12_gpa]"]'), 'Điểm trung bình năm/học kỳ gần nhất không hợp lệ. Vui lòng điền cụ thể 1 số thập phân (Ví dụ: 7.5)');
514						return false;
515					}
516				}
517
518
519			}
520		}
521
522		$ot = 0;
523		$(".show-other").each(function () {
524			if ($(this).find('input').val() == "") {
525				errorLabel($(this).find('input'), 'Vui lòng nhập đầy đủ thông tin');
526				$ot++;
527				return false;
528			}
529		});
530		if ($ot) return false;
531
532
533		$validate_6_major = $('div.form-checkbox.required :checkbox:checked');
534		$list_6_major = $validate_6_major.length;
535		$source_description = '';
536		$6_major = '';
537		if ($list_6_major) {
538			$validate_6_major.each(function (index, element) {
539				$description = $(this).data('sd');
540				$6_majorVal = $(this).val();
541				if (!$description) {
542					$description = "null";
543				}
544				if (index === ($list_6_major - 1)) {
545					$source_description += $description;
546					$6_major += index + ". " + $6_majorVal;
547				} else {
548					$source_description += $description + "\n";
549					$6_major += index + ". " + $6_majorVal + "\n";
550				}
551			});
552		} else {
553			errorLabel($form.find('div.form-checkbox.required'), 'Vui lòng chọn sự kiện cần đăng ký để tiếp tục');
554			return false;
555		}
556		$validate_university = $('div.form-radio.required :radio:checked').length;
557		if (!$validate_university) {
558			errorLabel($form.find('div.form-radio.required'), 'Vui lòng chọn Trường Đại học dự kiến để tiếp tục');
559			return false;
560		}
561
562		// $mes = $form.find('#frm_message').val();
563		// $majors = $form.find('input[name="majors"]').val();
564		// if(!$majors){
565		// 	$majors = "null";
566		// }
567		// $university = $('input[name="university_name_text"]:checked').val();
568
569		// if($university === "Khác"){
570		// 	$universityOther = jQuery('#university_other_name_text').val();
571		// 	if($universityOther){
572		// 		$university = $universityOther;
573		// 	}
574		// }
575
576		// $form.find('#frm_message').val("- Ngành học mong muốn: " + $majors + "\n" + "- Trường Đại học dự kiến: " + $university + "\n - Message: " + $mes);
577
578
579		data_submit = $form.serialize() + "&action=crmsync_v3&type=crmsync&tracking=" + window.location.href + "&cookie_id=" + getAsmUid() + "&page_title=" + document.title;
580		if (getURLParameter('cdp_test'))
581			data_submit += "&cdp_test=" + getURLParameter('cdp_test');
582		var data_utm = '';
583		if (getURLParameter('utm_source')) {
584			data_utm += "&utm_source=" + getURLParameter('utm_source');
585		} else if (localStorage.getItem('external_utm_source')) {
586			data_utm += "&utm_source=" + localStorage.getItem('external_utm_source');
587		}
588		if (getURLParameter('utm_medium')) {
589			data_utm += "&utm_medium=" + getURLParameter('utm_medium');
590		} else if (localStorage.getItem('external_utm_medium')) {
591			data_utm += "&utm_medium=" + localStorage.getItem('external_utm_medium');
592		}
593		if (getURLParameter('utm_term')) {
594			data_utm += "&utm_term=" + getURLParameter('utm_term');
595		} else if (localStorage.getItem('external_utm_term')) {
596			data_utm += "&utm_term=" + localStorage.getItem('external_utm_term');
597		}
598		data_submit += data_utm;
599
600		localStorage.removeItem('external_utm_source');
601		localStorage.removeItem('external_utm_medium');
602		localStorage.removeItem('external_utm_term');
603
604		data_submit += "&source_description=" + $source_description;
605		data_submit += "&6_major=" + $6_major;
606
607
608		$.ajax({
609			url: flatsomeVars.ajaxurl,
610			type: "POST",
611			beforeSend: function () {
612				// $form.find('button').after('<i class="icofont-spinner ico-spin"></i>');
613				$form.find('button').hide();
614				jQuery('#waitprocess').css({
615					display: "block"
616				});
617			},
618			complete: function () {
619
620				$form.find('button').show();
621				jQuery('#waitprocess').css({
622					display: "none"
623				});
624			},
625			dataType: "json",
626
627			data: data_submit,
628
629
630		})
631			.always(function (data) {
632				if (data.dims) {
633					if (typeof web_event !== 'undefined' && typeof web_event.track === 'function') {
634						web_event.track("user", "identify", {
635							dims: {
636								customers: {
637									customer_id: data.dims.customer_id,
638									name: data.dims.name,
639									phone: data.dims.phone
640								}
641							},
642							extra: {
643								identify_event: "user_identify",
644								identify_id: data.dims.customer_id
645							}
646						});
647					}
648				}
649				if (data.e == 0 && data.type_form) {
650					window.dataLayer = window.dataLayer || [];
651					window.dataLayer.push({
652						'event': data.type_form
653					});
654				}
655				$form.find('button').next().remove();
656				$form.find('button').show();
657				$form.find('input[type="text"],textarea').each(function () {
658					$(this).val('');
659				});
660			})
661			.done(function (data) {
662				if (data.e == "1")
663					alert(data.msg);
664
665				if (data.redirect) {
666					// setCookie('lasttime', time);
667					// window.location.href = data.redirect;
668					setCookie(cookieName, timeNow, 300);
669					window.location.href = data.redirect;
670				}
671			});
672		return false;
673	});
674	// END - UNIPREP
675	$('.group-form-other select').change(function () {
676		$this = $(this);
677		$parent_box = $this.closest('.group-form-other');
678		if ($this.val().search("Khác") === 0) {
679			$parent_box.addClass('show-other');
680		}
681		else
682
683			$parent_box.removeClass('show-other');
684
685
686	});
687});
688function errorLabel(item, label) {
689	jQuery(item).closest('.form-item').addClass('item-error');
690	jQuery(item).after('<span class="error-label">' + label + '</span>');
691	jQuery([document.documentElement, document.body]).animate({
692		scrollTop: jQuery(item).offset().top
693	}, 2000);
694}
695function validDateAttend(dateattend) {
696	$attend_split = (dateattend.split("/"));
697
698	if ($attend_split.length < 2) {
699		return false;
700	}
701	else {
702		$date = new Date();
703
704
705		if (isNaN($attend_split[0]) || isNaN($attend_split[1]))
706			return false;
707		else {
708			if ($attend_split[0].length > 2 || $attend_split[1].length > 4)
709				return false;
710			else {
711				if (parseInt($attend_split[1]) < $date.getFullYear())
712					return false;
713			}
714
715			if (parseInt($attend_split[0]) > 12)
716				return false;
717		}
718
719	}
720	return true;
721}
722
723function getURLParameter(name) {
724	return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
725}
726// function setCookie(cname, cvalue, exdays) {
727// 	var d = new Date();
728// 	d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
729// 	var expires = "expires=" + d.toUTCString();
730// 	document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
731// }
732// function getCookie(cname) {
733// 	var name = cname + "=";
734// 	var decodedCookie = decodeURIComponent(document.cookie);
735// 	var ca = decodedCookie.split(';');
736// 	for (var i = 0; i < ca.length; i++) {
737// 		var c = ca[i];
738// 		while (c.charAt(0) == ' ') {
739// 			c = c.substring(1);
740// 		}
741// 		if (c.indexOf(name) == 0) {
742// 			return c.substring(name.length, c.length);
743// 		}
744// 	}
745// 	return "";
746// }
747
748function setCookie(name, value, seconds) {
749	var expires = "";
750	if (seconds) {
751		var date = new Date();
752		date.setTime(date.getTime() + (seconds * 1000));
753		expires = "; expires=" + date.toUTCString();
754	}
755	document.cookie = name + "=" + (value || "") + expires + "; path=/";
756}
757
758function getCookie(name) {
759	var nameEQ = name + "=";
760	var ca = document.cookie.split(';');
761	for (var i = 0; i < ca.length; i++) {
762		var c = ca[i];
763		while (c.charAt(0) == ' ') c = c.substring(1, c.length);
764		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
765	}
766	return null;
767}
768
769function getCurrentSlug() {
770	var currentUrl = window.location.href;
771	var match = currentUrl.match(/:\/\/[^\/]+\/(.+?)\/?$/);
772	var slug = match ? match[1] : null;
773
774	if (slug) {
775		slug = slug.replace(/\/$/, '');
776		slug = slug.replace(/\//g, '_');
777	}
778
779	return slug;
780}
781
782function getAsmUid() {
783	const key = '_asm_uid';
784
785	// Hàm lấy cookie theo tên
786	function getCookie(name) {
787		const value = "; " + document.cookie;
788		const parts = value.split("; " + name + "=");
789		if (parts.length === 2) return parts.pop().split(";").shift();
790		return;
791	}
792
793	// 1. Ưu tiên Cookie
794	let asmUid = getCookie(key);
795
796	// 2. Nếu không có thì lấy từ LocalStorage
797	if (!asmUid) {
798		asmUid = localStorage.getItem(key);
799	}
800
801	return asmUid;
802}

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.