PageSourceSearch

https://www.paintcare.org/wp-content/plugins/wpbot-pro/js/qcld-wp-chatbot-front.js?ver=13.6.7

js paintcare.org collected 2026-10-01 11:29:35 UTC 147,986 bytes, 2,725 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                $("#wp-chatbot-editor").attr('disabled',false).focus();
994            })
995            $(document).on('click', '.qcld_back_to_start_menu', function(e){
996                e.preventDefault();
997                var maincontainerwidth = $('.wp-chatbot-board-container').width();
998                var maincontainerheight = $('.wp-chatbot-container').height();
999                if( typeof(iframe_exists)!=="undefined" ){
1000                    maincontainerwidth = '350px';
1001                }
1002                var widowW = $(window).width();
1003                if( widowW <= 768 && wpChatBotVar.mobile_full_screen==1 && typeof(iframe_exists)==="undefined" ){
1004                    $('.wp-chatbot-start-container').width( $(window).width() );
1005                    $('.wp-chatbot-start-container').height( $(window).height() - 50 );
1006                    $('.wp-chatbot-start-screen').slimScroll({
1007                        height: $(window).height() - 50,
1008                        start: 'top'
1009                    })
1010                }else{
1011                    $('.wp-chatbot-start-container').width( maincontainerwidth );
1012                    $('.wp-chatbot-start-container').height( maincontainerheight );
1013                    $('.wp-chatbot-start-screen').slimScroll({
1014                        height: maincontainerheight,
1015                        start: 'top'
1016                    })
1017                }
1018                $('.wp-chatbot-container').hide();
1019                $('.wp-chatbot-start-container').show();
1020                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').hide();
1021            })
1022            $(document).on('click', '.qcld_new_start_button', function(e){
1023                $('.wp-chatbot-container').show();
1024                $('.wp-chatbot-start-container').hide();
1025                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1026            })
1027            
1028            $(document).on('click', '#wp-chatbot-ball', function (event) {
1029                event.preventDefault();
1030				if($('.wpbot-saas-live-chat').is(':visible')){
1031					$('#wpbot_back_to_home').trigger( "click" );
1032				}
1033                
1034                if (widowW <= 1024 && wpChatBotVar.mobile_full_screen==1 && typeof insideIframe === 'undefined') {
1035                    $('.fb_dialog').hide();
1036                }
1037                
1038				if($('.active-chat-board').length>0){
1039                    $('.wp-chatbot-notification-container').hide();
1040                    if( $('.qc_wpbot_floating_main').length > 0 ){
1041                        $('.qc_wpbot_floating_main').show();
1042                    }
1043
1044                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1045                        $('#wp-chatbot-ball').show();
1046                    }
1047					$('#wp-chatbot-ball').removeClass('wpbot_chatopen_iconanimation');
1048					$('#wp-chatbot-ball').addClass('wpbot_chatclose_iconanimation');
1049					$('#wp-chatbot-ball').find('img').attr('src', botimage)		
1050                    $('.wp-chatbot-ball').css('background', '#ffffff');
1051                    if(wpChatBotVar.wp_keep_chat_window_open==1){
1052                        $.cookie('bot_window_open', 'no', { path: '/' });
1053                    }
1054                    setTimeout(function(){
1055					
1056                        var json = {
1057                            msg: 'chatbot_close',
1058                            val: (jQuery('#wp-chatbot-chat-container').height()+80)
1059                        }
1060                        sendMessageIframe(json);
1061                    },500)
1062                    $('#wp-chatbot-ball-container').removeAttr('aria-haspopup');
1063                    $('#wp-chatbot-ball-container').removeAttr('aria-expanded');
1064                    $('#wp-chatbot-ball-container').attr('aria-haspopup','');
1065                    $('#wp-chatbot-ball-container').attr('aria-expanded','false');
1066                    
1067
1068				}else{
1069
1070                    if( $('.qc_wpbot_floating_main').length > 0 ){
1071                        $('.qc_wpbot_floating_main').hide();
1072                    }
1073                    if(wpChatBotVar.auto_hide_floating_button==1){
1074                        justOpen = true;
1075                        qcwp_auto_hide_floating_buttons();
1076                    }
1077
1078                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1079                        $('#wp-chatbot-ball').hide();
1080                    }
1081					$('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1082					$('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1083					$('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1084                    //$('.wp-chatbot-ball').css('background', 'unset');
1085                    if(wpChatBotVar.wp_keep_chat_window_open==1){
1086                        $.cookie('bot_window_open', 'yes', { path: '/' });
1087                    }
1088                    
1089                    $('.wp-chatbot-notification-container').hide();
1090                    setTimeout(function(){
1091                        var json = {
1092                            msg: 'chatbot_open',
1093                            val: (jQuery('#wp-chatbot-chat-container').height()+80)
1094                        }
1095                        sendMessageIframe(json);
1096                        $('#wp-chatbot-ball-container').removeAttr('aria-haspopup');
1097                        $('#wp-chatbot-ball-container').removeAttr('aria-expanded');
1098                        $('#wp-chatbot-ball-container').attr('aria-expanded','true');
1099                        $('#wp-chatbot-ball-container').attr('aria-haspopup','');
1100                    },500)
1101				}
1102                function togglecahtwindow(){
1103                    $("#wp-chatbot-board-container").toggleClass('active-chat-board');
1104                    $('#wp-chatbot-notification-container').removeClass('wp-chatbot-notification-container-sliding');
1105                    $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
1106                }
1107                togglecahtwindow();
1108                //  setTimeout(
1109                //     togglecahtwindow,
1110                //     delay_chat_window_open);
1111                
1112                //chatbox will be open and notificaion will be closed
1113
1114                if( wpChatBotVar.start_menu_installed && wpChatBotVar.template!='template-05' && ( typeof(wpbotshortcodetemplate)==="undefined" || wpbotshortcodetemplate!='template-05' ) ){
1115                    if($('.active-chat-board').length>0){
1116                        var maincontainerwidth = $('.wp-chatbot-board-container').width();
1117                        var maincontainerheight = $('.wp-chatbot-container').height();
1118
1119                        if( typeof(iframe_exists)!=="undefined" ){
1120                            maincontainerwidth = '350px';
1121                        }
1122                        
1123                        var widowW = $(window).width();
1124                        if( widowW <= 768 && wpChatBotVar.mobile_full_screen==1 && typeof(iframe_exists)==="undefined" ){
1125                            $('.wp-chatbot-start-container').width( $(window).width() );
1126                            $('.wp-chatbot-start-container').height( $(window).height() );
1127                            $('.wp-chatbot-start-screen').slimScroll({
1128                                height: $(window).height(),
1129                                start: 'top'
1130                            })
1131                            $('.wpbot-saas-live-chat').width( $(window).width() );
1132                            $('.wpbot-saas-live-chat').height( $(window).height() - 50 );
1133                            if( $('.wbcaBody').length > 0 ){
1134                                $('.wbcaBody').css( "height", ($(window).height() - 50-30)+"px" )
1135                            }	
1136                            if( $('#wbca_chat_body').length > 0 ){
1137                                $('#wbca_chat_body').css( "height", ($(window).height() - 50-73)+"px" )
1138                            }
1139                        }else{
1140
1141                            $('.wp-chatbot-start-container').width( maincontainerwidth );
1142                            $('.wp-chatbot-start-container').height( maincontainerheight );
1143                            $('.wp-chatbot-start-screen').slimScroll({
1144                                height: maincontainerheight,
1145                                start: 'top'
1146                            })
1147                            
1148
1149                            
1150                            $('.wpbot-saas-live-chat').width( maincontainerwidth );
1151                            $('.wpbot-saas-live-chat').height( maincontainerheight );
1152                            if( $('.wbcaBody').length > 0 ){
1153                                $('.wbcaBody').css( "height", (maincontainerheight-30)+"px" )
1154                            }	
1155                            if( $('#wbca_chat_body').length > 0 ){
1156                                $('#wbca_chat_body').css( "height", (maincontainerheight-73)+"px" )
1157                            }
1158                        }
1159
1160                        if( typeof(iframe_exists)!=="undefined" ){
1161                            var widowH = screen.height - 50
1162                            if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1163                                var ballConH = parseInt(widowH - 150) * 0.8;    
1164                            }else{
1165                                var ballConH = parseInt(widowH - 150) * 0.8;
1166                            }
1167                            $('.wp-chatbot-start-container').height( ballConH );
1168                            $('.wp-chatbot-start-screen').slimScroll({
1169                                height: ballConH,
1170                                start: 'top'
1171                            })
1172                        }
1173
1174                        
1175                        $('.wp-chatbot-container').hide();
1176                        $('.wp-chatbot-start-container').show();
1177                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').hide();
1178                    }else{
1179                        $('.wp-chatbot-start-container').hide();
1180                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1181                    }
1182                }
1183                if((wpChatBotVar.template == 'template-horizontal') && !($('.wp-ch
1183atbot-start-container').is(':visible'))){
1184                    
1185                    $('.wp-chatbot-container').show();
1186                   
1187                }
1188                wpwbot_board_action();
1189
1190                
1191                
1192                if(wpChatBotVar.is_operator_online==1 && wpChatBotVar.open_livechat_window_first==1){
1193                    if($('.active-chat-board').length>0){
1194
1195                        if(wpChatBotVar.livechat_autopopulation!='1'){
1196                            if($('#wbca_signup_fullname').length>0){
1197                                if(localStorage.getItem('shopper')!==null){
1198                                    $('#wbca_signup_fullname').val(localStorage.getItem('shopper'));
1199                                }
1200                                if(localStorage.getItem('shopperemail')!==null){
1201                                    $('#wbca_signup_email').val(localStorage.getItem('shopperemail'));
1202                                }
1203                            }
1204                        }
1205                        var maincontainerwidth = $('.wp-chatbot-container').width();
1206                        var maincontainerheight = $('.wp-chatbot-container').height();
1207                        
1208                        $("#wp-chatbot-board-container").removeClass('active-chat-board');
1209                        $('.wp-chatbot-container').hide();
1210                        $('.wp-chatbot-start-container').hide();
1211                        $('.wpbot-saas-live-chat').show();
1212    
1213                    }
1214                }
1215                
1216
1217            });
1218            //wpwBot proActive start
1219            //Attention on
1220            if(wpChatBotVar.enable_meta_title==1 && handle_language(wpChatBotVar.meta_label)!="") {
1221                var MetaTitleInterval;
1222                var orginalTitle = document.title;
1223                $(document).on("mouseover", 'body', function (e) {
1224                    document.title = orginalTitle;
1225                    clearInterval(MetaTitleInterval);
1226                });
1227            }
1228            
1229            //Exit Intent
1230             if (wpChatBotVar.exit_intent_bargain_pro_single_page == 1 && wpChatBotVar.exit_intent_bargain_is_product_page ){
1231                window.addEventListener("mouseout", function (e) {
1232                    e = e ? e : window.event;
1233
1234                    // If this is an autocomplete element.
1235                    if (e.target.tagName.toLowerCase() == "input")
1236                        return;
1237
1238                    // Get the current viewport width.
1239                    var vpWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1240
1241                    // If the current mouse X position is within 50px of the right edge
1242                    // of the viewport, return.
1243                    if (e.clientX >= (vpWidth - 50))
1244                        return;
1245
1246                    // If the current mouse Y position is not within 50px of the top
1247                    // edge of the viewport, return.
1248                    if (e.clientY >= 50)
1249                        return;
1250
1251                    // Reliable, works on mouse exiting window and
1252                    // user switching active program
1253                    var from = e.relatedTarget || e.toElement;
1254                    if (!from)
1255                    //if will open once if setup from backend.
1256                        var exitIntentOpen = true;
1257                    if ($.cookie('exit_intent') == 'yes' && wpChatBotVar.exit_intent_once == 1) {
1258                        exitIntentOpen = false;
1259                    }
1260                    if ( exitIntentOpen == true) {
1261                        if (wpChatBotVar.exit_intent_handler == 0) {
1262                           
1263                           if($('.wp-saas-live-chat').is(':visible')){
1264                                return;
1265                            }
1266                           
1267                            if($('.active-chat-board').length == 0){
1268								
1269								wpChatBotVar.re_target_handler = 9;
1270
1271                                $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1272                                $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1273                                $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1274                                //$('.wp-chatbot-ball').css('background', 'unset');
1275                                $("#wp-chatbot-board-container").addClass('active-chat-board');
1276                                if($('.chat_active').length>1){
1277                                    $('.wp-chatbot-ball').trigger( "click" );
1278                                }
1279                                if($('.wp-chatbot-tpl-4-chat-trigger').length>0){
1280                                    $('.wp-chatbot-tpl-4-chat-trigger').trigger( "click" );
1281                                }
1282                                if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1283                                    $('#wp-chatbot-ball').hide();
1284                                    $(".wp-chatbot-container").animate({left: '-340px'});
1285                                }
1286                                if( $('.qc_wpbot_floating_main').length > 0 ){
1287                                    $('.qc_wpbot_floating_main').hide();
1288                                }
1289                                
1290                            }
1291
1292                            if( $('.wp-chatbot-start-container').is(':visible') ){
1293                                $('.wp-chatbot-container').show();
1294                                $('.wp-chatbot-start-container').hide();
1295                                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1296                            }else{
1297                                $('.wp-chatbot-container').show();
1298                                $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1299                            }
1300                            
1301                            
1302
1303                            setTimeout(function(){
1304                                $('.active-chat-board').addClass('animated tada');
1305                                setTimeout(function(){
1306                                    $('.active-chat-board').removeClass('animated tada');
1307                                }, 1000)
1308                            }, 200)
1309                            
1310                            
1311                            wpChatBotVar.exit_intent_handler++;
1312                            wpChatBotVar.re_target_handler = 9;
1313                            wpwbot_board_action();
1314                            //Shopper Name
1315                            if (localStorage.getItem('shopper')) {
1316                                var shopper = localStorage.getItem('shopper');
1317                            } else {
1318                                var shopper = handle_language(wpChatBotVar.shopper_demo_name);
1319                            }
1320                            setTimeout(function () {
1321                                if (localStorage.getItem("wpwHitory")) {
1322                                    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>';
1323                                    
1324                                    showing_proactive_msg(handle_language(wpChatBotVar.ret_greet) + ' ' + shopper + ', ' + handle_language(wpChatBotVar.exit_intent_bargain_msg)  + '<br><br>' + confirmBtn)
1325
1326                                } else {
1327                                    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>';
1328                                    
1329                                    showing_proactive_double_msg(handle_language(wpChatBotVar.ret_greet) + ' ' + shopper + ', ' + handle_language(wpChatBotVar.exit_intent_bargain_msg) + '<br><br>' + confirmBtn)
1330
1331                                }
1332                                $.cookie('exit_intent', 'yes');
1333                                //pro active sound
1334                                proactive_retargeting_sound();
1335                                //Window foucus meta title change.
1336                                window_focus_change_meta_title();
1337                            }, 1000)
1338                        }
1339                    }
1340                });
1341            }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) )){
1342                window.addEventListener("mouseout", function (e) {
1343                    e = e ? e : window.event;
1344
1345                    
1346                    // If this is an autocomplete element.
1347                    if (e.target.tagName.toLowerCase() == "input")
1348                        return;
1349
1350                    // Get the current viewport width.
1351                    var vpWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1352
1353                    // If the current mouse X position is within 50px of the right edge
1354                    // of the viewport, return.
1355                    if (e.clientX >= (vpWidth - 50))
1356                        return;
1357
1358                    // If the current mouse Y position is not within 50px of the top
1359                    // edge of the viewport, return.
1360                    if (e.clientY >= 50)
1361                        return;
1362					
1363                    // Reliable, works on mouse exiting window and
1364                    // user switching active program
1365                    var from = e.relatedTarget || e.toElement;
1366                    if (!from)
1367                       //if will open once if setup from backend.
1368                        var exitIntentOpen=true;
1369                        if($.cookie('exit_intent')=='yes' && wpChatBotVar.exit_intent_once==1) {
1370                            exitIntentOpen=false;
1371                        }
1372
1373                        var exitcustomintent = wpChatBotVar.exit_intent_custom_intent;
1374                        var exitmessage = handle_language( wpChatBotVar.exit_intent_msg );
1375
1376                        if(wpChatBotVar.exitintent_all_page=='pagewise'){
1377                            var epages = wpChatBotVar.exit_pagewise.page;
1378                            var emessages = wpChatBotVar.exit_pagewise.message;
1379                            var eintent = wpChatBotVar.exit_pagewise.intent;
1380                            if(epages.indexOf(wpChatBotVar.current_pageid)>-1){
1381                                var eindex = epages.indexOf(wpChatBotVar.current_pageid);
1382                            }
1383                            if(eintent[eindex]!=''){
1384                                exitcustomintent = eintent[eindex];
1385                            }
1386                            if(emessages[eindex]!=''){
1387                                exitmessage = emessages[eindex];
1388                            }
1389
1390                        }
1391                        exitcustomintent = exitcustomintent.trim();
1392						
1393                        if (exitIntentOpen==true) {
1394                            
1395                                if(wpChatBotVar.exit_intent_handler==0 && $('.active-chat-board').length == 0){
1396
1397                                    if($('.active-chat-board').length == 0){
1398										
1399										wpChatBotVar.re_target_handler = 1;
1400										
1401                                        $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1402                                        $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1403                                        $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1404                                        //$('.wp-chatbot-ball').css('background', 'unset');
1405                                        if( $('#wp-chatbot-chat-container').hasClass('qcchatbot-template-05') ){
1406                                            jQuery('#wp-chatbot-chat-container').css({
1407                                                'transform': 'translateX(0px)'
1408                                            })
1409                                            jQuery('#wp-chatbot-ball').addClass('chat_active');
1410                                        }
1411                                        
1412
1413                                        $("#wp-chatbot-board-container").addClass('active-chat-board');
1414                                        
1415
1416                                        if($('.wp-chatbot-tpl-4-chat-trigger').length>0){
1417                                            $('.wp-chatbot-tpl-4-chat-trigger').trigger( "click" );
1418                                        }
1419                                        if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1420                                            $('#wp-chatbot-ball').hide();
1421                                            $(".wp-chatbot-container").animate({left: '-340px'});
1422                                        }
1423
1424                                        if( $('.qc_wpbot_floating_main').length > 0 ){
1425                                            $('.qc_wpbot_floating_main').hide();
1426                                        }
1427                                    }
1428
1429                                    if( $('.wp-chatbot-start-container').is(':visible') ){
1430                                        $('.wp-chatbot-container').show();
1431                                        $('.wp-chatbot-start-container').hide();
1432                                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1433                                    }else{
1434                                        $('.wp-chatbot-container').show();
1435                                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1436                                    }
1437
1438                                    setTimeout(function(){
1439                                        $('.active-chat-board').addClass('animated tada');
1440                                        setTimeout(function(){
1441                                            $('.active-chat-board').removeClass('animated tada');
1442                                        }, 1000)
1443                                    }, 200)
1444
1445                                wpChatBotVar.exit_intent_handler++;
1446                                wpChatBotVar.re_target_handler = 1;
1447                                wp_chatbot_obj.re_target_handler = 1;
1448                                wpwbot_board_action();
1449
1450                                setTimeout(function(){
1451                                    var json = {
1452                                        msg: 'chatbot_open',
1453                                        val: (jQuery('#wp-chatbot-chat-container').height()+80)
1454                                    }
1455                                    sendMessageIframe(json);
1456                                },200)
1457                                //Shopper Name
1458                                if(localStorage.getItem('shopper')){
1459                                    var shopper=localStorage.getItem('shopper');
1460                                }else{
1461                                    var shopper= handle_language(wpChatBotVar.shopper_demo_name);
1462                                }
1463                                
1464                                
1465                                setTimeout(function () {
1466                                    
1467                                    if(exitcustomintent!=''){
1468                                        
1469                                        if(exitcustomintent=='Faq'){
1470                                            globalwpw.wildCard=1;
1471                                            globalwpw.supportStep='welcome';
1472                                            wpwAction.bot('from wildcard support');
1473                                            //keeping value in localstorage
1474                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1475                                            localStorage.setItem("supportStep", globalwpw.supportStep);
1476                                            
1477                                        }else if(exitcustomintent=='Email Subscription'){
1478                                            globalwpw.wildCard=3;
1479                                            globalwpw.subscriptionStep='welcome';
1480                                            wpwTree.subscription();
1481                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1482                                            localStorage.setItem("supportStep", globalwpw.supportStep);
1483            
1484                                        }else if(exitcustomintent==handle_language(wp_chatbot_obj.site_search)){
1485            
1486                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1487                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1488                                            }else{
1489                                                var shopperName=globalwpw.hasNameCookie;
1490                                            }
1491                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_search_keyword)
1492                                            
1493                                            wpwMsg.single(askEmail.replace("#name", shopperName));
1494                                            //Now updating the support part as .
1495                                            globalwpw.supportStep='search';
1496                                            globalwpw.wildCard=1;
1497                                            //keeping value in localstorage
1498                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1499                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1500            
1501                                        }else if(exitcustomintent=='Send Us Email'){
1502            
1503                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1504                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1505                                            }else{
1506                                                var shopperName=globalwpw.hasNameCookie;
1507                                            }
1508                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1509                                            wpwMsg.single(askEmail);
1510                                            //Now updating the support part as .
1511                                            globalwpw.supportStep='email';
1512                                            globalwpw.wildCard=1;
1513                                            //keeping value in localstorage
1514                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1515                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1516            
1517                                        }else if(exitcustomintent=='Leave A Feedback'){
1518            
1519                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1520                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1521                                            }else{
1522                                                var shopperName=globalwpw.hasNameCookie;
1523                                            }
1524                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1525                                            wpwMsg.single(askEmail);
1526                                            //Now updating the support part as .
1527                                            globalwpw.supportStep='email';
1528                                            globalwpw.wildCard=1;
1529                                            //keeping value in localstorage
1530                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1531                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1532            
1533                                        }else if(exitcustomintent == 'Request Callback'){
1534                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1535                                                var shopperName=  globalwpw.settings.obj.shopper_demo_name;
1536                                            }else{
1537                                                var shopperName=globalwpw.hasNameCookie;
1538                                            }
1539                                            var askEmail=wpwKits.randomMsg(wp_chatbot_obj.asking_phone);
1540                                            setTimeout(function(){
1541                                                wpwMsg.single(askEmail);
1542                                                //Now updating the support part as .
1543                                                globalwpw.supportStep='phone';
1544                                                globalwpw.wildCard=1;
1545                                                //keeping value in localstorage
1546                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1547                                                localStorage.setItem("supportStep",  globalwpw.supportStep);
1548                                            },1000)
1549                                        }else if(exitcustomintent!=''){
1550            
1551                                            globalwpw.initialize=1;
1552                                            globalwpw.ai_step=1;
1553                                            globalwpw.wildCard=0;
1554                                            wpwAction.bot(exitcustomintent);
1555            
1556                                        }
1557
1558                                        proactive_retargeting_sound();
1559                                        //Window foucus meta title change.
1560                                        window_focus_change_meta_title();
1561                                        
1562                                    }else if(wpChatBotVar.exit_intent_email==1 && wpChatBotVar.exitintent_all_page!='pagewise'){
1563                                        globalwpw.wildCard=3;
1564                                        globalwpw.subscriptionStep='welcome';
1565                                        wpwTree.subscription('test');
1566                                        $.cookie('scroll_open','yes');
1567                                       //pro active sound
1568                                        proactive_retargeting_sound();
1569                                        //Window foucus meta title change.
1570                                        window_focus_change_meta_title();
1571                                    }else{
1572                                        
1573                                        if (localStorage.getItem("wpwHitory")) {
1574                                            showing_proactive_msg( handle_language(wpChatBotVar.ret_greet)+' '+shopper +', '+exitmessage);
1575                                        } else {
1576                                            showing_proactive_double_msg(handle_language(wpChatBotVar.ret_greet)+' '+shopper+', '+exitmessage)
1577                                        }
1578                                        $.cookie('exit_intent','yes');
1579                                        //pro active sound
1580                                        proactive_retargeting_sound();
1581                                        //Window foucus meta title change.
1582                                        window_focus_change_meta_title();
1583                                        
1584                                    }
1585
1586                                }, 1000)
1587                            }
1588                        }
1589                });
1590            }
1591            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) ) ){
1592
1593
1594                $(document).on('scroll', function (event) {
1595                        var OpenScroll=true;
1596                        //if will open once if setup from backend.
1597                       if( $.cookie('scroll_open')=='yes' && wpChatBotVar.scroll_open_once==1) {
1598                           OpenScroll=false;
1599                       }
1600                        //it will be open only for single time.
1601
1602                        var scrollcustomintent = wpChatBotVar.scroll_open_custom_intent;
1603                        var scrollmessage = handle_language( wpChatBotVar.scroll_open_msg );
1604                        var spagesurl = wpChatBotVar.trigger_url_scroll;
1605                    
1606                        if (spagesurl) {
1607                            var sindex = spagesurl.indexOf(wpChatBotVar.current_pageid);
1608                            var smessages = wpChatBotVar.exit_pagewise.message;
1609                            var sintent = wpChatBotVar.exit_pagewise.intent;
1610                            if(spagesurl.indexOf(wpChatBotVar.current_pageid)>-1){
1611                                var eindex = spagesurl.indexOf(wpChatBotVar.current_pageid);
1612                            }
1613                            if(sintent[sindex]!=''){
1614                                scrollcustomintent = sintent[sindex];
1615                            }
1616                            if(smessages[sindex]!=''){
1617                                scrollmessage = smessages[sindex];
1618                            }
1619                        }
1620                        if(wpChatBotVar.scrollintent_all_page=='pagewise'){
1621
1622                            var epages = wpChatBotVar.scroll_pagewise.page;
1623                            var emessages = wpChatBotVar.scroll_pagewise.message;
1624                            var eintent = wpChatBotVar.scroll_pagewise.intent;
1625                            if(wpChatBotVar.scroll_pagewise.page.indexOf(wpChatBotVar.current_pageid)>-1){
1626                                var eindex = wpChatBotVar.scroll_pagewise.page.indexOf(wpChatBotVar.current_pageid);
1627                            }
1628                            if(eintent[eindex]!=''){
1629                                scrollcustomintent = eintent[eindex];
1630                            }
1631                            if(emessages[eindex]!=''){
1632                                scrollmessage = emessages[eindex];
1633                            }
1634
1635                        }
1636                        if(typeof scrollcustomintent !== "undefined"){
1637                            scrollcustomintent = scrollcustomintent.trim();
1638
1639                        }
1640
1641                        if (( OpenScroll==true) && (document.getElementsByClassName("wpbot-saas-live-chat")[0].style.display != 'block')) {
1642
1643                            if(wpChatBotVar.scroll_open_handler==0 && $('.active-chat-board').length == 0 ){
1644                            
1645                                var scrollOpenVal = parseInt(($(document).height() * wpChatBotVar.scroll_open_percent) / 100);
1646                                if ($(window).scrollTop() + screen.height - 50 > scrollOpenVal) {
1647
1648                                    if($('.active-chat-board').length ==0){
1649										wpChatBotVar.re_target_handler = 2;
1650                                        wp_chatbot_obj.re_target_handler = 1;
1651
1652                                        $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1653                                        $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1654                                        $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1655                                        //$('.wp-chatbot-ball').css('background', 'unset');
1656                                        $("#wp-chatbot-board-container").addClass('active-chat-board');
1657                                        if($('.chat_active').length>1){
1658                                            $('.wp-chatbot-ball').trigger( "click" );
1659                                        }
1660                                        if($('.wp-chatbot-tpl-4-chat-trigger').length>0){
1661                                            $('.wp-chatbot-tpl-4-chat-trigger').trigger( "click" );
1662                                        }
1663                                        if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1664                                            $('#wp-chatbot-ball').hide();
1665                                            $(".wp-chatbot-container").animate({left: '-340px'});
1666                                        }
1667
1668                                        if( $('.qc_wpbot_floating_main').length > 0 ){
1669                                            $('.qc_wpbot_floating_main').hide();
1670                                        }
1671                                    }
1672
1673                                    if( $('.wp-chatbot-start-container').is(':visible') ){
1674                                        $('.wp-chatbot-container').show();
1675                                        $('.wp-chatbot-start-container').hide();
1676                                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1677                                    }else{
1678                                        $('.wp-chatbot-container').show();
1679                                        $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1680                                    }
1681
1682                                    setTimeout(function(){
1683                                        $('.active-chat-board').addClass('animated tada');
1684                                        setTimeout(function(){
1685                                            $('.active-chat-board').removeClass('animated tada');
1686                                        }, 1000)
1687                                    }, 200)
1688									
1689                                    wpChatBotVar.scroll_open_handler++;
1690                                    wpChatBotVar.re_target_handler = 2;
1691                                    wp_chatbot_obj.re_target_handler = 1;
1692                                    wpwbot_board_action();
1693                                    setTimeout(function(){
1694                                        var json = {
1695                                            msg: 'chatbot_open',
1696                                            val: (jQuery('#wp-chatbot-chat-container').height()+80)
1697                                        }
1698                                        sendMessageIframe(json);
1699                                    },200)
1700                                    //Shopper Name
1701                                    if(localStorage.getItem('shopper')){
1702                                        var shopper=localStorage.getItem('shopper');
1703                                    }else{
1704                                        var shopper= handle_language(wpChatBotVar.shopper_demo_name);
1705                                    }
1706                                    setTimeout(function () {
1707										
1708										if(scrollcustomintent!=''){
1709											
1710											if(scrollcustomintent=='Faq'){
1711                                                globalwpw.wildCard=1;
1712                                                globalwpw.supportStep='welcome';
1713                                                wpwAction.bot('from wildcard support');
1714                                                //keeping value in localstorage
1715                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1716                                                localStorage.setItem("supportStep", globalwpw.supportStep);
1717                                                
1718                                            }else if(scrollcustomintent=='Email Subscription'){
1719                                                globalwpw.wildCard=3;
1720                                                globalwpw.subscriptionStep='welcome';
1721                                                wpwTree.subscription();
1722                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1723                                                localStorage.setItem("supportStep", globalwpw.supportStep);
1724                
1725                                            }else if(scrollcustomintent==handle_language(wp_chatbot_obj.site_search)){
1726                
1727                                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1728                                                    var shopperName=  wp_chatbot_obj.shopper_demo_name;
1729                                                }else{
1730                                                    var shopperName=globalwpw.hasNameCookie;
1731                                                }
1732                                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_search_keyword)
1733                                                
1734                                                wpwMsg.single(askEmail.replace("#name", shopperName));
1735                                                //Now updating the support part as .
1736                                                globalwpw.supportStep='search';
1737                                                globalwpw.wildCard=1;
1738                                                //keeping value in localstorage
1739                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1740                                                localStorage.setItem("supportStep",  globalwpw.supportStep);
1741                
1742                                            }else if(scrollcustomintent=='Send Us Email'){
1743                
1744                                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1745                                                    var shopperName=  wp_chatbot_obj.shopper_demo_name;
1746                                                }else{
1747                                                    var shopperName=globalwpw.hasNameCookie;
1748                                                }
1749                                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1750                                                wpwMsg.single(askEmail);
1751                                                //Now updating the support part as .
1752                                                globalwpw.supportStep='email';
1753                                                globalwpw.wildCard=1;
1754                                                //keeping value in localstorage
1755                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
1756                                                localStorage.setItem("supportStep",  globalwpw.supportStep);
1757                
1758                                            }else if(scrollcustomintent=='Leave A Feedback'){
1759                
1760                                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1761                                                    var shopperName=  wp_chatbot_obj.shopper_demo_name;
1762                                                }else{
1763                                                    var shopperName=globalwpw.hasNameCookie;
1764                                                }
1765                                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1766                                                wpwMsg.single(askEmail);
1767                                                //Now updating the support part as .
1768                                                globalwpw.supportStep='email';
1769                                                globalwpw.wildCard=1;
1770                                                //keeping value in localstorage
1771                                                localStorage.setItem("wildCard",  global
1771wpw.wildCard);
1772                                                localStorage.setItem("supportStep",  globalwpw.supportStep);
1773                
1774                                            }else if(scrollcustomintent == 'Request Callback'){
1775                                                if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1776                                                    var shopperName=  globalwpw.settings.obj.shopper_demo_name;
1777                                                }else{
1778                                                    var shopperName=globalwpw.hasNameCookie;
1779                                                }
1780                                                var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_phone);
1781                                                setTimeout(function(){
1782                                                    wpwMsg.single(askEmail);
1783                                                    //Now updating the support part as .
1784                                                    globalwpw.supportStep='phone';
1785                                                    globalwpw.wildCard=1;
1786                                                    //keeping value in localstorage
1787                                                    localStorage.setItem("wildCard",  globalwpw.wildCard);
1788                                                    localStorage.setItem("supportStep",  globalwpw.supportStep);
1789                                                },1000)
1790                                            }else if(scrollcustomintent!=''){
1791                
1792                                                globalwpw.initialize=1;
1793                                                globalwpw.ai_step=1;
1794                                                globalwpw.wildCard=0;
1795                                                wpwAction.bot(scrollcustomintent);
1796                
1797                                            }
1798    
1799                                            proactive_retargeting_sound();
1800                                            //Window foucus meta title change.
1801                                            window_focus_change_meta_title();
1802											
1803										}else if(wpChatBotVar.scroll_open_email==1 && wpChatBotVar.scrollintent_all_page!='pagewise'){
1804											globalwpw.wildCard=3;
1805											globalwpw.subscriptionStep='welcome';
1806											wpwTree.subscription('test');
1807											$.cookie('scroll_open','yes');
1808										   //pro active sound
1809											proactive_retargeting_sound();
1810											//Window foucus meta title change.
1811											window_focus_change_meta_title();
1812										}else{
1813                                            
1814											if (localStorage.getItem("wpwHitory")) {
1815												showing_proactive_msg(handle_language(wpChatBotVar.ret_greet)+' '+ shopper+', '+scrollmessage);
1816											} else {
1817												showing_proactive_double_msg(handle_language(wpChatBotVar.ret_greet)+' '+ shopper+', '+scrollmessage)
1818											}
1819											$.cookie('scroll_open','yes');
1820											//pro active sound
1821											proactive_retargeting_sound();
1822											//Window foucus meta title change.
1823											window_focus_change_meta_title();
1824										}
1825
1826                                    }, 1000)
1827                                }
1828                            }
1829                        }
1830
1831                });
1832            }
1833            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) )){
1834                //if will open once if setup from backend.
1835                var autoOpen=true;
1836                if($.cookie('auto_open')=='yes' && wpChatBotVar.auto_open_once==1) {
1837                    autoOpen=false;
1838                }
1839
1840
1841                var autocustomintent = wpChatBotVar.auto_open_custom_intent;
1842                var automessage = handle_language( wpChatBotVar.auto_open_msg );
1843                var apagesurl = wpChatBotVar.trigger_url_auto;
1844                    
1845                if (apagesurl) {
1846                    var aindex = apagesurl.indexOf(wpChatBotVar.current_pageid);
1847                    var amessages = wpChatBotVar.auto_pagewise.message;
1848                    var aintent = wpChatBotVar.auto_pagewise.intent;
1849                    if(apagesurl.indexOf(wpChatBotVar.current_pageid)>-1){
1850                        var aindex = apagesurl.indexOf(wpChatBotVar.current_pageid);
1851                    }
1852                    if(aintent[aindex]!=''){
1853                        autocustomintent = aintent[aindex];
1854                    }
1855                    if(aintent[aindex]!=''){
1856                       automessage = amessages[eindex];
1857                    }
1858                }
1859                if(wpChatBotVar.autointent_all_page=='pagewise'){
1860                    var epages = wpChatBotVar.auto_pagewise.page;
1861                    var emessages = wpChatBotVar.auto_pagewise.message;
1862                    var eintent = wpChatBotVar.auto_pagewise.intent;
1863                    if(wpChatBotVar.auto_pagewise.page.indexOf(wpChatBotVar.current_pageid)>-1){
1864                        var eindex = wpChatBotVar.auto_pagewise.page.indexOf(wpChatBotVar.current_pageid);
1865                    }
1866                    if(eintent[eindex]!=''){
1867                        autocustomintent = eintent[eindex];
1868                    }
1869                    if(emessages[eindex]!=''){
1870                        automessage = emessages[eindex];
1871                    }
1872
1873                }
1874                if(typeof autocustomintent !== "undefined"){
1875                    autocustomintent = autocustomintent.trim();
1876
1877                }
1878
1879                if( autoOpen==true)  {
1880                    setTimeout(function (e) {
1881                        if(document.getElementsByClassName("wpbot-saas-live-chat")[0].style.display != 'block'){
1882                            if (wpChatBotVar.auto_open_handler == 0 && $('.active-chat-board').length == 0 ) {
1883                                if ($('.active-chat-board').length == 0) {
1884                                    $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
1885                                    $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
1886                                    $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
1887                                    //$('.wp-chatbot-ball').css('background', 'unset');
1888                                    
1889                                    $("#wp-chatbot-board-container").addClass('active-chat-board');
1890                                    if($('.chat_active').length>1){
1891                                        $('.wp-chatbot-ball').trigger( "click" );
1892                                    }
1893                                    if($('.wp-chatbot-tpl-4-chat-trigger').length>0){
1894                                        $('.wp-chatbot-tpl-4-chat-trigger').trigger( "click" );
1895                                    }
1896                                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
1897                                        $('#wp-chatbot-ball').hide();
1898                                        $(".wp-chatbot-container").animate({left: '-340px'});
1899                                    }
1900                                    if( $('.qc_wpbot_floating_main').length > 0 ){
1901                                        $('.qc_wpbot_floating_main').hide();
1902                                    }
1903                                }
1904
1905                                if( $('.wp-chatbot-start-container').is(':visible') ){
1906                                    $('.wp-chatbot-container').show();
1907                                    $('.wp-chatbot-start-container').hide();
1908                                    $('#wp-chatbot-integration-container .wp-ch
1908atbot-integration-button-container').show();
1909                                }else{
1910                                    $('.wp-chatbot-container').show();
1911                                    $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
1912                                }
1913
1914                                setTimeout(function(){
1915                                    $('.active-chat-board').addClass('animated tada');
1916                                    setTimeout(function(){
1917                                        $('.active-chat-board').removeClass('animated tada');
1918                                    }, 1000)
1919                                }, 200)
1920
1921                                wpChatBotVar.auto_open_handler++;
1922                                wpChatBotVar.re_target_handler = 3;
1923                                wp_chatbot_obj.re_target_handler = 1;
1924                                wpwbot_board_action();
1925                                setTimeout(function(){
1926                                    var json = {
1927                                        msg: 'chatbot_open',
1928                                        val: (jQuery('#wp-chatbot-chat-container').height()+80)
1929                                    }
1930                                    sendMessageIframe(json);
1931                                },200)
1932                                //Shopper Name
1933                                if(localStorage.getItem('shopper')){
1934                                    var shopper=localStorage.getItem('shopper');
1935                                }else{
1936                                    var shopper= handle_language(wpChatBotVar.shopper_demo_name);
1937                                }
1938                                setTimeout(function () {
1939                                    
1940                                    if((typeof autocustomintent != 'undefined') &&  (autocustomintent != '')){
1941                                                
1942                                        if(autocustomintent=='Faq'){
1943                                            globalwpw.wildCard=1;
1944                                            globalwpw.supportStep='welcome';
1945                                            wpwAction.bot('from wildcard support');
1946                                            //keeping value in localstorage
1947                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1948                                            localStorage.setItem("supportStep", globalwpw.supportStep);
1949                                            
1950                                        }else if(autocustomintent=='Email Subscription'){
1951                                            globalwpw.wildCard=3;
1952                                            globalwpw.subscriptionStep='welcome';
1953                                            wpwTree.subscription();
1954                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1955                                            localStorage.setItem("supportStep", globalwpw.supportStep);
1956            
1957                                        }else if(autocustomintent==handle_language(wp_chatbot_obj.site_search)){
1958            
1959                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1960                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1961                                            }else{
1962                                                var shopperName=globalwpw.hasNameCookie;
1963                                            }
1964                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_search_keyword)
1965                                            
1966                                            wpwMsg.single(askEmail.replace("#name", shopperName));
1967                                            //Now updating the support part as .
1968                                            globalwpw.supportStep='search';
1969                                            globalwpw.wildCard=1;
1970                                            //keeping value in localstorage
1971                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1972                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1973            
1974                                        }else if(autocustomintent=='Send Us Email'){
1975            
1976                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1977                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1978                                            }else{
1979                                                var shopperName=globalwpw.hasNameCookie;
1980                                            }
1981                                            var askEmail=wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1982                                            wpwMsg.single(askEmail);
1983                                            //Now updating the support part as .
1984                                            globalwpw.supportStep='email';
1985                                            globalwpw.wildCard=1;
1986                                            //keeping value in localstorage
1987                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
1988                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
1989            
1990                                        }else if(autocustomintent=='Leave A Feedback'){
1991            
1992                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
1993                                                var shopperName=  wp_chatbot_obj.shopper_demo_name;
1994                                            }else{
1995                                                var shopperName=globalwpw.hasNameCookie;
1996                                            }
1997                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_email);
1998                                            wpwMsg.single(askEmail);
1999                                            //Now updating the support part as .
2000                                            globalwpw.supportStep='email';
2001                                            globalwpw.wildCard=1;
2002                                            //keeping value in localstorage
2003                                            localStorage.setItem("wildCard",  globalwpw.wildCard);
2004                                            localStorage.setItem("supportStep",  globalwpw.supportStep);
2005            
2006                                        }else if(autocustomintent == 'Request Callback'){
2007                                            if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
2008                                                var shopperName=  globalwpw.settings.obj.shopper_demo_name;
2009                                            }else{
2010                                                var shopperName=globalwpw.hasNameCookie;
2011                                            }
2012                                            var askEmail= wpwKits.randomMsg(wp_chatbot_obj.asking_phone);
2013                                            setTimeout(function(){
2014                                                wpwMsg.single(askEmail);
2015                                                //Now updating the support part as .
2016                                                globalwpw.supportStep='phone';
2017                                                globalwpw.wildCard=1;
2018                                                //keeping value in localstorage
2019                                                localStorage.setItem("wildCard",  globalwpw.wildCard);
2020                                                localStorage.setItem("supportStep",  global
2020wpw.supportStep);
2021                                            },1000)
2022                                        }else if((autocustomintent!='')){
2023            
2024                                            globalwpw.initialize=1;
2025                                            globalwpw.ai_step=1;
2026                                            globalwpw.wildCard=0;
2027                                            wpwAction.bot(autocustomintent);
2028            
2029                                        }
2030
2031                                        proactive_retargeting_sound();
2032                                        //Window foucus meta title change.
2033                                        window_focus_change_meta_title();
2034                                        
2035                                    }else if(wpChatBotVar.auto_open_email==1 && wpChatBotVar.autointent_all_page!='pagewise'){
2036                                        globalwpw.wildCard=3;
2037                                        globalwpw.subscriptionStep='welcome';
2038                                        wpwTree.subscription('test');
2039                                        $.cookie('auto_open','yes');
2040                                    //pro active sound
2041                                        proactive_retargeting_sound();
2042                                        //Window foucus meta title change.
2043                                        window_focus_change_meta_title();
2044                                    }else{
2045                                        var automessage = handle_language( wpChatBotVar.auto_open_msg );
2046                                        if (localStorage.getItem("wpwHitory")) {
2047                                            showing_proactive_msg(handle_language(wpChatBotVar.ret_greet)+' '+ shopper+', '+automessage);
2048                                        } else {
2049                                            showing_proactive_double_msg(handle_language(wpChatBotVar.ret_greet)+' '+shopper+', '+automessage)
2050                                        }
2051                                        $.cookie('auto_open','yes');
2052                                        //pro active sound
2053                                        proactive_retargeting_sound();
2054                                        //Window foucus meta title change.
2055                                        window_focus_change_meta_title();
2056                                    }
2057                                    
2058                                    
2059                                    
2060                                }, 1000)
2061                            }
2062                        }
2063                    }, parseInt(wpChatBotVar.auto_open_time * 1000));
2064                }
2065            }
2066            //Retargeting for Cart to complete checkout.
2067            if(wpChatBotVar.enable_ret_user_show==1 && localStorage.getItem("wpwHitory") && $.cookie('return_user')!='yes') {
2068
2069                $.cookie('return_user','yes');
2070                var data = {'action': 'qcld_wb_chatbot_only_cart'};
2071                jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2072                    if (response.items > 0) {
2073                        if ($('.active-chat-board').length == 0) {
2074                            setTimeout(function () {
2075								$('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
2076									$('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
2077									$('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
2078									//$('.wp-chatbot-ball').css('background', 'unset');
2079                                $("#wp-chatbot-board-container").addClass('active-chat-board');
2080                                if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
2081                                    $('#wp-chatbot-ball').hide();
2082                                    $(".wp-chatbot-container").animate({left: '-340px'});
2083                                }
2084
2085                                if( $('.wp-chatbot-start-container').is(':visible') ){
2086                                    $('.wp-chatbot-container').show();
2087                                    $('.wp-chatbot-start-container').hide();
2088                                    $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
2089                                }else{
2090                                    $('.wp-chatbot-container').show();
2091                                    $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
2092                                }
2093
2094                                setTimeout(function(){
2095                                    $('.active-chat-board').addClass('animated tada');
2096                                    setTimeout(function(){
2097                                        $('.active-chat-board').removeClass('animated tada');
2098                                    }, 1000)
2099                                }, 200)
2100                                wp_chatbot_obj.re_target_handler = 1;
2101                                wpwbot_board_action();
2102                                setTimeout(function(){
2103                                    var json = {
2104                                        msg: 'chatbot_open',
2105                                        val: (jQuery('#wp-chatbot-chat-container').height()+80)
2106                                    }
2107                                    sendMessageIframe(json);
2108                                },200)
2109                                showing_proactive_msg( handle_language( wpChatBotVar.checkout_msg ) );
2110                                setTimeout(function () {
2111                                    showing_proactive_msg(response.html);
2112                                    //Window foucus meta title change.
2113                                    window_focus_change_meta_title();
2114                                }, 2000);
2115                            }, 1000);
2116
2117                            
2118                        }
2119                    }
2120                });
2121            }
2122
2123            if(wpChatBotVar.enable_inactive_time_show==1 && localStorage.getItem("wpwHitory") ) {
2124                var timeoutID;
2125
2126                function setup() {
2127                    /*jQuery(document).on("mousemove", resetTimer, false);
2128                    jQuery(document).on("mousedown", resetTimer, false);
2129                    jQuery(document).on("keypress", resetTimer, false);
2130                    jQuery(document).on("DOMMouseScroll", resetTimer, false);
2131                    jQuery(document).on("mousewheel", resetTimer, false);
2132                    jQuery(document).on("touchmove", resetTimer, false);
2133                    jQuery(document).on("MSPointerMove", resetTimer, false);
2134                    */
2135                    startTimer();
2136                }
2137                setup();
2138
2139                function startTimer() {
2140                    // wait as set from admin seconds before calling goInactive
2141                    timeoutID = window.setTimeout(goInactive, parseInt(wpChatBotVar.inactive_time*1000));
2142                }
2143
2144                function resetTimer(e) {
2145                    window.clearTimeout(timeoutID);
2146
2147                    goActive();
2148                }
2149
2150                function goInactive() {
2151                    if(wpChatBotVar.ret_inactive_user_once==1 && $.cookie('return_inactive_user')!='yes') {
2152                        $.cookie('return_inactive_user','yes');
2153                        var data = {'action': 'qcld_wb_chatbot_only_cart'};
2154                        jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2155                            if (response.items > 0) {
2156                                if ($('.active-chat-board').length == 0) {
2157                                    setTimeout(function () {
2158										$('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation');
2159									$('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation');
2160									$('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png');
2161									//$('.wp-chatbot-ball').css('background', 'unset');
2162                                        $("#wp-chatbot-board-container").addClass('active-chat-board');
2163
2164                                        if( $('.wp-chatbot-start-container').is(':visible') ){
2165                                            $('.wp-chatbot-container').show();
2166                                            $('.wp-chatbot-start-container').hide();
2167                                            $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
2168                                        }else{
2169                                            $('.wp-chatbot-container').show();
2170                                            $('#wp-chatbot-integration-container .wp-chatbot-integration-button-container').show();
2171                                        }
2172
2173                                        setTimeout(function(){
2174                                            $('.active-chat-board').addClass('animated tada');
2175                                            setTimeout(function(){
2176                                                $('.active-chat-board').removeClass('animated tada');
2177                                            }, 1000)
2178                                        }, 200)
2179
2180                                        wpwbot_board_action();
2181                                        showing_proactive_msg( handle_language(wpChatBotVar.checkout_msg) );
2182                                        setTimeout(function () {
2183                                            showing_proactive_msg(response.html);
2184                                            //Window foucus meta title change.
2185                                            window_focus_change_meta_title();
2186                                        }, 2000);
2187                                    }, 2000);
2188                                }
2189                            }
2190                        });
2191                    }
2192                }
2193
2194                function goActive() {
2195                    // do something
2196
2197                    startTimer();
2198                }
2199            }
2200            //Proactive retargeting sound for auto open. scroll open and
2201            function proactive_retargeting_sound() {
2202                if(wpChatBotVar.enable_ret_sound==1){
2203                    var promise = document.querySelector('#wp-chatbot-proactive-audio').play();
2204                    if (promise !== undefined) {
2205                        promise.then(function (success) {
2206                            //success to play
2207                        }).catch(function (error) {
2208                            //some error
2209                            
2210                        });
2211                    }
2212                }
2213            }
2214
2215            //When user will be out of window and news retargetting will be shown. where opening hour, title and meta need to be set.
2216            function window_focus_change_meta_title() {
2217                if(wpChatBotVar.enable_meta_title==1 && handle_language(wpChatBotVar.meta_label)!=""  && openingHourIs==0) {
2218                    var showInactive = 0;
2219                    MetaTitleInterval = setInterval(function () {
2220                        if (showInactive == 0) {
2221                            document.title = handle_language(wpChatBotVar.meta_label);
2222                            showInactive = 1;
2223                        } else {
2224                            document.title = orginalTitle;
2225                            showInactive = 0;
2226                        }
2227                    }, 1000);
2228                }
2229            }
2230
2231            //wpwBot proActive end
2232            function wpwbot_board_action() {
2233                if (widowW <= 1024 && wpChatBotVar.mobile_full_screen==1 && typeof insideIframe === 'undefined') {//For mobile
2234                    if ($('#wp-chatbot-mobile-close').length <= 0 && wpChatBotVar.template!='template-05' && ( typeof(wpbotshortcodetemplate)==="undefined" || wpbotshortcodetemplate!='template-05' )) {
2235                        //$('.wp-chatbot-board-container').append('<div id="wp-chatbot-mobile-close">X</div>');
2236                        //$('.wp-chatbot-header').hide();
2237                    }
2238					if(wpChatBotVar.template=='template-05' || ( typeof(wpbotshortcodetemplate)!=="undefined" && wpbotshortcodetemplate=='template-05' )){
2239						
2240						$('.wp-chatbot-ball-inner').slimScroll({
2241							height: '70hv',
2242							start: 'bottom'
2243						}).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'});
2244						
2245					}else{
2246						
2247						$('.wp-chatbot-ball-inner').slimScroll({
2248							height: '100hv',
2249							start: 'bottom'
2250						}).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'});
2251						
2252						$('#wp-chatbot-chat-container').css({'bottom': '0', 'left': '0', 'right': '0'});
2253						$('#wp-chatbot-ball').hide();
2254						//Maintain inner chat box height
2255						var widowH = $(window).height();
2256						var headerH = $('.wp-chatbot-header').outerHeight();
2257						var footerH = $('.wp-chatbot-footer').outerHeight();
2258						var AppContentInner = widowH - footerH - headerH;
2259						
2260						if(wpChatBotVar.template=='template-07'){
2261							AppContentInner = (parseFloat(AppContentInner) + 2) - (parseFloat($('.wp-bot-header').height()*2));
2262						}
2263						
2264						if(wpChatBotVar.template=='template-06'){
2265							AppContentInner = (parseFloat(AppContentInner) + 2) - (parseFloat($('.wp-bot-header').height()));
2266						}
2267						
2268						
2269						$('.wp-chatbot-ball-inner').css({'height': AppContentInner + 'px'})
2270						$(this).hide();
2271						
2272					}
2273                    
2274                } else {
2275                    //$('.wp-chatbot-header').append('<div id="wp-chatbot-desktop-close">X</div>');
2276                    $('.wp-chatbot-ball-inner').slimScroll({
2277                        height: '70hv',
2278                        start: 'bottom'
2279                    }).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'});
2280                }
2281
2282                if( typeof(iframe_exists) !== "undefined" ){
2283                    var widowH1 = screen.height - 50
2284                    if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){
2285                        var ballConH1 = parseInt(widowH1 * 0.5);    
2286                    }else{
2287                        var ballConH1 = parseInt(widowH1 * 0.5) + 73;
2288                    }
2289                    $('.wp-chatbot-ball-inner').css({'height': ballConH1 + 'px'})
2290
2291                    $('.wpbot-saas-live-chat').css({'height': (ballConH1) + 'px'})
2292                    
2293                    $('.wpbot-saas-live-chat').width( '370px' );
2294
2295                    if( $('.wbcaBody').length > 0 ){
2296                        $('.wbcaBody').css( "height", (ballConH1-30)+"px" )
2297                    }	
2298                    if( $('#wbca_chat_body').length > 0 ){
2299                        $('#wbca_chat_body').css( "height", (ballConH1-73)+"px" )
2300                    }
2301                    
2302                }
2303                
2304
2305
2306                //Here is the Plugin  to be load only for once.
2307                
2308                if (LoadwpwBotPlugin == 0) {
2309                    jQuery.wpwbot({obj: wpChatBotVar, editor_handler: textEditorHandler, preLoadingTime: wpChatBotVar.botpreloadingtime});
2310                    LoadwpwBotPlugin++;
2311
2312                    var data = {'action': 'qcld_wb_chatbot_session_count'};
2313                    jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2314                       //
2315                    });
2316                } else {
2317                    if ( localStorage.getItem("wpwHitory") == null && jQuery('#wp-chatbot-messages-container').html() == '' ) {
2318                        wpwWelcome.greeting();
2319                    }
2320                }
2321                //If product detials is open then it will be closed.
2322                $('.wp-chatbot-product-container').removeClass('active-chatbot-product-details');
2323                //Show and close notification message on ball click
2324                
2325               
2326                if ($('.active-chat-board').length != 0) {
2327                    $('#wp-chatbot-notification-container').removeClass('wp-chatbot-notification-container-sliding');
2328                    //chatbox will be open and notificaion will be closed
2329                    $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
2330                    //clearInterval(notificationInterval);
2331                } else {
2332                    if (!sessionStorage.getItem('wpChatbotNotification')) {
2333                        $('#wp-chatbot-notification-container').removeClass('wp-chatbot-notification-container-disable');
2334                        $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-sliding');
2335
2336                    }
2337                    /// clearInterval(notificationInterval);
2338                }
2339                //Messenger handling.
2340                if ($('.active-chat-board').length > 0) {
2341                    $('#wp-chatbot-integration-container').show();
2342                    if(wpChatBotVar.template=='template-07'){
2343                        $('#wp-chatbot-integration-container-07').hide();
2344                    }
2345                } else {
2346                    $('#wp-chatbot-integration-container').hide();
2347                    if(wpChatBotVar.template=='template-07'){
2348                        $('#wp-chatbot-integration-container-07').show();
2349                    }
2350                }
2351            }
2352            function showing_proactive_msg(msg){
2353                //first open then chatboard
2354                if(localStorage.getItem("wpwHitory") && ! $('.wp-ch
2354atbot-operation-option[data-option="chat"]').parent().hasClass('wp-chatbot-operation-active')){
2355                    $('.wp-chatbot-messages-wrapper').html(localStorage.getItem("wpwHitory"));
2356                    $('.wp-chatbot-operation-option').each(function(){
2357                        if($(this).attr('data-option')=='chat'){
2358                            $(this).parent().addClass('wp-chatbot-operation-active');
2359                        }else{
2360                            $(this).parent().removeClass('wp-chatbot-operation-active');
2361                        }
2362                    });
2363                }
2364                var msgContent='<li class="wp-chatbot-msg">' +
2365                    '<div class="wp-chatbot-avatar">'+
2366                    '<img src="'+wpChatBotVar.agent_image_path+'" alt="">'+
2367                    '</div>'+
2368                    '<div class="wp-chatbot-agent">'+ handle_language(wpChatBotVar.agent)+'</div>'
2369                    +'<div class="wp-chatbot-paragraph"><img class="wp-chatbot-comment-loader" src="'+wpChatBotVar.image_path+'comment.gif" alt="Typing..." /></div></li>';
2370                    if($('.wp-chatbot-comment-loader').length<1){
2371						$('#wp-chatbot-messages-container').append(msgContent);
2372					}
2373                //Scroll to the last message
2374                $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2375                msg += '<span class="qcwpbot_close_ret">X</span>';
2376                setTimeout(function(){
2377                    $('#wp-chatbot-messages-container li:last .wp-chatbot-paragraph').html(msg).css({'background-color':wpChatBotVar.proactive_bg_color});
2378                    //scroll to the last message
2379                    $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2380
2381                    setTimeout(function(){
2382                        wp_chatbot_obj.re_target_handler = 0;
2383                    }, 1000);
2384
2385                }, 2000);
2386            }
2387            function  showing_proactive_double_msg(secondMsg) {
2388                //first open then chatboard
2389                if(localStorage.getItem("wpwHitory")){
2390                    $('.wp-chatbot-messages-wrapper').html(localStorage.getItem("wpwHitory"));
2391                    $('.wp-chatbot-operation-option').each(function(){
2392                        if($(this).attr('data-option')=='chat'){
2393                            $(this).parent().addClass('wp-chatbot-operation-active');
2394                        }else{
2395                            $(this).parent().removeClass('wp-chatbot-operation-active');
2396                        }
2397                    });
2398                }
2399                
2400                var fristMsg="<strong>"+handle_language(wpChatBotVar.agent)+" </strong> "+handle_language(wpChatBotVar.agent_join);
2401                var msgContent='<li class="wp-chatbot-msg">' +
2402                    '<div class="wp-chatbot-avatar">'+
2403                    '<img src="'+wpChatBotVar.agent_image_path+'" alt="">'+
2404                    '</div>'+
2405                    '<div class="wp-chatbot-agent">'+ handle_language(wpChatBotVar.agent)+'</div>'
2406                    +'<div class="wp-chatbot-paragraph"><img class="wp-chatbot-comment-loader" src="'+wpChatBotVar.image_path+'comment.gif" alt="Typing..." /></div></li>';
2407                $('#wp-chatbot-messages-container').append(msgContent);
2408                //Scroll to the last message
2409                $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2410                secondMsg += '<span class="qcwpbot_close_ret">X</span>';
2411                setTimeout(function(){
2412                    $('#wp-chatbot-messages-container li:last .wp-chatbot-paragraph').html(fristMsg);
2413                    //Second Message with interval
2414                    $('#wp-chatbot-messages-container').append(msgContent);
2415                    //Scroll to the last message
2416                    $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2417                     setTimeout(function(){
2418                        $('#wp-chatbot-messages-container li:last .wp-chatbot-paragraph').html(secondMsg).css({'background-color':wpChatBotVar.proactive_bg_color});
2419                        //Scroll to the last message
2420                         $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'});
2421                         
2422                         setTimeout(function(){
2423                            wpwWelcome.greeting();
2424                            setTimeout(function(){
2425                                wp_chatbot_obj.re_target_handler = 0;
2426                            }, 1000);
2427                         }, 2000)
2428                         //localStorage.getItem("wpwHitory") && globalwpw.initialize==0
2429                    }, 2000);
2430
2431                }, 2000);
2432            }
2433
2434
2435            $("#qcld-wp-chatbot-shortcode-style-css").attr("disabled", "disabled");
2436            /***
2437             * Notification Message
2438             */
2439            if ($('#wp-chatbot-notification-container').length > 0) {
2440                if (sessionStorage.getItem('wpChatbotNotification') && (sessionStorage.getItem('wpChatbotNotification') == 'removed') ){
2441                 
2442                    //if remove on the session.
2443                    $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
2444                } else {
2445                    //Notification comes with slideIn effect
2446                    $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-sliding');
2447                    //handling welcome & return user welcome msg.
2448
2449                    var welcomeMsg = '';
2450
2451                    if ($.cookie("shopper") && wpChatBotVar.disable_wp_chatbot_history!=1) {
2452                        var shopper = $.cookie("shopper");
2453                         welcomeMsg = wpChatBotVar.welcome_back[wpChatBotVar.language][0] + ' <strong>' + shopper + '!</strong>';
2454                    } else {
2455                         welcomeMsg = wpChatBotVar.welcome[wpChatBotVar.language][0] + ' <strong>' + handle_language(wpChatBotVar.host) + '!</strong>';
2456
2457                    }
2458                    $('.wp-chatbot-notification-welcome').html(welcomeMsg);
2459                    //Notifications msgs handling.
2460                    
2461                    var notifications = wpChatBotVar.notifications[wpChatBotVar.language];
2462                    var notification_intents = wpChatBotVar.notification_intents[wpChatBotVar.language]
2463                    if (notifications.length > 1) {
2464                        var totalNotMsg = wpChatBotVar.notifications[wpChatBotVar.language].length;
2465                        var notMsgIndex = 0;
2466                        var intervalTime = parseInt(wpChatBotVar.notification_interval) * 1000;
2467                        var notificationInterval = setInterval(function (e) {
2468                            notMsgIndex++;
2469                            if (totalNotMsg <= notMsgIndex) {
2470                                notMsgIndex = 0;
2471                            }
2472                            //show new notification time after every intervalTime
2473                            
2474							if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
2475								var shopperName=  wp_chatbot_obj.shopper_demo_name;
2476							}else{
2477								var shopperName=globalwpw.hasNameCookie;
2478							}
2479							
2480                            $('.wp-chatbot-notification-message').css({'opacity': 1}).html(notifications[notMsgIndex].replace("%%username%%", '<strong>'+shopperName+'</strong>'));
2481                            if(notification_intents[notMsgIndex]!='' && typeof notification_intents[notMsgIndex] !='undefined'){
2482                                $('#wp-chatbot-notification-container').attr('data-intent', notification_intents[notMsgIndex]);
2483                            }else{
2484                                $('#wp-chatbot-notification-container').removeAttr('data-intent');
2485                            }
2486                            
2487
2488                        }, intervalTime);
2489                    }else{
2490
2491						if(typeof(globalwpw.hasNameCookie)=='undefined'|| globalwpw.hasNameCookie==''){
2492							var shopperName=  wp_chatbot_obj.shopper_demo_name;
2493						}else{
2494							var shopperName=globalwpw.hasNameCookie;
2495						}
2496						
2497						
2498						$('.wp-chatbot-notification-message').css({'opacity': 1}).html($('.wp-chatbot-notification-message').html().replace("%%username%%", '<strong>'+shopperName+'</strong>'));
2499					}
2500
2501                    $(".wp-chatbot-notification-close").on('click', function () {
2502                        $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable');
2503                        //clearInterval(notificationInterval);
2504                        sessionStorage.setItem('wpChatbotNotification', 'removed');
2505                    });
2506                }
2507            }
2508        }
2509        else if ($('#wp-chatbot-shortcode-template-container').length > 0) { //Page shortcode area.
2510            $('#wp-chatbot-chat-container').css({'display': 'none'});
2511            $('#wp-chatbot-ball').hide();
2512            //Add Scroll to chat ui
2513            $('.wp-chatbot-ball-inner').slimScroll({
2514                height: '70hv',
2515                start: 'bottom'
2516            }).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'});
2517            //Add scroll to cart part
2518            var recentViewHeight = $('.wp-chatbot-container').outerHeight();
2519            if ($('.chatbot-shortcode-template-02').length == 0) {
2520                $('.wp-chatbot-cart-body').slimScroll({height: '200px', start: 'top'});
2521                $('.wp-chatbot-widget .wp-chatbot-products').slimScroll({height: '435px', start: 'top'});
2522            }
2523
2524            //Remove style of template
2525            $("#qcld-wp-chatbot-style-css").attr("disabled", "disabled");
2526            //Here is the Plugin  to be load only for once.
2527            if (LoadwpwBotPlugin == 0) {
2528                $.wpwbot({obj: wpChatBotVar, editor_handler: textEditorHandler, preLoadingTime: wpChatBotVar.botpreloadingtime});
2529                LoadwpwBotPlugin++;
2530                var data = {'action': 'qcld_wb_chatbot_session_count'};
2531                    jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2532                       //
2533                    });
2534            }
2535
2536
2537        }
2538        else if ($('#wp-chatbot-chat-app-shortcode-container').length > 0) {  //App shortcode area.
2539
2540            textEditorHandler = 1;
2541            //App UI (ball inner)
2542            setTimeout(function () {
2543                var widowH = screen.height - 50;
2544                
2545                var footerH = $('.wp-chatbot-footer').outerHeight();
2546
2547                var AppContentInner = widowH - footerH;
2548                
2549                $('#wp-chatbot-chat-app-shortcode-container .wp-chatbot-ball-inner').css({'height': AppContentInner + 'px'})
2550            }, 300);
2551            $(window).resize(function () {
2552                setTimeout(function () {
2553                    var widowH = screen.height - 50;
2554                    
2555                    var footerH = $('.wp-chatbot-footer').outerHeight();
2556                    var AppContentInner = widowH - footerH;
2557                    
2558                    $('#wp-chatbot-chat-app-shortcode-container .wp-chatbot-ball-inner').css({'height': AppContentInner + 'px'})
2559                }, 300)
2560            });
2561
2562            $('#wp-chatbot-ball').hide();
2563            //Add Scroll to chat ui
2564            $("#qcld-wp-chatbot-shortcode-style-css").attr("disabled", "disabled");
2565            $("#wp-chatbot-board-container").addClass('active-chat-board');
2566            $('.wp-chatbot-ball-inner').slimScroll({
2567                height: '55hv',
2568                start: 'bottom'
2569            }).parent().find('.slimScrollBar').css({'top': screen.height - 50 + 'px'});
2570            if (LoadwpwBotPlugin == 0) {
2571                $.wpwbot({obj: wpChatBotVar, editor_handler: textEditorHandler, preLoadingTime: wpChatBotVar.botpreloadingtime});
2572                LoadwpwBotPlugin++;
2573                var data = {'action': 'qcld_wb_chatbot_session_count'};
2574                    jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2575                       //
2576                    });
2577            }
2578            //Handling app cart and checkout
2579            $('#wp-chatbot-cart-short-code').hide();
2580            $('#wp-chatbot-checkout-short-code').hide();
2581            $(document).on('click', '.wp-chatbot-cart-link', function (event) {
2582                $('.wp-chatbot-messages-wrapper').hide();
2583                $('#wp-chatbot-checkout-short-code').hide();
2584                $('#wp-chatbot-cart-short-code').show();
2585                event.preventDefault();
2586                $('#wp-chatbot-cart-short-code').html('<img class="wp-chatbot-comment-loader" src="' + wpChatBotVar.image_path + 'comment.gif" alt="..." />');
2587                var data = {'action': 'qcld_wb_chatbot_cart_page'};
2588                jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2589                    $("#wp-chatbot-cart-short-code").html(response);
2590                });
2591            });
2592            $(document).on('click', '.wp-chatbot-checkout-link, .checkout-button', function (event) {
2593                event.preventDefault();
2594                $('.wp-chatbot-messages-wrapper').hide();
2595                $('#wp-chatbot-cart-short-code').hide();
2596                $('#wp-chatbot-checkout-short-code').show();
2597
2598
2599                $('#wp-chatbot-checkout-short-code').html('<img class="wp-chatbot-comment-loader" src="' + wpChatBotVar.image_path + 'comment.gif" alt="..." />');
2600                var data = {'action': 'qcld_wb_chatbot_checkout_page'};
2601                jQuery.post(wpChatBotVar.ajax_url, data, function (response) {
2602                    if (response.status == 'yes') {
2603                        window.location.href = response.html;
2604                    } else {
2605                        $("#wp-chatbot-checkout-short-code").html(response.html);
2606                    }
2607
2608                });
2609            });
2610            //Preventing url redirect from cart page.
2611            $(document).on('click', '#wp-chatbot-chat-app-shortcode-container .woocommerce-cart-form a', function (e) {
2612                e.preventDefault();
2613            });
2614        }
2615        //For variable product configuration
2616        var current_price_html = '';
2617        $(document).on('change', "#wp-chatbot-product-variable select ", function () {
2618            var variations = JSON.parse($("#wp-chatbot-variation-data").attr('data-product-variation'));
2619            var item_conditions = [];
2620            if(current_price_html == ''){
2621				current_price_html = $('#wp-chatbot-product-price').html();
2622			}
2623            var totalAttr = $("#wp-chatbot-product-variable select").length;
2624            var i = 1;
2625            $("#wp-chatbot-product-variable select").each(function (index, element) {
2626                var myVal = $(this).find('option:selected').val();
2627                if (myVal != "") {
2628                    item_conditions.push({
2629                        'left': 'item["variation_data"]["' + $(this).attr('name') + '"][0]',
2630                        'right': myVal
2631                    })
2632                }
2633            });
2634            var newVariation = [];
2635            for (var a = 0; variations.length > a; a++) {
2636                var item = variations[a];
2637                var item_condition = "";
2638                for (var i = 0; item_conditions.length > i; i++) {
2639
2640                    if (i > 0) {
2641                        item_condition += ' && ' + '"' + eval(item_conditions[i].left).toLowerCase() + '"' + '==' + '"' + item_conditions[i].right.toLowerCase() + '"';
2642                    } else {
2643                        item_condition += '"' + eval(item_conditions[i].left).toLowerCase() + '"' + '==' + '"' + item_conditions[i].right.toLowerCase() + '"';
2644                    }
2645                }
2646                if (eval(item_condition)) {
2647                    newVariation[0] = item;
2648                }
2649            }
2650            if (newVariation.length > 0) {
2651                $('#wp-chatbot-variation-add-to-cart').attr('variation_id', newVariation[0]['variation_id']);
2652                var priceSets = "";
2653                if (typeof newVariation[0]['variation_data']['_sale_price'] !== "undefined") {
2654                    priceSets +=   '<strong>' + newVariation[0]['variation_price'] + '</strong>';
2655                    //priceSets += '<strike>' + wpChatBotVar.currency_symbol + parseFloat(newVariation[0]['variation_data']['_regular_price'][0]).toFixed(2) + '</strike>'
2656                } else {
2657                    //priceSets += '<strong>' + wpChatBotVar.currency_symbol + parseFloat(newVariation[0]['variation_data']['_regular_price'][0]).toFixed(2) + '</strong>';
2658                    priceSets += '<strong>' + newVariation[0]['variation_price'] + '</strong>';
2659                }
2660                $('#wp-chatbot-product-price').html(priceSets);
2661            } else {
2662				$('#wp-chatbot-product-price').html(current_price_html);
2663			}
2664        });
2665
2666        if ($('.active-chat-board').length > 0) {
2667            $('#wp-chatbot-integration-container').show();
2668            if(wpChatBotVar.template=='template-07'){
2669                $('#wp-chatbot-integration-container-07').hide();
2670            }
2671        } else {
2672            $('#wp-chatbot-integration-container').hide();
2673            if(wpChatBotVar.template=='template-07'){
2674                $('#wp-chatbot-integration-container-07').show();
2675            }
2676        }
2677        //Facebook Messenger Integration
2678        
2679        //skype
2680        if (wpChatBotVar.enable_skype == 1) {
2681            $(document).on('click', '.inetegration-skype-btn', function (e) {
2682                $('#wp-chatbot-board-container').removeClass('active-chat-board');
2683                
2684                $('#wp-chatbot-integration-container').hide();
2685                if(wpChatBotVar.template=='template-07'){
2686                    $('#wp-chatbot-integration-container-07').show();
2687                }
2688            });
2689
2690        }
2691
2692
2693    });
2694	
2695	// Create IE + others compatible event handler
2696	var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
2697	var eventer = window[eventMethod];
2698	var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
2699
2700	// Listen to message from child window
2701	eventer(messageEvent,function(e) {
2702        if(e.data.msg == 'chatbot_open'){
2703            $('.wp-chatbot-notification-container').hide();
2704            //$('.wpbot-saas-live-chat').hide();
2705        }
2706        if(e.data.msg == 'chatbot_close'){
2707            if(sessionStorage.getItem('wpChatbotNotification') != 'removed' && wpChatBotVar.template!='template-05' ){
2708                $('.wp-chatbot-notification-container').show();
2709            }
2710        }
2711        // if(e.data.msg == 'parent'){
2712        //     $('#wp-chatbot-chat-container').css({
2713        //         'right': '50px',
2714        //         'bottom': '50px'
2715        //     })
2716        // }
2717
2718	},false);
2719	
2720	function sendMessageIframe(json){
2721		parent.postMessage(json,"*");
2722    }
2723    
2724
2725});

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.