PageSourceSearch

https://delightkorea.co.kr/wp-content/plugins/mangboard/plugins/popup/js/main.js?ver=142

js delightkorea.co.kr collected 2026-10-06 14:04:06 UTC 16,236 bytes, 424 lines download raw bytes

1jQuery( document ).ready(function() {
2	//팝업 태그를 body에 추가
3	var popup_html	= "";
4	popup_html		= popup_html+'<div class="mb-board">';
5	popup_html		= popup_html+'<div class="pop-bg" id="mb_pop_bg" onclick="hidePopupAlert()"></div>';
6	popup_html		= popup_html+'<div class="pop-main mb-'+mb_options["device_type"]+'" >';
7		popup_html		= popup_html+'<div class="pop-html" id="mb_pop_html">';
8			popup_html		= popup_html+'<div id="mb_pop_html_head"></div>';
9			popup_html		= popup_html+'<div id="mb_pop_html_body"></div>';			
10		popup_html		= popup_html+'</div>';
11		popup_html		= popup_html+'<div class="mb-pop pop-info" id="mb_pop_info">';
12			popup_html		= popup_html+'<div id="mb_pop_info_head"></div>';
13			popup_html		= popup_html+'<div id="mb_pop_info_body"></div>';
14		popup_html		= popup_html+'</div>';
15		popup_html		= popup_html+'<div class="mb-pop pop-confirm" id="mb_pop_confirm">';
16			popup_html		= popup_html+'<div class="pop-confirm-head" id="mb_pop_confirm_head"></div>';
17			popup_html		= popup_html+'<div class="pop-confirm-body" id="mb_pop_confirm_body"></div>';
18		popup_html		= popup_html+'</div>';
19		popup_html		= popup_html+'<div class="mb-pop pop-alert" id="mb_pop_alert">';
20			popup_html		= popup_html+'<div class="pop-alert-head" id="mb_pop_alert_head"></div>';
21			popup_html		= popup_html+'<div class="pop-alert-body" id="mb_pop_alert_body"></div>';
22		popup_html		= popup_html+'</div>';
23		
24	popup_html		= popup_html+'</div>';
25	popup_html		= popup_html+'</div>';
26
27     jQuery("body").append(popup_html);
28});
29
30var confirmCallbackSend;
31var confirmCallbackCancel;
32var alertCallbackSend;
33var popupCallbackData;
34var select_menu		= "";
35var eventX				= 0;
36var eventY				= 0;
37var scrollMode			= true;
38var popupMode			= "popup";
39
40function setPopupScrollEvent(){
41	jQuery(window).on({
42		'mousewheel': function(e){
43			if(scrollMode) setPopupPosition("scroll");
44		},'scroll': function(e){
45			if(scrollMode) setPopupPosition("scroll");
46		}
47	})
48}
49function setPopupPosition(mode){
50	if(typeof(mode)!=='undefined' && mode=="scroll" && jQuery("#mb_pop_bg").css('display')=='none') return;
51
52	var pHeight			= 120;
53	var nWidth			= jQuery(window).width();
54	var nHeight			= jQuery(window).height();
55	var scrollTop			= jQuery(document).scrollTop();
56	
57	var popupObj			= jQuery("#mb_pop_confirm");
58	if(mb_options["device_type"]=="mobile") pHeight				= 50;
59
60	popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
61	if(popupObj.outerHeight()>400){ pHeight			= 30; }
62	popupObj.css('top',(scrollTop-pHeight+((nHeight-popupObj.outerHeight())/2)));
63
64	popupObj		= jQuery("#mb_pop_alert");
65	popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
66	if(popupObj.outerHeight()>400){ pHeight			= 30; }
67	popupObj.css('top',(scrollTop-pHeight+((nHeight-popupObj.outerHeight())/2)));
68
69	popupObj		= jQuery("#mb_pop_info");
70	popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
71	popupObj.css('top',((scrollTop+((nHeight-popupObj.outerHeight())/2))));
72
73	popupObj		= jQuery("#mb_pop_html");
74	if(popupObj.outerHeight()>400){ pHeight			= 30; }
75	var nTop			= (scrollTop-pHeight+((nHeight-popupObj.outerHeight())/2));
76	if(nTop<scrollTop){
77		if((pHeight+nTop)<scrollTop){
78			nTop	= scrollTop;
79		}else{
80			nTop	= parseInt((pHeight+nTop)/2);
81		}
82	}
83	if(nTop<scrollTop){ nTop	= scrollTop; }
84	if(popupObj.outerHeight()>=nHeight || popupObj.outerWidth()>=nWidth){
85		popupObj.css('position','fixed');
86		if(popupObj.outerHeight()>=nHeight){
87			popupObj.css('top',0);
88		}else{
89			popupObj.css('top',nTop);
90		}
91		if(mb_options["device_type"]=="mobile") popupObj.css('width',"100%");
92		popupObj.css('height',"100%");
93		popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
94		scrollMode		= false;
95		jQuery('body').css('overflow-y','hidden');
96	}else{
97		popupObj.css('position','absolute');
98		popupObj.css('top',nTop);
99		popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
100	}
101}
102setPopupScrollEvent();
103
104function showConfirmPopup(message,data,send,cancel){
105	popupCallbackData				= data;
106	confirmCallbackSend			= send;
107
108	if(typeof(cancel)==='undefined') confirmCallbackCancel = hidePopupBox;
109	else confirmCallbackCancel		= cancel;
110
111	//위치 설정
112	var pop_head		= '';
113	var pop_body		= '';
114	var pop_btn_ok		= mb_languages["btn_ok"];
115	var pop_btn_cancel	= mb_languages["btn_cancel"];
116	if(typeof(data)!=='undefined'){
117		if(typeof(data.btn_ok)!=='undefined' && data.btn_ok!=""){
118			pop_btn_ok		= data.btn_ok;
119		}
120		if(typeof(data.btn_cancel)!=='undefined' && data.btn_cancel!=""){
121			pop_btn_cancel		= data.btn_cancel;
122		}
123	}
124	if(typeof(data)!=='undefined' && typeof(data.type)!=='undefined' && data.type=="passwd"){
125		pop_head		= '<div class="pop-title pop-title-confirm" id="mb_pop_confirm_text">'+message+'</div>';
126		pop_body			= pop_body+'<div id="mb_pop_form">';
127			pop_body			= pop_body+'<form class="pop-form" action="javascript:sendConfirmCallbackData()" id="mb_confirm_form" method="post" name="mb_confirm_form"><div><input id="mb_confirm_passwd" name="passwd" class="pop-input-passwd" type="password" /></div></form>';
128
129		pop_body			= pop_body+'</div>';		
130	}else{
131		pop_head		= '<div class="pop-title" id="mb_pop_confirm_text"><p class="pop-title-head">Message</p><p class="pop-title-message">'+message+'</p></div>';
132	}
133	pop_body			= pop_body+'<div class="btn-box-center">';
134	pop_body			= pop_body+'<a href="javascript:;" id="mb_pop_confirm_cancel" onclick="cancelConfirmCallbackData()" class="btn btn-default btn-cancel margin-right-10"><span>'+pop_btn_cancel+'</span></a>';
135	pop_body			= pop_body+'<a href="javascript:;" id="mb_pop_confirm_ok" onclick="sendConfirmCallbackData()" class="btn btn-default btn-ok"><span>'+pop_btn_ok+'</span></a>';
136	pop_body			= pop_body+'</div>';
137
138	if(typeof(data)!=='undefined'){
139		if(typeof(data.head)!=='undefined')  pop_head		= data.head;
140		if(typeof(data.body)!=='undefined')  pop_body		= data.body;
141	}
142
143	showPopupBox("Confirm",pop_head,pop_body);
144}
145function showAlertPopup(response,send){
146	if(!response || typeof(response)==='undefined') return;
147
148	var code					= "";
149	var message				= "";
150	var target_name			= "";
151	var mode					= "";
152	var board_action		= "";
153	
154	if(typeof(send)==='undefined') alertCallbackSend			= null;
155	else alertCallbackSend			= send;
156	
157	if(typeof(response.code)!=='undefined') code				= response.code;
158	if(typeof(response.message)!=='undefined') message		= response.message;
159	if(typeof(response.target_name)!=='undefined') target_name		= response.target_name;
160	if(typeof(response.mode)!=='undefined') mode				= response.mode;
161	if(typeof(response.board_action)!=='undefined') board_action				= response.board_action;
162	if(message=="") return;
163	if(code=="1103"){
164		showConfirmPopup(message, {}, function(){moveURL(mb_urls["login"]);});
165		return;
166	}
167	var pop_head		= '<div class="pop-title" id="mb_pop_alert_text"><p class="pop-title-head">Message</p><p class="pop-title-message">'+message+'</p></div>';
168	var pop_body		= '';
169	pop_body			= pop_body+'<div class="btn-box-center">';
170	pop_body			= pop_body+'<a href="javascript:;"  id="mb_pop_alert_ok" onclick="showAlertCallback(\''+code+'\',\''+target_name+'\',\''+mode+'\',\''+board_action+'\');" class="btn btn-default btn-ok"><span>'+mb_languages["btn_ok"]+'</span></a>';
171	pop_body			= pop_body+'</div>';
172	showPopupBox("Alert",pop_head,pop_body);
173}
174function showPopupBox(type,head,body,data,mode){
175	if(typeof(mode)!=='undefined' && mode!=''){
176		popupMode			= mode;
177	}else{
178		popupMode			= "popup";
179	}
180
181	scrollMode			= true;
182	initLoadingBox();
183	var popupID		= "#mb_pop_confirm";	
184
185	if(type=="Alert"){
186		popupID		= "#mb_pop_alert";
187		if(jQuery("#mb_pop_bg").css('display')=='none') jQuery("#mb_pop_confirm").hide();	
188
189		setTimeout(function(){ jQuery(popupID).addClass("mb-ani-pop-open");	 }, 1);		
190	}else if(type=="Info"){
191		popupID		= "#mb_pop_info";
192		setTimeout(function(){ jQuery(popupID).addClass("mb-ani-pop-fadein"); }, 1);
193	}else if(type=="Confirm"){
194		popupID		= "#mb_pop_confirm";
195		setTimeout(function(){ jQuery(popupID).addClass("mb-ani-pop-open");	 }, 1);		
196	}else if(type=="Html"){
197		popupID		= "#mb_pop_html";
198	}else{
199		popupID		= "#mb_pop_alert";
200		setTimeout(function(){ jQuery(popupID).addClass("mb-ani-pop-open");	 }, 1);		
201	}
202	if(typeof(data)==='undefined') data		= {};
203	if(typeof(data.position)==='undefined') data.position = "center";
204	if(typeof(data.bg)==='undefined') data.bg = true;
205	if(typeof(data.eventX)==='undefined') data.eventX = 0;
206	if(typeof(data.eventY)==='undefined') data.eventY = 0;
207	
208	jQuery(popupID+"_head").html(head);
209	jQuery(popupID+"_body").html(body);	
210
211	if(data.position=="click"){
212		jQuery(popupID).css("top",parseInt((data.eventY+jQuery(document).scrollTop())/10)*10-25);
213		jQuery(popupID).css("left",parseInt(data.eventX/10)*10+28);
214	}else{
215		setPopupPosition();
216	}
217	if(data.bg) showPopupBG();
218	
219	jQuery(popupID).show();	
220
221	if(type=="Alert"){
222		jQuery("#mb_pop_alert_ok").focus();
223	}else if(type=="Confirm"){
224		jQuery("#mb_confirm_passwd").focus();
225	}
226	
227}
228
229function initLoadingBox(){
230	jQuery("#mb_pop_html_head").html("");
231	jQuery("#mb_pop_html_body").html("");
232	jQuery("#mb_pop_html").css({'width':'','height':''});
233	jQuery("#mb_pop_html").hide();
234}
235
236function showLoadingBox(){
237	showPopupBox("Html",'<img src="'+mb_urls["plugin"]+'assets/images/loader.gif" width="50px" height="50px" style="opacity: 0.7;filter: alpha(opacity=0.7);">','<div style="color:#fff;font-size:12px;min-height:19px;">Loading</div>');
238}
239function hideLoadingBox(){
240	initLoadingBox();
241	if(jQuery("#mb_pop_alert").css('display')=='none' && jQuery("#mb_pop_confirm").
241css('display')=='none'){
242		jQuery("#mb_pop_bg").hide();
243	}
244	if(!scrollMode){
245		jQuery('body').css('overflow-y','auto');
246		scrollMode		= true;
247	}
248}
249
250function showPopupBG(){
251	hideInfoBox();
252	jQuery('#mb_pop_bg').height(jQuery(document).height());	
253	jQuery("#mb_pop_bg").show();
254}
255
256var popup_user_name	= "";
257function getUserMenu(uid,pid,name){
258	if(typeof(name)!=='undefined' && name!=""){
259		popup_user_name		= name;
260	}else{
261		popup_user_name		= "";
262	}
263	var menu_options		= "*";	
264	if(select_menu==uid+"_"+pid){
265		select_menu		= "";
266		hideInfoBox();
267	}else{		
268		sendUserMenu(uid,pid,menu_options,event);
269		select_menu		= uid+"_"+pid;
270	}
271}
272function showUserMenu(data){		
273	var menu_head		= data["head"];
274	var menu_body		= "";
275	var menu_foot		= data["foot"];
276
277	var user_name		= "";
278	if(typeof(data["user"]["name"])!=='undefined' && data["user"]["name"]!=""){
279		user_name		= data["user"]["name"];
280	}else if(popup_user_name!=""){
281		user_name		= popup_user_name;
282	}	
283	if(user_name!="") menu_head				= menu_head+'<div class="pop-info-head">'+user_name+'</div>';
284
285	menu_body			= '<ul class="pop-info-body list-unstyled">';	
286
287	if(data["body"].length>0){
288		jQuery.each(data["body"], function(key,value){
289			menu_body		= menu_body+'<li>'+value+'</li>';
290		});
291		menu_body		= menu_body+'</ul>';
292		showPopupBox("Info","",('<div class="pop-user-menu">'+menu_head+menu_body+menu_foot+"</div>"),{"position":"click","bg":false,"eventX":eventX,"eventY":eventY});
293	}
294}
295
296function sendUserMenu(uid,board_pid,option,event){
297	if(typeof(event)!=='undefined'){
298		eventX	= event.clientX;
299		eventY		= event.clientY - jQuery('body').offset().top;
300	}
301	if(option=="*") option	= "search,info,email,homepage,blog";
302
303	var param	= "board_name="+mb_options["board_name"]+"&option="+option+"&list_type="+mb_options["list_type"]+"&page="+mb_options["page"]+"&page_id="+mb_options["page_id"];
304	if(jQuery('#'+mb_options["board_name"]+'_form_board_search').length>0) param		+= "&"+jQuery('#'+mb_options["board_name"]+'_form_board_search').serialize();
305	param	+= "&mode=user&board_action=menu"+"&pid="+uid+"&board_pid="+board_pid;
306
307	sendDataRequest2(mb_urls["template_api"], param, sendUserMenuHandler);
308}
309function sendUserMenuHandler(response, state){		
310	if(response.state == "success"){
311		showUserMenu(response.data);
312	}else{
313		showAlertPopup(response);
314	}
315}
316function hideInfoBox() {
317	jQuery("#mb_pop_info").hide();
318	jQuery("#mb_pop_info").removeClass("mb-ani-pop-fadein");
319}
320function hidePopupBox() {	
321	confirmCallbackSend		= null;
322	jQuery(".mb-input-focus").removeClass("mb-input-focus");
323	jQuery("#mb_pop_info").hide();
324	jQuery("#mb_pop_html").hide();	
325	jQuery("#mb_pop_confirm").hide();	
326	jQuery("#mb_pop_confirm").removeClass("mb-ani-pop-open");
327	jQuery("#mb_pop_alert").removeClass("mb-ani-pop-open");
328	jQuery("#mb_pop_info").removeClass("mb-ani-pop-fadein");
329	jQuery("#mb_pop_bg").hide();
330	if(!scrollMode){
331		jQuery('body').css('overflow-y','auto');
332		scrollMode		= true;
333	}
334	popupMode			= "popup";
335}
336function showAlertCallback(code,target_name,mode,board_action){	
337	hidePopupAlert(code,target_name,mode,board_action);
338	sendAlertCallbackData();	
339}
340function hidePopupAlert(code,target_name,mode,board_action) {
341	if(popupMode=="modal") return;
342	if(typeof(code)!=='undefined' && code!=='undefined' && code!=''){
343		if(confirmCallbackSend) jQuery("#mb_pop_confirm").show();		
344
345		if(code.substr(0,2)=="12"){	//입력 관련 에러일 경우 포커스 설정
346			if(typeof(target_name)!=='undefined'  && target_name!=='undefined' && target_name!=''){
347				var target;
348				if(jQuery("#mb_pop_confirm").css('display')!='none'){
349					if(target_name.indexOf(" ") !== -1){		//이름에 공백이 있을 경우
350						if(jQuery("#mb_confirm_form").find(target_name).length>0){
351							target		= jQuery("#mb_confirm_form").find(target_name).first();
352						}
353					}else{
354						if(jQuery("#mb_confirm_form").find("input[name='"+target_name+"']").length>0){
355							target		= jQuery("#mb_confirm_form").find("input[name='"+target_name+"']").first();
356						}else if(jQuery("#mb_confirm_form").find(target_name).length>0){
357							target		= jQuery("#mb_confirm_form").find(target_name).first();
358						}
359					}					
360				}else{
361					if(code=="1299"){
362						if(jQuery(target_name).filter(':visible').length>0){
363							target		= jQuery(target_name).filter(':visible').first();
364						}
365					}else{
366						if(target_name.indexOf(" ") !== -1){		//이름에 공백이 있을 경우
367							if(jQuery(target_name).filter(':visible').length>0){
368								target		= jQuery(target_name).filter(':visible').first();
369							}
370						}else{
371							if(jQuery("[name='"+target_name+"']").filter(':visible').length>0){
372								if(typeof(mode)!=='undefined' && mode=='comment' && typeof(board_action)!=='undefined' && (board_action=='reply' || board_action=='modify')){
373									target		= jQuery(".cmt-reply-box [name='"+target_name+"']").filter(':visible').first();
374								}else{
375									target		= jQuery("[name='"+target_name+"']").filter(':visible').first();
376								}
377							}else if(jQuery(target_name).filter(':visible').length>0){
378								target		= jQuery(target_name).filter(':visible').first();
379							}
380						}						
381					}
382				}
383				jQuery(".mb-input-focus").removeClass("mb-input-focus");
384				if(typeof(target)!=='undefined'  && target!=='undefined'){
385					jQuery("html, body").animate({scrollTop: target.offset().top-200}, 300, function(){
386						target.focus();
387						target.addClass("mb-input-focus");
388					});
389				}
390			}
391		}
392	}else{
393		jQuery(".mb-input-focus").focus();
394	}
395	
396	jQuery("#mb_pop_alert").hide();
397	jQuery("#mb_pop_alert").removeClass("mb-ani-pop-open");
398	jQuery("#mb_pop_html").hide();
399	jQuery("#mb_pop_info").hide();
400	if(jQuery("#mb_pop_confirm").css('display')=='none'){
401		jQuery("#mb_pop_bg").hide();
402		initLoadingBox();
403	}
404	if(!scrollMode){
405		jQuery('body').css('overflow-y','auto');
406		scrollMode		= true;
407	}
408	popupMode			= "popup";
409}
410function sendAlertCallbackData() {	
411	if(alertCallbackSend) alertCallbackSend();
412	else alertCallbackSend		= null;
413}
414function sendConfirmCallbackData() {	
415	showLoadingBox();
416	jQuery("#mb_pop_confirm").hide();
417	if(confirmCallbackSend) confirmCallbackSend(popupCallbackData);
418	else confirmCallbackSend		= null;
419}
420function cancelConfirmCallbackData() {	
421	confirmCallbackSend		= null;
422	if(confirmCallbackCancel) confirmCallbackCancel();
423	else confirmCallbackCancel		= null;
424}

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.