PageSourceSearch

https://www.madnesslive.es/modules/redsys/views/js/front17.js?v=19

js madnesslive.es collected 2026-09-24 20:36:39 UTC 13,081 bytes, 197 lines download raw bytes

1/**
2 * ISC License
3 *
4 * Copyright (c) 2026 idnovate
5 * idnovate is a Registered Trademark & Property of idnovate.com, innovación y desarrollo SCP
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 *
19 * @author    idnovate
20 * @copyright 2026 idnovate
21 * @license   https://www.isc.org/licenses/ https://opensource.org/licenses/ISC ISC License
22 */
23
24function updateTotalsWithFee() {
25    var js_checkout_summary = '';
26    if (typeof $('#js-checkout-summary') !== 'undefined') {
27        var js_checkout_summary = '#js-checkout-summary ';
28    }
29    var total_ori_html = $(js_checkout_summary + '.cart-summary-line.cart-total').last().html();
30    if (typeof $('.cart-summary-line.cart-total_2').last().html() === 'undefined') {
31        if ($(js_checkout_summary + '.cart-summary-totals div').length == 2) {
32            if($(js_checkout_summary + '.cart-summary-totals div').last().prev().find('span.value').text() != '') {
33                var total_ori_without_taxes_html = $(js_checkout_summary + '.cart-summary-totals div').last().prev().html();
34            }
35        } else {
36            var total_ori_without_taxes_html = $(js_checkout_summary + '.cart-summary-totals .cart-summary-line.cart-total').last().prevAll('.cart-summary-line.cart-total').html();
37        }
38
39    } else {
40        var total_ori_without_taxes_html = $('.cart-summary-line.cart-total_2').last().html();
41    }
42    if (typeof $('.cart-summary-line.cart-total').next().html() === 'undefined') {
43        var taxes_ori_html = $(js_checkout_summary + '.cart-summary-line.cart-total').prev().html();
44        if ($('#cart-subtotal-tax')) {
45            var taxes_ori_html = $('#cart-subtotal-tax').find('span.value').html();
46        }
47    } else {
48        var taxes_ori_html = $(js_checkout_summary + '.cart-summary-line.cart-total').next().html();
49    }
50    $("input[name='payment-option']").on('click', function() {
51        var redsys_id = $('#pay-with-' + this.id + '-form').find('input[name=redsys_id]').val();
52        if (redsys_id != null && typeof redsys_id !== 'undefined') {
53            var conditions_checkbox = $("input[name='cgv']");
54            if ($("input[name='cgv']").size() == 0) {
55                conditions_checkbox = $("input[name='conditions_to_approve[terms-and-conditions]']");
56            }
57            if (conditions_checkbox.size() == 0 || $("input[name='conditions_to_approve[terms-and-conditions]']").is(':checked')) {
58                //document.querySelector('#payment-confirmation article').style.display = 'none';
59                document.querySelector('#payment-confirmation button').removeAttribute('disabled');
60            }
61        }
62        if (redsys_id != null && typeof redsys_id !== 'undefined') {
63            $('#cart-subtotal-redsys').remove();
64            $('<div class="cart-summary-line cart-summary-subtotals" id="cart-subtotal-redsys">' +
65                '<span class="label cart-summary-redsys-label">' + $("input[name='redsys_text_" + redsys_id + "']").val() + '</span>' +
66                '<span class="value pull-right">' + $("input[name='redsys_fee_with_taxes_" + redsys_id + "']").val() + '</span>' +
67                '</div>').insertAfter(js_checkout_summary + '#cart-subtotal-shipping');
68
69            if (typeof $('.cart-summary-line.cart-total_2').last().html() === 'undefined') {
70                $(js_checkout_summary + '.cart-summary-totals .cart-summary-line.cart-total').last().prevAll('.cart-summary-line.cart-total').find('span.value').html($("input[name='redsys_order_total_with_taxes_" + redsys_i
70d + "']").val());
71            } else {
72                $('.cart-summary-line.cart-total_2').find('span.value').html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
73            }
74            if ($("input[name='redsys_price_display_method_cartsummary_" + redsys_id + "']").val() == '1') {
75                $(js_checkout_summary + '.cart-summary-line.cart-total').last().find('span.value').html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
76                $(js_checkout_summary + '.cart-summary-line.cart-total').last().find('strong.value').html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
77            } else {
78                if ($(js_checkout_summary + '.cart-summary-totals div').length == 2) {
79                    if($(js_checkout_summary + '.cart-summary-totals div').last().prev().find('span.value').text() != '') {
80                        $(js_checkout_summary + '.cart-summary-totals div').last().prev().find('span.value').html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
81                    }
82                    if($(js_checkout_summary + '.cart-summary-totals div').last().find('span.value').text() != '') {
83                        $(js_checkout_summary + '.cart-summary-totals div').last().find('span.value').html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
84                    }
85                } else {
86                    $(js_checkout_summary + '.cart-summary-line.cart-total').last().find('span.value').html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
87                    $(js_checkout_summary + '.cart-summary-line.cart-total').last().find('strong.value').html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
88                }
89            }
90        } else if ($(this).attr('data-module-name') != 'redsys' && $(this).is(':checked')) {
91                /*
92                $('#' + this.id + '-additional-information').css('display', 'none');
93                */
94                $('#cart-subtotal-redsys').remove();
95                /*$('#cart-subtotalsum-redsys').remove();*/
96                $(js_checkout_summary + '.cart-summary-line.cart-total').last().html(total_ori_html);
97                if (typeof $(js_checkout_summary + '.cart-summary-line.cart-total_2').last().html() === 'undefined') {
98                    if ($(js_checkout_summary + '.cart-summary-totals div').length == 2) {
99                        $(js_checkout_summary + '.cart-summary-totals div').last().prev().html(total_ori_without_taxes_html);
100                    } else {
101                        $(js_checkout_summary + '.cart-summary-totals .cart-summary-line.cart-total').last().prevAll('.cart-summary-line.cart-total').html(total_ori_without_taxes_html);
102                    }
103                } else {
104                    $(js_checkout_summary + '.cart-summary-line.cart-total_2').first().html(total_ori_without_taxes_html);
105                }
106                if (typeof $(js_checkout_summary + '.cart-summary-line.cart-total').next().html() === 'undefined') {
107                    $(js_checkout_summary + '.cart-summary-line.cart-total').prev().html(taxes_ori_html);
108                    if ($('#cart-subtotal-tax').size() > 0) {
109                        $('#cart-subtotal-tax').find('span.value').html(taxes_ori_html);
110                    }
111                } else {
112                    $(js_checkout_summary + '.cart-summary-line.cart-total').next().html(taxes_ori_html);
113                }
114        } else {
115            /*
116            $('#' + this.id + '-additional-information').css('display', 'none');
117            */
118            $(js_checkout_summary + '#cart-subtotal-redsys').remove();
119            /*$('#cart-subtotalsum-redsys').remove();*/
120            //$(js_checkout_summary + '.cart-summary-line.cart-total').first().html(total_ori_html);
121            $(js_checkout_summary + '.cart-summary-line.cart-total_2').first().html(total_ori_without_taxes_html);
122            if ($(js_checkout_summary + '.cart-summary-totals div').length == 2) {
123                $(js_checkout_summary + '.cart-summary-totals div').last().prev().html(total_ori_without_taxes_html);
124            }
125            if (typeof $(js_checkout_summary + '.cart-summary-line.cart-total').next().html() === 'undefined') {
126                $(js_checkout_summary + '.cart-summary-line.cart-total').prev().html(taxes_ori_html);
127            } else {
128                $(js_checkout_summary + '.cart-summary-line.cart-total').next().html(taxes_ori_html);
129            }
130            $(js_checkout_summary + '.cart-summary-line.cart-total').last().html(total_ori_html);
131        }
132    });
133}
134
135function updateOrderSummaryWithFee() {
136    var ps176 = false;
137    var ps1761 = false;
138    if (typeof $('.order-confirmation-table .order-confirmation-total').html() !== 'undefined') {
139        ps1761 = true;
140        var table_totals = $('.order-confirmation-table div');
141        var total_ori_html = table_totals.last().html();
142        var taxes_ori_html = table_totals.last().prev().prev().html();
143    } else if (typeof $('.order-confirmation-table .taxes').html() === 'undefined') {
144        var total_ori_html = $('.order-confirmation-table table tr td').last().html();
145        var taxes_ori_html = $('.order-confirmation-table table tr').last().prev().last().html();
146    } else {
147        ps176 = true;
148        var total_ori_html = $('.order-confirmation-table table tr').last().prev().last().html();
149        var taxes_ori_html = $('.order-confirmation-table .taxes').html();
150    }
151    $("input[name='payment-option']").click(function() {
152        var redsys_id = $('#pay-with-' + this.id + '-form').find('input[name=redsys_id]').val();
153        if (redsys_id != null) {
154            $('tr.cart-order-summary-redsys').remove();
155                $('<tr class="cart-order-summary-redsys">' +
156                    '<td>' + $("input[name='redsys_text_" + redsys_id + "']").val() + '</td>' +
157                    '<td>' + $("input[name='redsys_fee_with_taxes_" + redsys_id + "']").val() + '</td>' +
158                    '</tr>').insertBefore($('.order-confirmation-table table tr').last().prev());
159            if (ps176) {
160                $('.order-confirmation-table table tr').last().prev().find('td').last().html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
161                if ($("input[name='redsys_tax_enabled_" + redsys_id + "']").val() == '1' && $("input[name='redsys_tax_display_" + redsys_id + "']").val() == '1') {
162                    $('.order-confirmation-table .taxes').find('td span').last().html($("input[name='redsys_taxes_" + redsys_id + "']").val());
163                }
164            } else if (ps1761) {
165                $('.order-confirmation-table div span').last().html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
166                if ($("input[name='redsys_tax_enabled_" + redsys_id + "']").val() == '1' && $("input[name='redsys_tax_display_" + redsys_id + "']").val() == '1') {
167                    table_totals.last().prev().prev().html($("input[name='redsys_taxes_" + redsys_id + "']").val());
168                }
169            } else {
170                $('.order-confirmation-table table tr td').last().html($("input[name='redsys_order_total_with_taxes_" + redsys_id + "']").val());
171                if ($("input[name='redsys_tax_enabled_" + redsys_id + "']").val() == '1' && $("input[name='redsys_tax_display_" + redsys_id + "']").val() == '1') {
172                    $('.order-confirmation-table table tr').last().prev().find('td').last().html($("input[name='redsys_taxes_" + redsys_id + "']").val());
173                }
174            }
175        } else {
176            $('tr.cart-order-summary-redsys, div.cart-order-summary-redsys').remove();
177            if (ps176) {
178                $('.order-confirmation-table table tr').last().prev().last().html(total_ori_html);
179                $('.order-confirmation-table .taxes').html(taxes_ori_html);
180            } else if (ps1761) {
181                table_totals.last().html(total_ori_html);
182                table_totals.last().prev().prev().html(taxes_ori_html);
183            } else {
184                $('.order-confirmation-table table tr td').last().html(total_ori_html);
185                $('.order-confirmation-table table tr').last().prev().last().html(taxes_ori_html);
186            }
187        }
188    });
189}
190
191$(document).ready(function() {
192    updateTotalsWithFee();
193    updateOrderSummaryWithFee();
194    if ($('input[data-module-name=redsys]:checked').attr('checked') === 'checked') {
195        $('input[data-module-name=redsys]').click();
196    }
197});

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.