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">×</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.