";
}
if (isAudioPattern) {
concatenated_message += "
";
} else if (typeof wplc_show_chat_detail.name !== "undefined" && wplc_show_chat_detail.name === "1") {
concatenated_message += message_from;
}
} else {
// Add a wrapper for the person name and the message, this wrapper is necessary to implement the UI of the admin chat
concatenated_message += "
";
}
var original_message = message_content;
if (isAudioPattern) {
message_content = "
" + (typeof wplc_visitor_voice !== 'undefined' && typeof wplc_visitor_voice.play_sound !== 'undefined' ? wplc_visitor_voice.play_sound : 'Open Voice Note') + "";
} else if (typeof wplcFormatParser !== "undefined"){
if(typeof the_message.other !== 'undefined' && typeof the_message.other.ignore_style_tags !== 'undefined' && the_message.other.ignore_style_tags === true){
//Don't nifty parse this
} else {
message_content = wplcFormatParser(message_content);
}
}
//Cleanup the original message
var original_message_stripper = document.createElement("DIV");
original_message_stripper.innerHTML = original_message;
original_message = original_message_stripper.textContent || original_message_stripper.innerText || "";
// If it is a GIF message
if (gifExtensionPattern.test(message_content)) {
cleanedGif = getCleanedGif(message_content);
concatenated_message += "

"+ message_edit_string;
} else if (isAudioPattern) {
// If it is audio pattern
concatenated_message += "
"+message_content+"";
} else {
// If it is a regular message
concatenated_message += "
"+message_content+""+ message_edit_string;
}
// Close the person name/message wrapper, if it was added
concatenated_message += "
";
// Close the HTML of a message
concatenated_message += "";
concatenated_message += wplc_add_date_and_time(the_message,the_message.originates);
if (aoru === 'u') {
wplc_chat_box_elemn = "#wplc_chatbox";
} else {
if (typeof bleeper_remote_enabled !== "undefined"){
wplc_chat_box_elemn = "#messages";
} else {
wplc_chat_box_elemn = "#admin_chat_box_area_"+wplc_cid;
}
}
jQuery(wplc_chat_box_elemn).append(concatenated_message);
}
}
}
next();
}
jQuery(function(){
jQuery(function(){
var wplc_node_searchTimeout;
jQuery("body").on("keydown","#wplc_chatmsg, #wplc_admin_chatmsg", function(e) {
if(typeof wplc_node_sockets_ready !== "undefined" && wplc_node_sockets_ready === true){
if(typeof wplc_node_is_client_typing !== "undefined"){
if (e.which <= 90 && e.which >= 48) {
if (wplc_node_is_client_typing) {
wplc_node_renew_typing();
return;
}
wplc_node_is_client_typing = true;
wplc_node_searchTimeout = setTimeout(wplc_node_clear_typing, 1000);
}
}
}
});
jQuery("body").on("click", "#wplc_na_msg_btn", function() {
var wplc_is_gdpr_enabled = jQuery(this).attr('data-wplc-gdpr-enabled');
if(typeof wplc_is_gdpr_enabled !== "undefined" && (wplc_is_gdpr_enabled === 'true' )){
var wplc_gdpr_opt_in_checked = jQuery("#wplc_chat_gdpr_opt_in").is(':checked');
if(typeof wplc_gdpr_opt_in_checked === "undefined" || wplc_gdpr_opt_in_checked === false){
/* GDPR requirements not met */
jQuery("#wplc_chat_gdpr_opt_in").addClass('incomplete');
return false;
}
jQuery("#wplc_chat_gdpr_opt_in").removeClass('incomplete');
}
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_node_renew_typing() {
clearTimeout(wplc_node_searchTimeout);
wplc_node_searchTimeout = setTimeout(wplc_node_clear_typing, 1000);
}
function wplc_node_clear_typing() {
wplc_node_is_client_typing = false;
clearTimeout(wplc_node_searchTimeout);
}
});
});
var wplc_generate_system_notification_object = function(msg,other,originates) {
the_message = {};
the_message.originates = originates;
the_message.msg = msg;
the_message.other = other;
var wplc_d = new Date();
the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 );
return the_message;
}
function wplc_display_system_notification(message) {
message_output = '
' + message.msg + '
';
if (jQuery('#bleeper_notification_message').length == 0) {
jQuery('#wp-live-chat-4').prepend(message_output);
}
}
function wplc_clear_system_notification() {
if (jQuery('#bleeper_notification_message').length !== 0) {
jQuery('#bleeper_notification_message').remove();
}
}
/*
* Updates the message element with a new message.
* - mid: Message ID which is appended to class selector as .message_{mid}
* - message: The html/text to insert into this container
* - inner_container_class: Optional, used to select the first child of the class type within the primary message container
* Nice for selecting the 'messageBody' class specifically
*/
function wplc_update_message_element_by_mid(mid, message, inner_container_class){
var element_selector = ".message_" + mid;
element_selector += (typeof inner_container_class !== "undefined" && inner_container_class !== false) ? (" ." + inner_container_class) : "";
jQuery(element_selector).html(message);
}