PageSourceSearch

https://bbq-beergarden.jp/wp/wp-content/plugins/booking-package/js/Input.js?ver=1.6.95&date=1791319083

js bbq-beergarden.jp collected 2026-10-06 20:38:07 UTC 30,672 bytes, 1,185 lines download raw bytes

1/* globals Booking_Package_Elements */
2
3	function Booking_Package_Input(debug) {
4		
5		this._userInformation = {};
6		this._userEmail = null;
7		this._prefix = "";
8		
9		this._debug = null;
10		this._admin = false;
11        this._console = {};
12        this._console.log = console.log;
13        if (debug != null && typeof debug.getConsoleLog == 'function') {
14            
15            this._debug = debug;
16            this._console.log = debug.getConsoleLog();
17            
18        }
19        
20        this._element = new Booking_Package_Elements(debug);
21		
22	};
23	
24	Booking_Package_Input.prototype.setAdmin = function(admin) {
25		
26		this._admin = admin;
27		
28	};
29	
30	Booking_Package_Input.prototype.getAdmin = function() {
31		
32		return this._admin;
33		
34	};
35	
36	Booking_Package_Input.prototype.setUserInformation = function(userInformation){
37		
38		this._userInformation = userInformation;
39		
40	};
41	
42	Booking_Package_Input.prototype.setUserEmail = function(userEmail) {
43		
44		this._userEmail = userEmail;
45		
46	};
47	
48	Booking_Package_Input.prototype.setPrefix = function(prefix){
49		
50		this._prefix = prefix;
51		
52	};
53    
54    Booking_Package_Input.prototype.createInput = function(inputName, input, inputData, eventAction){
55		
56		var object = this;
57		object._console.log(input);
58		var userInformation = object._userInformation;
59		object._console.log(userInformation);
60		var list = null;
61		
62		if (typeof input.options == 'string' && input.options != null) {
63			
64			list = input.options.split(",");
65			
66		} else if (typeof input.options == 'object' && input.options != null) {
67			
68			list = input.options;
69			
70		}
71		
72		if (input.json != null) {
73			
74			list = input.values;
75			
76		}
77		
78		object._console.log(list);
79		var userValuePanel = object.create('div', null,null, object._prefix + "value_" + input.id, null, 'hidden_panel', null);
80		var valuePanel = object.create('div', null, [userValuePanel], null, null, null, null);
81		var inputId = object._prefix + "input_" + input.id;
82		var userValue = null;
83		if (userInformation[input['type']] != null && userInformation[input['type']][input['id']] != null && userInformation[input['type']][input['id']].value != null) {
84			
85			userValue = userInformation[input['type']][input['id']].value;
86			
87		} else {
88			
89			if (input.isEmail == 'true' && object._userEmail != null) {
90				
91				userValue = object._userEmail;
92				
93			}
94			
95		}
96		
97		if (typeof userValue == "string") {
98			
99			userValue = userValue.replace(/\\/g, "");
100			
101		}
102		
103		if (input.isAutocomplete == 'false') {
104			
105			userValue = null;
106			
107		}
108		
109		var valueList = input.value;
110		if (input['type'] == 'CHECK' || input['type'] == 'RADIO') {
111			
112			if (typeof input.value.split == 'function') {
113				
114				valueList = input.value.split(",");
115				
116			}
117			
118			if (userValue != null && typeof userValue.split == 'function') {
119				
120				valueList = userValue.split(",");
121				
122			} else if (userValue != null && typeof userValue == 'object') {
123				
124				valueList = userValue;
125				
126			}
127			
128			if (input.isTerms != null && input.isTerms == 'true' && object.getAdmin() === false) {
129				
130				valueList = [];
131				
132			}
133			object._console.log(valueList);
134			
135		}
136		
137		if (input['type'] == 'TEXT' || input['type'] == 'PASSWORD') {
138			
139			var textBox = object.createInputElement('input', 'text', null, input['value'], null, null, inputId, null, 'regular-text form_text', null);
140			object._console.log(typeof input.placeholder);
141			if (input.placeholder == null) {
142				
143				input.placeholder = '';
144				
145			}
146			
147			if ((typeof input.placeholder == 'string' || typeof input.placeholder == 'number') && String(input.placeholder).length > 0) {
148				
149				textBox.setAttribute('placeholder', input.placeholder);
150				//textBox.placeholder = String(input.placeholder);
151				
152			}
153			
154			if (inputData[inputName] != null && inputData[inputName].textBox != null) {
155				
156				textBox = inputData[inputName]["textBox"];
157				
158			}
159			
160			if (input.disabled != null && parseInt(input.disabled) === 1) {
161				
162				textBox.disabled = true;
163				
164			}
165			
166			if (eventAction != null) {
167				    
168				textBox.onchange = eventAction;
169				
170			}
171			
172			if (input['type'] == 'PASSWORD') {
173				
174				textBox.type = 'password';
175				textBox.value = '';
176				textBox.onchange = null;
177				
178			}
179			
180			if (userValue != null && userValue.length != 0) {
181				
182				textBox.value = userValue;
183				textBox.classList.add("hidden_panel");
184				valuePanel.setAttribute("data-edit", "1");
185				userValuePanel.classList.remove("hidden_panel");
186				userValuePanel.textContent = userValue;
187				if (input.isTerms != null && input.isTerms == 'true' && object.getAdmin() === false) {
188					
189					textBox.classList.remove("hidden_panel");
190					userValuePanel.classList.add("hidden_panel");
191					valuePanel.removeAttribute("data-edit");
192					
193				}
194				
195				textBox.onchange = function() {
196					
197					userValuePanel.textContent = textBox.value;
198					
199					
200				};
201				
202			}
203			
204			valuePanel.appendChild(textBox);
205			inputData[inputName] = {textBox: textBox};
206			
207		} else if (input['type'] == 'SELECT') {
208			
209			object._console.log(input.value);
210			var selectBox = object.createInputElement('select', null, null, null, null, null, inputId, null, 'form_select', null);
211			if (input.disabled != null && parseInt(input.disabled) === 1) {
212				
213				selectBox.disabled = true;
214				
215			}
216			
217			for (var key in list) {
218				
219				if (typeof list[key] == "string") {
220					
221					list[key] = list[key].replace(/\\/g, "");
222					
223				}
224				
225				var optionBox = object.createInputElement('option', null, null, list[key], list[key], null, null, null, null, {optionsKey: key} );
226				if (list[key] == input['value']) {
227					
228					object._console.log("value = " + input['value']);
229					optionBox.selected = true;
230					
231				}
232				/**
233				if (input.index != null && input.index == key) {
234					
235					optionBox.selected = true;
236					
237				}
238				**/
239				
240				if (userValue == list[key]) {
241					
242					optionBox.selected = true;
243					
244					selectBox.classList.add("hidden_panel");
245					valuePanel.setAttribute("data-edit", "1");
246					userValuePanel.classList.remove("hidden_panel");
247					userValuePanel.textContent = userValue;
248					if (input.isTerms != null && input.isTerms == 'true' && object.getAdmin() === false) {
249						
250						selectBox.classList.remove("hidden_panel");
251						userValuePanel.classList.add("hidden_panel");
252						valuePanel.removeAttribute("data-edit");
253						
254					}
255					
256					selectBox.onchange = function() {
257						
258						var index = selectBox.selectedIndex;
259						userValuePanel.textContent = selectBox.options[index].value;
260						
261					};
262					
263				}
264				
265				selectBox.appendChild(optionBox);
266				
267				
268			}
269			
270			if (userValue == null && inputData[inputName] != null && inputData[inputName].selectBox != null) {
271				
272				selectBox = inputData[inputName].selectBox;
273				
274			}
275			
276			if (eventAction != null) {
277				    
278		    	selectBox.onchange = eventAction;
279			    
280			}
281			
282			valuePanel.appendChild(selectBox);
283			inputData[inputName] = {selectBox: selectBox};
284			
285		} else if (input['type'] == 'CHECK') {
286			
287			if (inputData[inputName] == null) {
288				
289				inputData[inputName] = {};
290				
291			}
292			
293			valueList = JSON.parse(JSON.stringify(valueList));
294			var updatedValueList = [];
295			var checkBoxPanel = object.create('div', null, null, inputId, null, null, null);
296			valuePanel.appendChild(checkBoxPanel);
297			
298			for (var i = 0; i < list.length; i++) {
299				
300				if (typeof list[i] == "string") {
301					
302					list[i] = list[i].replace(/\\/g, list[i]);
303					
304				}
305				
306				var valueName = object.create('span', list[i], null, null, null, 'radio_title', null);
307				var checkBox = object.createInputElement('input', 'checkbox', inputName, list[i], null, null, null, null, 'form_checkbox', {value: i} );
308				checkBox.checked = false;
309				if (input.disabled != null && parseInt(input.disabled) === 1) {
310					
311					checkBox.disabled = true;
312					
313				}
314				
315				for (var a = 0; a < valueList.length; a++) {
316					
317					object._console.log(valueList[a]);
318					if (typeof valueList[a] == "string") {
319						
320						valueList[a] = valueList[a].replace(/\\/g, "");
321						
322					}
323					
324					if (valueList[a] == list[i]) {
325						
326						checkBox.checked = true;
327						
328					}
329					
330				}
331				
332				if (inputData[inputName] != null && inputData[inputName][i] != null) {
333				
334					checkBox = inputData[inputName][i];
335					updatedValueList.push( checkBox.value );
336					
337				}
338				
339				checkBox.onchange = function() {
340					
341					var checkValue = "";
342					for (var key in inputData[inputName]) {
343						
344						var checkBox = inputData[inputName][key];
345						if (checkBox.checked == true) {
346							
347							checkValue += checkBox.value + "<br />";
348							
349						}
350						
351					}
352					
353					userValuePanel.textContent = null;
354					userValuePanel.insertAdjacentHTML("beforeend", checkValue);
355					
356				};
357				
358				var label = object.create('label', null, [checkBox, valueName], null, null, null, null);
359				checkBoxPanel.appendChild(label);
360				inputData[inputName][i] = checkBox;
361				object._console.log(checkBox.checked);
362				if (input.isTerms != null && input.isTerms == 'true' && object.getAdmin() === false) {
363					
364					checkBox.checked = false;
365					
366				}
367				//checkBox.checked = false;
368				object._console.log(checkBox.checked);
369				
370			}
371			
372			if (userValue != null && userValue.length != 0) {
373				
374				if (updatedValueList.length > 0) {
375					
376					valueList = updatedValueList;
377					
378				}
379				object._console.log(valueList);
380				object._console.log(input);
381				var checkValue = "";
382				let hasUserOptions = false;
383				for (var i = 0; i < valueList.length; i++) {
384					
385					if (list.indexOf( valueList[i] ) !== -1) {
386						
387						hasUserOptions = true;
388						checkValue += valueList[i] + "<br />";
389						
390					}
391					
392				}
393				
394				if (hasUserOptions === true) {
395					
396					checkBoxPanel.classList.add("hidden_panel");
397					valuePanel.setAttribute("data-edit", "1");
398					userValuePanel.classList.remove("hidden_panel");
399					userValuePanel.insertAdjacentHTML("beforeend", checkValue);
400					if (input.isTerms != null && input.isTerms == 'true' && object.getAdmin() === false) {
401						
402						checkBoxPanel.classList.remove("hidden_panel");
403						userValuePanel.classList.add("hidden_panel");
404						valuePanel.removeAttribute("data-edit");
405						for (var i in inputData[inputName]) {
406							
407							object._console.log(inputData[inputName][i]);
408							inputData[inputName][i].checked = "";
409							
410						}
411						
412					}
413					
414				}
415				
416				/**
417				checkBoxPanel.classList.add("hidden_panel");
418				valuePanel.setAttribute("data-edit", "1");
419				var checkValue = "";
420				for (var i = 0; i < valueList.length; i++) {
421					
422					checkValue += valueList[i] + "<br />";
423					
424				}
425				
426				userValuePanel.classList.remove("hidden_panel");
427				userValuePanel.insertAdjacentHTML("beforeend", checkValue);
428				if (input.isTerms != null && input.isTerms == 'true' && object.getAdmin() === false) {
429					
430					checkBoxPanel.classList.remove("hidden_panel");
431					userValuePanel.classList.add("hidden_panel");
432					valuePanel.removeAttribute("data-edit");
433					for (var i in inputData[inputName]) {
434						
435						object._console.log(inputData[inputName][i]);
436						inputData[inputName][i].checked = "";
437						
438					}
439					
440				}
441				**/
442			}
443			
444		} else if (input['type'] == 'RADIO') {
445			
446			if (inputData[inputName] == null) {
447				
448				inputData[inputName] = {};
449				
450			}
451			
452			if (typeof input['value'] == "string") {
453				
454				input['value'] = input['value'].replace(/\\/g, "");
455				
456			}
457			
458			var radioBoxPanel = object.create('div', null, null, inputId, null, null, null);
459			valuePanel.appendChild(radioBoxPanel);
460			
461			for (var i = 0; i < list.length; i++) {
462			//for(var key in list){
463				
464				object._console.log(i + " = " + list[i]);
465				if (typeof list[i] == "string") {
466					
467					list[i] = list[i].replace(/\\/g, "");
468					
469				}
470				var valueName = object.create('span', list[i], null, null, null, 'radio_title', null);
471				var radioBox = object.createInputElement('input', 'radio', inputName, list[i], null, null, null, null, 'form_radio', {value: i} );
472				if (i == 0) {
473					
474					radioBox.checked = "checked";
475					
476				}
477				
478				if (input['value'] == list[i]) {
479					
480					object._console.log("value = " + input['value']);
481					radioBox.checked = "checked";
482					
483				}
484				
485				if (userValue == list[i]) {
486					
487					radioBox.checked = "checked";
488					
489				}
490				
491				if (inputData[inputName] != null && inputData[inputName][i] != null) {
492				
493					radioBox = inputData[inputName][i];
494					
495				}
496				
497				radioBox.onchange = function(){
498					
499					var radioBox = this;
500					userValuePanel.textContent = radioBox.value;
501					if (typeof eventAction == 'function') {
502						
503						eventAction(this);
504						
505					}
506					
507				};
508				
509				var label = object.create('label', null, [radioBox, valueName], null, null, null, null);
510				radioBoxPanel.appendChild(label);
511				inputData[inputName][i] = radioBox;
512				
513			}
514			
515			if (userValue != null && userValue.length != 0) {
516				
517				var checkValue = "";
518				let hasUserOptions = false;
519				for (var i = 0; i < valueList.length; i++) {
520					
521					if (list.indexOf( valueList[i] ) !== -1) {
522						
523						hasUserOptions = true;
524						checkValue += valueList[i] + "<br />";
525						
526					}
527					
528				}
529				
530				if (hasUserOptions === true) {
531					
532					radioBoxPanel.classList.add("hidden_panel");
533					valuePanel.setAttribute("data-edit", "1");
534					userValuePanel.classList.remove("hidden_panel");
535					userValuePanel.insertAdjacentHTML("beforeend", checkValue);
536					if (input.isTerms != null && input.isTerms == 'true' && object.getAdmin() === false) {
537						
538						radioBoxPanel.classList.remove("hidden_panel");
539						userValuePanel.classList.add("hidden_panel");
540						valuePanel.removeAttribute("data-edit");
541						
542					}
543					
544				}
545				/**
546				radioBoxPanel.classList.add("hidden_panel");
547				valuePanel.setAttribute("data-edit", "1");
548				userValuePanel.classList.remove("hidden_panel");
549				userValuePanel.textContent = userValue;
550				if (input.isTerms != null && input.isTerms == 'true' && object.getAdmin() === false) {
551					
552					radioBoxPanel.classList.remove("hidden_panel");
553					userValuePanel.classList.add("hidden_panel");
554					valuePanel.removeAttribute("data-edit");
555					
556				}
557				**/
558				
559			}
560			
561		} else if(input['type'] == 'TEXTAREA') {
562			
563			var testareaBox = object.create('textarea', null, null, inputId, null, 'form_textarea', null);
564			if (inputData[inputName] != null && inputData[inputName].textBox != null) {
565				
566				testareaBox = inputData[inputName].textBox;
567				
568			}
569			
570			object._console.log(typeof input.placeholder);
571			if (typeof input.placeholder == 'string' && input.placeholder.length > 0) {
572				
573				testareaBox.setAttribute('placeholder', input.placeholder);
574				
575			}
576			
577			if (valueList != null) {
578				
579				
580				
581			}
582			
583			if (input.value != null && (typeof input.value == 'string' || typeof input.value == 'number')) {
584				
585				testareaBox.textContent = input.value;
586				
587			}
588			
589			valuePanel.appendChild(testareaBox);
590			inputData[inputName] = {textBox: testareaBox};
591			
592		}
593		
594		if (input.description != null) {
595			
596			var description = object.create('div', input.description.replace(/\\/g, ""), null, null, null, 'description', null);
597			valuePanel.appendChild(description);
598			
599		}
600		
601		return valuePanel;
602		
603	};
604	
605	Booking_Package_Input.prototype.checkEmailAddress = function(email) {
606		
607		if (email.length == 0) {
608			
609			return true;
610			
611		}
612		
613		if (email.match(/.+@.+\..+/) == null) {
614			
615			return false;
616			
617		} else {
618			
619			return true;
620			
621		}
622		
623	};
624    
625    Booking_Package_Input.prototype.inputCheck = function(keyName, input, inputBox, valueList, requestPage){
626		
627		var object = this;
628		var array = [];
629		var bool = false;
630		for(var key in inputBox){
631			
632			object._console.log(inputBox[key]);
633			var inputBool = false;
634			if (
635				parseInt(input['inputLimit']) == 0 || 
636				parseInt(input['inputLimit']) == 1 || 
637				parseInt(input['inputLimit']) == 2 || 
638				input['required'] != null
639			) {
640				
641				inputBool = true;
642				if (parseInt(input['inputLimit']) == 2 || input['required'] == 'false') {
643					
644					inputBool = false;
645					
646				}
647				
648				if (requestPage == 'dashboard' && input.required == 'true_frontEnd') {
649					
650					inputBool = false;
651					
652				}
653				
654				object._console.log("inputBool = " + inputBool);
655				if (input['inputType'] == 'TEXT' || input['type'] == 'TEXT') {
656					
657					object._console.log(input);
658					var text = inputBox[key].value.replace(/\s+/g, "");
659					if (text.length != 0 && inputBool == true) {
660						
661						array.push(inputBox[key].value);
662						bool = true;
663						
664					} else if (inputBool == false){
665						
666						array.push(inputBox[key].value);
667						bool = true;
668						
669					}
670					
671					if (input['isEmail'] == 'true') {
672						
673						bool = this.checkEmailAddress(text);
674						if (bool === true && inputBool === true && text.length == 0) {
675							
676							bool = false;
677							
678						}
679						
680					}
681					
682				} else if (input['inputType'] == 'SELECT' || input['type'] == 'SELECT' || input['inputType'] == 'SELECT_GROUP' || input['inputType'] == 'SELECT_TIMEZONE') {
683					
684					object._console.log(input['inputType']);
685					var selectKey = inputBox[key].selectedIndex;
686					object._console.log("selectKey = " + selectKey);
687					if (selectKey >= 0) {
688						
689						if (selectKey != null && inputBool == true) {
690							
691							array.push(inputBox[key].options[selectKey].value);
692							bool = true;
693							
694						} else if (selectKey != null && inputBool == false) {
695							
696							array.push(inputBox[key].options[selectKey].value);
697							bool = true;
698							
699						}
700						
701					} else {
702						
703						bool = true;
704						
705					}
706					
707				} else if (input['inputType'] == 'CHECK' || input['type'] == 'CHECK') {
708					
709					var value = null;
710					if (inputBox[key].checked == true && inputBool == true) {
711						
712						value = inputBox[key].value;
713						array.push(inputBox[key].value);
714						bool = true;
715						
716					} else if(inputBool == false) {
717						
718						if (inputBox[key].checked == true) {
719							
720							value = inputBox[key].value;
721							array.push(inputBox[key].value);
722							
723						}
724						bool = true;
725						
726					}
727					
728					if (value != null && input['valueList'] != null) {
729						
730						array = [];
731						object._console.log("value = " + value);
732						for(var valueKey in input['valueList']){
733							
734							if (input['valueList'][valueKey] == value) {
735								
736								array.push(valueKey);
737								break;
738								
739							}
740							
741						}
742						
743						object._console.log(valueKey);
744						
745					}
746					
747			    } else if (input['inputType'] == 'RADIO' || input['type'] == 'RADIO') {
748					
749					var value = null;
750					object._console.log(inputBox[key].checked);
751					if (inputBox[key].checked == true && inputBool == true) {
752						
753						value = inputBox[key].value;
754						array.push(inputBox[key].value);
755						bool = true;
756						
757					} else if (inputBool == false) {
758						
759						if (inputBox[key].checked == true) {
760							value = inputBox[key].value;
761							array.push(inputBox[key].value);
762						}
763						bool = true;
764						
765					}
766					
767					if (value != null && input['valueList'] != null) {
768						
769						array = [];
770						object._console.log("value = " + value);
771						for(var valueKey in input['valueList']){
772							
773							if (input['valueList'][valueKey] == value) {
774								
775								array.push(valueKey);
776								break;
777								
778							}
779							
780						}
781						
782						object._console.log(valueKey);
783						
784					}
785					
786			    } else if (input['inputType'] == 'TEXTAREA' || input['type'] == 'TEXTAREA') {
787				    
788				    if (inputBox[key].value.length != 0 && inputBool == true) {
789					    
790					    array.push(inputBox[key].value);
791					    bool = true;
792					    
793				    } else if(inputBool == false) {
794					    
795					    array.push(inputBox[key].value);
796					    bool = true;
797					    
798				    }
799				    
800			    }
801			    
802		    }
803		    
804		    if (bool == true) {
805			    
806			    valueList[keyName] = array;
807			    if (input['inputType'] == 'CHECK' || input['type'] == 'CHECK') {
808			    	
809			    	valueList[keyName] = JSON.stringify(array);
810			    	
811			    }
812			    
813		    } else {
814				
815				valueList[keyName] = [];
816				
817			}
818			
819		}
820		
821		return bool;
822		
823    };
824	
825	
826	Booking_Package_Input.prototype.getUserFieldValue = function (inputFormat, elements) {
827		
828		var object = this;
829		var values = null;
830		object._console.log(inputFormat);
831		object._console.log(elements);
832		if (inputFormat.type === 'TEXT' || inputFormat.type === 'TEXTAREA' || inputFormat.type === 'PASSWORD') {
833			
834			values = elements['textBox'].value.trim();
835			
836			
837		} else if (inputFormat.type === 'CHECK') {
838			
839			values = (function (inputElements) {
840				
841				const values = [];
842				for (var key in elements) {
843					
844					if (elements[key].checked === true) {
845						
846						//values.push(elements[key].getAttribute("data-value"));
847						values.push(elements[key].value);
848						
849					}
850					
851				}
852				
853				return values;
854				
855			})(elements);
856			
857		} else if (inputFormat.type === 'RADIO') {
858			
859			values = (function (elements) {
860				
861				const values = [];
862				for (var key in elements) {
863					
864					if (elements[key].checked === true) {
865						
866						//values.push(elements[key].getAttribute("data-value"));
867						values.push(elements[key].value);
868						
869					}
870					
871				}
872				
873				return values;
874				
875			})(elements);
876			
877		} else if (inputFormat.type === 'SELECT') {
878			
879			var inputObject = elements['selectBox'];
880			var index = inputObject.selectedIndex;
881			if (inputObject.options[index] != null) {
882				
883				values = inputObject.options[index].value;
884				
885			}
886			
887		} else if (inputFormat.type === 'OPTION') {
888			
889			values = (function (elements) {
890				
891				const values = [];
892				for (var key in elements) {
893					
894					if (elements[key].value != null && elements[key].value.trim().length !== 0) {
895						
896						values.push(elements[key].value.trim());
897						
898					}
899					
900				}
901				
902				return values;
903				
904			})(elements);
905			
906		}
907		
908		return values;
909		
910	}
911	
912	Booking_Package_Input.prototype.changeValueForUserFormFields = function(formFields, userProfile) {
913		
914		for (let i = 0; i < formFields.length; i++) {
915	        
916	        const filed = formFields[i];
917	        if (filed.type === 'SELECT') {
918	            
919	            const options = filed.options;
920	            if (userProfile[filed.type] != null && userProfile[filed.type][filed.id] != null) {
921	                
922	                userProfile[filed.type][filed.id].value = options[parseInt(userProfile[filed.type][filed.id].value)];
923	                
924	            }
925	            
926	            
927	        } else if (filed.type === 'CHECK' || filed.type === 'RADIO') {
928	            
929	            if (userProfile[filed.type] != null && userProfile[filed.type][filed.id] != null) {
930	                
931	                userProfile[filed.type][filed.id].value = (function(options, value) {
932	                    
933	                    let values = [];
934	                    for (let i = 0; i < value.length; i++) {
935	                        
936	                        values.push(options[parseInt(value[i])]);
937	                        
938	                        
939	                    }
940	                    
941	                    return values;
942	                    
943	                })(filed.options, userProfile[filed.type][filed.id].value);
944	                
945	            }
946	            
947	        }
948	        
949	        
950	    }
951	    
952    	return userProfile;
953		
954	}
955	
956    Booking_Package_Input.prototype.validateInputValues = function(formFields, inputData) {
957    	
958    	const object = this;
959    	let scrollIntoView = true;
960    	let response = {updata: true, error: [], customUserFields: { 'TEXT': {}, 'SELECT': {}, 'CHECK': {}, 'RADIO': {}, 'TEXTAREA': {} } };
961        for (var i = 0; i < formFields.length; i++) {
962            
963            const field = formFields[i];
964            const elements = inputData['customFormField_' + field.id];
965            if (typeof elements === 'object') {
966            	
967                object._console.log(field.id);
968                object._console.log(elements);
969                const tr = document.getElementById('tr_input_field_' + field.id);
970                tr.classList.remove('error_empty_value');
971                
972                let values = null;
973                if (field.type === 'PASSWORD') {
974                	
975                	continue;
976                	
977                } else if (field.type === 'TEXT' || field.type === 'TEXTAREA') {
978                	
979                	values = elements.textBox.value;
980                	response.customUserFields[field.type][field.id] = {id: field.id, value: values};
981                	
982                } else if (field.type === 'SELECT') {
983                	
984                	const inputObject = elements['selectBox'];
985					values = inputObject.selectedIndex;
986					response.customUserFields[field.type][field.id] = {id: field.id, value: values};
987                	
988                } else if (field.type === 'CHECK' || field.type === 'RADIO') {
989					
990					values = (function(elements) {
991						
992						let values = [];
993						for (let i in elements) {
994							
995							if (elements[i].checked === true) {
996								
997								values.push(parseInt(i));
998								
999							}
1000							
1001						}
1002						
1003						return values;
1004						
1005					})(elements);
1006					response.customUserFields[field.type][field.id] = {id: field.id, value: values};
1007
1008                }
1009                
1010                /**
1011                let values = object.getUserFieldValue(field, elements);
1012                if (field.type !== 'PASSWORD') {
1013                	
1014                	response.customUserFields[field.type][field.id] = {id: field.id, value: values};
1015                	
1016                } else if (field.type === 'CHECK' || field.type === 'RADIO') {
1017                	
1018                	values = (function(indexes, options) {
1019                        
1020                        let values = [];
1021                        for (var i = 0; i < indexes.length; i++) {
1022                            
1023                            values.push(options[ indexes[i] ]);
1024                            
1025                        }
1026                        
1027                        return values;
1028                        
1029                    })(values, field.options);
1030                    response.customUserFields[field.type][field.id] = {id: field.id, value: values};
1031                	
1032                }
1033                **/
1034                
1035                if (field.required === 'true' && values.length === 0) {
1036                    
1037                    response.error.push(field.id);
1038					tr.classList.add('error_empty_value');
1039                    response.updata = false;
1040                    if (scrollIntoView === true) {
1041                    	
1042                    	tr.scrollIntoView();
1043                    	scrollIntoView = false;
1044                    	
1045                    }
1046                    
1047                }
1048                
1049                
1050                
1051            }
1052            
1053        }
1054        
1055        //console.log(response.customUserFields);
1056        
1057        return response;
1058    	
1059    };
1060    
1061    Booking_Package_Input.prototype.createUserProfiledPanel = function(formFields, userProfile, inputData, elementName, defaultName) {
1062		
1063		let parentElementName = 'table';
1064		let trElementName = 'tr';
1065		let thElementName = 'th';
1066		let tdElementName = 'td';
1067		if (elementName === 'div') {
1068			
1069			parentElementName = 'div';
1070			trElementName = 'div';
1071			thElementName = 'div';
1072			tdElementName = 'div';
1073			
1074		}
1075		
1076		
1077		const object = this;
1078		const table = object.create(parentElementName, null, null, null, null, 'wp-list-table widefat', null);
1079		for (var key in formFields) {
1080			
1081			const id = formFields[key].id;
1082			const field = formFields[key];
1083			if (defaultName.hasOwnProperty(id) === false && field.active === 'true') {
1084				
1085				object._console.log(id);
1086				object._console.log(field);
1087				if (typeof userProfile[field.type] !== 'undefined' && typeof userProfile[field.type][field.id] !== 'undefined') {
1088					
1089					field.value = userProfile[field.type][field.id].value;
1090					
1091				}
1092				
1093				if (field.type === 'CHECK' || field.type === 'RADIO') {
1094					
1095					field.value = (function(field) {
1096						
1097						const values = [];
1098						for (var i = 0; i < field.value.length; i++) {
1099							
1100							let key = field.options.indexOf( field.value[i] );
1101							if (key !== -1) {
1102								
1103								values.push(field.options[key]);
1104								
1105							}
1106							/**
1107							const key = parseInt( field.value[i] );
1108							console.error(key);
1109							if (field.options.hasOwnProperty(key) === true) {
1110								
1111								values.push(field.options[key]);
1112								
1113							}
1114							**/
1115							
1116						}
1117						
1118						return values;
1119						
1120					})(field);
1121					
1122				}
1123				
1124				const inputElement = object.createInput('customFormField_' + field.id, field, inputData, null);
1125				object._console.log(inputElement);
1126				var th = document.createElement(thElementName);
1127				th.textContent = field.name;
1128				if (field.required === 'true') {
1129					
1130					th.classList.add('required');
1131					
1132				}
1133				var td = object.create(tdElementName, null, [inputElement], null, null, null, null);
1134				var tr = object.create(trElementName, null, [th, td], 'tr_input_field_' + field.id, null, null, null);
1135				tr.setAttribute("valign", "top");
1136				if (elementName === 'div') {
1137					
1138					tr.classList.add('row');
1139					th.classList.add('name');
1140					td.classList.add('value');
1141					
1142				}
1143				
1144				
1145				table.appendChild(tr);
1146				
1147			}
1148			
1149			
1150		}
1151		
1152		
1153		return table;
1154		
1155    }
1156    
1157    Booking_Package_Input.prototype.create = function(elementType, text, childElements, id, style, className, data_x) {
1158        
1159        var panel = this._element.create(elementType, text, childElements, id, style, className, data_x);
1160        return panel;
1161        
1162    };
1163    
1164    Booking_Package_Input.prototype.createButtonPanel = function(id, style, className, buttons) {
1165        
1166        var buttonPanel = this._element.createButtonPanel(id, style, className, buttons);
1167        return buttonPanel;
1168        
1169    };
1170    
1171    Booking_Package_Input.prototype.createButton = function(id, style, className, data_x, text) {
1172        
1173        var button = this._element.createButton(id, style, className, data_x, text);
1174        return button;
1175        
1176    };
1177    
1178    Booking_Package_Input.prototype.createInputElement = function(tagName, type, name, value, text, disabled, id, style, className, data_x) {
1179        
1180        var input = this._element.createInputElement(tagName, type, name, value, text, disabled, id, style, className, data_x);
1181        return input;
1182        
1183    };
1184    
1185    

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.