PageSourceSearch

https://www.indospace.in/wp-content/plugins/wpbot-pro-professional/js/qcld-wp-chatbot-front.js?ver=14.1.2

js indospace.in collected 2026-09-26 02:05:55 UTC 148,068 bytes, 2,727 lines download raw bytes

1var LoadwpwBotPlugin = 0;
2jQuery(function ($) {
3    "use strict";
4    //Global object passed by admin
5    var wpChatBotVar = wp_chatbot_obj;
6    var textEditorHandler = 0;
7    var exitintentcount = 0;
8    if( typeof(openingHourIsFn) !='undefined'){
9        var openingHourIs = openingHourIsFn;
10    }else{
11        var openingHourIs = 0;
12    }
13
14    var OnchatWindow = false;
15    var justOpen = true;
16    // if(wpChatBotVar.disable_livechat_operator_offline == '1'){
17    //     var menu = jQuery('.qcld-chatbot-custom-intent');
18    //     setTimeout(function(){jQuery('.qcld-chatbot-custom-intent').hide()}, 5000);
19        
20    //     if(menu.text() == 'Live Chat'){
21    //         menu.hide();
22    //     }
23    // }
24    $('.wp-chatbot-start-screen').on( 'scroll', function(){
25        var position = $(this).scrollTop();
26        var opacity = 1;
27        var calposition = Math.abs(position - 100);
28        opacity = (calposition/100)
29        if( position == 100 || position > 100 ){
30            opacity = 0;
31        }
32        if( position == 0 ){
33            opacity = 1;
34        }
35        $('.wp-chatbot-start-header-content').css('opacity', opacity);
36        $('.wp-chatbot-start-close').css('opacity', opacity);
37
38    })
39    
40    $(document).on({
41            mouseenter:function(){ 
42                OnchatWindow = true; 
43                
44                if(wpChatBotVar.auto_hide_floating_button==1 && !justOpen){
45                    $('#wp-chatbot-integration-container').fadeIn(500);
46                    $('#wp-chatbot-desktop-close').fadeIn(500);
47                    $('#wp-chatbot-desktop-reload').fadeIn(500);
48                }
49            },
50            mouseleave:function(){ 
51                OnchatWindow = false;
52                
53                if(wpChatBotVar.auto_hide_floating_button==1 && !justOpen){
54                    setTimeout(function(){
55                        if(!OnchatWindow){
56                            $('#wp-chatbot-integration-container').fadeOut(500);
57                            $('#wp-chatbot-desktop-close').fadeOut(500);
58                            $('#wp-chatbot-desktop-reload').fadeOut(500);
59                        }
60                        
61                    }, 3000)
62                }
63            },
64        }, 
65    '.slimScrollDiv'
66    );
67
68    wpChatBotVar.exit_intent_handler = 0;
69    wpChatBotVar.scroll_open_handler = 0;
70    wpChatBotVar.auto_open_handler = 0;
71    wpChatBotVar.re_target_handler = 0;
72
73    $(document).on('click', '.qcwpbot_close_ret' , function(e){
74        $(this).parent().parent().remove();
75    })
76    $(document).on('click', '.qc_wpbot_floating_main' , function(e){
77        e.preventDefault();
78        if(e.target.className=='qcwp_notification_nav'){
79            return;
80        }
81        if(e.target.className=='wp-chatbot-notification-close'){
82            $('.wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
83                    //clearInterval(notificationInterval);
84            sessionStorage.setItem('wpChatbotNotification', 'removed');
85            return;
86        }
87        $('.wp-chatbot-ball').trigger( "click" );
88    })
89
90    $(window).on('load', function() {
91
92        
93
94        if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
95            if(jQuery('#menuItems').find('.wp-chatbot-integration-button-container').children().length==0){
96                jQuery('#menuItems').hide();
97                jQuery('#menuTrigger').hide();            
98            }
99        }
100        
101
102        if(wpChatBotVar.wp_keep_chat_window_open==1){
103
104            if( $('.active-chat-board').length<1){
105				setTimeout(function(){
106					$('.wp-chatbot-ball').trigger( "click" );
107				}, 3000)
108                
109            }
110        }
111
112        
113
114    });
115
116    $(document).ready(function () {
117
118        if( wpChatBotVar.language == 'ar' ){
119            if( !$('#wp-chatbot-chat-container').hasClass('wp-chatbot-rtl') ){
120                $('#wp-chatbot-chat-container').addClass('wp-chatbot-rtl');
121            }
122        }
123
124        jQuery('#wp-chatbot-mobile-close, #wp-chatbot-desktop-close, #wp-chatbot-desktop-close1, .wp-chatbot-start-close').on('click', function (event) {
125
126            if( $('.wp-chatbot-start-container').is(':visible') ){
127                $('.wp-chatbot-start-container').hide();
128                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
129            }
130            $("#wp-chatbot-board-container").toggleClass('active-chat-board');
131            $("#wp-chatbot-notification-container").removeClass('wp-chatbot-notification-container-disable').addClass('wp-chatbot-notification-container-sliding');
132        
133            $('#wp-chatbot-chat-container').css({
134                'right': wpChatBotVar.wp_chatbot_position_x + 'px',
135                'bottom': wpChatBotVar.wp_chatbot_position_y + 'px',
136                'top': 'auto', 'left': 'auto'
137            });
138            if (window.matchMedia('(max-width: 480px)').matches) {
139                $('#wp-chatbot-chat-container').css({
140                    'right': wpChatBotVar.wp_chatbot_position_mp_x + 'px !important',
141                    'bottom': wpChatBotVar.wp_chatbot_position_mp_y + 'px !important',
142                    'top': 'auto', 'left': 'auto'
143                });
144            };
145            $('.fb_dialog').show();
146            $('#wp-chatbot-ball').show();
147            //Facebook Messenger.
148            if ($('.active-chat-board').length > 0) {
149                $('#wp-chatbot-integration-container').show();
150                if(wpChatBotVar.template=='template-07'){
151                    $('#wp-chatbot-integration-container-07').hide();
152                }
153                
154            } else {
155                $('#wp-chatbot-integration-container').hide();
156                if(wpChatBotVar.template=='template-07'){
157                    $('#wp-chatbot-integration-container-07').show();
158                }
159                if(wpChatBotVar.template=='template-06'){
160                    $('#wp-chatbot-ball').show();
161                }
162                $('#wp-chatbot-ball').removeClass('wpbot_chatopen_iconanimation');
163                $('#wp-chatbot-ball').addClass('wpbot_chatclose_iconanimation');
164                $('#wp-chatbot-ball').find('img').attr('src', botimage)		
165                $('.wp-chatbot-ball').css('background', '#ffffff');
166            }
167
168            if(wpChatBotVar.wp_keep_chat_window_open==1){
169                $.cookie('bot_window_open', 'no', { path: '/' });
170            }
171            
172            if( $('.qc_wpbot_floating_main').length > 0 ){
173                $('.qc_wpbot_floating_main').show();
174            }
175            setTimeout(function(){
176                
177                var json = {
178                    msg: 'chatbot_close',
179                    val: (jQuery('#wp-chatbot-chat-container').height()+80)
180                }
181                sendMessageIframe(json);
182                
183            },200)
184            $('#wp-chatbot-ball-container').removeAttr('aria-haspopup');
185            $('#wp-chatbot-ball-container').removeAttr('aria-expanded');
186            $('#wp-chatbot-ball-container').attr('aria-haspopup','');
187            $('#wp-chatbot-ball-container').attr('aria-expanded','false');
188        });
189
190        jQuery('.qc_floating_bottom_notification').css('top', '-'+ (jQuery('.qc_floating_bottom_notification').height() + jQuery('.qc_bottom_position').height() + 17) +'px');
191
192        $(document).keydown(function(e) {
193            
194            e = e || window.event;
195            var key = e.which || e.keyCode; // keyCode detection
196            var ctrl = e.ctrlKey ? e.ctrlKey : ((key === 17) ? true : false); // ctrl detection
197
198            if ( key == 66 && ctrl ) {
199                $('.wp-chatbot-ball').trigger( "click" );
200            }
201			if(e.key === "Escape") {
202				$('.wp-chatbot-ball').trigger( "click" );
203			}
204
205        })
206
207        //image popup script
208
209        $(document).on('click', '.wpbot_img_popup' , function(e){
210            e.preventDefault();
211            $('#qcwpbotModal').show();
212            $('#qcwpbotimg01').attr('src', $(this).attr('src'));
213        })
214
215        $(document).on('click', '.qcwpbotclose' , function(e){
216            e.preventDefault();
217            $('#qcwpbotModal').hide();            
218        })
219
220        function handle_language( obj ){
221            if ( typeof(obj) == 'object' &&  obj.hasOwnProperty( wpChatBotVar.language ) ){
222                return obj[wpChatBotVar.language];
223            }
224            return obj;
225        }
226
227	function dailogAIOAction(text){
228		
229        //=========
230
231        if(!localStorage.getItem('botsessionid')){
232
233            var number = Math.random() // 0.9394456857981651
234            number.toString(36); // '0.xtis06h6'
235            var id = number.toString(36).substr(2); // 'xtis06h6'
236
237            localStorage.setItem('botsessionid', id);
238            
239        }
240
241        if(wpChatBotVar.df_api_version=='v1'){
242            return  jQuery.ajax({
243                type : "POST",
244                url :"https://api.dialogflow.com/v1/query?v=20170712",
245                contentType : "application/json; charset=utf-8",
246                dataType : "json",
247                headers : {
248                    "Authorization" : "Bearer "+wpChatBotVar.obj.ai_df_token
249                },
250                
251                data: JSON.stringify( {
252                    query: text,
253                    
254                    lang : wpChatBotVar.df_agent_lan,
255                    sessionId: localStorage.getItem('botsessionid')?localStorage.getItem('botsessionid'):'wpwBot_df_2018071'
256                } )
257            });
258        }else{
259            return jQuery.post(wpChatBotVar.ajax_url, {
260                'action': 'qcld_wp_df_api_call',
261                'dfquery': text,
262                'sessionid': localStorage.getItem('botsessionid')?localStorage.getItem('botsessionid'):'wpwBot_df_2018071'
263            });
264        }
265
266        //=========
267    }
268    
269    
270
271	function df_reply(response){
272			
273		//checking for facebook platform
274        var i = 0;
275        var html = '';
276        var responses = [];
277
278        if(wpChatBotVar.df_api_version=='v1'){
279            var messages = response.result.fulfillment.messages;
280            var action = response.result.actionIncomplete;
281            jQuery.each( messages, function( key, message ) {
282                html = '';
283                i +=1;
284                if(message.type==2){
285                    
286                    html += "<p>" + message.title + "</p>";
287                    var index = 0;
288                    for (index; index<message.replies.length; index++) {
289                        html += "<span class=\"wpb-quick-reply qcld-chat-common\">"+ message.replies[index] +"</span>";
290                    }
291                    
292                    
293                }
294                //check for default reply
295                else if(message.type==0 && message.speech!=''){
296                    
297                    html += message.speech;
298                    
299                }else if(message.type==1){
300                    
301                    html +='<div class="wpbot_card_wraper">';
302                        html+='<div class="wpbot_card_image">';
303                            if(message.imageUrl!=''){
304                                html+='<img src="'+message.imageUrl+'" />';								
305                            }
306                            html+='<div class="wpbot_card_caption">';
307                            if(message.title!=''){
308                                html+='<h2>'+message.title+'</h2>';
309                            }
310                            if(message.subtitle!=''){
311                                html+='<p>'+message.subtitle+'</p>';
312                            }
313                            html+='</div>';
314                        html+='</div>';
315                        if(typeof message.buttons !== 'undefined'){
316                            if(message.buttons.length>0){
317                                jQuery.each( message.buttons, function( k, btn ) {
318                                    html+='<a href="'+btn.postback+'" target="_blank"><i class="fa fa-external-link"></i> '+btn.text+'</a>';
319                                })
320                            }
321                        }
322                        
323                    html +='</div>';
324                    
325                }else if(message.type=='simple_response'){
326                    html += message.textToSpeech;
327                }
328
329                if(html!=''){
330                    responses.push(html);
331                }
332                
333            })
334        }else{
335
336            
337
338            var messages = response.queryResult.fulfillmentMessages;
339            var actioncomplete = response.queryResult.allRequiredParamsPresent;
340
341            jQuery.each( messages, function( key, message ) {
342
343                html = '';
344                i +=1;
345                //handeling quickreplies
346                if(typeof message.quickReplies !=="undefined"){
347                    if(typeof message.quickReplies.title !=="undefined"){
348                        html += "<p>" + message.quickReplies.title + "</p>";
349                    }
350                    if(typeof message.quickReplies.quickReplies !=="undefined" ){
351
352                        var index = 0;
353                        for (index; index<message.quickReplies.quickReplies.length; index++) {
354                            html += "<span class=\"wpb-quick-reply qcld-chat-common\">"+ message.quickReplies.quickReplies[index] +"</span>";
355                        }
356
357                    }
358
359                }
360                //handleing default response
361                else if(typeof message.text !=="undefined"){
362                    if(typeof message.text.text !=="undefined" && message.text.text.length>0){
363                        html += message.text.text[0];
364                    }
365                }
366                else if(typeof message.card !=="undefined"){
367
368                    html +='<div class="wpbot_card_wraper">';
369                        html+='<div class="wpbot_card_image">';
370                            if(message.card.imageUri !=="undefined" && message.card.imageUri!=''){
371                                html+='<img src="'+message.card.imageUri+'" />';								
372                            }
373                            html+='<div class="wpbot_card_caption">';
374                            if(message.card.title !=="undefined" && message.card.title !=""){
375                                html+='<h2>'+message.card.title+'</h2>';
376                            }
377                            if(message.card.subtitle !=="undefined" && message.card.subtitle !=""){
378                                html+='<p>'+message.card.subtitle+'</p>';
379                            }
380                            html+='</div>';
381                        html+='</div>';
382
383                        if(typeof message.card.buttons !== 'undefined'){
384                            if(message.card.buttons.length>0){
385                                jQuery.each( message.card.buttons, function( k, btn ) {
386                                    html+='<a href="'+btn.postback+'" target="_blank"><i class="fa fa-external-link"></i> '+btn.text+'</a>';
387                                })
388                            }
389                        }
390                        
391                    html +='</div>';
392
393                }
394
395                if(html!=''){
396                    responses.push(html);
397                }
398
399            })
400
401        }
402
403
404        return responses;
405			
406    }
407    
408
409    function qcwp_auto_hide_floating_buttons(){
410        setTimeout(function(){
411            
412            if(!OnchatWindow){
413                $('#wp-chatbot-integration-container').fadeOut(500);
414                $('#wp-chatbot-desktop-close').fadeOut(500);
415                $('#wp-chatbot-desktop-reload').fadeOut(500);
416                
417            }else{
418                $('#wp-chatbot-integration-container').fadeIn();
419                $('#wp-chatbot-desktop-close').fadeIn();
420                $('#wp-chatbot-desktop-reload').fadeIn();
421            }
422            justOpen = false;
423        }, 3000)
424    }
425	
426	$(document).on('click', '#wpbot_back_to_home', function(event){
427		$('.wp-chatbot-container').show();
428		$("#wp-chatbot-board-container").addClass('active-chat-board');		
429		$(".wpbot-saas-live-chat").hide();
430		
431        $('.floatingbot_delay').hide();
432        showfloatinicon();
433        
434    })
435    var delay_floating_icon = wpChatBotVar.delay_wp_chatbot_floating_icon;
436    var delay_notification = parseInt(delay_floating_icon) + parseInt(wpChatBotVar.delay_floating_notification_box);
437    var chatbot_open_status = ''; 
438
439    // var chatbot_window_open = wpChatBotVar.chatbot_window_open;
440 
441    // if(chatbot_window_open == 1){
442    //     console.log('check');
443    //     setTimeout(function () {
444    //         $('.wp-chatbot-ball').trigger( "click" )
445    //     },1500);
446    // }
447    function showfloatinicon(){
448        $('.floatingbot_delay').show();
449    }
450    function shownotificationcontainer(){
451        var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
452	    var eventer = window[eventMethod];
453	    var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
454        var aria_status = jQuery('#wp-chatbot-ball').attr('class');
455        if( ((wpChatBotVar.enable_wp_chatbot_open_initial != 1 ) || ( $.cookie("auto_open_cookie") == 'yes' )) && (aria_status != 'wpbot_chatopen_iconanimation') && (sessionStorage.getItem('wpChatbotNotification') != 'removed') && wpChatBotVar.template!='template-05'){
456            $('.wp-chatbot-notification-container').show();
457        }
458        eventer(messageEvent,function(e) {
459            if(e.data.msg == 'chatbot_open'){
460                $('.wp-chatbot-notification-container').hide();
461            }
462            if(e.data.msg == 'chatbot_close'){
463                if(sessionStorage.getItem('wpChatbotNotification') != 'removed' && wpChatBotVar.template!='template-05' ){
464                    $('.wp-chatbot-notification-container').show();
465
466                }
467            }
468
469        },false);
470    }
471   
472    if((wpChatBotVar.enable_floating_icon == 1) && ( jQuery('#wp-chatbot-ball').attr('class') ) != 'wpbot_chatopen_iconanimation'){
473        setTimeout(shownotificationcontainer, delay_notification);
474    }
475    if(wpChatBotVar.enable_wp_chatbot_open_initial==1 ){
476        if( $.cookie("auto_open_cookie") != 'yes'){
477             if($('.active-chat-board').length==0){
478                 var delay_chat_window_open = parseInt(wpChatBotVar.delay_chat_window_open) + parseInt(wpChatBotVar.delay_wp_chatbot_floating_icon);
479               
480                 jQuery('#wp-chatbot-chat-container').removeClass('wpbot_hide_floating_icon');
481                 setTimeout(function(){
482                     $('.wp-chatbot-ball').trigger( "click" );
483                 },delay_chat_window_open)
484                 var date = new Date();
485                 date.setTime(date.getTime() + 12 * 60 * 60 * 1000);
486                 $.cookie('auto_open_cookie', 'yes', {
487                     expires: date
488                 });
489             }
490        }
491    }
492    $('.wp-chatbot-notification-container').hide();
493    $('.floatingbot_delay').hide();
494    setTimeout(showfloatinicon, delay_floating_icon);
495    if(wpChatBotVar.disable_wp_chatbot_history==1){
496        
497        localStorage.removeItem('shopper');
498        localStorage.removeItem('shopperemail');
499        localStorage.removeItem('shopperphone');
500
501        localStorage.removeItem('wpwHitory');
502        localStorage.setItem("wildCard",  0);
503        localStorage.setItem("aiStep", 0);
504        wpwKits.doReset();
505    }
506    
507    if(typeof(clickintent) !=="undefined" && clickintent !=''){
508        wpChatBotVar.clickintent = clickintent;
509    }
510
511    if(typeof(wclickintent) !=="undefined" && wclickintent !=''){
512        wpChatBotVar.clickintent = wclickintent;
513    }
514    if(typeof(pclickintent) !=="undefined" && pclickintent !=''){
515        wpChatBotVar.clickintent = pclickintent;
516    }
517
518    if(typeof(wpbot_clear_cache) !=="undefined" && wpbot_clear_cache !=''){
519      //  wpwKits.doReset();
520    }
521    
522
523    if(typeof(ldsuggestionObject) !=="undefined" ){
524		setTimeout( function(){
525			
526			if($('.active-chat-board').length==0){
527				$('.wp-chatbot-ball').trigger( "click" );
528				if(localStorage.getItem('wpwHitory')){
529					wpwTree.ldsuggestion();
530				}
531			}
532			
533		}, 3000 )
534    }
535    
536        $(document).on('click', '.qc_wpbot_chat_link', function(e){
537            e.preventDefault();
538            var clickintent = $(this).attr('data-intent');
539            if((clickintent) == ''){
540                clickintent = 'start';
541            }
542            if((clickintent) != ''){
543                $('#wp-chatbot-messages-container').html('');
544                wpChatBotVar.clickintent = clickintent;
545                $('.wp-chatbot-notification-container').hide();
546                $('#wp-chatbot-chat-container').show();
547                $('.fb_dialog').show();
548            }
549            if($('.active-chat-board').length==0){
550                jQuery('#wp-chatbot-chat-container').removeClass('wpbot_hide_floating_icon');
551                $('.wp-chatbot-ball').trigger( "click" );
552                
553                if( clickintent !='' ){
554                    jQuery('.wp-chatbot-container').show();
555                    jQuery('.wp-chatbot-start-container').hide();
556                }
557            }
558           // if(localStorage.getItem('wpwHitory')){
559                if(clickintent=='Faq'){
560                    globalwpw.wildCard=1;
561                    globalwpw.supportStep='welcome';
562                    wpwAction.bot('from wildcard support');
563                    //keeping value in localstorage
564                    localStorage.setItem("wildCard",  globalwpw.wildCard);
565                    localStorage.setItem("supportStep", globalwpw.supportStep);
566                    
567                }else if(clickintent=='Email Subscription'){
568                    globalwpw.wildCard=3;
569                    globalwpw.subscriptionStep='welcome';
570                    wpwTree.subscription();
571                    localStorage.setItem("wildCard",  globalwpw.wildCard);
572                    localStorage.setItem("supportStep", globalwpw.supportStep);
573
574                }else if(clickintent==handle_language(wp_chatbot_obj.site_search)){
575                    
576                    if(typeof(globalwpw.hasNameCookie)=='undefined'|| global
576wpw.hasNameCookie==''){
577                        var shopperName=  handle_language(wp_chatbot_obj.shopper_demo_name);
578                    }else{
579                        var shopperName=globalwpw.hasNameCookie;
580                    }
581                    var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_search_keyword)
582                    
583                    wpwMsg.single(askEmail.replace("#name", shopperName));
584                    //Now updating the support part as .
585                    globalwpw.supportStep='search';
586                    globalwpw.wildCard=1;
587                    //keeping value in localstorage
588                    localStorage.setItem("wildCard",  globalwpw.wildCard);
589                    localStorage.setItem("supportStep",  globalwpw.supportStep);
590
591                }else if(clickintent=='Send Us Email'){
592
593                    if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
594                        var shopperName=  handle_language(wp_chatbot_obj.shopper_demo_name);
595                    }else{
596                        var shopperName=globalwpw.hasNameCookie;
597                    }
598                    var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
599                    wpwMsg.single(askEmail);
600                    //Now updating the support part as .
601                    globalwpw.supportStep='email';
602                    globalwpw.wildCard=1;
603                    //keeping value in localstorage
604                    localStorage.setItem("wildCard",  globalwpw.wildCard);
605                    localStorage.setItem("supportStep",  globalwpw.supportStep);
606
607                }else if(clickintent=='Leave A Feedback'){
608
609                    if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
610                        var shopperName=  handle_language(wp_chatbot_obj.shopper_demo_name);
611                    }else{
612                        var shopperName=globalwpw.hasNameCookie;
613                    }
614                    var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
615                    wpwMsg.single(askEmail);
616                    //Now updating the support part as .
617                    globalwpw.supportStep='email';
618                    globalwpw.wildCard=1;
619                    //keeping value in localstorage
620                    localStorage.setItem("wildCard",  globalwpw.wildCard);
621                    localStorage.setItem("supportStep",  globalwpw.supportStep);
622
623                }else if(clickintent == 'Request Callback'){
624                    if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
625                        var shopperName=  handle_language(globalwpw.settings.obj.shopper_demo_name);
626                    }else{
627                        var shopperName=globalwpw.hasNameCookie;
628                    }
629                    var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_phone);
630                    setTimeout(function(){
631                        wpwMsg.single(askEmail);
632                        //Now updating the support part as .
633                        globalwpw.supportStep='phone';
634                        globalwpw.wildCard=1;
635                        //keeping value in localstorage
636                        localStorage.setItem("wildCard",  globalwpw.wildCard);
637                        localStorage.setItem("supportStep",  globalwpw.supportStep);
638                    },1000)
639                }else if(clickintent!=''){
640                    
641                    globalwpw.initialize=1;
642                    globalwpw.ai_step=1;
643                    globalwpw.wildCard=0;
644                    wpwAction.bot(clickintent);
645
646                }
647
648           // }
649
650            
651        })
652
653        $(document).on('click', '#wp-chatbot-notification-container', function(e){
654            e.preventDefault();
655            if(e.target.className=='wp-chatbot-notification-close'){
656                $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
657                        //clearInterval(notificationInterval);
658                sessionStorage.setItem('wpChatbotNotification', 'removed');
659            }else{
660            
661
662            var clickintent = $(this).attr('data-intent');
663            if(e.target.className=='qcwp_notification_nav'){
664                if(e.target.innerText.trim() == wp_chatbot_obj.wildcard_product[wp_chatbot_obj.default_language][0]){
665                   
666                    clickintent = wp_chatbot_obj.sys_key_product[wp_chatbot_obj.default_language];
667                }else if(e.target.innerText.trim() == wp_chatbot_obj.featured_products[wp_chatbot_obj.default_language][0]){
668                    globalwpw.wildCard=20;
669                    globalwpw.productStep='featured';
670                    clickintent = 'featured';
671                   // wpwKits.render('featured')
672                   // wpwKits.trigger_intent( 'featured' );
673                }
674                else{
675                    clickintent = e.target.innerText.trim();
676                }
677            }
678            if(e.target.className=='qc_kbx_custom_buddypress'){
679				
680				window.open(e.target.attributes[1].nodeValue, '_blank');
681				return;
682            }
683
684            
685            
686            if(clickintent!='' && typeof clickintent !='undefined'){
687                globalwpw.initialize = 0;
688                wpChatBotVar.clickintent = clickintent;
689                $('.wp-chatbot-notification-container').hide();
690                $('#wp-chatbot-chat-container').show();
691                $('.fb_dialog').show();
692                
693                if($('.active-chat-board').length==0){
694                    jQuery('#wp-chatbot-chat-container').removeClass('wpbot_hide_floating_icon');
695                    jQuery('.wp-chatbot-ball').trigger( "click" );
696                    jQuery('.wp-chatbot-container').show();
697                    jQuery('.wp-chatbot-start-container').hide();
698                    jQuery('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
699                      //  if(localStorage.getItem('wpwHitory')){
700                            
701                            if(clickintent.toLowerCase()=='faq'){
702                                globalwpw.wildCard=1;
703                                globalwpw.supportStep='welcome';
704                                wpwAction.bot('from wildcard support');
705                                //keeping value in localstorage
706                                localStorage.setItem("wildCard",  globalwpw.wildCard);
707                                localStorage.setItem("supportStep", globalwpw.supportStep);
708                                
709                            }else if(clickintent.toLowerCase()=='email Subscription'){
710                                globalwpw.wildCard=3;
711                                globalwpw.subscriptionStep='welcome';
712                                wpwTree.subscription();
713                                localStorage.setItem("wildCard",  globalwpw.wildCard);
714                                localStorage.setItem("supportStep", globalwpw.supportStep);
715
716                            }else if(clickintent.toLowerCase()==handle_language(wp_chatbot_obj.site_search)){
717
718                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
719                                    var shopperName= handle_language(wp_chatbot_obj.shopper_demo_name);
720                                }else{
721                                    var shopperName=globalwpw.hasNameCookie;
722                                }
723                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_search_keyword)
724                                
725                                wpwMsg.single(askEmail.replace("#name", shopperName));
726                                //Now updating the support part as .
727                                globalwpw.supportStep='search';
728                                globalwpw.wildCard=1;
729                                //keeping value in localstorage
730                                localStorage.setItem("wildCard",  globalwpw.wildCard);
731                                localStorage.setItem("supportStep",  globalwpw.supportStep);
732
733                            }else if(clickintent.toLowerCase()=='send us email'){
734
735                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
736                                    var shopperName= handle_language(wp_chatbot_obj.shopper_demo_name);
737                                }else{
738                                    var shopperName=globalwpw.hasNameCookie;
739                                }
740                                
741                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
742                                wpwMsg.single(askEmail);
743                                //Now updating the support part as .
744                                globalwpw.supportStep='email';
745                                globalwpw.wildCard=1;
746                                //keeping value in localstorage
747                                localStorage.setItem("wildCard",  globalwpw.wildCard);
748                                localStorage.setItem("supportStep",  globalwpw.supportStep);
749
750                            }else if(clickintent.toLowerCase()=='leave a feedback'){
751
752                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
753                                    var shopperName= handle_language(wp_chatbot_obj.shopper_demo_name);
754                                }else{
755                                    var shopperName=globalwpw.hasNameCookie;
756                                }
757                                var askEmail = wpwKits.randomMsg(wp_chatbot_obj.asking_email);
758                                wpwMsg.single(askEmail);
759                                //Now updating the support part as .
760                                globalwpw.supportStep='email';
761                                globalwpw.wildCard=1;
762                                //keeping value in localstorage
763                                localStorage.setItem("wildCard",  globalwpw.wildCard);
764                                localStorage.setItem("supportStep",  globalwpw.supportStep);
765
766                            }else if(clickintent.toLowerCase() == 'request callback'){
767                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
768                                    var shopperName= handle_language(globalwpw.settings.obj.shopper_demo_name);
769                                }else{
770                                    var shopperName=globalwpw.hasNameCookie;
771                                }
772                                var askEmail = wpwKits.randomMsg(wp_chatbot_obj.asking_phone);
773                                setTimeout(function(){
774                                    wpwMsg.single(askEmail);
775                                    //Now updating the support part as .
776                                    globalwpw.supportStep='phone';
777                                    globalwpw.wildCard=1;
778                                    //keeping value in localstorage
779                                    localStorage.setItem("wildCard",  globalwpw.wildCard);
780                                    localStorage.setItem("supportStep",  globalwpw.supportStep);
781                                },1000)
782                            }else if(clickintent.toLowerCase()!=''){
783
784                                globalwpw.initialize=0;
785                                globalwpw.ai_step=1;
786                                globalwpw.wildCard=0;
787                                if(e.target.innerText.trim() == wp_chatbot_obj.featured_products[wp_chatbot_obj.default_language][0]){
788                                    globalwpw.wildCard=20;
789                                }
790                                wpwAction.bot(clickintent);
791
792                            }
793
794                    //    }
795                }
796            }else{
797                $('.wp-chatbot-ball').trigger( "click" );
798            }
799
800        }
801        })
802
803        if ($('#wp-chatbot-shortcode-template-container').length == 0 && $('#wp-chatbot-chat-app-shortcode-container').length == 0) {
804            //Main wpwbot area.
805            //show it
806            $('#wp-chatbot-ball-wrapper').css({
807                'display': 'block',
808            });
809            //wpChatBot icon  position.
810            if (!window.matchMedia('(max-width: 480px)').matches) {
811                $('#wp-chatbot-chat-container').css({
812                    'right': wpChatBotVar.wp_chatbot_position_x + wpChatBotVar.wp_chatbot_position_in,
813                    'bottom': wpChatBotVar.wp_chatbot_position_y + wpChatBotVar.wp_chatbot_position_in
814                })
815            }
816            if (window.matchMedia('(max-width: 480px)').matches) {
817                $('#wp-chatbot-chat-container').css({
818                    'right': wpChatBotVar.wp_chatbot_position_mp_x + wpChatBotVar.wp_chatbot_position_mp_in,
819                    'bottom': wpChatBotVar.wp_chatbot_position_mp_y + wpChatBotVar.wp_chatbot_position_mp_in
820                });
821            };
822            //Facebook Messenger desktop
823            setTimeout(function () {
824                $('.fb_dialog').css({
825                    'right': parseInt(55 + parseInt(wpChatBotVar.wp_chatbot_position_x)) + wpChatBotVar.wp_chatbot_position_in,
826                    'bottom': parseInt(17 + parseInt(wpChatBotVar.wp_chatbot_position_y)) + wpChatBotVar.wp_chatbot_position_in,
827                    'visibility': 'visible'
828                });
829                $('.fb_dialog_content iframe').css({
830                    'right': parseInt(55 + parseInt(wpChatBotVar.wp_chatbot_position_x)) + wpChatBotVar.wp_chatbot_position_in,
831                    'bottom': parseInt(17 + parseInt(wpChatBotVar.wp_chatbot_position_y)) + wpChatBotVar.wp_chatbot_position_in
832                });
833            }, 3000);
834
835            //wpchatbot icon animation disable or enable
836            //Disable wpwBot icon Animation
837			
838            if (wpChatBotVar.disable_icon_animation == 1) {
839                $('.wp-chatbot-ball').addClass('wp-chatbot-animation-deactive');
840            } else {
841                $('.wp-chatbot-ball').addClass('wp-chatbot-animation-active');
842
843                
844                var itemHide = function () {
845                    $('.wp-chatbot-animation-active .wp-chatbot-ball-animation-switch').fadeOut(1000);
846                };
847                setTimeout(function () {
848                    itemHide()
849                }, 1000);
850
851                //Click Animation
852                $('.wp-chatbot-animation-active').on('click', function () {
853                    $('.wp-chatbot-animation-active .wp-chatbot-ball-animation-switch').fadeIn(100);
854                    setTimeout(function () {
855                        itemHide();
856                        showfloatinicon();
857                    }, 1000);
858                });
859            }
860
861            //window resize.
862            var widowH = $(window).height() - 50;
863            
864            var widowW = $(window).width();
865            if (widowW > 767 || typeof(iframe_exists)!=="undefined") {
866                if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
867                    var ballConH = parseInt(widowH * 0.5);    
868                }else{
869                    var ballConH = parseInt(widowH - 150) * 0.8;
870                }
871                
872                if( typeof(iframe_exists) !== "undefined" ){
873                    var widowH1 = screen.height - 50
874                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
875                        var ballConH = parseInt(widowH1 * 0.5);    
876                    }else{
877                        var ballConH = parseInt(widowH1 * 0.5) + 73;
878                    }
879                }
880               
881                $('.wp-chatbot-ball-inner').css({'height': ballConH + 'px'})
882                $('.wpbot-saas-live-chat').css({'height': (ballConH) + 'px'})
883                
884                $('.wpbot-saas-live-chat').width( '370px' );
885
886                if( $('.wbcaBody').length > 0 ){
887                    $('.wbcaBody').css( "height", (ballConH-30)+"px" )
888                }	
889                if( $('#wbca_chat_body').length > 0 ){
890                    $('#wbca_chat_body').css( "height", (ballConH-73)+"px" )
891                }
892				
893                $(window).resize(function () {
894                    var widowH = $(window).height() - 50;
895                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
896                        var ballConH = parseInt(widowH * 0.5);    
897                    }else{
898                        var ballConH = parseInt(widowH - 150) * 0.8;
899                    }
900
901                    if( typeof(iframe_exists) !== "undefined" ){
902                        var widowH1 = screen.height - 50
903                        if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
904                            var ballConH = parseInt(widowH1 * 0.5);    
905                        }else{
906                            var ballConH = parseInt(widowH1 * 0.5) + 73;
907                        }
908                    }
909
910                    $('.wp-chatbot-ball-inner').css({'height': ballConH + 'px'})
911                    $('.wpbot-saas-live-chat').css({'height': (ballConH) + 'px'})
912                    
913                    $('.wpbot-saas-live-chat').width( '370px' );
914
915                    if( $('.wbcaBody').length > 0 ){
916                        $('.wbcaBody').css( "height", (ballConH-30)+"px" )
917                    }	
918                    if( $('#wbca_chat_body').length > 0 ){
919                        $('#wbca_chat_body').css( "height", (ballConH-73)+"px" )
920                    }
921                });
922            };
923
924
925            if( typeof(iframe_exists)!=="undefined" ){
926                var widowH = screen.height - 50
927                if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
928                    var ballConH = parseInt(widowH * 0.5);    
929                }else{
930                    var ballConH = parseInt(widowH * 0.5) + 73;
931                }
932                $('.wp-chatbot-ball-inner').css({'height': ballConH + 'px'})
933                $('.wpbot-saas-live-chat').css({'height': (ballConH) + 'px'})
934                
935                $('.wpbot-saas-live-chat').width( '370px' );
936
937                if( $('.wbcaBody').length > 0 ){
938                    $('.wbcaBody').css( "height", (ballConH-30)+"px" )
939                }	
940                if( $('#wbca_chat_body').length > 0 ){
941                    $('#wbca_chat_body').css( "height", (ballConH-73)+"px" )
942                }
943				
944                $(window).resize(function () {
945                    var widowH = $(window).height() - (jQuery('#wp-chatbot-ball').position().top + jQuery('#wp-chatbot-ball').outerHeight(true));
946                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
947                        var ballConH = parseInt(widowH * 0.5);    
948                    }else{
949                        var ballConH = parseInt(widowH - 150) * 0.8;
950                    }
951
952                    if( typeof(iframe_exists) !== "undefined" ){
953                        var widowH1 = screen.height - 50
954                        if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
955                            var ballConH = parseInt(widowH1 * 0.5);    
956                        }else{
957                            var ballConH = parseInt(widowH1 * 0.5) + 73;
958                        }
959                    }
960
961                    $('.wp-chatbot-ball-inner').css({'height': ballConH + 'px'})
962                    $('.wpbot-saas-live-chat').css({'height': (ballConH) + 'px'})
963                    
964                    $('.wpbot-saas-live-chat').width( '370px' );
965
966                    if( $('.wbcaBody').length > 0 ){
967                        $('.wbcaBody').css( "height", (ballConH-30)+"px" )
968                    }	
969                    if( $('#wbca_chat_body').length > 0 ){
970                        $('#wbca_chat_body').css( "height", (ballConH-73)+"px" )
971                    }
972                });
973            }
974 
975			
976			if(widowH==0){
977				$('.wp-chatbot-ball-inner').css({'height': 450 + 'px'})
978			}
979			$(window).resize(function () {
980				if(widowH==0){
981					$('.wp-chatbot-ball-inner').css({'height': 450 + 'px'})
982				}
983			});
984			
985            var botimage = jQuery('#wp-chatbot-ball').find('img').attr('qcld_agent');
986
987            $(document).on('click', '.qc-new-conversation-button', function(e){
988                e.preventDefault();
989                $('.wp-chatbot-container').show();
990                $('.wp-chatbot-start-container').hide();
991                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
992                wpwbot_board_action();
993                if(!globalwpw.settings.obj.is_mobile){
994                    $("#wp-chatbot-editor").attr('disabled',false).focus();
995                }
996            })
997            $(document).on('click', '.qcld_back_to_start_menu', function(e){
998                e.preventDefault();
999                var maincontainerwidth = $('.wp-chatbot-board-container').width();
1000                var maincontainerheight = $('.wp-chatbot-container').height();
1001                if( typeof(iframe_exists)!=="undefined" ){
1002                    maincontainerwidth = '350px';
1003                }
1004                var widowW = $(window).width();
1005                if( widowW <= 768 && wpChatBotVar.mobile_full_screen==1 && typeof(iframe_exists)==="undefined" ){
1006                    $('.wp-chatbot-start-container').width( $(window).width() );
1007                    $('.wp-chatbot-start-container').height( $(window).height() - 50 );
1008                    $('.wp-chatbot-start-screen').slimScroll({
1009                        height: $(window).height() - 50,
1010                        start: 'top'
1011                    })
1012                }else{
1013                    $('.wp-chatbot-start-container').width( maincontainerwidth );
1014                    $('.wp-chatbot-start-container').height( maincontainerheight );
1015                    $('.wp-chatbot-start-screen').slimScroll({
1016                        height: maincontainerheight,
1017                        start: 'top'
1018                    })
1019                }
1020                $('.wp-chatbot-container').hide();
1021                $('.wp-chatbot-start-container').show();
1022                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').hide();
1023            })
1024            $(document).on('click', '.qcld_new_start_button', function(e){
1025                $('.wp-chatbot-container').show();
1026                $('.wp-chatbot-start-container').hide();
1027                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1028            })
1029            
1030            $(document).on('click', '#wp-chatbot-ball', function (event) {
1031                event.preventDefault();
1032				if($('.wpbot-saas-live-chat').is(':visible')){
1033					$('#wpbot_back_to_home').trigger( "click" );
1034				}
1035                
1036                if (widowW <= 1024 && wpChatBotVar.mobile_full_screen==1 && typeof insideIframe === 'undefined') {
1037                    $('.fb_dialog').hide();
1038                }
1039                
1040				if($('.active-chat-board').length>0){
1041                    $('.wp-chatbot-notification-container').hide();
1042                    if( $('.qc_wpbot_floating_main').length > 0 ){
1043                        $('.qc_wpbot_floating_main').show();
1044                    }
1045
1046                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1047                        $('#wp-chatbot-ball').show();
1048                    }
1049					$('#wp-chatbot-ball').removeClass('wpbot_chatopen_iconanimation');
1050					$('#wp-chatbot-ball').addClass('wpbot_chatclose_iconanimation');
1051					$('#wp-chatbot-ball').find('img').attr('src', botimage)		
1052                    $('.wp-chatbot-ball').css('background', '#ffffff');
1053                    if(wpChatBotVar.wp_keep_chat_window_open==1){
1054                        $.cookie('bot_window_open', 'no', { path: '/' });
1055                    }
1056                    setTimeout(function(){
1057					
1058                        var json = {
1059                            msg: 'chatbot_close',
1060                            val: (jQuery('#wp-chatbot-chat-container').height()+80)
1061                        }
1062                        sendMessageIframe(json);
1063                    },500)
1064                    $('#wp-chatbot-ball-container').removeAttr('aria-haspopup');
1065                    $('#wp-chatbot-ball-container').removeAttr('aria-expanded');
1066                    $('#wp-chatbot-ball-container').attr('aria-haspopup','');
1067                    $('#wp-chatbot-ball-container').attr('aria-expanded','false');
1068                    
1069
1070				}else{
1071
1072                    if( $('.qc_wpbot_floating_main').length > 0 ){
1073                        $('.qc_wpbot_floating_main').hide();
1074                    }
1075                    if(wpChatBotVar.auto_hide_floating_button==1){
1076                        justOpen = true;
1077                        qcwp_auto_hide_floating_buttons();
1078                    }
1079
1080                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1081                        $('#wp-chatbot-ball').hide();
1082                    }
1083					$('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1084					$('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1085					$('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1086                    //$('.wp-chatbot-ball').css('background', 'unset');
1087                    if(wpChatBotVar.wp_keep_chat_window_open==1){
1088                        $.cookie('bot_window_open', 'yes', { path: '/' });
1089                    }
1090                    
1091                    $('.wp-chatbot-notification-container').hide();
1092                    setTimeout(function(){
1093                        var json = {
1094                            msg: 'chatbot_open',
1095                            val: (jQuery('#wp-chatbot-chat-container').height()+80)
1096                        }
1097                        sendMessageIframe(json);
1098                        $('#wp-chatbot-ball-container').removeAttr('aria-haspopup');
1099                        $('#wp-chatbot-ball-container').removeAttr('aria-expanded');
1100                        $('#wp-chatbot-ball-container').attr('aria-expanded','true');
1101                        $('#wp-chatbot-ball-container').attr('aria-haspopup','');
1102                    },500)
1103				}
1104                function togglecahtwindow(){
1105                    $("#wp-chatbot-board-container").toggleClass('active-chat-board');
1106                    $('#wp-chatbot-notification-container').removeClass('wp-chatbot-notification-container-sliding');
1107                    $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
1108                }
1109                togglecahtwindow();
1110                //  setTimeout(
1111                //     togglecahtwindow,
1112                //     delay_chat_window_open);
1113                
1114                //chatbox will be open and notificaion will be closed
1115
1116                if( wpChatBotVar.start_menu_installed && wpChatBotVar.template!='template-05' && ( typeof(wpbotshortcodetemplate)==="undefined" || wpbotshortcodetemplate!='template-05' ) ){
1117                    if($('.active-chat-board').length>0){
1118                        var maincontainerwidth = $('.wp-chatbot-board-container').width();
1119                        var maincontainerheight = $('.wp-chatbot-container').height();
1120
1121                        if( typeof(iframe_exists)!=="undefined" ){
1122                            maincontainerwidth = '350px';
1123                        }
1124                        
1125                        var widowW = $(window).width();
1126                        if( widowW <= 768 && wpChatBotVar.mobile_full_screen==1 && typeof(iframe_exists)==="undefined" ){
1127                            $('.wp-chatbot-start-container').width( $(window).width() );
1128                            $('.wp-chatbot-start-container').height( $(window).height() );
1129                            $('.wp-chatbot-start-screen').slimScroll({
1130                                height: $(window).height(),
1131                                start: 'top'
1132                            })
1133                            $('.wpbot-saas-live-chat').width( $(window).width() );
1134                            $('.wpbot-saas-live-chat').height( $(window).height() - 50 );
1135                            if( $('.wbcaBody').length > 0 ){
1136                                $('.wbcaBody').css( "height", ($(window).height() - 50-30)+"px" )
1137                            }	
1138                            if( $('#wbca_chat_body').length > 0 ){
1139                                $('#wbca_chat_body').css( "height", ($(window).height() - 50-73)+"px" )
1140                            }
1141                        }else{
1142
1143                            $('.wp-chatbot-start-container').width( maincontainerwidth );
1144                            $('.wp-chatbot-start-container').height( maincontainerheight );
1145                            $('.wp-chatbot-start-screen').slimScroll({
1146                                height: maincontainerheight,
1147                                start: 'top'
1148                            })
1149                            
1150
1151                            
1152                            $('.wpbot-saas-live-chat').width( maincontainerwidth );
1153                            $('.wpbot-saas-live-chat').height( maincontainerheight );
1154                            if( $('.wbcaBody').length > 0 ){
1155                                $('.wbcaBody').css( "height", (maincontainerheight-30)+"px" )
1156                            }	
1157                            if( $('#wbca_chat_body').length > 0 ){
1158                                $('#wbca_chat_body').css( "height", (maincontainerheight-73)+"px" )
1159                            }
1160                        }
1161
1162                        if( typeof(iframe_exists)!=="undefined" ){
1163                            var widowH = screen.height - 50
1164                            if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1165                                var ballConH = parseInt(widowH - 150) * 0.8;    
1166                            }else{
1167                                var ballConH = parseInt(widowH - 150) * 0.8;
1168                            }
1169                            $('.wp-chatbot-start-container').height( ballConH );
1170                            $('.wp-chatbot-start-screen').slimScroll({
1171                                height: ballConH,
1172                                start: 'top'
1173                            })
1174                        }
1175
1176                        
1177                        $('.wp-chatbot-container').hide();
1178                        $('.wp-chatbot-start-container').show();
1179                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').hide();
1180                    }else{
1181                        $('.wp-chatbot-start-container').hide();
1182                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1183                    }
1184                }
1185                if((wpChatBotVar.template == 'template-horizontal') && !($('.wp-ch
1185atbot-start-container').is(':visible'))){
1186                    
1187                    $('.wp-chatbot-container').show();
1188                   
1189                }
1190                wpwbot_board_action();
1191
1192                
1193                
1194                if(wpChatBotVar.is_operator_online==1 && wpChatBotVar.open_livechat_window_first==1){
1195                    if($('.active-chat-board').length>0){
1196
1197                        if(wpChatBotVar.livechat_autopopulation!='1'){
1198                            if($('#wbca_signup_fullname').length>0){
1199                                if(localStorage.getItem('shopper')!==null){
1200                                    $('#wbca_signup_fullname').val(localStorage.getItem('shopper'));
1201                                }
1202                                if(localStorage.getItem('shopperemail')!==null){
1203                                    $('#wbca_signup_email').val(localStorage.getItem('shopperemail'));
1204                                }
1205                            }
1206                        }
1207                        var maincontainerwidth = $('.wp-chatbot-container').width();
1208                        var maincontainerheight = $('.wp-chatbot-container').height();
1209                        
1210                        $("#wp-chatbot-board-container").removeClass('active-chat-board');
1211                        $('.wp-chatbot-container').hide();
1212                        $('.wp-chatbot-start-container').hide();
1213                        $('.wpbot-saas-live-chat').show();
1214    
1215                    }
1216                }
1217                
1218
1219            });
1220            //wpwBot proActive start
1221            //Attention on
1222            if(wpChatBotVar.enable_meta_title==1 && handle_language(wpChatBotVar.meta_label)!="") {
1223                var MetaTitleInterval;
1224                var orginalTitle = document.title;
1225                $(document).on("mouseover", 'body', function (e) {
1226                    document.title = orginalTitle;
1227                    clearInterval(MetaTitleInterval);
1228                });
1229            }
1230            
1231            //Exit Intent
1232             if (wpChatBotVar.exit_intent_bargain_pro_single_page == 1 && wpChatBotVar.exit_intent_bargain_is_product_page ){
1233                window.addEventListener("mouseout", function (e) {
1234                    e = e ? e : window.event;
1235
1236                    // If this is an autocomplete element.
1237                    if (e.target.tagName.toLowerCase() == "input")
1238                        return;
1239
1240                    // Get the current viewport width.
1241                    var vpWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1242
1243                    // If the current mouse X position is within 50px of the right edge
1244                    // of the viewport, return.
1245                    if (e.clientX >= (vpWidth - 50))
1246                        return;
1247
1248                    // If the current mouse Y position is not within 50px of the top
1249                    // edge of the viewport, return.
1250                    if (e.clientY >= 50)
1251                        return;
1252
1253                    // Reliable, works on mouse exiting window and
1254                    // user switching active program
1255                    var from = e.relatedTarget || e.toElement;
1256                    if (!from)
1257                    //if will open once if setup from backend.
1258                        var exitIntentOpen = true;
1259                    if ($.cookie('exit_intent') == 'yes' && wpChatBotVar.exit_intent_once == 1) {
1260                        exitIntentOpen = false;
1261                    }
1262                    if ( exitIntentOpen == true) {
1263                        if (wpChatBotVar.exit_intent_handler == 0) {
1264                           
1265                           if($('.wp-saas-live-chat').is(':visible')){
1266                                return;
1267                            }
1268                           
1269                            if($('.active-chat-board').length == 0){
1270								
1271								wpChatBotVar.re_target_handler = 9;
1272
1273                                $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1274                                $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1275                                $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1276                                //$('.wp-chatbot-ball').css('background', 'unset');
1277                                $("#wp-chatbot-board-container").addClass('active-chat-board');
1278                                if($('.chat_active').length>1){
1279                                    $('.wp-chatbot-ball').trigger( "click" );
1280                                }
1281                                if($('.wp-chatbot-tpl-4-chat-trigger').length>0){
1282                                    $('.wp-chatbot-tpl-4-chat-trigger').trigger( "click" );
1283                                }
1284                                if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1285                                    $('#wp-chatbot-ball').hide();
1286                                    $(".wp-chatbot-container").animate({left: '-340px'});
1287                                }
1288                                if( $('.qc_wpbot_floating_main').length > 0 ){
1289                                    $('.qc_wpbot_floating_main').hide();
1290                                }
1291                                
1292                            }
1293
1294                            if( $('.wp-chatbot-start-container').is(':visible') ){
1295                                $('.wp-chatbot-container').show();
1296                                $('.wp-chatbot-start-container').hide();
1297                                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1298                            }else{
1299                                $('.wp-chatbot-container').show();
1300                                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1301                            }
1302                            
1303                            
1304
1305                            setTimeout(function(){
1306                                $('.active-chat-board').addClass('animated tada');
1307                                setTimeout(function(){
1308                                    $('.active-chat-board').removeClass('animated tada');
1309                                }, 1000)
1310                            }, 200)
1311                            
1312                            
1313                            wpChatBotVar.exit_intent_handler++;
1314                            wpChatBotVar.re_target_handler = 9;
1315                            wpwbot_board_action();
1316                            //Shopper Name
1317                            if (localStorage.getItem('shopper')) {
1318                                var shopper = localStorage.getItem('shopper');
1319                            } else {
1320                                var shopper = handle_language(wpChatBotVar.shopper_demo_name);
1321                            }
1322                            setTimeout(function () {
1323                                if (localStorage.getItem("wpwHitory")) {
1324                                    var confirmBtn='<span class="qcld-modal-bargin-confirm-exit-intent-btn"><span class="qcld-modal-bargin-bot-confirm-exit-intent" confirm-data="yes" >'+ handle_language(wpChatBotVar.yes) +'</span> <span> '+ handle_language(wpChatBotVar.or) +' </span><span class="qcld-chatbot-reset-btn qcld-chatbot-reset-btn-bargain"  reset-data="no">'+handle_language(wpChatBotVar.no)+'</span></span>';
1325                                    
1326                                    showing_proactive_msg(handle_language(wpChatBotVar.ret_greet) + ' ' + shopper + ', ' + handle_language(wpChatBotVar.exit_intent_bargain_msg)  + '<br><br>' + confirmBtn)
1327
1328                                } else {
1329                                    var confirmBtn='<span class="qcld-modal-bargin-confirm-exit-intent-btn"><span class="qcld-modal-bargin-bot-confirm-exit-intent" confirm-data="yes" >'+ handle_language(wpChatBotVar.yes) +'</span> <span> '+ handle_language(wpChatBotVar.or) +' </span><span class="qcld-chatbot-reset-btn qcld-chatbot-reset-btn-bargain"  reset-data="no">'+handle_language(wpChatBotVar.no)+'</span></span>';
1330                                    
1331                                    showing_proactive_double_msg(handle_language(wpChatBotVar.ret_greet) + ' ' + shopper + ', ' + handle_language(wpChatBotVar.exit_intent_bargain_msg) + '<br><br>' + confirmBtn)
1332
1333                                }
1334                                $.cookie('exit_intent', 'yes');
1335                                //pro active sound
1336                                proactive_retargeting_sound();
1337                                //Window foucus meta title change.
1338                                window_focus_change_meta_title();
1339                            }, 1000)
1340                        }
1341                    }
1342                });
1343            }else if(wpChatBotVar.enable_exit_intent == 1 && (wpChatBotVar.exitintent_all_page=='on' || (wpChatBotVar.exitintent_all_page=='off' && wpChatBotVar.exitintent_pages.indexOf(wpChatBotVar.current_pageid)>-1) || (wpChatBotVar.exitintent_all_page=='pagewise' && wpChatBotVar.exit_pagewise.page.indexOf(wpChatBotVar.current_pageid)>-1) )){
1344                window.addEventListener("mouseout", function (e) {
1345                    e = e ? e : window.event;
1346
1347                    
1348                    // If this is an autocomplete element.
1349                    if (e.target.tagName.toLowerCase() == "input")
1350                        return;
1351
1352                    // Get the current viewport width.
1353                    var vpWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1354
1355                    // If the current mouse X position is within 50px of the right edge
1356                    // of the viewport, return.
1357                    if (e.clientX >= (vpWidth - 50))
1358                        return;
1359
1360                    // If the current mouse Y position is not within 50px of the top
1361                    // edge of the viewport, return.
1362                    if (e.clientY >= 50)
1363                        return;
1364					
1365                    // Reliable, works on mouse exiting window and
1366                    // user switching active program
1367                    var from = e.relatedTarget || e.toElement;
1368                    if (!from)
1369                       //if will open once if setup from backend.
1370                        var exitIntentOpen=true;
1371                        if($.cookie('exit_intent')=='yes' && wpChatBotVar.exit_intent_once==1) {
1372                            exitIntentOpen=false;
1373                        }
1374
1375                        var exitcustomintent = wpChatBotVar.exit_intent_custom_intent;
1376                        var exitmessage = handle_language( wpChatBotVar.exit_intent_msg );
1377
1378                        if(wpChatBotVar.exitintent_all_page=='pagewise'){
1379                            var epages = wpChatBotVar.exit_pagewise.page;
1380                            var emessages = wpChatBotVar.exit_pagewise.message;
1381                            var eintent = wpChatBotVar.exit_pagewise.intent;
1382                            if(epages.indexOf(wpChatBotVar.current_pageid)>-1){
1383                                var eindex = epages.indexOf(wpChatBotVar.current_pageid);
1384                            }
1385                            if(eintent[eindex]!=''){
1386                                exitcustomintent = eintent[eindex];
1387                            }
1388                            if(emessages[eindex]!=''){
1389                                exitmessage = emessages[eindex];
1390                            }
1391
1392                        }
1393                        exitcustomintent = exitcustomintent.trim();
1394						
1395                        if (exitIntentOpen==true) {
1396                            
1397                                if(wpChatBotVar.exit_intent_handler==0 && $('.active-chat-board').length == 0){
1398
1399                                    if($('.active-chat-board').length == 0){
1400										
1401										wpChatBotVar.re_target_handler = 1;
1402										
1403                                        $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1404                                        $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1405                                        $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1406                                        //$('.wp-chatbot-ball').css('background', 'unset');
1407                                        if( $('#wp-chatbot-chat-container').hasClass('qcchatbot-template-05') ){
1408                                            jQuery('#wp-chatbot-chat-container').css({
1409                                                'transform': 'translateX(0px)'
1410                                            })
1411                                            jQuery('#wp-chatbot-ball').addClass('chat_active');
1412                                        }
1413                                        
1414
1415                                        $("#wp-chatbot-board-container").addClass('active-chat-board');
1416                                        
1417
1418                                        if($('.wp-chatbot-tpl-4-chat-trigger').length>0){
1419                                            $('.wp-chatbot-tpl-4-chat-trigger').trigger( "click" );
1420                                        }
1421                                        if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1422                                            $('#wp-chatbot-ball').hide();
1423                                            $(".wp-chatbot-container").animate({left: '-340px'});
1424                                        }
1425
1426                                        if( $('.qc_wpbot_floating_main').length > 0 ){
1427                                            $('.qc_wpbot_floating_main').hide();
1428                                        }
1429                                    }
1430
1431                                    if( $('.wp-chatbot-start-container').is(':visible') ){
1432                                        $('.wp-chatbot-container').show();
1433                                        $('.wp-chatbot-start-container').hide();
1434                                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1435                                    }else{
1436                                        $('.wp-chatbot-container').show();
1437                                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1438                                    }
1439
1440                                    setTimeout(function(){
1441                                        $('.active-chat-board').addClass('animated tada');
1442                                        setTimeout(function(){
1443                                            $('.active-chat-board').removeClass('animated tada');
1444                                        }, 1000)
1445                                    }, 200)
1446
1447                                wpChatBotVar.exit_intent_handler++;
1448                                wpChatBotVar.re_target_handler = 1;
1449                                wp_chatbot_obj.re_target_handler = 1;
1450                                wpwbot_board_action();
1451
1452                                setTimeout(function(){
1453                                    var json = {
1454                                        msg: 'chatbot_open',
1455                                        val: (jQuery('#wp-chatbot-chat-container').height()+80)
1456                                    }
1457                                    sendMessageIframe(json);
1458                                },200)
1459                                //Shopper Name
1460                                if(localStorage.getItem('shopper')){
1461                                    var shopper=localStorage.getItem('shopper');
1462                                }else{
1463                                    var shopper= handle_language(wpChatBotVar.shopper_demo_name);
1464                                }
1465                                
1466                                
1467                                setTimeout(function () {
1468                                    
1469                                    if(exitcustomintent!=''){
1470                                        
1471                                        if(exitcustomintent=='Faq'){
1472                                            globalwpw.wildCard=1;
1473                                            globalwpw.supportStep='welcome';
1474                                            wpwAction.bot('from wildcard support');
1475                                            //keeping value in localstorage
1476                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1477                                            localStorage.setItem("supportStep", globalwpw.supportStep);
1478                                            
1479                                        }else if(exitcustomintent=='Email Subscription'){
1480                                            globalwpw.wildCard=3;
1481                                            globalwpw.subscriptionStep='welcome';
1482                                            wpwTree.subscription();
1483                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1484                                            localStorage.setItem("supportStep", globalwpw.supportStep);
1485            
1486                                        }else if(exitcustomintent==handle_language(wp_chatbot_obj.site_search)){
1487            
1488                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1489                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1490                                            }else{
1491                                                var shopperName=globalwpw.hasNameCookie;
1492                                            }
1493                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_search_keyword)
1494                                            
1495                                            wpwMsg.single(askEmail.replace("#name", shopperName));
1496                                            //Now updating the support part as .
1497                                            globalwpw.supportStep='search';
1498                                            globalwpw.wildCard=1;
1499                                            //keeping value in localstorage
1500                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1501                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1502            
1503                                        }else if(exitcustomintent=='Send Us Email'){
1504            
1505                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1506                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1507                                            }else{
1508                                                var shopperName=globalwpw.hasNameCookie;
1509                                            }
1510                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1511                                            wpwMsg.single(askEmail);
1512                                            //Now updating the support part as .
1513                                            globalwpw.supportStep='email';
1514                                            globalwpw.wildCard=1;
1515                                            //keeping value in localstorage
1516                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1517                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1518            
1519                                        }else if(exitcustomintent=='Leave A Feedback'){
1520            
1521                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1522                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1523                                            }else{
1524                                                var shopperName=globalwpw.hasNameCookie;
1525                                            }
1526                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1527                                            wpwMsg.single(askEmail);
1528                                            //Now updating the support part as .
1529                                            globalwpw.supportStep='email';
1530                                            globalwpw.wildCard=1;
1531                                            //keeping value in localstorage
1532                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1533                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1534            
1535                                        }else if(exitcustomintent == 'Request Callback'){
1536                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1537                                                var shopperName=  globalwpw.settings.obj.shopper_demo_name;
1538                                            }else{
1539                                                var shopperName=globalwpw.hasNameCookie;
1540                                            }
1541                                            var askEmail=wpwKits.randomMsg(wp_chatbot_obj.asking_phone);
1542                                            setTimeout(function(){
1543                                                wpwMsg.single(askEmail);
1544                                                //Now updating the support part as .
1545                                                globalwpw.supportStep='phone';
1546                                                globalwpw.wildCard=1;
1547                                                //keeping value in localstorage
1548                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1549                                                localStorage.setItem("supportStep",  globalwpw.supportStep);
1550                                            },1000)
1551                                        }else if(exitcustomintent!=''){
1552            
1553                                            globalwpw.initialize=1;
1554                                            globalwpw.ai_step=1;
1555                                            globalwpw.wildCard=0;
1556                                            wpwAction.bot(exitcustomintent);
1557            
1558                                        }
1559
1560                                        proactive_retargeting_sound();
1561                                        //Window foucus meta title change.
1562                                        window_focus_change_meta_title();
1563                                        
1564                                    }else if(wpChatBotVar.exit_intent_email==1 && wpChatBotVar.exitintent_all_page!='pagewise'){
1565                                        globalwpw.wildCard=3;
1566                                        globalwpw.subscriptionStep='welcome';
1567                                        wpwTree.subscription('test');
1568                                        $.cookie('scroll_open','yes');
1569                                       //pro active sound
1570                                        proactive_retargeting_sound();
1571                                        //Window foucus meta title change.
1572                                        window_focus_change_meta_title();
1573                                    }else{
1574                                        
1575                                        if (localStorage.getItem("wpwHitory")) {
1576                                            showing_proactive_msg( handle_language(wpChatBotVar.ret_greet)+' '+shopper +', '+exitmessage);
1577                                        } else {
1578                                            showing_proactive_double_msg(handle_language(wpChatBotVar.ret_greet)+' '+shopper+', '+exitmessage)
1579                                        }
1580                                        $.cookie('exit_intent','yes');
1581                                        //pro active sound
1582                                        proactive_retargeting_sound();
1583                                        //Window foucus meta title change.
1584                                        window_focus_change_meta_title();
1585                                        
1586                                    }
1587
1588                                }, 1000)
1589                            }
1590                        }
1591                });
1592            }
1593            if(wpChatBotVar.enable_scroll_open==1 && (wpChatBotVar.scrollintent_all_page=='on' || (wpChatBotVar.scrollintent_all_page=='off' && wpChatBotVar.scrollintent_pages.indexOf(wpChatBotVar.current_pageid)>-1) || (wpChatBotVar.scrollintent_all_page=='pagewise' && wpChatBotVar.scroll_pagewise.page.indexOf(wpChatBotVar.current_pageid)>-1) ||  (wpChatBotVar.trigger_url_scroll != null) ) ){
1594
1595
1596                $(document).on('scroll', function (event) {
1597                        var OpenScroll=true;
1598                        //if will open once if setup from backend.
1599                       if( $.cookie('scroll_open')=='yes' && wpChatBotVar.scroll_open_once==1) {
1600                           OpenScroll=false;
1601                       }
1602                        //it will be open only for single time.
1603
1604                        var scrollcustomintent = wpChatBotVar.scroll_open_custom_intent;
1605                        var scrollmessage = handle_language( wpChatBotVar.scroll_open_msg );
1606                        var spagesurl = wpChatBotVar.trigger_url_scroll;
1607                    
1608                        if (spagesurl) {
1609                            var sindex = spagesurl.indexOf(wpChatBotVar.current_pageid);
1610                            var smessages = wpChatBotVar.exit_pagewise.message;
1611                            var sintent = wpChatBotVar.exit_pagewise.intent;
1612                            if(spagesurl.indexOf(wpChatBotVar.current_pageid)>-1){
1613                                var eindex = spagesurl.indexOf(wpChatBotVar.current_pageid);
1614                            }
1615                            if(sintent[sindex]!=''){
1616                                scrollcustomintent = sintent[sindex];
1617                            }
1618                            if(smessages[sindex]!=''){
1619                                scrollmessage = smessages[sindex];
1620                            }
1621                        }
1622                        if(wpChatBotVar.scrollintent_all_page=='pagewise'){
1623
1624                            var epages = wpChatBotVar.scroll_pagewise.page;
1625                            var emessages = wpChatBotVar.scroll_pagewise.message;
1626                            var eintent = wpChatBotVar.scroll_pagewise.intent;
1627                            if(wpChatBotVar.scroll_pagewise.page.indexOf(wpChatBotVar.current_pageid)>-1){
1628                                var eindex = wpChatBotVar.scroll_pagewise.page.indexOf(wpChatBotVar.current_pageid);
1629                            }
1630                            if(eintent[eindex]!=''){
1631                                scrollcustomintent = eintent[eindex];
1632                            }
1633                            if(emessages[eindex]!=''){
1634                                scrollmessage = emessages[eindex];
1635                            }
1636
1637                        }
1638                        if(typeof scrollcustomintent !== "undefined"){
1639                            scrollcustomintent = scrollcustomintent.trim();
1640
1641                        }
1642
1643                        if (( OpenScroll==true) && (document.getElementsByClassName("wpbot-saas-live-chat")[0].style.display != 'block')) {
1644
1645                            if(wpChatBotVar.scroll_open_handler==0 && $('.active-chat-board').length == 0 ){
1646                            
1647                                var scrollOpenVal = parseInt(($(document).height() * wpChatBotVar.scroll_open_percent) / 100);
1648                                if ($(window).scrollTop() + screen.height - 50 > scrollOpenVal) {
1649
1650                                    if($('.active-chat-board').length ==0){
1651										wpChatBotVar.re_target_handler = 2;
1652                                        wp_chatbot_obj.re_target_handler = 1;
1653
1654                                        $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1655                                        $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1656                                        $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1657                                        //$('.wp-chatbot-ball').css('background', 'unset');
1658                                        $("#wp-chatbot-board-container").addClass('active-chat-board');
1659                                        if($('.chat_active').length>1){
1660                                            $('.wp-chatbot-ball').trigger( "click" );
1661                                        }
1662                                        if($('.wp-chatbot-tpl-4-chat-trigger').length>0){
1663                                            $('.wp-chatbot-tpl-4-chat-trigger').trigger( "click" );
1664                                        }
1665                                        if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1666                                            $('#wp-chatbot-ball').hide();
1667                                            $(".wp-chatbot-container").animate({left: '-340px'});
1668                                        }
1669
1670                                        if( $('.qc_wpbot_floating_main').length > 0 ){
1671                                            $('.qc_wpbot_floating_main').hide();
1672                                        }
1673                                    }
1674
1675                                    if( $('.wp-chatbot-start-container').is(':visible') ){
1676                                        $('.wp-chatbot-container').show();
1677                                        $('.wp-chatbot-start-container').hide();
1678                                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1679                                    }else{
1680                                        $('.wp-chatbot-container').show();
1681                                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1682                                    }
1683
1684                                    setTimeout(function(){
1685                                        $('.active-chat-board').addClass('animated tada');
1686                                        setTimeout(function(){
1687                                            $('.active-chat-board').removeClass('animated tada');
1688                                        }, 1000)
1689                                    }, 200)
1690									
1691                                    wpChatBotVar.scroll_open_handler++;
1692                                    wpChatBotVar.re_target_handler = 2;
1693                                    wp_chatbot_obj.re_target_handler = 1;
1694                                    wpwbot_board_action();
1695                                    setTimeout(function(){
1696                                        var json = {
1697                                            msg: 'chatbot_open',
1698                                            val: (jQuery('#wp-chatbot-chat-container').height()+80)
1699                                        }
1700                                        sendMessageIframe(json);
1701                                    },200)
1702                                    //Shopper Name
1703                                    if(localStorage.getItem('shopper')){
1704                                        var shopper=localStorage.getItem('shopper');
1705                                    }else{
1706                                        var shopper= handle_language(wpChatBotVar.shopper_demo_name);
1707                                    }
1708                                    setTimeout(function () {
1709										
1710										if(scrollcustomintent!=''){
1711											
1712											if(scrollcustomintent=='Faq'){
1713                                                globalwpw.wildCard=1;
1714                                                globalwpw.supportStep='welcome';
1715                                                wpwAction.bot('from wildcard support');
1716                                                //keeping value in localstorage
1717                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1718                                                localStorage.setItem("supportStep", globalwpw.supportStep);
1719                                                
1720                                            }else if(scrollcustomintent=='Email Subscription'){
1721                                                globalwpw.wildCard=3;
1722                                                globalwpw.subscriptionStep='welcome';
1723                                                wpwTree.subscription();
1724                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1725                                                localStorage.setItem("supportStep", globalwpw.supportStep);
1726                
1727                                            }else if(scrollcustomintent==handle_language(wp_chatbot_obj.site_search)){
1728                
1729                                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1730                                                    var shopperName=  wp_chatbot_obj.shopper_demo_name;
1731                                                }else{
1732                                                    var shopperName=globalwpw.hasNameCookie;
1733                                                }
1734                                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_search_keyword)
1735                                                
1736                                                wpwMsg.single(askEmail.replace("#name", shopperName));
1737                                                //Now updating the support part as .
1738                                                globalwpw.supportStep='search';
1739                                                globalwpw.wildCard=1;
1740                                                //keeping value in localstorage
1741                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1742                                                localStorage.setItem("supportStep",  globalwpw.supportStep);
1743                
1744                                            }else if(scrollcustomintent=='Send Us Email'){
1745                
1746                                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1747                                                    var shopperName=  wp_chatbot_obj.shopper_demo_name;
1748                                                }else{
1749                                                    var shopperName=globalwpw.hasNameCookie;
1750                                                }
1751                                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1752                                                wpwMsg.single(askEmail);
1753                                                //Now updating the support part as .
1754                                                globalwpw.supportStep='email';
1755                                                globalwpw.wildCard=1;
1756                                                //keeping value in localstorage
1757                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1758                                                localStorage.setItem("supportStep",  globalwpw.supportStep);
1759                
1760                                            }else if(scrollcustomintent=='Leave A Feedback'){
1761                
1762                                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1763                                                    var shopperName=  wp_chatbot_obj.shopper_demo_name;
1764                                                }else{
1765                                                    var shopperName=globalwpw.hasNameCookie;
1766                                                }
1767                                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1768                                                wpwMsg.single(askEmail);
1769                                                //Now updating the support part as .
1770                                                globalwpw.supportStep='email';
1771                                                globalwpw.wildCard=1;
1772                                                //keeping value in localstorage
1773                                                localStorage.setItem("wildCard",  global
1773wpw.wildCard);
1774                                                localStorage.setItem("supportStep",  globalwpw.supportStep);
1775                
1776                                            }else if(scrollcustomintent == 'Request Callback'){
1777                                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1778                                                    var shopperName=  globalwpw.settings.obj.shopper_demo_name;
1779                                                }else{
1780                                                    var shopperName=globalwpw.hasNameCookie;
1781                                                }
1782                                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_phone);
1783                                                setTimeout(function(){
1784                                                    wpwMsg.single(askEmail);
1785                                                    //Now updating the support part as .
1786                                                    globalwpw.supportStep='phone';
1787                                                    globalwpw.wildCard=1;
1788                                                    //keeping value in localstorage
1789                                                    localStorage.setItem("wildCard",  globalwpw.wildCard);
1790                                                    localStorage.setItem("supportStep",  globalwpw.supportStep);
1791                                                },1000)
1792                                            }else if(scrollcustomintent!=''){
1793                
1794                                                globalwpw.initialize=1;
1795                                                globalwpw.ai_step=1;
1796                                                globalwpw.wildCard=0;
1797                                                wpwAction.bot(scrollcustomintent);
1798                
1799                                            }
1800    
1801                                            proactive_retargeting_sound();
1802                                            //Window foucus meta title change.
1803                                            window_focus_change_meta_title();
1804											
1805										}else if(wpChatBotVar.scroll_open_email==1 && wpChatBotVar.scrollintent_all_page!='pagewise'){
1806											globalwpw.wildCard=3;
1807											globalwpw.subscriptionStep='welcome';
1808											wpwTree.subscription('test');
1809											$.cookie('scroll_open','yes');
1810										   //pro active sound
1811											proactive_retargeting_sound();
1812											//Window foucus meta title change.
1813											window_focus_change_meta_title();
1814										}else{
1815                                            
1816											if (localStorage.getItem("wpwHitory")) {
1817												showing_proactive_msg(handle_language(wpChatBotVar.ret_greet)+' '+ shopper+', '+scrollmessage);
1818											} else {
1819												showing_proactive_double_msg(handle_language(wpChatBotVar.ret_greet)+' '+ shopper+', '+scrollmessage)
1820											}
1821											$.cookie('scroll_open','yes');
1822											//pro active sound
1823											proactive_retargeting_sound();
1824											//Window foucus meta title change.
1825											window_focus_change_meta_title();
1826										}
1827
1828                                    }, 1000)
1829                                }
1830                            }
1831                        }
1832
1833                });
1834            }
1835            if(wpChatBotVar.enable_auto_open==1 && (wpChatBotVar.autointent_all_page=='on' || (wpChatBotVar.autointent_all_page=='off' && wpChatBotVar.autointent_pages.indexOf(wpChatBotVar.current_pageid)>-1) || (wpChatBotVar.autointent_all_page=='pagewise' && wpChatBotVar.auto_pagewise.page.indexOf(wpChatBotVar.current_pageid)>-1) ||  (wpChatBotVar.trigger_url_auto != null) )){
1836                //if will open once if setup from backend.
1837                var autoOpen=true;
1838                if($.cookie('auto_open')=='yes' && wpChatBotVar.auto_open_once==1) {
1839                    autoOpen=false;
1840                }
1841
1842
1843                var autocustomintent = wpChatBotVar.auto_open_custom_intent;
1844                var automessage = handle_language( wpChatBotVar.auto_open_msg );
1845                var apagesurl = wpChatBotVar.trigger_url_auto;
1846                    
1847                if (apagesurl) {
1848                    var aindex = apagesurl.indexOf(wpChatBotVar.current_pageid);
1849                    var amessages = wpChatBotVar.auto_pagewise.message;
1850                    var aintent = wpChatBotVar.auto_pagewise.intent;
1851                    if(apagesurl.indexOf(wpChatBotVar.current_pageid)>-1){
1852                        var aindex = apagesurl.indexOf(wpChatBotVar.current_pageid);
1853                    }
1854                    if(aintent[aindex]!=''){
1855                        autocustomintent = aintent[aindex];
1856                    }
1857                    if(aintent[aindex]!=''){
1858                       automessage = amessages[eindex];
1859                    }
1860                }
1861                if(wpChatBotVar.autointent_all_page=='pagewise'){
1862                    var epages = wpChatBotVar.auto_pagewise.page;
1863                    var emessages = wpChatBotVar.auto_pagewise.message;
1864                    var eintent = wpChatBotVar.auto_pagewise.intent;
1865                    if(wpChatBotVar.auto_pagewise.page.indexOf(wpChatBotVar.current_pageid)>-1){
1866                        var eindex = wpChatBotVar.auto_pagewise.page.indexOf(wpChatBotVar.current_pageid);
1867                    }
1868                    if(eintent[eindex]!=''){
1869                        autocustomintent = eintent[eindex];
1870                    }
1871                    if(emessages[eindex]!=''){
1872                        automessage = emessages[eindex];
1873                    }
1874
1875                }
1876                if(typeof autocustomintent !== "undefined"){
1877                    autocustomintent = autocustomintent.trim();
1878
1879                }
1880
1881                if( autoOpen==true)  {
1882                    setTimeout(function (e) {
1883                        if(document.getElementsByClassName("wpbot-saas-live-chat")[0].style.display != 'block'){
1884                            if (wpChatBotVar.auto_open_handler == 0 && $('.active-chat-board').length == 0 ) {
1885                                if ($('.active-chat-board').length == 0) {
1886                                    $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1887                                    $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1888                                    $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1889                                    //$('.wp-chatbot-ball').css('background', 'unset');
1890                                    
1891                                    $("#wp-chatbot-board-container").addClass('active-chat-board');
1892                                    if($('.chat_active').length>1){
1893                                        $('.wp-chatbot-ball').trigger( "click" );
1894                                    }
1895                                    if($('.wp-chatbot-tpl-4-chat-trigger').length>0){
1896                                        $('.wp-chatbot-tpl-4-chat-trigger').trigger( "click" );
1897                                    }
1898                                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1899                                        $('#wp-chatbot-ball').hide();
1900                                        $(".wp-chatbot-container").animate({left: '-340px'});
1901                                    }
1902                                    if( $('.qc_wpbot_floating_main').length > 0 ){
1903                                        $('.qc_wpbot_floating_main').hide();
1904                                    }
1905                                }
1906
1907                                if( $('.wp-chatbot-start-container').is(':visible') ){
1908                                    $('.wp-chatbot-container').show();
1909                                    $('.wp-chatbot-start-container').hide();
1910                                    $('#wp-chatbot-integration-container .wp-ch
1910atbot-integration-button-container').show();
1911                                }else{
1912                                    $('.wp-chatbot-container').show();
1913                                    $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1914                                }
1915
1916                                setTimeout(function(){
1917                                    $('.active-chat-board').addClass('animated tada');
1918                                    setTimeout(function(){
1919                                        $('.active-chat-board').removeClass('animated tada');
1920                                    }, 1000)
1921                                }, 200)
1922
1923                                wpChatBotVar.auto_open_handler++;
1924                                wpChatBotVar.re_target_handler = 3;
1925                                wp_chatbot_obj.re_target_handler = 1;
1926                                wpwbot_board_action();
1927                                setTimeout(function(){
1928                                    var json = {
1929                                        msg: 'chatbot_open',
1930                                        val: (jQuery('#wp-chatbot-chat-container').height()+80)
1931                                    }
1932                                    sendMessageIframe(json);
1933                                },200)
1934                                //Shopper Name
1935                                if(localStorage.getItem('shopper')){
1936                                    var shopper=localStorage.getItem('shopper');
1937                                }else{
1938                                    var shopper= handle_language(wpChatBotVar.shopper_demo_name);
1939                                }
1940                                setTimeout(function () {
1941                                    
1942                                    if((typeof autocustomintent != 'undefined') &&  (autocustomintent != '')){
1943                                                
1944                                        if(autocustomintent=='Faq'){
1945                                            globalwpw.wildCard=1;
1946                                            globalwpw.supportStep='welcome';
1947                                            wpwAction.bot('from wildcard support');
1948                                            //keeping value in localstorage
1949                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1950                                            localStorage.setItem("supportStep", globalwpw.supportStep);
1951                                            
1952                                        }else if(autocustomintent=='Email Subscription'){
1953                                            globalwpw.wildCard=3;
1954                                            globalwpw.subscriptionStep='welcome';
1955                                            wpwTree.subscription();
1956                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1957                                            localStorage.setItem("supportStep", globalwpw.supportStep);
1958            
1959                                        }else if(autocustomintent==handle_language(wp_chatbot_obj.site_search)){
1960            
1961                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1962                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1963                                            }else{
1964                                                var shopperName=globalwpw.hasNameCookie;
1965                                            }
1966                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_search_keyword)
1967                                            
1968                                            wpwMsg.single(askEmail.replace("#name", shopperName));
1969                                            //Now updating the support part as .
1970                                            globalwpw.supportStep='search';
1971                                            globalwpw.wildCard=1;
1972                                            //keeping value in localstorage
1973                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1974                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1975            
1976                                        }else if(autocustomintent=='Send Us Email'){
1977            
1978                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1979                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1980                                            }else{
1981                                                var shopperName=globalwpw.hasNameCookie;
1982                                            }
1983                                            var askEmail=wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1984                                            wpwMsg.single(askEmail);
1985                                            //Now updating the support part as .
1986                                            globalwpw.supportStep='email';
1987                                            globalwpw.wildCard=1;
1988                                            //keeping value in localstorage
1989                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1990                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1991            
1992                                        }else if(autocustomintent=='Leave A Feedback'){
1993            
1994                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1995                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1996                                            }else{
1997                                                var shopperName=globalwpw.hasNameCookie;
1998                                            }
1999                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
2000                                            wpwMsg.single(askEmail);
2001                                            //Now updating the support part as .
2002                                            globalwpw.supportStep='email';
2003                                            globalwpw.wildCard=1;
2004                                            //keeping value in localstorage
2005                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
2006                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
2007            
2008                                        }else if(autocustomintent == 'Request Callback'){
2009                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
2010                                                var shopperName=  globalwpw.settings.obj.shopper_demo_name;
2011                                            }else{
2012                                                var shopperName=globalwpw.hasNameCookie;
2013                                            }
2014                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_phone);
2015                                            setTimeout(function(){
2016                                                wpwMsg.single(askEmail);
2017                                                //Now updating the support part as .
2018                                                globalwpw.supportStep='phone';
2019                                                globalwpw.wildCard=1;
2020                                                //keeping value in localstorage
2021                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
2022                                                localStorage.setItem("supportStep",  global
2022wpw.supportStep);
2023                                            },1000)
2024                                        }else if((autocustomintent!='')){
2025            
2026                                            globalwpw.initialize=1;
2027                                            globalwpw.ai_step=1;
2028                                            globalwpw.wildCard=0;
2029                                            wpwAction.bot(autocustomintent);
2030            
2031                                        }
2032
2033                                        proactive_retargeting_sound();
2034                                        //Window foucus meta title change.
2035                                        window_focus_change_meta_title();
2036                                        
2037                                    }else if(wpChatBotVar.auto_open_email==1 && wpChatBotVar.autointent_all_page!='pagewise'){
2038                                        globalwpw.wildCard=3;
2039                                        globalwpw.subscriptionStep='welcome';
2040                                        wpwTree.subscription('test');
2041                                        $.cookie('auto_open','yes');
2042                                    //pro active sound
2043                                        proactive_retargeting_sound();
2044                                        //Window foucus meta title change.
2045                                        window_focus_change_meta_title();
2046                                    }else{
2047                                        var automessage = handle_language( wpChatBotVar.auto_open_msg );
2048                                        if (localStorage.getItem("wpwHitory")) {
2049                                            showing_proactive_msg(handle_language(wpChatBotVar.ret_greet)+' '+ shopper+', '+automessage);
2050                                        } else {
2051                                            showing_proactive_double_msg(handle_language(wpChatBotVar.ret_greet)+' '+shopper+', '+automessage)
2052                                        }
2053                                        $.cookie('auto_open','yes');
2054                                        //pro active sound
2055                                        proactive_retargeting_sound();
2056                                        //Window foucus meta title change.
2057                                        window_focus_change_meta_title();
2058                                    }
2059                                    
2060                                    
2061                                    
2062                                }, 1000)
2063                            }
2064                        }
2065                    }, parseInt(wpChatBotVar.auto_open_time * 1000));
2066                }
2067            }
2068            //Retargeting for Cart to complete checkout.
2069            if(wpChatBotVar.enable_ret_user_show==1 && localStorage.getItem("wpwHitory") && $.cookie('return_user')!='yes') {
2070
2071                $.cookie('return_user','yes');
2072                var data = {'action': 'qcld_wb_chatbot_only_cart'};
2073                jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2074                    if (response.items > 0) {
2075                        if ($('.active-chat-board').length == 0) {
2076                            setTimeout(function () {
2077								$('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
2078									$('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
2079									$('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
2080									//$('.wp-chatbot-ball').css('background', 'unset');
2081                                $("#wp-chatbot-board-container").addClass('active-chat-board');
2082                                if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
2083                                    $('#wp-chatbot-ball').hide();
2084                                    $(".wp-chatbot-container").animate({left: '-340px'});
2085                                }
2086
2087                                if( $('.wp-chatbot-start-container').is(':visible') ){
2088                                    $('.wp-chatbot-container').show();
2089                                    $('.wp-chatbot-start-container').hide();
2090                                    $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
2091                                }else{
2092                                    $('.wp-chatbot-container').show();
2093                                    $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
2094                                }
2095
2096                                setTimeout(function(){
2097                                    $('.active-chat-board').addClass('animated tada');
2098                                    setTimeout(function(){
2099                                        $('.active-chat-board').removeClass('animated tada');
2100                                    }, 1000)
2101                                }, 200)
2102                                wp_chatbot_obj.re_target_handler = 1;
2103                                wpwbot_board_action();
2104                                setTimeout(function(){
2105                                    var json = {
2106                                        msg: 'chatbot_open',
2107                                        val: (jQuery('#wp-chatbot-chat-container').height()+80)
2108                                    }
2109                                    sendMessageIframe(json);
2110                                },200)
2111                                showing_proactive_msg( handle_language( wpChatBotVar.checkout_msg ) );
2112                                setTimeout(function () {
2113                                    showing_proactive_msg(response.html);
2114                                    //Window foucus meta title change.
2115                                    window_focus_change_meta_title();
2116                                }, 2000);
2117                            }, 1000);
2118
2119                            
2120                        }
2121                    }
2122                });
2123            }
2124
2125            if(wpChatBotVar.enable_inactive_time_show==1 && localStorage.getItem("wpwHitory") ) {
2126                var timeoutID;
2127
2128                function setup() {
2129                    /*jQuery(document).on("mousemove", resetTimer, false);
2130                    jQuery(document).on("mousedown", resetTimer, false);
2131                    jQuery(document).on("keypress", resetTimer, false);
2132                    jQuery(document).on("DOMMouseScroll", resetTimer, false);
2133                    jQuery(document).on("mousewheel", resetTimer, false);
2134                    jQuery(document).on("touchmove", resetTimer, false);
2135                    jQuery(document).on("MSPointerMove", resetTimer, false);
2136                    */
2137                    startTimer();
2138                }
2139                setup();
2140
2141                function startTimer() {
2142                    // wait as set from admin seconds before calling goInactive
2143                    timeoutID = window.setTimeout(goInactive, parseInt(wpChatBotVar.inactive_time*1000));
2144                }
2145
2146                function resetTimer(e) {
2147                    window.clearTimeout(timeoutID);
2148
2149                    goActive();
2150                }
2151
2152                function goInactive() {
2153                    if(wpChatBotVar.ret_inactive_user_once==1 && $.cookie('return_inactive_user')!='yes') {
2154                        $.cookie('return_inactive_user','yes');
2155                        var data = {'action': 'qcld_wb_chatbot_only_cart'};
2156                        jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2157                            if (response.items > 0) {
2158                                if ($('.active-chat-board').length == 0) {
2159                                    setTimeout(function () {
2160										$('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
2161									$('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
2162									$('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
2163									//$('.wp-chatbot-ball').css('background', 'unset');
2164                                        $("#wp-chatbot-board-container").addClass('active-chat-board');
2165
2166                                        if( $('.wp-chatbot-start-container').is(':visible') ){
2167                                            $('.wp-chatbot-container').show();
2168                                            $('.wp-chatbot-start-container').hide();
2169                                            $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
2170                                        }else{
2171                                            $('.wp-chatbot-container').show();
2172                                            $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
2173                                        }
2174
2175                                        setTimeout(function(){
2176                                            $('.active-chat-board').addClass('animated tada');
2177                                            setTimeout(function(){
2178                                                $('.active-chat-board').removeClass('animated tada');
2179                                            }, 1000)
2180                                        }, 200)
2181
2182                                        wpwbot_board_action();
2183                                        showing_proactive_msg( handle_language(wpChatBotVar.checkout_msg) );
2184                                        setTimeout(function () {
2185                                            showing_proactive_msg(response.html);
2186                                            //Window foucus meta title change.
2187                                            window_focus_change_meta_title();
2188                                        }, 2000);
2189                                    }, 2000);
2190                                }
2191                            }
2192                        });
2193                    }
2194                }
2195
2196                function goActive() {
2197                    // do something
2198
2199                    startTimer();
2200                }
2201            }
2202            //Proactive retargeting sound for auto open. scroll open and
2203            function proactive_retargeting_sound() {
2204                if(wpChatBotVar.enable_ret_sound==1){
2205                    var promise = document.querySelector('#wp-chatbot-proactive-audio').play();
2206                    if (promise !== undefined) {
2207                        promise.then(function (success) {
2208                            //success to play
2209                        }).catch(function (error) {
2210                            //some error
2211                            
2212                        });
2213                    }
2214                }
2215            }
2216
2217            //When user will be out of window and news retargetting will be shown. where opening hour, title and meta need to be set.
2218            function window_focus_change_meta_title() {
2219                if(wpChatBotVar.enable_meta_title==1 && handle_language(wpChatBotVar.meta_label)!=""  && openingHourIs==0) {
2220                    var showInactive = 0;
2221                    MetaTitleInterval = setInterval(function () {
2222                        if (showInactive == 0) {
2223                            document.title = handle_language(wpChatBotVar.meta_label);
2224                            showInactive = 1;
2225                        } else {
2226                            document.title = orginalTitle;
2227                            showInactive = 0;
2228                        }
2229                    }, 1000);
2230                }
2231            }
2232
2233            //wpwBot proActive end
2234            function wpwbot_board_action() {
2235                if (widowW <= 1024 && wpChatBotVar.mobile_full_screen==1 && typeof insideIframe === 'undefined') {//For mobile
2236                    if ($('#wp-chatbot-mobile-close').length <= 0 && wpChatBotVar.template!='template-05' && ( typeof(wpbotshortcodetemplate)==="undefined" || wpbotshortcodetemplate!='template-05' )) {
2237                        //$('.wp-chatbot-board-container').append('<div id="wp-chatbot-mobile-close">X</div>');
2238                        //$('.wp-chatbot-header').hide();
2239                    }
2240					if(wpChatBotVar.template=='template-05' || ( typeof(wpbotshortcodetemplate)!=="undefined" && wpbotshortcodetemplate=='template-05' )){
2241						
2242						$('.wp-chatbot-ball-inner').slimScroll({
2243							height: '70hv',
2244							start: 'bottom'
2245						}).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'});
2246						
2247					}else{
2248						
2249						$('.wp-chatbot-ball-inner').slimScroll({
2250							height: '100hv',
2251							start: 'bottom'
2252						}).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'});
2253						
2254						$('#wp-chatbot-chat-container').css({'bottom': '0', 'left': '0', 'right': '0'});
2255						$('#wp-chatbot-ball').hide();
2256						//Maintain inner chat box height
2257						var widowH = $(window).height();
2258						var headerH = $('.wp-chatbot-header').outerHeight();
2259						var footerH = $('.wp-chatbot-footer').outerHeight();
2260						var AppContentInner = widowH - footerH - headerH;
2261						
2262						if(wpChatBotVar.template=='template-07'){
2263							AppContentInner = (parseFloat(AppContentInner) + 2) - (parseFloat($('.wp-bot-header').height()*2));
2264						}
2265						
2266						if(wpChatBotVar.template=='template-06'){
2267							AppContentInner = (parseFloat(AppContentInner) + 2) - (parseFloat($('.wp-bot-header').height()));
2268						}
2269						
2270						
2271						$('.wp-chatbot-ball-inner').css({'height': AppContentInner + 'px'})
2272						$(this).hide();
2273						
2274					}
2275                    
2276                } else {
2277                    //$('.wp-chatbot-header').append('<div id="wp-chatbot-desktop-close">X</div>');
2278                    $('.wp-chatbot-ball-inner').slimScroll({
2279                        height: '70hv',
2280                        start: 'bottom'
2281                    }).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'});
2282                }
2283
2284                if( typeof(iframe_exists) !== "undefined" ){
2285                    var widowH1 = screen.height - 50
2286                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
2287                        var ballConH1 = parseInt(widowH1 * 0.5);    
2288                    }else{
2289                        var ballConH1 = parseInt(widowH1 * 0.5) + 73;
2290                    }
2291                    $('.wp-chatbot-ball-inner').css({'height': ballConH1 + 'px'})
2292
2293                    $('.wpbot-saas-live-chat').css({'height': (ballConH1) + 'px'})
2294                    
2295                    $('.wpbot-saas-live-chat').width( '370px' );
2296
2297                    if( $('.wbcaBody').length > 0 ){
2298                        $('.wbcaBody').css( "height", (ballConH1-30)+"px" )
2299                    }	
2300                    if( $('#wbca_chat_body').length > 0 ){
2301                        $('#wbca_chat_body').css( "height", (ballConH1-73)+"px" )
2302                    }
2303                    
2304                }
2305                
2306
2307
2308                //Here is the Plugin  to be load only for once.
2309                
2310                if (LoadwpwBotPlugin == 0) {
2311                    jQuery.wpwbot({obj: wpChatBotVar, editor_handler: textEditorHandler, preLoadingTime: wpChatBotVar.botpreloadingtime});
2312                    LoadwpwBotPlugin++;
2313
2314                    var data = {'action': 'qcld_wb_chatbot_session_count'};
2315                    jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2316                       //
2317                    });
2318                } else {
2319                    if ( localStorage.getItem("wpwHitory") == null && jQuery('#wp-chatbot-messages-container').html() == '' ) {
2320                        wpwWelcome.greeting();
2321                    }
2322                }
2323                //If product detials is open then it will be closed.
2324                $('.wp-chatbot-product-container').removeClass('active-chatbot-product-details');
2325                //Show and close notification message on ball click
2326                
2327               
2328                if ($('.active-chat-board').length != 0) {
2329                    $('#wp-chatbot-notification-container').removeClass('wp-chatbot-notification-container-sliding');
2330                    //chatbox will be open and notificaion will be closed
2331                    $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
2332                    //clearInterval(notificationInterval);
2333                } else {
2334                    if (!sessionStorage.getItem('wpChatbotNotification')) {
2335                        $('#wp-chatbot-notification-container').removeClass('wp-chatbot-notification-container-disable');
2336                        $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-sliding');
2337
2338                    }
2339                    /// clearInterval(notificationInterval);
2340                }
2341                //Messenger handling.
2342                if ($('.active-chat-board').length > 0) {
2343                    $('#wp-chatbot-integration-container').show();
2344                    if(wpChatBotVar.template=='template-07'){
2345                        $('#wp-chatbot-integration-container-07').hide();
2346                    }
2347                } else {
2348                    $('#wp-chatbot-integration-container').hide();
2349                    if(wpChatBotVar.template=='template-07'){
2350                        $('#wp-chatbot-integration-container-07').show();
2351                    }
2352                }
2353            }
2354            function showing_proactive_msg(msg){
2355                //first open then chatboard
2356                if(localStorage.getItem("wpwHitory") && ! $('.wp-ch
2356atbot-operation-option[data-option="chat"]').parent().hasClass('wp-chatbot-operation-active')){
2357                    $('.wp-chatbot-messages-wrapper').html(localStorage.getItem("wpwHitory"));
2358                    $('.wp-chatbot-operation-option').each(function(){
2359                        if($(this).attr('data-option')=='chat'){
2360                            $(this).parent().addClass('wp-chatbot-operation-active');
2361                        }else{
2362                            $(this).parent().removeClass('wp-chatbot-operation-active');
2363                        }
2364                    });
2365                }
2366                var msgContent='<li class="wp-chatbot-msg">' +
2367                    '<div class="wp-chatbot-avatar">'+
2368                    '<img src="'+wpChatBotVar.agent_image_path+'" alt="">'+
2369                    '</div>'+
2370                    '<div class="wp-chatbot-agent">'+ handle_language(wpChatBotVar.agent)+'</div>'
2371                    +'<div class="wp-chatbot-paragraph"><img class="wp-chatbot-comment-loader" src="'+wpChatBotVar.image_path+'comment.gif" alt="Typing..." /></div></li>';
2372                    if($('.wp-chatbot-comment-loader').length<1){
2373						$('#wp-chatbot-messages-container').append(msgContent);
2374					}
2375                //Scroll to the last message
2376                $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2377                msg += '<span class="qcwpbot_close_ret">X</span>';
2378                setTimeout(function(){
2379                    $('#wp-chatbot-messages-container li:last .wp-chatbot-paragraph').html(msg).css({'background-color':wpChatBotVar.proactive_bg_color});
2380                    //scroll to the last message
2381                    $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2382
2383                    setTimeout(function(){
2384                        wp_chatbot_obj.re_target_handler = 0;
2385                    }, 1000);
2386
2387                }, 2000);
2388            }
2389            function  showing_proactive_double_msg(secondMsg) {
2390                //first open then chatboard
2391                if(localStorage.getItem("wpwHitory")){
2392                    $('.wp-chatbot-messages-wrapper').html(localStorage.getItem("wpwHitory"));
2393                    $('.wp-chatbot-operation-option').each(function(){
2394                        if($(this).attr('data-option')=='chat'){
2395                            $(this).parent().addClass('wp-chatbot-operation-active');
2396                        }else{
2397                            $(this).parent().removeClass('wp-chatbot-operation-active');
2398                        }
2399                    });
2400                }
2401                
2402                var fristMsg="<strong>"+handle_language(wpChatBotVar.agent)+" </strong> "+handle_language(wpChatBotVar.agent_join);
2403                var msgContent='<li class="wp-chatbot-msg">' +
2404                    '<div class="wp-chatbot-avatar">'+
2405                    '<img src="'+wpChatBotVar.agent_image_path+'" alt="">'+
2406                    '</div>'+
2407                    '<div class="wp-chatbot-agent">'+ handle_language(wpChatBotVar.agent)+'</div>'
2408                    +'<div class="wp-chatbot-paragraph"><img class="wp-chatbot-comment-loader" src="'+wpChatBotVar.image_path+'comment.gif" alt="Typing..." /></div></li>';
2409                $('#wp-chatbot-messages-container').append(msgContent);
2410                //Scroll to the last message
2411                $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2412                secondMsg += '<span class="qcwpbot_close_ret">X</span>';
2413                setTimeout(function(){
2414                    $('#wp-chatbot-messages-container li:last .wp-chatbot-paragraph').html(fristMsg);
2415                    //Second Message with interval
2416                    $('#wp-chatbot-messages-container').append(msgContent);
2417                    //Scroll to the last message
2418                    $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2419                     setTimeout(function(){
2420                        $('#wp-chatbot-messages-container li:last .wp-chatbot-paragraph').html(secondMsg).css({'background-color':wpChatBotVar.proactive_bg_color});
2421                        //Scroll to the last message
2422                         $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2423                         
2424                         setTimeout(function(){
2425                            wpwWelcome.greeting();
2426                            setTimeout(function(){
2427                                wp_chatbot_obj.re_target_handler = 0;
2428                            }, 1000);
2429                         }, 2000)
2430                         //localStorage.getItem("wpwHitory") && globalwpw.initialize==0
2431                    }, 2000);
2432
2433                }, 2000);
2434            }
2435
2436
2437            $("#qcld-wp-chatbot-shortcode-style-css").attr("disabled", "disabled");
2438            /***
2439             * Notification Message
2440             */
2441            if ($('#wp-chatbot-notification-container').length > 0) {
2442                if (sessionStorage.getItem('wpChatbotNotification') && (sessionStorage.getItem('wpChatbotNotification') == 'removed') ){
2443                 
2444                    //if remove on the session.
2445                    $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
2446                } else {
2447                    //Notification comes with slideIn effect
2448                    $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-sliding');
2449                    //handling welcome & return user welcome msg.
2450
2451                    var welcomeMsg = '';
2452
2453                    if ($.cookie("shopper") && wpChatBotVar.disable_wp_chatbot_history!=1) {
2454                        var shopper = $.cookie("shopper");
2455                         welcomeMsg = wpChatBotVar.welcome_back[wpChatBotVar.language][0] + ' <strong>' + shopper + '!</strong>';
2456                    } else {
2457                         welcomeMsg = wpChatBotVar.welcome[wpChatBotVar.language][0] + ' <strong>' + handle_language(wpChatBotVar.host) + '!</strong>';
2458
2459                    }
2460                    $('.wp-chatbot-notification-welcome').html(welcomeMsg);
2461                    //Notifications msgs handling.
2462                    
2463                    var notifications = wpChatBotVar.notifications[wpChatBotVar.language];
2464                    var notification_intents = wpChatBotVar.notification_intents[wpChatBotVar.language]
2465                    if (notifications.length > 1) {
2466                        var totalNotMsg = wpChatBotVar.notifications[wpChatBotVar.language].length;
2467                        var notMsgIndex = 0;
2468                        var intervalTime = parseInt(wpChatBotVar.notification_interval) * 1000;
2469                        var notificationInterval = setInterval(function (e) {
2470                            notMsgIndex++;
2471                            if (totalNotMsg <= notMsgIndex) {
2472                                notMsgIndex = 0;
2473                            }
2474                            //show new notification time after every intervalTime
2475                            
2476							if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
2477								var shopperName=  wp_chatbot_obj.shopper_demo_name;
2478							}else{
2479								var shopperName=globalwpw.hasNameCookie;
2480							}
2481							
2482                            $('.wp-chatbot-notification-message').css({'opacity': 1}).html(notifications[notMsgIndex].replace("%%username%%", '<strong>'+shopperName+'</strong>'));
2483                            if(notification_intents[notMsgIndex]!='' && typeof notification_intents[notMsgIndex] !='undefined'){
2484                                $('#wp-chatbot-notification-container').attr('data-intent', notification_intents[notMsgIndex]);
2485                            }else{
2486                                $('#wp-chatbot-notification-container').removeAttr('data-intent');
2487                            }
2488                            
2489
2490                        }, intervalTime);
2491                    }else{
2492
2493						if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
2494							var shopperName=  wp_chatbot_obj.shopper_demo_name;
2495						}else{
2496							var shopperName=globalwpw.hasNameCookie;
2497						}
2498						
2499						
2500						$('.wp-chatbot-notification-message').css({'opacity': 1}).html($('.wp-chatbot-notification-message').html().replace("%%username%%", '<strong>'+shopperName+'</strong>'));
2501					}
2502
2503                    $(".wp-chatbot-notification-close").on('click', function () {
2504                        $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
2505                        //clearInterval(notificationInterval);
2506                        sessionStorage.setItem('wpChatbotNotification', 'removed');
2507                    });
2508                }
2509            }
2510        }
2511        else if ($('#wp-chatbot-shortcode-template-container').length > 0) { //Page shortcode area.
2512            $('#wp-chatbot-chat-container').css({'display': 'none'});
2513            $('#wp-chatbot-ball').hide();
2514            //Add Scroll to chat ui
2515            $('.wp-chatbot-ball-inner').slimScroll({
2516                height: '70hv',
2517                start: 'bottom'
2518            }).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'});
2519            //Add scroll to cart part
2520            var recentViewHeight = $('.wp-chatbot-container').outerHeight();
2521            if ($('.chatbot-shortcode-template-02').length == 0) {
2522                $('.wp-chatbot-cart-body').slimScroll({height: '200px', start: 'top'});
2523                $('.wp-chatbot-widget .wp-chatbot-products').slimScroll({height: '435px', start: 'top'});
2524            }
2525
2526            //Remove style of template
2527            $("#qcld-wp-chatbot-style-css").attr("disabled", "disabled");
2528            //Here is the Plugin  to be load only for once.
2529            if (LoadwpwBotPlugin == 0) {
2530                $.wpwbot({obj: wpChatBotVar, editor_handler: textEditorHandler, preLoadingTime: wpChatBotVar.botpreloadingtime});
2531                LoadwpwBotPlugin++;
2532                var data = {'action': 'qcld_wb_chatbot_session_count'};
2533                    jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2534                       //
2535                    });
2536            }
2537
2538
2539        }
2540        else if ($('#wp-chatbot-chat-app-shortcode-container').length > 0) {  //App shortcode area.
2541
2542            textEditorHandler = 1;
2543            //App UI (ball inner)
2544            setTimeout(function () {
2545                var widowH = screen.height - 50;
2546                
2547                var footerH = $('.wp-chatbot-footer').outerHeight();
2548
2549                var AppContentInner = widowH - footerH;
2550                
2551                $('#wp-chatbot-chat-app-shortcode-container .wp-chatbot-ball-inner').css({'height': AppContentInner + 'px'})
2552            }, 300);
2553            $(window).resize(function () {
2554                setTimeout(function () {
2555                    var widowH = screen.height - 50;
2556                    
2557                    var footerH = $('.wp-chatbot-footer').outerHeight();
2558                    var AppContentInner = widowH - footerH;
2559                    
2560                    $('#wp-chatbot-chat-app-shortcode-container .wp-chatbot-ball-inner').css({'height': AppContentInner + 'px'})
2561                }, 300)
2562            });
2563
2564            $('#wp-chatbot-ball').hide();
2565            //Add Scroll to chat ui
2566            $("#qcld-wp-chatbot-shortcode-style-css").attr("disabled", "disabled");
2567            $("#wp-chatbot-board-container").addClass('active-chat-board');
2568            $('.wp-chatbot-ball-inner').slimScroll({
2569                height: '55hv',
2570                start: 'bottom'
2571            }).parent().find('.slimScrollBar').css({'top': screen.height - 50 + 'px'});
2572            if (LoadwpwBotPlugin == 0) {
2573                $.wpwbot({obj: wpChatBotVar, editor_handler: textEditorHandler, preLoadingTime: wpChatBotVar.botpreloadingtime});
2574                LoadwpwBotPlugin++;
2575                var data = {'action': 'qcld_wb_chatbot_session_count'};
2576                    jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2577                       //
2578                    });
2579            }
2580            //Handling app cart and checkout
2581            $('#wp-chatbot-cart-short-code').hide();
2582            $('#wp-chatbot-checkout-short-code').hide();
2583            $(document).on('click', '.wp-chatbot-cart-link', function (event) {
2584                $('.wp-chatbot-messages-wrapper').hide();
2585                $('#wp-chatbot-checkout-short-code').hide();
2586                $('#wp-chatbot-cart-short-code').show();
2587                event.preventDefault();
2588                $('#wp-chatbot-cart-short-code').html('<img class="wp-chatbot-comment-loader" src="' + wpChatBotVar.image_path + 'comment.gif" alt="..." />');
2589                var data = {'action': 'qcld_wb_chatbot_cart_page'};
2590                jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2591                    $("#wp-chatbot-cart-short-code").html(response);
2592                });
2593            });
2594            $(document).on('click', '.wp-chatbot-checkout-link, .checkout-button', function (event) {
2595                event.preventDefault();
2596                $('.wp-chatbot-messages-wrapper').hide();
2597                $('#wp-chatbot-cart-short-code').hide();
2598                $('#wp-chatbot-checkout-short-code').show();
2599
2600
2601                $('#wp-chatbot-checkout-short-code').html('<img class="wp-chatbot-comment-loader" src="' + wpChatBotVar.image_path + 'comment.gif" alt="..." />');
2602                var data = {'action': 'qcld_wb_chatbot_checkout_page'};
2603                jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2604                    if (response.status == 'yes') {
2605                        window.location.href = response.html;
2606                    } else {
2607                        $("#wp-chatbot-checkout-short-code").html(response.html);
2608                    }
2609
2610                });
2611            });
2612            //Preventing url redirect from cart page.
2613            $(document).on('click', '#wp-chatbot-chat-app-shortcode-container .woocommerce-cart-form a', function (e) {
2614                e.preventDefault();
2615            });
2616        }
2617        //For variable product configuration
2618        var current_price_html = '';
2619        $(document).on('change', "#wp-chatbot-product-variable select ", function () {
2620            var variations = JSON.parse($("#wp-chatbot-variation-data").attr('data-product-variation'));
2621            var item_conditions = [];
2622            if(current_price_html == ''){
2623				current_price_html = $('#wp-chatbot-product-price').html();
2624			}
2625            var totalAttr = $("#wp-chatbot-product-variable select").length;
2626            var i = 1;
2627            $("#wp-chatbot-product-variable select").each(function (index, element) {
2628                var myVal = $(this).find('option:selected').val();
2629                if (myVal != "") {
2630                    item_conditions.push({
2631                        'left': 'item["variation_data"]["' + $(this).attr('name') + '"][0]',
2632                        'right': myVal
2633                    })
2634                }
2635            });
2636            var newVariation = [];
2637            for (var a = 0; variations.length > a; a++) {
2638                var item = variations[a];
2639                var item_condition = "";
2640                for (var i = 0; item_conditions.length > i; i++) {
2641
2642                    if (i > 0) {
2643                        item_condition += ' && ' + '"' + eval(item_conditions[i].left).toLowerCase() + '"' + '==' + '"' + item_conditions[i].right.toLowerCase() + '"';
2644                    } else {
2645                        item_condition += '"' + eval(item_conditions[i].left).toLowerCase() + '"' + '==' + '"' + item_conditions[i].right.toLowerCase() + '"';
2646                    }
2647                }
2648                if (eval(item_condition)) {
2649                    newVariation[0] = item;
2650                }
2651            }
2652            if (newVariation.length > 0) {
2653                $('#wp-chatbot-variation-add-to-cart').attr('variation_id', newVariation[0]['variation_id']);
2654                var priceSets = "";
2655                if (typeof newVariation[0]['variation_data']['_sale_price'] !== "undefined") {
2656                    priceSets +=   '<strong>' + newVariation[0]['variation_price'] + '</strong>';
2657                    //priceSets += '<strike>' + wpChatBotVar.currency_symbol + parseFloat(newVariation[0]['variation_data']['_regular_price'][0]).toFixed(2) + '</strike>'
2658                } else {
2659                    //priceSets += '<strong>' + wpChatBotVar.currency_symbol + parseFloat(newVariation[0]['variation_data']['_regular_price'][0]).toFixed(2) + '</strong>';
2660                    priceSets += '<strong>' + newVariation[0]['variation_price'] + '</strong>';
2661                }
2662                $('#wp-chatbot-product-price').html(priceSets);
2663            } else {
2664				$('#wp-chatbot-product-price').html(current_price_html);
2665			}
2666        });
2667
2668        if ($('.active-chat-board').length > 0) {
2669            $('#wp-chatbot-integration-container').show();
2670            if(wpChatBotVar.template=='template-07'){
2671                $('#wp-chatbot-integration-container-07').hide();
2672            }
2673        } else {
2674            $('#wp-chatbot-integration-container').hide();
2675            if(wpChatBotVar.template=='template-07'){
2676                $('#wp-chatbot-integration-container-07').show();
2677            }
2678        }
2679        //Facebook Messenger Integration
2680        
2681        //skype
2682        if (wpChatBotVar.enable_skype == 1) {
2683            $(document).on('click', '.inetegration-skype-btn', function (e) {
2684                $('#wp-chatbot-board-container').removeClass('active-chat-board');
2685                
2686                $('#wp-chatbot-integration-container').hide();
2687                if(wpChatBotVar.template=='template-07'){
2688                    $('#wp-chatbot-integration-container-07').show();
2689                }
2690            });
2691
2692        }
2693
2694
2695    });
2696	
2697	// Create IE + others compatible event handler
2698	var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
2699	var eventer = window[eventMethod];
2700	var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
2701
2702	// Listen to message from child window
2703	eventer(messageEvent,function(e) {
2704        if(e.data.msg == 'chatbot_open'){
2705            $('.wp-chatbot-notification-container').hide();
2706            //$('.wpbot-saas-live-chat').hide();
2707        }
2708        if(e.data.msg == 'chatbot_close'){
2709            if(sessionStorage.getItem('wpChatbotNotification') != 'removed' && wpChatBotVar.template!='template-05' ){
2710                $('.wp-chatbot-notification-container').show();
2711            }
2712        }
2713        // if(e.data.msg == 'parent'){
2714        //     $('#wp-chatbot-chat-container').css({
2715        //         'right': '50px',
2716        //         'bottom': '50px'
2717        //     })
2718        // }
2719
2720	},false);
2721	
2722	function sendMessageIframe(json){
2723		parent.postMessage(json,"*");
2724    }
2725    
2726   
2727});

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.