PageSourceSearch

https://spsamhwa.com/app/themes/sknk/src/mobile/js/_system/utils.custom.js?ver=1791588910

js spsamhwa.com collected 2026-10-09 23:36:09 UTC 11,787 bytes, 388 lines download raw bytes

1// developer util : this site only
2$(function(){
3	// select box set default
4	$('.fake_select[data-search-select] span').each(function(){
5		$(this).text($(this).next("select").find('option:selected').text());
6	});
7	$('.fake_select[data-search-select]').on('change',function(){
8		$(this).parents("form").submit();
9	});
10});
11
12// ################### ajax 페이지 호출
13var CALL_AJAX_PAGE = function(argThisVar){
14	var oThis = this;
15	var oThisName = argThisVar?argThisVar:"";//callAjax
16
17	// ### 사업장 목록
18	oThis.getBizPlaceList = function ($container){
19		var cate = $container.attr("data-biz-place-cate");
20		var inquiry = $container.attr("data-biz-place-inquiry");
21		var	url = "/ko/ajax/biz_place_list.ajax.asp?ts=" + new Date().getTime();
22		var data = {
23				"qCate" : cate,
24				"qInquiry" : inquiry
25			};
26		$.ajax({
27			"url": url ,
28			"data" : data,
29			"dataType" : "html",
30			"method": "POST",
31			"success" : function(html){
32				$container.html(html);
33			} ,
34			"error" : function(){
35				var btnRefresh="";
36				if (oThisName){
37					btnRefresh = '<br><a href="javascript:'+oThisName+'.getBizPlaceList($(\'[data-biz-place-cate='+cate+']\'));">[새로고침]</a>';
38				}
39				$container.html('<ul><li class="no-data">데이터 로딩에 실패하였습니다.<br>잠시후에 다시 시도해 주세요.'+btnRefresh+'</li></ul>');
40			}
41		});
42	}
43
44	// ### 뉴스레터 구독신청 폼
45	oThis.getNewsletterRequestForm = function (){
46		var $container = $("#popRequestNewsletter");
47
48		/*
49		if ($container.length > 0)
50			return;
51		*/
52		if ($container.length > 0)
53			$container.remove();
54
55		var	url = "/ko/ajax/newsletter_request_form.ajax.asp?ts=" + new Date().getTime();
56		$.ajax({
57			"url": url ,
58			"data" : null,
59			"dataType" : "html",
60			"method": "POST",
61			"success" : function(html){
62				$("body").append(html);
63			} ,
64			"error" : function(){
65				alert("화면 로딩에 실패하엿습니다. 잠시후에 다시 시도해주세요.");
66			}
67		});
68
69	}
70
71	// ### IR미팅 신청 폼
72	oThis.getIRMeetingRequestForm = function (idx, pwd){
73		var $container = $("#popRequestIRMeeting");
74
75		if ($container.length > 0)
76			$container.remove();
77			
78		//var	url = "/ko/ajax/ir_meeting_Request_Form.ajax.asp?ts=" + new Date().getTime();
79		var	url = "./ajax/ir_meeting_request_form.ajax.asp?ts=" + new Date().getTime();
80		$.ajax({
81			"url": url ,
82			"data" : {"idx":idx,"pwd":pwd},
83			"dataType" : "html",
84			"method": "POST",
85			"success" : function(html){
86				$("body").append(html);
87			} ,
88			"error" : function(){
89				alert("화면 로딩에 실패하엿습니다. 잠시후에 다시 시도해주세요.");
90			}
91		});
92
93	}
94
95}
96
97// ################### 다음 우편번호 검색
98var getDaumPostcode =  function() {
99	var oThis = this;
100	var containerID = "daumZipcode";
101	var popID = "popDaumZipcode";
102
103	// ### 우편번호 로드
104	oThis.loadMap = function(){
105		popOpen('#'+popID,'#btnFindAddr');
106		$("#"+containerID).html("");
107
108		// 우편번호 찾기 화면을 넣을 element
109		var element_wrap = document.getElementById(containerID);
110
111		// 현재 scroll 위치를 저장해놓는다.
112		var currentScroll = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
113		new daum.Postcode({
114			oncomplete: function(data) {
115				// 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분.
116
117				// 도로명 주소의 노출 규칙에 따라 주소를 표시한다.
118				// 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다.
119				var roadAddr = data.roadAddress; // 도로명 주소 변수
120				var extraRoadAddr = ''; // 참고 항목 변수
121
122				// 법정동명이 있을 경우 추가한다. (법정리는 제외)
123				// 법정동의 경우 마지막 문자가 "동/로/가"로 끝난다.
124				if(data.bname !== '' && /[동|로|가]$/g.test(data.bname)){
125					extraRoadAddr += data.bname;
126				}
127				// 건물명이 있고, 공동주택일 경우 추가한다.
128				if(data.buildingName !== '' && data.apartment === 'Y'){
129				   extraRoadAddr += (extraRoadAddr !== '' ? ', ' + data.buildingName : data.buildingName);
130				}
131				// 표시할 참고항목이 있을 경우, 괄호까지 추가한 최종 문자열을 만든다.
132				if(extraRoadAddr !== ''){
133					extraRoadAddr = ' (' + extraRoadAddr + ')';
134				}
135
136				// 우편번호와 주소 정보를 해당 필드에 넣는다.
137				$("#zipcode").val(data.zonecode);
138				if(roadAddr !== ''){
139					// 도로명주소
140					$("#addr1").val(roadAddr+extraRoadAddr);
141					//$("#addr2").val(extraRoadAddr);
142				}else{
143					// 지번주소
144					$("#addr1").val(data.jibunAddress);
145					//$("#addr2").val("");
146				}
147
148				// iframe을 넣은 element를 안보이게 한다.
149				// (autoClose:false 기능을 이용한다면, 아래 코드를 제거해야 화면에서 사라지지 않는다.)
150				element_wrap.style.display = 'none';
151
152				// 우편번호 찾기 화면이 보이기 이전으로 scroll 위치를 되돌린다.
153				document.body.scrollTop = currentScroll;
154
155				$("#"+popID+" .ui-pop-close:eq(0)").click();
156			},
157			// 우편번호 찾기 화면 크기가 조정되었을때 실행할 코드를 작성하는 부분. iframe을 넣은 element의 높이값을 조정한다.
158			onresize : function(size) {
159				element_wrap.style.height = size.height+'px';
160			},
161			width : '100%',
162			height : '100%'
163		}).embed(element_wrap);
164
165		// iframe을 넣은 element를 보이게 한다.
166		element_wrap.style.display = 'block';
167	};
168
169	// ### 우편번호 팝업 검증
170	if ($("#"+popID).length==0){
171		var html = '<div id="'+popID+'" class="pop_wrap large">'+
172					'	<article class="popup">'+
173					'		<div class="pop_head">'+
174					'			<h1>주소를 <br>검색해주세요.</h1>'+
175					'		</div>'+
176					'		<div class="pop_cont">'+
177					'			<div id="'+containerID+'" class="zipcode_wrap">로딩중..</div>'+
178					'		</div>'+
179					'		<a href="#" role="button" class="btn_pop_close ui-pop-close">팝업닫기</a>'+
180					'	</article>'+
181					'</div>';
182		$("body").append(html);
183	}
184
185	// ### 우편번호 스크립트 검증. 없을경우 스크립트 로딩
186	//console.log(typeof(daum));
187	if (typeof(daum)!="object"){
188		$.getScript( "//ssl.daumcdn.net/dmaps/map_js_init/postcode.v2.js" )
189			.done(function( script, textStatus ) {
190				if (textStatus=="success"){
191					daum.postcode.load(function (){
192						oThis.loadMap();
193					});
194				}else{
195					console.log("Daum map load",textStatus );
196				}
197			})
198			.fail(function( jqxhr, settings, exception ) {
199				$( "div.log" ).text( "Triggered ajaxError handler." );
200			});
201		return false;
202	}else{
203		oThis.loadMap();
204	}
205}
206
207// ################### common : search
208$(function(){
209	var search_section = 0;
210	$(window).load(function(){
211		// getGnbKeyword();
212	});
213
214	$(document).on("click","a.head_search",function(){
215		if (search_section==0) {
216			// getGnbKeyword();
217		}
218		$('#frmGnbSearchProd [name="qWord"]').val("");
219		setGnbSearchForm($('#frmGnbSearchProd [name="hdSearchOpt"]:eq(0)').val());
220	});
221
222	function getGnbKeyword(){
223		search_section = $("aricle.hd_search").length;
224
225		if (search_section>0) {
226			$.ajax({
227				"url": "/api/code/keywd_list.json.asp" ,
228				"dataType" : "JSON",
229				"method": "POST",
230				"success" : function(data){
231					if (data.list) {
232						for (i=0; i<data.list.length ; i++) {
233							var row = data.list[i];
234
235							var div;
236							if (row.div=="P")	div = "prod";
237							else if (row.div=="A")	div = "atta";
238
239							var $dom = $('dd[gnb-recomm-keywd="'+div+'"]');
240							if ($dom.length>0) {
241								$dom.append('<a href="#" class="button h33 round2 gray3">#'+decodeURIComponent(row.keywd)+'</a>');
242							}
243						}
244					}
245					$('dd[gnb-recomm-keywd]:eq(0)').show();
246				} ,
247				"error" : function(){
248					console.log("pageInit","GNB 검색키워드 로딩 실패");
249				}
250			});
251		}
252	}
253
254	function setGnbSearchForm(div){
255		$('dd[gnb-recomm-keywd]').hide();
256		$('dd[gnb-recomm-keywd="'+div+'"]').show();
257		if (div=="prod"){
258			$('#frmGnbSearchProd').attr("action","/ko/04_01_01.asp");
259		}else{
260			$('#frmGnbSearchProd').attr("action","/ko/04_02_01.asp");
261		}
262	}
263
264	// #### 검색 옵션 및 키워드
265	$(document).on("click",'#frmGnbSearchProd [name="hdSearchOpt"]',function(){
266		setGnbSearchForm($(this).val());
267	});
268	$(document).on("click",'dd[gnb-recomm-keywd]>a',function(){
269		var keywd = $(this).text();
270		if (keywd)
271			keywd = keywd.substr(1,keywd.length);
272
273		$('#frmGnbSearchProd [name="qWord"]').val(keywd);
274		$('#frmGnbSearchProd').submit();
275	});
276
277
278
279
280});
281// ################### common : sns share
282$(window).load(function(){
283	var utils = new HLIB_UTILS();
284	var meta_title = $('meta[property="og:title"]').attr("content");
285	var meta_description = $('meta[property="og:description"]').attr("content");
286	var meta_img = $('meta[property="og:image"]').attr("content");
287	var meta_url = $('meta[property="og:url"]').attr("content");
288
289	// ######## sms share
290	var	os = utils.chkMobileOS();
291	if (utils.is_mobile()===true){
292		$('[data-share-btn="sms"]').show();
293	}
294	$('[data-share-btn="sms"]').on("click",function(){
295		if(os=="IOS") {
296			document.location.href = "sms:&body=[에스피삼화] " + encodeURI(meta_title) + "%0D%0A" + meta_url;
297		} else {
298			//not ios
299			document.location.href = "sms:?body=[에스피삼화] " + encodeURI(meta_title) + "%0D%0A" + meta_url;
300		}
301		
302	});
303
304	// ######## url copy
305	if ($('[data-share-btn="copy"]').length > 0) {
306		$('[data-share-btn="copy"]').attr("data-clipboard-text",decodeURIComponent(meta_url));
307		$.getScript( "//cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" )
308			.done(function( script, textStatus ) {
309				if (textStatus=="success"){
310					var clipboard = new Clipboard('a[data-share-btn="copy"]');
311					clipboard.on('success', function(e) {
312						alert("링크가 복사되었습니다.");
313						//console.log(e);
314					}).on('error', function(e) {
315						console.log(e);
316					});
317
318				}else{
319					console.log("clipboard.js load",textStatus );
320				}
321			})
322			.fail(function( jqxhr, settings, exception ) {
323				console.log("clipboard.js load : fail",exception );
324		});
325	}
326
327	// ######## kakao share
328	if ($('[data-share-btn="kakao"]').length > 0) {
329		$.getScript( "//developers.kakao.com/sdk/js/kakao.min.js" )
330			.done(function( script, textStatus ) {
331				if (textStatus=="success"){
332					loadBtnKakaoShare();
333				}else{
334					console.log("kakao api load",textStatus );
335				}
336			})
337			.fail(function( jqxhr, settings, exception ) {
338				console.log("kakao api load : fail",exception );
339		});
340	}
341
342	function loadBtnKakaoShare(){
343		// // 사용할 앱의 JavaScript 키를 설정해 주세요.
344		Kakao.init('deb3407e1c1415138789eadf5fce2b9f');
345		// // 카카오링크 버튼을 생성합니다. 처음 한번만 호출하면 됩니다.
346
347		/*		
348		Kakao.Link.createScrapButton({
349			container: 'a[data-share-btn="kakao__"]',
350			requestUrl: decodeURIComponent(meta_url)
351		});
352		*/
353
354		Kakao.Link.createDefaultButton({
355			container: 'a[data-share-btn="kakao"]',
356			objectType: 'feed',
357			content: {
358				title: meta_title,
359				description: meta_description,
360				imageUrl: meta_img,
361				link: {
362					mobileWebUrl: decodeURIComponent(meta_url),
363					webUrl: decodeURIComponent(meta_url)
364				}
365			},
366			/*
367			social: {
368				likeCount: 286,
369				commentCount: 45,
370				sharedCount: 845
371			},
372			*/
373			buttons: [{
374				title: '바로가기',
375				link: {
376					mobileWebUrl: decodeURIComponent(meta_url),
377					webUrl: decodeURIComponent(meta_url)
378				}
379			}]
380		});
381	}
382
383	// ##### append dev server label
384	if (window.location.href.indexOf("m.spsamhwa.com/__dev/") > 0){
385		$("body").addClass("dev-server");
386		$("body").append('<div class="dev-server-label" style="background-color:#ff000080; color:#fff; font-weight:bold; position:fixed; top:0; left:0; z-index:1000; width:100%; padding:2px;font-family: dotum;font-size: 11px;">개발서버</div>');
387	}
388});

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.