PageSourceSearch

https://www.cheero.cz/wa_script/js/template/kryptonit/script.js?_=2026-09-02-11-10

js cheero.cz collected 2026-09-24 13:50:16 UTC 16,932 bytes, 615 lines download raw bytes

1function initProgressButtons()
2{
3  var _dataProperty = "_progressBtnInitialized";
4  var easing = function (t, b, c, d) {
5    return c*(t/=d)*t*t*t*t + b;
6  };
7  //tlačítko
8  $(".progress-button").each(function() {
9    var cart_status,
10      $this = $(this);
11    if(!$this.data(_dataProperty))
12    {
13      //easeInQuint
14      $this.on("start.BS.Cart", function(e) {
15        e.stopImmediatePropagation();
16        cart_status = -1;
17      });
18      $this.on("done.BS.Cart", function(e, event_data) {
19        e.stopImmediatePropagation();
20        cart_status = event_data.requestStatus;
21      });
22      $this.data(_dataProperty, true);
23      new ProgressButton(this, {
24        callback: function(instance) {
25          var progress = 0,
26            easing_v = [0,0,1,800];
27          var interval = setInterval( function() {
28            if(cart_status === -1)
29            {
30              progress = Math.min(progress + Math.random() * 0.1, 1);
31            }
32            else
33            {
34              //ajax již doběhnul, urychlíme progress
35              if(easing_v[0] === 0)
36              {
37                easing_v[1] = progress;
38                easing_v[2] = 1 - easing_v[1];
39              }
40              progress = Math.min(easing(easing_v[0], easing_v[1], easing_v[2], easing_v[3]), 1);
41              easing_v[0] += 200;
42            }
43
44            instance._setProgress(Math.roundFloat(progress, 3));
45            if(progress === 1)
46            {
47              instance._stop(cart_status === BS.CartUtils.status.SUCCESS ? true : false);
48              clearInterval(interval);
49            }
50          }, 200 );
51        }
52      });
53    }
54  });
55}
56
57function Login_dialog($button, BS)
58{
59  this.$modal = null;
60  this.$button = $button;
61  this.selector = "#loginModal";
62  var self = this;
63
64  this.tabs = {};
65
66  this.init = function() {
67    var $result = $(this.selector);
68    this.$modal = $result.length ? $result.detach() : null;
69
70    if(this.$modal !== null)
71    {
72      this.$modal[0].style.display = "block";
73      this.tabs = {
74        $login: $(this.$modal).find("#login-tab"),
75        $openID: $(this.$modal).find("#mojeID-tab"),
76        $lostPsw: $(this.$modal).find("#lostPsw-tab")
77      };
78      init_modal();
79      register_events();
80    }
81    else
82    {
83      console.log("%cUser has logged in.", "color: #0084b4");
84    }
85  };
86
87  function reload_page(page, delay) {
88    setTimeout(function() {
89      if(page
90        && page !== "")
91      {
92        window.location.href = page;
93      }
94      else
95      {
96        window.location.reload();
97      }
98    }, ( (Number.isInteger(delay)) ? delay : 0 ));
99  }
100
101  this.select_tab = function($tab) {
102    if(!$tab.hasClass("active"))
103    {
104      this.$modal.find(".tabs-container").children(".dialog-tab").filter(".active").removeClass("active");
105      $tab.addClass("active");
106    }
107  };
108
109  function init_modal() {
110    //login dialog
111    var modal_options = {
112      items: {
113        src: self.$modal
114      },
115      mainClass: 'modal-effect',
116      removalDelay: 300,
117      closeOnBgClick: false,
118      callbacks: {
119        close: function() {
120          reset_tabs();
121        },
122        beforeOpen: function() {
123          if(!BS.slideMenu.menu.isWidescreenActive()
124            && BS.slideMenu.menu.isOpened()) {
125            BS.slideMenu.menu.tabEnable();
126          }
127        },
128        beforeClose: function () {
129          if(!BS.slideMenu.menu.isWidescreenActive()
130            && BS.slideMenu.menu.isOpened()) {
131            BS.slideMenu.menu.tabRestore();
132          }
133        }
134      }
135    };
136    if(self.$button.length)
137    {
138      self.$button.magnificPopup(modal_options);
139      if(self.$modal.data("auto-open"))
140      {
141        setTimeout(function() {
142          $.magnificPopup.open(modal_options);
143        }, 500);
144      }
145    }
146  }
147
148  function reset_tabs() {
149    self.$modal.find(".login-msg.show-msg").removeClass("show-msg");
150  }
151
152  function register_events() {
153    var valid_email = false;
154    self.tabs.$login.find("form[name='loginForm']").on("submit", function(e) {
155      var request = BS.extend(BS.Request.$default, {
156        data: {
157          action: "Eshop_login",
158          request: {
159            action: "login",
160            data: {
161              login_data: {
162                username: this.login.value,
163                password: this.heslo.value
164              },
165              info: {
166                page: window.location.pathname,
167                url: window.location.href
168              }
169            }
170          },
171          id_zakaznik: BS.User.id
172        },
173        success: function(data)
174        {
175          if(data.success)
176          {
177            self.tabs.$login.find(".login-success").addClass("show-msg");
178            self.tabs.$login.find(".login-error").removeClass("show-msg");
179            $("html").removeClass("login-false");
180            reload_page(data.redirect ? data.redirect_to : null, 1000);
181          }
182          else
183          {
184            $("html").addClass("login-false");
185            self.tabs.$login.find(".login-error").addClass("show-msg");
186          }
187        }
188      });
189      $.ajax(request);
190      return false;
191    });
192    self.tabs.$lostPsw.find("form[name='lostPswForm']").on("submit", function(e) {
193      if(!valid_email)
194      {
195        var request = BS.extend(BS.Request.$default, {
196          data: {
197            action: "Eshop_login",
198            request: {
199              action: "recover",
200              data: {
201                email: this.email.value
202              }
203            },
204            id_zakaznik: BS.User.id
205          },
206          success: function(data)
207          {
208            if(data.success)
209            {
210              valid_email = true;
211              self.tabs.$lostPsw.find(".recover-error").removeClass("show-msg");
212              self.tabs.$lostPsw.find("form[name='lostPswForm']").submit();
213            }
214            else
215            {
216              self.tabs.$lostPsw.find(".recover-error").addClass("show-msg");
217            }
218          }
219        });
220        $.ajax(request);
221        return false;
222      }
223      else
224      {
225        return true;
226      }
227    });
228
229    self.$modal.find(".dialog-footer a").each(function() {
230      var action = /.+\/?(#[a-zA-Z]+)$/.exec(this.href);
231      if(action)
232      {
233        $(this).on("click", function(e) {
234          e.preventDefault();
235          switch (action[1])
236          {
237            case "#login":
238              self.select_tab(self.tabs.$login);
239              break;
240            case "#mojeID":
241              self.select_tab(self.tabs.$openID);
242              break;
243            case "#lostPsw":
244              self.select_tab(self.tabs.$lostPsw);
245              break;
246          }
247        });
248      }
249    });
250  }
251}
252
253var ScrollToTop = (function($, undefined) {
254  'use strict';
255
256  function getPercentage(value, from)
257  {
258    var result = false;
259    var matches = /(\d+(?:\.\d+)?)%$/.exec(value);
260    if(matches)
261    {
262      var num = parseFloat(matches[1]);
263      if(!isNaN(num))
264      {
265        result = Math.round(from * num);
266      }
267    }
268
269    return result;
270  }
271
272  function ScrollToTop(options) {
273    this._settings = {};
274    this._lastScroll = 0;
275    this._init(options);
276  }
277
278  ScrollToTop.prototype._init = function(options) {
279    if(options.element !== undefined)
280    {
281      this._settings = $.extend({}, ScrollToTop.defaults, options);
282
283      $(window).on("scroll", this._onScroll.bind(this));
284      $(this._settings.element).on("click", this._onElementClick.bind(this));
285    }
286  };
287
288  ScrollToTop.prototype._onScroll = function(e) {
289    //neustále způsbujeme reflow, zjistíme hodnoty pouze jednou a předáme funkcím
290    var windowHeight = window.innerHeight;
291    var pageHeight = document.body.scrollHeight;
292    var scrollOffset = window.pageYOffset;
293    var showTreshold = this._getShowTreshold(windowHeight, pageHeight);
294    var pageMinHeight = this._getPageMinHeight(windowHeight, pageHeight);
295
296    if(pageHeight > pageMinHeight)
297    {
298      if(scrollOffset > this._lastScroll)
299      {
300        //scrollujeme dolů
301        if(scrollOffset > showTreshold)
302        {
303          this._showElement();
304        }
305      }
306      else
307      {
308        //scrollujeme nahoru
309        if(scrollOffset <= showTreshold)
310        {
311          this._hideElement();
312        }
313      }
314    }
315    else
316    {
317      this._hideElement();
318    }
319    this._lastScroll = scrollOffset;
320  };
321
322  ScrollToTop.prototype._onElementClick = function() {
323    $('html, body').animate({scrollTop:0}, 'slow');
324  };
325
326  ScrollToTop.prototype._showElement = function() {
327    $(this._settings.element).removeClass(this._settings.hideClass);
328  };
329
330  ScrollToTop.prototype._hideElement = function() {
331    $(this._settings.element).addClass(this._settings.hideClass);
332  };
333
334  ScrollToTop.prototype._getShowTreshold = function(windowHeight, pageHeight) {
335    var result = 0;
336    if(typeof this._settings.minOffset === "string")
337    {
338      if(this._settings.minOffset === ScrollToTop.const.SCREEN)
339      {
340        result = windowHeight;
341      }
342      else
343      {
344        var temp = getPercentage(this._settings.minOffset, pageHeight);
345        result = temp !== false ? temp : 0;
346      }
347    }
348    else if(Number.isInteger(this._settings.minOffset))
349    {
350      result = this._settings.minPageHeight;
351    }
352
353    if(this._settings.addToScreenHeight)
354    {
355      result = windowHeight + result;
356    }
357
358    return result;
359  };
360
361  ScrollToTop.prototype._getPageMinHeight = function(windowHeight, pageHeight) {
362    var result = 0;
363    if(typeof this._settings.minPageHeight === "string")
364    {
365      if(this._settings.minPageHeight ===  ScrollToTop.const.SCREEN)
366      {
367        result = windowHeight;
368      }
369      else
370      {
371        var temp = getPercentage(this._settings.minPageHeight, pageHeight);
372        result = temp !== false ? temp : 0;
373      }
374    }
375    else if(Number.isInteger(this._settings.minPageHeight))
376    {
377      result = this._settings.minPageHeight;
378    }
379
380    return result;
381  };
382
383  ScrollToTop.const = {
384    SCREEN: "screen"
385  };
386
387  ScrollToTop.defaults = {
388    element: null,
389    minPageHeight: ScrollToTop.const.SCREEN,
390    minOffset:  ScrollToTop.const.SCREEN,
391    addToScreenHeight: false,
392    hideClass: "scrollTop-hidden"
393  };
394
395
396  return ScrollToTop;
397})(jQuery);
398
399$(function() {
400  if(typeof hover_img_enabled !== "undefined"
401    && hover_img_enabled)
402  {
403    $(".productBody .img_box").mouseenter(function() {
404      if($(this).closest("#changeable").length)
405      {
406        $(this).find("img").fadeOut(400);
407        $(this).closest("#changeable").find(".change").fadeIn( 400 );
408      }
409    });
410    $(".productBody .img_box").mouseleave(function() {
411      if($(this).closest("#changeable").length)
412      {
413        $(this).find("img").first().fadeIn( 400 );
414        $(this).closest("#changeable").find(".change").fadeOut(400);
415      }
416    });
417  }
418
419  Number.isInteger = Number.isInteger || function(value) {
420    return typeof value === "number"
421      && isFinite(value)
422      && Math.floor(value) == value
423  };
424
425  $("#carouselFooter .owl-carousel").owlCarousel({
426    autoplay: true,
427    autoplayTimeout: 4000,
428    items: 6,
429    //autoWidth: true,
430    autoplayHoverPause: true,
431    center: true,
432    loop: true,
433    lazyLoad: true,
434    margin: 10
435  });
436
437  var $carouselCategory = $("#carouselCategory");
438  $carouselCategory
439    .find(".owl-carousel")
440    .owlCarousel({
441      autoplay: true,
442      autoplayTimeout: 4000,
443      items: 4,
444      autoWidth: true,
445      autoplayHoverPause: true,
446      center: true,
447      loop: true,
448      lazyLoad: true,
449      margin: 10
450    });
451
452  /* login dialog */
453  var $login_buttons = $("#user_detail a.user-login");
454  //přidáme tlačítko z levého menu
455  $login_buttons = $login_buttons.add($("#userPanel span.user-login a"));
456  var dialog = new Login_dialog($login_buttons, BS);
457  dialog.init();
458
459  //košík
460  if(typeof cart_local !== "undefined")
461  {
462    var cart = new BS.Cart(BS.User.id, {
463      //tlačítko v detailu, výpisu, carouselu
464      buttonSelector: ".product-cart-btn, .buy_btn, .s-buy-btn"
465    }, cart_local);
466    cart.init();
467
468    $(cart.getCartElement()).on("itemAdded.BS.Cart", function(e, data) {
469      if(data)
470      {
471        BS.Conversion.getEvent(data.item, data.variant_selected, data.kusy, 'add_to_cart');
472
473        //FB pixel
474        if(typeof fb_pixel !== "undefined")
475        {
476          fb_pixel_init(data.item, data.kusy, 'addToCart');
477        }
478        //GA
479        if(WA.Google_analytics.activated)
480        {
481          WA.Google_analytics.add_product_to_basket((data.item_variant > 0 ? data.item_variant : data.item), "", "", data.kusy);
482        }
483      }
484    });
485
486    initProgressButtons();
487    if($carouselCategory
488      && $carouselCategory.length)
489    {
490      $carouselCategory.on("click", ".c-buy-btn", function(e) {
491        e.preventDefault();
492        cart.addItem(this.parentElement, this);
493      })
494    }
495    //filtrace produktů, musíme inicializovat znovu
496    $(document).on("page:productsLoaded", function(e) {
497      initProgressButtons();
498      cart.reloadButtons();
499    });
500  }
501
502  $(".header_slider div.icon-scroll").eq(0).on("click", function(e) {
503    e.stopImmediatePropagation();
504    var $target = $("#page_background");
505    $("html, body").animate({
506      scrollTop: $target.offset().top
507    }, 750, 'linear');
508  });
509
510  //záložky
511  var $bookmarks = $("ul.product-detail-bookmarks li");
512  $bookmarks.each(function() {
513    var tab_regex = /tab=(\w+)/;
514    $(this).children("a").on("click", function(e) {
515      e.preventDefault();
516      e.stopImmediatePropagation();
517      var $this = $(this),
518          current_tab,
519          target_tab,
520          $selected_bookmark;
521      if(!$this.parent().hasClass("selected"))
522      {
523        $selected_bookmark = $bookmarks.filter(".selected");
524        current_tab = tab_regex.exec($selected_bookmark.children("a").attr("href"));
525        target_tab = tab_regex.exec(this.href);
526        if(current_tab && target_tab)
527        {
528          $selected_bookmark.removeClass("selected");
529          $("#" + current_tab[1]).removeClass("selected").addClass("bookmark-hide");
530          $this.parent().addClass("selected");
531          $("#" + target_tab[1]).removeClass("bookmark-hide").addClass("selected");
532        }
533      }
534    });
535  });
536
537  $('a[href=#top-slow]').click(function(e){
538    e.stopImmediatePropagation();
539    e.preventDefault();
540    $('html, body').animate({scrollTop:0}, 'slow');
541  });
542
543  //zaheslovaná kategorie
544  var $lock_form = $("table.lock_form").eq(0),
545    $text = $lock_form.find("span").eq(0),
546    $form = $lock_form.find("form").eq(0);
547  if($text.length && $form.length)
548  {
549    var $lock_popup = $("<div />", {
550      class: "lock-form-wrapper",
551      html: '<div class="lock-form"></div>'
552    });
553    $lock_popup.children().append($text);
554    $lock_popup.children().append($form);
555    $lock_form.remove();
556    $.magnificPopup.open({
557      mainClass: 'modal-effect',
558      showCloseBtn: true,
559      closeOnBgClick: false,
560      enableEscapeKey: false,
561      items: {
562        src: $lock_popup
563      }
564    });
565  }
566
567  var backTop = new ScrollToTop({
568    element: ".content-back-top",
569    minPageHeight: ScrollToTop.const.SCREEN,
570    minOffset: "0.25%",
571    addToScreenHeight: true
572  });
573
574  (function() {
575    var MQL = 1170;
576    //primary navigation slide-in effect
577    var headerHeight = $('.myheader').height();
578    $(window).on('scroll', {
579       previousTop: 0
580     },
581     function () {
582       var currentTop = $(window).scrollTop();
583       //check if user is scrolling up
584       if (currentTop < this.previousTop) {
585         //if scrolling up...
586         if (currentTop > 0 && $('.myheader').hasClass('is-fixed')) {
587           $('.myheader').addClass('is-visible');
588         } else {
589           $('.myheader').removeClass('is-visible is-fixed');
590         }
591       } else {
592         //if scrolling down...
593         $('.myheader').removeClass('is-visible');
594         if (currentTop > headerHeight && !$('.myheader').hasClass('is-fixed')) $('.myheader').addClass('is-fixed');
595       }
596       this.previousTop = currentTop;
597     });
598    //open/close primary navigation
599    $('.cd-primary-nav-trigger').on('click', function () {
600      $('.cd-menu-icon').toggleClass('is-clicked');
601      $('.myheader').toggleClass('menu-is-open');
602
603      //in firefox transitions break when parent overflow is changed, so we need to wait for the end of the trasition to give the body an overflow hidden
604      if ($('.cd-primary-nav').hasClass('is-visible')) {
605        $('.cd-primary-nav').removeClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
606          $('body').removeClass('overflow-hidden');
607        });
608      } else {
609        $('.cd-primary-nav').addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
610          $('body').addClass('overflow-hidden');
611        });
612      }
613    });
614  })();
615});

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.