PageSourceSearch

https://carmeldirect.com/wp-content/plugins/woo-shipping-mod-plugin/script.js?ver=1.0.254

js carmeldirect.com collected 2026-10-08 06:06:17 UTC 8,295 bytes, 185 lines download raw bytes

1jQuery(document).ready(function($){
2    let checkbox_interval
3    $(document).on('click','.shipping_method_extra_fee',function(){
4        clearInterval(checkbox_interval)
5        let remove = $(this).is(':checked') ? "no" : "yes"
6        let stair_fee = $(this).val()
7        let id = $(this).attr('id')
8        // let label = "$('.shipping_method_extra_fee:checked').closest('label').find('span').html().split('(')[0]"
9        let label = $(this).attr('data-label')
10        let shipping_method = $(this).attr('data-shipping-method')
11        let dataset = {
12            name: label,
13            amount: stair_fee,
14            id, shipping_method, remove
15        }
16        console.log('dataset',dataset)
17        $.ajax({
18            url: wspl.ajax_url,
19            type: 'POST',
20            dataType: "json",
21            data: {
22                action: 'get_shipping_method_price',
23                dataset
24            },
25            success:function(resp){
26                console.log('resp',resp)
27                if( resp.status && resp.status == 'success' ) {
28                    $( document.body ).trigger('update_checkout')
29                    // window.location.reload()
30                }
31            },
32            error:function(err){
33                console.log('err',err)
34            }
35        })
36    })
37    $( document.body ).on('updated_checkout',function(e){
38   clearTimeout(checkbox_interval);
39
40checkbox_interval = setTimeout(() => {
41    $.each($('.fee th'), (k, v) => {
42        let text = $(v).html();
43
44        if (text == wspl.stair_label) {
45            $('input[id^="custom_stair_fee_"]').prop('checked', true);
46        }
47
48        if (text == wspl.distant_label) {
49            $('input[id^="custom_distance_location_fee_"]').prop('checked', true);
50        }
51    });
52}, 300);
53        let shipping_method = $('#shipping_method li input[type="radio"]:checked')
54        let shipping_method_val = shipping_method.val()
55        if( $('.wspl_checkbox_holder').length == 0 ) {
56            // console.log('checkout event', e)
57            let shipping_method_id = shipping_method_val.split(':')[1]
58            let method_label = shipping_method.siblings('label')
59            $.each($('#shipping_method .checkbox_holder'),(k,v) => {
60                $(v).remove()
61            })
62            console.log('shipping_method_id',shipping_method_id)
63            let actions = wspl.wcs_actions
64            for (let i = 0; i < actions.length; i++) {
65                const action = actions[i]
66                let stair_fee = action.stair_fee
67                let distance_location_fee = action.distant_location_fee
68                let ids = action.shipping_method_ids
69                for (let j = 0; j < ids.length; j++) {
70                    const id = ids[j]
71                    if( id == shipping_method_id && stair_fee && distance_location_fee) {
72                        console.log('matched id', shipping_method_val)
73                        shipping_method.closest('li').append(`
74                        <div class="wspl_checkbox_holder" style="width: 100%;
75                        display: flex;
76                        flex-direction: column;
77                        /* gap: 15px; */
78                        padding: 16px;
79                        background: #dfdfdf;
80                        border-radius: 8px;
81                        margin: 8px 0px;">
82                            <label class="checkbox_holder" for="custom_stair_fee">
83                                <input id="custom_stair_fee_${shipping_method_val}" data-label="${wspl.stair_label}" type="checkbox" data-shipping-method="${shipping_method_val}" value="${stair_fee}" name="shipping_method_extra_fee" class="shipping_method_extra_fee">
84                                <span>${wspl.stair_label} (${stair_fee}₪)</span>
85                            </label>
86
87                            <label class="checkbox_holder" for="custom_distance_location_fee">
88                                <input id="custom_distance_location_fee_${shipping_method_val}" type="checkbox" data-shipping-method="${shipping_method_val}" value="${distance_location_fee}" data-label="${wspl.distant_label}"  name="shipping_method_extra_fee" class="shipping_method_extra_fee"/>
89                                <span>${wspl.distant_label} (${distance_location_fee}₪)</span>
90                            </label>
91                        </div>`)
92                    }
93                }
94            }
95        }
96        let local_pickups = jQuery('input[value^="local_pickup:"]')
97        // last pickup
98        if( local_pickups.length > 1 ) {
99            let last_pickup = local_pickups[local_pickups.length - 1]
100            let last_pickup_val = $(last_pickup).val()
101            if( last_pickup_val == shipping_method_val ) {
102                let address_html = '<option value="">בחרו סניף לאיסוף עצמי</option>'
103                let addresses = wspl.local_pickup_addresses
104                for (let i = 0; i < addresses.length; i++) {
105                    const add = addresses[i];
106                    let local_address = localStorage.getItem('wspl_localpickup_address')
107                    let selected
108                    if( !local_address ) {
109                        selected = i == 0 ? 'selected' : ''
110                    } else if ( add == local_address ) {
111                        selected = 'selected'
112                    }
113                    address_html += `<option ${selected} value="${add}">${add}</option>`
114                }
115                if( shipping_method.closest('li').find('.wspl_checkbox_holder').length == 0 ) {
116                    console.log('local pickup')
117                    shipping_method.closest('li').append(`
118                            <div class="wspl_checkbox_holder" style="width: 100%;
119                            display: flex;
120                            flex-direction: column;
121                            /* gap: 15px; */
122                            padding: 16px;
123                            background: #dfdfdf;
124                            border-radius: 8px;
125                            margin: 8px 0px;">
126                                <label class="checkbox_holder" for="custom_stair_fee">
127                                    <select id="wspl_localpickup_address">
128                                        ${address_html}
129                                    </select>
130                                </label>
131                            </div>`)
132                }
133            }
134        }
135    })
136    $(document).on('click','input.shipping_method[type="radio"]:checked',function(){
137        console.log('working')
138        let shipping_method_val = $(this).val()
139        console.log('shipping_method_val',shipping_method_val)
140        $.ajax({
141            url: wspl.ajax_url,
142            type: 'POST',
143            dataType: "json",
144            data: {
145                action: 'unset_shipping_method_price',
146                dataset: { id: shipping_method_val }
147            },
148            success:function(resp){
149                console.log('unset resp',resp)
150                if( resp.status && resp.status == 'success' ) {
151                    $( document.body ).trigger('update_checkout')
152                    // window.location.reload()
153                }
154            },
155            error:function(err){
156                console.log('err',err)
157            }
158        })
159    })
160    $(document).on('change','#wspl_localpickup_address',function(){
161        let address = $(this).val()
162        $.ajax({
163            url: wspl.ajax_url,
164            type: 'POST',
165            dataType: "json",
166            data: {
167                action: 'wpsl_set_localpickup_address',
168                dataset: address
169            },
170            success:function(resp){
171                console.log('resp',resp)
172                if( resp.status && resp.status == 'success' ) {
173                    // put the address in browser local storage
174                    localStorage.setItem('wspl_localpickup_address',resp.address)
175                    // get address from local storage
176                    $( document.body ).trigger('update_checkout')
177                    // window.location.reload()
178                }
179            },
180            error:function(err){
181                console.log('err',err)
182            }
183        })
184    })
185})

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.