PageSourceSearch

https://www.ssupl.com/data/skin/front/19-07_C/js/gd_board_view.js

js ssupl.com collected 2026-10-09 23:38:33 UTC 12,583 bytes, 363 lines download raw bytes

1/**
2 * Created by LeeNamJu on 2015-11-03.
3 */
4
5$(document).ready(function () {
6    $('img.js_smart_img').each(function () {
7        $(this).css('max-width', '100%');
8    });
9
10    var gd_dom = function (bdId, sno) {
11        var formWrite = $('.js_form_write');
12        return {
13            //  dataRow: $(".js-data-row[data-bdid=" + bdId + "][data-sno=" + sno + "]"),
14            detail: $('.js_comment_area'),
15            commentRow: function (memoSno) {
16                return this.detail.find('.js_data_comment_row[data-memosno=' + memoSno + ']');
17            },
18            commentFormWrite: {
19                element: formWrite,
20                writerNm: formWrite.find('input[name=writerNm]'),
21                password: formWrite.find('input[name=password]'),
22                memo: formWrite.find('textarea[name=memo]'),
23            },
24            commentFormAction: function (memoSno) {
25                return {
26                    element: this.commentRow(memoSno).find('.js_action_form'),
27                    writerNm: this.commentRow(memoSno).find('input[name=writerNm]'),
28                    password: this.commentRow(memoSno).find('input[name=password]'),
29                    memo: this.commentRow(memoSno).find('textarea[name=memo]'),
30                    btn: this.commentRow(memoSno).find('.js_comment_btn_action'),
31                    init: function () {
32                        this.writerNm.val(null);
33                        this.password.val(null);
34                        this.memo.val(null);
35                    },
36                }
37            }
38        }
39    }
40
41    var gd_get_data = function (id, target) {
42        id = id.toLowerCase();
43        switch (id) {
44            case 'bdid' :
45            case 'sno' :
46                return $(target).closest('.js_comment_area').data(id)
47                break;
48            case 'memosno' :
49            case 'memoauth' :
50                return $(target).closest('.js_data_comment_row').data(id);
51        }
52    }
53
54    var gd_is_valid_form = function (elObj) {
55        var writerNmEl = elObj.find('input[name=writerNm]');
56        var passwordEl = elObj.find('input[name=password]');
57        var memoEl = elObj.find('textarea[name=memo]');
58        if (writerNmEl.length > 0) {
59            if (writerNmEl.val() == '') {
60                alert(__('이름을 입력해주세요.'));
61                writerNmEl.focus();
62                return false;
63            }
64        }
65
66        if (passwordEl.length > 0) {
67            if (passwordEl.val() == '') {
68                alert(__('비밀번호를 입력해주세요.'));
69                passwordEl.focus();
70                return false;
71            }
72        }
73
74        if (memoEl.length > 0) {
75            if (memoEl.val() == '') {
76                alert(__('댓글내용을 입력해주세요.'));
77                memoEl.focus();
78                return false;
79            }
80        }
81
82        return true;
83    }
84
85    /**
86     * 댓글작성
87     */
88    $('body').delegate('.js_comment_btn_write', 'click', function (e) {
89        var bdId = gd_get_data('bdId', this);
90        var sno = gd_get_data('sno', this);
91        var domRoot = gd_dom(bdId, sno);
92
93        if ($('#infoCollectionAgreeWrite').length > 0) {
94            if($('#infoCollectionAgreeWrite').is(':checked') == false) {
95                alert(__('개인정보 수집항목에 동의해주세요.'));
96                return;
97            }
98        }
99
100        if (!gd_is_valid_form(domRoot.commentFormWrite.element)) {
101            return false;
102        }
103
104        $.ajax({
105            method: "POST",
106            url: "../board/memo_ps.php",
107            data: {
108                mode: 'write',
109                bdSno: sno,
110                bdId: bdId,
111                memo: domRoot.commentFormWrite.memo.val(),
112                writerNm: domRoot.commentFormWrite.writerNm.val(),
113                writerPw: domRoot.commentFormWrite.password.val()
114            },
115            dataType: 'json'
116        }).success(function (data) {
117            if (data['result'] == 'ok') {
118                alert(data['msg']);
119                location.reload();
120            }
121            else {
122                alert(data['msg']);
123                return;
124            }
125        }).error(function (e) {
126            alert(e.responseText);
127        });
128    });
129
130
131    /**
132     * 댓글 수정
133     */
134    $('body').delegate('.js_comment_btn_modify', 'click', function () {
135        var mode = 'modify'
136        var bdId = gd_get_data('bdId', this);
137        var sno = gd_get_data('sno', this);
138        var memoSno = gd_get_data('memosno', this);
139        var commentFormAction = gd_dom(bdId, sno).commentFormAction(memoSno);
140        commentFormAction.init();
141        commentFormAction.element.show();
142        commentFormAction.writerNm.prop('readonly', true);
143        $.ajax({
144            method: "POST",
145            url: "../board/memo_ps.php",
146            data: {
147                mode: 'getMemo',
148                bdId: bdId,
149                bdSno: sno,
150                sno: memoSno,
151            },
152            dataType: 'json'
153        }).success(function (data) {
154            if (data['result'] == 'ok') {
155                commentFormAction.writerNm.val(data.writerNm);
156                commentFormAction.memo.val(data.memo);
157            }
158            else {
159                alert(data['msg']);
160                return;
161            }
162        });
163
164        commentFormAction.btn.unbind('click').bind('click', function () {
165            if ($('#infoCollectionAgreeAction').length > 0) {
166                if($('#infoCollectionAgreeAction').is(':checked') == false) {
167                    alert(__('개인정보 수집항목에 동의해주세요.'));
168                    return;
169                }
170            }
171
172            if (!gd_is_valid_form(commentFormAction.element)) {
173                return false;
174            }
175
176            $.ajax({
177                method: "POST",
178                url: "../board/memo_ps.php",
179                data: {
180                    mode: mode,
181                    bdSno: sno,
182                    sno: memoSno,
183                    bdId: bdId,
184                    writerNm: commentFormAction.writerNm.val(),
185                    writerPw: commentFormAction.password.val(),
186                    memo: commentFormAction.memo.val(),
187                },
188                dataType: 'json'
189            }).success(function (data) {
190                if (data['result'] == 'ok') {
191                    alert(data['msg']);
192                    location.reload();
193                }
194                else {
195                    alert(data['msg']);
196                    return;
197                }
198            }).error(function (e) {
199                alert(e.responseText);
200            });
201        });
202    });
203
204    /**
205     * 댓글답글
206     */
207    $('body').delegate('.js_comment_btn_reply', 'click', function () {
208        var mode = 'reply'
209        var bdId = gd_get_data('bdId', this);
210        var sno = gd_get_data('sno', this);
211        var memoSno = gd_get_data('memosno', this);
212        var commentFormAction = gd_dom(bdId, sno).commentFormAction(memoSno);
213        commentFormAction.init();
214        commentFormAction.element.show();
215        commentFormAction.writerNm.prop('readonly', false);
216        commentFormAction.btn.unbind('click').bind('click', function () {
217            if ($('#infoCollectionAgreeAction').length > 0) {
218                if($('#infoCollectionAgreeAction').is(':checked') == false) {
219                    alert(__('개인정보 수집항목에 동의해주세요.'));
220                    return;
221                }
222            }
223
224            if (!gd_is_valid_form(commentFormAction.element)) {
225                return false;
226            }
227
228            $.ajax({
229                method: "POST",
230                url: "../board/memo_ps.php",
231                data: {
232                    mode: mode,
233                    bdId: bdId,
234                    bdSno: sno,
235                    sno: memoSno,
236                    writerNm: commentFormAction.writerNm.val(),
237                    writerPw: commentFormAction.password.val(),
238                    memo: commentFormAction.memo.val(),
239                },
240                dataType: 'json'
241            }).success(function (data) {
242                if (data['result'] == 'ok') {
243                    alert(data['msg']);
244                    location.reload();
245                }
246                else {
247                    alert(data['msg']);
248                    return;
249                }
250            }).error(function (e) {
251                alert(e.responseText);
252            });
253        });
254    });
255
256
257    /**
258     * 댓글삭제
259     */
260    $('body').delegate('.js_comment_btn_delete', 'click', function () {
261        var bdId = gd_get_data('bdId', this);
262        var sno = gd_get_data('sno', this);
263        var memoSno = gd_get_data('memosno', this);
264        var auth = gd_get_data('memoauth', this);
265
266        if (auth == 'c') {
267            passwordLayer.show();
268            passwordLayer.btn.unbind('click').bind('click', function () {
269                memoDeleteAjaxProcess();
270            });
271            return;
272        }
273        if (!confirm(__('정말 삭제하시겠습니까?'))) {
274            return false;
275        }
276
277        memoDeleteAjaxProcess(memoSno);
278
279        function memoDeleteAjaxProcess() {
280            $.ajax({
281                method: "POST",
282                url: "../board/memo_ps.php",
283                data: {
284                    mode: 'delete',
285                    bdSno: sno,
286                    sno: memoSno,
287                    bdId: bdId,
288                    writerPw: passwordLayer.value(),
289                },
290                dataType: 'json'
291            }).success(function (data) {
292                if (data['result'] == 'ok') {
293                    alert(data['msg']);
294                    location.reload();
295                }
296                else {
297                    alert(data['msg']);
298                    return;
299                }
300            }).error(function (e) {
301                alert(e.responseText);
302            });
303        }
304    });
305
306})
307;
308
309//패스워드입력 레이어 창
310var passwordLayer = {
311    element: $('#lyPassword'),
312    btn: $('#lyPassword').find('.js_submit'),
313    value: function () {
314        return $('#lyPassword').find('input[name=writerPw]').val();
315    },
316    show: function () {
317        this.element.removeClass('dn');
318        this.element.currentCenter();
319        $('#layerDim').removeClass('dn');
320        $('#scroll-left, #scroll-right').addClass('dim');
321        $('.pasword_layer .ly_cont .text').focus();
322    },
323    close: function () {
324        $('.password_layer .ly_close').trigger('click');
325    }
326}
327
328function gd_btn_modify_write(bdId, sno, auth) {
329    switch (auth) {
330        case 'n' :
331            alert(__('권한이 없습니다.'));
332            break;
333        case 'y' :
334            location.href = boardData.modifyUrl.format(bdId, sno);
335            break;
336        case 'c' :
337            passwordLayer.show();
338            passwordLayer.btn.unbind('click').bind('click', function () {
339                $.ajax({
340                    method: "POST",
341                    url: "../board/board_ps.php",
342                    data: {mode: 'modifyCheck', sno: sno, bdId: bdId, writerPw: passwordLayer.value()},
343                    dataType: 'json'
344                }).success(function (data) {
345                    if (data['result'] == 'ok') {
346                        var formHtml = "<form method='post' action='" + boardData.modifyUrl.format(bdId, sno) + "' id='frmModify'>";
347                        formHtml += '<input type="hidden" name="bdId" value="' + bdId + '"/>';
348                        formHtml += '<input type="hidden" name="sno" value="' + sno + '"/>';
349                        formHtml += '<input type="hidden" name="oldPassword" value="' + passwordLayer.value() + '"/>';
350                        $('body').append(formHtml);
351                        $('#frmModify').submit();
352                    }
353                    else {
354                        alert(data['msg']);
355                        return;
356                    }
357                }).error(function (e) {
358                    alert(e.responseText);
359                });
360            });
361            break;
362    }
363}

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.