1jQuery(document).on("click", ".info-label", function () { 2 var targetModal = jQuery(this).attr("data-target"); 3 jQuery(targetModal).modal("show"); 4}); 5jQuery(document).on("click", ".close", function () { 6 jQuery(this).closest(".modal").modal("hide"); 7}); 8 9window.addEventListener("pageshow", function (event) { 10 var historyTraversal = 11 event.persisted || 12 (typeof window.performance != "undefined" && 13 window.performance.navigation.type === 2); 14 if (historyTraversal) { 15 window.location.reload(); 16 } 17}); 18 19function checkout_buttion() { 20 jQuery("#checkout-buttion").hide(); 21 jQuery("#checkout-loder").show(); 22 window.location.href = "/checkout/"; 23} 24 25// function handleRadioButtonClick(radioButton) { 26// var selectedproduct = radioButton.value; 27// var id = selectedproduct.split("_")[0]; 28// var selectedproductterm = radioButton.getAttribute("data-attribute"); 29// var arr = selectedproductterm.split(":"); 30// jQuery("#num_of_issues_" + id).html(arr[0] + " issues"); 31// jQuery("#regular_price_" + id).html("$" + arr[1]); 32// jQuery("#sale_price_" + id).html("$" + arr[2]); 33// jQuery("#you_save_" + id).html(arr[3] + "% off"); 34// jQuery("#addtocart_" + id).attr( 35// "onclick", 36// "Addtocart(" + id + "," + arr[4] + ")" 37// ); 38// if (arr[5] == "") { 39// jQuery("#addtocart_" + id) 40// .removeClass("nonclickable-button") 41// .html("Add"); 42// } else { 43// jQuery("#addtocart_" + id) 44// .addClass("nonclickable-button") 45// .html("Added"); 46// } 47// } 48 49function Addtocart(product_id, variation_id) { 50 var selectedproductterm = jQuery( 51 "#input_" + product_id + "_" + variation_id 52 ).data("attribute"); 53 54 jQuery.ajax({ 55 type: "POST", 56 url: custom_ajax_object.ajax_url, 57 data: { 58 action: "addtocart_own_combo", 59 p_id: product_id, 60 }, 61 beforeSend: function () { 62 jQuery(".v_overlay").show().addClass("v_loading-item"); 63 }, 64 success: function (result) { 65 if (result.success) { 66 console.log(result.data.cart); 67 createCookie("vcart", null, 0); 68 createCookie("vcart", result.data.cart, 1); 69 window.localStorage.setItem("vcart", result.data.cart); 70 jQuery.ajax({ 71 type: "POST", 72 dataType: "json", 73 url: custom_ajax_object.ajax_url, 74 data: { 75 action: "v_add_to_cart", 76 p_id: product_id, 77 qty: 1, 78 attr: variation_id, 79 }, 80 beforeSend: function () { 81 jQuery(".v_overlay").show().addClass("v_loading-item"); 82 }, 83 success: function (result) { 84 data = result; 85 console.log(data); 86 87 createCookie("vcart", null, 0); 88 createCookie("vcart", data.cookie, 1); 89 window.localStorage.setItem("vcart", data.cookie); 90 let items = JSON.parse(data.items); 91 let totalProQuantity = 0; 92 for (let i = 0; i < items.length; ++i) 93 totalProQuantity = totalProQuantity + parseInt(items[i].quantity); 94 jQuery("span.item-counter.minicart-counter").html(totalProQuantity); 95 96 if (data.cookie) { 97 jQuery.ajax({ 98 type: "POST", 99 url: custom_ajax_object.ajax_url, 100 data: { 101 action: "owncombo_cart_items", 102 cookie_data: data.cookie, 103 device_id: 0, 104 }, 105 success: function (getresults) { 106 console.log(getresults); 107 jQuery(".side-bar-cart").html(getresults); 108 jQuery(".v_overlay").removeClass("v_loading-item").hide(); 109 }, 110 }); 111 } else { 112 console.error("Cookie value not found in response."); 113 } 114 }, 115 error: function () { 116 console.error("Error in second AJAX call."); 117 jQuery(".v_overlay").removeClass("v_loading-item").hide(); 118 }, 119 }); 120 jQuery("#input_" + product_id + "_" + variation_id).prop( 121 "checked", 122 true 123 ); 124 jQuery("#input_" + product_id + "_" + variation_id).attr( 125 "data-attribute", 126 selectedproductterm + "Yes" 127 ); 128 jQuery("#addtocart_" + product_id + "_" + variation_id) 129 .addClass("nonclickable-button") 130 .html("Added"); 131 } 132 }, 133 }); 134 return false;
135} 136 137function Removetocart(product_id, attr, num, device) { 138 if (device == 1) { 139 jQuery(".close-icon-mob-" + num).css("opacity", "0.1"); 140 jQuery(".fa-spin-mob-" + num).show(); 141 jQuery("#cart_item_mob_" + num).addClass("cart-loader"); 142 } else { 143 jQuery(".close-icon-" + num).css("opacity", "0.1"); 144 jQuery(".fa-spin-" + num).show(); 145 jQuery("#cart_item_" + num).addClass("cart-loader"); 146 } 147 jQuery.ajax({ 148 type: "POST", 149 url: custom_ajax_object.ajax_url, 150 data: { 151 action: "removecart_own_combo", 152 product_id: product_id, 153 attr: attr, 154 device_id: device, 155 }, 156 beforeSend: function () { 157 jQuery(".v_overlay").show().addClass("v_loading-item"); 158 }, 159 success: function (result) { 160 console.log(result.data.items); 161 jQuery("span.item-counter.minicart-counter").html(result.data.items); 162 if (result.success) { 163 createCookie("vcart", null, 0); 164 createCookie("vcart", result.data.cookie, 1); 165 window.localStorage.setItem("vcart", result.data.cookie); 166 jQuery.ajax({ 167 type: "POST", 168 url: custom_ajax_object.ajax_url, 169 data: { 170 action: "owncombo_cart_items", 171 cookie_data: result.data.cookie, 172 device_id: 0, 173 }, 174 success: function (getresults) { 175 jQuery(".side-bar-cart").html(getresults); 176 jQuery(".v_overlay").removeClass("v_loading-item").hide(); 177 }, 178 }); 179 } 180 jQuery("#addtocart_" + product_id + "_" + attr) 181 .removeClass("nonclickable-button") 182 .html("Add"); 183 jQuery("#input_" + product_id + "_49").prop("checked", true); 184 }, 185 }); 186} 187 188function lode_mob_cart() { 189 jQuery("#bottom-canvas").hide(); 190 jQuery(".symbol").toggleClass("symbol-rotatex"); 191} 192 193function showhide_mob_cart() { 194 jQuery(".symbol").toggleClass("symbol-rotatex"); 195 jQuery("#bottom-canvas").toggle(); 196} 197jQuery(".info-label").on("click", function () { 198 const targetModal = jQuery(this).data("target"); 199 jQuery(targetModal).modal("show"); 200}); 201 202 function set_degetal_product(radioButton) { 203 var label = radioButton.nextElementSibling; 204 if (label) { 205 var text = label.textContent.trim(); 206 var capitalizedLabel = text.charAt(0).toUpperCase() + text.slice(1); 207 } 208 var card = radioButton.closest(".card"); 209 if (!card) { 210 console.warn("No .card found for", radioButton); 211 return; 212 } 213 214 var selectedproduct = radioButton.value; 215 var selectedproductterm = radioButton.getAttribute("data-attribute"); 216 var selectedproductimg = radioButton.getAttribute("data-img") || ""; 217 var product_pid = selectedproduct; 218 219 if (!selectedproductterm) { 220 console.warn("Missing data-attribute on", radioButton); 221 return; 222 } 223 224 var arr = selectedproductterm.split(":"); 225 var variations = []; 226 for (let i = 0; i < arr.length; i += 6) { 227 if (arr[i]) { 228 variations.push({ 229 varid: arr[i], 230 term: arr[i + 1], 231 issue: arr[i + 2], 232 regular: arr[i + 3], 233 sale: arr[i + 4], 234 save: arr[i + 5], 235 }); 236 } 237 } 238 239 let radiosHtml = ""; 240 variations.forEach((v, index) => { 241 radiosHtml += ` 242 <div class="col-6"> 243 <div class="form-check ${ 244 index % 2 === 0 ? "text-left" : "text-right" 245 }"> 246 <input class="form-check-input" type="radio" 247 name="promo_products_term_${product_pid}" 248 value="${product_pid}_${ 249 v.varid 250 }" id="input_${product_pid}_${v.varid}" 251 data-attribute="${v.issue}:${v.regular}:${v.sale}:${ 252 v.save 253 }:${v.varid}" 254 id="input_${v.varid}" 255 ${index === 0 ? "" : "checked"} 256 onclick="handleRadioButtonClick(this)"> 257 <label class="form-check-label-sm" style="font-size:12px;" for="input_${product_pid}_${ 258 v.varid 259 }"> 260 ${v.term} 261 </label> 262 </div> 263 </div> 264 `; 265 }); 266 267 var termsRow = card.querySelector(".terms-container"); 268 if (termsRow) { 269 termsRow.innerHTML = radiosHtml; 270 } 271 272 var magLabel = card.querySelector(".mag-type"); 273 if (magLabel) { 274 magLabel.textContent = capitalizedLabel; 275 } 276 277 var img = card.querySelector(".card-img-top"); 278 if (img && selectedproductimg) { 279 img.src = selectedproductimg; 280 } 281 282 var activeRadio = card.querySelector( 283 "input[name='promo_products_term_" + product_pid + "']:checked" 284 ); 285 if (activeRadio) { 286 handleRadioButtonClick(activeRadio); 287 } 288 } 289 290 function handleRadioButtonClick(radio) { 291 var card = radio.closest(".card"); 292 if (!card) return; 293 294 var product_pid = radio.value; 295 var attr = radio.getAttribute("data-attribute").split(":"); 296 var isChecked = radio.getAttribute("data-check"); 297 298 var issue = attr[0]; 299 var regular = attr[1]; 300 var sale = attr[2]; 301 var save = attr[3]; 302 var varid = attr[4]; 303 304 var issueLabel = card.querySelector(".number_of_issue"); 305 if (issueLabel) { 306 issueLabel.textContent = issue + " issues"; 307 } 308 // ð¹ Update price box 309 var productPriceIssue = card.querySelector(".price-box"); 310 if (productPriceIssue) { 311 productPriceIssue.innerHTML = `<label class="col-form-label col-4 lbl1">$${regular}</label> 312 <label class="col-form-label col-4 lbl2">$${sale}</label> 313 <label class="col-form-label col-4 lbl3">${save}% off</label>`; 314 } 315 316 var productAddCart = card.querySelector(".product-add-to-cart"); 317 if (productAddCart) { 318 if (isChecked === "Yes") { 319 productAddCart.innerHTML = ` 320 <button id="addtocart_${radio.value}" 321 style="width: 130px; font-weight: 600; font-size: 16px;" 322 class="btn btn-sm btn-cancel btn-outline-secondary mt-2 nonclickable-button" 323 role="button">Added</button> 324 `; 325 } else { 326 productAddCart.innerHTML = ` 327 <button id="addtocart_${radio.value}" 328 onclick="Addtocart(${radio.value.split("_")[0]},${varid})" 329 style="width: 130px; font-weight: 600; font-size: 16px;" 330 class="btn btn-sm btn-cancel btn-outline-secondary mt-2" 331 role="button">Add</button> 332 `; 333 } 334 } 335 }
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.