1jQuery(document).ready(function ($) { 2 if ($("#opc-product-selection").length) { 3 $("#opc-product-selection table tbody tr").each(function () { 4 var amount = $(this) 5 .find(".product-price .amount") 6 .html() 7 .trim() 8 .replace(".00", ""); 9 $(this).find(".product-price .amount").html(amount); 10 }); 11 } 12 var getUrlParameter = function getUrlParameter(sParam) { 13 var sPageURL = decodeURIComponent(window.location.search.substring(1)), 14 sURLVariables = sPageURL.split("&"), 15 sParameterName, 16 i; 17 for (i = 0; i < sURLVariables.length; i++) { 18 sParameterName = sURLVariables[i].split("="); 19 20 if (sParameterName[0] === sParam) { 21 return sParameterName[1] === undefined 22 ? true 23 : sParameterName[1]; 24 } 25 } 26 }; 27 var optinClickableID = $("#optin-clickable"); 28 if (optinClickableID.length > 0) { 29 var optinClickable = optinClickableID.attr("href"); 30 var optinBackgroundImage = $(".optin-monster-image"); 31 optinBackgroundImage.wrap( 32 '<a href="' + optinClickable + '" target="_self"></a>' 33 ); 34 } 35 36 // Complete your order 37 if ( 38 $("body").hasClass("woocommerce-checkout") && 39 $(".wcopc").length > 0 && 40 $("body").hasClass("woocommerce-order-received") === false && 41 $("body").hasClass("woocommerce-order-pay") === false 42 ) { 43 var selected_type = getUrlParameter("type") 44 ? getUrlParameter("type").toLowerCase().trim() 45 : "", 46 selected_plan = getUrlParameter("plan") 47 ? getUrlParameter("plan").toLowerCase().trim() 48 : "", 49 conversions = ""; 50 51 conversions = get_conversions(selected_type); 52 53 // Bail out, if parameters are empty or invalid 54 if ( 55 typeof selected_type === "undefined" || 56 selected_type === "" || 57 typeof selected_plan === "undefined" || 58 selected_plan === "" 59 ) { 60 window.location.href = "https://www.scan2cad.com" + "/pricing"; 61 return; 62 } 63 64 // Temporary measure as we don't do monthly lite plans 65 if (selected_type === "lite") { 66 window.location.href = "https://www.scan2cad.com" + "/pricing"; 67 return; 68 } 69 70 if ( 71 $("article.post-22212 section.entry #opc-product-selection") 72 .length > 0 73 ) { 74 add_additional_content(); 75 move_login_form_above(); 76 77 // set the form values and prices 78 set_billing_plan_checkboxes(selected_plan, selected_type); 79 set_selected_tier_options(selected_type); 80 set_related_license_types(selected_type); 81 set_saving(selected_type); 82 conversions = get_conversions(selected_type); 83 set_related_product_price( 84 selected_type, 85 selected_plan, 86 $("#license-type").val(), 87 conversions 88 ); 89 $(".conversions-included").text(conversions); 90 91 // Update license type drop-down based on selected product type 92 $("#selected-tier").on("change", function () { 93 add_disabled_attr(); 94 var new_selected_type = $(this).val().toLowerCase().trim(); 95 96 set_related_license_types(new_selected_type); 97 conversions = get_conversions(new_selected_type); 98 $(".conversions-included").text(conversions); 99 set_related_product_price( 100 new_selected_type, 101 selected_plan, 102 $("#license-type").val(), 103 conversions 104 ); 105 set_billing_plan_checkboxes(selected_plan, new_selected_type); 106 set_saving(new_selected_type); 107 108 setTimeout(function () { 109 remove_disabled_attr(); 110 }, 2500); // changed from 3500 111 }); 112 113 // Update license type drop-down based on selected product type 114 $("#license-type").on("change", function () { 115 add_disabled_attr(); 116 var selected_type = $("#selected-tier").val(), 117 selected_plan = $( 118 ".billing-plan-fields-wrapper input[type=checkbox]:checked" 119 ).data("plan"), 120 selected_license = $("#license-type").val(); 121 set_related_product_price( 122 selected_type, 123 selected_plan, 124 selected_license, 125 conversions 126 ); 127 setTimeout(function () { 128 remove_disabled_attr(); 129 }, 2500); // changed from 3500 130 }); 131 132 // Force checkbox to act like a radio button 133 $("input[name=billed-checkbox]").on("change", function () { 134 add_disabled_attr(); 135 $(".billing-plan-fields-wrapper li").removeClass( 136 "selected-plan" 137 ); 138 $("input[name=billed-checkbox]").prop("checked", false); 139 $(this).prop("checked", true); 140 $(this).closest("li").addClass("selected-plan"); 141 142 var selected_type = $("#selected-tier").val(), 143 selected_plan = $( 144 ".billing-plan-fields-wrapper input[type=checkbox]:checked" 145 ).data("plan"), 146 selected_license = $("#license-type").val(); 147 148 set_related_product_price( 149 selected_type, 150 selected_plan, 151 selected_license, 152 conversions 153 ); 154 setTimeout(function () { 155 remove_disabled_attr(); 156 }, 2500); // changed from 3500 157 }); 158 159 // Update cart quantity 160 $("input[type=number]#number-of-users").bind( 161 "keyup change", 162 function () { 163 add_disabled_attr(); 164 var selected_type = $("#selected-tier").val(), 165 selected_plan = $( 166 ".billing-plan-fields-wrapper input[type=checkbox]:checked" 167 ).data("plan"), 168 selected_license = $("#license-type").val(); 169 set_related_product_price( 170 selected_type, 171 selected_plan, 172 selected_license, 173 conversions 174 ); 175 setTimeout(function () { 176 remove_disabled_attr(); 177 }, 2500); // changed from 3500 178 } 179 ); 180 181 if ($(".wcopc > ul.woocommerce-error").length > 0) { 182 $("#wcopc-login-wrapper").prepend( 183 $(".wcopc > ul.woocommerce-error").get(0) 184 ); 185 $("html, body").animate( 186 { scrollTop: $("ul.woocommerce-error").offset().top }, 187 500 188 ); 189 } 190 191 $(document).on("update_checkout", function () { 192 add_custom_placeholders(); 193 194 if ($(".wcopc > .woocommerce-message").length > 0) { 195 $("#wcopc-login-wrapper").prepend( 196 $(".wcopc > .woocommerce-message").get(0) 197 ); 198 $("html, body").animate( 199 { 200 scrollTop: $(".woocommerce-message").offset().top, 201 }, 202 500 203 ); 204 } 205 setTimeout(function () { 206 $("#stripe-card-expiry").attr( 207 "placeholder", 208 "Expiry: MM / YY" 209 ); 210 }, 2500); 211 212 if ($(".create-account abbr img").length > 0) { 213 // $('.create-account abbr img').attr('src', 'https://www.scan2cad.com/wp-content/uploads/2014/08/icon-info.png'); 214 } 215 }); 216 217 $(document).on("checkout_error", function () { 218 if ($(".woocommerce-NoticeGroup").length > 0) { 219 $("#wcopc-login-wrapper").prepend( 220 $(".woocommerce-NoticeGroup").get(0) 221 ); 222 $(".woocommerce-NoticeGroup").slideDown("fast"); 223 $("html, body").animate( 224 { 225 scrollTop: $(".woocommerce-NoticeGroup").offset() 226 .top, 227 }, 228 100 229 ); 230 } 231 }); 232 remove_predefined_field_values(); 233 } 234 } 235 236 function add_additional_content() { 237 if ($(".opc_order_review").length > 0) { 238 $(".opc_order_review").prepend( 239 "<div class=extra-content-before-order-review><h5>Purchase with confidence</h5><ul><li>Free 24/7 support<li>No contracts, cancel whenever you wish<li>Instant download after purchase</ul></div>" 240 ); 241 242 $(".opc_order_review").append( 243 '<div class=extra-content-before-order-review><h5>For your records</h5><ul><li><a href="https://www.scan2cad.com/legal/terms-of-sale/" target="_blank">Terms of Sale</a></li><li><a href="https://www.scan2cad.com/legal/end-user-licensing-agreement/" target="_blank">End User License Agreement</a></li></ul></div>' 244 ); 245 } 246 } 247 248 function remove_predefined_field_values() { 249 if ($("#billing_po_number").length > 0) { 250 $("#billing_po_number").val(""); 251 } 252 253 if ($("#billing_end_user_name").length > 0) { 254 $("#billing_end_user_name").val(""); 255 } 256 257 if ($("#billing_end_user_email").length > 0) { 258 $("#billing_end_user_email").val(""); 259 } 260 261 if ($("#billing_end_user_company").length > 0) { 262 $("#billing_end_user_company").val(""); 263 } 264 } 265 266 // Customizing placeholders of billing fields 267 function add_custom_placeholders() { 268 if ($("input#woocommerce_eu_vat_number").length > 0) { 269 $("input#woocommerce_eu_vat_number").removeAttr("placeholder"); 270 $("input#woocommerce_eu_vat_number").attr( 271 "placeholder", 272 "VAT Number (optional)" 273 ); 274 } 275 if ($("input#billing_postcode").length > 0) { 276 $("input#billing_state").removeAttr("placeholder"); 277 $("input#billing_postcode").attr("placeholder", "ZIP / Postcode"); 278 } 279 if ($("input#billing_state").length > 0) { 280 $("input#billing_state").removeAttr("placeholder"); 281 $("input#billing_state").attr("placeholder", "State / County"); 282 } 283 setTimeout(function () { 284 if ($("p#billing_email_field").length > 0) { 285 $("p#billing_last_name_field").after( 286 $("p#billing_email_field").get(0) 287 ); 288 } 289 if ($("p#vat_number_field").length > 0) { 290 $("p#billing_postcode_field").after( 291 $("p#vat_number_field").get(0) 292 ); 293 } 294 }, 1300); 295 }
296 // Moving WooCommerce returing customer login form to the top of checkout page 297 function move_login_form_above() { 298 if ( 299 $("#wcopc-login-wrapper").length > 0 && 300 $(".wcopc > .woocommerce-form-login-toggle").length > 0 && 301 $( 302 ".wcopc > .woocommerce-form-login-toggle + .woocommerce-form-login" 303 ).length > 0 304 ) { 305 $("#wcopc-login-wrapper").empty(); 306 $("#wcopc-login-wrapper").append( 307 $(".wcopc > .woocommerce-form-login-toggle").get(0) 308 ); 309 $("#wcopc-login-wrapper").append( 310 $(".wcopc > .woocommerce-form-login").get(0) 311 ); 312 if ($("input#username").length > 0) { 313 $("input#username").removeAttr("placeholder"); 314 $("input#username").attr("placeholder", "Username or email"); 315 } 316 if ($("input#password").length > 0) { 317 $("input#password").removeAttr("placeholder"); 318 $("input#password").attr("placeholder", "Password"); 319 } 320 } 321 } 322 323 // Append product names to "Selected Tier" drop-down field 324 function set_selected_tier_options(selected_type) { 325 var product_types = new Array(), 326 selector = $("#selected-tier"); 327 328 // adds the product title to the drop down 329 $(".shop_table .product-item .product-name").each(function () { 330 var product_title = $(this) 331 .find(".product-title") 332 .text() 333 .trim() 334 .replace("Scan2CAD ", ""); 335 $(this).find(".product-title").text(product_title); 336 }); 337 338 // creates an array of product titles: Lite, Pro, Business 339 $(".shop_table .product-item .product-name").each(function () { 340 var product_title = $(this).find(".product-title").text().trim(); 341 342 if ( 343 $.inArray(product_title, product_types) === -1 && 344 product_title != "Lite" 345 ) { 346 product_types.push(product_title); 347 } 348 }); 349 350 // sets the value in options tag wihtin the tier drop down 351 if (selector.length > 0) { 352 selector.empty(); 353 354 $.each(product_types, function (index, value) { 355 var options = $( 356 '<option value="' + 357 value.toLowerCase().trim() + 358 '">Scan2CAD ' + 359 value + 360 "</option>" 361 ); 362 363 selector.append(options); 364 }); 365 366 selector.val(selected_type); 367 } 368 } 369 370 // hides Save 10% when Lite is selected 371 function set_saving(selected_type) { 372 if (selected_type == "lite") { 373 $("#saving").css("display", "none"); 374 } 375 376 if (selected_type != "lite") { 377 $("#saving").css("display", "inline"); 378 } 379 } 380 381 // sets the number of conversions 382 function get_conversions(selected_type) { 383 var conversions = getUrlParameter("conversions") 384 ? getUrlParameter("conversions").toLowerCase().trim() 385 : "unlimited"; 386 387 // make sure that conversions is always set to unlimited if not lite 388 // this is for price test July 2021 389 if (selected_type != "lite") { 390 conversions = "unlimited"; 391 } 392 393 return conversions; 394 } 395 396 // Set selected product license types based on selected product type 397 function set_related_license_types(selected_type) { 398 var license_types = new Array(), 399 selector = $("#license-type"); 400 401 $(".shop_table .product-item .product-name").each(function () { 402 var product_title = $(this) 403 .find(".product-title") 404 .text() 405 .toLowerCase() 406 .trim(); 407 var product_license = $(this) 408 .find(".attributes") 409 .text() 410 .replace("License Type:", "") 411 .replace(", Conversions: 50", "") 412 .replace(", Conversions: Unlimited", "") 413 .trim(); 414 415 if ( 416 $.inArray(product_license, license_types) === -1 && 417 product_title === selected_type 418 ) { 419 license_types.push(product_license); 420 } 421 }); 422 423 if (selector.length > 0) { 424 selector.empty(); 425 426 $.each(license_types, function (index, value) { 427 var options = $( 428 '<option value="' + 429 value.toLowerCase().trim() + 430 '">' + 431 value + 432 "</option>" 433 ); 434 435 selector.append(options); 436 }); 437 } 438 } 439 440 // set selected product license types based on selected product type 441 function set_related_product_price( 442 selected_type, 443 selected_plan, 444 selected_license, 445 conversions 446 ) { 447 var products_prices = new Array(), 448 selected_conversions = "unlimited", 449 selector_annually = $("#billed-annually-price"), 450 selector_monthly = $("#billed-monthly-price"), 451 // selected_plan variable passd in 'annual' not year 452 selected_plan = selected_plan === "month" ? selected_plan : "year", 453 monthly_price = "", 454 annually_price = "", 455 number_of_users = parseInt( 456 $("input[type=number]#number-of-users").val() - 1 457 ); 458 459 if (selected_type == "lite" || selected_type == "business") { 460 selected_conversions = conversions; 461 selected_plan = "year"; 462 } 463 464 $(".shop_table .product-item .product-quantity input[type=number].qty") 465 .removeClass("trigger-add-to-cart") 466 .val(0); 467 468 $(".shop_table .product-item").each(function () { 469 var product_title = $(this) 470 .find(".product-name .product-title") 471 .text() 472 .toLowerCase() 473 .trim(); 474 475 var product_license = $(this) 476 .find(".attributes") 477 .text() 478 .replace("License Type:", "") 479 .replace(", Conversions: 50", "") 480 .replace(", Conversions: Unlimited", "") 481 .toLowerCase() 482 .trim(); 483 484 var product_conversions = $(this) 485 .find(".attributes") 486 .text() 487 .replace("License Type: Standard", "")
488 .replace("License Type: Network", "") 489 .replace("License Type: USB", "") 490 .replace(", Conversions: ", "") 491 .toLowerCase() 492 .trim(); 493 494 // hack to make sure product conversions is set 495 // incase variation not set up on Woo 496 product_conversions = 497 product_conversions == "" ? "unlimited" : product_conversions; 498 499 var product_price = $(this) 500 .find(".product-price .woocommerce-Price-amount") 501 .text() 502 .toLowerCase() 503 .trim(); 504 505 var billing_cycle = $(this) 506 .find(".product-price .subscription-details") 507 .text() 508 .replace("/", "") 509 .toLowerCase() 510 .trim(); 511 512 if ( 513 $.inArray(product_price, products_prices) === -1 && 514 product_title === selected_type && 515 selected_conversions === product_conversions 516 ) { 517 products_prices[billing_cycle] = product_price; 518 } 519 520 if ( 521 product_title === selected_type && 522 selected_plan === billing_cycle && 523 selected_license === product_license && 524 selected_conversions === product_conversions 525 ) { 526 $(this) 527 .find(".product-quantity input[type=number].qty") 528 .addClass("trigger-add-to-cart") 529 .val(number_of_users); 530 } 531 }); 532 533 if (selector_annually.length > 0) { 534 selector_annually.empty(); 535 selector_annually.append(products_prices["year"]); 536 } 537 538 if (selector_monthly.length > 0) { 539 selector_monthly.empty(); 540 selector_monthly.append(products_prices["month"]); 541 } 542 543 setTimeout(function () { 544 $( 545 ".shop_table .product-item .product-quantity input[type=number].trigger-add-to-cart" 546 ) 547 .next() 548 .trigger("click"); // this fires the plus / minus button 549 $( 550 ".shop_table .product-item .product-quantity input[type=number].trigger-add-to-cart" 551 ).trigger("input"); // added for opc 2.8.1 to make sure cart is not empty on page load 552 }); 553 } 554 555 // Pre-select billing cycle based on selected product type 556 // note yearly is annual 557 function set_billing_plan_checkboxes(selected_plan, selected_type) { 558 if (selected_type == "lite" || selected_type == "business") { 559 $("li.billed-monthly").css("display", "none"); 560 selected_plan = "year"; 561 } 562 563 if (selected_type == "pro") { 564 $("li.billed-monthly").css("display", "table-cell"); 565 } 566 567 if ($(".billing-plan-fields-wrapper").length > 0) { 568 $(".billing-plan-fields-wrapper li").removeClass("selected-plan"); 569 570 $(".billing-plan-fields-wrapper input[type=checkbox]").each( 571 function () { 572 $(this).prop("checked", false); // clear it 573 574 if (selected_plan === $(this).data("plan").trim()) { 575 $(this).prop("checked", true); 576 $(this).closest("li").addClass("selected-plan"); 577 } 578 579 if ( 580 selected_type == "lite" || 581 selected_type == "business" 582 ) { 583 // has no monthly 584 585 $(this).prop("checked", true); 586 $(this).closest("li").addClass("selected-plan"); 587 } 588 } 589 ); 590 } 591 } 592 593 // Add "disabled" attribute to all elements 594 function add_disabled_attr() { 595 $("body").css("cursor", "wait"); 596 $("#selected-tier").prop("disabled", true).css("opacity", "0.5"); 597 $("#license-type").prop("disabled", true).css("opacity", "0.5"); 598 $("#number-of-users").prop("disabled", true).css("opacity", "0.5"); 599 $("#billed-annually-checkbox") 600 .prop("disabled", true) 601 .css("opacity", "0.5"); 602 $("#billed-monthly-checkbox") 603 .prop("disabled", true) 604 .css("opacity", "0.5"); 605 } 606 // Remove "disabled" attributes from all elements 607 function remove_disabled_attr() { 608 $("body").css("cursor", "auto"); 609 $("#selected-tier").prop("disabled", false).css("opacity", "1"); 610 $("#license-type").prop("disabled", false).css("opacity", "1"); 611 $("#number-of-users").prop("disabled", false).css("opacity", "1"); 612 $("#billed-annually-checkbox") 613 .prop("disabled", false) 614 .css("opacity", "1"); 615 $("#billed-monthly-checkbox") 616 .prop("disabled", false) 617 .css("opacity", "1"); 618 } 619 // WooCommerce Account 620 if ($("body").hasClass("woocommerce-account")) { 621 if ($("input#username").length > 0) { 622 $("input#username").removeAttr("placeholder"); 623 $("input#username").attr( 624 "placeholder", 625 "Username or email address" 626 ); 627 } 628 if ($("input#password").length > 0) { 629 $("input#password").removeAttr("placeholder"); 630 $("input#password").attr("placeholder", "Password"); 631 } 632 if ($("input#user_login").length > 0) { 633 $("input#user_login").removeAttr("placeholder"); 634 $("input#user_login").attr( 635 "placeholder", 636 "Username or email address" 637 ); 638 } 639 if ($("input#reg_username").length > 0) { 640 $("input#reg_username").removeAttr("placeholder"); 641 $("input#reg_username").attr("placeholder", "Username"); 642 } 643 if ($("input#reg_email").length > 0) { 644 $("input#reg_email").removeAttr("placeholder"); 645 $("input#reg_email").attr("placeholder", "Email address"); 646 } 647 if ($("input#reg_password").length > 0) { 648 $("input#reg_password").removeAttr("placeholder"); 649 $("input#reg_password").attr("placeholder", "Password"); 650 } 651 } 652 // WooCommerce Lost Password 653 if ($("body").hasClass("woocommerce-lost-password")) { 654 if ($("input#password_1").length > 0) { 655 $("input#password_1").removeAttr("placeholder"); 656 $("input#password_1").attr("placeholder", "New password"); 657 } 658 if ($("input#password_2").length > 0) { 659 $("input#password_2").removeAttr("placeholder"); 660 $("input#password_2").attr("placeholder", "Re-enter new password"); 661 } 662 } 663 // WooCommerce Account Address Edite 664 // Move email address fields and placeholder 665 if ($(".woocommerce-edit-address").length > 0) { 666 function edit_address_custom_placeholders() { 667 if ($("input#billing_postcode").length > 0) { 668 $("input#billing_postcode").removeAttr("placeholder"); 669 $("input#billing_postcode").attr("placeholder", "ZIP"); 670 } 671 if ($("input#billing_state").length > 0) { 672 $("input#billing_state").removeAttr("placeholder"); 673 $("input#billing_state").attr("placeholder", "State"); 674 } 675 setTimeout(function () { 676 if ($("p#billing_email_field").length > 0) { 677 $("p#billing_last_name_field").after( 678 $("p#billing_email_field").get(0) 679 ); 680 } 681 }, 1300); 682 } 683 edit_address_custom_placeholders(); 684 } 685 // Add Placeholder to VAT form 686 if ($(".woocommerce-account").length > 0) { 687 if ($("input#vat_number").length > 0) { 688 $("input#vat_number").removeAttr("placeholder"); 689 $("input#vat_number").attr("placeholder", "VAT Number (optional)"); 690 } 691 } 692 // Order details page 693 if ($("body").hasClass("woocommerce-view-order")) { 694 if ($("mark.order-status").length > 0) { 695 var order_status = $("mark.order-status") 696 .text() 697 .replace(" ", "-") 698 .toLowerCase() 699 .trim(); 700 $("mark.order-status").attr("id", "order-" + order_status); 701 } 702 if ( 703 $("h2.woocommerce-order-details__title").length > 0 && 704 $("#order-invoice-link").length > 0 705 ) { 706 $("h2.woocommerce-order-details__title").after( 707 $("#order-invoice-link").get(0) 708 ); 709 } 710 } 711 if ($("body").hasClass("woocommerce-account")) { 712 if (
713 $("td#subscription-download-links").length > 0 && 714 $("ul.wc-item-downloads").length > 0 715 ) { 716 $("td#subscription-download-links").empty(); 717 $("td#subscription-download-links").append( 718 $("ul.wc-item-downloads li a").get(0) 719 ); 720 $("ul.wc-item-downloads").remove(); 721 } 722 if ( 723 $("#view-license-code").length > 0 && 724 $("table.my_account_orders").length > 0 725 ) { 726 $("#view-license-code").attr( 727 "href", 728 $( 729 "table.my_account_orders tbody tr:last-of-type a.button.view" 730 ).attr("href") 731 ); 732 } 733 if ( 734 $("#subscription-cancel-pnl").length > 0 && 735 $("#subscription-cancel-btn").length > 0 736 ) { 737 $("#subscription-cancel-pnl").hide(); 738 $("#subscription-cancel-btn").css("cursor", "pointer"); 739 $("#subscription-cancel-btn").click(function () { 740 $("#subscription-cancel-pnl").slideToggle("slow"); 741 }); 742 } 743 if ( 744 $("#activation-instructions-pnl").length > 0 && 745 $("#activation-instructions-btn").length > 0 746 ) { 747 $("#activation-instructions-pnl").hide(); 748 $("#activation-instructions-btn").css("cursor", "pointer"); 749 $("#activation-instructions-btn").click(function () { 750 $("#activation-instructions-pnl").slideToggle("slow"); 751 }); 752 } 753 if ( 754 $("tr#pay-btn td").length > 0 && 755 $("td.order-actions .button.pay").length > 0 756 ) { 757 $("tr#pay-btn td").empty(); 758 $("tr#pay-btn td").append($("td.order-actions .button.pay").get(0)); 759 $("tr#pay-btn td .button.pay").text("PAY FOR THIS ORDER"); 760 } 761 } 762 // Add Placeholder to Account Details 763 if ($(".woocommerce-EditAccountForm").length > 0) { 764 if ($("input#account_first_name").length > 0) { 765 $("input#account_first_name").removeAttr("placeholder"); 766 $("input#account_first_name").attr("placeholder", "First name"); 767 } 768 if ($("input#account_last_name").length > 0) { 769 $("input#account_last_name").removeAttr("placeholder"); 770 $("input#account_last_name").attr("placeholder", "Last name"); 771 } 772 if ($("input#account_email").length > 0) { 773 $("input#account_email").removeAttr("placeholder"); 774 $("input#account_email").attr("placeholder", "email username"); 775 } 776 } 777 // Order received - Thank you page 778 if ( 779 $("body").hasClass("woocommerce-checkout") && 780 $("body").hasClass("woocommerce-order-received") 781 ) { 782 if ( 783 $( 784 ".woocommerce-order-details :not(.woocommerce-table).order_details" 785 ).length > 0 && 786 $("ul.wc-item-downloads").length > 0 787 ) { 788 $( 789 ".woocommerce-order-details :not(.woocommerce-table).order_details" 790 ).before($("ul.wc-item-downloads").get(0)); 791 } 792 if ( 793 $("#pdf-invoice-wrapper").length > 0 && 794 $(".woocommerce-table--order-details.shop_table.order_details") 795 .length > 0 796 ) { 797 $( 798 ".woocommerce-table--order-details.shop_table.order_details" 799 ).after($("#pdf-invoice-wrapper").get(0)); 800 } 801 if ($(".woocommerce-table.order_details").length > 0) { 802 $("th.product-name").empty(); 803 $("th.product-name").text("Plan"); 804 } 805 if ($("#pdf-invoice-wrapper + h2").length > 0) { 806 $("#pdf-invoice-wrapper + h2").empty(); 807 $("#pdf-invoice-wrapper + h2").text( 808 "YOUR LICENSE Codes and Download" 809 ); 810 } 811 if ($(".wc-item-downloads").length > 0) { 812 $(".wc-item-download-label").empty(); 813 $(".wc-item-download-label").text("Download"); 814 } 815 } 816 // Checkout 817 if ($("body").hasClass("woocommerce-checkout")) { 818 add_custom_placeholders(); 819 820 // shows the end user fields 821 // this was originally functioned using a check box 822 // but upgraded to the radio button options Me or Someone else 823 if ($("#billing_purchasing_for_else_field").length > 0) { 824 $('input[name="billing_purchasing_for_else"]').click(function () { 825 if ($('input[value="someoneElse"]').is(":checked")) { 826 $("#billing_end_user_company_field") 827 .delay(100) 828 .slideDown("slow"); 829 $("#billing_end_user_email_field") 830 .delay(100) 831 .slideDown("slow"); 832 $("#billing_end_user_name_field") 833 .delay(100) 834 .slideDown("slow"); 835 $("#billing_information_link_field") 836 .delay(100) 837 .slideDown("slow"); 838 } 839 840 if ($('input[value="me"]').is(":checked")) { 841 $("#billing_information_link_field") 842 .delay(100) 843 .slideUp("slow"); 844 $("#billing_end_user_name_field") 845 .delay(100) 846 .slideUp("slow"); 847 $("#billing_end_user_email_field") 848 .delay(100) 849 .slideUp("slow"); 850 $("#billing_end_user_company_field") 851 .delay(100) 852 .slideUp("slow"); 853 remove_predefined_field_values(); 854 } 855 }); 856 } 857 } 858 859 if ($("body").hasClass("woocommerce-order-pay")) { 860 if ($("input#username").length > 0) { 861 $("input#username").removeAttr("placeholder"); 862 $("input#username").attr( 863 "placeholder", 864 "Username or email address" 865 ); 866 } 867 if ($("input#password").length > 0) { 868 $("input#password").removeAttr("placeholder"); 869 $("input#password").attr("placeholder", "Password"); 870 } 871 } 872 // Making checkout product details table sticky 873 if ( 874 $("body").hasClass("woocommerce-checkout") && 875 $(".wcopc").length === 0 876 ) { 877 if ( 878 $("#payment.woocommerce-checkout-payment").length > 0 && 879 $("#order_review.woocommerce-checkout-review-order").length > 0 880 ) { 881 $("#order_review.woocommerce-checkout-review-order").after( 882 $("#payment.woocommerce-checkout-payment").get(0) 883 ); 884 $("#order_review.woocommerce-checkout-review-order").addClass( 885 "product-details-table" 886 ); 887 } 888 if ($("form.woocommerce-form-login").length > 0) { 889 $("form.woocommerce-form-login").addClass("form-wrapper"); 890 $("form.woocommerce-form-login") 891 .prev("div.woocommerce-info") 892 .addClass("form-wrapper"); 893 $(".form-wrapper").wrapAll( 894 '<div class="woocommerce-login-form-wrapper"></div>' 895 ); 896 $("form.woocommerce-form-login").removeClass("form-wrapper"); 897 $("form.woocommerce-form-login") 898 .prev("div.woocommerce-info") 899 .removeClass("form-wrapper"); 900 } 901 remove_predefined_field_values(); 902 } 903 // Select2 904 $("#selected-tier").select2(); 905 $("#license-type").select2(); 906 $(".gfield_select").select2(); 907 908 setTimeout(function () { 909 $("#stripe-card-expiry").attr("placeholder", "Expiry: MM / YY"); 910 }, 2500); 911 912 if ($(".create-account abbr img").length > 0) { 913 // $('.create-account abbr img').attr('src', 'https://www.scan2cad.com/wp-content/uploads/2014/08/icon-info.png'); 914 } 915}); 916 917// for copying license 918function copyText() { 919 const text = document.getElementById("license-key").innerText.trim(); 920 navigator.clipboard.writeText(text).then(() => { 921 const copiedSpan = document.getElementById("license-copied"); 922 copiedSpan.style.display = "inline"; 923 setTimeout(() => { 924 copiedSpan.style.display = "none"; 925 }, 1500); 926 }).catch(err => { 927 console.error("Failed to copy: ", err); 928 }); 929}
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.