PageSourceSearch

https://www.dailynews.co.th/wp-content/themes/hello-theme-child/assets/js/home_r2.js?ver=v3

js dailynews.co.th collected 2026-09-24 09:27:13 UTC 9,491 bytes, 386 lines download raw bytes

1jQuery.noConflict();
2(function ($) {
3
4	var api = {
5		'GOLD': 'https://newsapi.dailynews.co.th/dailynews-api/gold',
6		'GOLDYLG': 'https://newsapi.dailynews.co.th/dailynews-api/goldylg',
7		'EXCHANGE_RATE': 'https://newsapi.dailynews.co.th/dailynews-api/exchangeRate',
8		'LOTTERY': 'https://www.dailynews.co.th/wp-json/acf/v3/lotto?orderby=draw_date&per_page=1',
9		'OIL': 'https://newsapi.dailynews.co.th/dailynews-api/oil',
10	};
11
12	jQuery('#sc-hotnews .elementor-post__excerpt p').each(function () {
13		if (jQuery(this).text().length > 90) {
14			var hotnewExcerpt = jQuery(this).text().substring(0, 90);
15			jQuery(this).text(hotnewExcerpt);
16			jQuery('<span>...</span>').appendTo(jQuery(this));
17		}
18
19	});
20	jQuery('#sc-hotnews .elementor-posts-container').addClass('swiper-wrapper');
21
22	jQuery('#sc-hotnews .elementor-posts-container > article').each(function () {
23		jQuery(this).addClass('swiper-slide');
24	})
25
26	let swiper_news = new Swiper('.breaking-news-carousel', {
27		pagination: {
28			el: '.breaking-news-swiper-pagination',
29			clickable: true,
30		},
31		navigation: {
32			nextEl: '.breaking-news-swiper-button-next',
33			prevEl: '.breaking-news-swiper-button-prev',
34		},
35		spaceBetween: 0,
36		speed: 1000,
37		roundLengths: true,
38		loop: true,
39		loopAdditionalSlides: 10,
40		autoplay: {
41			delay: 5000,
42			disableOnInteraction: false,
43		},
44		// 		simulateTouch: false,
45		direction: 'horizontal',
46		// 		parallax: true,
47		freeMode: false,
48		fade: {
49			crossFade: true,
50		},
51		allowSwipeToPrev: true,
52		roundLengths: false,
53		effect: 'slide', //use cube,flip,coverflow or fade
54		breakpoints: {
55			// when window width is >= 320px
56			320: {
57				slidesPerView: 1,
58				spaceBetween: 0
59			},
60			// when window width is >= 640px
61			640: {
62				slidesPerView: 1.8, //use any number 1.8 or 4.2 or 7.3 etc..
63				centeredSlides: true,
64				spaceBetween: 0
65			}
66		}
67	});
68
69
70
71	let swiper = new Swiper('.sc-hotnews-carousel-wrapper .elementor-widget-container', {
72		navigation: {
73			nextEl: '.swiper-nav-hotnews-next',
74			prevEl: '.swiper-nav-hotnews-prev',
75		},
76		pagination: {
77			el: '#sc-hotnews .swiper-pagination',
78			clickable: true
79		},
80		spaceBetween: 0,
81		speed: 1000,
82		roundLengths: true,
83		loop: true,
84		loopAdditionalSlides: 10,
85		autoplay: {
86			delay: 5000,
87			disableOnInteraction: false,
88		},
89		simulateTouch: false,
90		direction: 'horizontal',
91		parallax: true,
92		freeMode: false,
93		fade: {
94			crossFade: true,
95		},
96		allowSwipeToPrev: true,
97		roundLengths: false,
98		effect: 'slide', //use cube,flip,coverflow or fade
99		breakpoints: {
100			// when window width is >= 320px
101			320: {
102				slidesPerView: 1,
103				spaceBetween: 0
104			},
105			// when window width is >= 640px
106			640: {
107				slidesPerView: 1.8, //use any number 1.8 or 4.2 or 7.3 etc..
108				centeredSlides: true,
109				spaceBetween: 0
110			}
111		}
112	});
113
114	jQuery('.highlight-news-carousel-section .elementor-posts-container').addClass('swiper-wrapper');
115
116	jQuery('.highlight-news-carousel-section .elementor-posts-container > article').each(function () {
117		jQuery(this).addClass('swiper-slide');
118	})
119
120	let highLightSwiper = new Swiper('.highlight-news-carousel-wrapper .elementor-widget-container', {
121		navigation: {
122			nextEl: '.swiper-hightlight-button-next',
123			prevEl: '.swiper-hightlight-button-prev',
124		},
125		pagination: {
126			el: '.kaoden-pagination .swiper-pagination',
127		},
128		slidesPerView: 1,
129		loop: true,
130		speed: 1000,
131		autoplay: {
132			delay: 3000,
133			disableOnInteraction: false,
134		},
135	});
136
137	let highLightSwiper2 = new Swiper('.today-news-carousel', {
138		navigation: {
139			nextEl: '.today-news-swiper-button-next',
140			prevEl: '.today-news-swiper-button-prev',
141		},
142		pagination: {
143			el: '.today-news-swiper-pagination',
144			clickable: true,
145		},
146		slidesPerView: 1,
147		loop: true,
148		speed: 1000,
149		autoplay: {
150			delay: 3000,
151			disableOnInteraction: false,
152		},
153	});
154
155	$('.hp-latestnews .elementor-posts-container article').each(function () {
156		$(this).find('.elementor-post__meta-data').prependTo($(this).find('.elementor-post__text'));
157	});
158
159	async function displayExchangeRate() {
160		const currencies = ["USD", "GBP", "CNY", "EUR", "JPY", "HKD"];
161		const response = await axios.get(api.EXCHANGE_RATE).then(res => {
162			const currencyItems = res.data.response;
163			// 			let usdItem = currencies.map((currency) => currencyItems.filter( (item) => item.NAME === currency ));
164			// 			console.log(usdItem);
165			// 			document.getElementById('exchange-wrapper').innerHTML = usdItem;
166			let tableExchange = document.getElementById('exchange-table');
167			currencyItems.map((item) => {
168				let td = '<tr>'
169					+ '<td><img src="' + item.ICON + '" class="img-flag">' + item.NAME + '</td>'
170					+ '<td>' + parseFloat(item.BUY).toFixed(2) + '</td>'
171					+ '<td>' + parseFloat(item.SELL).toFixed(2) + '</td>'
172					+ '</tr>';
173				$('#exchange-table').append(td);
174			});
175
176		}).catch(err => {
177			console.log(err);
178		})
179
180	}
181
182	async function displayOilPrice() {
183		const response = await axios.get(api.OIL).then(res => {
184			const data = res.data.response.data;
185			let table = $('#oil-price-table ul');
186			data.items.map((item) => {
187				let td = '<li>'
188					+ '<span><img src="' + item.Icon + '" class="img-flag"></span>'
189					+ '<p>' + item.PriceToday + '</p>'
190					+ '<p>' + item.PriceTomorrow + '</p>'
191					+ '</li>';
192				table.append(td);
193			});
194			table.append('<li><small>' + data.remark_th + '</small></li>')
195
196//			$('#oil-price-table #logo').attr('src', data.bankchak_logo)
197//			$('#oil-price-table #date-time')[0].innerText = data.update_date
198
199		}).catch(err => {
200			console.log(err);
201		})
202
203	}
204
205	$(function () {
206		displayExchangeRate();
207		displayOilPrice();
208	})
209
210 	var goldRate = new Vue({
211 		el: '.gold-rate-container',
212 		data: {
213 			res: null,
214 			loading: true,
215 			gold_price: {
216 				buy: '',
217 				sell: '',
218 			},
219 			gold_bar_price: {
220 				buy: '',
221 				sell: '',
222 			},
223 		},
224 		watch: {
225 			res(newValue, oldValue) {
226 				this.gold_price = this.res.price.gold
227 				this.gold_bar_price = this.res.price.gold_bar
228 			}
229 		},
230 		mounted: async function () {
231 			this.loading = true;
232 			const { data } = await axios.get(api.GOLD)
233
234 			this.res = await data.response
235 			this.loading = false;
236 		},
237 	});
238	
239	var goldYlgRate = new Vue({
240		el: '.goldylg',
241		data: {
242			res: {
243				asso: {
244					tin: 0,
245					'tin-ico': '',
246					tout: 0,
247					'tout-ico': '',
248				},
249				spot: {
250					tin: 0,
251					'tin-ico': '',
252					tout: 0,
253					'tout-ico': '',
254				},
255				bar99: {
256					tin: 0,
257					'tin-ico': '',
258					tout: 0,
259					'tout-ico': '',
260				},
261				orna99: {
262					tin: 0,
263					'tin-ico': '',
264					tout: 0,
265					'tout-ico': '',
266				},
267				bar96: {
268					tin: 0,
269					'tin-ico': '',
270					tout: 0,
271					'tout-ico': '',
272				},
273				orna96: {
274					tin: 0,
275					'tin-ico': '',
276					tout: 0,
277					'tout-ico': '',
278				},
279				update_date: '',
280				update_at: {
281					date: '',
282					time: '',
283				},
284			},
285			loading: true,
286		},
287// 		watch: {
288// 			res(newValue, oldValue) {
289// 				this.gold_price = this.res.price.gold
290// 				this.gold_bar_price = this.res.price.gold_bar
291// 			}
292// 		},
293		methods: {
294			formatPrice: function (price) {
295				return price.toLocaleString(undefined, {
296					minimumFractionDigits: 2,
297					maximumFractionDigits: 2,
298				});
299			},
300			getDirectionClass: function (direction) {
301				return `fas fa-caret-${direction}`;
302			},
303		},
304		mounted: async function () {
305			this.loading = true;
306			const { data } = await axios.get(api.GOLDYLG)
307			this.res = await data.response
308			this.loading = false;
309		},
310	});
311
312	var lottery = new Vue({
313		el: '.elementor-4114',
314		data: {
315			res: null,
316			loading: true,
317			first_prize: '',
318			last_2_digit: '',
319			first_3_digit: '',
320			last_3_digit: '',
321			drawDate: '',
322			records: null,
323		},
324		watch: {
325			records: function () {
326				this.first_prize = String(this.records['รางวัลที่1'])
327				this.last_2_digit = String(this.records['รางวัลเลขท้าย 2 ตัว'])
328				this.first_3_digit = this.records['รางวัลเลขหน้า 3 ตัว']
329				this.last_3_digit = this.records['รางวัลเลขท้าย 3 ตัว']
330			},
331			res: function () {
332				this.drawDate = new Date(this.res.draw_date).toLocaleDateString('th-TH', {
333					year: 'numeric',
334					month: 'long',
335					day: 'numeric'
336				});
337
338				const csvUrl = this.res.file.url;
339
340				const headers = [
341					'รางวัลที่1',
342					'รางวัลเลขท้าย 3 ตัว',
343					'รางวัลเลขหน้า 3 ตัว',
344					'รางวัลเลขท้าย 2 ตัว',
345					'รางวัลพิเศษชุดที่',
346					'รางวัลพิเศษ',
347					'รางวัลที่2',
348					'รางวัลที่3',
349					'รางวัลที่4',
350					'รางวัลที่5',
351				];
352
353				Papa.parse(csvUrl, {
354					download: true,
355					skipEmptyLines: true,
356					fastMode: true,
357					complete: (result) => {
358						const records = result.data;
359						const results = {};
360
361						for (let h = 0; h < headers.length; h++) {
362							results[headers[h]] = [];
363						}
364
365						for (let i = 1; i < records.length; i++) {
366							for (let j = 0; j < records[i].length; j++) {
367								if (records[i][j]) {
368									results[headers[j]].push(records[i][j]);
369								}
370							}
371						}
372
373						this.records = results;
374					},
375				});
376			},
377		},
378		mounted: async function () {
379			this.loading = true;
380			const { data } = await axios.get(api.LOTTERY);
381
382			this.res = data[0].acf;
383			this.loading = false;
384		},
385	});
386})(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.