1import * as alies_getcookies from "./wcmlim_getcookies.js"; 2import * as alies_localization from "./wcmlim_localization.js"; 3import * as alies_CommonFunction from "./wcmlim_common_functions.js"; 4 5var localization = alies_localization.wcmlim_localization(); 6 7export function CookieExists() { 8 const cookieExists = alies_getcookies.getCookie("wcmlim_selected_location"); 9 if (cookieExists) { 10 const cookiregid = alies_getcookies.getCookie( 11 "wcmlim_selected_location_regid" 12 ); 13 jQuery( 14 'select[name="wcmlim_change_sl_to"] option[value="' + cookiregid + '"]' 15 ).attr("selected", "selected"); 16 jQuery('select[name="wcmlim_change_sl_to"]').trigger("change"); 17 const selectedLQ = jQuery("#select_location") 18 .find("option:selected") 19 .attr("data-lc-qty"); 20 const BoS = jQuery("#backorderAllowed").val(); 21 if (jQuery(".variation_id").length == 0) { 22 if (BoS == 0) { 23 if (selectedLQ) { 24 document.getElementById("lc_qty").value = selectedLQ; 25 } 26 } 27 } 28 const regularPrice = jQuery("#select_location") 29 .find("option:selected") 30 .attr("data-lc-regular-price"); 31 const salePrice = jQuery("#select_location") 32 .find("option:selected") 33 .attr("data-lc-sale-price"); 34 const svalue = jQuery("#select_location").find("option:selected").text(); 35 const sLValue = jQuery("#select_location").find("option:selected").val(); 36 const stockDisplay = jQuery("#wcstdis_format").val(); 37 jQuery(document.body).trigger("wc_fragments_refreshed"); 38 const clasname = jQuery("#wcmlim-change-lc-select") 39 .find("option:selected") 40 .attr("class"); 41 jQuery("body").removeClass(function (index, css) { 42 return (css.match(/\bwclimloc_\S+/g) || []).join(" "); 43 }); 44 var body = document.body; 45 body.classList.add(clasname); 46 let undefinedclass = jQuery("body").hasClass("undefined"); 47 if (undefinedclass == true) { 48 jQuery(body).removeClass("undefined"); 49 jQuery(body).addClass("wclimloc_none"); 50 } 51 if ( 52 jQuery("#globMsg, #losm, #seloc,#locsoldImg, #locstockImg").length > 0 53 ) { 54 jQuery("#globMsg, #losm, #seloc,#locsoldImg, #locstockImg").remove(); 55 } 56 /**Radio option */ 57 if (sLValue) { 58 jQuery( 59 ".rselect_location input[name=select_location][value=" + sLValue + "]" 60 ).prop("checked", true); 61 jQuery( 62 ".rlist_location input[name=wcmlim_change_lc_to][value=" + sLValue + "]" 63 ).prop("checked", true); 64 } 65 if (svalue) { 66 const selA = svalue.split("-"); 67 if (1 in selA) { 68 const selS = selA[1].split(":"); 69 const stockStatus = selS[0].trim(); 70 71 if ( 72 !stockDisplay || 73 stockDisplay == "no_amount" || 74 stockDisplay == "low_amount" 75 ) { 76 if (stockStatus == "Out of Stock" || selectedLQ <= 1) { 77 if (sLValue == "-1") { 78 jQuery( 79 '<div id="load" style="display:none"><img src="//s.svgbox.net/loaders.svg?fill=maroon&ic=tail-spin" style="width:33px"></div>' 80 ).appendTo(".Wcmlim_nextloc_label"); 81 jQuery("#load").show(); 82 jQuery.ajax({ 83 type: "POST", 84 url: localization.ajaxurl, 85 data: { 86 action: "wcmlim_closest_location", 87 selectedLocationId: sLValue, 88 89 }, 90 dataType: "json", 91 success(res) { 92 93 if (jQuery.trim(res.status) == "true") { 94 if (localization.nextloc == "on") { 95 jQuery(".next_closest_location_detail").html(""); 96 jQuery(".next_closest_location_detail").show(); 97 jQuery("#load").hide(); 98 jQuery( 99 `<button id="" class="Wcmlim_accept_btn"><i class="fa fa-check"></i>Accept</button><input type="hidden" class="nextAcceptLoc" value="${res.secNearLocKey}" />` 100 ).appendTo(".Wcmlim_nextloc_label"); 101 jQuery( 102 `<div id="seloc" class="selected_location_name"><i class="fa fa-dot-circle"></i>${selA[0].trim()} <br />
103 <span class="next_km">( ` + 104 res.fetch_origin_distance + 105 `)</span> 106 </div>` 107 ).appendTo(".selected_location_detail"); 108 jQuery( 109 `<strong>` + 110 localization.NextClosestinStock + 111 `: <br/> ` + 112 res.secNearLocAddress + 113 ` <span class="next_km">( ` + 114 res.secNearStoreDisUnit + 115 `)</span></strong>` 116 ).appendTo(".next_closest_location_detail"); 117 118 if (jQuery(".Wcmlim_accept_btn").length) { 119 jQuery(".Wcmlim_accept_btn").click(() => { 120 jQuery("#select_location") 121 .val(res.secNearLocKey) 122 .trigger("change"); 123 jQuery(".Wcmlim_accept_btn").remove(); 124 }); 125 } 126 127 if (jQuery(".postcode-location-distance").length) { 128 jQuery(".postcode-location-distance").hide(); 129 } 130 } 131 } 132 jQuery(".wclimlocsearch").hide(); 133 }, 134 error(res) { 135 jQuery("#load").hide(); 136 }, 137 }); 138 } 139 if ( 140 jQuery("#globMsg, #losm, #seloc, #locsoldImg, #locstockImg") 141 .length > 0 142 ) { 143 jQuery( 144 "#globMsg, #losm, #seloc, #locsoldImg, #locstockImg" 145 ).remove(); 146 } 147 // jQuery( "<p id='losm'>" + localization.soldout + "</p>" ).insertAfter( 148 // ".Wcmlim_prefloc_sel" 149 // ); 150 jQuery( 151 `<div id="locsoldImg" class="Wcmlim_over_stock"><i class="fa fa-times"></i>${localization.soldout}</div>` 152 ).appendTo(".Wcmlim_locstock"); 153 jQuery( 154 ".actions-button, .qty, .quantity, .single_add_to_cart_button, .add_to_cart_button, .stock, .compare" 155 ).show(); 156 } else { 157 if ( 158 jQuery("#globMsg, #losm, #seloc, #locsoldImg, #locstockImg") 159 .length > 0 160 ) { 161 jQuery( 162 "#globMsg, #losm, #seloc, #locsoldImg, #locstockImg" 163 ).remove(); 164 } 165 166 if (stockDisplay == "no_amount") { 167 if ( 168 localization.listmode != "on" || 169 localization.listmode == null 170 ) { 171 jQuery( 172 "<p id='globMsg'> " + localization.instock + "</p>" 173 ).insertAfter(".Wcmlim_prefloc_sel"); 174 } 175 jQuery( 176 `<div id="seloc" class="selected_location_name"><i class="fa fa-dot-circle"></i>${selA[0].trim()}</div>` 177 ).appendTo(".selected_location_detail"); 178 var kmval = jQuery("#product-location-distance").val(); 179 if (kmval) { 180 jQuery(".postcode-location-distance").html( 181 `<i class="fa fa-map-marker-alt"></i> ${kmval} ` + 182 localization.away 183 ); 184 } 185 } else { 186 if (jQuery("#locsoldImg, #locstockImg").length > 0) { 187 jQuery("#locsoldImg, #locstockImg").remove(); 188 } 189 if (selectedLQ) { 190 if ( 191 localization.listmode != "on" || 192 localization.listmode == null 193 ) { 194 jQuery( 195 `<p id='globMsg'><b>${selectedLQ} </b> ` + 196 localization.instock + 197 `</p>` 198 ).insertAfter(".Wcmlim_prefloc_sel"); 199 } 200 jQuery( 201 `<div id="seloc" class="selected_location_name"><i class="fa fa-dot-circle"></i>${selA[0].trim()}</div>` 202 ).appendTo(".selected_location_detail"); 203 var kmval = jQuery("#product-location-distance").val(); 204 if (kmval) { 205 jQuery(".postcode-location-distance").html( 206 `<i class="fa fa-map-marker-alt"></i> ${kmval} away` 207 ); 208 } 209 jQuery( 210 `<div id="locstockImg" class="Wcmlim_have_stock 33"><i class="fa fa-check"></i>${localization.instock}</div>` 211 ).appendTo(".Wcmlim_locstock"); 212 } 213 } 214 } 215 } 216 if (BoS == 0) { 217 if (selectedLQ) { 218 jQuery(".qty").attr({ max: selectedLQ }); 219 document.getElementById("lc_qty").value = selectedLQ; 220 } 221 } 222 } 223 } 224 225 if (localization.enable_price == "on") { 226 if (typeof regularPrice !== "undefined" && regularPrice.length > 9) { 227 const grp = alies_CommonFunction.extractMoney(regularPrice); 228 var gpp = grp.amount; 229 } 230 if ((regularPrice || salePrice) && gpp > 0) { 231 if (salePrice.length > 9) { 232 jQuery(".price.wcmlim_product_price").html( 233 `<del>${regularPrice}</del><ins>${salePrice}</ins>` 234 ); 235 } else if (salePrice.length == 9) { 236 jQuery(".price.wcmlim_product_price").html(regularPrice); 237 } else { 238 jQuery(".price.wcmlim_product_price").html(regularPrice); 239 } 240 document.getElementById("lc_regular_price").value = regularPrice; 241 document.getElementById("lc_sale_price").value = salePrice; 242 } 243 } 244 } else { 245 jQuery("body").removeClass(function (index, css) { 246 return (css.match(/\bwclimloc_\S+/g) || []).join(" "); 247 }); 248 var body = document.body; 249 body.classList.add("wclimloc_none"); 250 } 251}
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.