PageSourceSearch

https://www.powerstar.de/sportnahrung-shop/modules/userbalance/views/js/balance.js

js powerstar.de collected 2026-10-08 03:23:12 UTC 7,880 bytes, 204 lines download raw bytes

1/**
2 * 2007-2017 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    PrestaShop SA <[email protected]>
21 * @copyright 2012-2017 SeoSA
22 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
23 * International Registered Trademark & Property of PrestaShop SA
24 */
25document.addEventListener(
26    'DOMContentLoaded',
27    function () {
28        $.ajax({
29            type: 'POST',
30            url: '',
31            data: {
32                action: 'checkBalanceDiscount',
33            },
34            success: function (data) {
35                if (data === 'need_reload') {
36                    window.location.reload()
37                    console.log(data);
38                }
39            },
40        });
41    },
42    false
43);
44(function () {
45    if ($.fn.jquery >= '1.7.2')
46        $.fn.live = $.fn.on;
47
48    var UB = {};
49    window.UB = UB;
50    UB.updatePayments = function (success) {
51        var payment = $('[name="payment"]:checked');
52        var id_payment = payment.attr('id');
53        this.setLoading();
54        $.ajax({
55            url: document.location.href.replace(document.location.hash, ''),
56            type: 'POST',
57            dataType: 'html',
58            data: {
59                ajax: true,
60                action: 'loadPaymentMethods'
61            },
62            success: function (r) {
63                UB.clearLoading();
64                $('.list_payments').html(r);
65                $('#' + id_payment).click();
66                if (typeof success != 'undefined')
67                    success(id_payment);
68            }
69        });
70    };
71
72    UB.setLoading = function () {
73        this.clearLoading();
74        $('body').prepend('<div class="loading_stage">' +
75            '<div class="sk-fading-circle">' +
76            '<div class="sk-circle1 sk-circle"></div>' +
77            '<div class="sk-circle2 sk-circle"></div>' +
78            '<div class="sk-circle3 sk-circle"></div>' +
79            '<div class="sk-circle4 sk-circle"></div>' +
80            '<div class="sk-circle5 sk-circle"></div>' +
81            '<div class="sk-circle6 sk-circle"></div>' +
82            '<div class="sk-circle7 sk-circle"></div>' +
83            '<div class="sk-circle8 sk-circle"></div>' +
84            '<div class="sk-circle9 sk-circle"></div>' +
85            '<div class="sk-circle10 sk-circle"></div>' +
86            '<div class="sk-circle11 sk-circle"></div>' +
87            '<div class="sk-circle12 sk-circle"></div>' +
88            '</div>' +
89            '</div>');
90    };
91
92    UB.clearLoading = function () {
93        $('.loading_stage').remove();
94    };
95
96    $(function () {
97        $('.fillUpBalance').live('click', function () {
98            var self = $(this);
99            var payment = $('[name="payment"]:checked');
100            var id_payment = payment.attr('id');
101            if (!id_payment) {
102                $.notify('Please, select payment!', {
103                    type: 'danger',
104                    align: 'center',
105                    verticalAlign: 'middle'
106                });
107                return false;
108            }
109
110            var data = {
111                ajax: true,
112                action: 'fill_up_balance',
113                value: $('[name="value"]').val()
114            };
115            UB.setLoading();
116            self.attr('disabled', true);
117            $.ajax({
118                url: document.location.href.replace(document.location.hash, ''),
119                type: 'POST',
120                dataType: 'json',
121                data: data,
122                success: function (r) {
123                    UB.clearLoading();
124                    self.removeAttr('disabled');
125                    if (!r.hasError) {
126                        UB.updatePayments(function (id_payment) {
127                            var link = $('[data-payment="' + id_payment + '"]').find('a');
128                            if (link.length) {
129                                if (link.attr('href') &&
130                                    (link.attr('href').match('http://') != null || link.attr('href').match('https://') != null))
131                                    document.location.href = link.attr('href');
132                                else {
133                                    if (link.attr('href') &&
134                                        (link.attr('href').match('javascript:') != null)) {
135                                        var code = link.attr('href').replace('javascript:', '');
136                                        code = code.replace('%24', '$');
137                                        eval('function funcClick() {' + code + '}');
138                                        link.live('click', funcClick);
139                                    }
140                                    link.trigger('click');
141                                }
142                            } else {
143                                var form = $('[data-payment="' + id_payment + '"]').find('form');
144                                if (form.length) {
145                                    form.submit();
146                                }
147                            }
148                        });
149                    }
150                    else
151                        $.notify(r.errors.join('\n'), {
152                            type: 'danger',
153                            align: 'center',
154                            verticalAlign: 'middle'
155                        });
156                }
157            });
158        });
159
160        $('.withdrawal').live('click', function () {
161            var self = $(this);
162            UB.setLoading();
163            self.attr('disabled', true);
164            var data = {
165                ajax: true,
166                action: 'withdrawal',
167                value: $('[name="withdrawal"]').val(),
168                message: $('[name="message"]').val(),
169                as_template: $('[name="as_template"]').is(':checked') ? 1 : 0
170            };
171            $.ajax({
172                url: document.location.href.replace(document.location.hash, ''),
173                type: 'POST',
174                dataType: 'json',
175                data: data,
176                success: function (r) {
177                    UB.clearLoading();
178                    self.removeAttr('disabled');
179                    if (!r.hasError) {
180                        $.notify(r.message, {
181                            type: 'success',
182                            align: 'center',
183                            verticalAlign: 'middle'
184                        });
185                        setTimeout(function () {
186                            document.location.reload();
187                        }, 2000);
188                    }
189                    else
190                        $.notify(r.errors.join('\n'), {
191                            type: 'danger',
192                            align: 'center',
193                            verticalAlign: 'middle'
194                        });
195                }
196            });
197        });
198
199        if ($('.tabContainer').length)
200            $('.tabContainer').tabContainer();
201    });
202})();
203
204

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.