PageSourceSearch

https://appskorea.net/js/pc/comment.js?1789361064

js appskorea.net collected 2026-10-02 00:38:52 UTC 10,161 bytes, 260 lines download raw bytes

1function show_comment_list(type,widget_id,rno){
2	$.ajax({
3		type:'POST',
4		data:{'type':type,'widget_id':widget_id,'rno':rno},
5		url:('/pc/backpg/comment_list.cm'),
6		dataType:'json',
7		async:false,
8		cache:false,
9		success:function(result){
10			if(result.msg=='SUCCESS'){
11				$('#comment_list_'+widget_id).parent().show();
12				$('#comment_list_'+widget_id).html(result.html);
13				$('#comment_cnt_'+widget_id).html(result.comment_cnt);
14				if(result.can_comment_result=='NO_ADMIN'){	//관리자만 댓글 쓰기인 경우					
15				}else{
16					show_comment_write(type,widget_id,rno,0, result.can_comment, result.can_comment_result, result.use_secret);
17				}
18			}else{
19				if(result.msg!="NO_COMMENT") alert(result.msg);
20			}
21		}
22	});
23}
24
25var comment_write_progress=false;
26function comment_write(type,widget_id,rno,comment_idx){
27	if(comment_write_progress) return false;
28	var comment_body = $('#comment_write_' + widget_id + '_' + comment_idx);
29	if(comment_body.find('textarea').val()=='') { alert(GetLangMsg('SITE_BOARD49')); comment_body.find('textarea').focus(); return false; } //댓글을 입력해주세요
30	comment_write_progress=true;
31	
32	var nick = '';
33	if(comment_body.find('input._nick').length>0) nick = comment_body.find('input._nick').val();
34	var password = '';
35	if(comment_body.find('input._password').length>0) password = comment_body.find('input._password').val();
36	
37	var is_secret='N';
38	if(comment_body.find('input._is_secret').length>0) is_secret = comment_body.find('input._is_secret').prop('checked')?'Y':'N';
39	
40	$.ajax({
41		type:'POST',
42		data:{'article_idx':rno,'widget_id':widget_id,'is_secret':is_secret,'comment_idx':comment_idx,'body':comment_body.find('textarea').val(),'type':type, 'wnick':nick, 'password':password},
43		url:('/pc/backpg/comment_write.cm'),
44		dataType:'json',
45		async:true,
46		cache:false,
47		success:function(result){
48			comment_write_progress=false;
49			if(result.msg=='SUCCESS'){
50				show_comment_list(type,widget_id,rno);
51			}else
52				alert(result.msg);
53		}
54	});
55}
56
57var comment_delete_progress=false;
58function comment_delete(type,widget_id,rno,comment_idx){
59	if(comment_delete_progress) return false;
60	if(!confirm(GetLangMsg('SITE_BOARD_ERR14'))) return false;
61	comment_delete_progress=true;	
62	$.ajax({
63		type:'POST',
64		data:{'article_idx':rno,'widget_id':widget_id,'comment_idx':comment_idx,'type':type},
65		url:('/pc/backpg/comment_delete.cm'),
66		dataType:'json',
67		async:true,
68		cache:false,
69		success:function(result){
70			comment_delete_progress=false;
71			if(result.msg=='SUCCESS'){
72				if(type=='guestbook')
73					window.location.reload();
74				else
75					show_comment_list(type,widget_id,rno);
76			}else
77				alert(result.msg);
78		}
79	});
80}
81
82var current_comment_write=0;
83function show_comment_write(type,widget_id,rno,comment_idx,can_comment,can_comment_result,use_secret){
84	if(current_comment_write>0) $('#comment_write_' + widget_id + '_' + current_comment_write).hide();
85	current_comment_write = comment_idx;
86	var html = '';
87
88	if(can_comment_result=='GUEST'){
89		
90		html += "<div class='comment_write' style='overflow:hidden;zoom:1;' id='comment_write_" + widget_id + '_' + comment_idx + "'>";
91		if(use_secret=='Y')	html += "<div  style='padding-bottom: 8px'>"+GetLangMsg("ADMIN_RIGHT_BOARD21")+" <input type='checkbox' class='_is_secret'/></div> ";//비밀댓글
92		if(comment_idx>0) html += '<div class="depth"><span class="cocoaicon brand_color">!</span></div>';
93		html += "<div class='fleft mr7'><input type='text' class='_nick placeholder wid200' value='' maxlength='50' title='"+GetLangMsg("SITE_JOIN_FIELD_NICK")+"' placeholder="+GetLangMsg("SITE_JOIN_FIELD_NICK")+" /></div>";//닉네임
94		html += '<div class="fleft"><input type="password" class="_password placeholder wid200" maxlength="20" value="" title="'+GetLangMsg("SITE_BOARD35")+'" placeholder="'+GetLangMsg("SITE_BOARD35")+'"/></div>'; //비밀번호
95		html += "<div class='comment_btn'><a href='javascript:;' onclick=\"comment_write('" + type + "','" + widget_id + "'," + rno + "," + comment_idx + ")\">"+GetLangMsg("REGISTER")+"</a></div>"; //등록
96		html += "<div class='textwrap'>
96<textarea class='placeholder' title='"+GetLangMsg("BOARD_ERR1")+"' placeholder='"+GetLangMsg("BOARD_ERR1")+"'></textarea></div>"; //댓글 내용을 입력해주세요.
97		html += '</div>';
98	}else if(can_comment=='Y'){
99		html += "<div class='comment_write' id='comment_write_" + widget_id + '_' + comment_idx + "'>";
100		if(comment_idx>0) html += '<div class="depth"><span class="cocoaicon brand_color">!</span></div>';
101		html += "<div class='comment_btn'><a href='javascript:;' onclick=\"comment_write('" + type + "','" + widget_id + "'," + rno + "," + comment_idx + ")\">"+GetLangMsg("REGISTER")+"</a></div>"; //등록
102		if(use_secret=='Y')
103			html += "<div>"+GetLangMsg("ADMIN_RIGHT_BOARD21")+" <input type='checkbox' class='_is_secret' /></div> "; //비밀댓글
104		html += "<div class='mt5'><textarea class='placeholder' title='"+GetLangMsg("BOARD_ERR1")+"' placeholder='"+GetLangMsg("BOARD_ERR1")+"'></textarea></div>";
105		html += '</div>';
106	}
107	
108
109	if(comment_idx>0){
110		$("#comment_list_"+widget_id+" div[id^='comment_write_']").remove();
111		$('#comment_'+widget_id+'_'+comment_idx).parent().append(html).find('textarea').focus();
112	}else{
113		$('#comment_list_'+widget_id).append(html);
114	}
115	
116	
117	cocoa_placeholder(); //IE8이하버전 PlaceHolder 적용
118	
119}
120
121function comment_no_login(return_url){
122	alert('덧글을 작성하려면 로그인을 해주세요');
123	pop_login(return_url);
124}
125
126/*
127 * 비회원 댓글 삭제시 체크
128 */
129var comment_delete_progress=false;
130
131var last_select_comment_idx = 0;
132function comment_delete_passwod_check(type, widget_id, rno, comment_idx){
133	var $ohtmlEditform = $("<div id='comment_delete_password' class='password_box delete'><p class='txt'>게시물 작성시 등록하신 비밀번호를 입력해주세요.</p><p><input type='password' name='secret_pass' value='' placeholder='비밀번호'><a class='pc_btn ml10' href='javascript:;'>확인</a></p><span class='tail'></span></div>");
134	var is_pwdbox = ($(".password_box.delete").length > 0);
135	
136	$(".password_box.delete").remove();
137	
138	if(last_select_comment_idx == comment_idx && is_pwdbox){
139		comment_idx = 0;
140	} else {
141		var $comment_wrap = $('#comment_li_' + comment_idx);
142		var $btn_del = $comment_wrap.find('.btn_del');
143		// tail : 12, c_memo_btn div의 top값 + 삭제 버튼의 높이
144		var pwd_form_top = 12 + $comment_wrap.find('.c_memo_btn').position().top + $btn_del.innerHeight();
145		
146		$ohtmlEditform.css('top', pwd_form_top);
147		
148		// 확인 버튼에 이벤트 부여
149		$ohtmlEditform.find('.pc_btn').bind('click', function(){
150			if(comment_delete_progress) return false;
151			comment_delete_progress=true;
152			$.ajax({
153				type:'POST',
154				data:{'article_idx':rno,'widget_id':widget_id,'comment_idx':comment_idx,'type':type,'secret_pass':$ohtmlEditform.find("input[type='password']").val()},
155				url:('/pc/backpg/comment_delete.cm'),
156				dataType:'json',
157				async:true,
158				cache:false,
159				success:function(result){
160					// 폼을 숨기고 비밀번호를 공백으로 초기화
161					$(".password_box.delete").remove();
162					comment_delete_progress=false;
163					if(result.msg=='SUCCESS'){
164						if(type=='guestbook')
165							window.location.reload();
166						else
167							show_comment_list(type,widget_id,rno);
168					}else{
169						var msg = result.msg;
170						
171						if(msg == 'no permission')
172							msg = '권한이 없습니다.';
173						
174						alert(msg);
175					}
176				}
177			});
178		});
179		
180		$comment_wrap.find(".comment_item").append($ohtmlEditform);
181	}
182	
183	last_select_comment_idx = comment_idx;
184}
185
186function comment_delete_passwod_check2(type,widget_id,rno,comment_idx){
187	var edit_width = 300;
188	var ohtmlEditForm = $("<div title='댓글 삭제하기' id='comment_dial_box'><input type='password' name='secret_pass' id='secret_pass' placeholder='비밀번호를 입력하세요' style='width:250px'/><div id='no_modify_password' style='display:none;'>비밀번호를 입력하세요</div><div/>");
189	if(!($("#comment_dial_box").length>0)){
190		$('body').append(ohtmlEditForm);	
191		ohtmlEditForm.dialog({
192			height:180,
193			width:edit_width,
194			modal: true,
195			open: function( event, ui ) {},
196			buttons: {
197				"삭제하기": function() {
198					if($("#secret_pass").val()!=""){
199						if(comment_delete_progress) return false;
200						comment_delete_progress=true;	
201						$.ajax({
202							type:'POST',
203							data:{'article_idx':rno,'widget_id':widget_id,'comment_idx':comment_idx,'type':type,'secret_pass':$("#secret_pass").val()},
204							url:('/pc/backpg/comment_delete.cm'),
205							dataType:'json',
206							async:true,
207							cache:false,
208							success:function(result){
209								$("#secret_pass").val("");
210								comment_delete_progress=false;
211								if(result.msg=='SUCCESS'){
212									if(type=='guestbook')
213										window.location.reload();
214									else
215										show_comment_list(type,widget_id,rno);
216								}else
217									alert(result.msg);
218							}
219						});
220						$( this ).dialog( "close" );
221					}else{
222						
223					}
224				},
225				'취소하기': function(){
226					$( this ).dialog( "close" );
227				}
228			}
229		});
230	}else{
231		$("#comment_dial_box").dialog("open");
232	}
233}
234
235/*
236 * 비밀글 보기 버튼 클릭 시 처리
237 */
238var last_click_btn = '';
239function comment_show_secret_passwod_check(idx){
240	if(last_click_btn == idx){
241		$("#secret_comment_password").hide();
242		last_click_btn = '';
243	} else {
244		last_click_btn = idx;
245	
246		var $secret_password_wrap = $('#comment_li_' + idx);
247		var $secret_password_btn = $secret_password_wrap.find('.secret_pwd_btn');
248		var $secret_comment_password = $('#secret_comment_password');
249		
250		// left 위치는 비밀글 보기 버튼에 맞춰야 한다.
251		var btn_left = $secret_password_btn.position().left + ($secret_password_btn.width()/2) + 85;
252		$("#secret_comment_password").css('left', btn_left - ($secret_comment_password.innerWidth() /2));
253		
254		// top 위치는 비밀글 보기 버튼에 맞춰야 한다. 
255		var btn_top = $secret_password_btn.position().top + $secret_password_btn.height() + 35 + 5;
256		$("#secret_comment_password").css('top', $secret_password_wrap.position().top + btn_top);
257		
258		$("#secret_comment_password").show();
259	}
260}

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.