PageSourceSearch

https://narucnc.co.kr/js/module/comments.js

js narucnc.co.kr collected 2026-09-24 15:05:54 UTC 65,368 bytes, 1,340 lines download raw bytes

1(function($) {
2
3	var _pb_blocklang = LANG;
4
5	if(typeof user == 'undefined') {
6		var user = {
7			'id' : '',
8			'reply' : '',
9			'name' : '',
10			'pass' : '',
11			'parent' : '',
12			'content' : '',
13			'key' : '',
14			'secret' : ''
15		}
16	}
17
18	var resetUser = function(o) {
19		$.each(o,function(k,v) {
20			o[k] = '';
21		});
22
23		if(typeof o['btn'] != 'undefined') delete o['btn'];
24		return o;
25	}
26	var uniqID = function() {
27		return Math.round(new Date().getTime() + (Math.random() * 100));
28	}
29
30	var tplCommentWrap = function(ctype,cmode,cview) {
31		var id = uniqID(),
32			menu_lock = (PAGE_MODE == 'c') ? '' : property.ISLOCK,
33			comments_class = (typeof menu_lock != 'undefined' && menu_lock == 'true') ? 'hide ' : '';
34		if(ctype == 'P' && cmode == 'project') comments_class += 'galProjectBg ';
35
36		$str = $('<div class="page-comments ' + comments_class + '" data-id="' + cview + '"></div>');
37		$str.css({
38			'text-align' : 'center',
39			'font-size' : '20px',
40			'background-image' : 'url(https://storage.googleapis.com/i.addblock.net/preloader2.gif)',
41			'background-position' : 'center center',
42			'background-repeat' : 'no-repeat',
43			'min-height' : '50px'
44		});
45		return {
46			id : id,
47			tpl : $str
48		}
49	}
50
51	var tplCommentForm = function(type,my_image,parent_settings, write_level, writeable, login) {
52		var $form = $('.tpl-comment-form');
53		$form.fadeOut('fast',function() {
54			$(this).remove();
55		});
56		var cVALIDPLAN = (PAGE_MODE == 'c') ? VALIDPLAN : property.VALIDPLAN;
57		var cVALIDTYPE = (PAGE_MODE == 'c') ? VALIDTYPE : property.VALIDTYPE;
58		var comm_placeholder = $.lang[_pb_blocklang]['config.comments.placeholder'];
59		var comm_submit = '\
60				<div class="btn-box comment-submit" data-type="' + type + '"><span class="btn btn-submit btn-round"> ' +  $.lang[_pb_blocklang]['config.comment'] + '</span></div>\
61		';
62		var disabled = '';
63		if(writeable == false) {
64			disabled = 'disabled';
65			comm_submit = '\
66				<div class="btn-box comment-login" data-type="' + type + '"><span class="btn btn-round"> ' +  $.lang[_pb_blocklang]['config.comment.login-modal'] + '</span></div>\
67			';
68			if((!cVALIDPLAN || cVALIDTYPE == 'PK') && write_level == 'NM') write_level = 'M';
69			if(login == true) comm_submit = '';
70			switch(write_level) {
71				case 'ADM':
72					comm_placeholder = $.lang[_pb_blocklang]['config.comment.admin-can-write'];
73					break;
74				case 'M':
75					comm_placeholder = $.lang[_pb_blocklang]['config.comment.member-can-write'];
76					break;
77				case 'G':
78					comm_placeholder = $.lang[_pb_blocklang]['config.comment.group-can-write'];
79					break;
80			}
81		}
82		var default_profile = '//storage.googleapis.com/i.addblock.net/member/profile_default.jpg';
83		if(my_image == default_profile && $('.page-bottom[data-case="page-bottom2"], .page-bottom[data-case="page-bottom6"], .page-bottom[data-case="page-bottom9"], .page-bottom[data-case="page-bottom10"]').length > 0) {
84			my_image = '//storage.googleapis.com/i.addblock.net/member/profile_default3.png';
85		}
86		var str = '\
87			<div class="tpl-comment-form '+disabled+'">\
88				<div class="comm-wrap">\
89					<div class="comm-body">\
90						<span class="comm-profile">\
91							<svg viewbox="0 0 40 40" width="35" height="35">\
92								<pattern id="comment-write-image" patternUnits="userSpaceOnUse" width="40" height="40">\
93									<image xlink:href="' + my_image + '?_' + new Date().getTime() + '" width="40" height="40" />\
94								</pattern>\
95								<circle cx="20" cy="20" r="20" fill="url(#comment-write-image)"/>\
96							</svg>\
97						</span>\
98						<div class="comm-area">\
99							<textarea class="form-control" id="comm-content" placeholder="' + comm_placeholder + '" '+disabled+'></textarea>\
100						</div>\
101					</div>\
102					<div class="comm-footer">';
103			
104			if(typeof parent_settings != 'undefined' && typeof parent_settings.secretComment_display != 'undefined') {
105				secretComment = parent_settings.secretComment_display;
106				switch (secretComment) {
107					case 'N':
108						str += '<input type="hidden" id="comm-secret" data-secretComm="N" value="OFF">';
109						break;
110					case 'U':
111						if(writeable == true) {
112							str += '\
113				 			<div class="checkbox">\
114				 				<label>\
115				 					<input type="checkbox" id="comm-secret" data-secretComm="U">\
116				 					<span class="cl-icon"><svg viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg><svg viewBox="0 0 16 16" width="16" height="16" class="active"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg></span>\
117				 					' +  $.lang[_pb_blocklang]['config.secret-post'] + '\
118				 				</label>\
119				 			</div>';
120				 		} else {
121				 			str += '<input type="hidden" id="comm-secret" data-secretComm="U" value="">';
122				 		}
123						break;
124					case 'A':
125						str += '<input type="hidden" id="comm-secret" data-secretComm="A" value="ON">';
126						break;
127				}
128			} else {
129				if(writeable == true) {
130					str += '\
131		 			<div class="checkbox">\
132		 				<label>\
133		 					<input type="checkbox" id="comm-secret">\
134		 					<span class="cl-icon"><svg viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg><svg viewBox="0 0 16 16" width="16" height="16" class="active"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg></span>\
135		 					' +  $.lang[_pb_blocklang]['config.secret-post'] + '\
136		 				</label>\
137		 			</div>';
138		 		} else {
139		 			str += '<input type="hidden" id="comm-secret" data-secretComm="U" value="">';
140		 		}
141			}
142			
143			str += comm_submit +'\
144					</div>\
145				</div>\
146			</div>\
147			';
148		return str;
149	}
150
151	var updateForm = function(type, content, input,id, only_secret, parent_settings) {
152		var secret = (user.secret) ? 'checked' : '',
153			area_str = '\
154							<input type="hidden" id="update-passwd" value="' + input + '">\
155							<input type="hidden" id="update-id" value="' + id + '">\
156							<textarea class="form-control" id="update-content" placeholder="' + $.lang[_pb_blocklang]['config.comments.placeholder'] + '">' + content + '</textarea>\
157			',
158			footer_str = '\
159					<div class="comm-footer">\
160			 			<div class="checkbox">\
161		';
162
163		var secretComment = (typeof $('#comm-secret').attr('data-secretComm') != 'undefined')? $('#comm-secret').attr('data-secretComm'):'U';
164		// console.log(secretComment);
165		switch (secretComment) {
166			case 'N':
167				footer_str += '<input type="hidden" id="update-secret" value="OFF">';
168				break;
169			case 'U':
170				if(!only_secret) {
171					if($('#comm-secret').val() != 'OFF') {
172						footer_str += '\
173		 				<label>\
174		 					<input type="checkbox" id="update-secret" ' + secret + '>\
175		 					<span class="cl-icon"><svg viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg><svg viewBox="0 0 16 16" width="16" height="16" class="active"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg></span>\
176		 					' +  $.lang[_pb_blocklang]['config.secret-post'] + '\
177		 				</label>\
178						';
179					}
180					 
181				} else {
182					footer_str += '\
183						<label data-toggle="tooltip" data-placement="top" data-html="true" data-original-title="' + $.lang[_pb_blocklang]['config.secret-replies'] + '">\
184							<span class="cl-icon"><svg viewBox="0 0 16 16" width="16" height="16" class="active"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg></span>\
185			 				' +  $.lang[_pb_blocklang]['config.secret-post'] + '\
186						</label>';
187				}
188				break;
189			case 'A':
190				footer_str += '<input type="hidden" id="update-secret" value="ON">';
191				break;
192		}
193
194		footer_str += '\
195			 			</div>\
196						<div class="btn-box update-submit" data-type="' + type + '"><span class="btn btn-round btn-submit"> ' +  $.lang[_pb_blocklang]['config.comment'] + '</span></div>\
197						<div class="btn-box update-cancel"><span class="btn btn-round cm-cancel"> ' +  $.lang[_pb_blocklang]['config.cancel'] + '</span></div>\
198					</div>\
199		';
200
201		return {'area':area_str, 'footer':footer_str};
202	}
203
204	var replyForm = function(type, id, name, option, myImage) {
205		var secretComment = (typeof $('#comm-secret').attr('data-secretComm') != 'undefined')? $('#comm-secret').attr('data-secretComm'):'U';
206		var checkBoxSVG = '\
207			',
208			str = '\
209			<div class="tpl-comment-form reply-form">\
210				<div class="comm-wrap">\
211					<div class="comm-body">\
212						<span class="comm-profile">\
213							<svg viewbox="0 0 40 40" width="35" height="35">\
214								<pattern id="comment-reply-image' + id + '" patternUnits="userSpaceOnUse" width="40" height="40">\
215									<image xlink:href="' + myImage + '?_' + new Date().getTime() + '" width="40" height="40" />\
216								</pattern>\
217								<circle cx="20" cy="20" r="20" fill="url(#comment-reply-image' + id + ')"/>\
218							</svg>\
219						</span>\
220						<div class="comm-area">\
221							<input type="hidden" id="reply-id" value="' + id + '">\
222							<input type="hidden" id="reply-name" value="' + name + '">\
223							<textarea class="form-control" id="reply-content" placeholder="' + $.lang[_pb_blocklang]['config.comments.placeholder'] + '"></textarea>\
224						</div>\
225					</div>\
226					<div class="comm-footer">\
227			 			<div class="checkbox">\
228		';
229		
230		switch (secretComment) {
231			case 'N':
232				str += '<input type="hidden" id="reply-secret" value="OFF">';
233				break;
234			case 'U':
235				if(!option) {
236					if($('#comm-secret').val() != 'OFF') {
237					str += '\
238		 				<label>\
239		 					<input type="checkbox" id="reply-secret">\
240							<span class="cl-icon"><svg viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg><svg viewBox="0 0 16 16" width="16" height="16" class="active"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg></span>\
241							' +  $.lang[_pb_blocklang]['config.secret-post'] + '\
242		 				</label>\
243					'; 
244					}
245				} else {
246					str += '\
247						<label data-toggle="tooltip" data-placement="top" data-html="true" data-original-title="' + $.lang[_pb_blocklang]['config.secret-replies'] + '">\
248							<span class="cl-icon"><svg viewBox="0 0 16 16" width="16" height="16" class="active"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg></span>\
249			 				' +  $.lang[_pb_blocklang]['config.secret-post'] + '\
250						</label>';
251				}
252				break;
253			case 'A':
254				str += '<input type="hidden" id="reply-secret" value="ON">';
255				break;
256		}
257
258		str += '\
259			 			</div>\
260						<div class="btn-box reply-submit" data-type="' + type + '"><span class="btn btn-round btn-submit"> ' +  $.lang[_pb_blocklang]['config.comment'] + '</span></div>\
261						<div class="btn-box reply-cancel"><span class="btn btn-round cm-cancel"> ' +  $.lang[_pb_blocklang]['config.cancel'] + '</span></div>\
262					</div>\
263				</div>\
264			</div>\
265		';
266
267		return str;
268	}
269
270
271	var writeForm = function(token) {
272		var F_SITEUM = (typeof SITEUM == 'undefined') ? property.SITEUM : SITEUM,
273			F_VALIDPLAN = (typeof VALIDPLAN == 'undefined') ? property.VALIDPLAN : VALIDPLAN,
274			F_VALIDTYPE = (typeof VALIDTYPE == 'undefined') ? property.VALIDTYPE : VALIDTYPE,
275			F_SERVICE = (typeof SERVICE == 'undefined') ? property.SERVICE : SERVICE,
276			isGabia = (F_SERVICE.indexOf('gabia') > -1) ? true : false,
277			joinUrl = (LANG != 'ko') ? '//creatorlink.net/en/member/join' : '//creatorlink.net/member/join' ;
278
279		if(F_VALIDTYPE != 'SM' && (F_VALIDTYPE != 'BN' && F_SITEUM > -1)) F_SITEUM = -1;
280
281        if(isGabia) { // gabia
282			return '' + 
283				'<ul class="comment-signForm nav" role="tablist">' +
284					'<li class="signType" role="presentation"><a href="#sitemember" aria-controls="sitemember" role="tab" data-toggle="tab">' +  $.lang[_pb_blocklang]['siteum.login.member'] + '</a></li>' +
285					'<li class="signType active" role="presentation"><a href="#anonymous" aria-controls="anonymous" role="tab" data-toggle="tab">' +  $.lang[_pb_blocklang]['config.anonymous'] + '</a></li>' +
286				'</ul>' +
287				'<div class="tab-content">' +
288					'<div role="tabpanel" class="tab-pane" id="sitemember">' +
289				        '<div class="form-inline comment-addform">' +
290				        	'<div class="cl-s-form-wrap">' +
291								'<div class="cl-s-form-group">' +
292									'<input type="text" class="cl-s-form-control" id="um_cmt_id" name="um_id" required="required" value="">' +
293									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['siteum.login.id'] + '</label>' +
294								'</div>' +
295							'</div>' +
296				        	'<div class="cl-s-form-wrap mt-10">' +
297								'<div class="cl-s-form-group">' +
298									'<input type="password" class="cl-s-form-control" id="um_cmt_password" name="um_password" required="required" value="">' +
299									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['siteum.login.password'] + '</label>' +
300								'</div>' +
301							'</div>' +
302				        '</div>' +
303				        '<div class="btn-wrap comment-addform mt-30">' +
304				        	'<a href="#" class="btn btn-primary btn-lg btn-block comm-login">' +  $.lang[_pb_blocklang]['config.modal.login'] + '</a>' +
305				        	'<button type="button" class="btn-modal-cancel" data-dismiss="modal">' +  $.lang[_pb_blocklang]['config.cancel'] + '</button>' +
306				        '</div>' +
307					'</div>' +
308					'<div role="tabpanel" class="tab-pane active" id="anonymous">' +
309						'<div class="form-inline comment-addform">' +
310						  	'<div class="cl-s-form-wrap">' +
311								'<div class="cl-s-form-group">' +
312									'<input type="text" class="cl-s-form-control" id="comm-name" required="required" value="">' +
313									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['config.modal.name'] + '</label>' +
314								'</div>' +
315							'</div>' +
316				        	'<div class="cl-s-form-wrap mt-10">' +
317								'<div class="cl-s-form-group">' +
318									'<input type="password" class="cl-s-form-control" id="comm-pass" required="required" value="">' +
319									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['siteum.login.password'] + '</label>' +
320								'</div>' +
321							'</div>' +
322						'</div>' +
323						'<div class="kcaptcha-box comment-addform input-text mt-30">' +
324							'<div class="col-xs-12 col-sm-5 col-md-5 no-padding text-left kcaptcha-img">' +
325								'<p id="write_option">' +
326									'<img src="" id="kcaptcha" alt="' +  $.lang[_pb_blocklang]['config.captcha-alt'] + '"/>' +
327								'</p>' +
328							'</div>' +
329							'<div class="col-xs-12 col-sm-7 col-md-7 no-padding text-left kcaptcha-text">' +
330								'<input type="text" id="wr_key" name="wr_key" class="col-sm-12 form-control" placeholder="' +  $.lang[_pb_blocklang]['config.enter-captcha'] + '"/>' +
331								'<a class="kcaptcha-change hand"><svg viewBox="0 0 24 24" width="24" height="24">
331<path d="M12 5c-3.64 0-6.63 2.78-6.97 6.33L3.35 9.65l-0.71 0.71 2.85 2.85 2.85-2.85L7.65 9.65l-1.59 1.59C6.43 8.29 8.95 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6c-1.66 0-3.17-0.68-4.26-1.78l-0.71 0.71C8.3 18.21 10.06 19 12 19c3.87 0 7-3.13 7-7S15.87 5 12 5z"/></svg><span>' +  $.lang[_pb_blocklang]['config.change-captcha'] + '</span></a>' +
332							'</div>' +
333						'</div>' +
334					'</div>' +
335				'</div>';
336		} else if(F_SITEUM > 0) { // BN plan & used site member - um & anonymous
337			return '' +
338				'<ul class="comment-signForm nav" role="tablist">' +
339					'<li class="signType active" role="presentation"><a href="#sitemember" aria-controls="sitemember" role="tab" data-toggle="tab">' +  $.lang[_pb_blocklang]['siteum.login.member'] + '</a></li>' +
340					'<li class="signType" role="presentation"><a href="#anonymous" aria-controls="anonymous" role="tab" data-toggle="tab">' +  $.lang[_pb_blocklang]['config.anonymous'] + '</a></li>' +
341				'</ul>' +
342				'<div class="tab-content">' +
343					'<div role="tabpanel" class="tab-pane active" id="sitemember">' +
344				        '<div class="form-inline comment-addform">' +
345				        	'<div class="cl-s-form-wrap">' +
346								'<div class="cl-s-form-group">' +
347									'<input type="text" class="cl-s-form-control" id="um_cmt_id" name="um_id" required="required" value="">' +
348									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['siteum.login.id'] + '</label>' +
349								'</div>' +
350							'</div>' +
351				        	'<div class="cl-s-form-wrap mt-10">' +
352								'<div class="cl-s-form-group">' +
353									'<input type="password" class="cl-s-form-control" id="um_cmt_password" name="um_password" required="required" value="">' +
354									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['siteum.login.password'] + '</label>' +
355								'</div>' +
356							'</div>' +
357				        '</div>' +
358				        '<div class="btn-wrap comment-addform mt-30">' +
359				        	'<a href="#" class="btn btn-primary btn-lg btn-block comm-login">' +  $.lang[_pb_blocklang]['config.modal.login'] + '</a>' +
360				        	'<button type="button" class="btn-modal-cancel" data-dismiss="modal">' +  $.lang[_pb_blocklang]['config.cancel'] + '</button>' +
361				        '</div>' +
362					'</div>' +
363					'<div role="tabpanel" class="tab-pane" id="anonymous">' +
364						'<div class="form-inline comment-addform">' +
365						  	'<div class="cl-s-form-wrap">' +
366								'<div class="cl-s-form-group">' +
367									'<input type="text" class="cl-s-form-control" id="comm-name" required="required" value="">' +
368									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['config.modal.name'] + '</label>' +
369								'</div>' +
370							'</div>' +
371				        	'<div class="cl-s-form-wrap mt-10">' +
372								'<div class="cl-s-form-group">' +
373									'<input type="password" class="cl-s-form-control" id="comm-pass" required="required" value="">' +
374									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['siteum.login.password'] + '</label>' +
375								'</div>' +
376							'</div>' +
377						'</div>' +
378						'<div class="kcaptcha-box comment-addform input-text mt-30">' +
379							'<div class="col-xs-12 col-sm-5 col-md-5 no-padding text-left kcaptcha-img">' +
380								'<p id="write_option">' +
381									'<img src="" id="kcaptcha" alt="' +  $.lang[_pb_blocklang]['config.captcha-alt'] + '"/>' +
382								'</p>' +
383							'</div>' +
384							'<div class="col-xs-12 col-sm-7 col-md-7 no-padding text-left kcaptcha-text">' +
385								'<input type="text" id="wr_key" name="wr_key" class="col-sm-12 form-control" placeholder="' +  $.lang[_pb_blocklang]['config.enter-captcha'] + '"/>' +
386								'<a class="kcaptcha-change hand"><svg viewBox="0 0 24 24" width="24" height="24"><path d="M12 5c-3.64 0-6.63 2.78-6.97 6.33L3.35 9.65l-0.71 0.71 2.85 2.85 2.85-2.85L7.65 9.65l-1.59 1.59C6.43 8.29 8.95 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6c-1.66 0-3.17-0.68-4.26-1.78l-0.71 0.71C8.3 18.21 10.06 19 12 19c3.87 0 7-3.13 7-7S15.87 5 12 5z"/></svg><span>' +  $.lang[_pb_blocklang]['config.change-captcha'] + '</span></a>' +
387							'</div>' +
388						'</div>' +
389					'</div>' +
390				'</div>';
391		} else if(F_VALIDPLAN) { // is plan - only anonymous
392			return '' + 
393				'<ul class="comment-signForm nav" role="tablist">' +
394					'<li class="signType active" role="presentation"><a href="#anonymous" aria-controls="anonymous" role="tab" data-toggle="tab"><!--<img src="https://storage.googleapis.com/i.addblock.net/icon/icon-sign-anonymous.png"><br><br>-->' +  $.lang[_pb_blocklang]['config.anonymous'] + '</a></li>' +
395				'</ul>' +
396				'<div class="tab-content">' +
397					'<div role="tabpanel" class="tab-pane active" id="anonymous">' +
398						'<div class="form-inline comment-addform">' +
399						  	'<div class="cl-s-form-wrap">' +
400								'<div class="cl-s-form-group">' +
401									'<input type="text" class="cl-s-form-control" id="comm-name" required="required" value="">' +
402									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['config.modal.name'] + '</label>' +
403								'</div>' +
404							'</div>' +
405				        	'<div class="cl-s-form-wrap mt-10">' +
406								'<div class="cl-s-form-group">' +
407									'<input type="password" class="cl-s-form-control" id="comm-pass" required="required" value="">' +
408									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['config.modal.password'] + '</label>' +
409								'</div>' +
410							'</div>' +
411						'</div>' +
412						'<div class="kcaptcha-box comment-addform input-text mt-30">' +
413							'<div class="col-xs-12 col-sm-5 col-md-5 no-padding text-left kcaptcha-img">' +
414								'<p id="write_option">' +
415									'<img src="" id="kcaptcha" alt="' +  $.lang[_pb_blocklang]['config.captcha-alt'] + '"/>' +
416								'</p>' +
417								// '<div id="recaptcha" data-stoken="' + token + '" data-res=""></div>' + 
418							'</div>' +
419							'<div class="col-xs-12 col-sm-7 col-md-7 no-padding text-left kcaptcha-text">' +
420								'<input type="text" id="wr_key" name="wr_key" class="col-sm-12 form-control" placeholder="' +  $.lang[_pb_blocklang]['config.enter-captcha'] + '"/>' +
421								'<a class="kcaptcha-change hand"><svg viewBox="0 0 24 24" width="24" height="24">
421<path d="M12 5c-3.64 0-6.63 2.78-6.97 6.33L3.35 9.65l-0.71 0.71 2.85 2.85 2.85-2.85L7.65 9.65l-1.59 1.59C6.43 8.29 8.95 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6c-1.66 0-3.17-0.68-4.26-1.78l-0.71 0.71C8.3 18.21 10.06 19 12 19c3.87 0 7-3.13 7-7S15.87 5 12 5z"/></svg><span>' +  $.lang[_pb_blocklang]['config.change-captcha'] + '</span></a>' +
422							'</div>' +
423						'</div>' +
424					'</div>' +
425				'</div>';
426
427		} else { // free - creatorlink & anonymous
428			return '' + 
429				'<ul class="comment-signForm nav" role="tablist">' +
430					'<li class="signType active" role="presentation"><a href="#creatorlink" aria-controls="creatorlink" role="tab" data-toggle="tab">' +  $.lang[_pb_blocklang]['config.creatorlink'] + '</a></li>' +
431					'<li class="signType" role="presentation"><a href="#anonymous" aria-controls="anonymous" role="tab" data-toggle="tab">' +  $.lang[_pb_blocklang]['config.anonymous'] + '</a></li>' +
432				'</ul>' +
433				'<div class="tab-content">' +
434					'<div role="tabpanel" class="tab-pane active" id="creatorlink">' +
435				        '<div class="form-inline comment-addform">' +
436				        	'<div class="cl-s-form-wrap">' +
437								'<div class="cl-s-form-group">' +
438									'<input type="text" class="cl-s-form-control" id="mb_cmt_id" name="mb_id" required="required" value="">' +
439									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['siteum.login.id'] + '</label>' +
440								'</div>' +
441							'</div>' +
442				        	'<div class="cl-s-form-wrap mt-10">' +
443								'<div class="cl-s-form-group">' +
444									'<input type="password" class="cl-s-form-control" id="mb_cmt_password" name="mb_password" required="required" value="">' +
445									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['siteum.login.password'] + '</label>' +
446								'</div>' +
447							'</div>' +
448				        '</div>' +
449				        '<div class="bottom-box text-right">' +
450							'<span>' +  $.lang[_pb_blocklang]['page.member.login-modal.jointext'] + '</span>&nbsp;&nbsp;&nbsp;<a href="' + joinUrl + '" target="_blank"><b>' +  $.lang[_pb_blocklang]['page.member.login-modal.join2'] + '<svg viewBox=\"0 0 6 8\" width=\"6\" height=\"8\"><polygon points=\"2 0 0 0 4 4 0 8 2 8 6 4 \"/></svg></b></a>' +
451						'</div>' +
452				        '<div class="btn-wrap comment-addform mt-30">' +
453				        	'<a href="#" class="btn btn-primary btn-lg btn-block comm-login">' +  $.lang[_pb_blocklang]['config.modal.login'] + '</a>' +
454				        	'<button type="button" class="btn-modal-cancel" data-dismiss="modal">' +  $.lang[_pb_blocklang]['config.cancel'] + '</button>' +
455				        '</div>' +
456					'</div>' +
457					'<div role="tabpanel" class="tab-pane" id="anonymous">' +
458						'<div class="form-inline comment-addform">' +
459						  	'<div class="cl-s-form-wrap">' +
460								'<div class="cl-s-form-group">' +
461									'<input type="text" class="cl-s-form-control" id="comm-name" required="required" value="">' +
462									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['config.modal.name'] + '</label>' +
463								'</div>' +
464							'</div>' +
465				        	'<div class="cl-s-form-wrap mt-10">' +
466								'<div class="cl-s-form-group">' +
467									'<input type="password" class="cl-s-form-control" id="comm-pass" required="required" value="">' +
468									'<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['config.modal.password'] + '</label>' +
469								'</div>' +
470							'</div>' +
471						'</div>' +
472						'<div class="kcaptcha-box comment-addform input-text mt-30">' +
473							'<div class="col-xs-12 col-sm-5 col-md-5 no-padding text-left kcaptcha-img">' +
474								'<p id="write_option">' +
475									'<img src="" id="kcaptcha" alt="' +  $.lang[_pb_blocklang]['config.captcha-alt'] + '"/>' +
476								'</p>' +
477								// '<div id="recaptcha" data-stoken="' + token + '" data-res=""></div>' + 
478							'</div>' +
479							'<div class="col-xs-12 col-sm-7 col-md-7 no-padding text-left kcaptcha-text">' +
480								'<input type="text" id="wr_key" name="wr_key" class="col-sm-12 form-control" placeholder="' +  $.lang[_pb_blocklang]['config.enter-captcha'] + '"/>' +
481								'<a class="kcaptcha-change hand"><svg viewBox="0 0 24 24" width="24" height="24">
481<path d="M12 5c-3.64 0-6.63 2.78-6.97 6.33L3.35 9.65l-0.71 0.71 2.85 2.85 2.85-2.85L7.65 9.65l-1.59 1.59C6.43 8.29 8.95 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6c-1.66 0-3.17-0.68-4.26-1.78l-0.71 0.71C8.3 18.21 10.06 19 12 19c3.87 0 7-3.13 7-7S15.87 5 12 5z"/></svg><span>' +  $.lang[_pb_blocklang]['config.change-captcha'] + '</span></a>' +
482							'</div>' +
483						'</div>' +
484					'</div>' +
485				'</div>';
486		}
487	}
488
489	$('.signType a[data-toggle="tab"]').live('click', function (e) {
490		var tab = $(this).attr('aria-controls'),
491			thisModal = $(this).closest('.flat-modal');
492		
493		switch(tab) {
494			case "creatorlink":
495			case "sitemember": thisModal.find('.modal-footer').hide(); break;
496			default:  thisModal.find('.modal-footer').show(); break;
497		}
498	});
499
500	var passwdForm = function() {
501		return '' +
502//			'<div class="form-inline comment-addform password">' + 				
503//			  	'<div class="form-group">' +
504//			    	'<label class="sr-only" for="comm-pass">' +  $.lang[_pb_blocklang]['config.modal.password'] + '</label>' +
505//			    	'<input type="password" class="form-control" id="comm-pass" placeholder="' +  $.lang[_pb_blocklang]['config.modal.password'] + '">' +
506//			  	'</div>' +
507//			'</div>';
508			'<div>\
509				<div class="cl-s-form-wrap comment-addform password">\
510					<div class="cl-s-form-group">\
511						<input type="password" class="cl-s-form-control comm-pass" id="input-password" required="required">\
512						<label for="input" class="cl-s-control-label">' + $.lang[_pb_blocklang]['config.modal.password'] + '</label>\
513					</div>\
514				</div>\
515			</div>';
516	}
517
518
519	$('.comm-login').live('click',function(e) {
520
521		$('.comment .error').remove();
522		var commentLoginModal = $(this).closest('.modal'),
523			F_SERVICE = (typeof SERVICE == 'undefined') ? property.SERVICE : SERVICE,
524			F_VALIDTYPE = (typeof VALIDTYPE == 'undefined') ? property.VALIDTYPE : VALIDTYPE,
525			F_SITEUM = (typeof SITEUM == 'undefined') ? property.SITEUM : SITEUM,
526			isGabia = (F_SERVICE.indexOf('gabia') > -1) ? true : false,
527			login_type = (isGabia || F_VALIDTYPE == 'SM' || (F_VALIDTYPE == 'BN' && F_SITEUM > 0)) ? 'um' : 'mb',
528			$input_id = $('#'+login_type+'_cmt_id'),
529			$input_password = $('#'+login_type+'_cmt_password'),
530			isSubmit = true,
531			idErrorTxt = (isGabia || F_VALIDTYPE=='SM' || (F_VALIDTYPE=='BN' && F_SITEUM > 0)) ? $.lang[_pb_blocklang]['config.enter-id'] : $.lang[_pb_blocklang]['config.enter-email'];
532
533		if($input_id.val().length==0) {
534			//$input_id.after('<label class="error">! ' +  $.lang[_pb_blocklang]['config.enter-id'] + '</label>').focus();
535			//$input_id.closest('.cl-s-form-wrap').addClass('empty');
536			$input_id.closest('.cl-s-form-wrap').addClass('empty');
537			$input_id.closest('.cl-s-form-wrap').after('<label for="input" class="cl-s-control-label error"><svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>'+idErrorTxt+'</label>');
538			$input_id.focus();
539			isSubmit = false;
540		}
541
542		if($input_password.val().length==0) {
543			//$input_password.after('<label class="error">! ' +  $.lang[_pb_blocklang]['config.enter-password'] + '</label>').focus();
544			//$input_password.closest('.cl-s-form-wrap').addClass('empty');
545			$input_password.closest('.cl-s-form-wrap').addClass('empty');
546			$input_password.closest('.cl-s-form-wrap').after('<label for="input" class="cl-s-control-label error"><svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>'+$.lang[_pb_blocklang]['config.enter-password']+'</label>');
547			$input_password.focus();
548			isSubmit = false;
549		}
550
551		modalEmptyCheck();
552
553		if(isSubmit) {
554
555			if(login_type == 'mb') {
556				$.post('/member/login/outlogin', { mb_id : $input_id.val(), mb_password : $input_password.val(), sid : sid}, function(data) {
557					if(typeof data.error != 'undefined' && data.error) {
558						$('.tab-pane.active').find('.bottom-box.text-right').before('<label class="error text-center error_login"><svg viewBox="0 0 13 13" width="13" height="13">
558<path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg><span>' + data.error + '</span></label>');
559						$('.cl-s-form-group input').val('');
560						$('.tab-pane.active').find('.cl-s-form-wrap').addClass('empty');
561						return false;
562					}
563
564					postComment(user);
565					commentLoginModal.modal('hide');
566				}, 'json');
567			} else {
568
569				var input_data = {
570					'id' : $input_id.val().toLowerCase(),
571					'password' : hex_md5($input_password.val()),
572				};
573
574				$.post('/umember/login/in', { sid : SID, data : JSON.stringify(input_data) }, function(data) {
575
576					if (typeof data.result != 'undefined' && data.result == 'fail') {
577						alert(data.message);
578						$input_id.focus();
579						return false;
580					} else {
581						$.umember.init();
582						postComment(user);
583						commentLoginModal.modal('hide');
584
585						if(typeof data.result != 'undefined' && data.result == 'success') {
586							if(typeof data.ss_url != 'undefined' && data.ss_url) {
587								$.each(data.ss_url, function(i,url) {
588									$('.dsgn-body').after('<img class="auth-img" src="' + ss_url + '">');
589								});
590							}
591
592							if(typeof data.ga_uid != 'undefined' && data.ga_uid) {
593								localStorage.setItem('googleAnalyticsUID'+sid, data.ga_uid);
594							}
595						}
596					}
597					
598				},'json');
599
600			}
601
602		}
603
604	});
605
606	$('.comment-list .cm-delete').die('click');
607	$('.comment-list .cm-delete').live('click', function(e) {
608		var id = $(this).attr('data-id');
609		$.comment.delete(id);
610	});
611
612	$('.comment-list .cm-update').die('click');
613	$('.comment-list .cm-update').live('click', function(e) {
614		var id = $(this).attr('data-id'),
615			cmt = $(this),
616			pageCheck = $(this).parents('.page-comments').hasClass('galProjectBg') ? true : false;
617
618		$.post('/template/comment/info', { id:id }, function(data) {
619			if(typeof data.error != 'undefined' && data.error) {
620				$(this).showModalFlat('ERROR',data.error,true,false,'','ok','','cl-modal cl-none-title cl-cmmodal cl-p130 cl-s-btn w560 cl-t80');
621				return false;
622			}
623
624
625			resetUser(user);
626			if(data.sign == false) {
627				var modal = $(this).showModalFlat($.lang[_pb_blocklang]['config.comment-edit'],passwdForm(),true,true,function() {
628					var $pass = $('.comm-pass'),
629						isSubmit = true,
630						userInput = $pass.val();
631					$('label.error').remove();
632					if($pass.val().length<4) {
633						//$pass.parents('.comment-addform.password').after('<label class="error">' +  $.lang[_pb_blocklang]['config.pass-min-length'] + '</label>').focus();
634						$pass.closest('.cl-s-form-wrap').addClass('error');
635						$pass.closest('.cl-s-form-wrap').after('<label for="input" class="cl-s-control-label error"><svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>'+$.lang[_pb_blocklang]['config.pass-min-length']+'</label>');
636						$pass.focus();
637						isSubmit = false;
638					}
639
640					if(isSubmit) {
641						//$('.comment-addform.password').parent().find('.error').remove();
642						$('.comment-addform.password').removeClass('error');
643						$.post('/template/comment/password',{ id: id, passwd : hex_md5($pass.val()) }, function(c_data) {
644							if(typeof c_data.error != 'undefined' && c_data.error) {
645								//$(this).showModalFlat('ERROR',c_data.error,true,false,'','ok');
646								//$('.comment-addform.password').before("<label class='error'>" + c_data.error + "</label>");
647								$pass.closest('.cl-s-form-wrap').addClass('error');
648								$pass.closest('.cl-s-form-wrap').after('<label for="input" class="cl-s-control-label error"><svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>
648'+c_data.error+'</label>');
649								return false;
650							}
651							modal.modal('hide');
652							cmt.closest('.cm-row').addClass('add-form nonmember');
653
654							var nonmemberName = cmt.closest('.cm-row').find('.cm-name').text();
655							cmt.closest('.cm-row').find('.cm-name').attr('data-nonmember-name', nonmemberName);
656							cmt.closest('.cm-row').find('.cm-name').text(c_data.name);
657							cmt.closest('.cm-row').find('.cm-name').attr('data-name', c_data.name);
658
659							insertReplyForm(id,c_data,userInput,pageCheck);
660						},'json');
661					}
662					modalEmptyCheck();
663				},'cancel','ok', 'cl-modal cl-cmmodal cl-p70 cl-s-btn w560 site-comment-modal cl-close-btn cl-t80');
664			} else {
665				cmt.closest('.cm-row').addClass('add-form');
666				insertReplyForm(id,data,'',pageCheck);
667			}
668		},'json');
669	});
670
671	var insertReplyForm = function(id, data, userInput,pageCheck) {
672		activeControls(false);
673		var $cm = $('.cm-content[data-id="' + id + '"]'),
674			pageCheck = (pageCheck) ? pageCheck : false;
675		
676		$cm.empty();
677		user.content = data.reply + data.lock + '<span class="cm-textarea">' + data.content + '</span>';
678		user.secret = data.secret;
679		var update_temp = updateForm(data.type,data.content,userInput,id,data.only_secret, data.parent_settings);
680		$cm.html(update_temp['area']);
681		$cm.closest('.comm-wrap').append(update_temp['footer']).addClass('update-wrap');
682		$('.cm-reply[data-id="' + id + '"]').removeClass('disabled');
683
684		if(data.r_data) {
685			$.each(data.r_data, function(i,o) {
686				var nonmemberName = $('.cm-row[id="' + o.id + '"] .cm-name').text();
687				var nonmemberReplyName = $('.cm-row[id="' + o.id + '"] .user-reply').text();
688				$('.cm-row[id="' + o.id + '"] .cm-name').attr('data-nonmember-name', nonmemberName);
689				$('.cm-row[id="' + o.id + '"] .user-reply').attr('data-nonmember-replyname', nonmemberReplyName);
690
691				$('.cm-row[id="' + o.id + '"] .cm-name').html(o.name.trim());
692				$('.cm-row[id="' + o.id + '"] .cm-reply').attr('data-name', data.name.trim());
693				$('.cm-row[id="' + o.id + '"] .user-reply').html('@'+o.reply_name.trim());
694				$('.cm-content[data-id="' + o.id + '"]').find('.cm-textarea').html(o.content);
695				$('.cm-reply[data-id="' + o.id + '"]').removeClass('disabled');
696			});
697		}
698	}
699
700	$('.comment-list .cm-like').die('click');
701	$('.comment-list .cm-like').live('click', function(e) {
702		e.stopPropagation();
703		setLike($(this), 'comment');
704	});
705
706	$('.comment-list .cm-reply').die('click');
707	$('.comment-list .cm-reply').live('click', function(e) {
708		var type = $(this).closest('.cm-section').attr('data-type'),
709			id = $(this).attr('data-id'),
710			name = $(this).attr('data-name'),
711			option = $(this).attr('data-option'),
712			myImage = $(this).attr('data-myImage'),
713			$cm = $('.cm-content[data-id="' + id + '"]');
714
715		$('.cm-controls').hide().addClass('cm-hide').removeClass('cm-controls');
716		$(this).closest('.cm-row').addClass('add-form');
717		$cm.find('.tpl-comment-form.reply-form').remove();
718		$cm.append(replyForm(type,id,name,option,myImage));
719	});
720
721	$('.comment-list .cm-cancel').die('click');
722	$('.comment-list .cm-cancel').live('click', function(e) {
723		$('.cm-hide').addClass('cm-controls').removeClass('cm-hide');
724		$(this).closest('.cm-row').removeClass('add-form');
725		// var nonmemberName = $(this).closest('.cm-row').find('.cm-name').attr('data-nonmember-name');
726		// if(typeof nonmemberName !== 'undefined' && nonmemberName) {
727		// 	$(this).closest('.cm-row').find('.cm-name').text(nonmemberN
727ame);
728		// }
729
730		// if($('.cm-row.line').length > 0) {
731		// 	$('.cm-row.line').each(function(idx, v){
732		// 		var nonmemberName = $(v).find('.cm-name').attr('data-nonmember-name');
733		// 		var nonmemberReplyName = $(v).find('.user-reply').attr('data-nonmember-replyname');
734		// 		if(typeof nonmemberName !== 'undefined' && nonmemberName) $(v).find('.cm-name').text(nonmemberName);
735		// 		if(typeof nonmemberReplyName !== 'undefined' && nonmemberReplyName) $(v).find('.user-reply').text(nonmemberReplyName);
736		// 	});
737		// }
738
739		$('.tpl-comment-form.reply-form').remove();
740		if($(this).closest('.comm-wrap').hasClass('update-wrap')) {
741			$(this).closest('.comm-wrap').find('.cm-content').html(user.content.replace(/\r\n|\n|\r/g, '<br />'));
742			$(this).closest('.comm-wrap').find('.comm-footer').remove();
743			$(this).closest('.comm-wrap').removeClass('update-wrap');
744		}
745
746	});
747
748	$('textarea[data-autoresize]').live('keyup',function(e) {
749		var offset = $(this).outerHeight() - $(this).height();
750		$(this).css('height', 'auto').css('height', $(this).prop('scrollHeight') + offset);
751	});
752
753	$(document).off('click', '.comment-submit');
754	$(document).on('click', '.comment-submit', function(e) {
755		$('.tpl-comment-form label.error').remove();
756		var content = $('#comm-content').val().trim();
757		var secret = ($('#comm-secret').is(':checked') || $('#comm-secret').val() == 'ON') ? 'ON' : '';
758		var error_str = '';
759
760		if(content.length < 2) error_str = $.lang[_pb_blocklang]['config.content-min-length'];
761
762		if(error_str.length > 0) {
763			$('.tpl-comment-form .comm-area textarea').after('<label class="error">' + error_str + '</label>');
764			return false;
765		}
766
767		resetUser(user);
768		user.content = content;
769		user.secret = secret;
770		user.btn = $(this);
771		signCheckPost();
772	});
773
774	$(document).off('click', '.comment-login');
775	$(document).on('click', '.comment-login', function(e) {
776		e.preventDefault();
777		var cVALIDTYPE = (PAGE_MODE == 'c') ? VALIDTYPE : property.VALIDTYPE;
778		var cSID = (PAGE_MODE == 'c') ? SID : property.SID;
779		var action = (cVALIDTYPE == 'SM')  ? '/_login' : '/_cllogin';
780		var url = $(location).attr('pathname');
781		var html = '<form name="write_login_form" id="write-login" method="post" action="' + action + '" style="display:none;">\
782						<input type="hidden" name="status" value="login">\
783						<input type="hidden" name="sid" value="'+cSID+'">\
784						<input type="hidden" name="url" value="'+url+'">\
785					</form>';
786		$('body').append(html);
787		document.write_login_form.submit();
788	});
789
790	$('.update-submit').die('click');
791	$('.update-submit').live('click',function(e) {
792		$('.comm-wrap.update-wrap label.error').remove();
793
794		var content = $('#update-content').val().trim(),
795			pass = $('#update-passwd').val(),
796			id = $('#update-id').val(),
797			secret = '',
798			error_str = '';
799
800		if(content.length < 2) error_str = $.lang[_pb_blocklang]['config.content-min-length'];
801
802		if(error_str.length > 0) {
803			$('.comm-wrap.update-wrap .comm-area textarea').after('<label class="error">' + error_str + '</label>');
804			return false;
805		}
806
807		if($('#update-secret').length>0) {
808			secret = ($('#update-secret').is(':checked') || $('#update-secret').val() == 'ON') ? 'ON' : '';
809		} else {
810			secret = ($('.cm-reply[data-id="' + id + '"]').attr('data-option')) ? 'ON' : '';
811		}
812
813		resetUser(user);
814		user.id = id;
815		user.pass = (pass) ? hex_md5(pass) : '';
816		user.content = content;
817		user.secret = secret;
818		user.btn = $(this);
819		postComment(user);
820	});
821
822	$('.reply-submit').die('click');
823	$('.reply-submit').live('click',function(e) {
824		$('.tpl-comment-form label.error').remove();
825		var content = $('#reply-content').val().trim(),
826			id = $('#reply-id').val(),
827			reply = $('#reply-name').val(),
828			secret = '',
829			error_str = '';
830
831		if(content.length < 2) error_str = $.lang[_pb_blocklang]['config.content-min-length'];
832
833		if(error_str.length > 0) {
834			$('.tpl-comment-form.reply-form .comm-area textarea').after('<label class="error">' + error_str + '</label>');
835			return false;
836		}
837
838		if($('#reply-secret').length>0) {
839			secret = ($('#reply-secret').is(':checked') || $('#reply-secret').val() == 'ON') ? 'ON' : '';
840		} else {
841			secret = ($('.cm-reply[data-id="' + id + '"]').attr('data-option')) ? 'ON' : '';
842		}
843
844		resetUser(user);
845		user.reply = reply;
846		user.parent = id;
847		user.content = content;
848		user.secret = secret;
849		user.btn = $(this);
850		signCheckPost();
851	});
852
853	$('.comment-list > li').live({
854		mouseover : function() {
855			if($(this).closest('.dsgn-body').hasClass('modoo')) {
856				$('.cm-controls').hide();
857				$(this).find('.cm-controls.cm-update').removeClass('disabled').show();
858				$(this).find('.cm-controls.cm-delete').removeClass('disabled').show();
859			} else {
860				$('.cm-controls').hide();
861				$(this).find('.cm-controls').show();
862			}
863		},
864		mouseleave : function () {
865			$('.cm-controls').hide();
866			$(this).find('.cm-controls').hide();
867		}
868	});
869
870	var activeControls = function(active) {
871		(typeof active=='undefined' || active==true) ? 
872			$('.cm-hide').addClass('cm-controls').removeClass('cm-hide') : 
873			$('.cm-controls').hide().addClass('cm-hide').removeClass('cm-controls');
874	}
875
876	var modalEmptyCheck = function() {
877		$('.cl-s-form-control').off().on({
878			keyup: function(e) {
879				if(e.keyCode === 13) {
880					if($(this).closest('.cl-s-form-wrap').next('.cl-s-form-wrap').length > 0) {
881						$(this).closest('.cl-s-form-wrap').next('.cl-s-form-wrap').find('.cl-s-form-control').focus();
882					} else if($(this).closest('.cl-s-form-wrap').next('#captcha:not(:empty)').length > 0) {
883						$('#wr_key').focus();
884					}
885				}
886			},
887			focus: function(e) {
888				$(this).closest('.cl-s-form-wrap').addClass('active');
889			},
890			blur: function(e) {
891				var inputEL = $(this),
892					type = $(this).attr('id'),
893					val = $(this).val().trim(),
894					error_str = '';
895
896				inputEL.closest('.cl-s-form-wrap').removeClass('active');
897				if(val.length == 0) {
898					inputEL.closest('.cl-s-form-wrap').removeClass('error').addClass('empty');
899					inputEL.closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove();
900					return false;
901				} else {
902					inputEL.closest('.cl-s-form-wrap').removeClass('empty');
903					var error_str = '';
904					if(type == 'comm-pass') {
905						if(val.length<4) {
906							error_str = '<svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>' + $.lang[_pb_blocklang]['config.pass-min-length'];
907						}
908					}
909					if(error_str.length > 0) {
910						inputEL.closest('.cl-s-form-wrap').addClass('error');
911						if(inputEL.parent().parent().find('.cl-s-control-label.error').length > 0) {
912							inputEL.parent().parent().find('.cl-s-control-label.error').html(error_str);
913						} else {
914							inputEL.parent().parent().next('.cl-s-control-label.error').remove();
915							inputEL.parent().parent().after('<label for="input" class="cl-s-control-label error">'+error_str+'</label>');
916						}
917						return false;
918					}
919				}
920				inputEL.closest('.cl-s-form-wrap').removeClass('error').removeClass('empty');
921				inputEL.parent().parent().next('.cl-s-control-label.error').remove();
922				if($('.error_login').length > 0) $('.error_login').remove();
923			}
924		});
925		$('#wr_key').off().on({
926			keyup: function(e) {
927				$(this).closest('.kcaptcha-box').removeClass('empty').removeClass('error');
928			},
929			focus: function(e) {
930				$(this).closest('.kcaptcha-box').addClass('active');
931			},
932			blur: function(e) {
933				if($(this).val().trim().length == 0) {
934					$(this).closest('.kcaptcha-box').removeClass('active');
935				} else {
936					$(this).closest('.kcaptcha-box').removeClass('empty').removeClass('error').removeClass('active');
937				}
938				$(this).closest('.kcaptcha-box').parent().find('.kcaptcha-error').remove();
939			}
940		});
941	}
942
943	var signCheckPost = function() {
944		var pid = (PAGE_MODE == 'c') ? PARENT.pid : property.PARENT.pid;
945		$.post('/fm/checkUser', { pid : pid, comment: true }, function(data) {
946			if(data.writeable == false && data.access=='G') {
947				$(this).showModalFlat('INFORMATION', $.lang[_pb_blocklang]['board.comment.group-can-write'],true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title');
948				return false;
949			}
950			if(data.writeable == false && data.access=='ADM') {
951				$(this).showModalFlat('INFORMATION', $.lang[_pb_blocklang]['board.comment.admin-can-write'],true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title');
952				return false;
953			}
954			if(!data.user || typeof data.user == 'undefined') {
955				var cSID = (PAGE_MODE == 'c') ? SID : property.SID;
956				var cBTN = $(user.btn);
957				var cTYPE = cBTN.attr('data-type');
958				var cPID = (PAGE_MODE == 'c') ? PARENT.pid : property.PARENT.pid;
959				var cVIEW = (PAGE_MODE == 'c') ? VIEW : property.VIEW;
960				var cVALIDTYPE = (PAGE_MODE == 'c') ? VALIDTYPE : property.VALIDTYPE;
961
962				if(	(typeof cSID == 'undefined' || !cSID) ||
963					(typeof cTYPE == 'undefined' || !cTYPE) ||
964					(typeof cPID == 'undefined' || !cPID) ||
965					(typeof cVIEW == 'undefined' || !cVIEW)
966				) {
967					console.log('error...');
968					console.log('cSID: ' + cSID);
969					console.log('cTYPE: ' + cTYPE);
970					console.log('cPID: ' + cPID);
971					console.log('cVIEW: ' + cVIEW);
972					return false;
973				}
974
975				var url = $(location).attr('pathname');
976
977				var aryKey = [], aryVal = [], aryCnt = 0;
978				$.map(property, function(val, key) {
979					aryKey[aryCnt] = key;
980					if (!val) val = '';
981					aryVal[aryCnt] = val; 
982					aryCnt++;
983				});
984				var strKey = aryKey.join('||');
985				var strVal = aryVal.join('||');
986				strVal = strVal.replace(/\"/gi, '@@');
987
988				user.parent = (user.parent) ? user.parent : '';
989				user.reply = (user.reply) ? user.reply : '';
990
991				$('#write-login').remove();
992				var action = (cVALIDTYPE == 'SM') ? '/_login' : '/_cllogin',
993					html = '<form name="write_login_form" id="write-login" method="post" action="' + action + '" style="display:none;">\
994								<input type="hidden" name="status" value="comment">\
995								<input type="hidden" name="sid" value="'+cSID+'">\
996								<input type="hidden" name="type" value="'+cTYPE+'">\
997								<input type="hidden" name="pid" value="'+cPID+'">\
998								<input type="hidden" name="view" value="'+cVIEW+'">\
999								<input type="hidden" name="url" value="'+url+'">\
1000								<input type="hidden" name="page_mode" value="'+data.access+'" />\
1001								<input type="hidden" name="reply_id" value="'+user.parent+'">\
1002								<input type="hidden" name="reply_name" value="'+user.reply+'">\
1003								<input type="hidden" name="comment" value="'+user.content+'" />\
1004								<input type="hidden" name="secret" value="'+user.secret+'" />\
1005								<input type="hidden" name="forum_email" value="'+$('#forum-email').val()+'" />\
1006								<input type="hidden" name="key" value="'+strKey+'" />\
1007								<input type="hidden" name="val" value="'+strVal+'" />\
1008							</form>';
1009
1010				$('body').append(html);
1011				document.write_login_form.submit();
1012
1013			} else {
1014				postComment(user);
1015			}
1016		},'json');		
1017	}	
1018
1019	var postComment = function(commentUser, callback) {
1020		var cSID = (PAGE_MODE == 'c') ? SID : property.SID;
1021		var cBTN = $(user.btn);
1022		var cTYPE = cBTN.attr('data-type');
1023		var cPID = (PAGE_MODE == 'c') ? PARENT.pid : property.PARENT.pid;
1024		var cVIEW = (PAGE_MODE == 'c') ? VIEW : property.VIEW;
1025		var forum_email = (PAGE_MODE == 's' && cTYPE == 'F') ? $('#forum-email').val() : '';
1026
1027		delete user.btn;
1028
1029		$.post('/template/comment/update', { user : JSON.stringify(commentUser), type : cTYPE, pid : cPID, view : cVIEW, sid : cSID, forum_email : forum_email, block_type : 'forum' }, function(r) {
1030			if(typeof r.error != 'undefined' && r.error) {
1031				$(this).showModalFlat('ERROR',r.error,true,false,'','ok');
1032				return false;
1033			}
1034
1035			$.comment.init();
1036			// setHeight(pageHeight());
1037
1038			if(typeof callback === 'function') {
1039				callback(r);
1040			}
1041
1042		},'json');
1043	}
1044
1045	var tplComment = function() {
1046		return '' +
1047			'<ul class="comment-list">' + 
1048			'</ul>';
1049	}
1050
1051	var tplCommentRow = function(type, id, name, content, datetime, reply, depth, option, lock, reply_btn, cmb, own, adm, mgr, my_image, mb_image, write_level, writeable, like, isLastReply, hasReply) {
1052		var line = (depth>0) ? 'line' : '';
1053		if(isLastReply) line += ' last-reply';
1054		if(hasReply) line += ' has-reply';
1055		var	userReply = 'disabled';
1056		var checkLogin = (PAGE_MODE == 'c')? true : property.UMEMBER.check_login;
1057		if (option) {
1058			userReply = (reply_btn) ? '' : 'disabled';
1059		} else {
1060			userReply  = (content=='') ? 'disabled' : '';
1061		}
1062
1063		var userUpdate = 'disabled',
1064			userDelete = 'disabled';
1065
1066		if(writeable == false) {
1067			userReply = 'disabled';
1068			userUpdate = 'disabled';
1069			userDelete = 'disabled';
1070		}
1071
1072		var userUpdate = (own && name) ? '' : 'disabled',
1073			userDelete = ((own || adm || mgr) && name) ? '' : 'disabled';
1074
1075		var empty = (name) ? '' : 'disabled',
1076			username = (name) ? name : $.lang[_pb_blocklang]['config.deleted-comment'],
1077			replyClass = (!name && line) ? ' deleted' : '';
1078
1079		var heart = '';
1080        var like_id = '';
1081        var like_cnt = 0;
1082        if(like) {
1083        	if(typeof like.own != 'undefined' && like.own) {
1084                like_id = (PAGE_MODE == 'c') ? VIEW : property.VIEW;
1085                heart = 'active';
1086            }
1087            like_cnt = like.cnt;
1088        }
1089		var default_profile = '//storage.googleapis.com/i.addblock.net/member/profile_default.jpg';
1090		if(mb_image == default_profile && $('.page-bottom[data-case="page-bottom2"], .page-bottom[data-case="page-bottom6"], .page-bottom[data-case="page-bottom9"], .page-bottom[data-case="page-bottom10"]').length > 0) {
1091			mb_image = '//storage.googleapis.com/i.addblock.net/member/profile_default3.png';
1092		}
1093		var comment_str = '\
1094			<li class="cm-row ' + line + replyClass + '" id="' + id + '">\
1095				<div class="comm-wrap">\
1096					<div class="comm-body">\
1097						<span class="comm-profile">\
1098							<svg viewbox="0 0 40 40" width="35" height="35">\
1099								<pattern id="comment-list-image' + id + '" patternUnits="userSpaceOnUse" width="40" height="40">\
1100									<image xlink:href="' + mb_image + '?_' + new Date().getTime() + '" width="40" height="40" />\
1101								</pattern>\
1102								<circle cx="20" cy="20" r="20" fill="url(#comment-list-image' + id + ')"/>\
1103							</svg>\
1104						</span>\
1105						<div class="comm-area">\
1106							<span class="cm-name ' + empty + '">' + username + '</span>\
1107							<span class="cm-time">' + datetime + '</span>';
1108			if(option != 'S' && like !== false) {
1109				comment_str += '\
1110							<span class="cm-like ' + heart + '" data-id="' + id + '" data-like="'+like_id+'">\
1111								<svg viewBox="0 0 28 28" width="28" height="28"><path d="m22.76 14.7-8.74 8.97-8.75-8.97m0 0c-2.31-2.32-2.37-6.14-.13-8.53 2.24-2.4 5.93-2.46 8.24-.14.23.23.44.48.63.75 1.93-2.67 5.59-3.2 8.16-1.2s3.09 5.79 1.16 8.45c-.18.24-.37.47-.58.68"></path><path d="M14.01 24.57c-.24 0-.48-.1-.64-.27l-8.74-8.97c-2.64-2.66-2.71-7.04-.15-9.78a6.576 6.576 0 0 1 4.74-2.12c1.79-.01 3.5.67 4.8 1.96a6.576 6.576 0 0 1 3.74-1.86c1.77-.25 3.54.22 4.97 1.34 2.95 2.29 3.55 6.64 1.33 9.69-.2.28-.42.54-.66.78l-.06.06-8.68 8.9c-.17.17-.4.27-.65.27zm-8.1-10.51c0 .01.01.01 0 0l8.1 8.32 8.1-8.31.06-.06c.15-.16.3-.33.43-.52 1.65-2.27 1.21-5.51-.98-7.22a4.723 4.723 0 0 0-3.61-.97c-1.31.2-2.47.91-3.27 2a.91.91 0 0 1-.73.37c-.29 0-.56-.14-.73-.38-.16-.22-.34-.44-.54-.64a4.78 4.78 0 0 0-3.49-1.43A4.83 4.83 0 0 0 5.8 6.78c-1.91 2.04-1.86 5.31.11 7.28z"></path></svg><span class="cm-like-cnt">'+like_cnt+'</span>\
1112							</span>\
1113							';
1114			}
1115			comment_str += '<span class="cm-section" data-type="'+ type +'">\
1116								<span class="cm-reply cm-controls ' + userReply + '" data-id="' + id + '" data-name="' + name + '" data-option="' + option + '" data-myImage="' + my_image + '"><i class="fa fa-reply"></i> ' +  $.lang[_pb_blocklang]['config.answer-comment'] + '</span>\
1117								<span class="cm-update cm-controls ' + userUpdate + '" data-id="' + id + '"><i class="fa fa-pencil"></i> ' +  $.lang[_pb_blocklang]['config.modify'] + '</span>\
1118								<span class="cm-delete cm-controls ' + userDelete + '" data-id="' + id + '"><i class="fa fa-trash-o"></i> ' +  $.lang[_pb_blocklang]['config.delete'] + '</span>\
1119							</span>\
1120							<div class="cm-content" data-id="' + id + '">' + reply + lock + '<span class="cm-textarea">' + content + '</span></div>\
1121						</div>\
1122					</div>\
1123				</div>\
1124			</li>\
1125		';
1126
1127		return comment_str;
1128	}
1129
1130
1131	$.comment = {
1132		init : function(options) {
1133			var cSID = (PAGE_MODE == 'c') ? SID : property.SID,
1134				cPARENT = (PAGE_MODE == 'c') ? PARENT : property.PARENT,
1135				cPAGE = (PAGE_MODE == 'c') ? PAGE : property.PAGE,
1136				cVALIDPLAN = (PAGE_MODE == 'c') ? VALIDPLAN : property.VALIDPLAN;;
1137			var _init_parent_settings = (cPARENT && cPARENT.settings) ? (typeof cPARENT.settings == 'string' ? $.parseJSON(cPARENT.settings) : cPARENT.settings) : null;
1138			_pb_blocklang = (_init_parent_settings && _init_parent_settings.pb_blocklang && typeof $.lang[_init_parent_settings.pb_blocklang] != 'undefined') ? _init_parent_settings.pb_blocklang : LANG;
1139
1140			if(typeof cSID == 'undefined' || !cSID) { console.log('cSID undefined'); return false; }
1141			if(typeof cPARENT == 'undefined' || !cPARENT) { console.log('cPARENT undefined'); return false; }
1142			if(typeof cPAGE == 'undefined' || !cPAGE) { console.log('cPAGE undefined'); return false; }
1143			if(cPARENT.mode===null) { console.log('cPARENT.mode null'); return false; }
1144
1145			var cPARENT_SETTINGS = (typeof cPARENT.settings != 'undefined' && cPARENT.settings) ? jQuery.parseJSON(cPARENT.settings) : {},
1146				cSETTINGS = (PAGE_MODE == 'c') ? SETTINGS : property.SETTINGS;
1147			if(typeof cSETTINGS == 'undefined' || !cSETTINGS) cSETTINGS = {};
1148
1149			var	checkUrl = cPAGE.split(','),
1150				cTYPE = (checkUrl[0] == 'forum') ? 'F' : 'P',
1151				cPID = cPARENT.pid,
1152				cVIEW =  (PAGE_MODE == 'c') ? VIEW : property.VIEW;
1153
1154			if(typeof cTYPE == 'undefined' || !cTYPE) { console.log('cTYPE undefined'); return false; }
1155			if(typeof cPID == 'undefined' || !cPID) { console.log('cPID undefined?'); return false; }
1156			if(typeof cVIEW == 'undefined' || !cVIEW) { console.log('cVIEW undefined'); return false; }
1157
1158			$('.page-comments').remove();
1159			var cwrap = tplCommentWrap(cTYPE,cPARENT.mode,cVIEW),
1160				$cwrap = $(cwrap.tpl);
1161
1162			if(typeof cSETTINGS.cmStyle != 'undefined' && cSETTINGS.cmStyle) $cwrap.addClass(cSETTINGS.cmStyle);
1163			$cwrap.append('<div class="container">');
1164			var appendProjectCommentWrap = function($fallbackEl) {
1165				var $pageBottomEl = $('[data-type="page_bottom"]').first();
1166				if($pageBottomEl.length > 0) {
1167					var $bottomList = $pageBottomEl.find('.page-bottomlist');
1168					if($bottomList.length > 0) $bottomList.before($cwrap);
1169					else $pageBottomEl.append($cwrap);
1170					$pageBottomEl.removeClass('empty');
1171				} else if($fallbackEl && $fallbackEl.length > 0) {
1172					$fallbackEl.before($cwrap);
1173				} else {
1174					$('.dsgn-body').append($cwrap);
1175				}
1176			}
1177
1178			if(PAGE_MODE == 'c') {
1179				$lastEl = ($('.el-footer_ctrl').length) ? $('.el-footer_ctrl') : $('.add-footer-information');
1180				if($('.page-bottomlist').length) $lastEl = $('.page-bottomlist');
1181
1182				if(cVIEW && cPARENT.mode=='project') {
1183					appendProjectCommentWrap($lastEl);								//gallery
1184				} else {
1185					if($('.page-bottomlist').length>0) $('.page-bottomlist').before($cwrap);
1186					else $('.forum-view').append($cwrap);								//forum
1187				}
1188			} else {
1189				if($('.el-footer').length) {
1190					$lastEl = ($('.page-bottomlist').length) ? $('.page-bottomlist') : $('.el-footer');
1191					
1192					if(cVIEW && cPARENT.mode=='project') {
1193						appendProjectCommentWrap($lastEl);
1194					} 			//gallery
1195					else {
1196						if($('.page-bottomlist').length>0) $('.page-bottomlist').before($cwrap);
1197						else $('.forum-view').append($cwrap);								//forum
1198					}				
1199				} else {
1200					if(cVIEW && cPARENT.mode=='project') {
1201						appendProjectCommentWrap();
1202					} else {
1203						$('.dsgn-body').append($cwrap);
1204					}
1205				}
1206			}
1207
1208			$.ajax({
1209				type : 'POST',
1210				url : '/template/comment/list/type/' + cTYPE + '/view/' + cVIEW + '/sid/' + cSID,
1211				data: {'pid': cPID, 'pb_blocklang': _pb_blocklang},
1212				dataType : 'json',
1213				async : true,
1214				success : function(data) {
1215					if(!$cwrap.closest('body').length) return false;
1216					if(typeof data.check_comment == 'undefined' || data.check_comment) {
1217						var write_level = (typeof data.write_level != 'undefined')? data.write_level:'M';
1218						var writeable = (typeof data.writeable != 'undefined')? data.writeable:false;
1219						var login = (typeof data.login != 'undefined')? data.login:false;
1220				    	var $tCmt = $(tplComment()),
1221				    		$tplCmtForm = $(tplCommentForm(cTYPE, data.my_image, cPARENT_SETTINGS, write_level, writeable, login));
1222				    		// $tplForm = $(tplForm(data.my_image));
1223
1224				    	if(cTYPE == 'F' && data.list.length > 0 && $('.forum-view[data-forum-type="qna"]').length > 0) $tplCmtForm = $('');
1225						$cwrap.find('> .container').children('.comment-cnt').remove();
1226						$cwrap.find('> .container').append('<div class="comment-cnt">' + $.lang[_pb_blocklang]['board.comments'] + '<b>' + data.list.length + '</b>' + '</div>');
1227				    	
1228				    	$.each(data.list, function(i,v) {
1229				    		if(data.check_likeComment === undefined || data.check_likeComment === false || !cVALIDPLAN) v.like = false;
1230				    		var isLastReply = v.depth > 0 && (i === data.list.length - 1 || data.list[i + 1].depth == 0);
1231				    		var hasReply = v.depth == 0 && i < data.list.length - 1 && data.list[i + 1].depth > 0;
1232							$tCmt.append(tplCommentRow(cTYPE,v.seq,v.name,v.content,v.datetime,v.reply,v.depth,v.option,v.lock,v.reply_btn,v.cmb,v.own,v.adm,v.mgr,data.my_image,v.mb_image,write_level,writeable,v.like,isLastReply,hasReply));
1233						});
1234
1235				    	setTimeout(function() {
1236					    	if(cPARENT_SETTINGS.forum_type == 'modoo') {
1237						    	$cwrap.find('.container').append($tCmt);
1238								$cwrap.css('background-image','none').find('.container').append($tplCmtForm);
1239					    	} else {
1240								$cwrap.css('background-image','none').find('.container').append($tplCmtForm);
1241						    	$cwrap.find('.container').append($tCmt);
1242					    	}
1243
1244			    			// if(typeof cSETTINGS.viewportMode != 'undefined' && cSETTINGS.viewportMode == 'mobile_web') setHeight(pageHeight());
1245						}, 30);
1246					} else {
1247						$cwrap.remove();
1248					}
1249				}
1250			});
1251
1252
1253			return false;
1254		},
1255		delete : function(id) {
1256			if(typeof id == 'undefined' || !id) {
1257				$(this).showModalFlat('ERROR', $.lang[_pb_blocklang]['config.comment-not-found'], true, false, '', 'ok');
1258				return false;
1259			}
1260
1261			//this case:: forum QnA block, answer delete =>> page refresh
1262			var checkPageReload = ($('.element[data-type="forum"][data-type2="qna"] .qna-details .tpl-qna-toolbar-button.data-qna-del[data-id="' + id + '"]').length > 0) ? true : false;
1263
1264			var modal = $(this).showModalFlat('INFORMATION', $.lang[_pb_blocklang]['config.confirm-delete-comment'], true,true, function() {
1265
1266				$.post('/template/comment/info', {id:id}, function(data) {
1267					if(typeof data.error != 'undefined' && data.error) {
1268						$(this).showModalFlat('ERROR',data.error,true,false,'','ok');
1269						return false;
1270					}
1271
1272					var cTYPE = data.type;
1273					if(data.sign == false) {
1274						var modalPass = $(this).showModalFlat($.lang[_pb_blocklang]['config.comment-delete'],passwdForm(),true,true,function() {
1275							var $pass = $('.comm-pass'),
1276								userInput = $pass.val(),
1277								isSubmit = true;
1278
1279							$('label.error').remove();
1280							if($pass.val().length<4) {
1281								//$pass.parents('.comment-addform.password').after('<label class="error">' +  $.lang[_pb_blocklang]['config.pass-min-length'] + '</label>').focus();
1282								$pass.closest('.cl-s-form-wrap').addClass('error');
1283								$pass.closest('.cl-s-form-wrap').after('<label for="input" class="cl-s-control-label error"><svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>'+$.lang[_pb_blocklang]['config.pass-min-length']+'</label>');
1284								$pass.focus();
1285								isSubmit = false;
1286							}
1287
1288							if(isSubmit) {
1289								//$('.comment-addform.password').parent().find('.error').remove();
1290								$('.comment-addform.password').removeClass('error');
1291								$.post('/template/comment/password',{ id: id, passwd : hex_md5($pass.val()) }, function(data) {
1292									if(typeof data.error != 'undefined' && data.error) {
1293										//$(this).showModalFlat('ERROR',data.error,true,false,'','ok');
1294										//$('.comment-addform.password').before('<label class="error">' + data.error + '</label>');
1295										$pass.closest('.cl-s-form-wrap').addClass('error');
1296										$pass.closest('.cl-s-form-wrap').after('<label for="input" class="cl-s-control-label error"><svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>'+data.error+'</label>');
1297										return false;
1298									}
1299									deleteComment(id,hex_md5($pass.val()));
1300									modalPass.modal('hide');
1301								},'json');
1302							}
1303							modalEmptyCheck();
1304						},'cancel','', 'cl-modal cl-cmmodal cl-p70 cl-s-btn w560 site-comment-modal cl-t80 cl-close-btn');
1305					} else {
1306						deleteComment(id);
1307					}
1308					return;
1309				},'json');
1310				setTimeout(function() {
1311					modal.modal('hide');
1312					if(checkPageReload) location.reload(); //this case:: forum QnA block, answer delete
1313				}, 20);
1314
1315			}, 'cancel','', 'cl-modal cl-none-title cl-cmmodal cl-p130 cl-s-btn w560 site-comment-modal cl-t80 cl-close-btn');
1316			
1317			function deleteComment(id,pass) {
1318				pass = (typeof pass == 'undefined') ? '' : pass;
1319
1320				var cSID = (PAGE_MODE == 'c') ? SID : property.SID;
1321				$.post('/template/comment/delete', { id : id, sid : cSID, pass : pass }, function(data) {
1322					if(typeof data.error != 'undefined' && data.error) {
1323						$(this).showModalFlat('ERROR',data.error,true,false,'','ok');
1324						return false;
1325					} else modal.modal('hide');
1326
1327					$.comment.init();
1328				},'json');
1329			}
1330
1331		},
1332		destory : function() {
1333			var $obj = $('.page-comments');
1334			$obj.fadeOut('slow',function() {
1335				$(this).remove();
1336			});
1337		}
1338
1339	};
1340}(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.