1/** 2* 2007-2016 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 Snegurka <[email protected]> 21* @link http://web-esse.ru/ 22* @copyright 2007-2023 Snegurka 23* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 24* International Registered Trademark & Property of PrestaShop SA 25*/ 26 27jQuery(document).ready(function ($) { 28 29 const togleTab = (evt) => { 30 evt.preventDefault(); 31 const parentBlock = document.querySelector('#referralbyphone-program-content'); 32 if (!parentBlock) return; 33 parentBlock.querySelectorAll('.tab-pane').forEach((el) => el.classList.remove('active')); 34 parentBlock.querySelectorAll('.ws-nav-link').forEach((el) => el.classList.remove('active')); 35 const el = evt.target; 36 el.classList.add('active'); 37 const { selector } = el.dataset; 38 39 const activeEl = parentBlock.querySelector(`#${selector}`); 40 if (activeEl) { 41 activeEl.classList.add('active'); 42 } 43 } 44 45 document.querySelectorAll('.ws-nav-link').forEach((item) => { 46 item.addEventListener('click', togleTab); 47 }); 48 49 $('#referral_rules_link').fancybox({ 50 'hideOnContentClick': false 51 }); 52 53 $('#ref_link a').fancybox(); 54 55 $('.block-promo .promo-input+button').click(function (e) { 56 e.preventDefault(); 57 var ws_voucher = $(".promo-input").val(); 58 var regex = new RegExp('INV'); 59 var results = regex.exec(ws_voucher); 60 if (results) { 61 if (id_customer > 0) { 62 $.ajax({
63 url: referral_controller_url, 64 data: { 65 ws_voucher: ws_voucher, 66 id_customer: id_customer, 67 action: 'CartRuleValidate' 68 }, 69 type: 'POST', 70 headers: { "cache-control": "no-cache" }, 71 dataType: "json", 72 success: function (data) { 73 $('.block-promo .promo-input+button').parent().submit(); 74 if (data.result) { 75 $(".js-error-text").text('Coupon can only be used for the first order.'); 76 $(".js-error").show(); 77 } else if (data.is_sponsor) { 78 $(".js-error-text").text('Coupon can only be used for your friends.'); 79 $(".js-error").show(); 80 } else { 81 $(this).parent().submit(); 82 } 83 } 84 }); 85 } else { 86 $(".js-error-text").text('This coupon cannot be used by the guest.'); 87 $(".js-error").show(); 88 } 89 90 } else { 91 $(this).parent().submit(); 92 } 93 94 }); 95 96});
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.