PageSourceSearch

https://megadecha.pl/themes/megadecha8/js/product.js

js megadecha.pl collected 2026-10-08 06:07:11 UTC 8,503 bytes, 196 lines download raw bytes

1$(document).ready(function(){
2
3    // CHECK CZY SĄ CECHY MAGAZYNOWE
4    
5    function options_lenght() {
6        
7        $('#product .content .shop_opt').each(function(){
8            var content = $(this).text().trim();
9            if (content === '') {
10                $(this).remove();
11            }
12            else {
13                $(this).show();
14            }
15        });
16        
17        $('#comment-submit').on('click', function() {
18            
19            var formData = $('#add-review-div').find('input,textarea,select').serialize();
20            var isValid = true;
21            $('#add-review-div input,textarea,select').filter('[required]:visible').each(function() {
22                if($(this).attr('id') == 'descriptionTextarea' || $(this).attr('id') == 'inputName' ) {
23                    if($(this).val().length < 3) {
24                        isValid = false;
25                    }
26                }
27                if(!$(this).val()) {
28                    isValid = false;
29                }
30            });
31            if(isValid) {
32                $.ajax({
33                    type: 'POST',
34                    url: $(this).data('comment-url'),
35                    data: formData,
36                    success: function (msg) {
37                        alert(msg);
38                    },
39                });
40            } else {
41                alert(__('Uzupełnij wymagane pola zachowując minimalna ilośc znaków'));
42            }
43
44        });
45        
46    }
47    
48    options_lenght();
49    
50    // /CHECK CZY SĄ CECHY MAGAZYNOWE
51
52});
53
54
55function change_prices() {
56    var tmp_price_add = 0;
57    var tmp_price_set = 0;
58    var number_old = 0;
59    price = parseFloat(price);
60    prom_price = parseFloat(prom_price);
61
62    jQuery('select.show_product_options option:selected').each(function () {
63        str = jQuery(this).html().replace(/\s|&nbsp;/g, '').match(/\(.*\)/g) + '';
64        atr = jQuery(this).attr('old');
65
66        if (str == 'null')
67            return null;
68		
69        var strSplit = str.split("(");
70        strSplit = strSplit[ strSplit.length - 1 ];
71        str = strSplit.match(/\d+\.?\d*/g) + '';
72		
73		is_add = strSplit.search(/\+/);
74        is_rem = strSplit.search(/\-/);
75
76        if (is_add == -1 && !atr )
77            return null;
78
79        number = parseFloat(str.replace(/,/g, '.'));
80        if (atr)
81            number_old = parseFloat(atr.replace(/,/g, '.'));
82        if (number != 0) {
83            if (is_add > -1)
84                tmp_price_add += number;
85            else if (is_rem > -1)
86                tmp_price_add -= number;
87            else
88                tmp_price_set = number;
89        } else {
90            return null;
91        }
92    });
93
94    //jeżeli ustawiono cene w cechach powiązanych
95    if (tmp_price_set > 0) {
96        if (number_old > 0) {
97            vat_value = ((show_product_tax * (number_old)) / (show_product_tax + 100)).toFixed(2);
98            netto = (number_old - vat_value);
99            netto = parseFloat(netto.toFixed(2));
100
101            jQuery('.p-price .label').html('Stara cena'); //cena detaliczna
102            jQuery('.p-price .value').html((number_old).toString().replace(/\./g, ','));
103            jQuery('#price_net').html(netto.toString().replace(/\./g, ','));
104            jQuery('#price_formated').html((number_old).number_format());
105            jQuery('#price_formated_net').html(netto.number_format()+' '+__('netto'));
106
107            vat_value = ((show_product_tax * (tmp_price_set + tmp_price_add)) / (show_product_tax + 100)).toFixed(2);
108            netto = (tmp_price_set + tmp_price_add - vat_value);
109            netto = parseFloat(netto.toFixed(2));
110
111            jQuery('.n-price .label').html('Cena'); //cena dla Ciebie
112            jQuery('.n-price .value').html((tmp_price_set + tmp_price_add).toString().replace(/\./g, ','));
113            jQuery('#prom_price_net').html(netto.toString().replace(/\./g, ','));
114            jQuery('#prom_price_formated').html((tmp_price_set + tmp_price_add).number_format()).addClass('text-red');
115            jQuery('#prom_price_formated_net').html(netto.number_format()+' '+__('netto'));
116
117            discount = (Math.round((1 - (tmp_price_set / number_old)) * 100));
118            difference = (number_old - tmp_price_set);
119            difference = parseFloat(difference.toFixed(2));
120
121            jQuery('#prom_discount_label').html(''); //oszczędzasz
122            jQuery('#prom_discount_discount').html(discount + '%');
123            jQuery('#prom_discount_formated').html('(' + difference.number_format() + ')');
124        } else {
125            jQuery('.p-price .label').html('');
126            jQuery('.p-price .value').html('');
127            jQuery('#price_net').html('');
128            jQuery('#price_formated').html('');
129            jQuery('#price_formated_net').html('');
130
131            vat_value = ((show_product_tax * (tmp_price_set + tmp_price_add)) / (show_product_tax + 100)).toFixed(2);
132            netto = (tmp_price_set + tmp_price_add - vat_value);
133            netto = parseFloat(netto.toFixed(2));
134
135            jQuery('.n-price .label').html('cena');
136            jQuery('.n-price .value').html((tmp_price_set + tmp_price_add).toString().replace(/\./g, ','));
137            jQuery('#prom_price_net').html(netto.toString().replace(/\./g, ','));
138            jQuery('#prom_price_formated').html((tmp_price_set + tmp_price_add).number_format()).removeClass('text-red');
139            jQuery('#prom_price_formated_net').html(netto.number_format()+' '+__('netto'));
140
141            jQuery('#prom_discount_label').html('');
142            jQuery('#prom_discount_discount').html('');
143            jQuery('#prom_discount_formated').html('');
144        }
145    } else if (tmp_price_set == 0) {
146        if (prom_price > 0) {
147            vat_value = ((show_product_tax * (price)) / (show_product_tax + 100)).toFixed(2);
148            netto = (price - vat_value);
149            netto = parseFloat(netto.toFixed(2));
150
151            jQuery('.p-price .label').html('Stara cena'); //cena detaliczna
152            jQuery('.p-price .value').html((price).toString().replace(/\./g, ','));
153            jQuery('#price_net').html(netto.toString().replace(/\./g, ','));
154            jQuery('#price_formated').html((price).number_format());
155            jQuery('#price_formated_net').html(netto.number_format()+' '+__('netto'));
156
157            vat_value = ((show_product_tax * (prom_price + tmp_price_add)) / (show_product_tax + 100)).toFixed(2);
158            netto = (prom_price + tmp_price_add - vat_value);
159            netto = parseFloat(netto.toFixed(2));
160
161            jQuery('.n-price .label').html('Cena'); //cena dla Ciebie
162            jQuery('.n-price .value').html((prom_price + tmp_price_add).toString().replace(/\./g, ','));
163            jQuery('#prom_price_net').html(netto.toString().replace(/\./g, ','));
164            jQuery('#prom_price_formated').html((prom_price + tmp_price_add).number_format()).addClass('text-red');
165            jQuery('#prom_price_formated_net').html(netto.number_format()+' '+__('netto'));
166
167            discount = (Math.round((1 - (prom_price / price)) * 100));
168            difference = (price - prom_price);
169            difference = parseFloat(difference.toFixed(2));
170
171            jQuery('#prom_discount_label').html(''); //oszczędzasz
172            jQuery('#prom_discount_discount').html(discount + '%');
173            jQuery('#prom_discount_formated').html('(' + difference.number_format() + ')');
174        } else {
175            jQuery('.p-price .label').html('');
176            jQuery('.p-price .value').html('');
177            jQuery('#price_net').html('');
178            jQuery('#price_formated').html('');
179            jQuery('#price_formated_net').html('');
180
181            vat_value = ((show_product_tax * (price + tmp_price_add)) / (show_product_tax + 100)).toFixed(2);
182            netto = (price + tmp_price_add - vat_value);
183            netto = parseFloat(netto.toFixed(2));
184
185            jQuery('.n-price .label').html('Cena');
186            jQuery('.n-price .value').html((price + tmp_price_add).toString().replace(/\./g, ','));
187            jQuery('#prom_price_net').html(netto.toString().replace(/\./g, ','));
188            jQuery('#prom_price_formated').html((price + tmp_price_add).number_format()).removeClass('text-red');
189            jQuery('#prom_price_formated_net').html(netto.number_format()+' '+__('netto'));
190
191            jQuery('#prom_discount_label').html('');
192            jQuery('#prom_discount_discount').html('');
193            jQuery('#prom_discount_formated').html('');
194        }
195    }
196}

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.