1/** 2 * Copyright © Lyra Network and contributors. 3 * This file is part of Sogecommerce plugin for WooCommerce. See COPYING.md for license details. 4 * 5 * @author Lyra Network (https://www.lyra.com/) 6 * @author Geoffrey Crofte, Alsacréations (https://www.alsacreations.fr/) 7 * @copyright Lyra Network and contributors 8 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL v2) 9 */ 10 11/** 12 * JS tools. 13 */ 14var sogecommerce_get_selected_option = function(elementNames) { 15 for (const name of elementNames) { 16 let element = 'input[name="'+ name + '"]'; 17 let option = jQuery(element); 18 19 if (option.length == 0) { 20 continue; 21 } else if (option.length > 1) { 22 option = jQuery(element + ':checked'); 23 } 24 25 document.cookie = name + '=' + option.val() + '; path=/'; 26 } 27}; 28 29var sogecommercestd_get_card = function () { 30 sogecommerce_get_selected_option(['sogecommercestd_card_type']); 31}; 32 33var sogecommerceUpdatePaymentBlock = function (useIdentifier, methodId) { 34 jQuery("ul." + methodId + "-view-top li.block").hide(); 35 jQuery("ul." + methodId + "-view-bottom li.block").hide(); 36 37 var blockName = useIdentifier ? "id" : "cc"; 38 jQuery("li." + methodId + "-" + blockName + "-block").show(); 39 40 if ((methodId !== "sogecommercesepa") && (typeof window.FORM_TOKEN != 'undefined')) { 41 sogecommerceUpdateFormToken(useIdentifier); 42 } 43 44 jQuery("#sogecommerce_use_identifier").val(useIdentifier); 45}; 46 47var sogecommerceWaitForElement = function (selector) { 48 return new Promise(resolve => { 49 if (document.querySelector(selector)) { 50 return resolve(document.querySelector(selector)); 51 } 52 53 const observer = new MutationObserver(mutations => { 54 if (document.querySelector(selector)) { 55 observer.disconnect(); 56 resolve(document.querySelector(selector)); 57 } 58 }); 59 60 observer.observe(document.body, { 61 childList: true, 62 subtree: true 63 }); 64 }); 65}
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.