PageSourceSearch

https://atenshop.co.kr/app/javascript/js/skin-responsive.js?v=afe0eba294279d50c840

js atenshop.co.kr collected 2026-10-07 03:24:26 UTC 14,798 bytes, 487 lines download raw bytes

1function displaySearchFilter() {
2	displaySearchSellerFilter();
3	displaySearchDetailFilter();
4}
5/* +++++++++++++++++++++++ 검색 입력창 ++++++++++++++++++++++++ */
6//컬러 필터 - 255, 255, 255 --> border
7function filterSort(sVal, ulClassName) {
8	var ulObj = $('.' + ulClassName);
9	var items = ulObj.find('li').get();
10	items.sort(function (a, b) {
11		if (sVal == 'cntindex') {
12			var keyA = parseInt($(a).find("label").attr('data-cntindex'));
13			var keyB = parseInt($(b).find("label").attr('data-cntindex'));
14		} else {
15			var keyA = $(a).find("label").text();
16			var keyB = $(b).find("label").text();
17		}
18		if (keyB > keyA) return -1;
19		if (keyA > keyB) return 1;
20		return 0;
21	});
22	$.each(items, function (i, li) {
23		ulObj.append(li);
24	});
25}
26function searchObject() {
27	var uObj = {};
28	var iColor = 0;
29	var iDelivery = 0;
30	var iBrand = 0;
31	$("form#goodsSearchForm input[type='hidden']").each(function () {
32		var uObjName = '';
33		var regex = /color/gi;
34		var bColor = regex.exec($(this).attr('name'));
35		regex = /brand/gi;
36		var bBrand = regex.exec($(this).attr('name'));
37		regex = /delivery/gi;
38		var bDelivery = regex.exec($(this).attr('name'));
39		var sVal = $(this).val();
40		if (sVal && sVal != 'undefined') {
41			if (bColor) {
42				uObjName = $(this).attr('name').replace('\[\]', '\[' + iColor + '\]');
43				iColor++;
44			} else if (bDelivery) {
45				uObjName = $(this).attr('name').replace('\[\]', '\[' + iDelivery + '\]');
46				iDelivery++;
47			} else if (bBrand) {
48				uObjName = $(this).attr('name').replace('\[\]', '\[' + iBrand + '\]');
49				iBrand++;
50			} else {
51				uObjName = $(this).attr('name');
52			}
53			uObj[uObjName] = $(this).val();
54		}
55	});
56	$("form#goodsSearchForm select[name='per'] option").each(function () {
57		if ($(this).prop("selected")) uObj['per'] = $(this).val();
58	});
59	sVal = $("form#goodsSearchForm input[name='sorting']:checked").val();
60	if (sVal && sVal != 'undefined') {
61		uObj['sorting'] = sVal;
62	}
63	sVal = $("form#goodsSearchForm input[name='filter_display']:checked").val();
64	if (sVal && sVal != 'undefined') {
65		uObj['filter_display'] = sVal;
66	}
67
68	// 검색에 필요한 parameter 이외 다른 parameter 유지되도록 개선
69	var search = new URLSearchParams(window.location.search);
70	search.forEach(function (value, key) {
71		const isArrayParam = /^(brand|color|delivery)\[\d+\]$/.test(key);
72			if (typeof uObj[key] === "undefined" && !isArrayParam) {
73				uObj[key] = value;
74			}
75	});
76
77	return uObj;
78}
79/* +++++++++++++++++++++++ 검색 입력창 ++++++++++++++++++++++++ */
80
81/* +++++++++++++++++++++++ 최근 본 상품 ++++++++++++++++++++++++ */
82function todayViewRemove(bObj) {
83	var obj = $(bObj);
84	var uObj = { 'goods_seq': obj.parent().data('value') };
85	var postParams = jQuery.param(uObj);
86	$.ajax({
87		'type': "post",
88		'url': '/common/mybag_goods_today_del',
89		'data': postParams,
90		'async': false,
91		'dataType': 'json',
92		'success': function (result) {
93			obj.parent().remove();
94			todayViewList();
95		}
96	});
97}
98
99/* +++++++++++++++++++++++ 최근 본 상품 ++++++++++++++++++++++++ */
100/* +++++++++++++++++++++++ 최근 검색어 ++++++++++++++++++++++++ */
101function searchRecentRemove(bObj) {
102	var obj = $(bObj);
103	var oData = obj.data('value');
104	var uObj = { 'recent_seq': oData };
105	var postParams = jQuery.param(uObj);
106	$.ajax({
107		'type': "post",
108		'url': '/stats_process/search_recent_del',
109		'data': postParams,
110		'async': false,
111		'dataType': 'json',
112		'success': function (result) {
113			displaySearchRecentRemove(obj, oData);
114			searchRecentList();
115		}
116	});
117}
118function setRecentAuto(sMode) {
119	var sAuto = 'on';
120	var sToggle = 'off';
121	$.ajax({
122		'type': "get",
123		'url': '/stats/search_recent_auto',
124		'dataType': 'json',
125	})
126		.always(function (result) {
127			if (result.auto == 'off') sAuto = 'off';
128			if (sAuto == 'off') sToggle = 'on';
129			if (sMode == 'toggle') {
130				var uObj = { 'auto': sAuto };
131				var postParams = jQuery.param(uObj);
132				$.ajax({
133					'type': "post",
134					'url': '/stats_process/set_search_recent_auto',
135					'async': false,
136					'data': postParams,
137					'dataType': 'json',
138					'success': function (result) {
139						sAuto = sToggle;
140						displaySetRecentAuto(sAuto);
141					}
142				});
143			}
144		});
145}
146function showAutoComplete(sKeyword) {
147	var uObj = { 'keyword': sKeyword };
148	var postParams = jQuery.param(uObj);
149	$.ajax({
150		'type': "get",
151		'url': '/stats/search_auto_complete',
152		'async': true,
153		'data': postParams,
154		'dataType': 'json',
155		'success': function (result) {
156			displayShowAutoComplete(result);
157		}
158	});
159}
160//자동 검색 단어 선택
161function setAutoComplete(sKeyword) {
162	$('#searchVer2InputBox').val(sKeyword);
163	$("form#topSearchForm").submit();
164}
165function setUseAuto(sMode) {
166	var sAuto = 'on';
167	var sToggle = 'off';
168	$.ajax({
169		'type': "get",
170		'url': '/stats/use_auto_complete',
171		'dataType': 'json',
172	})
173		.always(function (result) {
174			if (result.auto == 'off') sAuto = 'off';
175			if (sAuto == 'off') sToggle = 'on';
176			if (sMode == 'toggle') {
177				var uObj = { 'auto': sAuto };
178				var postParams = jQuery.param(uObj);
179				$.ajax({
180					'type': "post",
181					'url': '/stats_process/set_use_auto_complete',
182					'async': false,
183					'data': postParams,
184					'dataType': 'json',
185					'success': function (result) {
186						sAuto = sToggle;
187					}
188				});
189			}
190			$('#autoCompleteArea .btnAutoComplete').hide();
191			if (sAuto == 'off') {
192				$('#autoCompleteArea .btnAutoComplete.on').show();
193				$('#autoCompleteList').hide();
194				$('#autoCompleteGuide').show();
195			} else {
196				$('#autoCompleteArea .btnAutoComplete.off').show();
197				$('#autoCompleteList').show();
198				$('#autoCompleteGuide').hide();
199			}
200		});
201}
202/* +++++++++++++++++++++++ 최근 검색어 ++++++++++++++++++++++++ */
203/* +++++++++++++++++++++++ 찜 ++++++++++++++++++++++++ */
204function setWish(bobj) {
205	var obj = $(bobj);
206	var sMember = obj.data('member');
207	var sGoods = obj.data('goods');
208	var sWish = obj.data('wish');
209	if (!sMember) {
210		//회원만 사용가능합니다.\n로그인하시겠습니까?
211		if (confirm(getAlert('gv009'))) {
212			top.document.location.href = "/member/login?return_url=" + document.location.href;
213			return;
214		} else {
215			return;
216		}
217	}
218
219	var url = '/mypage/wish_add?seqs[]=' + sGoods;
220	if (sWish == '1') {
221		url = '/mypage/wish_del?seqs=' + sGoods;
222	}
223
224	$.ajax({
225		'url': url,
226		'type': 'get',
227		'success': function (res) {
228			if (sWish == '1') {
229				obj.closest("div").find("img").hide();
230				obj.closest("div").find("img.zzimOffImg").show();
231				obj.closest("div").find("img").each(function () {
232					$(this).data('wish', '0');
233				});
234				$("#wish_alert .wa_msg").html(getAlert('gv057'));
235			} else {
236				obj.closest("div").find("img").hide();
237				obj.closest("div").find("img.zzimOnImg").show();
238				obj.closest("div").find("img").each(function () {
239					$(this).data('wish', '1');
240				});
241				$("#wish_alert .wa_msg").html(getAlert('gv056'));
242
243				// 채널톡 위시리스트 이벤트
244				if (typeof ChannelIO != 'undefined') {
245					channeltalk_wish_in(sGoods, 'setWish', obj);
246				}
247
248			}
249			$("#wish_alert").stop(true, true).show();
250			clearInterval(alert_timer);
251			alert_timer = setInterval(function () {
252				clearInterval(alert_timer);
253				$("#wish_alert").stop(true, true).show().fadeOut('slow');
254			}, 1000);
255		}
256	});
257}
258/* +++++++++++++++++++++++ 찜 ++++++++++++++++++++++++ */
259function searchParams() {
260	var uObj = searchObject();
261	return jQuery.param(uObj);
262}
263function resetParams() {
264	var uObj = searchObject();
265	var sUrl = '';
266	if (uObj.searchMode == 'catalog') {
267		sUrl = '../goods/catalog?category=' + uObj.category;
268	}
269	if (uObj.searchMode == 'brand') {
270		sUrl = '../goods/brand?brand[0]=' + uObj.brand[0];
271	}
272	if (uObj.searchMode == 'location') {
273		sUrl = '../goods/location?location=' + uObj.location;
274	}
275	if (uObj.searchMode == 'search') {
276		sUrl = '../goods/search?osearchtext=' + uObj.osearchtext;
277	}
278	if (uObj.searchMode == 'best') {
279		sUrl = '../goods/best';
280	}
281	if (uObj.searchMode == 'new_arrivals') {
282		sUrl = '../goods/new_arrivals';
283	}
284	if (uObj.searchMode == 'event_view') {
285		sUrl = '../promotion/event_view?event=' + uObj.event;
286	}
287	if (uObj.searchMode == 'gift_view') {
288		sUrl = '../promotion/gift_view?gfit=' + uObj.gfit;
289	}
290	if (uObj.searchMode == 'mshop') {
291		sUrl = '../mshop?provider=' + uObj.provider;
292	}
293	location.href = sUrl;
294}
295function link_navi(obj, sUrl) {
296	var sCode = '';
297	var naviObj = $(obj);
298	if (naviObj.find("option:selected").val()) {
299		sCode = naviObj.find("option:selected").val();
300	}
301	if (sCode) {
302		sUrl = sUrl + '?code=' + sCode;
303	} else {
304		sUrl = '/';
305	}
306
307	location.href = sUrl;
308}
309function set_classification(category_code, location_code) {
310	var getParams = searchParams();
311	var sSearchMode = $("input[name='searchMode']").val();
312	// 미니샵 페이지인 경우 처리 내역이 없어 스크립트 오류 발생
313	if(sSearchMode == 'mshop'){
314		return;
315	}
316	$.ajax({
317		'type': "get",
318		'url': '/goods/search_classification',
319		'data': getParams + '&classification=1&category_code=' + category_code + '&location_code=' + location_code,
320		'dataType': 'json',
321		'success': function (result) {
322			if (result === null) return;
323			if (result.navigation.navi) {
324				var oNavi = result.navigation.navi;
325				var sNaviLink = result.navigation.link;
326				if (typeof (oNavi.__proto__) !== "undefined") {
327					oNavi.__proto__ = null;
328				}
329				display_navi(oNavi, sNaviLink);
330			}
331			if (sSearchMode == 'brand' || (result.category && result.category.length > 0)) {
332				displaySetFilterCategoryPath(sSearchMode, sSearchMode, result.category);
333			}
334			displaySetFilterCategoryChild(result.category_child);
335
336			if (result.location && result.location.length > 0) {
337				displaySetFilterLocationPath(sSearchMode, sSearchMode, result.location);
338			}
339			displaySetFilterLocationChild(result.location_child);
340		}
341	});
342}
343
344$(function()
345{
346    // 테그 전체에 클릭 이벤트 발생할 경우 현재 scrolltop 획득하여 cookie에 저장
347    $(document).on('click', 'a', function ()
348    {
349        var scrollHeightPosition = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
350        setCookie("scroll_position", scrollHeightPosition);
351        return true;
352    });
353});
354
355function setCookie(cookieName, cookieValue, cookieExpire, cookiePath, cookieDomain, cookieSecure){
356    var cookieText= encodeURI(cookieName)+'='+ encodeURI(cookieValue);
357    cookieText+=(cookieExpire ? '; EXPIRES='+cookieExpire.toGMTString() : '');
358    cookieText+=(cookiePath ? '; PATH='+cookiePath : '');
359    cookieText+=(cookieDomain ? '; DOMAIN='+cookieDomain : '');
360    cookieText+=(cookieSecure ? '; SECURE' : '');
361    document.cookie=cookieText;
362}
363 
364function getCookie(cookieName){
365    var cookieValue=null;
366    if(document.cookie){
367        var array=document.cookie.split((encodeURI(cookieName)+'='));
368        if(array.length >= 2){
369            var arraySub=array[1].split(';');
370            cookieValue=encodeURIComponent(arraySub[0]);
371        }
372    }
373    return cookieValue;
374}
375
376function goodsSearch(mode,options) {
377	$("#searchedItemDisplay").html('<div style="height:100px;display:block"></div>');
378	loadingStart("#searchedItemDisplay", { segments: 12, width: 25.5, space: 6, length: 23, color: '#000000', speed: 1.5, valign: 'bottom' });
379
380	// 필터 선택 시 필터 선택된 영역 노출
381	if (typeof gl_searchFilterUse != 'undefined') {
382		if (gl_searchFilterUse == '0') {
383			$("#searchFilterSelected").hide();
384		} else if (gl_searchFilterUse == '1') {
385			$("#searchFilterSelected").show();
386		}
387	}
388
389	// 첫번째 페이지로 초기화
390	if (mode != 'auto') {
391		$('form#goodsSearchForm input[name="page"]').val('1');
392	}
393
394	// 상품 리스팅 영역 노출
395	var getParams = searchParams();
396	var trident = navigator.userAgent.match(/Trident\/(\d.\d)/i);
397	if (trident && trident[1] == "7.0") { // ie 9
398		window.location.pathname + '?' + getParams;
399	} else {
400		history.replaceState(null, null, '?' + getParams);
401	}
402
403	var uObj = searchObject();
404
405	if (mode == 'auto') {
406		getParams += "&auto=1";
407	}
408
409	$.ajax({
410		'type': "get",
411		'url': '/goods/search_list',
412		'data': getParams,
413		'async': true,
414		'dataType': 'html',
415		'success': function (result) {
416			$("#searchedItemDisplay").html(result);
417		},
418		'complete': function () {
419			// 상품 색상 코드값 디자인( new 상품정보 )
420			if ($('.displaY_color_option').length > 0) {
421				$('.displaY_color_option .areA').filter(function () {
422					return ($(this).css('background-color') == 'rgb(255, 255, 255)');
423				}).addClass('border');
424			}
425			// BEST 페이지 순위 아이콘 넣기
426			if ($('#searchedItemDisplay.best_page_ranking').length > 0) {
427				$('#searchedItemDisplay.best_page_ranking .item_img_area').each(function (e) {
428					var num = (uObj.per) * (uObj.page - 1) + e + 1;
429					var rank_icon = '<div class="item_rank"><span class="num">' + num + '</span>위</div>';
430					$(this).append(rank_icon);
431				});
432			}
433			loadingStop("#searchedItemDisplay", true);
434			if (typeof (options) !== "undefined") {
435				if (typeof (options.position_top) !== "undefined") {
436					$("html").scrollTop($("#"+options.position_top).offset().top);
437				}
438			}
439			else
440			{
441				var scrollPosition = getCookie("scroll_position"); // 쿠키의 내용을 불러오는 사용자 정의 함수
442				if (scrollPosition != "" && scrollPosition != 'undefined') {
443					window.scrollTo(0, scrollPosition); // 또는 body.scrollTop(scrollPosition);
444					// 쿠키 내용 초기화
445					setCookie("scroll_position", "");
446				}
447			}
448		}
449	});
450}
451
452function setFilterCategoryPath(filterName) {
453	var getParams = searchParams();
454	var sSearchMode = $("input[name='searchMode']").val();
455	set_classification(filterName, '');
456}
457
458function setFilterLocationPath(filterName) {
459	var getParams = searchParams();
460	var sSearchMode = $("input[name='searchMode']").val();
461	set_classification('', filterName);
462}
463
464function setFilterBrandPath() {
465	var getParams = searchParams();
466	var sSearchMode = $("input[name='searchMode']").val();
467	if (sSearchMode == 'brand') {
468		$.ajax({
469			'type': "get",
470			'url': '/goods/navi',
471			'data': getParams,
472			'dataType': 'html',
473			'success': function (tag) {
474				$(".search_nav").html(tag);
475				displaySearchBrandFilter();
476			}
477		});
478	}
479}
480
481function goodsSearchPage(page) {
482	$('form#goodsSearchForm input[name="page"]').val(page);
483	var options = {
484		'position_top' : 'goodsSearchForm',
485	};
486	goodsSearch('auto',options);
487}

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.