PageSourceSearch

https://daewonkmc.com/Scripts/dimode.home.js?ver=2026100908650

js daewonkmc.com collected 2026-10-08 23:07:17 UTC 19,803 bytes, 493 lines download raw bytes

1(function ($) {
2    $(document).ready(function () {
3        var $HpSearchSetting = $('#HpSearchSetting');
4        $HpSearchSetting.hide();
5        $.ajax({
6            url: "/HpSC/GetSiteID",
7            type: "GET",
8            success: function (returnData) {
9                if (returnData !== null || returnData !== "" || returnData !== undefined || returnData !== "undefined") {
10                    if (returnData.length > 0) {
11                        $HpSearchSetting.show();
12                    }
13                }
14            },
15            error: function () {
16            }
17        });
18
19        var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
20
21        $HpSearchSetting.on('click', function () {
22            var result = confirm('사이트를 로그아웃 하시곘습니까?');
23
24            if (result) {
25                location.href = "http://dimode.co.kr/HpSearch/HpSearchMain/remove";
26            } else {
27                //no
28            }
29        });
30
31        var $popup = $('#directPopup');
32        var ckEditor;
33        var setType = function (type) {
34            $popup.find('.form').attr('data-type', type);
35
36            switch (type) {
37                case 'text':
38                    $popup.find('.form .text').removeClass('hide').siblings('.image').addClass('hide');
39                    break;
40
41                case 'image':
42                    $popup.find('.form .image').removeClass('hide').siblings('.text').addClass('hide');
43                    break;
44            }
45        };
46
47        var change = function (add) {
48            if (add)
49                $popup.find('.form').removeClass('hide').siblings('.list').addClass('hide');
50            else
51                $popup.find('.list').removeClass('hide').siblings('.form').addClass('hide');
52        };
53
54        var reset = function () {
55            $popup.find('.manager .form [name]').each(function () {
56                var tagName = $(this).prop('tagName');
57
58                switch (tagName) {
59                    case 'SELECT':
60                        $(this).val($(this).find('option').val());
61                        break;
62
63                    case 'INPUT':
64                        switch ($(this).attr('type')) {
65                            case 'radio':
66                                $(this).prop('checked', !$(this).val());
67                                break;
68
69                            case 'checkbox':
70                                $(this).prop('checked', true);
71                                break;
72
73                            default:
74                                $(this).val(null);
75                                break;
76                        }
77                        break;
78
79                    default:
80                        $(this).val(null);
81                        break;
82                }
83            });
84        };
85
86        var setEditor = function () {
87            if (!ckEditor)
88                ckEditor = CKEDITOR.replace('content', { height: 210 });
89        };
90
91        $popup.on('click', '.manager .list tbody tr[data-u] a.edit-btn', function () {
92            var u = $(this).closest('tr').data('u');
93            $.get('/popup/info', { popupU: u }).then(function (res) {
94                if (dimodeLib.isJson(res)) {
95                    var popup = JSON.parse(res);
96                    change(true);
97                    setType(popup.type);
98
99                    if (popup.type === 'text')
100                        setEditor();
101
102                    if (popup.popupU)
103                        $popup.find('.manager .actions .remove-btn').removeClass('hide');
104                    else
105                        $popup.find('.manager .actions .remove-btn').addClass('hide');
106
107                    $popup.find('.form select[name=type]').attr('readonly', true).find('option').attr('disabled', true);
108
109                    $popup.find('.form [name]').each(function () {
110                        var name = $(this).attr('name');
111                        var tagName = $(this).prop('tagName');
112
113                        for (var i in popup) {
114                            if (name === i) {
115                                if (name === 'content') {
116                                    if (popup.type === 'text')
117                                        ckEditor.setData(dimodeLib.htmlDecode(popup[i]));
118                                    else
119                                        $(this).val(popup[i]);
120                                }
121                                else if (tagName === 'INPUT' && ($(this).attr('type') === 'radio' || $(this).attr('type') === 'checkbox')) {
122                                    $(this).prop('checked', popup[i] !== undefined && popup[i] !== null && $(this).val() === popup[i].toString());
123                                }
124                                else {
125                                    $(this).val(popup[i]);
126                                }
127                                break;
128                            }
129                        }
130                    });
131                }
132            });
133        });
134
135        $popup.on('click', '.manager .close-btn', function () {
136            window.location.reload();
137        });
138
139        $popup.off('click', '.manager .dragger').on('click', '.manager .dragger', function (e) {
140            e.preventDefault(); // 기본 동작 방지 안전장치 추가
141
142            $(this).closest('.manager').toggleClass('active');
143            $popup.toggleClass('managing');
144
145            if ($(this).closest('.manager').hasClass('active')) {
146                $popup.find('.manager .core').html('<iframe src="/Popup/Index"></iframe>')
147                $(document.body).css('overflow', 'hidden');
148            }
149            else {
150                window.location.reload();
151            }
152        });
153
154        // 참고로 close-btn 쪽도 중복 방지를 해주는 것이 좋습니다.
155        $popup.off('click', '.manager .close-btn').on('click', '.manager .close-btn', function () {
156            window.location.reload();
157        });
158
159        $popup.on('change', '.manager .form select.type', function () {
160            var type = $(this).val();
161            setType(type);
162        });
163
164        $popup.on('click', '.manager .form .more-item a', function () {
165            $popup.find('.optional').toggleClass('visible');
166            $(this).toggleClass('hide').siblings().toggleClass('hide');
167        });
168
169        $popup.on('click', '.manager .actions .add-btn', function () {
170            setType('text');
171            reset();
172            change(true);
173            setEditor();
174            $popup.find('.form select[name=type]').removeAttr('readonly').find('option').removeAttr('disabled');
175        });
176
177        $popup.on('click', '.manager .list tbody tr[data-u] a.remove-btn', function () {
178            if (confirm('삭제하시겠습니까?')) {
179                var u = $(this).closest('tr').data('u');
180                $.post('/popup/remove/', { popupU: u }).then(function (res) {
181                    if (res === 'success') {
182                        dimodeLib.bandMessage('success', '삭제하였습니다.', 5000);
183                    }
184                    else {
185                        dimodeLib.bandMessage('danger', '오류가 있습니다.');
186                    }
187                });
188            }
189        });
190
191        $popup.on('click', '.manager .actions .cancel-btn', function () {
192            change();
193        });
194
195        // jQuery 기반 팝업 닫기 이벤트
196        $popup.on('click touchend', '.visible-popups > .each > .bottom span', function (e) {
197            e.preventDefault();    // 기본 동작 막기 (예: 링크 클릭)
198            e.stopPropagation();   // 이벤트 전파 막기
199
200            const $target = $(this);
201            console.log('클릭 이벤트:', $target.text());
202
203            handlePopupAction($target);
204        });
205
206        // 순수 JavaScript 기반 클릭/터치 이벤트 리스너
207        document.querySelectorAll('.visible-popups > .each > .bottom span').forEach(function (el) {
208            el.addEventListener('click', function (e) {
209                e.preventDefault();    // 기본 동작 방지
210                e.stopPropagation();   // 이벤트 버블링 방지
211                const $target = $(e.target);
212                console.log('클릭 감지:', $target.text());
213                handlePopupAction($target);
214            });
215
216            el.addEventListener('touchend', function (e) {
217                e.preventDefault();    // 기본 동작 방지
218                e.stopPropagation();   // 이벤트 버블링 방지
219                const $target = $(e.target);
220                console.log('터치 감지:', $target.text());
221                handlePopupAction($target);
222            });
223        });
224
225        // 팝업 닫기 처리 함수
226        function handlePopupAction($target) {
227            if ($target.hasClass('one-day')) {
228                var u = $target.closest('.each').data('u').toString();
229                var date = new Date();
230                var today = new Date();
231                today.setHours(24, 0, 0, 0);  // 자정으로 설정
232                date.setMilliseconds(date.getMilliseconds() + (today - date));
233                $.cookie('dimodePopupOneDay' + u, 'hidden', { expires: new Date(date), path: '/' });
234            }
235
236            // 팝업 닫기
237            $target.closest('.each').remove();
238        }
239
240        $popup.find('.manager .form').ajaxForm({
241            beforeSubmit: function (args) {
242                var getValue = function (name) {
243                    for (var i in args) {
244                        if (args[i].name === name)
245                            return args[i].value;
246                    }
247
248                    return null;
249                };
250
251                var title = getValue('title');
252                var type = getValue('type');
253                var startDate = getValue('startDate');
254                var endDate = getValue('endDate');
255                var width = getValue('width');
256                var height = getValue('height');
257                var marginTop = getValue('marginTop');
258                var marginLeft = getValue('marginLeft');
259                var padding = getValue('padding');
260                var memo = getValue('memo');
261                var linkUrl = getValue('linkUrl');
262
263                if (type === 'text') {
264                    var content = dimodeLib.htmlEncode(ckEditor.getData());
265
266                    for (var i in args) {
267                        if (args[i].name === 'content') {
268                            args.splice(i, 1);
269                            break;
270                        }
271                    }
272
273                    args.push({ name: 'content', value: content });
274                }
275
276                if (title && title.length > 20) {
277                    dimodeLib.bandMessage('warning', '제목은 20자를 넘을 수 없습니다.', 5000);
278                    return false;
279                }
280                else if (startDate && isNaN(Number(startDate))) {
281                    dimodeLib.bandMessage('warning', '시작일은 8자리 숫자로 입력해주세요.', 5000);
282                    return false;
283                }
284                else if (endDate && isNaN(Number(endDate))) {
285                    dimodeLib.bandMessage('warning', '시작일은 8자리 숫자로 입력해주세요.', 5000);
286                    return false;
287                }
288                else if (width && isNaN(Number(width))) {
289                    dimodeLib.bandMessage('warning', '가로 크기는 숫자로 입력해주세요.', 5000);
290                    return false;
291                }
292                else if (height && isNaN(Number(height))) {
293                    dimodeLib.bandMessage('warning', '세로 크기는 숫자로 입력해주세요.', 5000);
294                    return false;
295                }
296                else if (marginTop && isNaN(Number(marginTop))) {
297                    dimodeLib.bandMessage('warning', '상단 여백은 숫자로 입력해주세요.', 5000);
298                    return false;
299                }
300                else if (marginLeft && isNaN(Number(marginLeft))) {
301                    dimodeLib.bandMessage('warning', '좌측 여백은 숫자로 입력해주세요.', 5000);
302                    return false;
303                }
304                else if (padding && isNaN(Number(padding))) {
305                    dimodeLib.bandMessage('warning', '내부 여백은 숫자로 입력해주세요.', 5000);
306                    return false;
307                }
308                else if (linkUrl && linkUrl.length > 1000) {
309                    dimodeLib.bandMessage('warning', '링크 주소는 1000자를 넘을 수 없습니다.', 5000);
310                    return false;
311                }
312                else if (memo && memo.length > 100) {
313                    dimodeLib.bandMessage('warning', '메모는 100자를 넘을 수 없습니다.', 5000);
314                    return false;
315                }
316
317                if (type === 'text') {
318                    var cont = getValue('content');
319                    if (!cont) {
320                        dimodeLib.bandMessage('warning', '내용을 입력해주세요.', 5000);
321                        return false;
322                    }
323                    else if (cont.length > 2000) {
324                        dimodeLib.bandMessage('warning', '내용은 2,000자를 넘을 수 없습니다.', 5000);
325                        return false;
326                    }
327                }
328                else {
329                    if (!getValue('content') && !getValue('file')) {
330                        dimodeLib.bandMessage('warning', '파일ì
330„ 선택해주세요.', 5000);
331                        return false;
332                    }
333                }
334
335                dimodeLib.bandMessage('warning', '처리 중입니다.', 0);
336            },
337            success: function (res) {
338                if (res === 'success') {
339                    dimodeLib.bandMessage('success', '저장하였습니다.', 5000);
340                    change();
341                }
342                else {
343                    dimodeLib.bandMessage('danger', '오류가 있습니다.');
344                }
345            },
346            error: function () {
347                dimodeLib.bandMessage('danger', '오류가 있습니다.#2', 0);
348            }
349        });
350
351        $popup.find('.visible-popups > .each').each(function () {
352            var u = $(this).data('u');
353            var type = $(this).data('type');
354            var href = $(this).data('href');
355
356            if ($.cookie('dimodePopupOneDay' + u) === 'hidden') {
357                $(this).remove();
358            }
359            else if (type === 'text') {
360                var $html = $(this).show().find('.html');
361                $html.html(dimodeLib.htmlDecode($html.text()));
362            }
363            else {
364                $(this).show();
365            }
366
367            if (type === 'image' && href) {
368                $(this).on('click', function () {
369                    location.href = href;
370                });
371            }
372
373            if ($(window).width() > 767) {
374                if ($(this).find('video').length <= 0) {
375                    $(this).draggable();
376                }
377            }
378        });
379
380        if ($(window).width() < 768) {
381            $('#directPopup iframe').wrap("<div class='video-wrap'></div>");
382        }
383
384        function autoArrangeDirecTerms() {
385            var $terms = $('[id="direcTerms"]');
386
387            // 1. 약관 링크 영역이 아예 없으면 종료
388            if ($terms.length === 0) return;
389
390            // 2. 중복 방지 (2개 이상 존재하면 첫 번째만 남기고 삭제)
391            if ($terms.length > 1) {
392                $terms.slice(1).remove();
393            }
394
395            var $target = $('[id="direcTerms"]');
396
397            // 3. fullPage.js 사용 여부 감지
398            var isFullPageActive = $('.fullpage-site').length > 0 || typeof $.fn.fullpage !== 'undefined';
399
400            if (isFullPageActive) {
401                var appended = false;
402
403                if ($('.footer-box').length > 0) {
404                    $('.footer-box').append($target);
405                    appended = true;
406                }
407                else if ($('.fp-auto-height').length > 0) {
408                    $('.fp-auto-height').append($target);
409                    appended = true;
410                }
411                else if ($('.section').length > 0) {
412                    $('.section').last().append($target);
413                    appended = true;
414                }
415
416                if (appended && typeof $.fn.fullpage !== 'undefined' && $.fn.fullpage.reBuild) {
417                    setTimeout(function () {
418                        $.fn.fullpage.reBuild();
419                    }, 300);
420                }
421
422            } else {
423                if ($('body').length > 0) {
424                    $('body').append($target);
425                } else if ($('.layout').length > 0) {
426                    $('.layout').last().append($target);
427                } else {
428                    $('html').append($target);
429                }
430            }
431        }
432
433        // 문서 로딩이 완료되면 최초 1회 실행
434        autoArrangeDirecTerms();
435
436        // 비동기 통신(Ajax)이나 지연 로딩으로 인해 나중에 요소가 생성될 경우를 대비
437        $(document).ajaxComplete(function () {
438            autoArrangeDirecTerms();
439        });
440
441
442        // ==========================================
443        // [추가됨] 약관, 개인정보처리방침 모달 팝업 처리 로직
444        // ==========================================
445
446        var modalHtml = `
447        <div id="termsAjaxModal">
448            <div class="terms-modal-dialog">
449                <div class="terms-modal-header">
450                    <span id="termsAjaxModalClose">&times;</span>
451                </div>
452                <div id="termsAjaxModalBody">
453                    </div>
454            </div>
455        </div>`;
456
457        $('body').append(modalHtml);
458
459        // direcTerms 영역 안의 링크(a 태그) 3개 모두에 클릭 이벤트 적용
460        $(document).on('click', '#direcTerms a', function (e) {
461            e.preventDefault();
462
463            var targetUrl = $(this).attr('href');
464            var $modal = $('#termsAjaxModal');
465            var $modalBody = $('#termsAjaxModalBody');
466
467            $modalBody.html('<div style="text-align:center; padding:50px;">데이터를 불러오는 중입니다...</div>');
468            $modal.css('display', 'flex').hide().fadeIn(200);
469
470            $.ajax({
471                url: targetUrl,
472                type: "GET",
473                success: function (data) {
474                    $modalBody.html(data);
475                },
476                error: function () {
477                    $modalBody.html('<div style="text-align:center; color:red; padding:50px;">내용을 불러오는데 실패했습니다.</div>');
478                }
479            });
480        });
481
482        $('#termsAjaxModalClose').on('click', function () {
483            $('#termsAjaxModal').fadeOut(200);
484        });
485
486        $('#termsAjaxModal').on('click', function (e) {
487            if ($(e.target).is('#termsAjaxModal')) {
488                $(this).fadeOut(200);
489            }
490        });
491
492    });
493})(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.