PageSourceSearch

https://tmglobal.com.my/themes/custom/Tm/lib/swipers.js?tljml2

js tmglobal.com.my collected 2026-10-04 10:41:26 UTC 6,359 bytes, 232 lines download raw bytes

1const mobile_min_width_size = 768;
2
3function getViewportSizes(){
4	const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
5	const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
6   	return {vw,vh};
7}
8
9var swiper_banner = null;
10var currentSize = "";
11
12var bannerResize = function () {
13  var viewPort = getViewportSizes();
14  var updatedSize = viewPort.vw >= mobile_min_width_size ? "desktop" : "mobile";
15
16  if (viewPort.vw >= mobile_min_width_size && updatedSize != currentSize) {
17    // REMOVE MOBILE SLIDES
18    jQuery('div[data-slide-type="mobile"]:not(.swiper-slide-duplicate)').removeClass("swiper-slide");
19
20    // ADD DESKTOP SLIDES
21    jQuery('div[data-slide-type="desktop"]:not(.swiper-slide-duplicate)').addClass("swiper-slide");
22
23    setTimeout(() => {
24      jQuery('div[data-slide-type="mobile"]:not(.swiper-slide-duplicate)').hide();
25      jQuery('div[data-slide-type="desktop"]:not(.swiper-slide-duplicate)').show();
26      swiper_banner?.destroy();
27      _initBannerSwiper();
28    }, 50);
29  } else if (viewPort.vw < mobile_min_width_size && updatedSize != currentSize) {
30    // REMOVE DESKTOP SLIDES
31    jQuery('div[data-slide-type="desktop"]:not(.swiper-slide-duplicate)').removeClass("swiper-slide");
32
33    // ADD MOBILE SLIDES
34    jQuery('div[data-slide-type="mobile"]:not(.swiper-slide-duplicate)').addClass("swiper-slide");
35
36    setTimeout(() => {
37      jQuery('div[data-slide-type="desktop"]:not(.swiper-slide-duplicate)').hide();
38      jQuery('div[data-slide-type="mobile"]:not(.swiper-slide-duplicate)').show();
39      swiper_banner?.destroy();
40      _initBannerSwiper();
41    }, 50);
42  }
43};
44
45var _initBannerSwiper = function () {
46  swiper_banner = new Swiper(".banner-swiper", {
47    // Optional parameters
48    direction: "horizontal",
49    loop: true,
50    autoplay: {
51      delay: 2000,
52    },
53    pagination: {
54      el: ".banner-pagination",
55      clickable: true,
56    },
57  });
58};
59
60var initBannerSwiper = function () {
61  bannerResize();
62};
63
64var swiper_WindowResizing = jQuery(window).resize(function () {
65  bannerResize();
66  setDesktopSize();
67});
68
69var setDesktopSize = function () {
70  var viewPort = getViewportSizes();
71  currentSize = viewPort.vw >= mobile_min_width_size ? "desktop" : "mobile";
72};
73
74jQuery(document).ready(function ($) {
75  initBannerSwiper();
76  const swiper_featured_article = new Swiper(".featured-article-cards-slider-mobile", {
77    // Optional parameters
78    direction: "horizontal",
79    loop: true,
80    autoplay: {
81      delay: 2000,
82    },
83    navigation: {
84      nextEl: ".swiper-button-next",
85      prevEl: ".swiper-button-prev",
86    },
87  });
88
89  const swiper_youtube = new Swiper(".youtube-swiper", {
90    // Optional parameters
91    direction: "horizontal",
92    loop: true,
93    autoplay: {
94      delay: 2000,
95    },
96    navigation: {
97      nextEl: ".vid-next",
98      prevEl: ".vid-prev",
99    },
100    pagination: {
101      el: ".swiper-pagination",
102    },
103  });
104
105  jQuery(".swiper-multiple-items").each(function () {
106    var thisE = $(this);
107    var addPlus = parseInt(thisE.data("plus-per-slide"));
108    const swiper_2_col = new Swiper(this, {
109      // Optional parameters
110      direction: "horizontal",
111      loop: false,
112      slidesPerView: 3 + addPlus,
113      breakpoints: {
114        769: {
115          slidesPerView: 4 + addPlus,
116        },
117        320: {
118          slidesPerView: 1 + addPlus,
119        },
120      },
121      spaceBetween: 5,
122      navigation: {
123        nextEl: ".multiple-items-next",
124        prevEl: ".multiple-items-prev",
125      },
126    });
127  });
128
129  $(".e-book-swiper").each(function (index, element) {
130    var $this = $(this);
131    var nextClass = ".e-book-next" + index;
132    // $this.find(".e-book-next")[0].classList.add(nextClass);
133    var prevClass = ".e-book-prev" + index;
134    // $this.find(".e-book-prev")[0].classList.add(prevClass);
135    var paginationClass = ".e-book-pagination" + index;
136    // $this.find(".e-book-pagination")[0].classList.add(paginationClass);
137    var slidesLength = $this.find(".swiper-slide").length;
138    var swiperOptions =
139      slidesLength > 2
140        ? {
141            direction: "horizontal",
142            loop: true,
143            autoplay: {
144              delay: 8000,
145            },
146            autoHeight : true,
147            slidesPerView: 2,
148            spaceBetween: 30,
149            slidesPerGroup: 2,
150            navigation: {
151              nextEl: ".e-book-next",
152              prevEl: ".e-book-prev",
153            },
154            pagination: {
155              el: ".e-book-pagination",
156              clickable: true,
157            },
158            breakpoints: {
159              769: {
160                slidesPerView: 2,
161                spaceBetween: 30,
162                slidesPerGroup: 2,
163              },
164              0: {
165                slidesPerView: 1,
166                spaceBetween: 30,
167                slidesPerGroup: 1,
168              },
169            },
170          }
171        : {
172            direction: "horizontal",
173            watchOverflow: true,
174            autoplay: {
175              delay: 8000,
176            },
177            autoHeight : true,
178            navigation: {
179              nextEl: ".e-book-next",
180              prevEl: ".e-book-prev",
181            },
182            pagination: {
183              el: ".e-book-pagination",
184              clickable: true,
185            },
186            breakpoints: {
187              769: {
188                slidesPerView: 2,
189                spaceBetween: 30,
190                slidesPerGroup: 2,
191              },
192              0: {
193                slidesPerView: 1,
194                spaceBetween: 30,
195                slidesPerGroup: 1,
196              },
197            },
198          };
199
200    var swiper = new Swiper(this, swiperOptions);
201  });
202
203  const swiper_events = new Swiper(".events-swiper", {
204    // Optional parameters
205    direction: "horizontal",
206    autoplay: {
207      delay: 3000,
208    },
209    pagination: {
210      el: ".event-paginator",
211      clickable: true,
212    },
213    navigation: {
214      nextEl: ".event-next",
215      prevEl: ".event-prev",
216    },
217  });
218  const swiper_articles = new Swiper(".articles-swiper", {
219    // Optional parameters
220    direction: "horizontal",
221    loop: true,
222    pagination: {
223      el: ".articles-pagination",
224      clickable: true,
225    },
226    navigation: {
227      nextEl: ".article-btn-next",
228      prevEl: ".article-btn-prev",
229    },
230  });
231
232});

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.