// source --> http://ada-security.com/2013/wp-content/plugins/wp-live-chat-support/js/wplc_u.js?ver=7.1.07 /* * Cookie Status * * 1 - complete - user has left site * 2 - pending - user waiting for chat to be answered by admin * 3 - active chat - user and admin are chatting * 4 - deleted * 5 - browsing - no data has been inputted * 6 - requesting chat - admin has requested a chat with user * 7 - timed out - visitor has timed out * 8 - complete but now browsing again * 9 - user closed chat before starting chat * 10 - user minimized active chat * 11 - user moved on to another page (session variable is different) * 12 - user has not been answered after sending chat request and is still active * */ var wplc_is_chat_open = false; var wplc_online = false; var wplc_agent_name = ""; var msg_history = new Array(); var wplc_is_minimized = false; /* global to hold whether or not the chat box is minimized */ var wplc_retry_interval = null; var wplc_run = true; var wplc_server = null; wplc_server = new WPLCServer(); var wplc_server_last_loop_data = null; var wplc_shown_welcome = false; var wplc_current_agent = false; jQuery(document).ready(function() { var wplc_session_variable = new Date().getTime(); var wplc_cid; var wplc_check_hide_cookie; var wplc_chat_status = ""; var wplc_cookie_name = ""; var wplc_cookie_email = ""; var wplc_init_chat_box_check = true; var wplc_cid = null; var initial_data = {}; var wplc_fist_run = true; var wplc_long_poll_delay = 1500; /* preload the images */ wplc_preload(); wplc_cid = Cookies.get('wplc_cid'); if(typeof wplc_cid === 'undefined'){ wplc_cid = null; } else { wplc_cid = Cookies.get('wplc_cid'); } wplc_check_hide_cookie = Cookies.get('wplc_hide'); wplc_check_minimize_cookie = Cookies.get('wplc_minimize'); wplc_chat_status = Cookies.get('wplc_chat_status'); wplc_cookie_name = Cookies.get('wplc_name'); wplc_cookie_email = Cookies.get('wplc_email'); // Always start on 5 - ajax will then return chat status if active Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' }); wplc_chat_status = 5; //if (typeof wplc_chat_status !== "undefined" && parseInt(wplc_chat_status) === 3) { } else { //} var data = { action: 'wplc_get_chat_box', security: wplc_nonce, cid: wplc_cid }; jQuery.ajax({ url: wplc_ajaxurl_site, data:data, type:"POST", success: function(response) { /* inject html */ if(response){ if (response === "0") { if (window.console) { console.log('WP Live Chat Support Return Error'); } wplc_run = false; return; } response = JSON.parse(response); jQuery( "body" ).append( response['cbox']); wplc_listenForScrollEvent(jQuery("#wplc_chatbox")); if( typeof wplc_cookie_name == 'undefined' || typeof wplc_cookie_email == 'undefined' ){ var wplc_cookie_name = jQuery( jQuery.parseHTML( response['cbox'] ) ).find( "#wplc_name" ).val(); var wplc_cookie_email = jQuery( jQuery.parseHTML( response['cbox'] ) ).find( "#wplc_email" ).val(); } /* is an agent online? */ if (response['online'] === false) { wplc_run = false; wplc_online = false; } else { wplc_online = true; } if (wplc_filter_run_override !== "1" || wplc_online === false) { wplc_run = false; } else { /* we can run */ } /* has this user been assigned an agent? */ if (typeof response['type'] === "undefined") { wplc_shown_welcome = false; } else { if (response['type'] === "returning") { wplc_shown_welcome = true; /* set the agent vars so we can access them on the fly */ if (typeof response['agent_data'] !== "undefined") { wplc_current_agent = response['agent_data']; } } else { wplc_shown_welcome = false; } } /*Support mobile loggin*/ var wplc_mobile_check = false; if(typeof wplc_is_mobile !== "undefined" && (wplc_is_mobile === "true" || wplc_is_mobile === true)){ wplc_mobile_check = true; } /* start long polling */ var data = { action: 'wplc_call_to_server_visitor', security: wplc_nonce, cid:wplc_cid, wplc_name: wplc_cookie_name, wplc_email: wplc_cookie_email, status:wplc_chat_status, wplcsession:wplc_session_variable, wplc_is_mobile: wplc_mobile_check, wplc_extra_data:wplc_extra_data }; if(wplc_server.browserIsSocketReady()){ data.socket = true; } initial_data = data; // ajax long polling function if (wplc_filter_run_override !== "1" || wplc_online === false) { wplc_call_to_server_chat(data,true,true); } else { wplc_call_to_server_chat(data,true,false); } if(wplc_cid !== null && wplc_init_chat_box_check == true && wplc_init_chat_box !== false){ wplc_init_chat_box(wplc_cid,wplc_chat_status); } } } }); /** * Preload images from the localized variable * @return void */ function wplc_preload() { var images = []; if (typeof wplc_preload_images !== "undefined" && typeof wplc_preload_images === "object" ) { var wplc_i = 0; for (var key in wplc_preload_images) { images[wplc_i] = new Image(); images[wplc_i].src = wplc_preload_images[key]; wplc_i++; } } } /** * Detect if the chatbox is being scrolled. * * This had to be created as jQuery does not allow the scroll event to bubble up the DOM tree. * * Thank you Bikal Basnet (https://stackoverflow.com/questions/16505182/bind-scroll-event-to-dynamic-div) * * @param object el The element in question */ function wplc_listenForScrollEvent(el) { el.on("scroll", function(){ el.trigger("wplc-custom-scroll"); }) } /** * This instantly sends the user the welcome message (i.e. to wait for any agent and start typing so long) * * */ function wplc_send_welcome_message() { if(wplc_welcome_msg !== "" && !wplc_shown_welcome){ message_class = "wplc_system_notification wplc-color-4"; var concatenated_message = ""; concatenated_message += wplc_welcome_msg; concatenated_message += ""; if(typeof niftyFormatParser !== "undefined"){ jQuery("#wplc_chatbox").append(niftyFormatParser(concatenated_message)); } else{ jQuery("#wplc_chatbox").append(concatenated_message); } wplc_scroll_to_bottom(); wplc_shown_welcome = true; } } /** * Scrolls the chat box to the bottom * */ function wplc_scroll_to_bottom() { var height = jQuery('#wplc_chatbox')[0].scrollHeight; jQuery('#wplc_chatbox').scrollTop(height); } function wplc_user_message_receiver(data){ if(typeof wplc_loop_response_handler !== "undefined" && typeof wplc_loop_response_handler === "function"){ wplc_loop_response_handler(data, wplc_server_last_loop_data); data = JSON.parse(data); if(typeof data['status'] !== "undefined"){ delete wplc_server_last_loop_data.status; } if(data.keep_alive === true){ setTimeout(function(){ wplc_server_last_loop_data.status = wplc_chat_status; wplc_call_to_server_chat(wplc_server_last_loop_data); },100); } } } function wplc_user_retry_handler(data){ var tstatus = Cookies.get("wplc_chat_status"); if (tstatus !== "undefined") { if(tstatus !== 8 || tstatus !== 1){ wplc_retry_interval = setTimeout(function(){ wplc_server.prepareTransport(function(){ //Transport ready... wplc_server_last_loop_data.status = parseInt(tstatus); //Set to existing status wplc_call_to_server_chat(wplc_server_last_loop_data); }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error); },500); } } } function wplc_call_to_server_chat(data,first_run,short_poll) { if (typeof first_run === "undefined") { first_run = false; }; if (typeof short_poll === "undefined") { short_poll = false; }; data.first_run = first_run; data.short_poll = short_poll; if(typeof Cookies.get('wplc_name') !== "undefined"){ data.msg_from_print = Cookies.get('wplc_name'); } wplc_server_last_loop_data = data; wplc_server.send(wplc_ajaxurl, data, "POST", 120000, function(response) { wplc_long_poll_delay = 1500; wplc_loop_response_handler(response, data); }, function(jqXHR, exception) { wplc_long_poll_delay = 5000; if (jqXHR.status == 404) { wplc_log_connection_error('Error: Requested page not found. [404]'); wplc_run = false; } else if (jqXHR.status == 500) { wplc_log_connection_error('Error: Internal Server Error [500].'); wplc_log_connection_error('Retrying in 5 seconds...'); wplc_run = true; } else if (exception === 'parsererror') { wplc_log_connection_error('Error: Requested JSON parse failed.'); wplc_run = false; } else if (exception === 'abort') { wplc_log_connection_error('Error: Ajax request aborted.'); wplc_run = false; } else { wplc_log_connection_error('Error: Uncaught Error.\n' + jqXHR.responseText); wplc_log_connection_error('Retrying in 5 seconds...'); wplc_run = true; } }, function(response){ if (wplc_run) { if(wplc_server.isInSocketMode() === false && wplc_server.isPreparingSocketMode() === false){ setTimeout(function() { wplc_call_to_server_chat(data,false,false); }, wplc_long_poll_delay); } else if ((wplc_server.isInSocketMode() === false && wplc_server.isPreparingSocketMode() === true) && (typeof wplc_transport_prepared !== "undefined" && wplc_transport_prepared === false)) { /* Allows for initiate chat to work on the node server */ if (typeof wplc_use_node_server !== "undefined" && wplc_use_node_server === "true") { /* do not run this if using not the node jedi */ setTimeout(function() { wplc_call_to_server_chat(data,false,true); }, 7500); } } else { if(typeof response !== "undefined" && typeof response.responseText !== "undefined" && response.responseText !== ""){ var response_data = JSON.parse(response.responseText); if (typeof wplc_transport_prepared !== "undefined") { if(wplc_transport_prepared !== true && (parseInt(response_data.status) === 3 || parseInt(response_data.status) === 2)){ //Transport is unprepared and the user has returned to the page with a status 3/2 wplc_server.prepareTransport(function(){ wplc_call_to_server_chat(data,false,false); }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error); } } } } } } ); }; function wplc_loop_response_handler(response, data){ if(response){ if (response === "0") { if (window.console) { console.log('WP Live Chat Support Return Error'); } wplc_run = false; return; } if (typeof response !== "object") { response = JSON.parse(response); } data['action_2'] = ""; if(typeof response['wplc_name'] !== "undefined"){ data['wplc_name'] = response['wplc_name']; /* Cookies.set('wplc_name', response['wplc_name'], { expires: 1, path: '/' });*/ } if(typeof response['wplc_email'] !== "undefined"){ data['wplc_email'] = response['wplc_email']; /* Cookies.set('wplc_email', response['wplc_email'], { expires: 1, path: '/' }); */ } if(typeof response['cid'] !== "undefined"){ data['cid'] = response['cid']; Cookies.set('wplc_cid', response['cid'], { expires: 1, path: '/' }); } if(typeof response['aname'] !== "undefined") { wplc_agent_name = response['aname']; } if(typeof response['cid'] !== "undefined" && wplc_cid !== jQuery.trim(response['cid'])){ wplc_cid = jQuery.trim(response['cid']); jQuery("#wplc_cid").val(wplc_cid); } if(typeof response['status'] !== "undefined" && parseInt(wplc_chat_status) !== parseInt(response['status'])){ wplc_chat_status = response['status']; Cookies.set('wplc_chat_status', null, { path: '/' }); Cookies.set('wplc_chat_status', wplc_chat_status, { expires: 1, path: '/' }); } /* Trigger for handling responses */ jQuery.event.trigger({type: "wplc_user_chat_loop",response:response}); /* Process status changes */ if(data['status'] == response['status']){ if(data['status'] == 5 && wplc_init_chat_box_check === true && wplc_init_chat_box !== false){ // open chat box on load wplc_init_chat_box(data['cid'], data['status']); } if((response['status'] == 3 || response['status'] == 2) && response['data'] != null){ // if active and data is returned wplc_run = true; var wplc_new_message_sound = false; if (typeof response['data'] === "object") { for (var index in response['data']) { if(typeof response['data'][index] !== "object"){ if (typeof msg_history[index] === "undefined") { //Not from node /* we dont have this message */ msg_history[index] = true; msg_to_parse = response['data'][index].wplcStripSlashes(); if(typeof niftyFormatParser !== "undefined"){ jQuery("#wplc_chatbox").append(niftyFormatParser(msg_to_parse)); } else{ jQuery("#wplc_chatbox").append(response['data'][index].wplcStripSlashes()); } wplc_new_message_sound = true; } else { /* we already have this message */ } } else { var the_message = response['data'][index]; the_message.mid = index; wplc_push_message_to_chatbox(the_message,'u', function() { wplc_scroll_to_bottom(); }); } } } else { /* backwards compatibility - response['data'] is a string */ if(typeof niftyFormatParser !== "undefined"){ jQuery("#wplc_chatbox").append(niftyFormatParser(response['data'].wplcStripSlashes())); } else{ jQuery("#wplc_chatbox").append(response['data'].wplcStripSlashes()); } wplc_new_message_sound = true; } if(wplc_new_message_sound){ wplc_scroll_to_bottom(); if (typeof wplc_enable_ding !== 'undefined' && wplc_enable_ding === "1") { new Audio(wplc_plugin_url+'/wp-live-chat-support/ding.mp3').play(); } } } } else { data['status'] = wplc_chat_status; Cookies.set('wplc_chat_status', wplc_chat_status, { expires: 1, path: '/' }); if(response['status'] == 0 || response['status'] == 12){ // no answer from admin jQuery("#wp-live-chat-3").hide(); if (typeof response['data'] !== "undefined") { jQuery("#wplc_chatbox").append(response['data'].wplcStripSlashes()+"
"); } } else if(response['status'] == 8){ // chat has been ended by admin wplc_run = false; document.getElementById('wplc_chatmsg').disabled = true; wplc_shown_welcome = false; the_message = {}; the_message.originates = 0; the_message.msg = wplc_error_messages.chat_ended_by_operator; the_message.other = {}; var wplc_d = new Date(); the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 ); wplc_push_message_to_chatbox(the_message,'u', function() { wplc_scroll_to_bottom(); }); /* if(typeof response['data'] === "object") { for (var index in response['data']) { if(typeof response['data'][index] === "object"){ var the_message = response['data'][index]; if(typeof the_message.originates !== "undefined"){ var message_class = ""; var message_content = ""; if (parseInt(the_message.originates) === 0){ //System Notification message_class = "wplc_system_notification wplc-color-4"; message_content = the_message.msg; if(message_content !== ""){ var concatenated_message = ""; concatenated_message += message_content; concatenated_message += ""; if(typeof niftyFormatParser !== "undefined"){ jQuery("#wplc_chatbox").append(niftyFormatParser(concatenated_message)); } else{ jQuery("#wplc_chatbox").append(concatenated_message); } } } } } } } else { //Backwards Compat jQuery("#wplc_chatbox").append(""+response['data']+"
"); }*/ jQuery.event.trigger({type: "wplc_end_chat"}); } else if(parseInt(response['status']) == 11){ /* use moved on to another page (perhaps in another tab so close this instance */ jQuery("#wp-live-chat").css({ "display" : "none" }); wplc_run = false; } else if(parseInt(response['status']) == 3 || parseInt(response['status']) == 2 || parseInt(response['status']) == 10){ // re-initialize chat wplc_run = true; if(parseInt(response['status']) == 3) { // only if not minimized open aswell /* HERE NODE */ if (typeof wplc_use_node_server !== "undefined" && wplc_use_node_server === "true") { /* do not run this if using not the node jedi */ if (typeof wplc_transport_prepared !== "undefined" && wplc_transport_prepared === false) { wplc_server.prepareTransport(function(){ wplc_call_to_server_chat(wplc_server_last_loop_data,false,false); }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error); } } if (!wplc_is_minimized) { if (!wplc_is_chat_open) { wplc_cbox_animation(); setTimeout(function() { open_chat(0); },1500); } } if(jQuery('#wp-live-chat').hasClass('wplc_left') === true || jQuery('#wp-live-chat').hasClass('wplc_right') === true){ //jQuery('#wp-live-chat').height("400px"); } } if(parseInt(response['status']) == 10) { // only if not minimized open aswell wplc_run = true; open_chat(0); } if(response['data'] != null){ // append messages to chat area if (typeof response['data'] === "object") { for (var index in response['data']) { wplc_new_message_sound = false; if(typeof response['data'][index] !== "object"){ if (typeof msg_history[index] === "undefined") { /* we dont have this message */ msg_history[index] = true; if(typeof niftyFormatParser !== "undefined"){ jQuery("#wplc_chatbox").append(niftyFormatParser(response['data'][index].wplcStripSlashes())); } else{ jQuery("#wplc_chatbox").append(response['data'][index].wplcStripSlashes()); } wplc_new_message_sound = true; } else { /* we already have this message */ } } else { var the_message = response['data'][index]; the_message.mid = index; wplc_push_message_to_chatbox(the_message,'u', function() { wplc_scroll_to_bottom(); }); } if(wplc_new_message_sound){ if (response['alert']) { jQuery('#wplc-chat-alert').addClass('is-active'); } wplc_scroll_to_bottom(); if (typeof wplc_enable_ding !== 'undefined' && wplc_enable_ding === "1") { new Audio(wplc_plugin_url+'/wp-live-chat-support/ding.mp3').play(); } } } } else { /* backwards compatibility - response['data'] is a string */ if(typeof niftyFormatParser !== "undefined"){ jQuery("#wplc_chatbox").append(niftyFormatParser(response['data'].wplcStripSlashes())); } else{ jQuery("#wplc_chatbox").append(response['data'].wplcStripSlashes()); } } if(response['data']){ wplc_scroll_to_bottom(); } } } } } } function wplc_log_connection_error(error){ if (window.console) { console.log(error); } jQuery("#wplc_chatbox").append("" + error + "
"); wplc_scroll_to_bottom(); } function wplc_display_error(error) { the_message = {}; the_message.originates = 2; the_message.msg = error; the_message.other = {}; var wplc_d = new Date(); the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 ); wplc_push_message_to_chatbox(the_message,'u', function() { wplc_scroll_to_bottom(); }); } function wplc_init_chat_box(cid, status){ if(wplc_chat_status == 9 && wplc_check_hide_cookie == "yes"){ } else if (wplc_chat_status === 3) { wplc_cbox_animation(); } else { if(wplc_check_hide_cookie != "yes"){ wplc_dc = setTimeout(function (){ wplc_cbox_animation(); }, parseInt(window.wplc_delay)); } } wplc_init_chat_box = false; } function wplc_cbox_animation() { /* * 1- Slide Up * 2- Slide Across (Left/Right) * 3- Slide Down * 4- Fade In */ var wplc_window_id = jQuery("#wp-live-chat"); var wplc_theme_chosen = jQuery(wplc_window_id).attr('wplc_animation'); switch(wplc_theme_chosen){ case 'none': jQuery(wplc_window_id).css('display', 'block'); break; case 'animation-1': // Slide Up jQuery(wplc_window_id).animate({'marginBottom' : '0px'}, 1000); break; case 'animation-2-bl': // Slide Accross from left jQuery(wplc_window_id).animate({'left' : '20px'}, 1000); break; case 'animation-2-br': // Slide Accross from right jQuery(wplc_window_id).animate({'right' : '20px'}, 1000); break; case 'animation-2-l': // Slide Accross from left jQuery(wplc_window_id).animate({"left" : '0px'}, 1000); break; case 'animation-2-r': // Slide Accross from right jQuery(wplc_window_id).animate({'right' : '0px'}, 1000); break; case 'animation-3': // Fade In jQuery(wplc_window_id).fadeIn('slow'); case 'animation-4': jQuery(wplc_window_id).css('display', 'block'); break; default: jQuery(wplc_window_id).css('display', 'block'); break; } //jQuery("#wp-live-chat").css({ "display" : "block" }); if(jQuery("#wp-live-chat").attr('wplc-auto-pop-up') === "1"){ open_chat(0); } jQuery.event.trigger({type: "wplc_animation_done"}); } function wplc_sound(source,volume,loop) { this.source=source; this.volume=volume; this.loop=loop; var son; this.son=son; this.finish=false; this.stop=function() { document.body.removeChild(this.son); } this.start=function() { if(this.finish)return false; this.son=document.createElement("embed"); this.son.setAttribute("src",this.source); this.son.setAttribute("hidden","true"); this.son.setAttribute("volume",this.volume); this.son.setAttribute("autostart","true"); this.son.setAttribute("loop",this.loop); document.body.appendChild(this.son); } this.remove=function() { document.body.removeChild(this.son); this.finish=true; } this.init=function(volume,loop) { this.finish=false; this.volume=volume; this.loop=loop; } } //placeholder text fix for IE jQuery('#wp-live-chat [placeholder]').focus(function() { var input = jQuery(this); if (input.val() == input.attr('placeholder')) { input.val(''); input.removeClass('placeholder'); } }).blur(function() { var input = jQuery(this); if (input.val() == '' || input.val() == input.attr('placeholder')) { input.addClass('placeholder'); input.val(input.attr('placeholder')); } }).blur(); /* minimize chat window */ jQuery("body").on("click", "#wp-live-chat-minimize", function() { jQuery.event.trigger({type: "wplc_minimize_chat"}); }); /* close chat window */ jQuery("body").on("click", "#wp-live-chat-close", function() { jQuery("#wp-live-chat").hide(); jQuery("#wp-live-chat-1").hide(); jQuery("#wp-live-chat-2").hide(); jQuery("#wp-live-chat-3").hide(); jQuery("#wp-live-chat-4").hide(); jQuery("#wplc_social_holder").hide(); jQuery("#nifty_ratings_holder").hide(); jQuery("#wp-live-chat-react").hide(); jQuery("#wp-live-chat-minimize").hide(); if (typeof wplc_hide_chat !== "undefined" && wplc_hide_chat !== "" && wplc_hide_chat !== null) { Cookies.set('wplc_hide', wplc_hide_chat , { expires: 1, path: '/' }); } else { var wplc_expire_date = new Date(); var minutes = 2; wplc_expire_date.setTime(wplc_expire_date.getTime() + (minutes * 60 * 1000)); Cookies.set('wplc_hide', "yes" , { expires: wplc_expire_date , path: '/' }); } var data = { action: 'wplc_user_close_chat', security: wplc_nonce, cid: wplc_cid, status: wplc_chat_status }; jQuery.post(wplc_ajaxurl, data, function(response) { }); }); //open chat window function function open_chat(force){ jQuery.event.trigger({type: "wplc_open_chat_1"}); wplc_chat_status = Cookies.get('wplc_chat_status'); /** * double check we have a cookie. If not, set to 5 so that the chat box can atleast restart * https://github.com/CodeCabin/wp-live-chat-support/issues/313 */ if( wplc_chat_status == null || wplc_chat_status == 'null' ){ Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' }); wplc_chat_status = 5; } if (parseInt(wplc_chat_status) == 3 || parseInt(wplc_chat_status) == 2 || parseInt(wplc_chat_status) == 0 || parseInt(wplc_chat_status) == 12) { jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online}); Cookies.set('wplc_had_chat', true, { path: '/' }); wplc_send_welcome_message(); if (parseInt(wplc_chat_status) == 0 || parseInt( wplc_chat_status ) == 11 || parseInt(wplc_chat_status) == 12) { /* user was a missed chat, now lets change them back to "pending" */ wplc_chat_status = 2; } if(typeof wplc_start_chat_pro_custom_fields_filter !== "undefined" && typeof wplc_start_chat_pro_custom_fields_filter === "function"){ wplc_extra_data = wplc_start_chat_pro_custom_fields_filter(wplc_extra_data); } if (wplc_online) { var data = { action: 'wplc_user_maximize_chat', security: wplc_nonce, cid: wplc_cid, chat_status : parseInt(wplc_chat_status), wplc_extra_data:wplc_extra_data }; jQuery.post(wplc_ajaxurl, data, function(response) { //log("user maximized chat success"); }); } } else if (parseInt(wplc_chat_status) == 10) { jQuery("#wp-live-chat-minimize").trigger("click"); } else if (wplc_chat_status == 5 || wplc_chat_status == 9 || wplc_chat_status == 8){ if(jQuery("#wp-live-chat-2").is(":visible") === false && jQuery("#wp-live-chat-4").is(":visible") === false){ jQuery("#wp-live-chat-2").show(); jQuery("#wp-live-chat-2-inner").show(); var wplc_visitor_name = Cookies.get('wplc_name'); if(Cookies.get('wplc_email') !== "no email set" && typeof wplc_visitor_name !== "undefined"){ jQuery("#wplc_name").val(Cookies.get('wplc_name')); jQuery("#wplc_email").val(Cookies.get('wplc_email')); } jQuery("#wp-live-chat-header").addClass("active"); } } /*else if (wplc_chat_status == 2){ jQuery("#wp-live-chat-3").show(); } */ else if(wplc_chat_status == 1){ jQuery("#wp-live-chat-4").show(); jQuery("#wplc_social_holder").show(); jQuery("#nifty_ratings_holder").show(); jQuery.event.trigger({type: "wplc_animation_done"}); jQuery("#wplc_chatbox").append(wplc_error_messages.chat_ended_by_operator+"
"); wplc_scroll_to_bottom(); jQuery("#wp-live-chat-minimize").hide(); document.getElementById('wplc_chatmsg').disabled = true; } wplc_is_chat_open = true; } //allows for a class to open chat window now jQuery("body").on("click", ".wp-live-chat-now", function() { open_chat(0); }); jQuery(document).on("wplc_minimize_chat", function() { wplc_is_minimized = true; Cookies.set('wplc_minimize', "yes", { expires: 1, path: '/' }); wplc_chat_status = Cookies.get('wplc_chat_status'); if(typeof wplc_start_chat_pro_custom_fields_filter !== "undefined" && typeof wplc_start_chat_pro_custom_fields_filter === "function"){ wplc_extra_data = wplc_start_chat_pro_custom_fields_filter(wplc_extra_data); } if(wplc_chat_status != 5 && wplc_chat_status != 10 && wplc_chat_status != 9 && wplc_chat_status != 8){ if (wplc_online) { var data = { action: 'wplc_user_minimize_chat', security: wplc_nonce, cid: wplc_cid, wplc_extra_data:wplc_extra_data }; jQuery.post(wplc_ajaxurl, data, function(response) { }); } } if (typeof wplc_enable_ga !== "undefined" && wplc_enable_ga === '1' && wplc_online) { if (typeof ga !== "undefined") { ga('send', { hitType: 'event', eventCategory: 'WP_Live_Chat_Support', eventAction: 'Event', eventLabel: 'Minimize Chat' }); } } }); jQuery(document).on("wplc_start_chat", function() { if (typeof wplc_enable_ga !== "undefined" && wplc_enable_ga === '1') { if (typeof ga !== "undefined") { ga('send', { hitType: 'event', eventCategory: 'WP_Live_Chat_Support', eventAction: 'Event', eventLabel: 'Start Chat' }); } } }); jQuery(document).on("wplc_open_chat_1", function() { if (typeof wplc_enable_ga !== "undefined" && wplc_enable_ga === '1') { if (typeof ga !== "undefined") { ga('send', { hitType: 'event', eventCategory: 'WP_Live_Chat_Support', eventAction: 'Event', eventLabel: 'Start Chat - Step 1' }); } } }); jQuery(document).on("wplc_open_chat_2", function() { if (typeof wplc_enable_ga !== "undefined" && wplc_enable_ga === '1') { if (typeof ga !== "undefined") { ga('send', { hitType: 'event', eventCategory: 'WP_Live_Chat_Support', eventAction: 'Event', eventLabel: 'Start Chat - Step 2' }); } } }); jQuery(document).on("wplc_agent_joined", function(e) { var temail = ''; var tname = ''; var taid = ''; var ta_tagline = ''; var ta_bio = ''; if (typeof e.ndata.other.email !== "undefined") { temail = e.ndata.other.email; } if (typeof e.ndata.other.name !== "undefined") { tname = e.ndata.other.name; } if (typeof e.ndata.other.aid !== "undefined") { taid = e.ndata.other.aid; } if (typeof e.ndata.other.agent_tagline !== "undefined") { ta_tagline = e.ndata.other.agent_tagline; } if (typeof e.ndata.other.agent_bio !== "undefined") { ta_bio = e.ndata.other.agent_bio; } wplc_current_agent = e.ndata.other; jQuery(".wplc_no_answer").remove(); jQuery(".admin_chat_name").html(tname); wplc_node_pair_name = tname; wplc_agent_name = tname; }); jQuery("body").on("click", "#wplc_start_chat_btn", function() { var wplc_name = jQuery("#wplc_name").val(); var wplc_email = jQuery("#wplc_email").val(); if (wplc_name.length <= 0) { alert(wplc_error_messages.valid_name); return false; } if (wplc_email.length <= 0) { alert(wplc_error_messages.valid_email); return false; } if(jQuery("#wplc_email").attr('wplc_hide') !== "1"){ var testEmail = /^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,12}$/i; //var testEmail = /^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i; if (!testEmail.test(wplc_email)){ alert(wplc_error_messages.valid_email); return false; } } document.getElementById('wplc_chatmsg').disabled = false; /* start the long polling */ wplc_run = true; wplc_send_welcome_message(); wplc_scroll_to_bottom(); /* if (wplc_filter_run_override === "1" || wplc_online === false) { } else { initial_data.status = 2; // force the loop to start only now, as we are not using the initiate extension wplc_call_to_server_chat(initial_data,false,false); }*/ jQuery.event.trigger({type: "wplc_start_chat"}); var date = new Date(); date.setTime(date.getTime() + (2 * 60 * 1000)); wplc_cid = Cookies.get('wplc_cid'); if(typeof wplc_start_chat_pro_custom_fields_filter !== "undefined" && typeof wplc_start_chat_pro_custom_fields_filter === "function"){ wplc_extra_data = wplc_start_chat_pro_custom_fields_filter(wplc_extra_data); } if (typeof wplc_cid !== "undefined" && wplc_cid !== null) { /* we've already recorded a cookie for this person */ var data = { action: 'wplc_start_chat', security: wplc_nonce, name: wplc_name, email: wplc_email, cid: wplc_cid, wplcsession: wplc_session_variable, wplc_extra_data:wplc_extra_data }; if(typeof wplc_start_chat_pro_data !== "undefined" && typeof wplc_start_chat_pro_data === "function"){ data = wplc_start_chat_pro_data(data); } } else { // no cookie recorded yet for this visitor var data = { action: 'wplc_start_chat', security: wplc_nonce, name: wplc_name, email: wplc_email, wplcsession: wplc_session_variable, wplc_extra_data:wplc_extra_data }; if(typeof wplc_start_chat_pro_data !== "undefined" && typeof wplc_start_chat_pro_data === "function"){ data = wplc_start_chat_pro_data(data); } } Cookies.set('wplc_name', wplc_name, { path: '/' } ); Cookies.set('wplc_email', wplc_email, { path: '/' } ); wplc_server.send(wplc_ajaxurl, data, "POST", 120000, function(response){ wplc_chat_status = 2; Cookies.set('wplc_chat_status', 2, { expires: date, path: '/' }); wplc_cid = jQuery.trim(response); //All sorted, let's check for message transport mode wplc_server.prepareTransport(function(){ //Transport ready... wplc_server_last_loop_data.status = 2; //Set to waiting if (wplc_filter_run_override === "1" || wplc_online === false) { } else { wplc_call_to_server_chat(wplc_server_last_loop_data); } }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error); }, function(){ //Fails }, function(response, wplc_send_data){ //Complete if (typeof wplc_send_data !== "undefined" && typeof wplc_send_data['action'] !== "undefined" && wplc_send_data['action'] == 'wplc_start_chat') { /* we got here because the short poll (when disabling the initiate chat feature) comes back on the "complete" callback. This check makes sure we restart the longpoll */ wplc_chat_status = 2; Cookies.set('wplc_chat_status', 2, { expires: date, path: '/' }); wplc_cid = jQuery.trim(response); //All sorted, let's check for message transport mode wplc_server.prepareTransport(function(){ //Transport ready... wplc_server_last_loop_data.status = 2; //Set to waiting if (wplc_filter_run_override === "1" || wplc_online === false) { } else { wplc_call_to_server_chat(wplc_server_last_loop_data); } }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error); } } ); }); jQuery("body").on("click", "#wplc_na_msg_btn", function() { var wplc_name = jQuery("#wplc_name").val(); var wplc_email = jQuery("#wplc_email").val(); var wplc_msg = jQuery("#wplc_message").val(); var wplc_domain = jQuery("#wplc_domain_offline").val(); var ip_address = jQuery("#wplc_ip_address").val(); if (wplc_name.length <= 0) { alert(wplc_error_messages.valid_name); return false; } if (wplc_email.length <= 0) { alert(wplc_error_messages.valid_email); return false; } var testEmail = /^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,12}$/i; if (!testEmail.test(wplc_email)){ alert(wplc_error_messages.valid_email); return false; } if (wplc_msg.length <= 0) { alert(wplc_error_messages.empty_message); return false; } jQuery("#wp-live-chat-2-info").hide(); jQuery("#wplc_message_div").html(wplc_offline_msg); wplc_cid = Cookies.get('wplc_cid'); var data = { action: 'wplc_user_send_offline_message', security: wplc_nonce, cid: wplc_cid, name: wplc_name, email: wplc_email, msg: wplc_msg, ip: ip_address, domain: wplc_domain, wplc_extra_data:wplc_extra_data }; jQuery.post(wplc_ajaxurl_site, data, function(response) { jQuery("#wplc_message_div").html(wplc_offline_msg3); }); if (typeof wplc_enable_ga !== "undefined" && wplc_enable_ga === '1') { if (typeof ga !== "undefined") { ga('send', { hitType: 'event', eventCategory: 'WP_Live_Chat_Support', eventAction: 'Event', eventLabel: 'User Send Offline Message' }); } } }); function wplc_strip(str) { str=str.replace(/
/gi, "\n"); str=str.replace(//gi, "\n"); str=str.replace(/(.*?)<\/a>/gi, " $2 ($1) "); str=str.replace(/<(?:.|\s)*?>/g, ""); str=str.replace('iframe', ""); str=str.replace('src', ""); str=str.replace('href', ""); str=str.replace('<', ""); str=str.replace('>', ""); /* remove the last carriage return from the text area output */ str=str.replace(/\n$/, "") return str; } jQuery("body").on("keyup","#wplc_chatmsg", function(event){ if(event.keyCode === 13){ jQuery("#wplc_send_msg").trigger("click"); } }); jQuery("body").on("click", "#wplc_send_msg", function() { var wplc_cid = jQuery("#wplc_cid").val(); if (wplc_cid.length < 1) { /* failover for wplc_cid */ var wplc_cid = Cookies.get('wplc_cid'); } var wplc_chat = wplc_strip(document.getElementById('wplc_chatmsg').value); if(wplc_chat !== ""){ var wplc_name = jQuery("#wplc_name").val(); if (typeof wplc_name == "undefined" || wplc_name == null || wplc_name == "") { wplc_name = Cookies.get('wplc_name'); } if (typeof wplc_name == "undefined") { wplc_name = 'Guest'; } var wplc_email = jQuery("#wplc_email").val(); if (typeof wplc_email == "undefined" || wplc_email == null || wplc_email == "") { wplc_email = Cookies.get('wplc_email'); } if (typeof wplc_email == "undefined") { wplc_email = ''; } /*Nifty format Parse*/ var wplc_chat_parsed = wplc_chat; //if(typeof niftyFormatParser !== "undefined"){ // wplc_chat_parsed = niftyFormatParser(wplc_chat_parsed); //} if( typeof wplc_display_name !== 'undefined' ){ /** * We're still using the old options */ if(wplc_display_name == 'display'){ if (wplc_gravatar_image.length > 1) { jQuery("#wplc_chatbox").append(""+wplc_gravatar_image+" "+wplc_name+": "+wplc_chat_parsed+"
"); } else { jQuery("#wplc_chatbox").append(" "+wplc_name+": "+wplc_chat_parsed+"
"); } } else { jQuery("#wplc_chatbox").append(""+wplc_chat_parsed+"
"); } } else { the_message = {}; the_message.originates = 2; the_message.msg = wplc_chat_parsed; the_message.other = {}; var wplc_d = new Date(); the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 ); wplc_push_message_to_chatbox(the_message,'u', function() { wplc_scroll_to_bottom(); }); } wplc_scroll_to_bottom(); var data = { action: 'wplc_user_send_msg', security: wplc_nonce, cid: wplc_cid, msg: wplc_chat_parsed, wplc_extra_data:wplc_extra_data }; wplc_server.sendMessage(wplc_ajaxurl, data, "POST", 120000, function(){ //Success wplc_server.asyncStorage(wplc_ajaxurl, data, 120000); }, function(){ //Fail }, function(){ //Complete } ); if (typeof wplc_enable_ga !== "undefined" && wplc_enable_ga === '1') { if (typeof ga !== "undefined") { ga('send', { hitType: 'event', eventCategory: 'WP_Live_Chat_Support', eventAction: 'Event', eventLabel: 'User Send Message' }); } } } jQuery("#wplc_chatmsg").val(''); }); jQuery(document).on("wplc_open_chat", function (event) { /* what is the current status? */ wplc_chat_status = Cookies.get('wplc_chat_status'); if( typeof wplc_chat_status === 'undefined' ){ Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' }); } var wplc_tmp_checker = wplc_pre_open_check_status(status, function() { open_chat(); }); }); jQuery(document).on("wplc_end_chat", function(){ /* Clear Cookies */ Cookies.remove('wplc_chat_status'); Cookies.remove('wplc_cid'); //Cookies.remove('wplc_name'); //Cookies.remove('wplc_email'); /* Close ports if applicable*/ wplc_server.forceClosePort(); /* Check if we should redirect */ if(typeof wplc_redirect_thank_you !== "undefined" && wplc_redirect_thank_you !== null && wplc_redirect_thank_you !== ""){ window.location = wplc_redirect_thank_you; } }); function wplc_pre_open_check_status(status, callback) { if (typeof wplc_chat_status !== 'undefined' && ( typeof wplc_chat_status.length !== 'undefined' && wplc_chat_status.length > 0 ) ) { if (parseInt(wplc_chat_status) === 10 || parseInt(wplc_chat_status) === 7) { /* it was minimized or timedout, now we need to open it - set status to 3 (back to open chat) */ Cookies.set('wplc_chat_status', 3, { expires: 1, path: '/' }); } if (parseInt(wplc_chat_status) === 0 || parseInt(wplc_chat_status) === 12) { /* no answer from agent previously */ // Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' }); } if (parseInt(wplc_chat_status) === 8) { /* no answer from agent previously */ cnonsole.log("now setting it to 5"); Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' }); } } callback(); } if(typeof wplc_elem_trigger_id !== "undefined" && wplc_elem_trigger_id !== ""){ var wplc_click_or_hover = 0; var wplc_class_or_id = 0; if(typeof wplc_elem_trigger_action !== "undefined" && wplc_elem_trigger_action !== ""){ wplc_click_or_hover = parseInt(wplc_elem_trigger_action); } if(typeof wplc_elem_trigger_type !== "undefined" && wplc_elem_trigger_type !== ""){ wplc_class_or_id = parseInt(wplc_elem_trigger_type); } jQuery( (wplc_class_or_id === 1 ? "#" : ".") + wplc_elem_trigger_id).on( (wplc_click_or_hover === 1 ? "mouseenter" : "click"), function(){ open_chat(0); }); } // Fix conflict with Responsive Lighbox plugin setTimeout(function () { if (jQuery('html').hasClass('nivo-lightbox-notouch') || jQuery('a[rel*="lightbox"]').length) { jQuery("body").on("keyup", function (event) { if (event.keyCode === 13) { jQuery("#wplc_send_msg").trigger("click"); } }); } }, 5000); }); // source --> http://ada-security.com/2013/wp-content/plugins/wp-live-chat-support/js/md5.js?ver=7.1.07 function md5cycle(x, k) { var a = x[0], b = x[1], c = x[2], d = x[3]; a = wplc_ff(a, b, c, d, k[0], 7, -680876936); d = wplc_ff(d, a, b, c, k[1], 12, -389564586); c = wplc_ff(c, d, a, b, k[2], 17, 606105819); b = wplc_ff(b, c, d, a, k[3], 22, -1044525330); a = wplc_ff(a, b, c, d, k[4], 7, -176418897); d = wplc_ff(d, a, b, c, k[5], 12, 1200080426); c = wplc_ff(c, d, a, b, k[6], 17, -1473231341); b = wplc_ff(b, c, d, a, k[7], 22, -45705983); a = wplc_ff(a, b, c, d, k[8], 7, 1770035416); d = wplc_ff(d, a, b, c, k[9], 12, -1958414417); c = wplc_ff(c, d, a, b, k[10], 17, -42063); b = wplc_ff(b, c, d, a, k[11], 22, -1990404162); a = wplc_ff(a, b, c, d, k[12], 7, 1804603682); d = wplc_ff(d, a, b, c, k[13], 12, -40341101); c = wplc_ff(c, d, a, b, k[14], 17, -1502002290); b = wplc_ff(b, c, d, a, k[15], 22, 1236535329); a = wplc_gg(a, b, c, d, k[1], 5, -165796510); d = wplc_gg(d, a, b, c, k[6], 9, -1069501632); c = wplc_gg(c, d, a, b, k[11], 14, 643717713); b = wplc_gg(b, c, d, a, k[0], 20, -373897302); a = wplc_gg(a, b, c, d, k[5], 5, -701558691); d = wplc_gg(d, a, b, c, k[10], 9, 38016083); c = wplc_gg(c, d, a, b, k[15], 14, -660478335); b = wplc_gg(b, c, d, a, k[4], 20, -405537848); a = wplc_gg(a, b, c, d, k[9], 5, 568446438); d = wplc_gg(d, a, b, c, k[14], 9, -1019803690); c = wplc_gg(c, d, a, b, k[3], 14, -187363961); b = wplc_gg(b, c, d, a, k[8], 20, 1163531501); a = wplc_gg(a, b, c, d, k[13], 5, -1444681467); d = wplc_gg(d, a, b, c, k[2], 9, -51403784); c = wplc_gg(c, d, a, b, k[7], 14, 1735328473); b = wplc_gg(b, c, d, a, k[12], 20, -1926607734); a = wplc_hh(a, b, c, d, k[5], 4, -378558); d = wplc_hh(d, a, b, c, k[8], 11, -2022574463); c = wplc_hh(c, d, a, b, k[11], 16, 1839030562); b = wplc_hh(b, c, d, a, k[14], 23, -35309556); a = wplc_hh(a, b, c, d, k[1], 4, -1530992060); d = wplc_hh(d, a, b, c, k[4], 11, 1272893353); c = wplc_hh(c, d, a, b, k[7], 16, -155497632); b = wplc_hh(b, c, d, a, k[10], 23, -1094730640); a = wplc_hh(a, b, c, d, k[13], 4, 681279174); d = wplc_hh(d, a, b, c, k[0], 11, -358537222); c = wplc_hh(c, d, a, b, k[3], 16, -722521979); b = wplc_hh(b, c, d, a, k[6], 23, 76029189); a = wplc_hh(a, b, c, d, k[9], 4, -640364487); d = wplc_hh(d, a, b, c, k[12], 11, -421815835); c = wplc_hh(c, d, a, b, k[15], 16, 530742520); b = wplc_hh(b, c, d, a, k[2], 23, -995338651); a = wplc_ii(a, b, c, d, k[0], 6, -198630844); d = wplc_ii(d, a, b, c, k[7], 10, 1126891415); c = wplc_ii(c, d, a, b, k[14], 15, -1416354905); b = wplc_ii(b, c, d, a, k[5], 21, -57434055); a = wplc_ii(a, b, c, d, k[12], 6, 1700485571); d = wplc_ii(d, a, b, c, k[3], 10, -1894986606); c = wplc_ii(c, d, a, b, k[10], 15, -1051523); b = wplc_ii(b, c, d, a, k[1], 21, -2054922799); a = wplc_ii(a, b, c, d, k[8], 6, 1873313359); d = wplc_ii(d, a, b, c, k[15], 10, -30611744); c = wplc_ii(c, d, a, b, k[6], 15, -1560198380); b = wplc_ii(b, c, d, a, k[13], 21, 1309151649); a = wplc_ii(a, b, c, d, k[4], 6, -145523070); d = wplc_ii(d, a, b, c, k[11], 10, -1120210379); c = wplc_ii(c, d, a, b, k[2], 15, 718787259); b = wplc_ii(b, c, d, a, k[9], 21, -343485551); x[0] = add32(a, x[0]); x[1] = add32(b, x[1]); x[2] = add32(c, x[2]); x[3] = add32(d, x[3]); } function wplc_cmn(q, a, b, x, s, t) { a = add32(add32(a, q), add32(x, t)); return add32((a << s) | (a >>> (32 - s)), b); } function wplc_ff(a, b, c, d, x, s, t) { return wplc_cmn((b & c) | ((~b) & d), a, b, x, s, t); } function wplc_gg(a, b, c, d, x, s, t) { return wplc_cmn((b & d) | (c & (~d)), a, b, x, s, t); } function wplc_hh(a, b, c, d, x, s, t) { return wplc_cmn(b ^ c ^ d, a, b, x, s, t); } function wplc_ii(a, b, c, d, x, s, t) { return wplc_cmn(c ^ (b | (~d)), a, b, x, s, t); } function wplc_md51(s) { txt = ''; var n = s.length, state = [1732584193, -271733879, -1732584194, 271733878], i; for (i=64; i<=s.length; i+=64) { md5cycle(state, md5blk(s.substring(i-64, i))); } s = s.substring(i-64); var tail = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; for (i=0; i>2] |= s.charCodeAt(i) << ((i%4) << 3); tail[i>>2] |= 0x80 << ((i%4) << 3); if (i > 55) { md5cycle(state, tail); for (i=0; i<16; i++) tail[i] = 0; } tail[14] = n*8; md5cycle(state, tail); return state; } /* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5 * algorithm for multi-byte characters (perhaps * by adding every four 16-bit characters and * shortening the sum to 32 bits). Otherwise * I suggest performing MD-5 as if every character * was two bytes--e.g., 0040 0025 = @%--but then * how will an ordinary MD-5 sum be matched? * There is no way to standardize text to something * like UTF-8 before transformation; speed cost is * utterly prohibitive. The JavaScript standard * itself needs to look at this: it should start * providing access to strings as preformed UTF-8 * 8-bit unsigned value arrays. */ function md5blk(s) { /* I figured global was faster. */ var md5blks = [], i; /* Andy King said do it this way. */ for (i=0; i<64; i+=4) { md5blks[i>>2] = s.charCodeAt(i) + (s.charCodeAt(i+1) << 8) + (s.charCodeAt(i+2) << 16) + (s.charCodeAt(i+3) << 24); } return md5blks; } var hex_chr = '0123456789abcdef'.split(''); function wplc_rhex(n) { var s='', j=0; for(; j<4; j++) s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; return s; } function wplc_hex(x) { for (var i=0; i> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } }; // source --> http://ada-security.com/2013/wp-content/plugins/wp-live-chat-support/js/themes/modern.js?ver=7.1.07 jQuery(document).on("wplc_minimize_chat", function( e ) { wplc_is_chat_open = false; jQuery('#wp-live-chat').height(""); if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_right"){ jQuery("#wp-live-chat").css("left", ""); jQuery("#wp-live-chat").css("bottom", "0"); jQuery("#wp-live-chat").css("right", "20px"); } else if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_left"){ jQuery("#wp-live-chat").css("left", "20px"); jQuery("#wp-live-chat").css("bottom", "0"); jQuery("#wp-live-chat").css("right", ""); } else if(jQuery("#wp-live-chat").attr("original_pos") === "left"){ jQuery("#wp-live-chat").css("left", "20px"); jQuery("#wp-live-chat").css("bottom", "100px"); } else if(jQuery("#wp-live-chat").attr("original_pos") === "right"){ //jQuery("#wp-live-chat").css("left", ""); //jQuery("#wp-live-chat").css("right", "0"); //jQuery("#wp-live-chat").css("bottom", "100px"); //jQuery("#wp-live-chat").css("width", ""); } jQuery('#wp-live-chat').addClass("wplc_close"); jQuery('#wp-live-chat').removeClass("wplc_open"); //jQuery("#wp-live-chat").css(jQuery("#wp-live-chat").attr("original_pos"), "100px"); jQuery("#wp-live-chat").css("top", ""); jQuery("#wp-live-chat").css("height", ""); jQuery("#wp-live-chat-1").show(); jQuery("#wp-live-chat-1").css('cursor', 'pointer'); jQuery("#wp-live-chat-2").hide(); jQuery("#wp-live-chat-3").hide(); jQuery("#wp-live-chat-4").hide(); jQuery("#wplc_social_holder").hide(); jQuery("#nifty_ratings_holder").hide(); jQuery("#nifty_ratings_holder").hide(); jQuery("#wp-live-chat-react").hide(); jQuery("#wp-live-chat-minimize").hide(); jQuery("#wp-live-chat-header").show(); }); jQuery(document).on("wplc_start_chat", function( e ) { jQuery("#wp-live-chat-2-inner").hide("slow"); /* changed in version 7 as we now allow users to start typing immediately */ /* jQuery("#wp-live-chat-3").show(); */ jQuery.event.trigger({type: "wplc_open_chat_1"}); jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online}); }); jQuery(document).on( "wplc_open_chat_1", function( e ) { jQuery('#wp-live-chat').removeClass("wplc_close"); jQuery('#wp-live-chat').addClass("wplc_open"); jQuery("#wp-live-chat-react").hide(); //jQuery("#wp-live-chat-header").hide(); Cookies.set('wplc_hide', "", { expires: 1, path: '/' }); jQuery("#wp-live-chat-minimize").show(); }); jQuery(document).on("wplc_agent_joined", function(e) { var temail = ''; var tname = ''; var taid = ''; var ta_tagline = ''; var ta_bio = ''; var ta_social_links = ''; if (typeof e.ndata.other.email !== "undefined") { temail = e.ndata.other.email; } if (typeof e.ndata.other.name !== "undefined") { tname = e.ndata.other.name; } if (typeof e.ndata.other.aid !== "undefined") { taid = e.ndata.other.aid; } if (typeof e.ndata.other.agent_tagline !== "undefined") { ta_tagline = e.ndata.other.agent_tagline; } if (typeof e.ndata.other.agent_bio !== "undefined") { ta_bio = e.ndata.other.agent_bio; } if (typeof e.ndata.other.social_links !== "undefined") { ta_social_links = e.ndata.other.social_links; } jQuery(".wplc_no_answer").remove(); jQuery(".admin_chat_name").html(tname); wplc_node_pair_name = tname; wplc_agent_name = tname; var timageurl = 'https://www.gravatar.com/avatar/'+temail; jQuery(".wplc_agent_info").html(''); if ( ! jQuery( '#agent_grav_'+taid ).length ) { jQuery('

', { 'class': '', 'style': 'text-align:center;', html: '
'+tname+''+ta_tagline+ta_bio+ta_social_links }).appendTo('.wplc_agent_info'); } var csst = "url(https://www.gravatar.com/avatar/20a6e5c8b75ce87f4896f46ed6f49832?s=60);"; jQuery("#wplc_chatbox_header_bg").css('background-image', 'url('+timageurl+'?s=380)'); jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px" ); }); jQuery(document).on("wplc_animation_done", function(e) { jQuery("#nifty_text_editor_holder").remove(); jQuery("#wplc_msg_notice").remove(); jQuery("#wp-live-chat-minimize").remove(); jQuery("#wplc_logo").prependTo("#wplc_chatbox_header"); if (jQuery("wplc_chatbox").hasClass("wplc-shrink")) { /** * The +18px is to compensate for the 18px of padding at the bottom of the header box */ jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px" ); jQuery("#wplc_logo").show(); } else { /** * The +18px is to compensate for the 18px of padding at the bottom of the header box */ jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px" ); jQuery("#wplc_logo").hide(); } jQuery("#wplc_chatbox").css("bottom", "0"); }); jQuery(document).on( "wplc_open_chat_2", function( e ) { jQuery("#wp-live-chat-1").hide(); jQuery("#wp-live-chat-2-inner").hide(); jQuery("#wp-live-chat-2").show(); if(!jQuery("#wp-live-chat-header").hasClass("active")){ jQuery("#wplc_chatmsg").focus(); } jQuery("#wp-live-chat-header").addClass("active"); wplc_chat_status = Cookies.get('wplc_chat_status'); if (typeof e.wplc_online !== "undefined" && e.wplc_online === true) { jQuery("#wp-live-chat-4").show(); jQuery("#wplc_social_holder").show(); jQuery("#nifty_ratings_holder").show(); jQuery.event.trigger({type: "wplc_animation_done"}); } jQuery("#wp-live-chat-3").hide(); jQuery("#wp-live-chat-minimize").css("right","23px"); Cookies.set('wplc_minimize', "", { expires: 1, path: '/' }); }); var wplc_leave_window_alone = false; jQuery(document).ready(function() { jQuery("body").on("mousewheel", "#wplc_chatbox", function(turn, delta){ if (delta == 1) { /** * The +18px is to compensate for the 18px of padding at the bottom of the header box */ jQuery("#wplc_chatbox_header").removeClass("wplc-shrink"); jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px" ); jQuery("#wplc_logo").show(); } else { // going down /** * The +18px is to compensate for the 18px of padding at the bottom of the header box */ jQuery("#wplc_chatbox_header").addClass("wplc-shrink"); jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px" ); jQuery("#wplc_logo").hide(); } }); //opens chat when clicked on top bar jQuery("body").on("click", "#wp-live-chat-header", function() { }); jQuery("body").on("click", ".wplc_retry_chat", function() { jQuery("#wplc_chatbox").html(""); jQuery("#wp-live-chat-4").fadeOut(); Cookies.remove('wplc_chat_status'); jQuery("#wp-live-chat-2-inner").fadeIn(); wplc_shown_welcome = false; }); jQuery("body").on("click", "#wp-live-chat-header", function(){ //if (!wplc_is_chat_open) { if (jQuery(this).hasClass('active')) { jQuery("#wplc_hovercard").fadeOut("fast"); jQuery("#wp-live-chat-2").fadeOut("fast"); jQuery(this).removeClass('active'); jQuery.event.trigger({type: "wplc_minimize_chat"}); } else { jQuery("#wplc_hovercard").fadeIn('fast'); jQuery(this).addClass('active'); wplc_chat_status = Cookies.get('wplc_chat_status'); if (parseInt(wplc_chat_status) == 3 || parseInt(wplc_chat_status) == 2 || parseInt(wplc_chat_status) == 0 || parseInt(wplc_chat_status) == 12 || parseInt(wplc_chat_status) == 10) { jQuery("#speeching_button").click(); } } //} }); jQuery("body").on("click", "#wplc_hovercard_min", function() { jQuery("#wplc_hovercard").fadeOut('fast'); }); jQuery("body").on("click", "#speeching_button", function() { jQuery("#wplc_hovercard").fadeOut("fast"); jQuery("#wplc-chat-alert").removeClass('is-active'); wplc_is_chat_open = true; jQuery.event.trigger({type: "wplc_open_chat"}); }); jQuery("body").on("click", "#wp-live-chat-minimize", function() { jQuery("#wp-live-chat-header").removeClass('active'); }) }); !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}); // source --> http://ada-security.com/2013/wp-content/plugins/wp-live-chat-support/js/jquery-cookie.js?ver=4.8.17 /*! * JavaScript Cookie v2.1.0 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license */ (function (factory) { if (typeof define === 'function' && define.amd) { define(factory); } else if (typeof exports === 'object') { module.exports = factory(); } else { var _OldCookies = window.Cookies; var api = window.Cookies = factory(); api.noConflict = function () { window.Cookies = _OldCookies; return api; }; } }(function () { function extend () { var i = 0; var result = {}; for (; i < arguments.length; i++) { var attributes = arguments[ i ]; for (var key in attributes) { result[key] = attributes[key]; } } return result; } function init (converter) { function api (key, value, attributes) { var result; // Write if (arguments.length > 1) { attributes = extend({ path: '/' }, api.defaults, attributes); if (typeof attributes.expires === 'number') { var expires = new Date(); expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); attributes.expires = expires; } try { result = JSON.stringify(value); if (/^[\{\[]/.test(result)) { value = result; } } catch (e) {} if (!converter.write) { value = encodeURIComponent(String(value)) .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); } else { value = converter.write(value, key); } key = encodeURIComponent(String(key)); key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); key = key.replace(/[\(\)]/g, escape); return (document.cookie = [ key, '=', value, attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE attributes.path && '; path=' + attributes.path, attributes.domain && '; domain=' + attributes.domain, attributes.secure ? '; secure' : '' ].join('')); } // Read if (!key) { result = {}; } // To prevent the for loop in the first place assign an empty array // in case there are no cookies at all. Also prevents odd result when // calling "get()" var cookies = document.cookie ? document.cookie.split('; ') : []; var rdecode = /(%[0-9A-Z]{2})+/g; var i = 0; for (; i < cookies.length; i++) { var parts = cookies[i].split('='); var name = parts[0].replace(rdecode, decodeURIComponent); var cookie = parts.slice(1).join('='); if (cookie.charAt(0) === '"') { cookie = cookie.slice(1, -1); } try { cookie = converter.read ? converter.read(cookie, name) : converter(cookie, name) || cookie.replace(rdecode, decodeURIComponent); if (this.json) { try { cookie = JSON.parse(cookie); } catch (e) {} } if (key === name) { result = cookie; break; } if (!key) { result[name] = cookie; } } catch (e) {} } return result; } api.get = api.set = api; api.getJSON = function () { return api.apply({ json: true }, [].slice.call(arguments)); }; api.defaults = {}; api.remove = function (key, attributes) { api(key, '', extend(attributes, { expires: -1 })); }; api.withConverter = init; return api; } return init(function () {}); })); // source --> http://ada-security.com/2013/wp-content/plugins/sticky-menu-or-anything-on-scroll/assets/js/jq-sticky-anything.min.js?ver=2.1.1 /** * @preserve Sticky Anything 2.1.1 | @senff | GPL2 Licensed */ var stickyAnythingBreakpoint = '' // solely to use as a debugging breakpoint, if needed. !function(e){function t(t,i,n,s,l,o,r,d){$listenerElement=e(".sticky-element-active");var c=$listenerElement.offset();if(orgElementTop=c.top,l){var a=e(l).offset();pushElementTop=a.top}var m=window,g="inner";if("innerWidth"in window||(g="client",m=document.documentElement||document.body),viewport=m[g+"Width"],o&&e("body").hasClass("admin-bar")&&viewport>600?adminBarHeight=e("#wpadminbar").height():adminBarHeight=0,e(window).scrollTop()>=orgElementTop-t-adminBarHeight&&viewport>=i&&viewport<=n){coordsOrgElement=$listenerElement.offset(),leftOrgElement=coordsOrgElement.left,widthPlaceholder=$listenerElement[0].getBoundingClientRect().width,widthPlaceholder||(widthPlaceholder=$listenerElement.css("width")),heightPlaceholder=$listenerElement[0].getBoundingClientRect().height,heightPlaceholder||(heightPlaceholder=$listenerElement.css("height")),widthSticky=e(".sticky-element-original").css("width"),"0px"==widthSticky&&(widthSticky=e(".sticky-element-original")[0].getBoundingClientRect().width),heightSticky=e(".sticky-element-original").height(),paddingOrgElement=[e(".sticky-element-original").css("padding-top"),e(".sticky-element-original").css("padding-right"),e(".sticky-element-original").css("padding-bottom"),e(".sticky-element-original").css("padding-left")],paddingSticky=paddingOrgElement[0]+" "+paddingOrgElement[1]+" "+paddingOrgElement[2]+" "+paddingOrgElement[3],marginOrgElement=[$listenerElement.css("margin-top"),$listenerElement.css("margin-right"),$listenerElement.css("margin-bottom"),$listenerElement.css("margin-left")],marginPlaceholder=marginOrgElement[0]+" "+marginOrgElement[1]+" "+marginOrgElement[2]+" "+marginOrgElement[3],assignedStyles="";for(var h in r)"inline"==r[h]?assignedStyles+=h+":inline-block; ":assignedStyles+=h+":"+r[h]+"; ";elementHeight=0,heightPlaceholder<1?elementHeight=e(".sticky-element-cloned").outerHeight():elementHeight=e(".sticky-element-original").outerHeight(),l&&e(window).scrollTop()>pushElementTop-t-elementHeight-adminBarHeight?stickyTopMargin=pushElementTop-t-elementHeight-e(window).scrollTop():stickyTopMargin=adminBarHeight,assignedStyles+="width:"+widthPlaceholder+"px; height:"+heightPlaceholder+"px; margin:"+marginPlaceholder+";",e(".sticky-element-original").removeClass("sticky-element-active").removeClass("element-is-not-sticky").addClass("element-is-sticky").css("position","fixed").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthSticky).css("margin-left",0).css("padding",paddingSticky).css("margin-top",stickyTopMargin).css("z-index",s),e(".sticky-element-placeholder").hasClass("sticky-element-active")||e(".sticky-element-placeholder").addClass("sticky-element-active").attr("style",assignedStyles)}else e(".sticky-element-original").addClass("sticky-element-active").removeClass("element-is-sticky").addClass("element-is-not-sticky").attr("style",d),e(".sticky-element-placeholder").hasClass("sticky-element-active")&&e(".sticky-element-placeholder").removeClass("sticky-element-active").removeAttr("style").css("width","0").css("height","0").css("margin","0").css("padding","0")}function i(){e(".sticky-element-original").addClass("sticky-element-active").before('

')}function n(e){return o={},o.display=e.css("display"),o.float=e.css("float"),o.flex=e.css("flex"),o["box-sizing"]=e.css("box-sizing"),o.clear=e.css("clear"),o.overflow=e.css("overflow"),o.transform=e.css("transform"),o}function s(t,i,n,s,o,r,d){var c=e(".sticky-element-original").offset();if(orgElementTop=c.top,o){var a=e(o).offset();pushElementTop=a.top}var m=window,g="inner";"innerWidth"in window||(g="client",m=document.documentElement||document.body),viewport=m[g+"Width"],d&&e("body").hasClass("admin-bar")&&viewport>600?adminBarHeight=e("#wpadminbar").height():adminBarHeight=0,e(window).scrollTop()>=orgElementTop-t-adminBarHeight&&viewport>=i&&viewport<=n?(orgElement=e(".sticky-element-original"),coordsOrgElement=orgElement.offset(),leftOrgElement=coordsOrgElement.left,widthOrgElement=orgElement[0].getBoundingClientRect().width,widthOrgElement||(widthOrgElement=orgElement.css("width")),heightOrgElement=orgElement.outerHeight(),paddingOrgElement=[orgElement.css("padding-top"),orgElement.css("padding-right"),orgElement.css("padding-bottom"),orgElement.css("padding-left")],paddingCloned=paddingOrgElement[0]+" "+paddingOrgElement[1]+" "+paddingOrgElement[2]+" "+paddingOrgElement[3],1==r&&e(".sticky-element-cloned").length<1&&l(t,s),elementHeight=0,heightOrgElement<1?elementHeight=e(".sticky-element-cloned").outerHeight():elementHeight=e(".sticky-element-original").outerHeight(),o&&e(window).scrollTop()>pushElementTop-t-elementHeight-adminBarHeight?stickyTopMargin=pushElementTop-t-elementHeight-e(window).scrollTop():stickyTopMargin=adminBarHeight,e(".sticky-element-cloned").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthOrgElement).css("margin-top",stickyTopMargin).css("padding",paddingCloned).show(),e(".sticky-element-original").css("visibility","hidden")):(1==r?e(".sticky-element-cloned").remove():e(".sticky-element-cloned").hide(),e(".sticky-element-original").css("visibility","visible"))}function l(t,i){e(".sticky-element-original").clone().insertAfter(e(".sticky-element-original")).addClass("sticky-element-cloned").removeClass("element-is-not-sticky").addClass("element-is-sticky").css("position","fixed").css("top",t+"px").css("margin-left","0").css("z-index",i).removeClass("sticky-element-original").hide()}e.fn.stickThis=function(o){var r=e.extend({top:0,minscreenwidth:0,maxscreenwidth:99999,zindex:1,legacymode:!1,dynamicmode:!1,debugmode:!1,pushup:"",adminbar:!1},o),d=e(this).length,c=e(r.pushup).length;return c<1?(1==r.debugmode&&r.pushup&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the Push-up element ("'+r.pushup+'").'),r.pushup=""):c>1&&(1==r.debugmode&&console.error("STICKY ANYTHING DEBUG: There are "+c+' elements on the page with the selector/class/ID you selected for the push-up element ("'+r.pushup+'"). You can select only ONE element to push the sticky element up.'),r.pushup=""),d<1?1==r.debugmode&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'").'):d>1?1==r.debugmode&&console.error("STICKY ANYTHING DEBUG: There There are "+c+' elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'"). You can only make ONE element sticky.'):1==r.legacymode?(e(this).addClass("sticky-element-original").addClass("element-is-not-sticky"),1!=r.dynamicmode&&l(r.top,r.zindex,r.adminbar),checkElement=setInterval(function(){s(r.top,r.minscreenwidth,r.maxscreenwidth,r.zindex,r.pushup,r.dynamicmode,r.adminbar)},10)):(e(this).addClass("sticky-element-original").addClass("element-is-not-sticky"),orgAssignedStyles=n(e(this)),orgInlineStyles=e(".sticky-element-original").attr("style"),null==orgInlineStyles&&(orgInlineStyles=""),i(),checkElement=setInterval(function(){t(r.top,r.minscreenwidth,r.maxscreenwidth,r.zindex,r.pushup,r.adminbar,orgAssignedStyles,orgInlineStyles)},10)),this}}(jQuery);