1/* 22018.07.10 JS íµí©ìì 3 4######################################################### 5* í©ì³ì§ë íì¼ 6######################################################### 71. /script/bannerpop.js 9ê° 82. /script/resizePhoto.js 5ê° 93. /script/floating.banner.js 2ê° 104. /script/mosaic.js 6ê° 115. /script/newsAutoCall.js 2ê° 126. /script/common.js 8ê° 137. /script/app.js 49ê° 14 15=> /script/common.js ë¡ íµí© 16########################################################## 17*/ 18 19/* ****************************************** */ 20/* /script/bannerpop.js */ 21/* ****************************************** */ 22 23 24/****************************************************************************************************************** 25/* ****************************************** */ 26/* /script/resizePhoto.js */ 27/* ****************************************** */ 28 29function resizePhoto() { 30 31 var $_container = $('#article-view-content-div'); 32 var articleViewDivWidth = $_container.width(); 33 34 $_container.find('img').each(function(e){ 35 if($(this).closest('figure').length) { 36 var ViewimageObj = new Image(); 37 var $_thisImgObj = $(this); 38 ViewimageObj.src = $(this).attr("src"); 39 ViewimageObj.onload = function() { 40 imageWidth = this.width; 41 if(articleViewDivWidth <= imageWidth) { 42 $_thisImgObj.closest('figure').addClass('bigsize'); 43 } 44 }; 45 46 } 47 }); 48 49 $_container.on('click', 'figure.bigsize', function(e){ 50 $('<form action="/news/userArticlePhoto.html" method="POST"><input type="hidden" name="src" value="'+$(this).find("img").attr('src')+'"></form>').appendTo('body').submit(); 51 }) 52 .on('click', 'figure.bigsize figcaption', function(e){ 53 e.preventDefault(); 54 e.stopPropagation(); 55 }); 56} 57 58/* ****************************************** */ 59/* /script/floating.banner.js */ 60/* ****************************************** */ 61$(function() { 62 $(window).scroll(function() { 63 64 if(!($('#floating_banner_left').length || $('#floating_banner_right').length)) return false; 65 66 var floatBannerLeft = $('#floating_banner_left'), 67 floatBannerRight = $('#floating_banner_right'), 68 69 HeadHeight = $('#user-header').height(), 70 footerBoxTop = $('#user-footer').offset().top, 71 footerBoxHeight = $('#user-footer').height(), 72 73 scrollTop = $(window).scrollTop(), 74 75 flBnLHeight = floatBannerLeft.height(), 76 flBnRHeight = floatBannerRight.height(), 77 78 ahtHeight = $('.aht-wrapper').height(), 79 80 flBnLscrollLimit = footerBoxTop - flBnLHeight - HeadHeight - floatBannerLeft.data('down-margin'), 81 flBnLscrollLimitChk = flBnLscrollLimit + footerBoxHeight + floatBannerLeft.data('down-margin'), 82 flBnRscrollLimit = footerBoxTop - flBnRHeight - HeadHeight - floatBannerRight.data('down-margin'), 83 flBnRscrollLimitChk = flBnRscrollLimit + footerBoxHeight + floatBannerRight.data('down-margin'), 84 85 flBnLscrollTop = scrollTop - HeadHeight + ahtHeight + floatBannerLeft.data('top-margin'), 86 flBnRscrollTop = scrollTop - HeadHeight + ahtHeight + floatBannerRight.data('top-margin'); 87 88 if(floatBannerLeft.data('scroll') == 'y'){ 89 if(floatBannerLeft.data('duration') > 0) floatBannerLeft.stop(); 90 if(scrollTop < HeadHeight) floatBannerLeft.animate({top: '0px'}, floatBannerLeft.data('duration'), 'linear'); 91 else if(scrollTop >= flBnLscrollLimitChk) floatBannerLeft.animate({top:flBnLscrollLimit + 'px'}, floatBannerLeft.data('duration'), 'linear'); 92 else if(scrollTop >= HeadHeight) floatBannerLeft.animate({top:flBnLscrollTop + 'px'}, floatBannerLeft.data('duration'), 'linear'); 93 } 94 95 if(floatBannerRight.data('scroll') == 'y'){ 96 if(floatBannerRight.data('duration') > 0) floatBannerRight.stop(); 97 if(scrollTop < HeadHeight) floatBannerRight.animate({top: '0px'}, floatBannerRight.data('duration'), 'linear'); 98 else if(scrollTop >= flBnRscrollLimitChk) floatBannerRight.animate({top:flBnRscrollLimit + 'px'}, floatBannerRight.data('duration'), 'linear'); 99 else if(scrollTop >= HeadHeight) floatBannerRight.animate({top:flBnRscrollTop + 'px'}, floatBannerRight.data('duration'), 'linear'); 100 } 101 }); 102}); 103 104/* ****************************************** */ 105/* /script/mosaic.js */ 106/* ****************************************** */ 107 108function mosaic_autobox(data) { 109 var $_container = $(data[0].container); 110 var autoplay = data[0].autoplay; 111 var autotime = data[0].autotime; 112 var temp_autoplay = autoplay; 113 var totalcount = $_container.find('ul.auto-nav > li').length; 114 var point = 0; 115 116 $_container.on('mouseenter', '.auto-cursor', function(e){
117 mosaic_cmd('current', $(this).index()); 118 }); 119 120 $_container.on('mouseenter', function(e){ 121 if(autoplay) temp_autoplay = false; 122 }).on('mouseleave', function(e){ 123 if(autoplay) temp_autoplay = true; 124 }); 125 126 if(autoplay) { 127 var rolling = window.setInterval(function () { 128 if(temp_autoplay) mosaic_cmd('next', 0); 129 }, autotime); 130 } 131 132 function mosaic_cmd(mode, current_point) { 133 134 if(mode == "prev") { 135 point -= 1; 136 if(point < 0) point = totalcount - 1; 137 }else if(mode == "next") { 138 point += 1; 139 if(point >= totalcount) point = 0; 140 }else if(mode == "current") { 141 point = current_point; 142 } 143 144 $_container.find('ul.auto-container > li').eq(point).show().siblings().hide(); 145 $_container.find('ul.auto-nav > li').eq(point).addClass('active').siblings().removeClass('active'); 146 147 if(point < 2){ 148 $_container.find('ul.auto-container').css({"left":"33.333333%","top":"33.333333%"}); 149 } else if(point < 4 && point >= 2) { 150 $_container.find('ul.auto-container').css({"left":"0px","top":"33.333333%"}); 151 } else if(point < 6 && point >= 4) { 152 $_container.find('ul.auto-container').css({"left":"0px","top":"0px"}); 153 } else if(point >= 6) { 154 $_container.find('ul.auto-container').css({"left":"33.333333%","top":"0px"}); 155 } 156 157 return false; 158 } 159} 160 161/* ****************************************** */ 162/* /script/newsAutoCall.js */ 163/* ****************************************** */ 164 165function fn_articleAutoCall(mode, cycle) { 166 167 var cycle=parseInt(cycle)||0; 168 if(isNaN(cycle)||cycle<=0) return false; 169 170 var autoCallMode = mode; 171 var autoCallCycle = 1000*60*cycle; 172 var _autoCallWatch = setInterval(action, autoCallCycle); 173 174 // DESKì¤ë³µìì ì´ë©´ ì´ê¸° 1í ë°ë¡ì¤í. 175 if(autoCallMode == "desk") action(); 176 177 function action() { 178 if(autoCallMode == "save") { 179 if($('.auto-save', '#admin-content').length > 0 && $('input:hidden[name="autoSave"]', '#newsWriteForm').val() != "") $('.auto-save', '#admin-content').show(); 180 TxRx("/news/articleAutoSave.ajax.php"); 181 } 182 else if(autoCallMode == "desk") TxRx("/news/articleAutoDesk.ajax.php"); 183 else stop(); 184 } 185 186 function TxRx(url) { 187 188 $.ajax({ 189 type: "post", 190 dataType: "json", 191 url:url, 192 data:$('#newsWriteForm').serialize(), 193 success: function(data) { 194 console.log(data[1]); 195 }, 196 error: function(error, request) { 197 console.log("ìëì½ìë¬ - code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 198 stop(); 199 } 200 }).always(function() { 201 if($('.auto-save', '#admin-content').length > 0) $('.auto-save', '#admin-content').fadeOut(1500); 202 }); 203 } 204 205 function stop() { 206 clearInterval(_autoCallWatch); 207 console.log(autoCallMode + 'ì¤í±'); 208 } 209} 210 211/* ****************************************** */ 212/* 기존 common.js */ 213/* ****************************************** */ 214 215/*--------------------------------------------------------------------------------------------- 216 JAVASCRIPT CODE 217 --------------------------------------------------------------------------------------------- 218 function name | description | use process 219 --------------------------------------------------------------------------------------------- 220 setCookie(ì¿ í¤ëª , ê°, ì í¨ê¸°ê°(ì¼)) | | ì¿ í¤ìì± 221 getCookie(ì¿ í¤ëª ) | | ì¿ í¤ê°ì ¸ì¤ê¸° 222 ---------------------------------------------------------------------------------------------*/ 223 224// ì¿ í¤ ìì± 225function setCookie(cName, cValue, cDay, cDomain){ 226 Util.setCookie(cName, cValue, cDay, cDomain); 227} 228 229// ì¿ í¤ ê°ì ¸ì¤ê¸° 230function getCookie(cName) { 231 Util.getCookie(cName); 232} 233 234// ì¿ í¤ ì§ì 235function delCookie(cName) { 236 var today = new Date(); 237 today.setTime(today.getTime() - 1); 238 var value = getCookie(cName); 239 if(value != "") { 240 var host=(typeof SITE_DOMAIN!='undefined')?SITE_DOMAIN:window.location.host 241 ,domain='.'+host.replace(/^http(s)?:\/\//i,'').replace(/^(www|cms|slv|cdn|m)\./i,'') 242 ,cookies = cName + "=" + value + "; path=/; expires=" + today.toGMTString() + '; ' + "domain=" + domain + ';'; 243 document.cookie = cookies; 244 } 245} 246 247 248/*--------------------------------------------------------------------------------------------- 249 JAVASCRIPT CODE 250 --------------------------------------------------------------------------------------------- 251 function name | description | use process 252 --------------------------------------------------------------------------------------------- 253 checkMsgLength() | ì ë ¥ë 문ìì´ ê¸¸ì´ ê²ì¬ | ê¸°ì¬ ëê¸ 254 calculateMsgLength() | 문ìì´ ê¸¸ì´ ë°í | ê¸°ì¬ ëê¸ 255 assertMsgLength() | 문ìì´ ê¸¸ì´ë§í¼ ìë¼ ë³í | ê¸°ì¬ ëê¸ 256 ---------------------------------------------------------------------------------------------*/ 257 258// 문ìì´ê¸¸ì´ ê²ì¬ 259function checkMsgLength(frm, id, lenStr) { 260 var length = calculateMsgLength(document.getElementById(frm).value); 261 document.getElementById(id).innerHTML = length; 262 if (length > lenStr) { 263 alert("ìµë "+lenStr+" ë°ì´í¸ê¹ì§ ë¨ê¸°ì¤ ì ììµëë¤.\r\nì´ê³¼ë " + (length - lenStr) + "ë°ì´í¸ë ìëì¼ë¡ ìì ë©ëë¤."); 264 document.getElementById(frm).value = assertMsgLength(document.getElementById(frm).value, lenStr, id); 265 } 266} 267 268//문ìì´ê¸¸ì´ ë°í 269function calculateMsgLength(message) { 270 var nbytes = 0; 271 272 for (i=0; i<message.length; i++) { 273 var ch = message.charAt(i); 274 275 if (escape(ch).length > 4) { 276 nbytes += 2; 277 } else if (ch != "\r") { 278 nbytes++; 279 } 280 } 281 282 return nbytes; 283} 284 285//문ìì´ ê¸¸ì´ë§í¼ ìë¼ ë³í 286function assertMsgLength(message, maximum, id) { 287 var inc = 0; 288 var nbytes = 0; 289 var msg = ""; 290 var msglen = message.length; 291 292 for (i=0; i<msglen; i++) { 293 var ch = message.charAt(i); 294 295 if (escape(ch).length > 4) { 296 inc = 2; 297 } else if (ch != "\r") { 298 inc = 1; 299 } 300 301 if ((nbytes + inc) > maximum) { 302 break; 303 } 304 305 nbytes += inc; 306 msg += ch; 307 } 308 309 document.getElementById(id).innerHTML = nbytes; 310 return msg; 311} 312 313
314// ê´ë¦¬ììì 기ì¬ë³¸ë¬¸ ë³µì¬íì¬ ë¸ë¡ê·¸ì í¼ ë를ì ë§í¬ê° ê´ë¦¬ì ë§í¬ë¡ ëì´ ì´ë¥¼ ë³´ì 315function avReplaceImgUrlOnCopy(){ 316 var $aView=document.querySelector('#article-view') 317 ,chgUrl=CDN_DOMAIN||SITE_DOMAIN; 318 319 if(!$aView || !chgUrl) return ; 320 $aView.addEventListener("copy", function(e){ 321 Array.prototype.slice.call(e.currentTarget.querySelectorAll("img,a[href^='/news/download.php']")).map(function($o, i){ 322 if($o.tagName.toLowerCase() == 'a'){ // download link 323 var href=$o.getAttribute("href"); 324 $o.href=SITE_DOMAIN+href; 325 }else{ // image 326 var src=$o.getAttribute("src"); 327 if(!/data:image\/(jpeg|png|gif);base64,/i.test(src) && !/^http(s)?:\/\//i.test(src)) $o.src=chgUrl+src; 328 } 329 }); 330 }); 331} 332 333/*--------------------------------------------------------------------------------------------- 334 JAVASCRIPT CODE 335 --------------------------------------------------------------------------------------------- 336 function name | description | use process 337 --------------------------------------------------------------------------------------------- 338 articleHeader() | 기ì¬ë·° í¤ë ë¤ë¹ | 기ì¬ë·° í¤ë ë¤ë¹ 339 ---------------------------------------------------------------------------------------------*/ 340 341var articleHeader = { 342 343 // í¤ë ë¤ë¹ê²ì´ì ìì± 344 setScroll:function(){ 345 jQuery(window).scroll(function() { 346 if (jQuery(this).scrollTop() > 300) { 347 jQuery('#sticky-header').addClass('scroll'); 348 } else { 349 jQuery('#sticky-header').removeClass('scroll'); 350 } 351 }); 352 }, 353 354 355 // 기ì¬ì´ë 356 move:function(mod, order_type, order_value, section_code, sub_section_code, serial_code){ 357 jQuery.get( "ajaxGetForwardIdxno.php", { mod: mod, order_type:order_type, order_value: order_value, section_code: section_code, sub_section_code: sub_section_code, serial_code: serial_code }, function( f_idxno ) { 358 359 if(f_idxno){ 360 location.href = '/news/articleView.html?idxno='+f_idxno; 361 }else{ 362 alert('기ì¬ê° ì¡´ì¬íì§ ììµëë¤'); 363 } 364 365 }); 366 } 367 368} 369 370 371/*--------------------------------------------------------------------------------------------- 372 JAVASCRIPT CODE 373 --------------------------------------------------------------------------------------------- 374 function name | description | use process 375 --------------------------------------------------------------------------------------------- 376 bbsPrint(idxno) | ê²ì물 ì¸ìì°½ ì¤í | ê²ì물 ì¸ìì°½ ì¤í 377 articlePrint(idxno) | ì¸ìì°½ ì¤í | ì¸ìì°½ ì¤í 378 articleMail(idxno) | ë©ì¼ë³´ë´ê¸°ì°½ ì¤í | ë©ì¼ë³´ë´ê¸°ì°½ ì¤í 379 articleErr(idxno) | ì¤ë¥ì ê³ ì°½ ì¤í | ì¤ë¥ì ê³ ì°½ ì¤í 380 articleSingo(idxno) | ëê¸ì ê³ ì°½ ì¤í | ëê¸ì ê³ ì°½ ì¤í 381 fn_guid() | (ëë¤)ê³ ì ìì´ë ìì± | (ëë¤)ê³ ì ìì´ë ìì± 382 ---------------------------------------------------------------------------------------------*/ 383 384//ì¸ìì°½ ì¤í 385function bbsPrint( idxno, ps ) { 386 var ps_str = ""; 387 if(ps != "") ps_str = "&ps="+ps; 388 window.open('/bbs/bbsPrint.html?idxno='+idxno+ps_str, 'bbsPrint', 'width=660,height=500,scrollbars=yes'); 389} 390 391// ì¸ìì°½ ì¤í 392function articlePrint( idxno ) { 393 window.open('/news/articlePrint.html?idxno='+idxno, 'articlePrint', 'width=660,height=500,scrollbars=yes'); 394} 395 396// ë©ì¼ë³´ë´ê¸°ì°½ ì¤í 397function articleMail( idxno ) { 398 window.open('/news/articleMail.html?idxno='+idxno, 'articleMail', 'width=660,height=500,scrollbars=yes'); 399} 400 401// ì¤ë¥ì ê³ ì°½ ì¤í 402function articleErr( idxno ) { 403 window.open('/news/articleErr.html?idxno='+idxno, 'articleErr', 'width=660,height=500,scrollbars=yes'); 404} 405 406// ëê¸ì ê³ ì°½ ì¤í 407function articleSingo( idxno ) { 408 window.open('/news/articleSingo.html?idxno='+idxno, 'articleSingo', 'width=660,height=500,scrollbars=yes'); 409} 410 411//ê³ ì ê°ìì± (기ì¬ë±ë¡ ê´ë ¨ê¸°ì¬ ëì¸ë ì¬ì©) 412function fn_guid() { 413 function s4() { 414 return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); 415 } 416 return s4() + s4() + s4() + s4() + s4() + s4() + s4() + s4(); 417} 418 419/***************************************************************************** 420*ê²ìí ì¹´í ê³ ë¦¬ ì¤ì 421*****************************************************************************/ 422var bbsCfg={ 423 424 // ì¹´í ê³ ë¦¬ ì í 425 setCategory:function() { 426 427 // ì¶ê° 428 $('#admin-content').on('click', '#btn_category_add, .btn_category_delete, .btn_category_modify', function(e){
429 430 var _this = this 431 ,$this = $(_this) 432 ,isAddButton = $this.is("#btn_category_add") 433 ,isDltButton = $this.is(".btn_category_delete") 434 ,isModalButton = $this.is(".btn_category_modify") 435 ,$categoryName = $('#category_name').val() 436 ,categoryArr = $categoryName.split(','); 437 438 if(isAddButton){ // ì¶ê° 439 categoryArr =categoryArr.filter(Boolean); 440 for (var i in categoryArr) { 441 var category = categoryArr[i]; 442 443 // íì í목 ì²´í¬ 444 if(!category || category == "") { 445 alert("ì¹´í ê³ ë¦¬ëª ì ì ííê² ì ë ¥í´ì£¼ì¸ì."); 446 return false; 447 } 448 449 // ì¤ë³µì²´í¬ 450 if($('#category-div').find("input[class='category'][value='"+category+"']").length>0) { 451 alert(category+' ì¹´í ê³ ë¦¬ë ì¡´ì¬í©ëë¤.'); 452 $('#category_name').val(''); 453 return false; 454 } 455 456 var _time = (Math.random()*new Date().getTime()).toFixed(0); 457 var html=''; 458 html += "<div class='btn btn-sm btn-tb add-category-entity'> "; 459 html += " <input type='hidden' name='category["+_time+"]' class='category' value='"+category+"'>"; 460 html += " <span class='btn_category_modify' data-cate-idxno='"+_time+"'>"+category+"</span><span class='btn_category_delete' data-cate-idxno='"+_time+"' aria-label='ìì '><i class='ndcon-cancel'></i></span>"; 461 html += "</div>"; 462 $('#add-category').append(html); 463 } 464 465 //ì´ê¸°í 466 $('#category_name').val(''); 467 468 } else if(isModalButton) { // ìì ëª¨ë¬ 469 470 var $this = $(this) 471 ,$form = $('#form_bbs_category') 472 ,$item = $this.closest(".add-category-entity") 473 ,$span = $this.closest(".btn_category_modify") 474 ,cate_idxno = $span.data("cate-idxno") 475 ,category = $item.find("input:hidden[name='category["+cate_idxno+"]']").val(); 476 477 $form.find('input:hidden[name="cate_idxno"]').val(cate_idxno); 478 $form.find('input:text[name="category"]').val(category); 479 480 $('#form_bbs_category').foundation('open'); 481 482 // ìì 483 $form.on('click', '.chk', function(e){ 484 if($item) { 485 var cate_idxno= $form.find('input:hidden[name="cate_idxno"]').val() 486 ,category = $form.find('input[name="category"]').val(); 487 488 if($form.find('[name="category"]').val() == ""){ 489 alert('ì¹´í ê³ ë¦¬ ëª ì ì ííê² ì ë ¥í´ì£¼ì¸ì'); 490 $form.find('[name="category"]').focus(); 491 return false; 492 } 493 494 $item.find("input:hidden[name='category["+cate_idxno+"]']").val(category); 495 $item.find(".btn_category_modify[data-cate-idxno='"+cate_idxno+"']").html(category).attr("data-category",category); 496 } 497 498 $('#form_bbs_category').foundation('close'); 499 }); 500 501 } else if(isDltButton) { //ìì 502 var cate_idxno = $(this).closest(".btn_category_delete").data("cate-idxno"); 503 if(!window.confirm("ìì íìê² ìµëê¹?")) return false; 504 $.post( "/bbs/axBbsCategory.php" 505 ,{mode:"categoryChk",cate_idxno:cate_idxno} 506 ,function(data, rst){ 507 if(data.result === "success"){ 508 $this.closest(".add-category-entity").fadeOut("fast",function(){$(this).remove();}); 509 }else alert(decodeURIComponent(data.msg)); 510 511 },"json"); 512 return false; 513 } 514 }); 515 } 516 517 //ì ë ¬ 518 ,evtSortableCategory:function(){ 519 var $box = $("#add-category"), 520 table_name = $box.attr("data-table"); 521 522 $box.sortable({ 523 placeholder: "ui-state-highlight" 524 ,forcePlaceholderSize:true 525 ,update:function(event, ui){ 526 // ì ì¥ìí¨ 527 } 528 }); 529 } 530 531 //ì¹´í ê³ ë¦¬ ì´ë 532 ,categoryMove:function(checkBoxIdxno){ 533 534 // ì ì²´ì í 535 $("#all-dummy").click(function(e){ 536 $('input:checkbox[name="bbs_idxno[]"]', '#bbs_table').each(function(i){ 537 this.checked = $('input:checkbox[name="all_dummy"]', '#bbs_table').is(':checked'); 538 }); 539 }); 540 541 // ì¶ê° 542 $('.bbs-skin').on('click', '.categoryModalBtn', function(e){ 543 var data=$(checkBoxIdxno).filter(function(i){ return this.checked?true:false; }).map(function(a,b){ return b.value; }).get(); 544 if(data.length<=0){ 545 alert("ì¹´í ê³ ë¦¬ ì´ë í ê²ì물ì ì íí´ì£¼ì¸ì."); 546 return false; 547 } 548 //console.log(data); 549 $('#categoryMoveForm').foundation('open'); 550 551 $('#categoryMoveForm').on('click', '.category_move_btn', function(e){
552 var to_category = $('#categoryMoveForm').find('#toCategory option:selected').val(), 553 table_name = $('#categoryMoveForm').find('input:hidden[name="table_name"]').val(); 554 555 if(!window.confirm("ì¹´í ê³ ë¦¬ ì´ë í ê²ìë¬¼ë¡ ë³ê²½íìê² ìµëê¹?")) return false; 556 $.post("/bbs/axBbsCategory.php" 557 ,{mode:"bbsCategoryMove","bbs_idxno[]":data,"to_category":to_category,"table_name":table_name} 558 ,function(data,rst){ 559 console.log(data); 560 if(data.result!="success"){ 561 alert(data.msg||"문ì ê° ìê²¼ìµëë¤. ì ìí ë¤ì ìë íì¬ ì£¼ì¸ì."); 562 return false; 563 } 564 //alert("ì¹´í ê³ ë¦¬ ì´ëì´ ìë£ëììµëë¤."); 565 location.reload(true); 566 },"json"); 567 568 return false; 569 }); 570 }); 571 } 572} 573 574/***************************************************************************** 575* ë¤ì¤ì¹ì ì¤ì 576*****************************************************************************/ 577var multiSection ={ 578 579 // ì¹ì ë¡ë 580 sectionLoad:function() { 581 582 $('#admin-content').on('change', '.add-section-select', function(e){ 583 var tp = $(this).data('type'); 584 var code = $(this).val(); 585 var $_obj = $('#add_section'); 586 587 if(tp == 1) multiSection.changeSectionCode(tp, code); 588 else if(tp == 2) { 589 if($(this).val() == "") { 590 multiSection.changeSectionCode(1, $_obj.val()); 591 } 592 else multiSection.changeSectionCode(tp, code); 593 } 594 }); 595 596 //ìì 597 $('#section-div').on('click', '.delete-button', function(e){ 598 var tp = $(this).data('type'); 599 $(this).closest('.'+tp+'-section-entity').remove(); 600 }); 601 } 602 603 //ì¹ì ì½ë í¸ì¶ 604 ,changeSectionCode:function(tp,code) { 605 606 var $_subsection = $('#add_subsection'); 607 var $_serial = $('#add_serial'); 608 609 $.ajax({ 610 type: "post", 611 dataType: "json", 612 url: "/news/changeSectionCode.ajax.php", 613 data:{tp:tp, code:code}, 614 success: function(data) { 615 if(data[0] == "Y"){ 616 if(tp == 1){ 617 $_subsection.html(data[1]); 618 $_serial.html(data[2]); 619 }else if(tp == 2){ 620 $_serial.html(data[2]); 621 } 622 } 623 }, 624 error: function(error, request) { 625 alert('error!!!'); 626 console.log("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 627 } 628 }); 629 630 return false; 631 } 632 633 // ìëë°ì¤ ì¹ì ì¶ê°&ì ì¸ 634 ,addSectionCode:function() { 635 636 // ì¹ì ë¨ë½ ë ¸ì¶ ì¬ë¶ 637 if($('.add-section-entity').length > 0) $('#section-div').show(); 638 else $('#section-div').hide(); 639 640 $('#admin-content').on('click', '#sectionBtn', function(e){ 641 642 // ì¶ê° or ì ì¸ 643 var tp = $(this).data('type'); 644 645 //1ì°¨ì¹ì 646 var sectioncode = $('#add_section option:selected').val(); 647 var sectionname = $('#add_section option:selected').text(); 648 //2ì°¨ì¹ì 649 var subsectioncode = $('#add_subsection option:selected').val(); 650 var subsectionname = $('#add_subsection option:selected').text(); 651 //3ì°¨ì¹ì 652 var serialcode = $('#add_serial option:selected').val(); 653 var serialname = $('#add_serial option:selected').text(); 654 655 //1ì°¨ì¹ì ì ì í ìíìì... 656 if(!sectioncode || sectioncode == "") { 657 alert("ì¶ê°í ì¹ì ì ì íí´ì£¼ì¸ì."); 658 return false; 659 } 660 661 // ì¤ë³µì½ë ì²´í¬ 662 var addSecCode = sectioncode; 663 if(subsectioncode) addSecCode += '>'+subsectioncode; 664 if(serialcode) addSecCode += '>'+serialcode; 665 666 var duplicateChk = false; 667 668 // ëì¼í ì¹ì 구ì±ì´ ì¶ê°&ì ì¸ ëì ì¶ê° ì ì´ 669 $('.input_setion_data').each(function(){ 670 if( $(this).val() == addSecCode) { 671 alert('ì´ë¯¸ ì¤ë³µ ë ì½ëê° ì¡´ì¬í©ëë¤.'); 672 eixt; 673 duplicateChk = true; 674 return false; 675 } 676 }); 677 678 if(tp == 'add') { 679 //ì ì²´ê° ì í ë ê²½ì° ë¨ì¼ ì í ì ì´ 680 $('.add_section_data').each(function(){ 681 if($(this).val() == "ALL"){ 682 alert('ì 체를 ì ííì¤ ê²½ì° ë¨ì¼ ì¹ì ì íì íì¤ ì ììµëë¤.'); 683 duplicateChk = true; 684 return false; 685 } 686 }); 687 688 // ë¨ì¼ ì¹ì ì íì ì ì²´ ì í ì ì´ 689 if($('.add-section-entity').length > 0) { 690 if(addSecCode == "ALL"){ 691 alert('ë¨ì¼ ì¹ì ì´ ì´ë¯¸ ì íëì´ ììµëë¤. ì ì²´ë ì ííì¤ ì ììµëë¤.'); 692 duplicateChk = true; 693 return false; 694 } 695 } 696 697 } else if(tp == "exc") { 698 699 if(addSecCode == "ALL"){ 700 alert('ì ì¸ ì¹ì ì¼ë¡ë ì 체를 ì ííì¤ ì ììµëë¤.'); 701 duplicateChk = true; 702 return false; 703 } else { 704 705 if($('.add-section-entity').length > 0) { 706 $('.add_section_data').each(function(){
707 if($(this).val().indexOf(addSecCode) != -1) { //í¬í¨í ê²½ì° 708 alert('ì¶ê° ì¹ì ì í¬í¨ ë 1ì°¨ ì¹ì ì¼ë¡ ì ì¸í ì ììµëë¤. '); 709 duplicateChk = true; 710 return false; 711 } 712 if($(this).val() != "ALL"){ 713 if(addSecCode.indexOf(">") == -1) { 714 alert('ì ì¸ ì¹ì ì¼ë¡ ì²ë¦¬í ì ììµëë¤.'); 715 duplicateChk = true; 716 return false; 717 } 718 } 719 }); 720 } 721 } 722 723 if($('.add-section-entity').length == 0) { 724 alert('ì¶ê° ì¹ì ì 먼ì ì íí´ì£¼ì¸ì.'); 725 duplicateChk = true; 726 return false; 727 } 728 } 729 730 if(duplicateChk) return false; 731 732 // ì¶ê° ë ê²½ì° ë ¸ì¶ 733 $('#section-div').show(); 734 735 var title = sectionname; 736 if(subsectioncode || subsectioncode != "") title += ">"+subsectionname; 737 if(serialcode || serialcode != "") title += ">"+serialname; 738 739 var html=''; 740 html += "<div class='dsframe-section-content "+tp+"-section-entity'>"; 741 html += " <input type='hidden' name='"+tp+"_section_data[]' class='"+tp+"_section_data input_setion_data' value='"+addSecCode+"'>"; 742 // html += " <input type='hidden' class='"+tp+"-chk-sec' value='"+addSecCode+"'>"; 743 html += " <button type='button' class='btn btn-tb delete-button' data-type='"+tp+"' title='"+sectionname+" ìì '>"; 744 html += title; 745 html += " <i class='ndcon-cancel' aria-label='ìì '></i></button>"; 746 html += "</div>"; 747 748 $('#'+tp+'-section').append(html); 749 750 //.attr("data-code",category) 751 752 }); 753 } 754 755 //ì ì¡ 756 ,multiSectionSumbit:function(form) 757 { 758 759 if(!form.description.value) 760 { 761 alert("리ì¤í¸ëª ì ì ë ¥í´ì£¼ì¸ì."); 762 description.focus(); 763 return false; 764 } 765 766 if($('.add-section-entity').length == 0) { 767 alert("ì°ê²° ì¹ì ì ì íí´ì£¼ì¸ì."); 768 return false; 769 } 770 771 if(confirm("ì íí ì¹ì ì íëì 리ì¤í¸ë¡ 구ì±í©ëë¤. \nì ë§ë¡ ì¤ííìê² ìµëê¹?")) return true; 772 else return false; 773 774 } 775 776} 777 778/* ****************************************** */ 779/* /script/app.js (íì´ë°ì´ì ì¤ííì¼ */ 780/* ****************************************** */ 781 782$(function(){ 783 $(document).foundation(); 784}); 785 786/***************************************************************************** 787*ê¸°ì¬ ì¹´ì´í¸ 788*****************************************************************************/ 789var _statistics={ 790 articleCookieCount:function(article_idxno){ 791 if(!article_idxno) return false; 792 793 var cookieRestore = false 794 ,articleIdxno = article_idxno 795 ,articleUniqView = _statistics.getCookie('___AUV') 796 ,dateTime = new Date(); 797 798 var regexp = new RegExp("_"+articleIdxno+"\.(\\d{10})x","i"); 799 var dataArr = articleUniqView.match(regexp); 800 801 if(dataArr !== null){ 802 var limitTime = dateTime.setHours(dateTime.getHours() - 1); 803 limitTime = Math.floor(limitTime / 1000); 804 if (limitTime > dataArr[1]){ 805 articleUniqView = articleUniqView.replace(dataArr[0], ''); 806 cookieRestore = true; 807 } 808 } else cookieRestore = true; 809 810 if(cookieRestore === true) { 811 var newData = '_'+articleIdxno+'.'+ Math.floor(new Date().getTime() / 1000) +'x'; 812 $.ajax({ 813 url:'/news/makeArticleUniqSave.ajax.php', 814 type:'POST', 815 dataType:'json', 816 cahse: false, 817 data: {article_idxno:articleIdxno}, 818 success:function(rst,data){ 819 if(rst.result == "success"){ 820 var tmpTotalSize = 8 + articleUniqView.length + newData.length; 821 if (tmpTotalSize >= 2048) articleUniqView = articleUniqView.substr(0, (articleUniqView.length - newData.length)); 822 articleUniqView = newData + articleUniqView; 823 824 var domain = '.'+ countDomain.replace(/^http(s)?:\/\//i,'').replace(/^(www|m)\./i,''); 825 _statistics.setCookie("___AUV", articleUniqView.trim(), 30, domain); 826 } 827 }, 828 error: function(error, request) { 829 console.log("error:"+error+"\n"+"request:"+request); 830 } 831 }); 832 } 833 } 834 ,getCookie:function(name) 835 { 836 name+="="; 837 var ca = document.cookie.split(';'); 838 for(var i=0; i<ca.length; i++) { 839 var c = ca[i];
840 while (c.charAt(0)==' ') c = c.substring(1); 841 if (c.indexOf(name) == 0) return c.substring(name.length,c.length); 842 } 843 return ""; 844 } 845 ,setCookie:function(name, value, days, domain) 846 { 847 var expires = ""; 848 if(days){ 849 var date = new Date(); 850 date.setTime(date.getTime()+(days*24*60*60*1000)); 851 expires = "; expires="+date.toGMTString(); 852 } 853 if(!domain) domain = countDomain.replace(/^http(s)?:\/\//i,'').replace(/^(www|m)\./i,''); 854 document.cookie = name+"="+value+expires+"; path=/; " + (domain?"domain="+domain+";":""); 855 } 856} 857 858/***************************************************************************** 859* 기ì¬ë³¸ë¬¸ ë³µì¬í기 ì¶ì² íì 860*****************************************************************************/ 861var _articleSelect={ 862 copy:function(text){ 863 if(!text) return; 864 $('#article-view-content-div').on('copy', function(e){ 865 var selectContent = window.getSelection().toString() 866 ,copyFooter = "\n\nì¶ì² : "+text+"\n" 867 ,copyText = selectContent + copyFooter; 868 Util.copyToClipboard(copyText, _articleSelect.empty, _articleSelect.empty); 869 }); 870 } 871 ,empty:function(){} 872};
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.