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