1/** 2 * Copyright 2022 LÃNEA GRÃFICA E.C.E S.L. 3 * 4 * @author LÃnea Gráfica E.C.E. S.L. 5 * @copyright Lineagrafica.es - LÃnea Gráfica E.C.E. S.L. all rights reserved. 6 * @license https://www.apache.org/licenses/LICENSE-2.0 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * https://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21var lggoogleanalytics = {}; 22 23window.addEventListener('load',function() { 24 lggoogleanalytics = { 25 response: null, 26 27 pcommon: { 28 'ajax': 1, 29 // 'module_name': 'lggoogleanalytics', 30 // 'configure': 'lggoogleanalytics', 31 'token': lggoogleanalytics_token, 32 'rand': new Date().getTime() 33 }, 34 35 ajaxCall: function (params, callback) { 36 if (typeof params.data != 'undefined') { 37 var contentType = false;
38 var processData = false; 39 var data = params.data; 40 delete params.data; 41 Object.assign(params, this.pcommon); 42 $.each(params, function(index, value) { 43 data.append(index, value); 44 }); 45 } else { 46 var contentType = 'application/x-www-form-urlencoded; charset=UTF-8'; 47 var processData = true; 48 var data = {}; 49 Object.assign(data, this.pcommon, params); 50 } 51 return $.ajax({ 52 'url': lggoogleanalytics_link, 53 'method': 'post', 54 'dataType': 'json', 55 'contentType': contentType, 56 'processData': processData, 57 'cache': false, 58 'data': data, 59 'success': function (data) { 60 if (typeof callback != 'undefined') { 61 eval(callback + '(params, data)'); 62 } 63 }, 64 'error': function (data) { 65 console.log(data) 66 //alert("leer error"); 67 } 68 }); 69 }, 70 addToCart(params, data) { 71 if (typeof data.value != 'undefined') { 72 gtag('event', 'add_to_cart', data); 73 } 74 }, 75 }; 76}); 77 78$( document ).ajaxComplete(function( event, xhr, settings ) { 79 if (typeof settings.data !== 'undefined' && ( 80 (settings.data.search('add-to-cart') > -1 || settings.data.search('add') > -1) || 81 ( 82 settings.data.search('controller=cart') > -1 && 83 settings.data.search('id_product=') > -1 84 )) 85 && settings.data.search('getProductPopupAdded') == -1 86 ) { 87 var id_product = 0; 88 var id_product_attribute = 0; 89 var regex_p = /[&|?]?id_product=([0-9]+)/gm 90 var match_p = regex_p.exec(settings.data); 91 if (match_p != null && typeof match_p[1] != 'undefined') { 92 id_product = match_p[1]; 93 } 94 var regex_pa = /[&|?]?id_product_attribute|ipa=([0-9]+)/gm 95 var match_pa = regex_pa.exec(settings.data); 96 if (match_pa != null && typeof match_pa[1] != 'undefined') { 97 id_product_attribute = match_pa[1]; 98 } 99 if ($('input[name="qty"]').length) { 100 var quantity = $('input[name="qty"]').val(); 101 } else { 102 var quantity = 1; 103 } 104 if (id_product > 0) { 105 var params = { 106 'action': 'getProduct', 107 'id_product': id_product, 108 'id_product_attribute': id_product_attribute, 109 'quantity': quantity 110 }; 111 //console.log('lggoogleanalytics.addToCart'); 112 lggoogleanalytics.ajaxCall(params, 'lggoogleanalytics.addToCart'); 113 } 114 } 115});
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.