1var share = { 2 app_id: 0, 3 items: [], 4 mlsnum: 0, 5 app_name: '', 6 app_url: '', 7 host: '', 8 listing_id: '', 9 message: '', 10 cid: '', 11 cms: '', 12 noads: '', 13 gateway: '', 14 noCompleteCheck:false, 15 init: function () { 16 form = {} 17 form['app_id'] = this.app_id 18 form['listing_id'] = this.listing_id 19 form['mlsnum'] = this.mlsnum 20 form['app_name'] = this.app_name 21 form['app_url'] = this.app_url 22 form['message'] = this.message 23 form['items'] = this.items 24 form['cid'] = this.cid 25 form['cms'] = this.cms 26 form['noads'] = this.noads 27 form['gateway'] = this.gateway 28 this.getForm(form) 29 }, 30 initplain: function () { 31 form = {} 32 form['noclient'] = 1; 33 form['app_id'] = this.app_id 34 form['listing_id'] = this.listing_id 35 form['mlsnum'] = this.mlsnum 36 form['app_name'] = this.app_name 37 form['app_url'] = this.app_url 38 form['message'] = this.message 39 form['items'] = this.items 40 form['cid'] = this.cid 41 form['noads'] = this.noads 42 form['gateway'] = this.gateway 43 this.getForm(form) 44 }, 45 getForm: function (form) { 46 $('.share-form').html('') 47 $('.share-form-loading').show() 48 $.ajax({
49 url: share.host+'/api/share-form', 50 type: "GET", 51 datatype: "json", 52 data: this.clean(form), 53 xhrFields: { withCredentials: false }, 54 success: function (json) { 55 resp = $.parseJSON(json) 56 $('.share-form').html(resp.html) 57 $('.share-form-loading').hide() 58 if(typeof sharecomplete != 'undefined' && share.noCompleteCheck === false) 59 { 60 sharecomplete(); 61 } 62 } 63 }) 64 }, 65 shareToClientForm: function (form) { 66 $('.shareToClient-form').html('') 67 $('.shareToClient-form-loading').show() 68 $.ajax({ 69 url: share.host+'/api/share-to-client-form', 70 type: "GET", 71 datatype: "json", 72 data: this.clean(form), 73 xhrFields: { withCredentials: false }, 74 success: function (json) { 75 resp = $.parseJSON(json) 76 $('.shareToClient-form').html(resp.html) 77 $('.shareToClient-form-loading').hide() 78 79 } 80 }) 81 }, 82 sendEmail: function (elem) { 83 data = this.validate(elem) 84 if (data) { 85 this.AjaxCall(share.host+'/api/share-send-mail', data, elem) 86 } else { 87 bootbox.alert('Please fill the complete information.') 88 } 89 90 }, 91 sendText: function (elem) { 92 data = this.validate(elem) 93 if (data) { 94 this.AjaxCall(share.host+'/api/share-send-text', data, elem) 95 } else { 96 bootbox.alert('Please fill the complete information.') 97 } 98 99 }, 100 clean: function (form) { 101 for (var propName in form) { 102 if (form[propName] === null || form[propName] === undefined || form[propName] == '') { 103 delete form[propName]; 104 } 105 } 106 return form 107 }, 108 validate: function (id) { 109 error_status = [] 110 elem = $('#' + id) 111 myform = {} 112 myform['_token'] = $('input[name="_token"]').val() 113 myform['hsource'] = $('input[name="hsource"]').val() 114 elem.find('input[type="hidden"],textarea').each(function (I, V) { 115 myform[$(V).attr("name")] = $(V).val(); 116 }); 117 obj = this 118 119 elem.find('input[required]').each(function (i, v) { 120 //for email 121 if ($(v).attr('type') == 'email') { 122 if (obj.checkEmail($(v).val())) { 123 $(v).removeClass('is-invalid') 124 myform[$(v).attr("name")] = $(v).val() 125 } else { 126 $(v).addClass('is-invalid') 127 error_status.push($(v).attr("name")); 128 } 129 } 130 //for tel 131 if ($(v).attr('type') == 'tel') { 132 133 if (obj.checkPhone($(v).val())) { 134 $(v).removeClass('is-invalid') 135 myform[$(v).attr("name")] = $(v).val() 136 } else { 137 $(v).addClass('is-invalid') 138 error_status.push($(v).attr("name")); 139 } 140 } 141 142 if ($(v).attr('type') == 'hidden') { 143 if ($(v).val() == "") { 144 error_status.push($(v).attr("name")); 145 } 146 } 147 148 }); 149 if (error_status.length) { 150 return false 151 } else { 152 return myform 153 } 154 }, 155 singleValidate: function (elem) { 156 if ($(elem).attr('type') == 'email') { 157 if (this.checkEmail($(elem).val())) { 158 $(v).removedClass('is-invalid') 159 } else { 160 $(v).addClass('is-invalid') 161 } 162 } 163 164 if ($(elem).attr('type') == 'tel') { 165 if (this.checkPhone($(elem).val())) { 166 $(v).removeClass('is-invalid') 167 } else { 168 $(v).addClass('is-invalid') 169 } 170 } 171 }, 172 checkEmail: function (val) { 173 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 174 if (regex.test(val) == false) { 175 return false 176 } else { 177 return true 178 } 179 }, 180 checkPhone: function (val) { 181 var exp = /[a-zA-Z`@#$%^&*]/ 182 if (val.length >= 10 && !exp.test(val)) { 183 return true 184 } else { 185 return false 186 } 187 }, AjaxCall(url, data, elem) { 188 $.ajax({ 189 url: url, 190 type: "POST", 191 datatype: "json", 192 data: data, 193 xhrFields: { withCredentials: false }, 194 success: function (json) { 195 resp = $.parseJSON(json) 196 if (resp.status == 'success') { 197 $('#' + elem).remove(); 198 $('#' + elem + '-response').html(resp.message).show() 199 $('#' + elem + '-error_response').hide() 200 } else if (resp.status == 'error') { 201 $('#' + elem + '-error_response').html(resp.message).show() 202 $('#' + elem + '-response').hide() 203 } 204 205 } 206 }) 207 }, IsUrl(string) { 208 let url; 209 try { 210 url = new URL(string); 211 } catch (_) { 212 return false;
213 } 214 return true; 215 }, copyLink() { 216 var msg = 'Link copied â paste and share.'; 217 let linkhref = $('.share-link').attr('href'); 218 if (!navigator.clipboard) { 219 var clipBoardElem = document.createElement("input"); 220 document.body.appendChild(clipBoardElem); 221 clipBoardElem.value = linkhref; 222 clipBoardElem.select(); 223 224 var successfulCopy = document.execCommand('copy'); 225 if (successfulCopy) { 226 227 if (document.getElementById("share_message")) { 228 let shareMessageDiv = document.getElementById("share_message"); 229 shareMessageDiv.innerHTML = msg; 230 shareMessageDiv.style.display = "block"; 231 setTimeout(() => { 232 shareMessageDiv.style.display = "none"; 233 }, 10000); 234 } else { 235 harBootbox.Alert(msg); 236 } 237 238 } else { 239 harBootbox.Alert("Failed, Clipboard permission denied."); 240 } 241 } else { 242 navigator.clipboard.writeText(linkhref).then( 243 function () { 244 if (document.getElementById("share_message")) { 245 let shareMessageDiv = document.getElementById("share_message"); 246 shareMessageDiv.innerHTML = msg; 247 shareMessageDiv.style.display = "block"; 248 setTimeout(() => { 249 shareMessageDiv.style.display = "none"; 250 }, 10000); 251 } else { 252 harBootbox.Alert(msg); 253 } 254 255 }) 256 .catch( 257 function () { 258 harBootbox.Alert("Failed, Clipboard permission denied."); 259 }); 260 } 261 }, shareHCaptcha(hcaptcha) { 262 hcaptcha.render('share-email-hcaptcha', { 263 "sitekey": "802aa4a8-3568-409c-b66d-095448795f6c" 264 }) 265 hcaptcha.render('share-text-hcaptcha', { 266 "sitekey": "802aa4a8-3568-409c-b66d-095448795f6c" 267 }) 268 } 269 270 271 272 273};
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.