PageSourceSearch

https://git.or.th/front/template/default/assets/js/main.js?u=20260210115046

js git.or.th collected 2026-10-02 04:52:51 UTC 42,475 bytes, 1,751 lines download raw bytes

1var base_url_lang = $('html').attr('lang')
2var path = $('base').attr('href')
3
4;(function () {
5  'use strict'
6
7  const initSliders = function () {
8    const sliders = []
9
10    const initSlider = function (selector, options) {
11      const $el = $(selector)
12      if ($el.length && !$el.hasClass('slick-initialized')) {
13        $el.slick(options)
14        sliders.push($el)
15        return true
16      }
17      return false
18    }
19
20    const lazyInitSlider = function (selector, options, delay) {
21      setTimeout(function () {
22        initSlider(selector, options)
23      }, delay || 100)
24    }
25
26    return { initSlider, lazyInitSlider, sliders }
27  }
28
29  window.sliderManager = initSliders()
30})()
31
32AOS.init({
33  once: true,
34  duration: 2000
35})
36
37$(document).ready(function () {
38  const $siteHeader = $('.site-header')
39  const $menuFull = $('.menu-full')
40  const siteheaderHeight = $siteHeader.outerHeight()
41  const isDesktop = $(window).width() > 991
42
43  let ticking = false
44  const handleScroll = function () {
45    if (!ticking) {
46      window.requestAnimationFrame(function () {
47        const scrollTop = $(window).scrollTop()
48        if (scrollTop > siteheaderHeight) {
49          if (isDesktop) {
50            $siteHeader.addClass('tiny')
51            $menuFull.addClass('tiny')
52          } else {
53            $siteHeader.addClass('blur')
54          }
55        } else {
56          if (isDesktop) {
57            $siteHeader.removeClass('tiny')
58            $menuFull.removeClass('tiny')
59          } else {
60            $siteHeader.removeClass('blur')
61          }
62        }
63        ticking = false
64      })
65      ticking = true
66    }
67  }
68
69  $(window).on('scroll', handleScroll)
70
71  let href = $('.popup-item').attr('data-href')
72  // let popupId = $(".popup-item").attr("id");
73
74  // if ($('.popup-item').attr("data-href") != '') {
75  //     $( ".fancybox-image" ).wrap( "<a class='link' href='" + href + "' target='_blank'></a>" );
76  // }
77
78  var arrPopup = new Array()
79  $("[data-fancybox='gallery-popup']").fancybox({
80    thumbs: false,
81    slideShow: true,
82    protect: true,
83    fullScreen: false,
84    zoom: false,
85    slideShow: {
86      speed: 5000
87    },
88
89    onComplete: function () {
90      const containers = $('.fancybox-container')
91      if (containers.length > 1) $('#fancybox-container-1').remove()
92      if (!$('.fancybox-container').parent().hasClass('fancybox--gallery-popup')) {
93        $('.fancybox-container').wrap("<div class='fancybox--gallery-popup'></div>")
94      }
95      arrPopup = Array.from(new Set(arrPopup))
96      let onComplete = $(this)[0].src.split('?targetid=')
97      if ($('#' + onComplete[1]).data('href') !== 'javascript:void(0);') {
98        $('.fancybox-image').wrap($('<a></a>'))
99        $('.fancybox-placeholder a').attr(
100          'href',
101          base + base_url_lang + '/pageredirect/popup/' + $('#' + onComplete[1]).data('id')
102        )
103        $('.fancybox-placeholder a').attr('target', $('#' + onComplete[1]).data('target'))
104        $('.fancybox-placeholder a').css('pointer-events', 'auto')
105      } else {
106        $('.fancybox-image').wrap($('<a></a>'))
107        $('.fancybox-placeholder a').attr('href', 'javascript:void(0);')
108        $('.fancybox-placeholder a').css('pointer-events', 'none')
109      }
110    },
111    beforeLoad: function () {
112      let explode = $(this)[0].src.split('?targetid=')
113      arrPopup.push(explode[1])
114    },
115    afterLoad: function () {
116      if (!$('.fancybox-button--play').hasClass('fancybox-button--pause')) {
117        $('.fancybox-button--play').trigger('click')
118      }
119
120      $('.fancybox-placeholder').on('mouseover', function () {
121        $('.fancybox-button--play').trigger('click')
122      })
123      $('.fancybox-placeholder').on('mouseout', function () {
124        $('.fancybox-button--play').trigger('click')
125      })
126    }
127  })
128
129  $("[data-fancybox='gallery']").fancybox({
130    thumbs: true,
131    slideShow: true,
132    protect: true,
133    fullScreen: true,
134    zoom: true
135  })
136
137  $('.main-menu-list .link-submenu').click(function () {
138    $('.main-menu-list .link-submenu').removeClass('active')
139    $(this).addClass('active')
140
141    $('.menu-full').addClass('show')
142
143    var link = $(this).data('link')
144    $('.' + link + ' .submenu').click()
145    $('.site-header .menu-toggle').addClass('close')
146
147    return false
148  })
149
150  $('.site-header .search-toggle').click(function () {
151    $('.search').addClass('show')
152  })
153  $('.site-header .search input').click(function () {
154    $('.search').addClass('show')
155  })
156  $('.site-header .search .close').click(function () {
157    $('.search').removeClass('show')
158  })
159
160  $('.site-header .menu-toggle').click(function () {
161    $('.menu-full').toggleClass('show')
162    // $('.site-header-topbar').toggleClass('show');
163    // $('.site-header').toggleClass('position');
164    $(this).toggleClass('close')
165    $('.main-menu-list .link-submenu').removeClass('active')
166    $('.menu-full .main-menu').removeClass('hide')
167  })
168
169  $('.menu-full .main-menu .link').click(function () {
170    // $('.menu-full .main-menu').css('transform', 'translateX(-100%)');
171    $('.menu-full .main-menu').addClass('hide')
172  })
173  $('.menu-full .dropdown-menu.level-II').click(function (e) {
174    // $('.menu-full .main-menu').css('transform', 'translateX(0)');
175    $('.menu-full .main-menu').removeClass('hide')
176
177    // check the event click outer a and a eq javascript:void(0); not do something
178    if (e.target.nodeName.toLowerCase() != 'a') {
179      return false
180    } else if (
181      e.target.nodeName.toLowerCase() == 'a' &&
182      (e.target.href == 'javascript:void(0);' || e.target.href == undefined)
183    ) {
184      return false
185    }
186    $('.site-header .menu-toggle').click()
187  })
188
189  if (window.sliderManager) {
190    window.sliderManager.lazyInitSlider(
191      '.intro-slider',
192      {
193        infinite: true,
194        slidesToShow: 1,
195        slidesToScroll: 1,
196        arrows: false,
197        dots: false,
198        autoplay: true,
199        autoplaySpeed: 5000
200      },
201      0
202    )
203  }
204
205  //  $(".sc-cm-collapse .attachment-slider.-II").slick({
206  //   infinite: true,
207  //   centerPadding: 50,
208  //   slidesToShow: 2,
209  //   slidesToScroll: 1,
210  //   arrows: false,
211  //   dots: true,
212  //   responsive: [
213  //    {
214  //     breakpoint: 576,
215  //     settings: {
216  //      slidesToShow: 1,
217  //      dots: true,
218  //     },
219  //    },
220  //   ],
221  //  });
222
223  $(document).ready(function () {
224    const $attachmentSlider = $('.attachment-slider')
225    if ($attachmentSlider.length && !$attachmentSlider.hasClass('slick-initialized')) {
226      const itemCount = $attachmentSlider.find('.item').length
227      const options = {
228        infinite: false,
229        centerPadding: 50,
230        slidesToShow: 2,
231        slidesToScroll: 1,
232        arrows: false,
233        dots: itemCount > 1,
234        responsive: [
235          {
236            breakpoint: 576,
237            settings: { slidesToShow: 1 }
238          }
239        ]
240      }
241      $attachmentSlider.slick(options)
242    }
243  })
244
245  $('.default-nav-slider').slick({
246    infinite: true,
247    slidesToShow: 4,
248    slidesToScroll: 1,
249    arrows: true,
250    dots: false,
251    responsive: [
252      {
253        breakpoint: 768,
254        settings: {
255          slidesToShow: 3
256        }
257      },
258      // {
259      //     breakpoint: 576,
260      //     settings: {
261      //         slidesToShow: 2,
262      //     },
263      // },
264      {
265        breakpoint: 415,
266        settings: {
267          slidesToShow: 1
268        }
269      }
270      // {
271      //     breakpoint: 376,
272      //     settings: {
273      //         slidesToShow: 1,
274      //     },
275      // },
276    ]
277  })
278
279  // var count_slick = $('.default-tab-slider div div').length ? count_slick : true;
280  $('.default-tab-slider').slick({
281    infinite: false,
282    // slidesToShow: 4,
283    // slidesToScroll: 1,
284    arrows: true,
285    dots: true,
286    variableWidth: true,
287    responsive: [
288      {
289        breakpoint: 778,
290        settings: {
291          arrows: false
292          // slidesToShow: 3,
293        }
294      },
295      {
296        breakpoint: 576,
297        settings: {
298          // slidesToShow: 2,
299          dots: true,
300          arrows: false
301        }
302      }
303      // {
304      //     breakpoint: 376,
305      //     settings: {
306      //         // slidesToShow: 1,
307      //     },
308      // },
309    ]
310  })
311
312  $('.default-nav .slider').slick({
313    infinite: false,
314    slidesToShow: 4,
315    slidesToScroll: 1,
316    arrows: true,
317    dots: false,
318    responsive: [
319      {
320        breakpoint: 992,
321        settings: {
322          slidesToShow: 3
323        }
324      },
325      {
326        breakpoint: 768,
327        settings: {
328          slidesToShow: 2
329        }
330      },
331      {
332        breakpoint: 576,
333        settings: {
334          slidesToShow: 1
335        }
336      }
337    ]
338  })
339
340  $('.knowledge-block .slider').slick({
341    autoplay: true,
342    autoplaySpeed: 3000,
343    infinite: true,
344    slidesToShow: 4,
345    slidesToScroll: 1,
346    arrows: true,
347    dots: true,
348    prevArrow: '<button class="slick-prev prev-arrow"></button>',
349    nextArrow: '<button class="slick-next next-arrow"></button>',
350    responsive: [
351      {
352        breakpoint: 992,
353        settings: {
354          slidesToShow: 3
355        }
356      },
357      {
358        breakpoint: 768,
359        settings: {
360          slidesToShow: 2
361        }
362      },
363      {
364        breakpoint: 576,
365        settings: {
366          slidesToShow: 2
367        }
368      }
369    ]
370  })
371
372  $('.theme-1 .top-graphic .slider').slick({
373    autoplay: true,
374    autoplaySpeed: 4000,
375    infinite: false,
376    slidesToShow: 1,
377    slidesToScroll: 1,
378    arrows: false,
379    dots: true
380  })
381
382  $('.theme-2 .top-graphic .slider').slick({
383    autoplay: true,
384    autoplaySpeed: 4000,
385    infinite: false,
386    slidesToShow: 1,
387    slidesToScroll: 1,
388    arrows: false,
389    dots: true
390  })
391
392  $('.services-block .slider').slick({
393    autoplay: true,
394    autoplaySpeed: 3000,
395    infinite: false,
396    slidesToShow: 2,
397    slidesToScroll: 2,
398    rows: 2,
399    arrows: false,
400    dots: true,
401    responsive: [
402      {
403        breakpoint: 576,
404        settings: {
405          slidesToShow: 1,
406          rows: false
407        }
408      }
409    ]
410  })
411
412  $('.theme-3 .git-news-block .slider').slick({
413    autoplay: true,
414    autoplaySpeed: 3000,
415    infinite: false,
416    slidesToShow: 3,
417    slidesToScroll: 3,
418    arrows: false,
419    dots: true,
420    responsive: [
421      {
422        breakpoint: 768,
423        settings: {
424          slidesToShow: 2,
425          slidesToScroll: 2
426        }
427      },
428      {
429        breakpoint: 576,
430        settings: {
431          slidesToShow: 1,
432          slidesToScroll: 1
433        }
434      }
435    ]
436  })
437
438  $('.git-information-block .slider').slick({
439    autoplay: true,
440    autoplaySpeed: 3000,
441    slidesToShow: 3,
442    slidesToScroll: 3,
443    arrows: false,
444    dots: true,
445    responsive: [
446      {
447        breakpoint: 768,
448        settings: {
449          slidesToShow: 2,
450          slidesToScroll: 2
451        }
452      },
453      {
454        breakpoint: 576,
455        settings: {
456          slidesToShow: 1,
457          slidesToScroll: 1
458        }
459      }
460    ]
461  })
462
463  $('.training-block .slider').slick({
464    autoplay: true,
465    autoplaySpeed: 3000,
466    infinite: false,
467    vertical: true,
468    verticalSwiping: true,
469    slidesToShow: 3,
470    slidesToScroll: 1,
471    arrows: false,
472    dots: true
473  })
474
475  $('.lab-update-block .slider').slick({
476    autoplay: true,
477    autoplaySpeed: 3000,
478    infinite: false,
479    slidesToShow: 1,
480    slidesToScroll: 1,
481    rows: 3,
482    arrows: true,
483    dots: false,
484    prevArrow: '<button class="slick-prev prev-arrow"></button>',
485    nextArrow: '<button class="slick-next next-arrow"></button>',
486    responsive: [
487      {
488        breakpoint: 992,
489        settings: {
490          arrows: false,
491          dots: true
492        }
493      }
494    ]
495  })
496
497  $('.git-training-movement-block .slider').slick({
498    autoplay: true,
499    autoplaySpeed: 3000,
500    infinite: false,
501    slidesToShow: 1,
502    slidesToScroll: 1,
503    rows: 3,
504    arrows: true,
505    dots: false,
506    prevArrow: '<button class="slick-prev prev-arrow"></button>',
507    nextArrow: '<button class="slick-next next-arrow"></button>',
508    responsive: [
509      {
510        breakpoint: 992,
511        settings: {
512          arrows: false,
513          dots: true
514        }
515      }
516    ]
517  })
518
519  $('.theme-1 .git-news-block .slider').slick({
520    autoplay: true,
521    autoplaySpeed: 3000,
522    centerMode: true,
523    centerPadding: '455px',
524    infinite: true,
525    slidesToShow: 1,
526    slidesToScroll: 1,
527    arrows: false,
528    dots: false,
529    responsive: [
530      {
531        breakpoint: 1601,
532        settings: {
533          centerPadding: '300px'
534        }
535      },
536      {
537        breakpoint: 1200,
538        settings: {
539          centerPadding: '200px'
540        }
541      },
542      {
543        breakpoint: 992,
544        settings: {
545          centerPadding: '100px'
546        }
547      },
548      {
549        breakpoint: 768,
550        settings: {
551          centerPadding: '40px'
552        }
553      },
554      {
555        breakpoint: 576,
556        settings: {
557          centerPadding: '20px'
558        }
559      }
560    ]
561  })
562
563  $('.theme-2 .git-news-block .slider').slick({
564    autoplay: true,
565    autoplaySpeed: 3000,
566    // centerMode: true,
567    infinite: true,
568    slidesToShow: 3,
569    slidesToScroll: 1,
570    arrows: false,
571    dots: true,
572    responsive: [
573      {
574        breakpoint: 768,
575        settings: {
576          slidesToShow: 2
577        }
578      },
579
580      {
581        breakpoint: 576,
582        settings: {
583          slidesToShow: 1
584        }
585      },
586      {
587        breakpoint: 576,
588        settings: {
589          // centerPadding: '20px',
590        }
591      }
592    ]
593  })
594
595  $('.theme-1 .git-book-block .slider').slick({
596    autoplay: true,
597    autoplaySpeed: 3000,
598    infinite: true,
599    slidesToShow: 5,
600    slidesToScroll: 5,
601    arrows: false,
602    dots: true,
603    responsive: [
604      {
605        breakpoint: 992,
606        settings: {
607          slidesToShow: 4,
608          slidesToScroll: 4
609        }
610      },
611      {
612        breakpoint: 768,
613        settings: {
614          variableWidth: false,
615          slidesToShow: 3,
616          slidesToScroll: 3
617        }
618      },
619      {
620        breakpoint: 576,
621        settings: {
622          variableWidth: false,
623          slidesToShow: 2,
624          slidesToScroll: 2
625        }
626      }
627    ]
628  })
629
630  $('.git-e-Learning-block .slider').slick({
631    autoplay: true,
632    autoplaySpeed: 3000,
633    centerMode: true,
634    // centerPadding: '60px',
635    infinite: true,
636    slidesToShow: 3,
637    slidesToScroll: 1,
638    arrows: false,
639    dots: true,
640    responsive: [
641      {
642        breakpoint: 768,
643        settings: {
644          slidesToShow: 1,
645          centerMode: false
646        }
647      }
648    ]
649  })
650
651  $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
652    $('.slider.default-slider').slick('setPosition')
653  })
654
655  $('.theme-2 .git-book-block .slider').slick({
656    autoplay: true,
657    autoplaySpeed: 3000,
658    infinite: true,
659    slidesToShow: 4,
660    slidesToScroll: 1,
661    arrows: false,
662    dots: true,
663    variableWidth: true,
664    responsive: [
665      {
666        breakpoint: 992,
667        settings: {
668          variableWidth: false
669        }
670      },
671      {
672        breakpoint: 768,
673        settings: {
674          variableWidth: false,
675          slidesToShow: 3,
676          slidesToScroll: 3
677        }
678      },
679      {
680        breakpoint: 576,
681        settings: {
682          variableWidth: false,
683          slidesToShow: 2,
684          slidesToScroll: 2
685        }
686      }
687    ]
688  })
689
690  $('.theme-3 .top-graphic .slider').slick({
691    autoplay: true,
692    autoplaySpeed: 4000,
693    infinite: false,
694    slidesToShow: 1,
695    slidesToScroll: 1,
696    arrows: true,
697    dots: true
698  })
699
700  $('.banner-block .slider').slick({
701    autoplay: true,
702    autoplaySpeed: 3000,
703    infinite: false,
704    slidesToShow: 1,
705    slidesToScroll: 1,
706    arrows: false,
707    dots: true
708  })
709
710  $('.update-block .slider').slick({
711    autoplay: true,
712    autoplaySpeed: 3000,
713    infinite: true,
714    slidesToShow: 3,
715    slidesToScroll: 3,
716    arrows: false,
717    dots: true,
718    responsive: [
719      {
720        breakpoint: 992,
721        settings: {
722          slidesToShow: 3
723        }
724      },
725      {
726        breakpoint: 768,
727        settings: {
728          slidesToShow: 2
729        }
730      },
731      {
732        breakpoint: 576,
733        settings: {
734          slidesToShow: 1
735        }
736      }
737    ]
738  })
739
740  $('.theme-1 .weblink-block .slider').slick({
741    autoplay: true,
742    autoplaySpeed: 3000,
743    infinite: true,
744    slidesToShow: 3,
745    slidesToScroll: 1,
746    arrows: false,
747    dots: true,
748    responsive: [
749      {
750        breakpoint: 1200,
751        settings: {
752          slidesToShow: 2
753        }
754      },
755      {
756        breakpoint: 992,
757        settings: {
758          slidesToShow: 3
759        }
760      },
761      {
762        breakpoint: 768,
763        settings: {
764          slidesToShow: 4
765        }
766      },
767      {
768        breakpoint: 576,
769        settings: {
770          slidesToShow: 3
771        }
772      }
773    ]
774  })
775
776  $('.theme-2 .weblink-block .slider').slick({
777    autoplay: true,
778    autoplaySpeed: 3000,
779    infinite: true,
780    slidesToShow: 6,
781    slidesToScroll: 1,
782    arrows: false,
783    dots: true,
784    responsive: [
785      {
786        breakpoint: 992,
787        settings: {
788          slidesToShow: 5
789        }
790      },
791      {
792        breakpoint: 768,
793        settings: {
794          slidesToShow: 4
795        }
796      },
797      {
798        breakpoint: 576,
799        settings: {
800          slidesToShow: 3
801        }
802      }
803    ]
804  })
805
806  $('.theme-3 .weblink-block .slider').slick({
807    autoplay: true,
808    autoplaySpeed: 3000,
809    infinite: true,
810    slidesToShow: 5,
811    slidesToScroll: 1,
812    arrows: false,
813    dots: true,
814    responsive: [
815      {
816        breakpoint: 992,
817        settings: {
818          slidesToShow: 4
819        }
820      },
821      {
822        breakpoint: 576,
823        settings: {
824          slidesToShow: 3
825        }
826      }
827    ]
828  })
829
830  $('.gallery-slider-for').slick({
831    slidesToShow: 1,
832    slidesToScroll: 1,
833    arrows: false,
834    fade: true,
835    asNavFor: '.gallery-slider-nav'
836  })
837
838  $('.gallery-slider-nav').slick({
839    infinite: false,
840    slidesToShow: 6,
841    slidesToScroll: 1,
842    asNavFor: '.gallery-slider-for',
843    dots: true,
844    // centerMode: true,
845    focusOnSelect: true,
846    responsive: [
847      {
848        breakpoint: 992,
849        settings: {
850          slidesToShow: 5
851        }
852      },
853      {
854        breakpoint: 768,
855        settings: {
856          slidesToShow: 4
857        }
858      },
859      {
860        breakpoint: 576,
861        settings: {
862          slidesToShow: 3
863        }
864      },
865      {
866        breakpoint: 426,
867        settings: {
868          slidesToShow: 2
869        }
870      }
871    ]
872  })
873
874  $('.info-block .slider').slick({
875    // autoplay: true,
876    // autoplaySpeed: 3000,
877    // infinite: true,
878    slidesToShow: 4,
879    slidesToScroll: 1,
880    arrows: false,
881    dots: false,
882    responsive: [
883      {
884        breakpoint: 576,
885        settings: {
886          slidesToShow: 1,
887          slidesToScroll: 1,
888          dots: true
889        }
890      },
891      {
892        breakpoint: 991,
893        settings: {
894          slidesToShow: 3,
895          slidesToScroll: 1,
896          dots: true
897        }
898      },
899      {
900        breakpoint: 1200,
901        settings: {
902          slidesToShow: 4,
903          slidesToScroll: 1
904        }
905      }
906    ]
907  })
908
909  $('.git-vdo-block .yt-frame').click(function () {
910    $(this).addClass('hide')
911    // $(".yt-frame .icon").addClass("d-none");
912    // $(".yt-frame .cover").addClass("d-none");
913  })
914
915  $('.default-nav-slider .item a').click(function () {
916    $('a').removeClass('active')
917    $(this).addClass('active')
918  })
919
920  $('.default-tab-slider .item .tab-block').click(function () {
921    $('.tab-block').removeClass('active')
922    $(this).addClass('active')
923  })
924
925  // add
926
927  $('.add-form-1').click(function () {
928    $('#add-form-1').addClass('d-block')
929    $('#add-form-1').removeClass('d-none')
930  })
931
932  $('.add-form-2').click(function () {
933    $('#add-form-2').addClass('d-block')
934    $('#add-form-2').removeClass('d-none')
935  })
936
937  $('.add-form-3').click(function () {
938    $('#add-form-3').addClass('d-block')
939    $('#add-form-3').removeClass('d-none')
940  })
941
942  $('.add-form-4').click(function () {
943    $('#add-form-4').addClass('d-block')
944    $('#add-form-4').removeClass('d-none')
945  })
946
947  $('.add-form-5').click(function () {
948    $('#add-form-5').addClass('d-block')
949    $('#add-form-5').removeClass('d-none')
950  })
951
952  $('.add-form-6').click(function () {
953    $('#add-form-6').addClass('d-block')
954    $('#add-form-6').removeClass('d-none')
955  })
956
957  // delete
958
959  $('.delete-form-1').click(function () {
960    $('#add-form-1').addClass('d-none')
961    $('#add-form-1').removeClass('d-block')
962  })
963
964  $('.delete-form-2').click(function () {
965    $('#add-form-2').addClass('d-none')
966    $('#add-form-2').removeClass('d-block')
967  })
968
969  $('.delete-form-3').click(function () {
970    $('#add-form-3').addClass('d-none')
971    $('#add-form-3').removeClass('d-block')
972  })
973
974  $('.delete-form-4').click(function () {
975    $('#add-form-4').addClass('d-none')
976    $('#add-form-4').removeClass('d-block')
977  })
978
979  $('.delete-form-5').click(function () {
980    $('#add-form-5').addClass('d-none')
981    $('#add-form-5').removeClass('d-block')
982  })
983
984  $('.delete-form-6').click(function () {
985    $('#add-form-6').addClass('d-none')
986    $('#add-form-6').removeClass('d-block')
987  })
988
989  $('.select-control').select2({
990    minimumResultsForSearch: -1
991  })
992
993  $('.select-control.filter').select2({
994    minimumResultsForSearch: -1
995  })
996
997  $('.select-control.select-year').select2({
998    theme: 'option-year',
999    minimumResultsForSearch: -1
1000  })
1001
1002  $('.select-control.select-gray').select2({
1003    theme: 'option-gray',
1004    minimumResultsForSearch: -1
1005  })
1006
1007  // Swal.fire({
1008  //     title: 'ยืนยันตัวตนผ่านอีเมล์',
1009  //     text: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry',
1010  //     icon: 'error',
1011  //     confirmButtonText: 'Cool'
1012  // })
1013
1014  function readURL(input, imgControlName) {
1015    if (input.files && input.files[0]) {
1016      var reader = new FileReader()
1017      reader.onload = function (e) {
1018        $(imgControlName).attr('src', e.target.result)
1019      }
1020      reader.readAsDataURL(input.files[0])
1021    }
1022  }
1023
1024  $('.git-service-block .topic').on('click', function () {
1025    if ($(this).hasClass('active')) {
1026      $(this).siblings('.sub-topic').slideUp()
1027      $(this).removeClass('active')
1028      // $('.dots-topic').addClass('active');
1029    } else {
1030      $('.sub-topic').slideUp()
1031      $('.topic').removeClass('active')
1032      $(this).siblings('.sub-topic').slideToggle()
1033      $(this).toggleClass('active')
1034      $('.dots-topic').removeClass('active')
1035    }
1036  })
1037})
1038
1039$('.notice-slide').slick({
1040  autoplay: true,
1041  autoplaySpeed: 4000,
1042  dots: false,
1043  infinite: true,
1044  arrows: true,
1045  speed: 2000,
1046  slidesToShow: 1,
1047  slidesToScroll: 1,
1048  responsive: [
1049    {
1050      breakpoint: 1024,
1051      settings: {
1052        slidesToShow: 1,
1053        slidesToScroll: 1
1054      }
1055    },
1056    {
1057      breakpoint: 600,
1058      settings: {
1059        slidesToShow: 1,
1060        slidesToScroll: 1
1061      }
1062    },
1063    {
1064      breakpoint: 480,
1065      settings: {
1066        slidesToShow: 1,
1067        slidesToScroll: 1
1068      }
1069    }
1070    // You can unslick at a given breakpoint now by adding:
1071    // settings: "unslick"
1072    // instead of a settings object
1073  ]
1074})
1075
1076$(function () {
1077  $('[data-toggle="tooltip"]').tooltip()
1078})
1079
1080// DEV
1081function numberWithCommas(number, str = null) {
1082  var yourNumber = Math.round(number)
1083  var n = yourNumber.toString().split('.')
1084  var number_empty = 0
1085  var number_return = 0
1086
1087  if (n[1]) {
1088    yourNumber = parseFloat(yourNumber).toFixed(2)
1089    var n = yourNumber.toString().split('.')
1090    //Comma-fies the first part
1091    n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
1092    //Combines the two sections
1093    number_empty = n.join('.')
1094  } else {
1095    var n = yourNumber.toString().split('.')
1096    //Comma-fies the first part
1097    n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
1098    //Combines the two sections
1099    number_empty = n.join('.')
1100    // return n.join(".");
1101  }
1102
1103  if (str != '' && str != null) {
1104    if (number_empty <= 0) {
1105      number_return = '-'
1106    } else {
1107      number_return = number_empty + ' ' + str
1108    }
1109  } else {
1110    if (str == null && number_empty <= 0) {
1111      number_return = '-'
1112    } else {
1113      number_return = number_empty
1114    }
1115  }
1116
1117  return number_return
1118}
1119
1120$(document).ready(function () {
1121  const scrollToTopBtn = $('#scrollToTopBtn')
1122  if (!scrollToTopBtn.length) return
1123
1124  let scrollTicking = false
1125  const handleScrollToTop = function () {
1126    if (!scrollTicking) {
1127      window.requestAnimationFrame(function () {
1128        if ($(window).scrollTop() > 40) {
1129          scrollToTopBtn.addClass('show')
1130        } else {
1131          scrollToTopBtn.removeClass('show')
1132        }
1133        scrollTicking = false
1134      })
1135      scrollTicking = true
1136    }
1137  }
1138
1139  $(window).on('scroll', handleScrollToTop)
1140  scrollToTopBtn.on('click', function () {
1141    $('html, body').animate({ scrollTop: 0 }, 800)
1142    return false
1143  })
1144
1145  //  $(".sc-git-chanel .nav-slider").slick({
1146  //   autoplay: false,
1147  //   dots: false,
1148  //   infinite: false,
1149  //   arrows: true,
1150  //   variableWidth: true,
1151  //   //  speed: 2000,
1152  //   slidesToShow: 8,
1153  //   //  slidesToScroll: 1,
1154  //   responsive: [
1155  //    {
1156  //     breakpoint: 575,
1157  //     settings: {
1158  //      slidesToShow: 3,
1159  //      slidesToScroll: 1,
1160  //     },
1161  //    },
1162  //    //  {
1163  //    //   breakpoint: 600,
1164  //    //   settings: {
1165  //    //    slidesToShow: 1,
1166  //    //    slidesToScroll: 1,
1167  //    //   },
1168  //    //  },
1169  //    //  {
1170  //    //   breakpoint: 480,
1171  //    //   settings: {
1172  //    //    slidesToShow: 1,
1173  //    //    slidesToScroll: 1,
1174  //    //   },
1175  //    //  },
1176  //   ],
1177  //  });
1178
1179  //  $(".sc-git-chanel .tab-content .slider").slick({
1180  //   autoplay: true,
1181  //   autoplaySpeed: 3000,
1182  //   infinite: false,
1183  //   slidesToShow: 1,
1184  //   slidesToScroll: 1,
1185  //   arrows: false,
1186  //   dots: true,
1187  //  });
1188
1189  //  $(
1190  //   ".sc-corporate-communication .tab-content .slider"
1191  //  ).slick({
1192  //   autoplay: true,
1193  //   infinite: true,
1194  //   dots: true,
1195  //   arrows: false,
1196  //   variableWidth: true,
1197  //   speed: 2000,
1198  //   slidesToShow: 2,
1199  //   responsive: [
1200  //    {
1201  //     breakpoint: 575,
1202  //     settings: {
1203  //      slidesToShow: 1,
1204  //      variableWidth: false,
1205  //     },
1206  //    },
1207  //    {
1208  //     breakpoint: 991,
1209  //     settings: {
1210  //      slidesToShow: 2,
1211  //      variableWidth: false,
1212  //     },
1213  //    },
1214  //   ],
1215  //  });
1216
1217  // edt js git ch yammy
1218
1219  $(document).ready(function () {
1220    const $navSlider = $('.sc-git-chanel .nav-slider')
1221    if ($navSlider.length && !$navSlider.hasClass('slick-initialized')) {
1222      $navSlider.slick({
1223        autoplay: false,
1224        dots: false,
1225        infinite: true,
1226        arrows: true,
1227        variableWidth: true,
1228        slidesToShow: 6,
1229        responsive: [
1230          {
1231            breakpoint: 575,
1232            settings: { slidesToShow: 3, slidesToScroll: 1 }
1233          }
1234        ]
1235      })
1236    }
1237
1238    const initTabSlider = function ($slider) {
1239      if ($slider.length && !$slider.hasClass('slick-initialized')) {
1240        $slider.slick({
1241          autoplay: true,
1242          autoplaySpeed: 3000,
1243          infinite: false,
1244          slidesToShow: 1,
1245          slidesToScroll: 1,
1246          arrows: false,
1247          dots: true
1248        })
1249      }
1250    }
1251
1252    const $activeTabSlider = $('.sc-git-chanel .tab-content.active .slider')
1253    if ($activeTabSlider.length) {
1254      initTabSlider($activeTabSlider)
1255    }
1256
1257    $('.sc-git-chanel .nav-slider .nav-link').on('shown.bs.tab', function () {
1258      const targetTab = $($(this).attr('href'))
1259      const slider = targetTab.find('.slider')
1260      if (slider.hasClass('slick-initialized')) {
1261        slider.slick('refresh')
1262      } else {
1263        initTabSlider(slider)
1264      }
1265    })
1266
1267    $('.sc-git-chanel .nav-slider .nav-link').on('click', function () {
1268      const targetTab = $($(this).attr('href'))
1269      const slider = targetTab.find('.slider')
1270      setTimeout(() => {
1271        if (slider.hasClass('slick-initialized')) {
1272          slider.slick('refresh')
1273        } else {
1274          initTabSlider(slider)
1275        }
1276      }, 200)
1277    })
1278  })
1279
1280  // edt js git ch yammy
1281
1282  $('.related-block-addon.info .related-slider').slick({
1283    autoplay: true,
1284    autoplaySpeed: 3000,
1285    slidesToShow: 3,
1286    slidesToScroll: 1,
1287    arrows: false,
1288    dots: false,
1289    responsive: [
1290      {
1291        breakpoint: 768,
1292        settings: {
1293          slidesToShow: 2,
1294          slidesToScroll: 1,
1295          dots: true
1296        }
1297      },
1298      {
1299        breakpoint: 576,
1300        settings: {
1301          slidesToShow: 1,
1302          slidesToScroll: 1,
1303          dots: true
1304        }
1305      }
1306    ]
1307  })
1308
1309  $('.related-block-addon:not(.info) .related-slider').slick({
1310    autoplay: true,
1311    autoplaySpeed: 3000,
1312    slidesToShow: 4,
1313    slidesToScroll: 4,
1314    arrows: false,
1315    dots: true,
1316    responsive: [
1317      {
1318        breakpoint: 768,
1319        settings: {
1320          slidesToShow: 2,
1321          slidesToScroll: 2
1322        }
1323      },
1324      {
1325        breakpoint: 576,
1326        settings: {
1327          slidesToShow: 1,
1328          slidesToScroll: 1
1329        }
1330      }
1331    ]
1332  })
1333})
1334
1335// $(".close-event").click(function () {
1336//  $(this)
1337//   .closest(".event-drop-show")
1338//   .addClass("visually-hidden");
1339// });
1340
1341// $(".event-more .-more").click(function () {
1342//  $(this)
1343//   .closest(".action")
1344//   .find(".event-drop-show")
1345//   .removeClass("visually-hidden");
1346//   $('.event-drop-show:not(.visually-hidden)').addClass('visually-hidden');
1347// });
1348
1349$('.sc-git-chanel .nav-link').click(function () {
1350  $(this).toggleClass('active')
1351  $('.sc-git-chanel .nav-link.active').removeClass('active')
1352})
1353
1354$('.iframe-container.vdo-mp4').click(function () {
1355  $('.play-button').addClass('hide')
1356})
1357
1358$('.collapse-box').each(function () {
1359  let acc = $(this)
1360  let btn = $(this).find('>.collapse-btn')
1361  let content = $(this).find('>.collapse-content')
1362
1363  content.hide()
1364
1365  if (acc.find('.collapse-content').length == 0) {
1366    acc.addClass('empty')
1367  }
1368
1369  if (btn.hasClass('active')) {
1370    $(this).parent().find(content).slideDown(200)
1371  }
1372
1373  btn.click(function () {
1374    if ($(this).hasClass('active')) {
1375      $(this).removeClass('active').parent().find(content).slideUp(200)
1376    } else {
1377      $(this).closest('.collapse-group').find('.collapse-btn').removeClass('active')
1378      $(this).closest('.collapse-group').find('.collapse-content').slideUp(200)
1379      $(this).addClass('active').parent().find(content).slideDown(200)
1380    }
1381    return false
1382  })
1383})
1384
1385function copyToClipboard(text, event) {
1386  navigator.clipboard.writeText(text).then(
1387    function () {
1388      // สร้าง element สำหรับแสดงข้อความแจ้งเตือน
1389      const toast = document.createElement('div')
1390      toast.className = 'toast-notification'
1391      toast.innerText = 'Copied to clipboard!'
1392
1393      // กำหนดตำแหน่งของ toast ใกล้กับปุ่มที่กด
1394      const rect = event.target.getBoundingClientRect()
1395      toast.style.position = 'absolute'
1396      toast.style.top = `${rect.top + window.scrollY - 30}px` // ด้านบนปุ่ม
1397      toast.style.left = `${rect.left + window.scrollX}px`
1398
1399      // ตรวจสอบว่ามี toast อยู่แล้วหรือไม่ และลบออกก่อนที่จะเพิ่มใหม่
1400      const existingToast = document.querySelector('.toast-notification')
1401      if (existingToast) {
1402        existingToast.remove()
1403      }
1404
1405      // เพิ่ม element ไปยัง body
1406      document.body.appendChild(toast)
1407
1408      // ลบ toast หลังจากแสดงผล
1409      setTimeout(() => {
1410        toast.classList.add('fade-out')
1411        toast.addEventListener('transitionend', () => toast.remove())
1412      }, 100000)
1413    },
1414    function (err) {
1415      console.error('Could not copy text: ', err)
1416    }
1417  )
1418}
1419
1420// เพิ่ม CSS สำหรับ toast notification
1421const style = document.createElement('style')
1422style.innerHTML = `
1423  .toast-notification {
1424    padding: 8px 12px;
1425    background-color: #2351d1;
1426    color: white;
1427    border-radius: 4px;
1428    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
1429    opacity: 1;
1430    transition: opacity 0.5s ease; 
1431    z-index: 1000;
1432    margin-top: -15px !important;
1433    margin-left: -65px !important;
1434  }
1435  .toast-notification.fade-out {
1436    opacity: 0;
1437  }
1438`
1439document.head.appendChild(style)
1440
1441$('.btn-toggle-social').click(function () {
1442  $(this).toggleClass('selected')
1443  $('.social-bar-addon .item-list').toggleClass('show')
1444})
1445
1446var windowSize = $(window).width()
1447if (windowSize <= 991) {
1448  $('.sc-corporate-communication .corporate-area-start .slider').slick({
1449    autoplay: false,
1450    infinite: false,
1451    dots: false,
1452    arrows: false,
1453    // variableWidth: true,
1454    speed: 2000,
1455    slidesToShow: 1,
1456    responsive: [
1457      {
1458        breakpoint: 991,
1459        settings: {
1460          slidesToShow: 1,
1461          dots: true
1462          //  variableWidth: false,
1463        }
1464      }
1465      //  {
1466      //   breakpoint: 991,
1467      //   settings: {
1468      //    slidesToShow: 2,
1469      //    variableWidth: false,
1470      //   },
1471      //  },
1472    ]
1473  })
1474}
1475document.querySelectorAll('.calendar-group-text').forEach(function (element) {
1476  const color = element.getAttribute('data-color')
1477  const pseudoBefore = window.getComputedStyle(element, '::before')
1478
1479  if (color) {
1480    element.style.setProperty('--pseudo-before-bg-color', color)
1481  }
1482})
1483
1484//  $(document).ready(function () {
1485// function initSwiper(){
1486//   const corporateSwiper = new Swiper(
1487//   ".sc-corporate-communication .swiper",
1488//   {
1489//     // centeredSlides: true,
1490//     watchSlidesProgress: true,
1491//     loop: true,
1492//     // slidesPerGroup: 1,
1493//     direction: "horizontal",
1494//     // initialSlide: 1,
1495//    pagination: {
1496//     el: ".swiper-pagination",
1497//     clickable: true,
1498//    },
1499//    breakpoints: {
1500//     0: {
1501//      spaceBetween: 15,
1502//      slidesPerView: 1,
1503//     },
1504//     768: {
1505//      spaceBetween: 20,
1506//      slidesPerView: 2,
1507//     },
1508//     992: {
1509//      spaceBetween: 20,
1510//      slidesPerView: 2,
1511//     },
1512//     1200: {
1513//      spaceBetween: 30,
1514//      slidesPerView: 2,
1515//     },
1516//    },
1517//   }
1518//  );
1519// }
1520// initSwiper()
1521// $('.sc-corporate-communication .nav-tabs .nav-link').click(function() {
1522//   // corporateSwiper.slideTo(0);
1523//   initSwiper();
1524
1525//   const corporateSwiper = new Swiper(
1526//     ".sc-corporate-communication .swiper",
1527//     {
1528//       // centeredSlides: true,
1529//       watchSlidesProgress: true,
1530//       loop: true,
1531//       // slidesPerGroup: 1,
1532//       direction: "horizontal",
1533//       // initialSlide: 1,
1534//      pagination: {
1535//       el: ".swiper-pagination",
1536//       clickable: true,
1537//      },
1538//      breakpoints: {
1539//       0: {
1540//        spaceBetween: 15,
1541//        slidesPerView: 1,
1542//       },
1543//       768: {
1544//        spaceBetween: 20,
1545//        slidesPerView: 2,
1546//       },
1547//       992: {
1548//        spaceBetween: 20,
1549//        slidesPerView: 2,
1550//       },
1551//       1200: {
1552//        spaceBetween: 30,
1553//        slidesPerView: 2,
1554//       },
1555//      },
1556//     }
1557//    );
1558
1559// });
1560
1561//   const corporateSwiper = new Swiper(
1562//     ".sc-corporate-communication .swiper",
1563//     {
1564//       // centeredSlides: true,
1565//       speed: 1000,
1566//       autoplay: {
1567//           delay: 2000,
1568//           disableOnInteraction: false,
1569//       },
1570//       watchSlidesProgress: true,
1571//       loop: true,
1572//       // slidesPerGroup: 1,
1573//       direction: "horizontal",
1574//       // initialSlide: 1,
1575//      pagination: {
1576//       el: ".swiper-pagination",
1577//       clickable: true,
1578//      },
1579//      breakpoints: {
1580//       0: {
1581//        spaceBetween: 15,
1582//        slidesPerView: 1,
1583//       },
1584//       768: {
1585//        spaceBetween: 20,
1586//        slidesPerView: 2,
1587//       },
1588//       992: {
1589//        spaceBetween: 20,
1590//        slidesPerView: 2,
1591//       },
1592//       1200: {
1593//        spaceBetween: 30,
1594//        slidesPerView: 2,
1595//       },
1596//      },
1597//     }
1598//    );
1599
1600//  });
1601
1602//  $(document).ready(function () {
1603//   var swiper1, swiper2;
1604
1605//   // เมื่อแท็บถูกแสดง, ให้ทำการตั้งตำแหน่งเริ่มต้นใหม่
1606//   $('.sc-corporate-communication .nav-tabs .nav-link').on('shown.bs.tab', function (e) {
1607//     var targetTab = $(e.target).attr('href'); // ดึงข้อมูลแท็บที่ถูกคลิก
1608
1609//     // ตรวจสอบว่า Swiper ถูกสร้างแล้วหรือยัง ถ้ายังให้สร้างใหม่
1610//     if (targetTab === "#COOP-203" && !swiper1) {
1611//       swiper1 = new Swiper('#COOP-203 .swiper-container', {
1612//         initialSlide: 0, // ตั้งให้เริ่มที่ slide ที่ 0
1613//         loop: true,
1614//         slidesPerView: 2,
1615//       });
1616//     }
1617//     if (targetTab === "#COOP-196" && !swiper2) {
1618//       swiper2 = new Swiper('#COOP-196 .swiper-container', {
1619//         initialSlide: 2, // ตั้งให้เริ่มที่ slide ที่ 1
1620//         loop: true,
1621//         slidesPerView:2,
1622//       });
1623//     }
1624
1625//     // ตั้งตำแหน่งสไลด์ที่ต้องการหลังจากที่แท็บเปิด
1626//     if (targetTab === "#COOP-203") {
1627//       swiper1.slideTo(0);  // ตั้งให้ Swiper ไปที่ slide 0
1628//     }
1629//     if (targetTab === "#COOP-196") {
1630//       swiper2.slideTo(1);  // ตั้งให้ Swiper ไปที่ slide 1
1631//     }
1632
1633//     // อัพเดต Swiper หลังจากการเปลี่ยนแท็บ
1634//     if (swiper1 && targetTab === "#COOP-203") {
1635//       swiper1.update();
1636//     }
1637//     if (swiper2 && targetTab === "#COOP-196") {
1638//       swiper2.update();
1639//     }
1640//   });
1641
1642//   // เปิดแท็บแรกเป็นค่าเริ่มต้น
1643//   $('.sc-corporate-communication .nav-tabs .nav-link:first').tab('show');
1644// });
1645
1646// ?##########  yam edt coop slide ####################
1647$(document).ready(function () {
1648  let corporateSwiper
1649
1650  function initializeSwiper() {
1651    const activeTab = $('.sc-corporate-communication .tab-pane.active.show')
1652    const swiperContainer = activeTab.find('.swiper')
1653    const slides = swiperContainer.find('.swiper-slide')
1654
1655    // console.log("slide count:", slides.length);
1656
1657    if (slides.length === 1) {
1658      // console.log("del done");
1659      swiperContainer.find('.swiper-slide-duplicate').remove()
1660    }
1661
1662    if (swiperContainer.hasClass('swiper-initialized')) {
1663      // console.log("update swip");
1664      swiperContainer[0].swiper.update()
1665    } else {
1666      corporateSwiper = new Swiper(swiperContainer[0], {
1667        watchSlidesProgress: true,
1668        loop: slides.length > 1,
1669        speed: 1000,
1670        autoplay: {
1671          delay: 2000,
1672          disableOnInteraction: false
1673        },
1674        pagination: {
1675          el: '.swiper-pagination',
1676          clickable: true
1677        },
1678        breakpoints: {
1679          0: {
1680            spaceBetween: 15,
1681            slidesPerView: 1
1682          },
1683          768: {
1684            spaceBetween: 20,
1685            slidesPerView: 2
1686          },
1687          992: {
1688            spaceBetween: 20,
1689            slidesPerView: 2
1690          },
1691          1200: {
1692            spaceBetween: 30,
1693            slidesPerView: 2
1694          }
1695        }
1696      })
1697    }
1698  }
1699
1700  if ($('.sc-corporate-communication').length > 0) {
1701    initializeSwiper()
1702  }
1703
1704  $('.sc-corporate-communication .nav-link').on('click', function () {
1705    const targetTab = $(this).attr('href')
1706    // console.log("tab:", targetTab);
1707
1708    setTimeout(function () {
1709      initializeSwiper()
1710    }, 200)
1711  })
1712}) // ?##########  yam edt coop slide ####################
1713
1714$('.sc-info .sc-git-chanel .nav-slider').slick({
1715  autoplay: false,
1716  dots: false,
1717  infinite: true,
1718  arrows: true,
1719  variableWidth: true,
1720  slidesToShow: 8,
1721  responsive: [
1722    {
1723      breakpoint: 575,
1724      settings: {
1725        slidesToShow: 3,
1726        slidesToScroll: 1
1727      }
1728    }
1729  ]
1730})
1731
1732$('.egp-tags .slider').slick({
1733  infinite: false,
1734  slidesToShow: 1,
1735  variableWidth: true,
1736  arrows: false,
1737  dots: true
1738})
1739
1740$('.egp-nav .nav-slider').slick({
1741  infinite: false,
1742  slidesToShow: 1,
1743  variableWidth: true,
1744  arrows: true,
1745  dots: false
1746})
1747
1748$('.egp-nav .nav-slider .item a').click(function () {
1749  $('a').removeClass('active')
1750  $(this).addClass('active')
1751})

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.