1(function ($, settings) { 2 $.fn.serializeObject = function () { 3 var o = {}; 4 var a = this.serializeArray(); 5 $.each(a, function () { 6 if (o[this.name]) { 7 if (!o[this.name].push) { 8 o[this.name] = [o[this.name]]; 9 } 10 o[this.name].push(this.value || ""); 11 } else { 12 o[this.name] = this.value || ""; 13 } 14 }); 15 return o; 16 }; 17 18 $.homelocalPrice = function (amount, currency = "", trim_zero = true) { 19 const requested = currency || settings.currency; 20 let price; 21 22 // Intl.NumberFormat throws a RangeError on an invalid currency code (e.g. 23 // the "¤" placeholder). A single malformed property must degrade only its 24 // own card, never abort the render loop and blank the whole explorer map. 25 try { 26 price = new Intl.NumberFormat(settings.lang, { 27 style: "currency", 28 currency: requested, 29 }).format(amount); 30 } catch (e) { 31 try { 32 // Retry with the site default currency. 33 price = new Intl.NumberFormat(settings.lang, { 34 style: "currency", 35 currency: settings.currency, 36 }).format(amount); 37 } catch (e2) { 38 // Last resort: a plain, currency-less number. 39 price = new Intl.NumberFormat(settings.lang).format(amount); 40 } 41 } 42 43 if ("CNY" === currency) { 44 price = price.replace("CN", ""); 45 } 46 47 if (trim_zero) { 48 if (parseInt(price.split(".")[1], 10) === 0) { 49 price = price.split(".")[0]; 50 } 51 } 52 53 return price; 54 }; 55 56 $(document).ready(function () { 57 // move all elements that have hk-modal attribute to .hk-scope-modal container. 58 $("[hk-modal]").each(function () { 59 const $this = $(this); 60 $this.appendTo(".hk-scope-modal"); 61 }); 62 }); 63})(jQuery, homelocal_common_config);
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.