PageSourceSearch

https://on.com2us.com/wp-content/themes/com2uson/scripts/index.js?v=1790936606

js com2us.com collected 2026-10-02 10:24:23 UTC 10,656 bytes, 462 lines download raw bytes

1(function ($) {
2
3	if ($('body').hasClass('page-template-newsletter')) {
4		console.log('newsletter')
5		subscribe_newsletter();
6
7	}
8
9
10	function subscribe_newsletter() {
11		var subscribeForm = $("form.newsletter-subscribe"),
12			newsletterEmail = subscribeForm.find('[name="email"]'),
13			radioAgree = subscribeForm.find('[name="agree01"]'),
14			radioThirdAgree = subscribeForm.find('[name="agree02"]'),
15			checkAge = subscribeForm.find("#checkAge"),
16			checkRegistration = subscribeForm.find("#checkRegistration"),
17			btnSubmit = subscribeForm.find('[type="submit"]'),
18			newsletterModal = $("#newsletter-modal");
19
20		function openModal(message) {
21			console.log(message)
22			newsletterModal.find("h5.modal-message").text(message),
23				newsletterModal.modal("show")
24		}
25		subscribeForm.on("submit", function (e) {
26			e.preventDefault();
27			try {
28				var emailTrim = newsletterEmail.val().trim();
29				var emailTest = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(emailTrim);
30				var confirmCheckAge = checkAge.is(":checked");
31				var confirmcheckRegistration = checkRegistration.is(":checked");
32				var confirmRadioAgree = "agree" === radioAgree.filter(":checked").val();
33				var confirmRadioThirdAgree = "agree" === radioThirdAgree.filter(":checked").val();
34				if (!emailTest) {
35					throw "이메일주소를 확인하세요";
36				}
37				if (!confirmRadioAgree)
38					throw "개인정보 수집 및 이용 동의를 동의해주세요"
39
40				if (!confirmRadioThirdAgree)
41					throw "개인정보 제3자 제공 동의를 동의해주세요"
42
43				if (!confirmCheckAge)
44					throw "14세 이상만 구독할 수 있습니다.";
45				if (!confirmcheckRegistration)
46					throw "컴투스온 뉴스레터 정기구독 신청에 체크해주세요."
47
48			} catch (error) {
49				return void openModal(error)
50			}
51
52			$.ajax(subscribeForm.attr("action"), {
53				method: "post",
54				data: {
55					email: newsletterEmail.val()
56				},
57				beforeSend: function () {
58					btnSubmit.removeAttr("disabled", "disabled")
59				},
60				success: function () {
61					var message = newsletterEmail.val() + "로 확인 메일을 드렸습니다. 메일함을 확인해 주세요";
62					subscribeForm[0].reset(),
63						openModal(message)
64				},
65				error: function (e, t, a) {
66					alert(e.status + ": " + a),
67						btnSubmit.removeAttr("disabled")
68				}
69			})
70		});
71	}
72
73	$(window).scroll(function () {
74		if ($(this).scrollTop() > 500) {
75			$('#btn-totop').fadeIn();
76		} else {
77			$('#btn-totop').fadeOut();
78		}
79	});
80
81	$("#btn-totop").click(function () {
82		$('html, body').animate({
83			scrollTop: 0
84		}, 400);
85		return false;
86	});
87
88
89	var horizontalCarousel = function () {
90		var $carousel = $('.horizontal-carousel');
91		$carousel.find('.loop').addClass('swiper-slide');
92		var slide = new Swiper('.horizontal-carousel', {
93			loop: false,
94			slidesPerView: 1,
95			scrollbar: {
96				el: '.swiper-scrollbar',
97				hide: true,
98				draggable: false,
99			},
100			navigation: {
101				nextEl: ".swiper-button-next",
102				prevEl: ".swiper-button-prev",
103			},
104
105			autoplay: false,
106			autoplaySpeed: 5000,
107			breakpoints: {
108				360: {
109					slidesPerView: 1.2,
110					spaceBetween: 16,
111
112				},
113				768: {
114					slidesPerView: 2,
115					spaceBetween: 16,
116
117				},
118				1200: {
119					slidesPerView: 3,
120					spaceBetween: 40,
121				}
122			}
123		});
124
125
126	};
127	horizontalCarousel();
128
129
130	var relatedCarousel = function () {
131		var $carousel = $('.related-carousel');
132		$carousel.find('.loop').addClass('swiper-slide');
133		var slide = new Swiper('.related-carousel', {
134			loop: false,
135			slidesPerView: 1,
136			scrollbar: {
137				el: '.swiper-scrollbar',
138				hide: true,
139				draggable: false,
140			},
141			navigation: {
142				nextEl: ".swiper-button-next",
143				prevEl: ".swiper-button-prev",
144			},
145
146
147			autoplay: false,
148			autoplaySpeed: 5000,
149			breakpoints: {
150				360: {
151					slidesPerView: 1.2,
152					spaceBetween: 16,
153
154				},
155				768: {
156					slidesPerView: 2,
157					spaceBetween: 16,
158
159				},
160				1200: {
161					slidesPerView: 3,
162					spaceBetween: 25,
163				}
164			}
165		});
166
167
168	};
169	relatedCarousel();
170
171
172
173	var categoryCarousel = function () {
174		$('.category-carousel').slick({
175			asNavFor: '.category-carousel-title',
176			dots: false,
177			arrows: false,
178			infinite: true,
179		});
180		var $category = $('.category-carousel-title'),
181			options = {
182				asNavFor: '.category-carousel',
183				slidesToShow: 1,
184				prevArrow: '<span class="slick-prev slick-arrow svg-icon icon-left icon-small"></span>',
185				nextArrow: '<span class="slick-next slick-arrow svg-icon icon-right icon-small"></span>',
186				autoplay: false
187			};
188
189		if (!$category.length) {
190			return;
191		}
192
193		$category.slick(options);
194	};
195	categoryCarousel();
196
197
198
199	var toggleHamburgerScreen = function () {
200		$(document.body).on('click', '.header-hamburger', function (event) {
201			event.preventDefault();
202			var $el = $(this),
203				$screen = $('#' + $el.data('target'));
204			$screen.fadeToggle(function () {
205				$('.hamburger-menu', $screen).addClass('active');
206			});
207			$screen.addClass('open');
208
209		}).on('click', '#hamburger-fullscreen .button-close', function (event) {
210			event.stopPropagation();
211
212			var $el = $(this),
213				$screen = $('#hamburger-fullscreen');
214
215			$el.removeClass('active');
216			$screen.removeClass('open');
217
218			setTimeout(function () {
219				$screen.fadeOut();
220			}, 420);
221		});
222
223		if (typeof PerfectScrollbar !== 'undefined') {
224			var $hamburgerScreen = $('#hamburger-fullscreen');
225
226			if ($hamburgerScreen.length) {
227				new PerfectScrollbar($('.hamburger-screen-content', $hamburgerScreen).get(0));
228			}
229		}
230	};
231
232	toggleHamburgerScreen();
233
234
235	/**
236	 * Toggle off-screen panels
237	 */
238	var toggleOffCanvas = function () {
239		$(document.body).on('click', '[data-toggle="off-canvas"]', function (event) {
240			var target = '#' + $(this).data('target');
241			console.log(target);
242
243			if ($(target).hasClass('open')) {
244				closeOffCanvas(target);
245			} else if (openOffCanvas(target)) {
246				event.preventDefault();
247			}
248		}).on('click', '.offscreen-panel .button-close, .offscreen-panel .backdrop', function (event) {
249			event.preventDefault();
250
251			closeOffCanvas(this);
252		}).on('keyup', function (e) {
253			if (e.keyCode === 27) {
254				closeOffCanvas();
255			}
256		});
257	};
258
259
260	var openOffCanvas = function (target) {
261		var $target = $(target);
262
263		if (!$target.length) {
264			return false;
265		}
266
267		$target.fadeIn();
268		$target.addClass('open');
269
270		$(document.body).addClass('offcanvas-opened ' + $target.attr('id') + '-opened').trigger('dbd_off_canvas_opened', [$target]);
271
272		return true;
273	}
274
275
276	var closeOffCanvas = function (target) {
277		if (!target) {
278			$('.offscreen-panel').each(function () {
279				var $panel = $(this);
280
281				if (!$panel.hasClass('open')) {
282					return;
283				}
284
285				$panel.removeClass('open').fadeOut();
286				$(document.body).removeClass($panel.attr('id') + '-opened');
287			});
288		} else {
289			target = $(target).closest('.offscreen-panel');
290			target.removeClass('open').fadeOut();
291
292			$(document.body).removeClass(target.attr('id') + '-opened');
293		}
294
295		$(document.body).removeClass('offcanvas-opened').trigger('dbd_off_canvas_closed', [target]);
296
297
298	}
299
300
301	toggleOffCanvas();
302
303
304	var HamburgerMenu = function () {
305		$(document.body).on('click', '.header-hamburger', function (event) {
306
307			event.preventDefault();
308			var $el = $(this),
309				$screen = $('#' + $el.data('target'));
310
311
312			$screen.fadeToggle(function () {
313				$('.hamburger-menu', $screen).addClass('active');
314			});
315			$screen.addClass('open');
316
317
318
319		}).on('click', '#hamburger-fullscreen .button-close', function (event) {
320			event.stopPropagation();
321
322			var $el = $(this),
323				$screen = $('#hamburger-fullscreen');
324
325			$el.removeClass('active');
326			$screen.removeClass('open');
327
328			setTimeout(function () {
329				$screen.fadeOut();
330			}, 420);
331		});
332
333	};
334	HamburgerMenu();
335
336	var mobileMenu = function () {
337		var $mobileMenu = $('#mobile-menu');
338		$mobileMenu.find('')
339
340
341		$mobileMenu.find('.menu > .menu-item-has-children, .menu > li > ul > .menu-item-has-children').filter(function () {
342			return $(this).hasClass('current-menu-item') || $(this).hasClass('current-menu-ancestor');
343		}).addClass('open');
344
345		$mobileMenu.on('click', '.menu-item-has-children > a', function (event) {
346			var $li = $(this).parent();
347
348			if ($li.hasClass('open') && $li.hasClass('clicked') && '#' !== $(this).attr('href')) {
349				return true;
350			}
351
352			event.stopPropagation();
353			event.preventDefault();
354
355			$li.addClass('clicked');
356
357			$li.toggleClass('open').children('ul').slideToggle();
358			$li.siblings('.open').removeClass('open clicked').children('ul').slideUp();
359		}).on('click', '.menu-item-has-children > .toggle', function (event) {
360			event.stopPropagation();
361			event.preventDefault();
362
363			var $li = $(this).parent();
364
365			$li.toggleClass('open').children('ul').slideToggle();
366			$li.siblings('.open').removeClass('open').children('ul').slideUp();
367		});
368
369
370		$mobileMenu.on('click', '[data-toggle="off-canvas"], [data-toggle="modal"]', function () {
371			if ('mobile-menu' !== $(this).data('target')) {
372				closeModal();
373				closeOffCanvas();
374			}
375		});
376	};
377
378	mobileMenu();
379
380
381
382
383	/**
384	 * Toggle modals.
385	 */
386	var toggleModals = function () {
387		$(document.body).on('click', '[data-toggle="modal"]', function (event) {
388			var target = '#' + $(this).data('target');
389
390			if ($(target).hasClass('open')) {
391				closeModal(target);
392			} else if (openModal(target)) {
393				event.preventDefault();
394			}
395		}).on('click', '.modal .button-close, .modal .backdrop', function (event) {
396			event.preventDefault();
397
398			closeModal(this);
399		}).on('keyup', function (e) {
400			if (e.keyCode === 27) {
401				closeModal();
402			}
403		});
404	};
405
406	toggleModals();
407	/**
408	 * Open a modal.
409	 *
410	 * @param string target
411	 */
412	var openModal = function (target) {
413
414		var $target = $(target);
415
416
417		var $search = $target.find('input.search-field');
418		if (!$target.length) {
419			return false;
420		}
421
422		$target.fadeIn();
423		$target.addClass('open');
424
425		$search.focus();
426		$(document.body).addClass('modal-opened ' + $target.attr('id') + '-opened').trigger('modal_opened', [$target]);
427		return true;
428	}
429	openModal();
430
431	/**
432	 * Close a modal.
433	 *
434	 * @param string target
435	 */
436	var closeModal = function (target) {
437		if (!target) {
438			$('.modal').removeClass('open').fadeOut();
439
440			$('.modal').each(function () {
441				var $modal = $(this);
442
443				if (!$modal.hasClass('open')) {
444					return;
445				}
446
447				$modal.removeClass('open').fadeOut();
448				$(document.body).removeClass($modal.attr('id') + '-opened');
449			});
450		} else {
451			target = $(target).closest('.modal');
452			target.removeClass('open').fadeOut();
453
454			$(document.body).removeClass(target.attr('id') + '-opened');
455		}
456
457		$(document.body).removeClass('modal-opened').trigger('modal_closed', [target]);
458	}
459	closeModal();
460
461
462})(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.