1jQuery(function ($) { 2 //Global object passed by admin 3 var wpChatBotVar = wp_chatbot_obj; 4 5 var LoadwpwBotPlugin = 0; 6 var textEditorHandler = 0; 7 if( typeof(openingHourIsFn) !='undefined'){ 8 var openingHourIs = openingHourIsFn; 9 }else{ 10 var openingHourIs = 0; 11 } 12 13 wpChatBotVar.exit_intent_handler = 0; 14 wpChatBotVar.scroll_open_handler = 0; 15 wpChatBotVar.auto_open_handler = 0; 16 wpChatBotVar.re_target_handler = 0; 17 18 $(document).ready(function () { 19 if(typeof(wpbot_clear_cache) !=="undefined" && wpbot_clear_cache !=''){ 20 wpwKits.reset(); 21 LoadwpwBotPlugin = 0; 22 } 23 var botimage = jQuery('#wp-chatbot-ball').find('img').attr('qcld_agent'); 24 if ($('#wp-chatbot-shortcode-template-container').length == 0 && $('#wp-chatbot-chat-app-shortcode-container').length == 0) { 25 //Main wpwbot area. 26 //show it 27 $('#wp-chatbot-ball-wrapper').css({ 28 'display': 'block', 29 }); 30 //wpChatBot icon position. 31 $('#wp-chatbot-chat-container').css({ 32 'right': wpChatBotVar.wp_chatbot_position_x + 'px', 33 'bottom': wpChatBotVar.wp_chatbot_position_y + 'px' 34 }) 35 //Facebook Messenger desktop 36 setTimeout(function () { 37 $('.fb_dialog').css({ 38 'right': parseInt(55 + parseInt(wpChatBotVar.wp_chatbot_position_x)) + 'px', 39 'bottom': parseInt(17 + parseInt(wpChatBotVar.wp_chatbot_position_y)) + 'px', 40 'visibility': 'visible' 41 }); 42 }, 3000); 43 44 //wpchatbot icon animation disable or enable 45 //Disable wpwBot icon Animation 46 if (wpChatBotVar.disable_icon_animation == 1) { 47 $('.wp-chatbot-ball').addClass('wp-chatbot-animation-deactive'); 48 } else { 49 $('.wp-chatbot-ball').addClass('wp-chatbot-animation-active'); 50 51 //wpchatbot icon animation timing 52 //var itemHide = function(){ 53 // $('.wp-chatbot-animation-active .wp-chatbot-ball-animation-switch').css({ 54 // "opacity": 0, 55 // }) 56 //}; 57 var itemHide = function () { 58 $('.wp-chatbot-animation-active .wp-chatbot-ball-animation-switch').fadeOut(1000); 59 }; 60 setTimeout(function () { 61 itemHide() 62 }, 1000); 63 64 //Click Animation 65 $('.wp-chatbot-animation-active').click(function () { 66 $('.wp-chatbot-animation-active .wp-chatbot-ball-animation-switch').fadeIn(100); 67 setTimeout(function () { 68 itemHide() 69 }, 1000); 70 }); 71 } 72 73 //window resize. 74 var widowH = $(window).height(); 75 var widowW = $(window).width(); 76 if (widowW > 767) { 77 var ballConH = parseInt(widowH * 0.5)+ parseInt(114); 78 //$('.wp-chatbot-ball-inner').css({'height': ballConH + 'px'}) 79 80 $(window).resize(function () { 81 var widowH = $(window).height(); 82 var ballConH = parseInt(widowH * 0.5)+ parseInt(114); 83 //$('.wp-chatbot-ball-inner').css({'height': ballConH + 'px'}) 84 }); 85 }; 86 87 $(document).on('click', '#wp-chatbot-ball', function (event) { 88 89 if($('.active-chat-board').length>0){ 90 if(wpChatBotVar.template=='template-06' || wpChatBotVar.template=='template-07'){ 91 $('#wp-chatbot-ball').show(); 92 } 93 $('#wp-chatbot-ball').removeClass('wpbot_chatopen_iconanimation'); 94 $('#wp-chatbot-ball').addClass('wpbot_chatclose_iconanimation'); 95 $('#wp-chatbot-ball').find('img').attr('src', botimage)
96 $('.wp-chatbot-ball').css('background', '#ffffff'); 97 98 99 }else{ 100 101 $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation'); 102 $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation'); 103 $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png'); 104 //$('.wp-chatbot-ball').css('background', 'unset'); 105 106 107 } 108 109 $("#wp-chatbot-board-container").toggleClass('active-chat-board'); 110 wpwbot_board_action(); 111 112 }); 113 //wpwBot proActive start 114 //Attention on 115 if(wpChatBotVar.enable_meta_title==1 && wpChatBotVar.meta_label!="") { 116 var MetaTitleInterval; 117 var orginalTitle = document.title; 118 $(document).on("mouseover", 'body', function (e) { 119 document.title = orginalTitle; 120 clearInterval(MetaTitleInterval); 121 }); 122 } 123 //Exit Intent 124 if(wpChatBotVar.enable_exit_intent == 1){ 125 window.addEventListener("mouseout", function (e) { 126 e = e ? e : window.event; 127 128 // If this is an autocomplete element. 129 if (e.target.tagName.toLowerCase() == "input") 130 return; 131 132 // Get the current viewport width. 133 var vpWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 134 135 // If the current mouse X position is within 50px of the right edge 136 // of the viewport, return. 137 if (e.clientX >= (vpWidth - 50)) 138 return; 139 140 // If the current mouse Y position is not within 50px of the top 141 // edge of the viewport, return. 142 if (e.clientY >= 50) 143 return; 144 145 // Reliable, works on mouse exiting window and 146 // user switching active program 147 var from = e.relatedTarget || e.toElement; 148 if (!from) 149 //if will open once if setup from backend. 150 var exitIntentOpen=true; 151 if($.cookie('exit_intent')=='yes' && wpChatBotVar.exit_intent_once==1) { 152 exitIntentOpen=false; 153 } 154 if ($('.active-chat-board').length == 0 && exitIntentOpen==true) { 155 if (wpChatBotVar.exit_intent_handler == 0) { 156 $("#wp-chatbot-board-container").addClass('active-chat-board'); 157 wpChatBotVar.exit_intent_handler++; 158 wpChatBotVar.re_target_handler = 1; 159 wpwbot_board_action(); 160 //Shopper Name 161 if(localStorage.getItem('shopper')){ 162 var shopper=localStorage.getItem('shopper'); 163 }else{ 164 var shopper=wpChatBotVar.shopper_demo_name; 165 } 166 setTimeout(function () { 167 if (localStorage.getItem("wpwHitory")) { 168 showing_proactive_msg( wpChatBotVar.ret_greet+' '+shopper +', '+wpChatBotVar.exit_intent_msg); 169 } else { 170 showing_proactive_double_msg(wpChatBotVar.ret_greet+' '+shopper+', '+wpChatBotVar.exit_intent_msg) 171 } 172 $.cookie('exit_intent','yes'); 173 //pro active sound 174 proactive_retargeting_sound(); 175 //Window foucus meta title change. 176 window_focus_change_meta_title(); 177 }, 1000) 178 } 179 } 180 }); 181 } 182 if(wpChatBotVar.enable_scroll_open==1){ 183 184 $(document).on('scroll', function (event) { 185 var OpenScroll=true; 186 //if will open once if setup from backend. 187 if( $.cookie('scroll_open')=='yes' && wpChatBotVar.scroll_open_once==1) { 188 OpenScroll=false; 189 } 190 //it will be open only for single time. 191 if ($('.active-chat-board').length ==0 && OpenScroll==true) { 192 if (wpChatBotVar.scroll_open_handler == 0) { 193 var scrollOpenVal = parseInt(($(document).height() * wpChatBotVar.scroll_open_percent) / 100); 194 if ($(window).scrollTop() + $(window).height() > scrollOpenVal) { 195 $("#wp-chatbot-board-container").addClass('active-chat-board'); 196 wpChatBotVar.scroll_open_handler++; 197 wpChatBotVar.re_target_handler = 2; 198 wpwbot_board_action(); 199 //Shopper Name 200 if(localStorage.getItem('shopper')){ 201 var shopper=localStorage.getItem('shopper'); 202 }else{ 203 var shopper=wpChatBotVar.shopper_demo_name; 204 } 205 setTimeout(function () { 206 if (localStorage.getItem("wpwHitory")) { 207 showing_proactive_msg(wpChatBotVar.ret_greet+' '+ shopper+', '+wpChatBotVar.scroll_open_msg); 208 } else { 209 showing_proactive_double_msg(wpChatBotVar.ret_greet+' '+ shopper+', '+wpChatBotVar.scroll_open_msg) 210 } 211 $.cookie('scroll_open','yes'); 212 //pro active sound 213 proactive_retargeting_sound(); 214 //Window foucus meta title change. 215 window_focus_change_meta_title(); 216 }, 1000) 217 } 218 } 219 } 220 221 }); 222 } 223 if(wpChatBotVar.enable_auto_open==1 ){ 224 //if will open once if setup from backend. 225 var autoOpen=true; 226 if($.cookie('auto_open')=='yes' && wpChatBotVar.auto_open_once==1) { 227 autoOpen=false; 228 } 229 if( wpChatBotVar.auto_open_handler == 0 && autoOpen==true) { 230 setTimeout(function (e) { 231 if ($('.active-chat-board').length == 0) { 232 $("#wp-chatbot-board-container").addClass('active-chat-board'); 233 wpChatBotVar.auto_open_handler++; 234 wpChatBotVar.re_target_handler = 3; 235 wpwbot_board_action(); 236 //Shopper Name 237 if(localStorage.getItem('shopper')){ 238 var shopper=localStorage.getItem('shopper'); 239 }else{ 240 var shopper=wpChatBotVar.shopper_demo_name; 241 } 242 setTimeout(function () { 243 if (localStorage.getItem("wpwHitory")) { 244 showing_proactive_msg(wpChatBotVar.ret_greet+' '+ shopper+', '+wpChatBotVar.auto_open_msg); 245 } else { 246 showing_proactive_double_msg(wpChatBotVar.ret_greet+' '+shopper+', '+wpChatBotVar.auto_open_msg) 247 } 248 $.cookie('auto_open','yes'); 249 //pro active sound 250 proactive_retargeting_sound(); 251 //Window foucus meta title change. 252 window_focus_change_meta_title(); 253 }, 1000) 254 } 255 }, parseInt(wpChatBotVar.auto_open_time * 1000)); 256 } 257 } 258 //Retargeting for Cart to complete checkout. 259 if(wpChatBotVar.enable_ret_user_show==1 && localStorage.getItem("wpwHitory") && $.cookie('return_user')!='yes') { 260 261 $.cookie('return_user','yes'); 262 var data = {'action': 'qcld_wb_chatbot_only_cart'}; 263 jQuery.post(wpChatBotVar.ajax_url, data, function (response) { 264 if (response.items > 0) { 265 if ($('.active-chat-board').length == 0) { 266 setTimeout(function () { 267 $("#wp-chatbot-board-container").addClass('active-chat-board'); 268 wpwbot_board_action(); 269 showing_proactive_msg(wpChatBotVar.checkout_msg); 270 setTimeout(function () { 271 showing_proactive_msg(response.html); 272 //Window foucus meta title change. 273 window_focus_change_meta_title(); 274 }, 2000); 275 }, 1000); 276 } 277 } 278 }); 279 }else{ 280 $.cookie('return_user','yes'); 281 } 282 283 if(wpChatBotVar.enable_inactive_time_show==1 && localStorage.getItem("wpwHitory") ) { 284 var timeoutID; 285 286 function setup() { 287 this.addEventListener("mousemove", resetTimer, false); 288 this.addEventListener("mousedown", resetTimer, false); 289 this.addEventListener("keypress", resetTimer, false); 290 this.addEventListener("DOMMouseScroll", resetTimer, false); 291 this.addEventListener("mousewheel", resetTimer, false); 292 this.addEventListener("touchmove", resetTimer, false); 293 this.addEventListener("MSPointerMove", resetTimer, false); 294 295 startTimer(); 296 } 297 setup(); 298 299 function startTimer() { 300 // wait as set from admin seconds before calling goInactive 301 timeoutID = window.setTimeout(goInactive, parseInt(wpChatBotVar.inactive_time*1000)); 302 } 303 304 function resetTimer(e) { 305 window.clearTimeout(timeoutID); 306 307 goActive(); 308 } 309 310 function goInactive() { 311 if(wpChatBotVar.ret_inactive_user_once==1 && $.cookie('return_inactive_user')!='yes') { 312 $.cookie('return_inactive_user','yes'); 313 var data = {'action': 'qcld_wb_chatbot_only_cart'}; 314 jQuery.post(wpChatBotVar.ajax_url, data, function (response) { 315 if (response.items > 0) { 316 if ($('.active-chat-board').length == 0) { 317 setTimeout(function () { 318 $('#wp-chatbot-ball').removeClass('wpbot_chatclose_iconanimation'); 319 $('#wp-chatbot-ball').addClass('wpbot_chatopen_iconanimation'); 320 $('#wp-chatbot-ball').find('img').attr('src', wpChatBotVar.imgurl+'wpbot-close-icon.png'); 321 $("#wp-chatbot-board-container").addClass('active-chat-board'); 322 wpwbot_board_action(); 323 showing_proactive_msg(wpChatBotVar.checkout_msg); 324 setTimeout(function () { 325 showing_proactive_msg(response.html); 326 //Window foucus meta title change. 327 window_focus_change_meta_title(); 328 }, 2000); 329 }, 2000); 330 } 331 } 332 }); 333 }else{ 334 $.cookie('return_inactive_user','yes'); 335 } 336 } 337 338 function goActive() {
339 // do something 340 341 startTimer(); 342 } 343 } 344 //Proactive retargeting sound for auto open. scroll open and 345 function proactive_retargeting_sound() { 346 if(wpChatBotVar.enable_ret_sound==1){ 347 var promise = document.querySelector('#wp-chatbot-proactive-audio').play(); 348 if (promise !== undefined) { 349 promise.then(function (success) { 350 //success to play 351 }).catch(function (error) { 352 //some error 353 //console.log(error); 354 }); 355 } 356 } 357 } 358 359 //When user will be out of window and news retargetting will be shown. where opening hour, title and meta need to be set. 360 function window_focus_change_meta_title() { 361 if(wpChatBotVar.enable_meta_title==1 && wpChatBotVar.meta_label!="" && openingHourIs==0) { 362 var showInactive = 0; 363 MetaTitleInterval = setInterval(function () { 364 if (showInactive == 0) { 365 document.title = wpChatBotVar.meta_label; 366 showInactive = 1; 367 } else { 368 document.title = orginalTitle; 369 showInactive = 0; 370 } 371 }, 1000); 372 } 373 } 374 375 //wpwBot proActive end 376 function wpwbot_board_action() { 377 if (widowW <= 1024 && wpChatBotVar.mobile_full_screen==1 ) {//For mobile 378 if ($('#wp-chatbot-mobile-close').length <= 0) { 379 $('.wp-chatbot-board-container').append('<div id="wp-chatbot-mobile-close">X</div>'); 380 } 381 $('.wp-chatbot-ball-inner').slimScroll({ 382 height: '100hv', 383 start: 'bottom' 384 }).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'}); 385 $('#wp-chatbot-chat-container').css({'bottom': '0', 'left': '0', 'right': '0'}); 386 $('#wp-chatbot-ball').hide(); 387 //Maintain inner chat box height 388 var widowH = $(window).height(); 389 var headerH = $('.wp-chatbot-header').outerHeight(); 390 var footerH = $('.wp-chatbot-footer').outerHeight(); 391 var AppContentInner = widowH - footerH - headerH; 392 //alert(footerH); 393 $('.wp-chatbot-ball-inner').css({'height': AppContentInner + 'px'}) 394 $('.wp-chatbot-ball-inner').css({'max-height': AppContentInner + 'px'}) 395 $(this).hide(); 396 } else { 397 // $('.wp-chatbot-header').append('<div id="wp-chatbot-desktop-close"><span class="dashicons dashicons-no"></span></div>'); 398 $('.wp-chatbot-ball-inner').slimScroll({ 399 height: '55hv', 400 start: 'bottom' 401 }).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'}); 402 } 403 404 405 //Here is the Plugin to be load only for once. 406 if (LoadwpwBotPlugin == 0) { 407 $.wpwbot({obj: wpChatBotVar, editor_handler: textEditorHandler, preLoadingTime: wpChatBotVar.botpreloadingtime}); 408 LoadwpwBotPlugin++; 409 var data = {'action': 'qcld_wb_chatbot_session_count'}; 410 jQuery.post(wpChatBotVar.ajax_url, data, function (response) { 411 // 412 }); 413 } 414 //If product detials is open then it will be closed. 415 $('.wp-chatbot-product-container').removeClass('active-chatbot-product-details'); 416 //Show and close notification message on ball click 417 if ($('.active-chat-board').length != 0) { 418 $('#wp-chatbot-notification-container').removeClass('wp-chatbot-notification-container-sliding'); 419 //chatbox will be open and notificaion will be closed 420 $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable'); 421 //clearInterval(notificationInterval); 422 } else { 423 if (!sessionStorage.getItem('wpChatbotNotification')) { 424 $('#wp-chatbot-notification-container').removeClass('wp-chatbot-notification-container-disable'); 425 $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-sliding'); 426 427 } 428 /// clearInterval(notificationInterval); 429 } 430 //Messenger handling. 431 if ($('.active-chat-board').length > 0) { 432 $('#wp-chatbot-integration-container').show(); 433 } else { 434 $('#wp-chatbot-integration-container').hide(); 435 } 436 } 437 function showing_proactive_msg(msg){ 438 var enableleReactions = globalwpw.settings.obj.skip_chat_reactions_menu; 439 var eanleeReport = globalwpw.settings.obj.enable_chat_report_menu; 440 var enableshare = globalwpw.settings.obj.enable_chat_share_menu; 441 var likeTxt = globalwpw.settings.obj.qlcd_wp_chatbot_like_text; 442 var disLikeTxt = globalwpw.settings.obj.qlcd_wp_chatbot_dislike_text; 443 var reportTxt = globalwpw.settings.obj.qlcd_wp_chatbot_report_text; 444 var sharetTxt = globalwpw.settings.obj.qlcd_wp_chatbot_share_text; 445 console.log(globalwpw.settings); 446 console.log(enableleReactions); 447 //first open then chatboard 448 if(localStorage.getItem("wpwHitory") && ! $('.wp-ch
448atbot-operation-option[data-option="chat"]').parent().hasClass('wp-chatbot-operation-active')){ 449 $('.wp-chatbot-messages-wrapper').html(localStorage.getItem("wpwHitory")); 450 $('.wp-chatbot-operation-option').each(function(){ 451 if($(this).attr('data-option')=='chat'){ 452 $(this).parent().addClass('wp-chatbot-operation-active'); 453 }else{ 454 $(this).parent().removeClass('wp-chatbot-operation-active'); 455 } 456 }); 457 } 458 var msgContent='<li class="wp-chatbot-msg">' + 459 '<div class="wp-chatbot-avatar">'+ 460 '<img src="'+wpChatBotVar.agent_image_path+'" alt="">'+ 461 '</div>'+ 462 '<div class="wp-chatbot-agent">'+ wpChatBotVar.agent+'</div>' 463 +'<div class="wp-chatbot-paragraph"><img class="wp-chatbot-comment-loader" src="'+wpChatBotVar.image_path+'comment.gif" alt="Typing..." /></div>'+ 464 '<div class="qcld-like-dislike-icon">' + 465 (enableleReactions == 1 466 ? '<a href="#" title="' + (likeTxt?.en_US || 'Like') + '"><i class="dashicons dashicons-thumbs-up" ></i></a>' + 467 '<a href="#" title="' + (disLikeTxt?.en_US || 'Dislike') + '"><i class="dashicons dashicons-thumbs-down"></i></a>' 468 : '') + 469 470 (eanleeReport == 1 471 ? '<a href="#" title="' + (reportTxt?.en_US || 'Report') + '"><i class="dashicons dashicons-admin-comments"></i></a>' 472 : '') + 473 474 (enableshare == 1 475 ? '<div class="qcld-share">' + 476 '<a href="#" class="share-toggle" title="' + (sharetTxt?.en_US || 'Share') + '"><i class="dashicons dashicons-share" aria-hidden="true"></i></a>' + 477 '<div class="share-menu" style="display:none;">' + 478 '<a href="#" class="share-fb"><i class="dashicons dashicons-facebook"></i></a>' + 479 '<a href="#" class="share-wa"><i class="dashicons dashicons-whatsapp"></i></a>' + 480 '<a href="#" class="share-x"><i class="dashicons dashicons-twitter"></i></a>' + 481 '<a href="#" class="share-email"><i class="dashicons dashicons-email-alt"></i></a>' + 482 '</div>' + 483 '</div>' 484 : '') + 485 '</div>' + 486 '</li>'; 487 488 $('#wp-chatbot-messages-container').append(msgContent); 489 //Scroll to the last message 490 $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'}); 491 setTimeout(function(){ 492 $('#wp-chatbot-messages-container li:last .wp-chatbot-paragraph').html(msg).css({'background-color':wpChatBotVar.proactive_bg_color}); 493 //scroll to the last message 494 $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'}); 495 }, 2000); 496 } 497 function showing_proactive_double_msg(secondMsg) { 498 var enableleReactions = globalwpw.settings.obj.skip_chat_reactions_menu; 499 var eanleeReport = globalwpw.settings.obj.enable_chat_report_menu; 500 var enableshare = globalwpw.settings.obj.enable_chat_share_menu; 501 var likeTxt = globalwpw.settings.obj.qlcd_wp_chatbot_like_text; 502 var disLikeTxt = globalwpw.settings.obj.qlcd_wp_chatbot_dislike_text; 503 var reportTxt = globalwpw.settings.obj.qlcd_wp_chatbot_report_text; 504 var sharetTxt = globalwpw.settings.obj.qlcd_wp_chatbot_share_text; 505 console.log(globalwpw.settings); 506 console.log(enableleReactions); 507 //first open then chatboard 508 if(localStorage.getItem("wpwHitory")){
509 $('.wp-chatbot-messages-wrapper').html(localStorage.getItem("wpwHitory")); 510 $('.wp-chatbot-operation-option').each(function(){ 511 if($(this).attr('data-option')=='chat'){ 512 $(this).parent().addClass('wp-chatbot-operation-active'); 513 }else{ 514 $(this).parent().removeClass('wp-chatbot-operation-active'); 515 } 516 }); 517 } 518 var fristMsg="<strong>"+wpChatBotVar.agent+" </strong> "+wpChatBotVar.agent_join[0]; 519 var msgContent='<li class="wp-chatbot-msg">' + 520 '<div class="wp-chatbot-avatar">'+ 521 '<img src="'+wpChatBotVar.agent_image_path+'" alt="">'+ 522 '</div>'+ 523 '<div class="wp-chatbot-agent">'+ wpChatBotVar.agent+'</div>' 524 +'<div class="wp-chatbot-paragraph"><img class="wp-chatbot-comment-loader" src="'+wpChatBotVar.image_path+'comment.gif" alt="Typing..." /></div>'+ 525 '<div class="qcld-like-dislike-icon">' + 526 (enableleReactions == 1 527 ? '<a href="#" title="' + (likeTxt?.en_US || 'Like') + '"><i class="dashicons dashicons-thumbs-up"></i></a>' + 528 '<a href="#" title="' + (disLikeTxt?.en_US || 'Dislike') + '"><i class="dashicons dashicons-thumbs-down"></i></a>' 529 : '') + 530 531 (eanleeReport == 1 532 ? '<a href="#" title="' + (reportTxt?.en_US || 'Report') + '"><i class="dashicons dashicons-admin-comments"></i></a>' 533 : '') + 534 535 (enableshare == 1 536 ? '<div class="qcld-share">' + 537 '<a href="#" class="share-toggle" title="' + (sharetTxt?.en_US || 'Share') + '"><i class="dashicons dashicons-share"></i></a>' + 538 '<div class="share-menu" style="display:none;">' + 539 '<a href="#" class="share-fb"><i class="dashicons dashicons-facebook"></i></a>' + 540 '<a href="#" class="share-wa"><i class="dashicons dashicons-whatsapp"></i></a>' + 541 '<a href="#" class="share-x"><i class="dashicons dashicons-twitter"></i></a>' + 542 '<a href="#" class="share-email"><i class="dashicons dashicons-email-alt"></i></a>' + 543 '</div>' + 544 '</div>' 545 : '') + 546 '</div>' + 547 '</li>'; 548 $('#wp-chatbot-messages-container').append(msgContent); 549 //Scroll to the last message 550 $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'}); 551 552 setTimeout(function(){ 553 $('#wp-chatbot-messages-container li:last .wp-chatbot-paragraph').html(fristMsg); 554 //Second Message with interval 555 $('#wp-chatbot-messages-container').append(msgContent); 556 //Scroll to the last message 557 $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'}); 558 setTimeout(function(){ 559 $('#wp-chatbot-messages-container li:last .wp-chatbot-paragraph').html(secondMsg).css({'background-color':wpChatBotVar.proactive_bg_color}); 560 //Scroll to the last message 561 $('.wp-chatbot-ball-inner').animate({ scrollTop: $('.wp-chatbot-messages-wrapper').prop("scrollHeight")}, 'slow').parent().find('.slimScrollBar').css({'top':$('.wp-chatbot-ball-inner').height()+'px'}); 562 563 }, 2000); 564 565 }, 2000); 566 } 567 $(document).on('click', '#wp-chatbot-mobile-close, #wp-chatbot-desktop-close', function (event) { 568 $("#wp-chatbot-board-container").toggleClass('active-chat-board'); 569 $("#wp-chatbot-notification-container").removeClass('wp-chatbot-notification-container-disable').addClass('wp-chatbot-notification-container-sliding'); 570 $('#wp-chatbot-chat-container').css({ 571 'right': wpChatBotVar.wp_chatbot_position_x + 'px', 572 'bottom': wpChatBotVar.wp_chatbot_position_y + 'px', 573 'top': 'auto', 'left': 'auto' 574 }); 575 $('#wp-chatbot-ball').find('img').attr('src', botimage)
576 $('.wp-chatbot-ball').css('background', '#ffffff'); 577 $('#wp-chatbot-ball').show(); 578 //Facebook Messenger. 579 if ($('.active-chat-board').length > 0) { 580 $('#wp-chatbot-integration-container').show(); 581 } else { 582 $('#wp-chatbot-integration-container').hide(); 583 } 584 }); 585 586 587 $("#qcld-wp-chatbot-shortcode-style-css").attr("disabled", "disabled"); 588 /*** 589 * Notification Message 590 */ 591 if ($('#wp-chatbot-notification-container').length > 0) { 592 if (sessionStorage.getItem('wpChatbotNotification') && sessionStorage.getItem('wpChatbotNotification') == 'removed') { 593 //if remove on the session. 594 $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable'); 595 } else { 596 //Notification comes with slideIn effect 597 $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-sliding'); 598 //handling welcome & return user welcome msg. 599 if ($.cookie("shopper")) { 600 var shopper = $.cookie("shopper"); 601 var welcomeMsg = wpChatBotVar.welcome_back[0] + ' <strong>' + shopper + '!</strong>'; 602 } else { 603 var welcomeMsg = wpChatBotVar.welcome[0] + ' <strong>' + wpChatBotVar.host + '!</strong>'; 604 605 } 606 $('.wp-chatbot-notification-welcome').html(welcomeMsg); 607 //Notifications msgs handling. 608 var notifications = wpChatBotVar.notifications; 609 if (notifications.length > 1) { 610 var totalNotMsg = wpChatBotVar.notifications.length; 611 var notMsgIndex = 0; 612 var intervalTime = parseInt(wpChatBotVar.notification_interval) * 1000; 613 var notificationInterval = setInterval(function (e) { 614 notMsgIndex++; 615 if (totalNotMsg <= notMsgIndex) { 616 notMsgIndex = 0; 617 } 618 //show new notification time after every intervalTime 619 $('.wp-chatbot-notification-message').css({'opacity': 1}).html(notifications[notMsgIndex]); 620 }, intervalTime); 621 } 622 623 $(".wp-chatbot-notification-close").click(function () { 624 $('#wp-chatbot-notification-container').addClass('wp-chatbot-notification-container-disable'); 625 //clearInterval(notificationInterval); 626 sessionStorage.setItem('wpChatbotNotification', 'removed'); 627 }); 628 } 629 } 630 } 631 else if ($('#wp-chatbot-shortcode-template-container').length > 0) { //Page shortcode area. 632 $('#wp-chatbot-chat-container').css({'display': 'none'}); 633 $('#wp-chatbot-ball').hide(); 634 //Add Scroll to chat ui 635 $('.wp-chatbot-ball-inner').slimScroll({ 636 height: '60hv', 637 start: 'bottom' 638 }).parent().find('.slimScrollBar').css({'top': $('.wp-chatbot-ball-inner').height() + 'px'}); 639 //Add scroll to cart part 640 var recentViewHeight = $('.wp-chatbot-container').outerHeight(); 641 if ($('.chatbot-shortcode-template-02').length == 0) { 642 $('.wp-chatbot-cart-body').slimScroll({height: '200px', start: 'top'}); 643 $('.wp-chatbot-widget .wp-chatbot-products').slimScroll({height: '435px', start: 'top'}); 644 } 645 646 //Remove style of template 647 $("#qcld-wp-chatbot-style-css").attr("disabled", "disabled"); 648 //Here is the Plugin to be load only for once. 649 if (LoadwpwBotPlugin == 0) {
650 $.wpwbot({obj: wpChatBotVar, editor_handler: textEditorHandler}); 651 LoadwpwBotPlugin++; 652 var data = {'action': 'qcld_wb_chatbot_session_count'}; 653 jQuery.post(wpChatBotVar.ajax_url, data, function (response) { 654 // 655 }); 656 } 657 658 659 } 660 else if ($('#wp-chatbot-chat-app-shortcode-container').length > 0) { //App shortcode area. 661 662 textEditorHandler = 1; 663 //App UI (ball inner) 664 setTimeout(function () { 665 var widowH = $(window).height(); 666 //var headerH = $('.wp-chatbot-header').outerHeight(); 667 var footerH = $('.wp-chatbot-footer').outerHeight(); 668 669 var AppContentInner = widowH - footerH; 670 //alert(footerH); 671 $('#wp-chatbot-chat-app-shortcode-container .wp-chatbot-ball-inner').css({'height': AppContentInner + 'px'}) 672 }, 300); 673 $(window).resize(function () { 674 setTimeout(function () { 675 var widowH = $(window).height(); 676 //var headerH = $('.wp-chatbot-header').outerHeight(); 677 var footerH = $('.wp-chatbot-footer').outerHeight(); 678 var AppContentInner = widowH - footerH; 679 //alert(footerH); 680 $('#wp-chatbot-chat-app-shortcode-container .wp-chatbot-ball-inner').css({'height': AppContentInner + 'px'}) 681 }, 300) 682 }); 683 684 $('#wp-chatbot-ball').hide(); 685 //Add Scroll to chat ui 686 $("#qcld-wp-chatbot-shortcode-style-css").attr("disabled", "disabled"); 687 $("#wp-chatbot-board-container").addClass('active-chat-board'); 688 $('.wp-chatbot-ball-inner').slimScroll({ 689 height: '55hv', 690 start: 'bottom' 691 }).parent().find('.slimScrollBar').css({'top': $(window).height() + 'px'}); 692 if (LoadwpwBotPlugin == 0) { 693 $.wpwbot({obj: wpChatBotVar, editor_handler: textEditorHandler}); 694 LoadwpwBotPlugin++; 695 var data = {'action': 'qcld_wb_chatbot_session_count'}; 696 jQuery.post(wpChatBotVar.ajax_url, data, function (response) { 697 // 698 }); 699 } 700 //Handling app cart and checkout 701 $('#wp-chatbot-cart-short-code').hide(); 702 $('#wp-chatbot-checkout-short-code').hide(); 703 $(document).on('click', '.wp-chatbot-cart-link', function (event) { 704 $('.wp-chatbot-messages-wrapper').hide(); 705 $('#wp-chatbot-checkout-short-code').hide(); 706 $('#wp-chatbot-cart-short-code').show(); 707 event.preventDefault(); 708 $('#wp-chatbot-cart-short-code').html('<img class="wp-chatbot-comment-loader" src="' + wpChatBotVar.image_path + 'comment.gif" alt="..." />'); 709 var data = {'action': 'qcld_wb_chatbot_cart_page'}; 710 jQuery.post(wpChatBotVar.ajax_url, data, function (response) { 711 $("#wp-chatbot-cart-short-code").html(response); 712 }); 713 }); 714 $(document).on('click', '.wp-chatbot-checkout-link, .checkout-button', function (event) { 715 event.preventDefault(); 716 $('.wp-chatbot-messages-wrapper').hide(); 717 $('#wp-chatbot-cart-short-code').hide(); 718 $('#wp-chatbot-checkout-short-code').show(); 719 720 721 $('#wp-chatbot-checkout-short-code').html('<img class="wp-chatbot-comment-loader" src="' + wpChatBotVar.image_path + 'comment.gif" alt="..." />'); 722 var data = {'action': 'qcld_wb_chatbot_checkout_page'}; 723 jQuery.post(wpChatBotVar.ajax_url, data, function (response) { 724 if (response.status == 'yes') { 725 window.location.href = response.html; 726 } else { 727 $("#wp-chatbot-checkout-short-code").html(response.html); 728 } 729 730 }); 731 }); 732 //Preventing url redirect from cart page. 733 $(document).on('click', '#wp-chatbot-chat-app-shortcode-container .wpcommerce-cart-form a', function (e) { 734 e.preventDefault(); 735 }); 736 } 737 //For variable product configuration 738 $(document).on('change', "#wp-chatbot-product-variable select ", function () { 739 var variations = JSON.parse($("#wp-chatbot-variation-data").attr('data-product-variation')); 740 var item_conditions = []; 741 742 var totalAttr = $("#wp-chatbot-product-variable select").length; 743 var i = 1; 744 $("#wp-chatbot-product-variable select").each(function (index, element) { 745 var myVal = $(this).find('option:selected').val(); 746 if (myVal != "") { 747 item_conditions.push({ 748 'left': 'item["variation_data"]["' + $(this).attr('name') + '"][0]', 749 'right': myVal
750 }) 751 } 752 }); 753 var newVariation = []; 754 for (var a = 0; variations.length > a; a++) { 755 var item = variations[a]; 756 var item_condition = ""; 757 for (var i = 0; item_conditions.length > i; i++) { 758 759 if (i > 0) { 760 item_condition += ' && ' + '"' + eval(item_conditions[i].left).toLowerCase() + '"' + '==' + '"' + item_conditions[i].right.toLowerCase() + '"'; 761 } else { 762 item_condition += '"' + eval(item_conditions[i].left).toLowerCase() + '"' + '==' + '"' + item_conditions[i].right.toLowerCase() + '"'; 763 } 764 } 765 if (eval(item_condition)) { 766 newVariation[0] = item; 767 } 768 } 769 if (newVariation.length > 0) { 770 $('#wp-chatbot-variation-add-to-cart').attr('variation_id', newVariation[0]['variation_id']); 771 var priceSets = ""; 772 if (newVariation[0]['variation_data']['_sale_price'][0] != "") { 773 priceSets += '<strike>' + wpChatBotVar.currency_symbol + newVariation[0]['variation_data']['_regular_price'][0] + '</strike> <strong>' + wpChatBotVar.currency_symbol + newVariation[0]['variation_data']['_sale_price'][0] + '</strong>' 774 } else { 775 priceSets += '<strong>' + wpChatBotVar.currency_symbol + newVariation[0]['variation_data']['_regular_price'][0] + '</strong>'; 776 } 777 $('#wp-chatbot-product-price').html(priceSets); 778 } 779 }); 780 781 if ($('.active-chat-board').length > 0) { 782 $('#wp-chatbot-integration-container').show(); 783 } else { 784 $('#wp-chatbot-integration-container').hide(); 785 } 786 //Facebook Messenger Integration 787 /* if(wpChatBotVar.enable_messenger == 1){ 788 $(document).on('click','.fb_dialog',function (e) { 789 $('#wp-chatbot-board-container').removeClass('active-chat-board'); 790 $('.fb_dialog').css({'display': 'inline'}); 791 setTimeout(function (e) { 792 $('.fb-customerchat >span').css({'display': 'inline'}); 793 $('.fb_dialog').trigger('click'); //.css({'display': 'none'}); 794 },300); 795 $('#wp-chatbot-integration-container').hide(); 796 }); 797 }*/ 798 //skype 799 if (wpChatBotVar.enable_skype == 1) { 800 $(document).on('click', '.inetegration-skype-btn', function (e) { 801 $('#wp-chatbot-board-container').removeClass('active-chat-board'); 802 // $('.lwc-button-icon').trigger('click'); 803 $('#wp-chatbot-integration-container').hide(); 804 }); 805 806 } 807 808 809 }); 810 811});
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.