PageSourceSearch

https://www.utrade.com.my/js/modules/masterpage/custom_masterpage.js

js utrade.com.my collected 2026-10-02 05:38:08 UTC 8,264 bytes, 276 lines download raw bytes

1var recaptcha_public_key = '6LfC_HAUAAAAADvV3fVc7XgdRjAxVGk_N1X09A5i';
2
3var mode = {
4	addMode: 0,
5	editMode: 1,
6	deleteMode: 2,
7	viewMode: 3
8}
9
10var ajaxSendCount = 0;
11var ajaxCompleteCount = 0;
12
13$(document).ready(function () {
14	appendSubNavToogle();
15	$('.fancybox').fancybox();
16	$('.fancybox-media').attr('rel', 'media-gallery').fancybox({
17		openEffect: 'none',
18		closeEffect: 'none',
19		prevEffect: 'none',
20		nextEffect: 'none',
21		arrows: false,
22		helpers: {
23			media: {},
24			buttons: {}
25		}
26	});
27
28	$(window).scroll(function () {
29		if ($(this).scrollTop() > 500) {
30			$(".scroll-top").removeClass("d-none");
31			$(".scroll-top").fadeIn(200);
32		}
33		else {
34			$(".scroll-top").fadeOut(200);
35		}
36	});
37
38	$(".scroll-top").click(function (event) {
39		event.preventDefault();
40		$("html, body").animate({ scrollTop: 0 }, 600);
41	});
42
43	$(document).ajaxSend(function (event, jqXHR, settings) {
44		ajaxSendCount++;
45		$('#loading').removeClass('d-none');
46	});
47
48	$(document).ajaxComplete(function (event, jqXHR, settings) {
49		ajaxCompleteCount++;
50		if (ajaxSendCount == ajaxCompleteCount) {
51			ajaxSendCount = 0;
52			ajaxCompleteCount = 0;
53			$('#loading').addClass('d-none');
54		}
55	});
56
57	$('.tools_content_menu, .products_content_menu').on('click', function () {
58		var hrefSection = $(this).attr('href').indexOf('#') >= 0 ? $(this).attr('href').substr($(this).attr('href').indexOf('#')) : $(this).hasClass("tools_content_menu") ? '#UTRADEWebSection' : '#StocksSection';
59		$('a.list-group-item').removeClass('show active');
60		$('a[href="' + hrefSection + '"]').addClass('show active');
61		$('.service-right-content').addClass('fade');
62		$('#' + hrefSection.replace('#', '').replace('Section', '')).parent().removeClass('fade');
63	});
64
65	$('#loading').addClass('d-none');
66	
67	var g_btn = document.querySelectorAll("div.impersonation-fraud-warning button.asText");
68	for (var i=0,il=g_btn.length;i<il;i++) {
69		g_btn[i].addEventListener("click", closeWarning);
70	}	
71});
72
73function closeWarning() {
74	var el = document.querySelector(".impersonation-fraud-warning");
75	if (el !== undefined)
76		el.classList.add('hide');
77}
78
79function appendSubNavToogle() {
80	if ($('#main-navigation-wrapper .navbar-nav li .dropdown-submenu').length) {
81		$('#main-navigation-wrapper .navbar-nav li .dropdown-submenu').parent('li').children('a').append(function () {
82			return '<button class="dopdown-nav-toggler"> <i class="fa fa-bars" aria-hidden="true"></i></button>';
83		});
84		$('#main-navigation-wrapper .navbar-nav .dopdown-nav-toggler').on('click', function () {
85			var Self = $(this);
86			Self.parent().parent().children('.dropdown-submenu').slideToggle();
87			return false;
88		});
89	};
90}
91
92function getErrorMessage(jqXHR, exception) {
93	var msg = '';
94	if (jqXHR.status === 0) {
95		msg = 'Not connect.\n Verify Network.';
96	} else if (jqXHR.status == 404) {
97		msg = 'Requested page not found. [404]';
98	} else if (jqXHR.status == 500) {
99		msg = 'Internal Server Error [500].';
100	} else if (exception === 'parsererror') {
101		msg = 'Requested JSON parse failed.';
102	} else if (exception === 'timeout') {
103		msg = 'Time out error.';
104	} else if (exception === 'abort') {
105		msg = 'Ajax request aborted.';
106	} else {
107		msg = 'Uncaught Error.\n' + jqXHR.responseText;
108	}
109
110	return msg;
111}
112
113// ADVANCED - Global Validation (START)
114function validIsEmpty(id, rfv) {
115	if ($('#' + id).val().length == 0)
116		$('#' + rfv).removeClass('d-none');
117	else
118		$('#' + rfv).addClass('d-none');
119}
120
121function validIsNumeric(id, rev) {
122	if ($.isNumeric($('#' + id).val()))
123		$('#' + rev).addClass('d-none');
124	else
125		$('#' + rev).removeClass('d-none');
126}
127
128function validIsAlphaNumeric(id, rev) {
129	var regx = /^[A-Za-z0-9]+$/;
130	if (!regx.test($('#' + id).val()))
131		$('#' + rev).removeClass('d-none');
132	else
133		$('#' + rev).addClass('d-none');
134}
135
136function validIsEmail(id, rev) {
137	var regx = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
138	if (!regx.test(String($('#' + id).val()).toLowerCase()))
139		$('#' + rev).removeClass('d-none');
140	else
141		$('#' + rev).addClass('d-none');
142}
143
144function validIsMoreThanEqualInt(id, compare_id, rv) {
145	if ($.isNumeric($('#' + id).val()) && $.isNumeric($('#' + compare_id).val())) {
146		if (parseInt($('#' + id).val()) >= parseInt($('#' + compare_id).val()))
147			$('#' + rv).addClass('d-none');
148		else
149			$('#' + rv).removeClass('d-none');
150	}
151	else
152		$('#' + rv).removeClass('d-none');
153}
154
155function validIsLessThanEqualInt(id, compare_id, rv) {
156	if ($.isNumeric($('#' + id).val()) && $.isNumeric($('#' + compare_id).val())) {
157		if (parseInt($('#' + id).val()) <= parseInt($('#' + compare_id).val()))
158			$('#' + rv).addClass('d-none');
159		else
160			$('#' + rv).removeClass('d-none');
161	}
162	else
163		$('#' + rv).removeClass('d-none');
164}
165
166function validIsLargestInt(id, compare_id, rv) {
167	if ($.isNumeric($('#' + id).val()) && $.isNumeric($('#' + compare_id).val())) {
168		if (parseInt($('#' + id).val()) > parseInt($('#' + compare_id).val()))
169			$('#' + rv).addClass('d-none');
170		else
171			$('#' + rv).removeClass('d-none');
172	}
173	else
174		$('#' + rv).removeClass('d-none');
175}
176
177function validIsSmallestInt(id, compare_id, rv) {
178	if ($.isNumeric($('#' + id).val()) && $.isNumeric($('#' + compare_id).val())) {
179		if (parseInt($('#' + id).val()) < parseInt($('#' + compare_id).val()))
180			$('#' + rv).addClass('d-none');
181		else
182			$('#' + rv).removeClass('d-none');
183	}
184	else
185		$('#' + rv).removeClass('d-none');
186}
187
188
189function validIsExceedLength(id, rev, txtLength) {
190	var new_pass = $('#' + id).val();
191
192	if (new_pass.length < txtLength) {
193		$('#pass_length').removeClass('valid').addClass('invalid');
194	}
195	else {
196		$('#pass_length').removeClass('invalid').addClass('valid');
197	}
198
199	if (new_pass.match(/[A-z]/)) {
200		$('#pass_letter').removeClass('invalid').addClass('valid');
201	}
202	else {
203		$('#pass_letter').removeClass('valid').addClass('invalid');
204	}
205
206	if (new_pass.match(/[A-Z]/)) {
207		$('#pass_cap_letter').removeClass('invalid').addClass('valid');
208	}
209	else {
210		$('#pass_cap_letter').removeClass('valid').addClass('invalid');
211	}
212	if (new_pass.match(/\d/)) {
213		$('#pass_num').removeClass('invalid').addClass('valid');
214	}
215	else {
216		$('#pass_num').removeClass('valid').addClass('invalid');
217	}
218
219	if (new_pass.match(/[!,%,&,@,#,$,^,*,?,_,~,`,(,),-,+,=,{,},|,:,;,.,",']/)) {
220		$('#pass_special').removeClass('invalid').addClass('valid');
221	}
222	else {
223		$('#pass_special').removeClass('valid').addClass('invalid');
224	}
225	if ($('.pwd_validation').hasClass('invalid')) {
226		$('#' + rev).removeClass('d-none');
227	}
228	else {
229		$('#' + rev).addClass('d-none');
230	}
231}
232// ADVANCED - Global Validation (END)
233
234
235// ADVANECD - Formating (START)
236function GetTodayDate(str_dateFormat) {
237	var tdate = new Date();
238	var dd = (tdate.getDate() < 10 ? '0' : '') + tdate.getDate(); //yields day
239	var mm = (tdate.getMonth() < 10 ? '0' : '') + (tdate.getMonth() + 1); //yields month
240	var yyyy = tdate.getFullYear(); //yields year
241	var h = tdate.getHours();
242	var i = tdate.getMinutes();
243	var s = tdate.getSeconds();
244	var dateFormat = str_dateFormat.replace('dd', dd).replace('mm', mm).replace('yyyy', yyyy).replace('h', h).replace('i', i).replace('s', s);
245
246	return dateFormat;
247}
248// ADVANECD - Formating (END)
249
250// Updated by AIMI, 20260918 - Update company name and registration number in email footer
251function emailFooterTemplate() {
252	var footer = '<P> </P>  '
253		+ '<P> </P>  '
254		+ '<P> </P>  '
255		+ '<P>Please do not hesitate to <A href="' + getBASEURL() + '/public/contact_us">contact us</A> if you have any queries with respect to the above.</P>  '
256		+ '<P>Thank you.</P>  '
257		+ '<P> </P>  '
258		+ '<P> </P>  '
259		+ '<P> </P>  '
260		+ '<P>Best regards,<BR> <BR>'
261		+ '<I>UOB Kay Hian (M) Sdn. Bhd.</I><BR>'
262		+ '<I>Registration No. : 199001003423 (194990-K)</I></P>';
263	return footer;
264}
265
266function validateOldNewPwd(id, id2, rev) {
267	var old_pwd = $('#' + id).val();
268	var new_pwd = $('#' + id2).val();
269
270	if (old_pwd == new_pwd) 
271		$('#' + rev).removeClass('d-none');
272		else
273		$('#' + rev).addClass('d-none');
274	
275
276}

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.