PageSourceSearch

https://newellijay.tv/wp-content/plugins/whols/assets/js/whols.js?ver=2.4.12

js newellijay.tv collected 2026-09-25 03:01:21 UTC 4,986 bytes, 154 lines download raw bytes

1/*
2 * JS for both frontend and backend.
3 */
4
5;( function ( $ ) {
6    'use strict';
7
8    if ( typeof whols_params === 'undefined' ) {
9		return false;
10	}
11
12    const whols = {
13        selectors: {    
14            sendButton: '.whols-message-box button',
15            modalForm: '.whols-raq-form',
16            loadingIcon: '<i class="dashicons dashicons-update"></i>',
17            modalFormSubmit: '.whols-raq-modal button[type="submit"]',
18            modalFormMessage: '.whols-raq-modal .whols-raq-form-message',
19        },
20        conversationID: '',
21        sendarType: '',
22
23        init: function() {
24            $( document ).on( 'click', '.whols-request-a-quote,.whols-start-conversation', this.openModalAjax );
25            $( document ).on( 'submit', whols.selectors.modalForm, this.submitRequestQuoteForm );
26
27            $( document ).on( 'click', '.whols-raq-modal-dismiss', whols.dismissModal );
28        },
29
30        submitRequestQuoteForm: function( e ) {
31			e.preventDefault();
32		
33			const $form = $( this );
34
35            const $button = $( whols.selectors.modalFormSubmit );
36            const postedData = whols.getFormDataAfterSubmit( $form );
37            
38            $.ajax({
39                type: 'POST',
40                dataType: 'json',
41                url:  whols_params.ajax_url,
42                data: {
43                    action: "whols_request_raq_form_submit",
44                    nonce: whols_params.nonce,
45                    fields: postedData,
46                    location: $(whols.selectors.modalFormSubmit).data('location'),
47                },
48                beforeSend: function(){
49                    whols.showLoadingButton( $button );
50                },
51                success: function( response ){
52                    if( response.success ){
53                        whols.displayMessage( response.data.message, 'success' );
54                        $( whols.selectors.modalForm ).trigger( 'reset' );
55                    } else {
56                        whols.displayMessage(response.data.message, 'error');
57                    }
58                },
59                complete:function( response ){
60                    whols.hideLoadingButton( $button );
61                },
62                error: function (jqXHR, textStatus, errorThrown) {
63                    var errorMessage = "An error occurred during the AJAX request.";
64
65                    if (jqXHR.responseJSON && jqXHR.responseJSON.message) {
66                        errorMessage = jqXHR.responseJSON.message;
67                    } else if (textStatus === "timeout") {
68                        errorMessage = "The request timed out. Please try again.";
69                    } else if (textStatus === "abort") {
70                        errorMessage = "The request was aborted. Please try again.";
71                    }
72
73                    whols.displayMessage(errorMessage, 'error');
74					console.log( 'error', errorThrown );
75                },
76            });
77		},
78
79        getFormDataAfterSubmit: function( $form ){
80            const postedData = {};
81			const formData = new FormData($form[0]);
82			[...formData.entries()].forEach(([key, value]) => {
83				postedData[key] = value;
84			});
85
86            return postedData;
87        },
88
89		openModalAjax: function( e ) {
90			e.preventDefault();
91
92            const location = $(e.target).data('location');
93            const target = $(e.target);
94            
95			$.ajax({
96				url: whols_params.ajax_url,
97				type: 'POST',
98				data: {
99					action: 'whols_open_raq_modal',
100					nonce: whols_params.nonce,
101                    fields: {
102                        location: location
103                    }
104				},
105				beforeSend: function() {
106					whols.showLoadingButton( target );
107				},
108				success: function( response ) {
109					if( response.success && response.data.modal_content ){
110						$('body').append( $(response.data.modal_content) );
111					} else {
112						console.log( 'error', response );
113					}
114				},
115				complete: function() {
116					whols.hideLoadingButton( target );
117				},
118				error: function( response ) {
119					console.log( 'error', response );
120				}
121			});
122
123			$('body').addClass('whols-raq-modal-open');
124		},
125
126        showLoadingButton: function( $button ){
127            $button.append( whols.selectors.loadingIcon );
128        },
129
130        hideLoadingButton: function( $button ){
131            $button.find('.dashicons-update').remove();
132        },
133
134        displayMessage: function( message, type ){
135            let noticeClass = 'woocommerce-message';
136            if( type == 'error' ){
137                noticeClass = 'woocommerce-error'
138            }
139
140            $( whols.selectors.modalFormMessage ).html('<div class="woocommerce"><div class="woocommerce-notices-wrapper"><div class=" '+ noticeClass +' " role="alert">'+ message +'</div></div></div>');
141        },
142
143        dismissModal: function( e ) {
144			e.preventDefault();
145
146			$('.whols-raq-modal').remove();
147		},
148
149    }
150
151    $(document).ready(function(){
152        whols.init();
153    });
154} )( jQuery );

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.