PageSourceSearch

https://ehurtowniaszczecin.eu/skins/user/rwd_shoper_6/js/user.js?sci=960

js ehurtowniaszczecin.eu collected 2026-09-27 13:54:47 UTC 18,956 bytes, 570 lines download raw bytes

1let lock_clients_in_basket = [
2    {
3        'client_ids': [171, 172],
4        'lang': {
5            'pl_PL': {
6                'basket_error': 'Szanowny Kliencie, Twój koszyk został tymczasowo zablokowany ze względu na <strong>nieopłacone faktury, których termin płatności już upłynął.</strong> <br>Aby przywrócić możliwość robienia zakupów, prosimy o uregulowanie zaległości. <br>Jeśli płatność została już wykonana, prosimy o wysłanie potwierdzenia.',
7            },
8        },
9    },
10    {
11		'client_ids': [99999],
12        'lang': {
13            'pl_PL': {
14                'basket_error': 'Panie Janku,<br> proszę opłacić zaległą fakturę',
15            },
16        },
17    },
18];
19
20(function () {
21  Shop.AjaxBasket.include({
22    options: {
23      form_selector:
24        ".basket form[method=post][action], form.basket[method=post][action]",
25      fullprod_selector: "#box_productfull",
26      container_id: "ajaxbasket",
27      loyaltyexchange_class: "loyaltyexchange",
28      basket_header_class: "header .basket .countlabel b",
29      basket_quantities: [
30        "header .basket .countlabel b.count span",
31        "#box_basket .innerbox p.products em",
32      ],
33      basket_sums: [
34        "header .basket-contain .basket-price strong.price-products",
35      ],
36      basket_sums_discount: [
37        "#box_basket .innerbox p.sum em",
38        "header .basket .countlabel b.sum",
39        "header .basket-contain .basket-price strong.price-total",
40      ],
41      insert_px1: true,
42      container: null,
43      callbacks: {
44        postAdd: null,
45      },
46    },
47    modal: null,
48    json: null,
49    mask: null,
50    event: null,
51    div: null,
52    form: null,
53    initialize: function (options) {
54      var self;
55      this.constructor.setOptions(options);
56      if (this.options.container === null) {
57        this.options.container = $("<div />");
58        this.options.container
59          .attr("id", this.options.container_id)
60          .addClass("none");
61        this.options.container.appendTo($("body"));
62      }
63      self = this;
64      this.parent.addEvent("cart:add", function (ev, evForm, options, $form) {
65        var fp;
66        if (!$form.hasClass(self.options.loyaltyexchange_class)) {
67          fp = $form.parents(self.options.fullprod_selector);
68          if (fp.length <= 0) {
69            options.preventSubmit = true;
70            self.wrapform($form[0], evForm);
71          }
72        }
73      });
74    },
75    wrapform: function (form, e) {
76      var that = this,
77        formAnswer = null,
78        iframe = null,
79        ajaxBasketHandler = null,
80        fileInput;
81      fileInput = $(form).find('input[type="file"]');
82      if (fileInput.length > 0) {
83        if (fileInput[0].files.length > 0) {
84          $("#box_productfull").addClass("loading");
85        }
86        iframe = $("<iframe />", {
87          name: "iframeUpload",
88          css: {
89            display: "none",
90          },
91          src: "about:blank",
92          id: "iframeUpload",
93        }).appendTo(document.body);
94        iframe = iframe[0];
95        window.frames["iframeUpload"].name = "iframeUpload";
96        ajaxBasketHandler = function () {
97          $("#box_productfull").removeClass("loading");
98          if (iframe.detachEvent) {
99            iframe.detachEvent("onload", ajaxBasketHandler);
100          } else {
101            iframe.removeEventListener("load", ajaxBasketHandler, false);
102          }
103          if (iframe.contentDocument) {
104            formAnswer = iframe.contentDocument.body.innerHTML;
105          } else if (iframe.contentWindow) {
106            formAnswer = iframe.contentWindow.document.body.innerHTML;
107          } else if (iframe.document) {
108            formAnswer = iframe.document.body.innerHTML;
109          }
110          if (formAnswer) {
111            $.ajax({
112              url: $(form).attr("action"),
113              method: "get",
114              headers: {
115                "Content-Type": "multipart/form-data",
116              },
117            })
118              .error(function () {
119                that.failure();
120              })
121              .success(function (json) {
122                that.display(json);
123              });
124          } else {
125            that.failure();
126          }
127        };
128        if (iframe.addEventListener) {
129          iframe.addEventListener("load", ajaxBasketHandler, true);
130        }
131        if (iframe.attachEvent) {
132          iframe.attachEvent("onload", ajaxBasketHandler);
133        }
134        form.setAttribute("target", "iframeUpload");
135        form.submit();
136      } else {
137        this.parent.fireEvent("cart:preadd:ajax", form);
138        if (!form.prevent) {
139          this.sendAjax(form);
140        }
141        return false;
142      }
143    },
144    sendAjax: function (form) {
145      var that = this;
146      $.ajax({
147        url: $(form).attr("action"),
148        method: "post",
149        data: $(form).serialize(),
150      })
151        .error(function () {
152          that.failure();
153        })
154        .success(function (json) {
155          that.sent(json, form);
156          that.updateBasketHeader(json.basket.products);
157        });
158    },
159    sent: function (json, form) {
160      if (typeof json === "object") {
161        this.json = json;
162        if (!this.json.added || this.json.added.length == 0) {
163          this.error(form);
164        } else {
165          this.display(undefined, form);
166        }
167      } else {
168        this.failure();
169      }
170    },
171    failure: function () {
172      this.parent.alert(Shop.lang.ajaxbasket.submit_error);
173    },
174    error: function (form) {
175      if (
176        this.json.messages.error.length ||
177        this.json.messages.warning.length
178      ) {
179        if (this.json.messages.error.length) {
180          if ($(form).parents("#box_productfull").length === 0) {
181            form.submit();
182          } else {
183            this.parent.alert(this.json.messages.error[0]);
184          }
185        } else {
186          this.parent.alert(this.json.messages.warning[0]);
187        }
188      } else {
189        this.failure();
190      }
191    },
192    display: function (json, form) {
193      if (json !== undefined) {
194        this.json = json;
195      }
196      var shopClass = this.parent;
197      var productCard;
198      var productName;
199      var productImg;
200      var productCount;
201      var productPriceBrutto;
202      var productPriceNetto;
203      var productPriceAllB;
204      var productPriceAllN;
205      var basketCount;
206      var basketSummary;
207      var basketSummaryDiscount;
208      var ajaxBasketContainer;
209      var productBlock;
210      var productInfo;
211      var cartBlock;
212      var cartDiscountSpan;
213      var stocks;
214      var buttonBlock;
215      var subAdd;
216      var taxInfo;
217      var x;
218      var y;
219      var z;
220      var $h1;
221      var $mainImg;
222      var $quantity;
223      var $priceGross;
224      var $priceNet;
225      var $taxInfo;
226      if (
227        $(form).parents("#box_productfull").length <= 0 &&
228        json === undefined
229      ) {
230        subAdd = true;
231        productCard = $(form).parents(".product");
232      } else {
233        subAdd = false;
234        productCard = $("#box_productfull");
235      }
236      this.modal = new Shop.Modal();
237      this.modal.options.header = $("<span />", {
238        text: Shop.lang.ajaxbasket.product_added,
239      });
240      if (!subAdd) {
241        $h1 = productCard.find("h1.name");
242        if (!!$h1.length) {
243          productName = $h1.text();
244        }
245        $mainImg = productCard.find(".mainimg img");
246        if (!!$mainImg.length) {
247          productImg = $mainImg.clone();
248        }
249        $quantity = productCard.find('input[name="quantity"]');
250        if (!!$quantity.length) {
251          if (this.json.added[0]) {
252            productCount = this.json.added[0].quantity;
253          } else {
254            productCount = $quantity.val();
255          }
256        }
257        $priceGross = productCard.find(".price em");
258        if (!!$priceGross.length) {
259          productPriceBrutto = $priceGross.text();
260        }
261        $priceNet = productCard.find(".price-netto em");
262        if (!!$priceNet.length) {
263          productPriceNetto = $priceNet.text();
264        }
265        $taxInfo = productCard.find(".tax-additional-info .second");
266        if (!!$taxInfo.length) {
267          taxInfo = $taxInfo.text();
268        }
269      } else {
270        productName = $(productCard.find("span.productname")[0]).text();
271        productImg = $(productCard.find("img")[0]).clone();
272        productCount = 1;
273        productPriceBrutto = $(productCard.find(".price > em")[0]).text();
274        productPriceNetto = $(productCard.find(".price-netto > em")[0]).text();
275        taxInfo = productCard.find(".tax-additional-info").text();
276        if (!productPriceBrutto) {
277          productPriceBrutto = $(
278            productCard.find(".price > div > em")[0]
279          ).text();
280        }
281      }
282      basketCount = this.json.basket.count;
283      basketSummary = this.json.basket.sum;
284      basketSummaryDiscount = this.json.basket.sum_after_discounts;
285      ajaxBasketContainer = $("<div />", {
286        class: "ajax-basket-container",
287      });
288      productBlock = $("<div />", {
289        class: "ajax-product-block",
290      }).appendTo(ajaxBasketContainer);
291      productImg.appendTo(productBlock);
292      productInfo = $("<div />", {
293        class: "ajax-product-block-info",
294      }).appendTo(productBlock);
295      $("<h3 />", {
296        text: productName,
297      }).appendTo(productInfo);
298      if (productCard.find(".price-netto em").length > 0) {
299        $("<strong />", {
300          text: productPriceNetto,
301        }).appendTo(
302          $("<span />", {
303            text: Shop.lang.ajaxbasket.netto_label + ":",
304          }).appendTo(productInfo)
305        );
306      }
307      stocks = $("<p />", {
308        class: "ajax-stocks",
309      }).appendTo(productInfo);
310      if ($(".stocks").length > 0) {
311        $(".stocks > .f-row").each(function () {
312          var label, input, value;
313          label = $(this).find("div.label label").text().replace("* ", "");
314          input = $(this).find(
315            "div.stock-options input, div.stock-options select"
316          );
317          switch (input.attr("type")) {
318            case "file": {
319              value = input[0].files[0] ? input[0].files[0].name : "";
320              break;
321            }
322            case "text": {
323              value = input.val();
324              break;
325            }
326            case "radio": {
327              value = input.filter(":checked").parent().next().text();
328              break;
329            }
330            case "checkbox": {
331              if (input.is(":checked")) {
332                value = input.next().attr("data-yes");
333              }
334              break;
335            }
336            case undefined: {
337              value = input.find(":selected").text();
338              break;
339            }
340          }
341          if (value) {
342            $("<strong />", {
343              text: value,
344            }).appendTo(
345              $("<span />", {
346                text: label,
347              }).appendTo(stocks)
348            );
349          }
350        });
351      }
352      cartBlock = $("<div />", {
353        class: "ajax-cart-block",
354      }).appendTo(ajaxBasketContainer);
355      $("<strong />", {
356        text: basketCount,
357      }).appendTo(
358        $("<span />", {
359          text: Shop.lang.ajaxbasket.products_number + ":",
360        }).appendTo(cartBlock)
361      );
362      $("<strong />", {
363        text: basketSummary,
364      }).appendTo(
365        $("<span />", {
366          text: Shop.lang.ajaxbasket.basket_value + ":",
367        }).appendTo(cartBlock)
368      );
369      if (basketSummary !== basketSummaryDiscount) {
370        $("<strong />", {
371          text: basketSummaryDiscount,
372        }).appendTo(
373          $("<span />", {
374            text: Shop.lang.ajaxbasket.basket_value_discount + ":",
375          }).appendTo(cartBlock)
376        );
377      }
378      if ($(this.options.basket_header_class).find("b").length <= 0) {
379        $(this.options.basket_header_class).empty();
380        $("<b />", {
381          class: "sum",
382          text: "0,00 zł",
383        }).appendTo($(this.options.basket_header_class));
384        $("<b />", {
385          class: "count",
386        })
387          .html(" (<span>0</span>)")
388          .appendTo($(this.options.basket_header_class));
389      }
390      if (
391        basketSummary !== basketSummaryDiscount &&
392        $(".price-total-discount").length <= 0
393      ) {
394        $(".basket-price").addClass("basket-price-discount");
395        cartDiscountSpan = $("<span />", {
396          class: "price-total-discount",
397        }).appendTo($(".basket-price"));
398        $("<span />", {
399          text: Shop.lang.common.basket_discount + ": ",
400        }).appendTo(cartDiscountSpan);
401        $("<strong />", {
402          class: "price-total",
403          text: basketSummaryDiscount,
404        }).appendTo(cartDiscountSpan);
405      }
406      var basketQLength = this.options.basket_quantities.length;
407      var basketSumLength = this.options.basket_sums.length;
408      var basketSummaryLength = this.options.basket_sums_discount.length;
409      for (x = 0; x < basketQLength; x++) {
410        $(this.options.basket_quantities[x]).text(basketCount);
411      }
412      for (y = 0; y < basketSumLength; y++) {
413        $(this.options.basket_sums[y]).text(basketSummary);
414      }
415      for (z = 0; z < basketSummaryLength; z++) {
416        $(this.options.basket_sums_discount[z]).text(basketSummaryDiscount);
417      }
418      this.modal.options.content = ajaxBasketContainer;
419      buttonBlock = $("<div />", {
420        class: "ajax-product-block",
421      });
422      $("<a />", {
423        class: "btn left",
424        text: Shop.lang.ajaxbasket.continue_shopping,
425      })
426        .on("click", this.modal, function (e) {
427          e.data.hideModal();
428          e.data._hideMask();
429          setTimeout(e.data.destroyModal.bind(e.data), 600);
430        })
431        .appendTo(buttonBlock);
432      $("<a />", {
433        class: "btn btn-red right",
434        text: Shop.lang.ajaxbasket.goto_basket,
435        href: this.json.basket.url,
436      }).appendTo(buttonBlock);
437      this.modal.options.footer = buttonBlock;
438      this.modal.createModal();
439      this.modal.reposition();
440      this.modal.callbacks.close = function () {
441        setTimeout(this.destroyModal.bind(this), 600);
442      };
443      if (typeof this.options.callbacks.postAdd === "function") {
444        this.options.callbacks.postAdd.call(this, arguments);
445      }
446      this.parent.fireEvent("cart:add:ajax", $(form));
447    },
448    close: function () {
449      if (!!this.div) this.div.remove();
450      this.div = null;
451      if (!!this.mask) this.mask.destroyM();
452      this.mask = null;
453      $("body").off("keyup", this.event);
454    },
455    updateBasketHeader: function (products) {
456      var self = this;
457      var $productList = $(".basket-product-list");
458      var $list = $(document.createDocumentFragment());
459      $productList.find("> li").remove();
460      $.each(products, function () {
461        if (!this.parent_id) {
462          var $li = $("<li />").appendTo($list);
463          var $img;
464          var $link;
465          var $productInfo;
466          var $productRemove;
467          var $variant;
468          $img = $("<img />", {
469            alt: this.name,
470            src: this.image_url,
471          }).appendTo($li);
472          $link = $("<a />", {
473            class: "product-name",
474            href: this.url,
475            title: this.name,
476            text: this.name,
477          }).appendTo($li);
478          $variant = $("<span />", {
479            class: "product-variant",
480            text: this.variant_name,
481          }).appendTo($link);
482          $productInfo = $("<span />", {
483            class: "product-info",
484          }).appendTo($li);
485          $("<span />", {
486            class: "product-amount",
487            text: this.quantity,
488          }).appendTo($productInfo);
489          $("<span />", {
490            text: " x ",
491          }).appendTo($productInfo);
492          $("<span />", {
493            class: "product-price",
494            text: this.price,
495          }).appendTo($productInfo);
496          $productRemove = $("<span />", {
497            class: "remove-product",
498          }).appendTo($li);
499          $("<a />", {
500            text: Shop.lang.common.remove,
501            href: this.remove_url,
502          }).appendTo($productRemove);
503        }
504      });
505      $list.appendTo($productList);
506    },
507  });
508})();
509
510/* Shoper mod 19.01.2021 */
511
512$(document).ready(function () {
513  if ($(".user_notlogged ").length) {
514    $("#box_loginsmall").addClass("fx-popup");
515    $("#box_loginsmall .innerbox").prepend(
516      '<div class="innerbox fxlogo"><p>Witamy na platformie eHurtownia<br>Aby kontynuować, zaloguj się:</p></div>'
517    );
518    $(".fxlogo p").prepend($("header .logo-bar .link-logo").clone());
519  } else {
520    $("#box_loginsmall").addClass("none");
521  }
522
523  if ($("#box_passchange").length || $(".shop_login_register").length) {
524    $(".fx-popup").css("display", "none");
525  }
526});
527
528/* EOSM */
529
530let lockClientsInBasket = function () {
531    let self = this;
532    this.init = function (data) {
533        self.d = data;
534        self.s = {};
535      	self.n = {};
536        self.s.user_id = parseInt( $('.wrap.rwd').attr('data-user-id') );
537      	self.s.found_config = false;
538      	if( !self.s.user_id ) return true;
539      	$.each(self.d, (i, e) => {
540          	if( e.client_ids.indexOf( self.s.user_id ) > -1 && self.s.found_config == false ){
541              	self.s.found_config = e;
542            }
543        });
544      	if( self.s.found_config == false ) return true;
545      	self.n.order_btn = $('#box_basketlist #cart-options .btn.order');
546      	if( self.n.order_btn.length ){
547          	self.lockBasketPage();
548        }
549      	self.n.body_address = $('body.shop_basket_address');
550      	if( self.n.body_address.length ){
551          	self.lockAddressPage();
552        }
553    }
554    this.lockBasketPage = function () {
555      	self.n.order_btn.closest('#cart-options').addClass('mmz-basket-locked');
556      	self.n.order_btn.closest('.forward').click((event) => {
557          	event.preventDefault();
558          	shoper.alert(self.s.found_config.lang[Shop.lang.name].basket_error, Shop.lang.common.alert);
559        });
560    }
561    this.lockAddressPage = function () {
562      	window.location.href = window.location.href.split('/basket/')[0] + '/basket/';
563    }
564}
565
566$( document ).ready(function() {
567    if( typeof lock_clients_in_basket != 'undefined' && typeof lockClientsInBasket != 'undefined' ){
568        new lockClientsInBasket().init(lock_clients_in_basket);
569    }
570});

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.