1/* 2 * NOTICE OF LICENSE 3 * 4 * This file is licenced under the Software License Agreement. 5 * With the purchase or the installation of the software in your application 6 * you accept the licence agreement. 7 * 8 * You must not modify, adapt or create derivative works of this source code 9 * 10 * @author Frederic Moreau 11 * @copyright 2020 BeComWeb 12 * @license LICENSE.txt 13 */ 14 15$(document).ready(function(){ 16 prestashop.on('updateCart', function(event){ // change quantity, etc 17 updateAbfdAjaxBlocks('update_cart'); 18 } 19 ); 20 prestashop.on('changedCheckoutStep', function(){ // after changing step in checkout 21 updateAbfdAjaxBlocks('changed_step'); 22 }); 23 if (prestashop.page.page_name === 'checkout') { // display of checkout tunnel 24 updateAbfdAjaxBlocks('display_checkout'); 25 } 26}); 27 28function updateAbfdAjaxBlocks(action) { 29 if (typeof abfd_url == 'undefined') { 30 console.log('Cannot reach ABFD ajax controller !'); 31 return false; 32 } 33 var abfd_blocks = []; 34 // Get all blocks that are in hooks which are not reloaded after cart refresh (nav, shopping cart footer) 35 if (prestashop.page.page_name !== 'checkout') { 36 $('.abfd_ajax_block').each(function(index){ 37 abfd_blocks.push($(this).data('hook-name')); 38 }); 39 } 40 else { 41 $('.abfd_block').each(function(index){ 42 abfd_blocks.push($(this).data('hook-name')); 43 }); 44 } 45 if (abfd_blocks.length > 0) { 46 if (prestashop.page.page_name === 'checkout') { 47 var abdf_id_address_delivery = $('input[name="id_address_delivery"]:checked').val(); 48 var abfd_id_delivery_option = abdf_id_address_delivery ? $('input[name="delivery_option['+abdf_id_address_delivery+']"]:checked').val() : null; 49 } 50 if (action == 'update_cart' || (abdf_id_address_delivery || abfd_id_delivery_option)) { 51 request_data = { 52 'abfd_blocks' : abfd_blocks, 53 'iso_code' : prestashop.language.iso_code, 54 'static_token' : prestashop.static_token, 55 'id_address_delivery' : abdf_id_address_delivery, 56 'amount_display' : (prestashop.configuration.display_prices_tax_incl === true) ? 'tax_incl' : 'tax_excl', 57 'id_delivery_option' : abfd_id_delivery_option ? abfd_id_delivery_option.replace(",","") : null 58 }; 59 $.post(abfd_url, request_data).then(function(resp) { 60 var data = JSON.parse(resp); 61 if (data.error) { 62 console.log(data.error); 63 } 64 else { 65 if (data.blocks) { 66 $.each(data.blocks, function(hook_name, block_content) { 67 $('.abfd_block[data-hook-name="'+hook_name+'"]').replaceWith(block_content).show(0); 68 }); 69 } 70 } 71 }).fail(function(resp) { 72 console.log(resp.error); 73 }); 74 } 75 } 76}
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.