PageSourceSearch

https://www.hairfusionbar.com/wp-content/themes/hair-fusion-bar/js/custom.js

js hairfusionbar.com collected 2026-10-08 18:41:49 UTC 13,790 bytes, 420 lines download raw bytes

1jQuery(document).ready(function(){
2	jQuery(".mobile-menu").click(function(){
3		jQuery(this).toggleClass('active');
4		jQuery("#site-navigation").slideToggle('150');
5	});
6	//home slider js code
7	jQuery('.flexslider').flexslider({
8		animation: "fade",
9		animationLoop: true
10	});
11	//home other slider
12	jQuery('.flexcarousel').flexslider({
13		animation: "slide",
14		animationLoop: true,
15		itemWidth: 300,
16		itemMargin: 3
17	});
18
19	jQuery('.flexcarouselreviews').flexslider({
20		animation: "slide",
21		animationLoop: true
22	});
23
24	//portfolio slider js code
25	 jQuery('#carousel').flexslider({
26	    animation: "slide",
27	    controlNav: false,
28	    animationLoop: false,
29	    slideshow: false,
30	    itemWidth: 210,
31	    itemMargin: 5,
32	    asNavFor: '#slider'
33	  });
34	 
35	  jQuery('#slider').flexslider({
36	    animation: "slide",
37	    controlNav: false,
38	    animationLoop: false,
39	    slideshow: false,
40	    sync: "#carousel"
41	  });
42
43	jQuery('#secondary-menu > li:first-child > a').click(function(e){
44		e.preventDefault();
45	});
46	jQuery('#secondary-menu > li:first-child').click(function(e){
47		//e.preventDefault();
48		jQuery(this).siblings('li').slideToggle('fast');
49	});
50	jQuery('.portfolio .osc-res-nav .tabdrop .dropdown-toggle').append("<span>More</span>");
51	jQuery('.portfolio .osc-res-nav .tabdrop .dropdown-toggle').click(function(e){
52		//e.preventDefault();
53		jQuery(this).siblings('ul').slideToggle('fast');
54	});
55	jQuery('.vagaro-popup-widget a img').attr("src","http://www.hairfusionbar.com/wp-content/uploads/2016/03/vagaro-mobile.png");
56	//jQuery('.vagaro-popup-widget a img').attr("src","http://hairfusionbar.dfmstaging.com/wp-content/uploads/2016/03/vagaro-mobile.png");
57});
58
59	jQuery('#my_custom_checkout_field').append('<input type="submit" class="button alt" id="dfm_gratuity" value="Add gratuity">');
60	jQuery('#my_field_name_2_field').hide();
61	jQuery('.my-field-class').change(function(){
62		if(jQuery( ".my-field-class option:selected" ).text() == 'Other Amount'){
63			jQuery('#my_field_name_2_field').show();
64		}else{
65			jQuery('#my_field_name_2_field').hide();
66		}
67	});
68
69
70	jQuery('#dfm_gratuity').click(function(){
71		if(jQuery( ".my-field-class option:selected" ).text() == 'Other Amount'){
72			var val = jQuery('#my_field_name_2').val();
73			val = val.replace(/[\$£€#]/g , "");
74			if(val < 0){
75				val = 0;
76			}
77			var type = 'direct';
78		}else{
79			var val = jQuery( ".my-field-class option:selected" ).text();
80			var type = 'percentage';
81		}
82		var data = {
83			action: 'woocommerce_apply_state',
84			security: wc_checkout_params.apply_state_nonce,
85			val: val,
86			type: type
87		};
88
89    jQuery.ajax({
90        type: 'POST',
91        url: ajaxurl,
92        data: data,
93        success: function (code) {
94            console.log(code);
95//                jQuery('.woocommerce-error, .woocommerce-message').remove();
96
97            if (code === '0') {
98//                    $form.before(code);
99                jQuery('body').trigger('update_checkout');
100            }
101        },
102        dataType: 'html'
103    });
104         return false;
105    });
106
107(function($){
108	$(".guest_checkbox").parent().next().hide();
109    $(".guest_checkbox").change(function () {
110		if($(this).is(':checked')){
111			$(this).parent().next().show();
112			var p_id = $(this).val();
113            var data = {
114                action: 'woocommerce_add_to_cart_ajax',
115                // security: wc_checkout_params.apply_state_nonce,
116                pId: p_id
117            };
118
119            // console.log($(this).attr('data-id'));
120            jQuery.ajax({
121                type: 'POST',
122                url: ajaxurl,
123                data: data,
124                beforeSend: function(){
125                    jQuery('.loading').show();
126                },
127                success: function (code) {
128                    // setTimeout('window.location="/cart"', 2000);
129                },
130                complete:function(data){
131                    jQuery('.loading').hide();
132                    window.location="/cart";
133                },
134                dataType: 'html'
135            });
136            // setTimeout(function(){window.location = '/preview/?product_id=' + p_id} , 2000);
137		}else{
138            $(this).parent().next().hide();
139		}
140    });
141
142    $(".confirm--proceed").on('click', function () {
143        var pId = $(this).attr('data-id');
144        var data = {
145            action: 'woocommerce_add_to_cart_ajax',
146            // security: wc_checkout_params.apply_state_nonce,
147            pId: pId
148        };
149
150        // console.log($(this).attr('data-id'));
151        jQuery.ajax({
152            type: 'POST',
153            url: ajaxurl,
154            data: data,
155            beforeSend: function(){
156                jQuery('.loading').show();
157            },
158            success: function (code) {
159                // setTimeout('window.location="/cart"', 2000);
160            },
161            complete:function(data){
162                jQuery('.loading').hide();
163                if(pId == 4373){
164                    window.location="/cart";
165                }else{
166                    window.location="/checkout";
167                }
168            },
169            dataType: 'html'
170        });
171    });
172
173    $(".hard-coded-product").on('click', function () {
174        var cEmail = $(this).parent().find('.customer--email').val();
175        var cPhone = $(this).parent().find('.customer--phone').val();
176
177        var data = {
178            action: 'send_user_checkout_page',
179            // security: wc_checkout_params.apply_state_nonce,
180            pId: $(this).attr('data-id'),
181            email: cEmail,
182            phone: cPhone
183        };
184
185        var that = $(this);
186        // console.log($(this).parent().find('.customer--email').val());
187        jQuery.ajax({
188            type: 'POST',
189            url: ajaxurl,
190            data: data,
191            beforeSend: function(){
192                jQuery('.loading').show();
193            },
194            success: function (code) {
195                console.log(code);
196                if(cPhone =='' && cEmail == ''){
197                    Swal(
198                        'Opps!',
199                        'Something went wrong!',
200                        'error'
201                    );
202                }else{
203                    Swal(
204                        'Thanks!',
205                        'Message is sent!',
206                        'success'
207                    );
208                }
209                that.next().find('input').val('');
210                that.next().next().find('input').val('');
211                // setTimeout('window.location="/cart"', 2000);
212            },
213            complete:function(data){
214                jQuery('.loading').hide();
215            },
216            dataType: 'html'
217        });
218
219    });
220
221    $(".tab-button").parent().find('.agreement').hide();
222    $(".tab-button").on('click', function(){
223        var arr = $(".agreement");
224        $.each( arr, function( i, val ) {
225            $(this).hide();
226        });
227    	$(this).parent().find('.agreement').show();
228    });
229
230    jQuery(document).ready(function($) {
231
232        // Show the login dialog box on click
233        $('a#show_login').on('click', function(e){
234            $('form#login').fadeIn(500);
235            $('div.login_overlay, form#login a.close').on('click', function(){
236                $('div.login_overlay').remove();
237                $('form#login').hide();
238            });
239            e.preventDefault();
240        });
241
242        // Perform AJAX login on form submit
243        $('form#login').on('submit', function(e){
244            // $('form#login p.status').show().text(ajax_login_object.loadingmessage);
245            $.ajax({
246                type: 'POST',
247                dataType: 'json',
248                url: ajaxurl,
249                data: {
250                    'action': 'ajaxlogin', //calls wp_ajax_nopriv_ajaxlogin
251                    'username': $('form#login #username').val(),
252                    'password': $('form#login #password').val(),
253                    'security': $('form#login #security').val() },
254                success: function(data){
255                    $('form#login p.status').text(data.message);
256                    if (data.loggedin == true){
257                        // document.location.href = ajax_login_object.redirecturl;
258                        document.location.href = '/booking/?tab=employee-login';
259                    }
260                }
261            });
262            e.preventDefault();
263        });
264
265        $('form#create-product').on('submit', function(e){
266            var customerEmail = $('form#create-product #prod-email').val();
267            var customerPhone = $('form#create-product #prod-phone').val();
268
269            $.ajax({
270                type: 'POST',
271                dataType: 'json',
272                url: ajaxurl,
273                beforeSend: function(){
274                    jQuery('.loading').show();
275                },
276                data: {
277                    'action': 'add_custom_product', //calls wp_ajax_nopriv_ajaxlogin
278                    'desc': $('form#create-product #prod-desc').val(),
279                    'title': $('form#create-product #prod-title').val(),
280                    'price': $('form#create-product #prod-price').val(),
281                    'email': customerEmail,
282                    'phone': customerPhone,
283                    'gratuity': $('form#create-product #prod-gratuity').val(),
284                    'security': $('form#create-product #security').val()
285                },
286                success: function(data){
287                    if(data !=0){
288                        if(customerEmail =='' && customerPhone == ''){
289                            Swal(
290                                'Opps!',
291                                'Email or Phone Number is missing!',
292                                'error'
293                            );
294                        }else{
295                            Swal(
296                                'Thanks!',
297                                'Message is sent!',
298                                'success'
299                            );
300                        }
301                    }else{
302                        Swal(
303                            'Opps!',
304                            'Something went wrong!',
305                            'error'
306                        );
307                    }
308
309                    document.getElementById("create-product").reset();
310
311                },
312                complete:function(data){
313                    jQuery('.loading').hide();
314                }
315
316            });
317
318            e.preventDefault();
319        });
320
321    });
322
323    $(document).ready(function() {
324        $('#example').DataTable({
325            "order": [[ 0, 'desc' ]],
326            autoWidth: false, //step 1
327            columnDefs: [
328                { width: '100px', targets: 0 }, //step 2, column 1 out of 4
329                { width: '300px', targets: 1 }, //step 2, column 2 out of 4
330                { width: '100px', targets: 2 },  //step 2, column 3 out of 4
331                { width: '100px', targets: 3 },
332                { width: '100px', targets: 4 }
333            ],
334            "ordering": false
335            // "processing": true,
336            // "serverSide": true,
337            // "ajax": {
338            //     "type": "POST",
339            //     "url": ajaxurl,
340            //     "data": {action: "all_voter_list_to_show_in_data_table"}
341            // },
342            // "aoColumns": [
343            //     {"bSortable": false},
344            //     {"bSortable": false},
345            //     {"bSortable": false},
346            //     {"bSortable": false},
347            //     {"bSortable": false}
348            // ]
349		});
350    } );
351
352    if($('.cart-to-empty').length){
353        var data = {
354            action: 'hfb_flush_cart'
355        };
356
357        const swalWithBootstrapButtons = swal.mixin({
358            buttonsStyling: true,
359            confirmButtonColor: '#3085d6',
360            cancelButtonColor: 'green'
361        });
362
363        swalWithBootstrapButtons({
364            title: 'You have some product(s) in cart. ',
365            text: "Do you want to flush it?",
366            type: 'info',
367            showCancelButton: true,
368            confirmButtonText: 'Yes, flush cart!',
369            cancelButtonText: 'No, fine!',
370            reverseButtons: true
371        }).then(function(result) {
372            if (result.value) {
373                jQuery.ajax({
374                    type: 'POST',
375                    url: ajaxurl,
376                    data: data,
377                    success: function (response) {
378                        swalWithBootstrapButtons(
379                            'Cart is flushed!',
380                            '',
381                            'info'
382                        );
383                    },
384                    dataType: 'html'
385                });
386
387            } else if (
388                result.dismiss === swal.DismissReason.cancel
389            ) {
390                swalWithBootstrapButtons(
391                    'You are checking out with',
392                    'previously added product(s).',
393                    'info'
394                )
395            }
396        });
397    }
398
399    $('.customer--phone').keyup(function(e){
400        var ph = this.value.replace(/\D/g,'').substring(0,10);
401        // Backspace and Delete keys
402        var deleteKey = (e.keyCode == 8 || e.keyCode == 46);
403        var len = ph.length;
404        if(len==0){
405            ph=ph;
406        }else if(len<3){
407            ph='('+ph;
408        }else if(len==3){
409            ph = '('+ph + (deleteKey ? '' : ') ');
410        }else if(len<6){
411            ph='('+ph.substring(0,3)+') '+ph.substring(3,6);
412        }else if(len==6){
413            ph='('+ph.substring(0,3)+') '+ph.substring(3,6)+ (deleteKey ? '' : '-');
414        }else{
415            ph='('+ph.substring(0,3)+') '+ph.substring(3,6)+'-'+ph.substring(6,10);
416        }
417        this.value = ph;
418    });
419
420})(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.