1/** 2* 2007-2017 PrestaShop 3* 4* NOTICE OF LICENSE 5* 6* This source file is subject to the Academic Free License (AFL 3.0) 7* that is bundled with this package in the file LICENSE.txt. 8* It is also available through the world-wide-web at this URL: 9* http://opensource.org/licenses/afl-3.0.php 10* If you did not receive a copy of the license and are unable to 11* obtain it through the world-wide-web, please send an email 12* to [email protected] so we can send you a copy immediately. 13* 14* DISCLAIMER 15* 16* Do not edit or add to this file if you wish to upgrade PrestaShop to newer 17* versions in the future. If you wish to customize PrestaShop for your 18* needs please refer to http://www.prestashop.com for more information. 19* 20* @author PrestaShop SA <[email protected]> 21* @copyright 2007-2017 PrestaShop SA 22* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 23* International Registered Trademark & Property of PrestaShop SA 24* 25* Don't forget to prefix your containers with your own identifier 26* to avoid any conflicts with others containers. 27*/ 28 29var display_cashback = function() 30{ 31 $.ajax({ 32 type: 'GET', 33 dataType: 'json', 34 url: url_cashback, 35 success: function(data) 36 { 37 if(data.success) 38 { 39 $('.card.cart-summary').append(data.html); 40 } 41 }, 42 error: function(error) 43 { 44 console.log(error); 45 } 46 }); 47 48} 49 50$(function(){ 51 display_cashback(); 52 $('a.deploy_voucher_list').click(function(e){ 53 e.preventDefault(); 54 var form = $("#voucher_form"); 55 if(form.hasClass('hidden-xs-up')){ 56 form.removeClass('hidden-xs-up'); 57 $('a.deploy_voucher_list').find('i.material-icons').replaceWith('<i class="material-icons">expand_less</i>'); 58 }else{ 59 form.addClass('hidden-xs-up'); 60 $('a.deploy_voucher_list').find('i.material-icons').replaceWith('<i class="material-icons">expand_more</i>'); 61 } 62 }) 63 64 $("#convertCashBackForm").submit(function(e){ 65 return confirm(confirm_cashback); 66 }) 67 68 69 // customer form 70 function isValidZSPhone(p) { 71 // const regex = /^(?:(?:\+|00)33[\s.-]{0,3}(?:\(0\)[\s.-]{0,3})?|0)[6-7](?:(?:[\s.-]?\d{2}){4}|\d{2}(?:[\s.-]?\d{3}){2})$/gm; 72 const regex = /^\+?\d+$/ 73 var exec = regex.exec(p); 74 if(exec !== null) 75 return true 76 else 77 return false; 78 79 } 80 81 function isValidSponsorCode(sc) { 82 const regex = /^[A-Z0-9]{5,9}$/ 83 var exec = regex.exec(sc); 84 if(exec !== null) 85 return true 86 else 87 return false; 88 89 } 90 91 $(function () { 92 $("#customer-form").on("submit", function (e) { 93 var zs_phone = $("#zsphone").val(); 94 var checked = $("#zs_terms").is(":checked"); 95 var sponsor_code = $("#zs_sponsor_code").val(); 96 97 if (checked && zs_phone.length <= 0) { 98 alert(error_message); 99 e.preventDefault(); 100 return false; 101 } 102 if (zs_phone.length > 0) { 103 if (!isValidZSPhone(zs_phone)) { 104 alert(error_message); 105 e.preventDefault(); 106 return false; 107 } 108 109 if (!checked) { 110 alert(error_message); 111 e.preventDefault(); 112 return false; 113 } 114 } 115 if(sponsor_code?.length > 0) { 116 if (!isValidSponsorCode(sponsor_code)) { 117 alert(sponsor_error_message); 118 e.preventDefault(); 119 return false; 120 } 121 } 122 this.submit(); 123 return true; 124 }); 125 }); 126 127 $("#zsphone, #zs_terms, #zs_sponsor_code").on("input", function (e) { 128 var button = $("form#customer-form button.continue"); 129 if (button) { 130 button.removeClass("disabled"); 131 } 132 }); 133});
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.