1var wplc_searchTimeout; 2var wplc_is_typing = false; 3var wplc_has_sent_auto_first_response = false; 4 5 6jQuery(document).on("wplc_animation_done", function(e) { 7 8 9 jQuery('.nifty_rating_icon').click(function(evt){ 10 jQuery('.nifty_rating_icon').removeClass('wplc-color-1'); 11 jQuery(this).addClass('wplc-color-1'); 12 }); 13 jQuery("#nifty_rating_pos").click(function(evt){ 14 jQuery("#nifty_rating_thanks").hide(); 15 jQuery("#nifty_ratings_form").fadeIn(); 16 jQuery("#nifty_rating_button").attr("nifty-rating", "1"); 17 18 evt.stopImmediatePropagation(); 19 }); 20 jQuery("#nifty_rating_neg").click(function(evt){ 21 jQuery("#nifty_rating_thanks").hide(); 22 jQuery("#nifty_ratings_form").fadeIn(); 23 jQuery("#nifty_rating_button").attr("nifty-rating", "0"); 24 25 evt.stopImmediatePropagation(); 26 }); 27 jQuery("#nifty_rating_button").click(function(evt){ 28 var nifty_rating = jQuery(this).attr("nifty-rating"); 29 var nifty_comment = jQuery("#nifty_ratings_comment").val() !== "" ? jQuery("#nifty_ratings_comment").val() : "No Comment..."; 30 jQuery("#nifty_ratings_form").hide(); 31 jQuery("#nifty_recording").fadeIn(); 32 33 var formData = new FormData(); 34 35 formData.append('action', 'wplc_record_chat_rating'); 36 formData.append('cid', Cookies.get('wplc_cid')); 37 formData.append('rating', nifty_rating); 38 formData.append('comment', nifty_comment); 39 formData.append('security', wplc_nonce ); 40 formData.append('update_chat_rating', "1" ); 41 formData.append('wplc_extra_data[domain]', wplc_extra_data['domain'] ); 42 formData.append('wplc_extra_data[api_key]', wplc_extra_data['api_key'] ); 43 44 jQuery.ajax({ 45 url : wplc_ajaxurl, 46 type : 'POST', 47 data : formData, 48 cache: false, 49 processData: false, 50 contentType: false, 51 success : function(data) { 52 wplc_pro_rating_show_thanks_message(); 53 }, 54 error : function (){ 55 wplc_pro_rating_show_thanks_message(); 56 } 57 }); 58 59 jQuery.event.trigger({type: 'wplc_send_live_rating', rating: {score: nifty_rating, comment: nifty_comment} }); 60 61 evt.stopImmediatePropagation(); 62 }); 63 64 function wplc_pro_rating_show_thanks_message(){ 65 jQuery("#nifty_recording").fadeOut(); 66 jQuery("#nifty_rating_thanks").fadeIn(); 67 68 setTimeout(function(){ 69 jQuery("#nifty_rating_thanks").fadeOut(); 70 }, 2000); 71 } 72}); 73 74jQuery(function() { 75 76 77 jQuery(document).on("wplc_start_chat", function( e ) { 78 var data = { 79 action: 'wplc_start_chat_hook', 80 security: wplc_nonce, 81 cid: Cookies.get('wplc_cid'), 82 wplc_extra_data:{ 83 name: jQuery("#wplc_name").val(), 84 email: jQuery("#wplc_email").val(), 85 } 86 }; 87 88 if (typeof wplc_restapi_enabled !== "undefined" && wplc_restapi_enabled === '1') { 89 data.security = (typeof wplc_restapi_token !== "undefined" ? wplc_restapi_token : false); 90 jQuery.post(wplc_restapi_endpoint+"/new-chat/", data, function(response) {}); 91 } 92 93 94 }); 95 96 jQuery("body").on("change", "#wplc_user_selected_department", function(){ 97 if(wplc_extra_data !== "undefined"){ 98 wplc_extra_data['wplc_user_selected_department'] = jQuery(this).val(); 99 } 100 }); 101 102 103 104 105 106}); 107 108jQuery(document).on("bleeper_send_message", function(e) { 109 if(typeof wplc_pro_auto_resp_chat_msg !== 'undefined' && wplc_pro_auto_resp_chat_msg !== ""){ 110 if(wplc_has_sent_auto_first_response == false){ 111 if(jQuery('.wplc-admin-message').length <= 0){ 112 var first_response_html = "<span class='wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4' mid='" + Date.now() + "'>"; 113 first_response_html += "<div class='wplc-msg-content' mid='" + Date.now() + "'>"; 114 first_response_html += "<span class='messageBody' data-message='" + wplc_pro_auto_resp_chat_msg + "'>" + wplc_pro_auto_resp_chat_msg + "</span>"; 115 first_response_html += "</div></span>"; 116 117 setTimeout(function(){ 118 jQuery('#wplc_chatbox').append(first_response_html); 119 }, 1000); 120 } 121 wplc_has_sent_auto_first_response = true; 122 } 123 } 124}); 125 126function wplc_start_chat_pro_data(data){ 127 if(typeof wplc_extra_data !== "undefined" && typeof wplc_extra_data['wplc_user_selected_department'] !== "undefined"){ 128 data['wplc_user_selected_department'] = wplc_extra_data['wplc_user_selected_department']; 129 } 130 131 return data; 132} 133 134/* Handles Uploading and sharing a file within chat*/
135function wplcShareFile(fileToUpload, failedID, successID, uploadingID, originalID){ 136 var formData = new FormData(); 137 138 formData.append('action', 'wplc_upload_file'); 139 formData.append('cid', Cookies.get('wplc_cid')); 140 formData.append('file', fileToUpload); 141 formData.append('timestamp', Date.now()); 142 formData.append('security', wplc_nonce ); 143 144 /*Handle jQuery Elements*/ 145 jQuery(uploadingID).show(); 146 jQuery(originalID).hide(); 147 jQuery(successID).hide(); 148 jQuery(failedID).hide(); 149 150 if(fileToUpload.name.indexOf(".php") === -1 && fileToUpload.name.indexOf(".html") === -1 && fileToUpload.name.indexOf(".js") === -1 && fileToUpload.name.indexOf(".asp") === -1 && fileToUpload.name.indexOf(".svg") === -1){ 151 //Files allowed - continue 152 if(fileToUpload.size < 4000000){ //Max size of 4MB 153 jQuery.ajax({ 154 url : wplc_ajaxurl_site, 155 type : 'POST', 156 data : formData, 157 cache: false, 158 processData: false, 159 contentType: false, 160 success : function(data) { 161 if(parseInt(data) !== 0){ 162 jQuery(uploadingID).hide(); 163 jQuery(successID).show(); 164 setTimeout(function(){ 165 jQuery(successID).hide(); 166 jQuery(originalID).show(); 167 }, 2000); 168 169 //All good post the link to file 170 var tag = (data.indexOf(".png") !== -1 || data.indexOf(".PNG") !== -1 ||data.indexOf(".jpg") !== -1 || data.indexOf(".JPG") !== -1 || data.indexOf(".jpeg") !== -1 || data.indexOf(".gif") !== -1 || data.indexOf(".bmp")!== -1 ) ? "img" : "link"; 171 172 if(tag !== "img"){ 173 tag = (data.indexOf(".mp4") !== -1 || data.indexOf(".mpeg4") !== -1 || data.indexOf(".webm") !== -1 || data.indexOf(".oog") !== -1 ) ? "video" : "link"; //video now 174 } 175 jQuery("#wplc_chatmsg").val(tag + ":" + data + ":" + tag); //Add to input field 176 jQuery("#wplc_send_msg").trigger("click"); //Send message 177 } 178 else{ 179 jQuery(uploadingID).hide(); 180 jQuery(failedID).show(); 181 setTimeout(function(){ 182 jQuery(failedID).hide(); 183 jQuery(originalID).show(); 184 }, 2000); 185 186 } 187 }, 188 error : function (){ 189 jQuery(uploadingID).hide(); 190 jQuery(failedID).show(); 191 setTimeout(function(){ 192 jQuery(failedID).hide(); 193 jQuery(originalID).show(); 194 }, 2000); 195 } 196 }); 197 }else{ 198 alert("File limit is 4mb"); 199 jQuery(uploadingID).hide(); 200 jQuery(failedID).show(); 201 setTimeout(function(){ 202 jQuery(failedID).hide(); 203 jQuery(originalID).show(); 204 }, 2000); 205 } 206 } else{ 207 alert("File type not supported"); 208 jQuery(uploadingID).hide(); 209 jQuery(failedID).show(); 210 setTimeout(function(){ 211 jQuery(failedID).hide(); 212 jQuery(originalID).show(); 213 }, 2000); 214 } 215} 216 217function wplc_start_chat_pro_custom_fields_filter( wplc_extra_data_tmp, rest_action_data, callback ) { 218 219 var custom_field_array = {}; 220 221 var cnt = 0; 222 jQuery('*[name^="wplc_custom_field"]').each(function(key, val) { 223 224 var field_name = jQuery(this).attr( "fname" ); 225 custom_field_array[cnt] = {}; 226 custom_field_array[cnt][0] = field_name; 227 custom_field_array[cnt][1] = jQuery(this).val(); 228 cnt++; 229 });
230 231 var custom_data = custom_field_array; 232 wplc_extra_data_tmp['custom_fields'] = JSON.stringify(custom_data); 233 234 if(typeof callback === "function"){ 235 rest_action_data.wplc_extra_data = wplc_extra_data_tmp; 236 callback(wplc_extra_data_tmp, rest_action_data); 237 } 238 239 return wplc_extra_data_tmp; 240 241}
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.