PageSourceSearch

https://www.luxuryzone.it/assets/js/_core/post.js?ver=1.9

js luxuryzone.it collected 2026-10-09 02:48:06 UTC 13,693 bytes, 438 lines download raw bytes

1////////////////////////////////////////////
2// PostBack and AjaxPostBack
3////////////////////////////////////////////
4
5qcodo.postBack = function(strForm, strControl, strEvent, strParameter) {
6	var objForm = document.getElementById(strForm);
7	objForm.Qform__FormControl.value = strControl;
8	objForm.Qform__FormEvent.value = strEvent;
9	objForm.Qform__FormParameter.value = strParameter;
10	objForm.Qform__FormCallType.value = "Server";
11	objForm.Qform__FormUpdates.value = qcodo.formUpdates();
12	objForm.Qform__FormCheckableControls.value = qcodo.formCheckableControls(strForm, "Server");
13	if(objForm.beforesubmit && !objForm.beforesubmit()) {
14
15		$('[data-prevent-double-click]').prop('disabled', '');
16		return;
17	}
18	objForm.submit();
19};
20
21qcodo.formUpdates = function() {
22	var strToReturn = "";
23	for (var strControlId in qcodo.controlModifications)
24		for (var strProperty in qcodo.controlModifications[strControlId])
25			strToReturn += strControlId + " " + strProperty + " " + qcodo.controlModifications[strControlId][strProperty] + "\n";
26	qcodo.controlModifications = {};
27	return strToReturn;
28};
29
30qcodo.formCheckableControls = function(strForm, strCallType) {
31	var objForm = document.getElementById(strForm);
32	var strToReturn = "";
33
34	for (var intIndex = 0; intIndex < objForm.elements.length; intIndex++) {
35		if (((objForm.elements[intIndex].type == "checkbox") ||
36				(objForm.elements[intIndex].type == "radio")) &&
37			((strCallType == "Ajax") ||
38				(!objForm.elements[intIndex].disabled))) {
39
40			// CheckBoxList
41			if (objForm.elements[intIndex].id.indexOf('[') >= 0) {
42				if (objForm.elements[intIndex].id.indexOf('[0]') >= 0)
43					strToReturn += " " + objForm.elements[intIndex].id.substring(0, objForm.elements[intIndex].id.length - 3);
44
45				// RadioButtonList
46			} else if (objForm.elements[intIndex].id.indexOf('_') >= 0) {
47				if (objForm.elements[intIndex].id.indexOf('_0') >= 0)
48					strToReturn += " " + objForm.elements[intIndex].id.substring(0, objForm.elements[intIndex].id.length - 2);
49
50				// Standard Radio or Checkbox
51			} else {
52				strToReturn += " " + objForm.elements[intIndex].id;
53			};
54		};
55	};
56
57	if (strToReturn.length > 0)
58		return strToReturn.substring(1);
59	else
60		return "";
61};
62
63qcodo.interceptSubmit = function(event, strControlId) {
64	var objControl = document.getElementById(strControlId);
65	event.keyCode = 13;
66	if (objControl.onkeypress) objControl.onkeypress(event);
67	else if (objControl.onkeydown) objControl.onkeydown(event);
68	objControl.blur();
69};
70
71qcodo.ajaxQueue = new Array();
72
73qcodo.postAjax = function(strForm, strControl, strEvent, strParameter, strWaitIconControlId) {
74
75
76
77	// Only add if we're not unloaded
78	if (!qc.unloadFlag) {
79		if (qc.beforeUnloadFlag) {
80			qc.beforeUnloadFlag = false;
81		};
82
83		// Figure out if Queue is Empty
84		var blnQueueEmpty = false;
85		if (qcodo.ajaxQueue.length == 0)
86			blnQueueEmpty = true;
87
88		// Enqueue the AJAX Request
89		qcodo.ajaxQueue.push(new Array(strForm, strControl, strEvent, strParameter, strWaitIconControlId));
90
91		// If the Queue was originally empty, call the Dequeue
92		if (blnQueueEmpty)
93			qcodo.dequeueAjaxQueue();
94	};
95};
96
97qcodo.clearAjaxQueue = function() {
98	qcodo.ajaxQueue = new Array();
99};
100
101qcodo.objAjaxWaitIcon = null;
102qcodo.ajaxRequest = null;
103
104qcodo.handleAjaxResponse = function(objEvent, objIframeResponse) {
105	var objRequest;
106
107	if (objIframeResponse || (qcodo.ajaxRequest.readyState == 4)) {
108		if (objIframeResponse)
109			objRequest = objIframeResponse;
110		else
111			objRequest = qcodo.ajaxRequest;
112
113		if (!qcodo.beforeUnloadFlag) {
114			try {
115				var objXmlDoc = objRequest.responseXML;
116//					qcodo.logMessage(objRequest.responseText, true);
117//					alert('AJAX Response Received');
118
119				if (!objXmlDoc) {
120					// alert("Sorry! An error occurred!");
121					// console.log(objRequest.responseText);
122					// qcodo.ajaxQueue.shift();
123					//
124					// // Hid the WaitIcon (if applicable)
125					// if (qcodo.objAjaxWaitIcon)
126					//     qcodo.objAjaxWaitIcon.style.display = 'none';
127					//
128					// // If there are still AjaxEvents in the queue, go ahead and process/dequeue them
129					// if (qcodo.ajaxQueue.length > 0)
130					//     qcodo.dequeueAjaxQueue();
131					//
132
133
134					alert("An error occurred during AJAX Response parsing");
135					//console.error(objRequest);
136					var objErrorWindow = window.open('about:blank', 'qcodo_error','menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=700,left=50,top=50');
137					//objErrorWindow.focus();
138					objErrorWindow.document.write(objRequest.responseText);
139					return;
140
141				} else {
142					var intLength = 0;
143
144					// Go through Controls
145					var objXmlControls = objXmlDoc.getElementsByTagName('control');
146					intLength = objXmlControls.length;
147
148					for (var intIndex = 0; intIndex < intLength; intIndex++) {
149						var strControlId = objXmlControls[intIndex].attributes.getNamedItem('id').nodeValue;
150
151						var strControlHtml = "";
152						if (objXmlControls[intIndex].textContent)
153							strControlHtml = objXmlControls[intIndex].textContent;
154						else if (objXmlControls[intIndex].firstChild)
155							strControlHtml = objXmlControls[intIndex].firstChild.nodeValue;
156
157						// Perform Callback Responsibility
158						if (strControlId == "Qform__FormState") {
159							var objFormState = document.getElementById(strControlId);
160							objFormState.value = strControlHtml;
161						} else {
162							var objSpan = document.getElementById(strControlId + "_ctl");
163							if (objSpan)
164								objSpan.innerHTML = strControlHtml;
165							else if (document.getElementById(strControlId ) != null)
166								document.getElementById(strControlId ).innerHTML=strControlHtml;
167						};
168					};
169
170					// Go through Commands
171					var objXmlCommands = objXmlDoc.getElementsByTagName('command');
172					intLength = objXmlCommands.length;
173
174					for (var intIndex = 0; intIndex < intLength; intIndex++) {
175						if (objXmlCommands[intIndex] && objXmlCommands[intIndex].firstChild) {
176							var strCommand = "";
177							intChildLength = objXmlCommands[intIndex].childNodes.length;
178							for (var intChildIndex = 0; intChildIndex < intChildLength; intChildIndex++)
179								strCommand += objXmlCommands[intIndex].childNodes[intChildIndex].nodeValue;
180							eval(strCommand);
181						};
182					};
183				};
184			} catch (objExc) {
185				console.error(objExc);
186
187				//alert(objExc.message + "\r\non line number " + objExc.lineNumber + "\r\nin file " + objExc.fileName);
188				alert("An error occurred during AJAX Response handling");
189				// var objErrorWindow = window.open('about:blank', 'qcodo_error','menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=700,left=50,top=50');
190				// //objErrorWindow.focus();
191				// objErrorWindow.document.write(objRequest.responseText);
192				return;
193			};
194		};
195
196		// Perform the Dequeue
197		qcodo.ajaxQueue.shift();
198
199		// Hid the WaitIcon (if applicable)
200		if (qcodo.objAjaxWaitIcon)
201			qcodo.objAjaxWaitIcon.style.display = 'none';
202
203		// If there are still AjaxEvents in the queue, go ahead and process/dequeue them
204		if (qcodo.ajaxQueue.length > 0)
205			qcodo.dequeueAjaxQueue();
206	};
207
208	qcodo.setClientValidators();
209
210};
211
212
213qcodo.setClientValidators = function(){
214	$(
215		function(){
216
217			qcodo.validationSummary();
218			$("input").change(
219				function() {
220
221					let attr = $(this).attr('data-val-group');
222					let input=$(this);
223					if(input.val()) {
224						$('.label-danger.' + attr).remove();
225						input.removeClass('invalid');
226						//$('.error-checkout').removeClass("error-form");
227						qcodo.validationSummary();
228					}
229					// if($this.hasAttr $input.val()){
230					//
231					// }
232
233
234
235				});
236
237
238			$("select[data-required='true']").change(
239
240				function() {
241					let input=$(this);
242					let attr = input.attr('data-validation-group') ? $(this).attr('data-validation-group') : $(this).attr('id')  ;
243
244					if(input.val()) {
245						$('.label-danger.' + attr).remove();
246						qcodo.validationSummary();
247					}
248
249
250				});
251			$("select[data-val-required='true']").change(
252
253				function() {
254					let input=$(this);
255					let attr = input.attr('data-validation-group') ? $(this).attr('data-validation-group') : $(this).attr('id')  ;
256
257					if(input.val()) {
258						$('.label-danger.' + attr).remove();
259						qcodo.validationSummary();
260					}
261
262
263				});
264
265			// $("select[data-required='true']").change(
266			// 	function() {
267			// 		let input=$(this);
268			// 		if (input.next().next('.label-danger')) {
269			// 			input.next('.label-danger').remove();
270			// 			qcodo.validationSummary();
271			// 		}
272			//
273			//
274			// 	});
275			//
276			// $("select[data-required='true']").change(
277			// 	function() {
278			// 		let select=$(this);
279			// 		if (select.next().siblings('label-danger')) {
280			// 			select.next().siblings('label-danger').remove();
281			// 			qcodo.validationSummary();
282			// 		}
283			//
284			//
285			// 	});
286			// $("select[data-required='true']").change(
287			// 	function() {
288			// 		var value = $(this).val();
289			// 		if ($(this).siblings('.label.label-danger') && value != 0) {
290			// 			$(this).siblings('.label.label-danger').remove();
291			// 			qcodo.validationSummary();
292			// 		}
293			//
294			//
295			// 	});
296
297
298		});
299
300};
301qcodo.validationSummary =function(){
302
303	if($("input.invalid").length>0 || $("input.label-danger").length>0)
304		$(".validation-summary").show();
305	else
306		$(".validation-summary").hide();
307
308
309
310
311}
312qcodo.dequeueAjaxQueue = function() {
313	if (qcodo.ajaxQueue.length > 0) {
314		strForm = this.ajaxQueue[0][0];
315		strControl = this.ajaxQueue[0][1];
316		strEvent = this.ajaxQueue[0][2];
317		strParameter = this.ajaxQueue[0][3];
318		strWaitIconControlId = this.ajaxQueue[0][4];
319
320
321		if (!strWaitIconControlId) {
322			strWaitIconControlId="defaultWaitIcon";
323		}
324		// Display WaitIcon (if applicable)
325		if (strWaitIconControlId) {
326			this.objAjaxWaitIcon = this.getWrapper(strWaitIconControlId);
327			if (this.objAjaxWaitIcon)
328				this.objAjaxWaitIcon.style.display = 'inline';
329		}
330
331
332		var objForm = document.getElementById(strForm);
333		objForm.Qform__FormControl.value = strControl;
334		objForm.Qform__FormEvent.value = strEvent;
335		objForm.Qform__FormParameter.value = strParameter;
336		objForm.Qform__FormCallType.value = "Ajax";
337		objForm.Qform__FormUpdates.value = qcodo.formUpdates();
338		objForm.Qform__FormCheckableControls.value = this.formCheckableControls(strForm, "Ajax");
339
340		var strPostData = "";
341		for (var i = 0; i < objForm.elements.length; i++) {
342			switch (objForm.elements[i].type) {
343				case "checkbox":
344				case "radio":
345					if (objForm.elements[i].checked) {
346						var strTestName = objForm.elements[i].name + "_";
347						if (objForm.elements[i].id.substring(0, strTestName.length) == strTestName)
348							strPostData += "&" + objForm.elements[i].name + "=" + objForm.elements[i].id.substring(strTestName.length);
349						else
350//								strPostData += "&" + objForm.elements[i].id + "=" + "1";
351							strPostData += "&" + objForm.elements[i].id + "=" + objForm.elements[i].value;
352					};
353					break;
354
355				case "select-multiple":
356					var blnOneSelected = false;
357					for (var intIndex = 0; intIndex < objForm.elements[i].options.length; intIndex++)
358						if (objForm.elements[i].options[intIndex].selected) {
359							strPostData += "&" + objForm.elements[i].name + "=";
360							strPostData += objForm.elements[i].options[intIndex].value;
361						};
362					break;
363
364				default:
365					strPostData += "&" + objForm.elements[i].id + "=";
366
367					// For Internationalization -- we must escape the element's value properly
368					var strPostValue = objForm.elements[i].value;
369					if (strPostValue) {
370						strPostValue = strPostValue.replace(/\%/g, "%25");
371						strPostValue = strPostValue.replace(/&/g, escape('&'));
372						strPostValue = strPostValue.replace(/\+/g, "%2B");
373					};
374					strPostData += strPostValue;
375					break;
376			};
377		};
378
379		var strUri = objForm.action;
380
381		var objRequest;
382		if (window.XMLHttpRequest) {
383			objRequest = new XMLHttpRequest();
384		} else if (typeof ActiveXObject != "undefined") {
385			objRequest = new ActiveXObject("Microsoft.XMLHTTP");
386		};
387
388		if (objRequest) {
389			objRequest.open("POST", strUri, true);
390			objRequest.setRequestHeader("Method", "POST " + strUri + " HTTP/1.1");
391			objRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
392			objRequest.setRequestHeader("X-Post-Nonce", get_new_guid());
393
394			objRequest.onreadystatechange = qcodo.handleAjaxResponse;
395			qcodo.ajaxRequest = objRequest;
396			objRequest.send(strPostData);
397		};
398	};
399};
400
401function getCookie(cname) {
402	var name = cname + "=";
403	var decodedCookie = decodeURIComponent(document.cookie);
404	var ca = decodedCookie.split(';');
405	for(var i = 0; i <ca.length; i++) {
406		var c = ca[i];
407		while (c.charAt(0) == ' ') {
408			c = c.substring(1);
409		}
410		if (c.indexOf(name) == 0) {
411			return c.substring(name.length, c.length);
412		}
413	}
414	return "";
415}
416
417function setCookie(cname, cvalue, exdays) {
418	var d = new Date();
419	d.setTime(d.getTime() + (exdays*24*60*60*1000));
420	var expires = "expires="+ d.toUTCString();
421	document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
422}
423
424function get_new_guid() {
425	function s4() {
426		return Math.floor((1 + Math.random()) * 0x10000)
427			.toString(16)
428			.substring(1);
429	}
430	return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
431}
432
433//////////////////
434// Qcodo Shortcuts
435//////////////////
436
437qc.pB = qcodo.postBack;
438qc.pA = qcodo.postAjax;

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.