PageSourceSearch

https://www.hawaiitours.com/wp-content/plugins/sumopaymentplans/as…/sumo-pp-single-product-page.js?ver=6.3

js hawaiitours.com collected 2026-09-24 11:13:00 UTC 5,853 bytes, 143 lines download raw bytes

1/* global sumo_pp_single_product_page */
2
3jQuery( function( $ ) {
4
5    if( typeof sumo_pp_single_product_page === 'undefined' ) {
6        return false ;
7    }
8
9    var is_blocked = function( $node ) {
10        return $node.is( '.processing' ) || $node.parents( '.processing' ).length ;
11    } ;
12
13    /**
14     * Block a node visually for processing.
15     *
16     * @param {JQuery Object} $node
17     */
18    var block = function( $node ) {
19        if( ! is_blocked( $node ) ) {
20            $node.addClass( 'processing' ).block( {
21                message : null ,
22                overlayCSS : {
23                    background : '#fff' ,
24                    opacity : 0.6
25                }
26            } ) ;
27        }
28    } ;
29
30    /**
31     * Unblock a node after processing is complete.
32     *
33     * @param {JQuery Object} $node
34     */
35    var unblock = function( $node ) {
36        $node.removeClass( 'processing' ).unblock() ;
37    } ;
38
39    var single_product = {
40        variationForm : $( '.variations_form' ) ,
41        depositForm : $( '#_sumo_pp_payment_type_fields' ) ,
42        bookingDepositForm : $( '._sumo_pp_wc_booking_deposit_fields' ) ,
43        /**
44         * Init single product
45         */
46        init : function() {
47
48            if( single_product.bookingDepositForm.length ) {
49                single_product.bookingDepositForm.insertBefore( '.single_add_to_cart_button' ) ;
50            }
51
52            $( document ).on( 'found_variation.wc-variation-form' , this.onFoundVariation ) ;
53            $( document ).on( 'reset_data' , this.onResetVariation ) ;
54            $( document ).on( 'change' , 'input[type=radio][name="_sumo_pp_payment_type"]' , this.togglePaymentType ) ;
55            $( document ).on( 'wc_booking_form_changed' , this.bookingFormChanged ) ;
56            $( document ).on( 'sumo_bookings_calculated_price' , this.bookingFormChanged ) ;
57            $( document ).on( 'yith_wcbk_form_update_response' , this.bookingFormChanged ) ;
58            $( document ).on( 'click' , 'div._sumo_pp_plan_view_more > p > a' , this.planInfoModal.show ) ;
59            $( document ).on( 'click' , 'div._sumo_pp_modal-close > img' , this.planInfoModal.hide ) ;
60        } ,
61        onFoundVariation : function( evt , variation ) {
62            single_product.onResetVariation() ;
63
64            if( variation.sumo_pp_deposit_form ) {
65                single_product.variationForm.find( '.woocommerce-variation-add-to-cart' ).before( variation.sumo_pp_deposit_form ) ;
66
67                if( 'yes' === sumo_pp_single_product_page.hide_product_price && 'payment-plans' === $( variation.sumo_pp_deposit_form ).find( 'input[type=radio][name="_sumo_pp_payment_type"]' ).val() ) {
68                    single_product.hideProductGetPrice() ;
69                } else {
70                    single_product.showProductGetPrice() ;
71                }
72            }
73        } ,
74        onResetVariation : function( evt , variation ) {
75            if( single_product.variationForm.find( '#_sumo_pp_payment_type_fields' ).length ) {
76                single_product.variationForm.find( '#_sumo_pp_payment_type_fields' ).remove() ;
77            }
78        } ,
79        togglePaymentType : function( evt ) {
80            $( 'div#_sumo_pp_plans_to_choose' ).slideUp( 'fast' ) ;
81            $( 'div#_sumo_pp_amount_to_choose' ).slideUp( 'fast' ) ;
82            single_product.showProductGetPrice() ;
83
84            switch( $( evt.currentTarget ).val() ) {
85                case 'payment-plans':
86                    $( 'div#_sumo_pp_plans_to_choose' ).slideDown( 'fast' ) ;
87
88                    if( 'yes' === sumo_pp_single_product_page.hide_product_price ) {
89                        single_product.hideProductGetPrice() ;
90                    }
91                    break ;
92                case 'pay-in-deposit':
93                    $( 'div#_sumo_pp_amount_to_choose' ).slideDown( 'fast' ) ;
94                    break ;
95            }
96        } ,
97        showProductGetPrice : function() {
98            $( 'div' ).find( 'p.price' ).slideDown( 'fast' ) ;
99            $( 'div.woocommerce-variation-price' ).find( 'span.price' ).slideDown( 'fast' ) ;
100        } ,
101        hideProductGetPrice : function() {
102            $( 'div' ).find( 'p.price' ).slideUp( 'fast' ) ;
103            $( 'div.woocommerce-variation-price' ).find( 'span.price' ).slideUp( 'fast' ) ;
104        } ,
105        bookingFormChanged : function() {
106
107            $.blockUI.defaults.overlayCSS.cursor = 'wait' ;
108            block( single_product.depositForm ) ;
109
110            $.ajax( {
111                type : 'POST' ,
112                url : sumo_pp_single_product_page.wp_ajax_url ,
113                data : {
114                    action : '_sumo_pp_get_wc_booking_deposit_fields' ,
115                    security : sumo_pp_single_product_page.get_wc_booking_deposit_fields_nonce ,
116                    product : sumo_pp_single_product_page.product ,
117                } ,
118                success : function( data ) {
119                    if( 'undefined' !== typeof data.result && 'success' === data.result ) {
120                        single_product.depositForm.remove() ;
121
122                        $( 'span#_sumo_pp_wc_booking_deposit_fields' ).html( data.html ) ;
123                        $( 'span#_sumo_pp_wc_booking_deposit_fields' ).insertBefore( '.single_add_to_cart_button' ) ;
124                    }
125                } ,
126                complete : function() {
127                    unblock( single_product.depositForm ) ;
128                }
129            } ) ;
130        } ,
131        planInfoModal : {
132            show : function( evt ) {
133                evt.preventDefault() ;
134                $( this ).closest( 'div' ).find( 'div._sumo_pp_modal' ).show() ;
135            } ,
136            hide : function() {
137                $( this ).closest( 'div._sumo_pp_modal' ).hide() ;
138            } ,
139        } ,
140    } ;
141
142    single_product.init() ;
143} ) ;

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.