PageSourceSearch

https://pn-jakartabarat.go.id//assets/js/custom.js

js pn-jakartabarat.go.id collected 2026-10-08 23:41:04 UTC 20,339 bytes, 760 lines download raw bytes

1(function ($) {
2  "use strict";
3
4
5  //Hide Loading Box (Preloader)
6  function handlePreloader() {
7    if ($('.loader-wrap').length) {
8      $('.loader-wrap').delay(500).fadeOut(500);
9    }
10  }
11
12  if ($(".preloader-close").length) {
13    $(".preloader-close").on("click", function () {
14      $('.loader-wrap').delay(200).fadeOut(500);
15    })
16  }
17
18
19  function thmSwiperInit() {
20    // swiper slider
21    if ($(".thm-swiper__slider").length) {
22      $(".thm-swiper__slider").each(function () {
23        let elm = $(this);
24        let options = elm.data('swiper-options');
25        let thmSwiperSlider = new Swiper(elm, options);
26      });
27    }
28  }
29
30
31
32  function thmOwlInit() {
33    // owl slider
34
35    if ($(".thm-owl__carousel").length) {
36      $(".thm-owl__carousel").each(function () {
37        let elm = $(this);
38        let options = elm.data('owl-options');
39        let thmOwlCarousel = elm.owlCarousel(options);
40      });
41    }
42
43    if ($(".thm-owl__carousel--custom-nav").length) {
44      $(".thm-owl__carousel--custom-nav").each(function () {
45        let elm = $(this);
46        let owlNavPrev = elm.data('owl-nav-prev');
47        let owlNavNext = elm.data('owl-nav-next');
48        $(owlNavPrev).on("click", function (e) {
49          elm.trigger('prev.owl.carousel');
50          e.preventDefault();
51        })
52
53        $(owlNavNext).on("click", function (e) {
54          elm.trigger('next.owl.carousel');
55          e.preventDefault();
56        })
57      });
58    }
59
60  }
61
62
63  function dynamicCurrentMenuClass(selector) {
64    let FileName = window.location.href.split("/").reverse()[0];
65
66    selector.find("li").each(function () {
67      let anchor = $(this).find("a");
68      if ($(anchor).attr("href") == FileName) {
69        $(this).addClass("current");
70      }
71    });
72    // if any li has .current elmnt add class
73    selector.children("li").each(function () {
74      if ($(this).find(".current").length) {
75        $(this).addClass("current");
76      }
77    });
78    // if no file name return
79    if ("" == FileName) {
80      selector.find("li").eq(0).addClass("current");
81    }
82
83  }
84
85
86
87  if ($(".main-menu__list").length) {
88    // dynamic current class
89    let mainNavUL = $(".main-menu__list");
90    dynamicCurrentMenuClass(mainNavUL);
91  }
92
93
94  if ($(".service-details__sidebar-service-list").length) {
95    // dynamic current class
96    let mainNavUL = $(".service-details__sidebar-service-list");
97    dynamicCurrentMenuClass(mainNavUL);
98  }
99
100
101  if ($(".main-menu__list").length && $(".mobile-nav__container").length) {
102    let navContent = document.querySelector(".main-menu__list").outerHTML;
103    let mobileNavContainer = document.querySelector(".mobile-nav__container");
104    mobileNavContainer.innerHTML = navContent;
105  }
106
107
108
109  if ($(".sticky-header__content").length) {
110    let navContent = document.querySelector(".main-menu").innerHTML;
111    let mobileNavContainer = document.querySelector(".sticky-header__content");
112    mobileNavContainer.innerHTML = navContent;
113  }
114
115
116  if ($(".mobile-nav__container .main-menu__list").length) {
117    let dropdownAnchor = $(
118      ".mobile-nav__container .main-menu__list .dropdown > a"
119    );
120    dropdownAnchor.each(function () {
121      let self = $(this);
122      let toggleBtn = document.createElement("BUTTON");
123      toggleBtn.setAttribute("aria-label", "dropdown toggler");
124      toggleBtn.innerHTML = "<i class='fa fa-angle-down'></i>";
125      self.append(function () {
126        return toggleBtn;
127      });
128      self.on("click", function (e) {
129        // Prevent double triggers and default navigation
130        e.preventDefault();
131        e.stopPropagation();
132        
133        let $this = $(this);
134        $this.toggleClass("expanded");
135        $this.find("button").toggleClass("expanded");
136        $this.parent().toggleClass("expanded");
137        
138        // Use stop(true,true) to clear queued animations so double clicks don't slide down then slide up instantly
139        let $submenu = $this.parent().children("ul");
140        if ($submenu.length) {
141          $submenu.stop(true, true).slideToggle(300);
142        }
143      });
144    });
145  }
146
147
148  if ($(".mobile-nav__toggler").length) {
149    $(".mobile-nav__toggler").on("click", function (e) {
150      e.preventDefault();
151      $(".mobile-nav__wrapper").toggleClass("expanded");
152      $("body").toggleClass("locked");
153    });
154  }
155
156
157
158  //Fact Counter + Text Count
159  if ($(".count-box").length) {
160    $(".count-box").appear(
161      function () {
162        var $t = $(this),
163          n = $t.find(".count-text").attr("data-stop"),
164          r = parseInt($t.find(".count-text").attr("data-speed"), 10);
165
166        if (!$t.hasClass("counted")) {
167          $t.addClass("counted");
168          $({
169            countNum: $t.find(".count-text").text()
170          }).animate({
171            countNum: n
172          }, {
173            duration: r,
174            easing: "linear",
175            step: function () {
176              $t.find(".count-text").text(Math.floor(this.countNum));
177            },
178            complete: function () {
179              $t.find(".count-text").text(this.countNum);
180            }
181          });
182        }
183      }, {
184        accY: 0
185      }
186    );
187  }
188
189  // Progress Bar
190  if ($('.count-bar').length) {
191    $('.count-bar').appear(function () {
192      var el = $(this);
193      var percent = el.data('percent');
194      $(el).css('width', percent).addClass('counted');
195    }, {
196      accY: -50
197    });
198
199  }
200
201  // Apartments Plan Tab Box
202  if ($('.apartments-plan-tab-box').length) {
203    $('.apartments-plan-tab-box .tabs-button-box .tab-btn-item').on('click', function (e) {
204      e.preventDefault();
205      var target = $($(this).attr('data-tab'));
206
207      if ($(target).hasClass('actve-tab')) {
208        return false;
209      } else {
210        $('.apartments-plan-tab-box .tabs-button-box .tab-btn-item').removeClass('active-btn-item');
211        $(this).addClass('active-btn-item');
212        $('.apartments-plan-tab-box .tabs-content-box .tab-content-box-item').removeClass('tab-content-box-item-active');
213        $(target).addClass('tab-content-box-item-active');
214      }
215    });
216  }
217
218
219
220  // Search Form Tab Box
221  if ($('.search-form-tab-box').length) {
222    $('.search-form-tab-box .tabs-button-box .tab-btn-item').on('click', function (e) {
223      e.preventDefault();
224      var target = $($(this).attr('data-tab'));
225
226      if ($(target).hasClass('actve-tab')) {
227        return false;
228      } else {
229        $('.search-form-tab-box .tabs-button-box .tab-btn-item').removeClass('active-btn-item');
230        $(this).addClass('active-btn-item');
231        $('.search-form-tab-box .tabs-content-box .tab-content-box-item').removeClass('tab-content-box-item-active');
232        $(target).addClass('tab-content-box-item-active');
233      }
234    });
235  }
236
237
238  // ===Portfolio Grid===
239  function projectMasonaryLayout() {
240    if ($('.masonary-layout').length) {
241      $('.masonary-layout').isotope({
242        layoutMode: 'masonry'
243      });
244    }
245    if ($('.post-filter').length) {
246      $('.post-filter li').children('.filter-text').on('click', function () {
247        var Self = $(this);
248        var selector = Self.parent().attr('data-filter');
249        $('.post-filter li').removeClass('active');
250        Self.parent().addClass('active');
251        $('.filter-layout').isotope({
252          filter: selector,
253          animationOptions: {
254            duration: 500,
255            easing: 'linear',
256            queue: false
257          }
258        });
259        return false;
260      });
261    }
262
263    if ($('.post-filter.has-dynamic-filters-counter').length) {
264      // var allItem = $('.single-filter-item').length;
265      var activeFilterItem = $('.post-filter.has-dynamic-filters-counter').find('li');
266      activeFilterItem.each(function () {
267        var filterElement = $(this).data('filter');
268        var count = $('.filter-layout').find(filterElement).length;
269        $(this).children('.filter-text').append('<span class="count">' + count + '</span>');
270      });
271    };
272  }
273
274
275
276  //====== Magnific Popup
277  if ($(".video-popup").length) {
278    $(".video-popup").magnificPopup({
279      type: "iframe",
280      mainClass: "mfp-fade",
281      removalDelay: 160,
282      preloader: true,
283
284      fixedContentPos: false
285    });
286  }
287
288
289
290  //====== Img Popup
291  if ($(".img-popup").length) {
292    var groups = {};
293    $(".img-popup").each(function () {
294      var id = parseInt($(this).attr("data-group"), 10);
295
296      if (!groups[id]) {
297        groups[id] = [];
298      }
299
300      groups[id].push(this);
301    });
302
303    $.each(groups, function () {
304      $(this).magnificPopup({
305        type: "image",
306        closeOnContentClick: true,
307        closeBtnInside: false,
308        gallery: {
309          enabled: true
310        }
311      });
312    });
313  }
314
315
316  //Bottom Parallax
317  if ($('.bottom-parallax').length) {
318    var windowpos = $(window).scrollTop();
319    var siteFooter = $('.footer-area').height();
320    var sitebodyHeight = $('.boxed_wrapper').height();
321    var finalHeight = sitebodyHeight - siteFooter - 1000;
322    if (windowpos >= finalHeight) {
323      $('body').addClass('parallax-visible');
324    } else {
325      $('body').removeClass('parallax-visible');
326    }
327  }
328
329
330
331  if ($("#video-gallery-items-thumb").length) {
332    let learningcoursesThumb = new Swiper("#video-gallery-items-thumb", {
333      speed: 1400,
334      watchSlidesVisibility: true,
335      watchSlidesProgress: true,
336      loop: false,
337      autoplay: {
338        delay: 3000
339      },
340      "breakpoints": {
341
342        "0": {
343          "spaceBetween": 30,
344          "slidesPerView": 1
345        },
346        "375": {
347          "spaceBetween": 30,
348          "slidesPerView": 1
349        },
350        "575": {
351          "spaceBetween": 20,
352          "slidesPerView": 2
353        },
354        "767": {
355          "spaceBetween": 20,
356          "slidesPerView": 3
357        },
358        "991": {
359          "spaceBetween": 20,
360          "slidesPerView": 4
361        },
362        "1199": {
363          "spaceBetween": 30,
364          "slidesPerView": 5
365        }
366
367      }
368
369    });
370
371    let learningcoursesCarousel = new Swiper("#video-gallery-items-carousel", {
372      observer: true,
373      observeParents: true,
374      loop: false,
375      speed: 1400,
376      mousewheel: true,
377      slidesPerView: 1,
378      spaceBetween: 0,
379      autoplay: {
380        delay: 5000000000
381      },
382      thumbs: {
383        swiper: learningcoursesThumb
384      },
385      pagination: {
386        el: '#learning-courses-carousel-pagination',
387        type: 'bullets',
388        clickable: true
389      },
390
391      "navigation": {
392        "nextEl": "#learning-courses__swiper-button-next",
393        "prevEl": "#learning-courses__swiper-button-prev"
394      },
395
396    });
397
398  }
399
400
401
402  // AOS Animation
403  if ($("[data-aos]").length) {
404    AOS.init({
405      duration: '1000',
406      disable: 'false',
407      easing: 'ease',
408      mirror: true
409    });
410  }
411
412
413  //Contact Form Validation
414  if ($("#contact-form").length) {
415    $("#contact-form").validate({
416      submitHandler: function (form) {
417        var form_btn = $(form).find('button[type="submit"]');
418        var form_result_div = '#form-result';
419        $(form_result_div).remove();
420        form_btn.before('<div id="form-result" class="alert alert-success" role="alert" style="display: none;"></div>');
421        var form_btn_old_msg = form_btn.html();
422        form_btn.html(form_btn.prop('disabled', true).data("loading-text"));
423        $(form).ajaxSubmit({
424          dataType: 'json',
425          success: function (data) {
426            if (data.status = 'true') {
427              $(form).find('.form-control').val('');
428            }
429            form_btn.prop('disabled', false).html(form_btn_old_msg);
430            $(form_result_div).html(data.message).fadeIn('slow');
431            setTimeout(function () {
432              $(form_result_div).fadeOut('slow')
433            }, 6000);
434          }
435        });
436      }
437    });
438  }
439
440
441  if ($("#datepicker").length) {
442    $("#datepicker").datepicker();
443  }
444
445
446  $('input[name="time"]').ptTimeSelect();
447
448
449  if ($(".odometer").length) {
450    var odo = $(".odometer");
451    odo.each(function () {
452      $(this).appear(function () {
453        var countNumber = $(this).attr("data-count");
454        $(this).html(countNumber);
455      });
456    });
457  }
458
459
460  if ($(".banner-bg-slide").length) {
461    $(".banner-bg-slide").each(function () {
462      var Self = $(this);
463      var bgSlideOptions = Self.data("options");
464      var bannerTwoSlides = Self.vegas(bgSlideOptions);
465    });
466  }
467
468
469  if ($(".wow").length) {
470    var wow = new WOW({
471      boxClass: "wow", // animated element css class (default is wow)
472      animateClass: "animated", // animation css class (default is animated)
473      mobile: true, // trigger animations on mobile devices (default is true)
474      live: true // act on asynchronously loaded content (default is true)
475    });
476    wow.init();
477  }
478
479
480
481  if ($(".search-toggler").length) {
482    $(".search-toggler").on("click", function (e) {
483      e.preventDefault();
484      $(".search-popup").toggleClass("active");
485      $(".mobile-nav__wrapper").removeClass("expanded");
486      $("body").toggleClass("locked");
487    });
488  }
489
490
491
492  //Accordion Box
493  if ($('.accordion-box').length) {
494    $(".accordion-box").on('click', '.acc-btn', function () {
495
496      var outerBox = $(this).parents('.accordion-box');
497      var target = $(this).parents('.accordion');
498
499      if ($(this).hasClass('active') !== true) {
500        $(outerBox).find('.accordion .acc-btn').removeClass('active');
501      }
502
503      if ($(this).next('.acc-content').is(':visible')) {
504        return false;
505      } else {
506        $(this).addClass('active');
507        $(outerBox).children('.accordion').removeClass('active-block');
508        $(outerBox).find('.accordion').children('.acc-content').slideUp(300);
509        target.addClass('active-block');
510        $(this).next('.acc-content').slideDown(300);
511      }
512    });
513  }
514
515
516  function SmoothMenuScroll() {
517    var anchor = $(".scrollToLink");
518    if (anchor.length) {
519      anchor.children("a").bind("click", function (event) {
520        if ($(window).scrollTop() > 10) {
521          var headerH = "90";
522        } else {
523          var headerH = "90";
524        }
525        var target = $(this);
526        $("html, body")
527          .stop()
528          .animate({
529              scrollTop: $(target.attr("href")).offset().top - headerH + "px"
530            },
531            1200,
532            "easeInOutExpo"
533          );
534        anchor.removeClass("current");
535        anchor.removeClass("current-menu-ancestor");
536        anchor.removeClass("current_page_item");
537        anchor.removeClass("current-menu-parent");
538        target.parent().addClass("current");
539        event.preventDefault();
540      });
541    }
542  }
543  SmoothMenuScroll();
544
545
546  function OnePageMenuScroll() {
547    var windscroll = $(window).scrollTop();
548    if (windscroll >= 117) {
549      var menuAnchor = $(".one-page-scroll-menu .scrollToLink").children("a");
550      menuAnchor.each(function () {
551        var sections = $(this).attr("href");
552        $(sections).each(function () {
553          if ($(this).offset().top <= windscroll + 100) {
554            var Sectionid = $(sections).attr("id");
555            $(".one-page-scroll-menu").find("li").removeClass("current");
556            $(".one-page-scroll-menu").find("li").removeClass("current-menu-ancestor");
557            $(".one-page-scroll-menu").find("li").removeClass("current_page_item");
558            $(".one-page-scroll-menu").find("li").removeClass("current-menu-parent");
559            $(".one-page-scroll-menu")
560              .find("a[href*=\\#" + Sectionid + "]")
561              .parent()
562              .addClass("current");
563          }
564        });
565      });
566    } else {
567      $(".one-page-scroll-menu li.current").removeClass("current");
568      $(".one-page-scroll-menu li:first").addClass("current");
569    }
570  }
571
572
573
574  // window load event
575  $(window).on("load", function () {
576
577
578    thmSwiperInit();
579    thmOwlInit();
580    projectMasonaryLayout();
581    handlePreloader();
582
583
584    //Jquery Spinner / Quantity Spinner
585    if ($('.quantity-spinner').length) {
586      $("input.quantity-spinner").TouchSpin({
587        verticalbuttons: true
588      });
589    }
590
591    //Jquery Curved Circle
592    if ($('.curved-circle').length) {
593      $('.curved-circle').circleType({
594        position: 'absolute',
595        dir: 1,
596        radius: 70,
597        forceHeight: true,
598        forceWidth: true
599      });
600    }
601
602  });
603
604
605
606
607  // window scroll event
608  $(window).on("scroll", function () {
609
610    //Stricked Menu Fixed
611    if ($(".stricked-menu").length) {
612      var headerScrollPos = 130;
613      var stricky = $(".stricked-menu");
614      if ($(window).scrollTop() > headerScrollPos) {
615        stricky.addClass("stricky-fixed");
616      } else if ($(this).scrollTop() <= headerScrollPos) {
617        stricky.removeClass("stricky-fixed");
618      }
619    }
620
621    //Scroll To Top
622    if ($(".scroll-to-top").length) {
623      var strickyScrollPos = 100;
624      if ($(window).scrollTop() > strickyScrollPos) {
625        $(".scroll-to-top").fadeIn(500);
626      } else if ($(this).scrollTop() <= strickyScrollPos) {
627        $(".scroll-to-top").fadeOut(500);
628      }
629    }
630
631    OnePageMenuScroll();
632
633  });
634
635
636
637
638  if ($(".scroll-to-target").length) {
639    $(".scroll-to-target").on("click", function () {
640      var target = $(this).attr("data-target");
641      // animate
642      $("html, body").animate({
643          scrollTop: $(target).offset().top
644        },
645        100
646      );
647
648      return false;
649    });
650  }
651
652
653  $(document).ready(function () {
654    $('select:not(.ignore)').niceSelect();
655  });
656
657
658
659
660
661
662
663  // Jquery Dependency
664  $("input[data-type='currency']").on({
665    keyup: function () {
666      formatCurrency($(this));
667    },
668    blur: function () {
669      formatCurrency($(this), "blur");
670    }
671  });
672
673
674  function formatNumber(n) {
675    // format number 1000000 to 1,234,567
676    return n.replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")
677  }
678
679
680  function formatCurrency(input, blur) {
681    // appends $ to value, validates decimal side
682    // and puts cursor back in right position.
683
684    // get input value
685    var input_val = input.val();
686
687    // don't validate empty input
688    if (input_val === "") {
689      return;
690    }
691
692    // original length
693    var original_len = input_val.length;
694
695    // initial caret position 
696    var caret_pos = input.prop("selectionStart");
697
698    // check for decimal
699    if (input_val.indexOf(".") >= 0) {
700
701      // get position of first decimal
702      // this prevents multiple decimals from
703      // being entered
704      var decimal_pos = input_val.indexOf(".");
705
706      // split number by decimal point
707      var left_side = input_val.substring(0, decimal_pos);
708      var right_side = input_val.substring(decimal_pos);
709
710      // add commas to left side of number
711      left_side = formatNumber(left_side);
712
713      // validate right side
714      right_side = formatNumber(right_side);
715
716      // On blur make sure 2 numbers after decimal
717      if (blur === "blur") {
718        right_side += "00";
719      }
720
721      // Limit decimal to only 2 digits
722      right_side = right_side.substring(0, 2);
723
724      // join number by .
725      input_val = "$" + left_side + "." + right_side;
726
727    } else {
728      // no decimal entered
729      // add commas to number
730      // remove all non-digits
731      input_val = formatNumber(input_val);
732      input_val = "$" + input_val;
733
734      // final formatting
735      if (blur === "blur") {
736        input_val += ".00";
737      }
738    }
739
740    // send updated string to input
741    input.val(input_val);
742
743    // put caret back in the right position
744    var updated_len = input_val.length;
745    caret_pos = updated_len - original_len + caret_pos;
746    input[0].setSelectionRange(caret_pos, caret_pos);
747  }
748
749
750
751  $(document).ready(function () {
752
753  });
754
755
756
757
758
759
760})(jQuery);

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.