PageSourceSearch

https://www.processwork.org/wp-content/plugins/eea-multi-event-reg…/multi_event_registration.js?ver=2.0.18.p

js processwork.org collected 2026-10-02 10:15:28 UTC 21,544 bytes, 740 lines download raw bytes

1var MER;
2jQuery( document ).ready( function( $ ) {
3
4	/**
5	 * @namespace MER
6	 * @type {{
7	 *     event_cart : object,
8	 *     form_input: object,
9	 *     form_data: object,
10	 *     response: object,
11	 *     display_debug: boolean,
12	 *     ticket_selector_iframe: boolean,
13	 * }}
14	 * @namespace eei18n
15	 * @type {{
16	 *     wp_debug: boolean,
17	 *     ajax_url: string,
18	 *     iframe_tickets_added: string,
19	 * }}
20	 * @namespace form_data
21	 * @type {{
22	 *     action: string,
23	 *     ticket: string,
24	 *     line_item: string,
25	 *     ee: string,
26	 *     cart_results: string,
27	 *     confirm_delete_state: string,
28	 * }}
29	 */
30
31
32	MER = {
33
34		/**
35		 * DOM element - main event cart container
36		 */
37		event_cart: {},
38
39		/**
40		 * DOM element - event cart text input field
41		 */
42		form_input: {},
43
44		/**
45		 * DOM element - AJAX notices container
46		 */
47		ajax_notices: {},
48
49		/**
50		 * array of form data
51		 * @namespace form_data
52		 * @type {{
53		 *     action: string,
54		 *     ticket: string,
55		 *     line_item: string,
56		 *     ee: string,
57		 *     cart_results: string,
58		 * }}
59		 */
60		form_data: {},
61
62		/**
63		 * AJAX response
64		 * @namespace response
65		 * @type {{
66		 *     errors: string,
67		 *     attention: string,
68		 *     success: string,
69		 *     new_html: object,
70		 *     tickets_added: boolean,
71		 *     btn_id: string,
72		 *     btn_txt: string,
73		 *     form_html: string,
74		 *     mini_cart: string,
75		 *     cart_results: string,
76		 *     redirect_url: string,
77		 * }}
78		 */
79		response: {},
80
81		/**
82		 * display debugging info in console?
83		 * @namespace display_debug
84		 * @type boolean
85		 */
86		display_debug: eei18n.wp_debug,
87
88		/**
89		 * is ticket selector in an iframe ?
90		 * @namespace ticket_selector_iframe
91		 * @type boolean
92		 */
93		ticket_selector_iframe: typeof eei18n.ticket_selector_iframe !== 'undefined'
94			? eei18n.ticket_selector_iframe
95			: false,
96
97		/**
98		 * the last submit button to be clicked
99		 * @namespace ticket_selector_submit_btn
100		 * @type Object
101		 */
102		ticket_selector_submit_btn: null,
103
104		/********** INITIAL SETUP **********/
105
106		/**
107		 * @function initialize
108		 */
109		initialize: function() {
110			MER.ajax_notices = $( '#espresso-ajax-notices' );
111			var event_cart = $( '#event-cart' );
112			if ( event_cart.length ) {
113				MER.event_cart = event_cart;
114				MER.set_listener_for_add_ticket_button();
115				MER.set_listener_for_remove_ticket_button();
116				MER.set_listener_for_delete_ticket_button();
117				MER.set_listener_for_update_event_cart_button();
118				MER.set_listener_for_empty_event_cart_link();
119			} else {
120				MER.set_listener_for_ticket_selector_submit_btn();
121			}
122			//alert( 'initialized !' );
123		},
124
125		/**
126		 *  @function set_listener_for_add_ticket_button
127		 */
128		set_listener_for_add_ticket_button: function() {
129			MER.event_cart.on( 'click',
130				'.event-cart-add-ticket-button',
131				function( event ) {
132					if ( ! $( this ).hasClass( 'disabled-event-cart-btn' ) &&
133						! $( this ).hasClass( 'js-disabled-event-cart-btn' )
134					) {
135						var urlParams = $( this ).eeGetParams();
136						MER.form_data = {};
137						MER.form_data.action = 'espresso_add_ticket_to_event_cart';
138						MER.form_data.ticket = typeof( urlParams.ticket ) !== 'undefined'
139							? urlParams.ticket
140							: '';
141						MER.form_data.line_item
142							= typeof( urlParams.line_item ) !== 'undefined'
143							? urlParams.line_item
144							: '';
145						MER.submit_ajax_request();
146					}
147					event.preventDefault();
148					event.stopPropagation();
149				}
150			);
151		},
152
153		/**
154		 *  @function set_listener_for_remove_ticket_button
155		 */
156		set_listener_for_remove_ticket_button: function() {
157			MER.event_cart.on( 'click',
158				'.event-cart-remove-ticket-button',
159				function( event ) {
160					event.preventDefault();
161					event.stopPropagation();
162					if ( ! $( this ).hasClass( 'disabled-event-cart-btn' ) &&
163						! $( this ).hasClass( 'js-disabled-event-cart-btn' )
164					) {
165						if ( ! MER.confirm_required_ticket_delete( $( this ) ) ) {
166							return;
167						}
168						var urlParams = $( this ).eeGetParams();
169						MER.form_data = {};
170						MER.form_data.action = 'espresso_remove_ticket_from_event_cart';
171						MER.form_data.ticket = typeof( urlParams.ticket ) !== 'undefined'
172							? urlParams.ticket
173							: '';
174						MER.form_data.line_item
175							= typeof( urlParams.line_item ) !== 'undefined'
176							? urlParams.line_item
177							: '';
178						MER.submit_ajax_request();
179					}
180				}
181			);
182		},
183
184		/**
185		 *  @function set_listener_for_delete_ticket_button
186		 */
187		set_listener_for_delete_ticket_button: function() {
188			MER.event_cart.on( 'click',
189				'.event-cart-delete-ticket-button',
190				function( event ) {
191					event.preventDefault();
192					event.stopPropagation();
193					if ( ! $( this ).hasClass( 'disabled-event-cart-btn' ) &&
194						! $( this ).hasClass( 'js-disabled-event-cart-btn' )
195					) {
196						if ( ! MER.confirm_required_ticket_delete( $( this ), true ) ) {
197							return;
198						}
199						var urlParams = $( this ).eeGetParams();
200						MER.form_data = {};
201						MER.form_data.action = 'espresso_delete_ticket_from_event_cart';
202						MER.form_data.ticket = typeof( urlParams.ticket ) !== 'undefined'
203							? urlParams.ticket
204							: '';
205						MER.form_data.line_item
206							= typeof( urlParams.line_item ) !== 'undefined'
207							? urlParams.line_item
208							: '';
209						MER.submit_ajax_request();
210					}
211				}
212			);
213		},
214
215		/**
216		 *  @function confirm_required_ticket_delete
217		 */
218		confirm_required_ticket_delete: function( $button, deleteAll ) {
219			deleteAll = typeof deleteAll !== 'undefined' ? deleteAll : false;
220			if ( $button.hasClass( 'required' ) ) {
221				// not deleting all, so need to check ticket qty
222				if ( deleteAll !== true ) {
223					var $target = $( '#' + $button.data( 'target' ) );
224					deleteAll = $target.length && parseInt( $target.val() ) === 1;
225				}
226				if ( deleteAll === true ) {
227					return confirm( eei18n.confirm_delete_state );
228				}
229			}
230			// proceed with deletion
231			return true;
232		},
233
234		/**
235		 *  @function set_listener_for_update_event_cart_link
236		 */
237		set_listener_for_update_event_cart_button: function() {
238			MER.event_cart.on( 'click',
239				'.event-cart-update-cart-lnk',
240				function( event ) {
241					if ( ! $( this ).hasClass( 'disabled-event-cart-btn' ) &&
242						! $( this ).hasClass( 'js-disabled-event-cart-btn' )
243					) {
244						//var serialized_form_data = $( MER.event_cart  ).find( 'form'
245						// ).serializeArray(); MER.form_data = MER.convert_to_JSON(
246						// serialized_form_data );
247						MER.form_data = MER.get_form_data( MER.event_cart, true );
248						//console.log( MER.form_data );
249						MER.form_data.action = 'espresso_update_event_cart';
250						MER.submit_ajax_request();
251					}
252					event.preventDefault();
253					event.stopPropagation();
254				}
255			);
256		},
257
258		/**
259		 *  @function set_listener_for_empty_event_cart_link
260		 */
261		set_listener_for_empty_event_cart_link: function() {
262			MER.event_cart.on( 'click',
263				'.event-cart-empty-cart-lnk',
264				function( event ) {
265					if ( ! $( this ).hasClass( 'disabled-event-cart-btn' ) &&
266						! $( this ).hasClass( 'js-disabled-event-cart-btn' )
267					) {
268						MER.form_data = {};
269						MER.form_data.action = 'espresso_empty_event_cart';
270						MER.submit_ajax_request();
271					}
272					event.preventDefault();
273					event.stopPropagation();
274				}
275			);
276		},
277
278		/**
279		 *  @function set_listener_for_ticket_selector_submit_btn
280		 */
281		set_listener_for_ticket_selector_submit_btn: function() {
282			$( document ).on( 'click', '.ticket-selector-submit-ajax',
283				function( event ) {
284					MER.ticket_selector_submit_btn = $( this );
285					MER.form_data = MER.get_form_data( $( this ), false );
286
287					// console.log(JSON.stringify('MER.form_data', null, 4));
288					// console.log( MER.form_data );
289					if ( typeof MER.form_data.ee === 'undefined' ) {
290						// alert('206) MER.form_data.ee = ' + MER.form_data.ee);
291						MER.form_data.ee = 'view_event_cart';
292						MER.form_data.event_cart = 'view';
293						// console.log(JSON.stringify('MER.form_data', null, 4));
294						// console.log(MER.form_data);
295					}
296
297					var ticket_count = 0;
298					if ( typeof MER.form_data[ 'tkt-slctr-event-id' ] !== 'undefined' &&
299						MER.form_data[ 'tkt-slctr-event-id' ] !== ''
300					) {
301						var tkt_slctr_qty = 'tkt-slctr-qty-';
302						tkt_slctr_qty += MER.form_data[ 'tkt-slctr-event-id' ];
303						tkt_slctr_qty += '[]';
304						//console.log( tkt_slctr_qty );
305						//console.log( MER.form_data[ tkt_slctr_qty ] );
306						if ( typeof MER.form_data[ tkt_slctr_qty ] !== 'undefined' &&
307							MER.form_data[ tkt_slctr_qty ] !== ''
308						) {
309							var ticket_quantities = MER.form_data[ tkt_slctr_qty ];
310							//console.log( 'ticket_quantities' );
311							//console.log( ticket_quantities );
312							if ( typeof ticket_quantities === 'object' ) {
313								$.each( ticket_quantities, function( index, ticket_quantity ) {
314									//console.log( 'ticket_quantity' );
315									//console.log( ticket_quantity );
316									ticket_count = ticket_count + parseInt( ticket_quantity );
317									//alert( 'ticket_quantity = ' + parseInt( ticket_quantity ) );
318								} );
319							} else {
320								ticket_count = parseInt( ticket_quantities );
321							}
322						}
323					}
324					ticket_count = parseInt( ticket_count );
325					//console.log( JSON.stringify( 'ticket_count: ' + ticket_count, null,
326					// 4 ) ); console.log( JSON.stringify( 'typeof ticket_count: ' + (
327					// typeof ticket_count ), null, 4 ) ); console.log( JSON.stringify(
328					// 'MER.form_data.event_cart: ' + MER.form_data.event_cart, null, 4 )
329					// ); var view_cart = MER.form_data.event_cart === 'view';
330					var view_cart = typeof MER.form_data.event_cart !== 'undefined' &&
331						MER.form_data.event_cart === 'view';
332					//console.log( JSON.stringify( 'view_cart: ' + view_cart, null, 4 )
333					// );
334					//console.log( JSON.stringify( 'MER.ticket_selector_iframe: ' +
335					// MER.ticket_selector_iframe, null, 4 ) ); alert(
336					// 'MER.form_data.event_cart = ' + MER.form_data.event_cart + '\n' +
337					// 'ticket_count = ' + ticket_count + '\n' + 'view_cart = ' +
338					// view_cart ); alert('( ticket_count !== 0 ) = ' + ( ticket_count
339					// !== 0 ) + '\n' + '( ticket_count === 0 && ! view_cart ) = ' + (
340					// ticket_count === 0 && !view_cart ) + '\n' + '! (
341					// MER.ticket_selector_iframe && view_cart ) = ' + !(
342					// MER.ticket_selector_iframe && view_cart ));
343					if ( ! ( MER.ticket_selector_iframe && view_cart ) ) {
344						MER.form_data.action = 'espresso_' + MER.form_data.ee;
345						MER.submit_ajax_request();
346						event.preventDefault();
347						event.stopPropagation();
348					}
349					// console.log( JSON.stringify( 'ticket_count: ' + ticket_count,
350					// null, 4 ) ); console.log( JSON.stringify( 'view_cart: ' +
351					// view_cart, null, 4 ) );
352				} );
353		},
354
355		/**
356		 *  @function close_modal
357		 *  @param {Object} event
358		 */
359		close_modal: function( event ) {
360			var cart_results_wrapper = $( '#cart-results-modal-wrap-dv' );
361			if ( cart_results_wrapper.length ) {
362				cart_results_wrapper.eeRemoveOverlay().hide();
363				event.preventDefault();
364				event.stopPropagation();
365				if( MER.ticket_selector_submit_btn !== null ) {
366					MER.ticket_selector_submit_btn.focus();
367					MER.ticket_selector_submit_btn = null;
368				}
369			}
370		},
371
372		/**
373		 *  @function close_modal_after_click
374		 */
375		close_modal_after_click: function( event ) {
376			MER.remove_listeners_for_modal();
377			MER.close_modal( event );
378		},
379
380		/**
381		 *  @function set_listener_for_close_modal_btn
382		 */
383		set_listener_for_close_modal_btn: function() {
384			$( document ).on(
385				'click',
386				'.close-modal-js',
387				MER.close_modal_after_click
388			);
389		},
390
391		/**
392		 *  @function close_modal_after_click
393		 */
394		close_modal_after_keyup: function( event ) {
395			if ( event.keyCode === 27 ) {
396				MER.remove_listeners_for_modal();
397				MER.close_modal( event );
398			}
399		},
400
401		/**
402		 *  @function set_listener_for_escape_modal
403		 */
404		set_listener_for_escape_modal: function() {
405			$( document ).on( 'keyup', MER.close_modal_after_keyup );
406		},
407
408		/**
409		 *  @function set_listener_for_escape_modal
410		 */
411		remove_listeners_for_modal: function() {
412			$( document ).unbind( 'click', MER.close_modal_after_keyup );
413			$( document ).unbind( 'keyup', MER.close_modal_after_keyup );
414		},
415
416		/**
417		 *  @function submit_promo_code
418		 */
419		submit_ajax_request: function() {
420			// console.log(JSON.stringify('MER.form_data', null, 4));
421			// console.log(MER.form_data);
422			// alert('276) MER.form_data (see console)');
423			// no form_data ?
424			if ( typeof MER.form_data.action === 'undefined' ||
425				MER.form_data.action === ''
426			) {
427				// MER.form_data.action = 'view_cart';
428				return;
429			}
430			MER.form_data.noheader = 1;
431			MER.form_data.ee_front_ajax = 1;
432			// send AJAX
433			$.ajax( {
434
435				type: 'POST',
436				url: eei18n.ajax_url,
437				data: MER.form_data,
438				dataType: 'json',
439
440				beforeSend: function() {
441					MER.do_before_sending_ajax();
442				},
443
444				success: function( response ) {
445					MER.response = response;
446					MER.process_response( MER.response );
447					MER.do_after_ajax();
448				},
449
450				error: function( response ) {
451					MER.response = response;
452					MER.response.error = eei18n.server_error;
453					MER.do_after_ajax();
454				},
455
456			} );
457
458		},
459
460		/**
461		 * @function do_before_sending_ajax
462		 */
463		do_before_sending_ajax: function() {
464			MER.disable_buttons();
465			$( '#espresso-ajax-long-loading' ).remove();
466			$( '#espresso-ajax-loading' ).show();
467		},
468
469		/**
470		 * @function do_after_ajax
471		 */
472		do_after_ajax: function() {
473			MER.enable_buttons();
474			$( '#espresso-ajax-loading' ).fadeOut( 'fast' );
475			MER.display_messages( MER.response );
476		},
477
478		/**
479		 * @function process_response
480		 */
481		process_response: function() {
482			//console.log( MER.response );
483			if ( typeof MER.response === 'object' ) {
484				if ( typeof MER.response.redirect_url !== 'undefined' &&
485					MER.response.redirect_url !== ''
486				) {
487					// redirect browser
488					window.location.replace( MER.response.redirect_url );
489					return;
490				}
491				if ( typeof MER.response.new_html !== 'undefined' ) {
492					MER.process_new_html();
493				}
494				if ( typeof MER.response.tickets_added !== 'undefined' &&
495					MER.response.tickets_added === true
496				) {
497					MER.process_tickets_added();
498				}
499				if ( typeof MER.response.mini_cart !== 'undefined' &&
500					MER.response.mini_cart !== ''
501				) {
502					MER.process_mini_cart();
503
504				}
505				if ( typeof MER.response.cart_results !== 'undefined' &&
506					MER.response.cart_results !== ''
507				) {
508					MER.process_cart_results();
509				}
510			}
511		},
512
513		/**
514		 *  @function process_new_html
515		 */
516		process_new_html: function() {
517			// loop thru tracked errors
518			$.each( MER.response.new_html, function( index, html ) {
519				//console.log( JSON.stringify( 'index: ' + index, null, 4 ) );
520				if ( typeof index !== 'undefined' && typeof html !== 'undefined' ) {
521					var event_cart_element = $( MER.event_cart ).find( index );
522					if ( event_cart_element.length ) {
523						event_cart_element.replaceWith( html );
524						$( MER.event_cart ).parent().eeScrollTo( 200 );
525						//console.log( JSON.stringify( 'html: ' + html, null, 4 ) );
526					}
527				}
528			} );
529		},
530
531		/**
532		 *  @function process_tickets_added
533		 */
534		process_tickets_added: function() {
535			var btn_id = typeof MER.response.btn_id !== 'undefined'
536				? MER.response.btn_id
537				: '';
538			var btn_txt = typeof MER.response.btn_txt !== 'undefined'
539				? MER.response.btn_txt
540				: '';
541			var form_html = typeof MER.response.form_html !== 'undefined'
542				? MER.response.form_html
543				: '';
544			var submit_button = $( btn_id );
545			if ( submit_button.length && btn_txt !== '' ) {
546				if ( submit_button.val() !== btn_txt ) {
547					submit_button.val( btn_txt );
548					var ticket_form = submit_button.parents( 'form:first' );
549					if ( ticket_form.length && form_html !== '' ) {
550						ticket_form.append( form_html );
551						//console.log( JSON.stringify( 'form_html: ' + form_html, null, 4 )
552						// );
553					}
554				}
555			}
556			$( '.ticket-selector-tbl-qty-slct' ).each( function() {
557				//console.log( JSON.stringify( 'ticket-selector-tbl-qty-slct id: ' + $(
558				// this ).attr( 'id' ), null, 4 ) );
559				if ( $( this ).find( 'option[value="0"]' ).length > 0 ) {
560					$( this ).val( 0 );
561				}
562				$( this ).prop( 'checked', false );
563			} );
564		},
565
566		/**
567		 *  @function process_mini_cart
568		 */
569		process_mini_cart: function() {
570			var mini_cart = $( '#ee-mini-cart-details' );
571			//console.log( mini_cart );
572			if ( mini_cart.length ) {
573				mini_cart.html( MER.response.mini_cart );
574				$( '#mini-cart-whats-next-buttons' ).fadeIn();
575			}
576		},
577
578		/**
579		 *  @function process_cart_results
580		 */
581		process_cart_results: function() {
582			var cart_results_wrapper = $( '#cart-results-modal-wrap-dv' );
583			//console.log( mini_cart );
584			if ( cart_results_wrapper.length ) {
585				cart_results_wrapper.html( MER.response.cart_results )
586					.eeCenter( 'fixed' )
587					.eeAddOverlay( 0.5 )
588					.show();
589				MER.add_modal_notices();
590				// now that modal is open, set listeners for closing it
591				MER.set_listener_for_close_modal_btn();
592				MER.set_listener_for_escape_modal();
593			} else if ( MER.ticket_selector_iframe ) {
594				MER.show_event_cart_ajax_msg( 'success',
595					eei18n.iframe_tickets_added,
596					6000
597				);
598			}
599
600		},
601
602		/**
603		 *  @function add_modal_notices
604		 */
605		add_modal_notices: function() {
606			var notices = '';
607			if ( typeof MER.response.attention !== 'undefined' && MER.response.attention ) {
608				notices += '<div class="espresso-ajax-modal-notices attention"><p>';
609				notices += MER.response.attention + '</p></div>';
610			} else if ( typeof MER.response.errors !== 'undefined' && MER.response.errors ) {
611				notices += '<div class="espresso-ajax-modal-notices errors"><p>';
612				notices += MER.response.errors + '</p></div>';
613			} else if ( typeof MER.response.success !== 'undefined' && MER.response.success ) {
614				notices += '<div class="espresso-ajax-modal-notices success"><p>';
615				notices += MER.response.success + '</p></div>';
616			}
617			if ( notices !== '' ) {
618				notices = '<div id="espresso-ajax-modal-notices-dv"' +
619					' style="display: block;">' + notices + '</div>';
620				var cart_results = $( '#cart-results-modal-dv' );
621				var notices_width = cart_results.innerWidth();
622				cart_results.append( notices );
623				$( '#espresso-ajax-modal-notices-dv' )
624					.css( { 'width': notices_width } )
625					.show();
626			}
627		},
628
629		/**
630		 *  @function get_form_data
631		 * @param  {object} form_container
632		 * @param  {boolean} form_within - whether the form should be looked for
633		 *   above or within the indicated DOM element
634		 */
635		get_form_data: function( form_container, form_within ) {
636			if ( form_container.length ) {
637				form_within = typeof form_within === 'boolean' ? form_within : false;
638				var serialized_form_data;
639				if ( form_within ) {
640					serialized_form_data = form_container.find( 'form' ).serializeArray();
641				} else {
642					serialized_form_data = form_container.parents( 'form:first' )
643						.serializeArray();
644				}
645				return MER.convert_to_JSON( serialized_form_data );
646			} else {
647				return {};
648			}
649		},
650
651		/**
652		 *  @function disable_buttons
653		 */
654		disable_buttons: function() {
655			$( '.event-cart-button' ).each( function() {
656				$( this ).addClass( 'js-disabled-event-cart-btn' );
657			} );
658		},
659
660		/**
661		 *  @function enable_buttons
662		 */
663		enable_buttons: function() {
664			$( '.event-cart-button' ).each( function() {
665				$( this ).removeClass( 'js-disabled-event-cart-btn' );
666			} );
667		},
668
669		/**
670		 * @function display messages
671		 * @param  {object} msg
672		 */
673		display_messages: function( msg ) {
674			if ( typeof msg.attention !== 'undefined' && msg.attention ) {
675				MER.show_event_cart_ajax_msg( 'attention', msg.attention, 18000 );
676			} else if ( typeof msg.errors !== 'undefined' && msg.errors ) {
677				MER.show_event_cart_ajax_msg( 'error', msg.errors, 12000 );
678			} else if ( typeof msg.success !== 'undefined' && msg.success ) {
679				MER.show_event_cart_ajax_msg( 'success', msg.success, 6000 );
680			}
681		},
682
683		/**
684		 * @function show event cart ajax msg
685		 * @param  {string} type
686		 * @param  {string} msg
687		 * @param  {number} fadeOut
688		 */
689		show_event_cart_ajax_msg: function( type, msg, fadeOut ) {
690			// does an actual message exist ?
691			if ( typeof msg !== 'undefined' && msg !== '' ) {
692				// ensure message type is set
693				/** @type {string} - whether an error or success */
694				var msg_type = typeof type !== 'undefined' && type !== ''
695					? type
696					: 'error';
697				// make sure fade out time is not too short
698				fadeOut = typeof fadeOut === 'undefined' || fadeOut < 4000
699					? 4000
700					: fadeOut;
701				// center notices on screen
702				MER.ajax_notices.eeCenter( 'fixed' );
703				/** @type {object} - target parent container */
704				var espresso_ajax_msg = $( '#espresso-ajax-notices-' + msg_type );
705				/** @type {object} - actual message container */
706				espresso_ajax_msg.children( '.espresso-notices-msg' ).html( msg );
707				// display message
708				espresso_ajax_msg.removeClass( 'hidden' )
709					.show()
710					.delay( fadeOut )
711					.fadeOut();
712			}
713		},
714
715		/**
716		 *  @function convert_to_JSON
717		 * @param  {string} serialized_array
718		 */
719		convert_to_JSON: function( serialized_array ) {
720			var json_object = {};
721			$.each( serialized_array, function() {
722				if ( json_object[ this.name ] ) {
723					if ( ! json_object[ this.name ].push ) {
724						json_object[ this.name ] = [ json_object[ this.name ] ];
725					}
726					json_object[ this.name ].push( this.value || '' );
727				} else {
728					json_object[ this.name ] = this.value || '';
729				}
730			} );
731			return json_object;
732		},
733
734
735	};
736
737	MER.initialize();
738
739} );
740

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.