1String.prototype.startsWith = function(str) { 2if (this.length < str.length) { return false; } 3return this.indexOf(str) == 0; 4} 5 6String.prototype.endsWith = function(str) { 7if (this.length < str.length) { return false; } 8return this.lastIndexOf(str) + str.length == this.length; 9} 10 11 12GMap = function(){ 13 this.map = new Object(); 14}; 15GMap.prototype = { 16 put : function(key, value){ 17 this.map[key] = value; 18 }, 19 get : function(key){ 20 return this.map[key]; 21 }, 22 containsKey : function(key){ 23 return key in this.map; 24 }, 25 containsValue : function(value){ 26 for(var prop in this.map){ 27 if(this.map[prop] == value) return true; 28 } 29 return false; 30 }, 31 isEmpty : function(key){ 32 return (this.size() == 0); 33 }, 34 clear : function(){ 35 for(var prop in this.map){ 36 delete this.map[prop]; 37 } 38 }, 39 remove : function(key){ 40 delete this.map[key]; 41 }, 42 keys : function(){ 43 var keys = new Array(); 44 for(var prop in this.map){ 45 keys.push(prop); 46 } 47 return keys; 48 }, 49 values : function(){ 50 var values = new Array(); 51 for(var prop in this.map){ 52 values.push(this.map[prop]); 53 } 54 return values; 55 }, 56 size : function(){ 57 var count = 0; 58 for (var prop in this.map) { 59 count++; 60 } 61 return count; 62 }, 63 toString : function(){ 64 var temp = ''; 65 for(i in this.map){ 66 temp = temp + ',' + i + ':' + this.map[i]; 67 } 68 temp = temp.replace(',',''); 69 return temp; 70 }, 71 jsonString: function(){ 72 return JSON.stringify(this.map); 73 } 74}; 75 76String.prototype.replaceAll = function(org, dest) { 77 return this.split(org).join(dest); 78}; 79 80 81function gfnRmHtmlTag(args) { 82 83 if (args == null) 84 return; 85 86 return args.replace(/(<([^>]+)>)/ig,""); 87}; 88 89function ajaxSend(sendUrl, sendData, callback, callbackparam, callbackparam2) { 90 91 $.ajax({ 92 url:sendUrl 93 , async:true 94 , type:'POST' 95 , dataType:'json' 96 , contentType:'application/json; charset=utf-8' 97 , data: sendData 98 , beforeSend : function(xhr){ 99 xhr.setRequestHeader("AJAX", true); 100 } 101 , success:function(result) { 102 103 //console.log(result); 104 105 if (typeof callback === "function") { 106 if (callbackparam2 != null) { 107 callback(result, callbackparam, callbackparam2); 108 } else if (callbackparam != null && callbackparam2 == null) { 109 callback(result, callbackparam); 110 } else { 111 callback(result); 112 } 113 } 114 115 } 116 , error:function(request, status, error){ 117 console.log("code",request.status); 118 console.log("error",error); 119 } 120 , complete:function(xhr) { 121 122 } 123 }); 124}; 125 126 127function gfnSitePageOpen(args) { 128 129 console.log("gfnSitePageOpen", args); 130 131 window.open(args, "_blank"); 132 133}; 134 135function gfnGetBbsList(bbsId, pageIndex, callback, sparam, sparamVal, pageUnit, stype, param) { 136 137 console.log("gfnGetBbsList", bbsId); 138 139 var sendMap = new GMap(); 140 sendMap.put("siteFlag", $('#siteFlag').val()); 141 sendMap.put("bbsId", bbsId); 142 sendMap.put("pageIndex", pageIndex); 143 sendMap.put("bbsAuth", $("#bbsAuth").val()); 144 145 if (sparam != null && sparamVal != '') { 146 if (sparam == '01') { 147 sendMap.put("searchCnd", "0"); 148 sendMap.put("searchWrd", sparamVal); 149 } else if (sparam == '02') { 150 sendMap.put("searchCnd", "1"); 151 sendMap.put("searchWrd", sparamVal); 152 } else if (sparam == '03') { 153 sendMap.put("searchCnd", "3"); 154 sendMap.put("searchWrd", sparamVal); 155 } 156 } 157 158 if (pageUnit != null) { 159 sendMap.put("pageUnit", pageUnit); 160 } 161 162 if (stype != null && stype != '') { 163 sendMap.put("searchCategoryCd", stype); 164 } 165 166 console.log("gfnGetBbsList sendMap.jsonString()", sendMap.jsonString()); 167 168 169 if (param != null) { 170 ajaxSend("/web/bbs/bbsListApi.gen", sendMap.jsonString(), callback, param); 171 } else { 172 ajaxSend("/web/bbs/bbsListApi.gen", sendMap.jsonString(), callback); 173 } 174 175 176}; 177 178function gfnGetDeferred(requests, callback) { 179 var deferreds = []; 180 181 $.each(requests, function (index, item) { 182 deferreds.push( 183 $.ajax({
184 url:item.sendUrl 185 , async:true 186 , type:'POST' 187 , dataType:'json' 188 , contentType:'application/json; charset=utf-8' 189 , data: item.sendData 190 , success:function(data) { 191 callback(data, JSON.parse(item.sendData)); 192 }, error:function(request, status, error){ 193 194 } 195 }) 196 ); 197 }); 198 199 return deferreds; 200} 201 202function gfnGetAjaxWithWhen(requests, callback, doneCallback) { 203 var deferreds = gfnGetDeferred(requests, callback); 204 $.when.apply(null, deferreds).done(function() { 205 //console.log("gfnGetAjaxWithWhen done"); 206 doneCallback(); 207 }); 208} 209 210 211function gfnGetTopBbsList(bbsProperties, callback, doneCallback) { 212 var requests = new Array(); 213 var obj = new Object(); 214 var sendUrl = "/web/bbs/bbsListApi.gen"; 215 var pageUnit = 4; 216 var pageIndex = 1; 217 var sendMap; 218 219 $.each(bbsProperties, function (index, item) { 220 //console.log(item.mnuUrl); 221 obj = new Object(); 222 sendMap = new GMap(); 223 sendMap.put("siteFlag" , $('#siteFlag').val()); 224 sendMap.put("bbsAuth" , $("#bbsAuth").val()); 225 sendMap.put("bbsId" , item.bbsId); 226 sendMap.put("mnuId" , item.mnuId); 227 sendMap.put("pageIndex", pageIndex); 228 sendMap.put("pageUnit" , pageUnit); 229 230 obj.sendUrl = sendUrl; 231 obj.sendData = sendMap.jsonString(); 232 233 requests.push(obj); 234 }); 235 236 //console.log("requests : ", requests); 237 gfnGetAjaxWithWhen(requests, callback, doneCallback); 238 239} 240 241function gfnGetQnABbsList(bbsId, pageIndex, callback, sparam, sparamVal, pageUnit, stype, param) { 242 243 console.log("gfnGetQnABbsList", bbsId); 244 245 var sendMap = new GMap(); 246 sendMap.put("siteFlag", $('#siteFlag').val()); 247 sendMap.put("bbsId", bbsId); 248 sendMap.put("pageIndex", pageIndex); 249 sendMap.put("bbsAuth", $("#bbsAuth").val()); 250 251 if (sparam != null && sparamVal != '') { 252 if (sparam == '01') { 253 sendMap.put("searchCnd", "0"); 254 sendMap.put("searchWrd", sparamVal); 255 } else if (sparam == '02') { 256 sendMap.put("searchCnd", "1"); 257 sendMap.put("searchWrd", sparamVal); 258 } else if (sparam == '03') { 259 sendMap.put("searchCnd", "3"); 260 sendMap.put("searchWrd", sparamVal); 261 } 262 } 263 264 if (pageUnit != null) { 265 sendMap.put("pageUnit", pageUnit); 266 } 267 268 if (stype != null && stype != '') { 269 sendMap.put("searchCategoryCd", stype); 270 } 271 272 console.log("gfnGetBbsList sendMap.jsonString()", sendMap.jsonString()); 273 274 275 if (param != null) { 276 ajaxSend("/web/bbs/bbsQnAListApi.gen", sendMap.jsonString(), callback, param); 277 } else { 278 ajaxSend("/web/bbs/bbsQnAListApi.gen", sendMap.jsonString(), callback); 279 } 280 281}; 282 283function gfnGetBbsDetail(bbsId, nttId, callback) { 284 285 console.log("gfnGetBbsList", bbsId); 286 287 var sendMap = new GMap(); 288 sendMap.put("siteFlag", $('#siteFlag').val()); 289 sendMap.put("bbsId", bbsId); 290 sendMap.put("nttId", nttId); 291 sendMap.put("mnuId", $("#mnuId").val()); 292 sendMap.put("bbsAuth", $("#bbsAuth").val()); 293 294 console.log("gfnGetBbsDetail sendMap.jsonString()", sendMap.jsonString()); 295 296 ajaxSend("/web/bbs/bbsViewApi.gen", sendMap.jsonString(), callback); 297 298}; 299 300function gfnGetQnABbsDetail(bbsId, nttId, callback) { 301 302 console.log("gfnGetQnABbsList", bbsId); 303 304 var sendMap = new GMap(); 305 sendMap.put("siteFlag", $('#siteFlag').val()); 306 sendMap.put("bbsId", bbsId); 307 sendMap.put("nttId", nttId); 308 sendMap.put("mnuId", $("#mnuId").val()); 309 sendMap.put("bbsAuth", $("#bbsAuth").val()); 310 311 console.log("gfnGetQnABbsDetail sendMap.jsonString()", sendMap.jsonString()); 312 313 ajaxSend("/web/bbs/bbsQnAViewApi.gen", sendMap.jsonString(), callback); 314 315}; 316 317function gfnFileDownload(atchFileId, fileSn) { 318 var mnuId = $("#mnuId").val(); 319 window.open("/web/bbs/FileDownApi.gen?atchFileId="+atchFileId+"&fileSn="+fileSn+"&mnuId="+mnuId); 320}; 321 322function gfnCodeSelect(grpId, argsId, title, selectedVal) { 323 324 var sendMap = new GMap(); 325 sendMap.put("grpId", grpId); 326 327 if(!selectedVal){ selectedVal = ""; } 328 329 console.log("gfnCodeSelect sendMap.jsonString()", sendMap.jsonString()); 330 331 ajaxSend("/web/bbs/getCdListApi.gen", sendMap.jsonString(), function(result){ 332 var strHtml = ''; 333 334 if (title != null) { 335 strHtml += '<option value="">' + title + '</option>'; 336 } 337 338 $.each(result.cdList, function(idx, item){ 339 if(selectedVal == item.cdId){ 340 strHtml += '<option value="' + item.cdId + '" selected="selected" >'; 341 }else{ 342 strHtml += '<option value="' + item.cdId + '" >'; 343 } 344 strHtml += item.cdTitle; 345 strHtml += '</option>'; 346 }); 347 348 $('#' + argsId).html(strHtml); 349 }); 350 351}; 352 353function gfnCodeList(grpId, parentId, name, title) { 354 355 var sendMap = new GMap(); 356 sendMap.put("grpId", grpId); 357 358 console.log("gfnCodeSelect sendMap.jsonString()", sendMap.jsonString()); 359 360 if(title){title = "ë¶ë¥"} 361 362 var strHtml = '<div class="label_box"><p class="label">' + title + '</p></div>'; 363 364 ajaxSend("/web/bbs/getCdListApi.gen", sendMap.jsonString(), function(result){ 365 366 strHtml += '<ul class="type_list">'; 367 $.each(result.cdList, function(idx, item){ 368 strHtml += '<li>'; 369 strHtml += ' <label class="check_box">'; 370 strHtml += ' <input type="checkbox" id="'+name+(idx)+'" name="'+name+'" value="'+item.cdId+'" class="check" data-type="array">'; 371 strHtml += ' <span class="text">'+item.cdTitle+'</span>'; 372 strHtml += ' </label>'; 373 strHtml += '</li>'; 374 }); 375 strHtml += '</ul>'; 376 377 $('#' + parentId).html(strHtml); 378 }); 379 380}; 381 382function gcbCodeSelect(result, argsId, title) { 383 384 var strHtml = ''; 385 386 if (title != null) { 387 strHtml += '<option value="">' + title + '</option>'; 388 } 389 390 $.each(result.cdList, function(idx, item){ 391 strHtml += '<option value="' + item.cdId + '" >'; 392 strHtml += item.cdTitle; 393 strHtml += '</option>'; 394 }); 395 396 $('#' + argsId).html(strHtml); 397 398}; 399 400function gfnPagination_mobile(page, divId, calfn) { 401 var totalRecordCount = page.totalRecordCount; 402 var currentPageNo = page.currentPageNo; 403 var recordCountPerPage = page.recordCountPerPage; 404 var pageSize = 5; 405 var totalPageCount = Math.floor((totalRecordCount - 1) / recordCountPerPage) + 1; 406 407 var firstPageNo = 1; 408 var lastPageNo = totalPageCount; 409
410 var firstPageNoOnPageList = Math.floor((currentPageNo - 1) /pageSize) * pageSize + 1; 411 var lastPageNoOnPageList = firstPageNoOnPageList + pageSize - 1; 412 413 if (lastPageNoOnPageList > totalPageCount) { 414 lastPageNoOnPageList = totalPageCount; 415 } 416 417 //console.log("currentPageNo : ", currentPageNo); 418 //console.log("page : ", firstPageNoOnPageList +"~" + lastPageNoOnPageList); 419 420 var strHtml = ''; 421 var prePage; 422 var nextPage; 423 424 if (currentPageNo == firstPageNo) { 425 prePage = currentPageNo; 426 } else { 427 prePage = currentPageNo - 1; 428 } 429 430 if (currentPageNo == lastPageNo) { 431 nextPage = currentPageNo; 432 } else { 433 nextPage = currentPageNo + 1; 434 } 435 436 437 strHtml += '<ul class="bbs_page mobile">'; 438 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '(1);" class="btn_page first"></a></li>'; 439 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '('+ prePage + ');" class="btn_page prev"></a></li>'; 440 441 for (var i=firstPageNoOnPageList; i<=lastPageNoOnPageList; i++) { 442 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '('+ i + ');"'; 443 if (i == currentPageNo) { 444 strHtml += ' class="btn_page active">'; 445 } else { 446 strHtml += ' class="btn_page">'; 447 } 448 strHtml += i; 449 strHtml += '</a></li>'; 450 } 451 452 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '('+ nextPage + ');" class="btn_page next"></a></li>'; 453 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '('+ lastPageNo + ');" class="btn_page last"></a></li>'; 454 strHtml += '</ul>'; 455 456 return strHtml; 457} 458 459function gfnPagination_pc(page, divId, calfn) { 460 461 var strHtml = ''; 462 var prePage; 463 var nextPage; 464 465 console.log("page : ", page); 466 467 if (page.currentPageNo == page.firstPageNo) { 468 prePage = page.currentPageNo; 469 } else {
470 prePage = page.currentPageNo - 1; 471 } 472 473 if (page.currentPageNo == page.lastPageNo) { 474 nextPage = page.currentPageNo; 475 } else { 476 nextPage = page.currentPageNo + 1; 477 } 478 479 strHtml += '<ul class="bbs_page pc">'; 480 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '(1);" class="btn_page first"></a></li>'; 481 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '('+ prePage + ');" class="btn_page prev"></a></li>'; 482 483 for (var i=page.firstPageNoOnPageList; i<=page.lastPageNoOnPageList; i++) { 484 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '('+ i + ');"'; 485 if (i == page.currentPageNo) { 486 strHtml += ' class="btn_page active">'; 487 } else { 488 strHtml += ' class="btn_page">'; 489 } 490 strHtml += i; 491 strHtml += '</a></li>'; 492 } 493 494 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '('+ nextPage + ');" class="btn_page next"></a></li>'; 495 strHtml += '<li><a href="javascript:void(0);" onclick="' + calfn + '('+ page.lastPageNo + ');" class="btn_page last"></a></li>'; 496 strHtml += '</ul>'; 497 498 return strHtml; 499} 500 501function gfnPagination(page, divId, calfn) { 502 var strHtml = ""; 503 strHtml += gfnPagination_pc(page, divId, calfn); 504 strHtml += gfnPagination_mobile(page, divId, calfn); 505 506 $("#" + divId).html(strHtml); 507}; 508 509function gfnMoveBbsDetail(bbsId, nttId, action) { 510 var frm = document.getElementById('contsfrm'); 511 frm.bbsId.value = bbsId; 512 frm.nttId.value = nttId; 513 frm.bbsFlag.value = "View"; 514 frm.method = "POST"; 515 516 if (action != null) { 517 frm.action = '/web/pages/' + action + '.do'; 518 } 519 520 frm.submit(); 521}; 522 523function gfnMoveBbsList(action) { 524 var frm = document.getElementById('contsfrm'); 525 frm.bbsFlag.value = "List"; 526 frm.method = "POST"; 527 if (action != null) { 528 frm.action = action; 529 } 530 frm.submit(); 531}; 532 533 534function gfnDeleteBbs(action) { 535 536 if (confirm('í´ë¹ ê²ì물ì ìì íìê² ìµëê¹?')) { 537 538 var frm = document.getElementById('contsfrm'); 539 frm.bbsFlag.value = "Delete"; 540 541 var sendData = new FormData(frm); 542 543 $.ajax({ 544 type: "POST", 545 enctype: 'multipart/form-data', 546 url: "/web/bbs/bbsProcApi.gen", 547 data: sendData, 548 processData: false, 549 contentType: false, 550 cache: false, 551 success: function (data) { 552 if(data.resultCode == 0){ 553 gfnMoveBbsList(); 554 } else if(data.resultCode == -1){ 555 alert(data.message); 556 history.back(); 557 } else{ 558 history.back(); 559 } 560 }, 561 error: function (e) { 562 alert("ì¤ë¥ê° ë°ìíììµëë¤."); 563 history.back(); 564 } 565 }); 566 567 } 568}; 569 570// LIME ë°ìí 2020.09.09 ê¸ì°ê¸° ë©ë´ì´ë 571function gfnMoveBbsWrite(bbsFlag, action) { 572 var frm = document.getElementById('contsfrm'); 573 574 frm.bbsFlag.value = bbsFlag; 575 frm.method = "POST"; 576 if (action != null) { 577 frm.action = action; 578 } 579 frm.submit(); 580 581 582} 583 584function gfnSearchAll() { 585 586 var frm = document.getElementById('kietfrm'); 587 frm.method = "POST"; 588 frm.srchAllWord.value = $("#srchAllText").val(); 589 frm.action = '/kietc/kietChinaSearch.do'; 590 frm.submit(); 591 592}; 593 594function gfnDateFormat(args, format) { 595 596 if (args < 8){ 597 return args; 598 } else { 599 args = args.replace(/-/gi,""); 600 return args.substring(0,4) + format + args.substring(4,6) + format + args.substring(6,8); 601 } 602 603}; 604 605String.prototype.cutstring = function(len) { 606 607 var str = this; 608 var s = 0; 609 for (var i=0; i<str.length; i++) { 610 s += (str.charCodeAt(i) > 128) ? 2 : 1; 611 if (s > len) return str.substring(0,i) + "..."; 612 } 613 614 return str; 615 616}; 617 618String.prototype.bytes = function() { 619 var str = this; 620 var s = 0; 621 for (var i=0; i<str.length; i++) { 622 s += (str.charCodeAt(i) > 128) ? 2 : 1; 623 } 624 return s; 625}; 626 627var isMobile = { 628 Android: function() { 629 return navigator.userAgent.match(/Android/i) == null ? false : true; 630 } 631 , BlackBerry: function() { 632 return navigator.userAgent.match(/BlackBerry/i) == null ? false : true; 633 } 634 , IOS: function() { 635 return navigator.userAgent.match(/iPhone|iPad|iPod/i) == null ? false : true; 636 } 637 , Opera: function() { 638 return navigator.userAgent.match(/Opera Mini/i) == null ? false : true; 639 } 640 , Windows: function() { 641 return navigator.userAgent.match(/IEMobile/i) == null ? false : true; 642 } 643 , confirm: function() { 644 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.IOS() || isMobile.Opera() || isMobile.Windows()); 645 } 646}; 647 648function gfnDatePicker() { 649 $.fn.datepicker.dates['ko'] = { 650 days: ["ì¼", "ì", "í", "ì", "목", "ê¸", "í "], 651 daysShort: ["ì¼", "ì", "í", "ì", "목", "ê¸", "í "], 652 daysMin: ["ì¼", "ì", "í", "ì", "목", "ê¸", "í "], 653 months: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"], 654 monthsShort: ["01ì", "02ì", "03ì", "04ì", "05ì", "06ì", "07ì", "08ì", "09ì", "10ì", "11ì", "12ì"], 655 today: "Today", 656 clear: "Clear", 657 format: "yyyy.MM.dd", 658 titleFormat: "yyyy MM", /* Leverages same syntax as 'format' */ 659 weekStart: 0 660 }; 661 $(".datepicker").datepicker({ 662 orientation: "bottom", 663 language: "ko", 664 autoclose: true, 665 endDate: "+0d", 666 }); 667 //ììë ë§ì§ë§ë ì¤ì 668 $("#sDate").datepicker().on("changeDate", function (selected) { 669 var minDate = new Date(selected.date.valueOf()); 670 $("#eDate").datepicker("setStartDate", minDate); 671 }); 672 $("#eDate").datepicker().on("changeDate", function (selected) { 673 var maxDate = new Date(selected.date.valueOf()); 674 $("#sDate").datepicker("setEndDate", maxDate); 675 }); 676 677 //기ê°ê²ì 678 $("#setPrAll").on("click", function(){ 679 $(".datepicker").datepicker("update", ""); 680 }); 681 $("#setPrToday").on("click", function(){ 682 $("#sDate").datepicker("update", "0d"); 683 $("#eDate").datepicker("update", "0d"); 684 }); 685 $("#setPrWeek").on("click", function(){ 686 $("#sDate").datepicker("update", "-7d"); 687 $("#eDate").datepicker("update", "0d"); 688 }); 689 $("#setPrMon").on("click", function(){ 690 $("#sDate").datepicker("update", "-30d"); 691 $("#eDate").datepicker("update", "0d"); 692 }); 693 $("#setPrYear").on("click", function(){ 694 $("#sDate").datepicker("update", "-365d"); 695 $("#eDate").datepicker("update", "0d"); 696 }); 697 698 //ë ì§ ì´ê¸°í 699 $("#dateReset").on("click", function(){ 700 $(".datepicker").datepicker("update", ""); 701 }); 702}; 703 704function gfnDateYear(date){ 705 var args = date; 706 if (args < 8) { return args; } 707 args = args.replace(/-/gi,""); 708 return args.substring(0,4); 709} 710 711function gfnDateMonth(date){ 712 var args = date; 713 if (args < 8) { return args; } 714 args = args.replace(/-/gi,""); 715 return args.substring(4,6); 716} 717 718function gfnDateDay(date){ 719 var args = date; 720 if (args < 8) { return args; } 721 args = args.replace(/-/gi,""); 722 return args.substring(6,8); 723} 724 725function gfnMoveMain() { 726 727 var siteFlag = $("#siteFlag").val(); 728 location.href="/web/index.do?siteFlag=" + siteFlag; 729 730}; 731 732function gfnNvl(args, req) { 733 if (args == null) 734 return req; 735 else
736 return args; 737}; 738 739function gfnEnter(event, func) { 740 if (event.keyCode==13) { 741 new Function('return '+func+'()')(); 742 event.preventDefault(); 743 } 744} 745 746function gfnNbspToSpace(str){ 747 return str.replace(/ /gi," "); 748} 749 750function gfnTrim(str) { 751 return str.replace(/(^\s*)|(\s*$)/g, ""); 752} 753 754function gfnGoBbsMovePage(options, loginState){ 755 var siteFlag = ""; 756 var mnuId = ""; 757 var bbsFlag = ""; 758 var bbsId = ""; 759 var nttId = ""; 760 761 if(loginState) { loginState = "1"; } 762 763 if(options){ 764 siteFlag = options.siteFlag; 765 mnuId = options.mnuId; 766 bbsFlag = options.bbsFlag; 767 bbsId = options.bbsId; 768 nttId = options.nttId; 769 } 770 771 if(bbsFlag == "Write" || bbsFlag == "Edit" || bbsFlag == "Reply"){ 772 gfnMoveBbsWrite(bbsFlag); 773 }else if(bbsFlag == "View"){ 774 gfnMoveBbsDetail(bbsId, nttId); 775 }else if(bbsFlag == "Delete"){ 776 if(loginState == "1"){ 777 gfnMoveBbsDetail(bbsId, nttId); 778 }else{ 779 gfnDeleteBbs(); 780 } 781 } 782 783} 784 785function gfnGetBbsPermitCheck(bbsFlag, bbsId, nttId){ 786 var siteFlag = $("#siteFlag").val(); 787 var mnuId = $("#mnuId").val(); 788 789 if(bbsId == null || typeof(bbsId) == 'undefined') bbsId = ""; 790 if(nttId == null || typeof(nttId) == 'undefined') nttId = ""; 791 792 var sendMap = new GMap(); 793 sendMap.put("siteFlag" , siteFlag); 794 sendMap.put("mnuId" , mnuId); 795 sendMap.put("bbsId" , bbsId); 796 sendMap.put("nttId" , nttId); 797 sendMap.put("bbsFlag" , bbsFlag); 798 799 var options = JSON.parse(sendMap.jsonString()); 800 801 ajaxSend("/web/bbs/bbsUserPermitCheckApi.gen", sendMap.jsonString(), function(result){ 802 803 if(result.resultCode == 0){ 804 gfnGoBbsMovePage(options,'2'); 805 }else{ //ê¶í ìì 806 if(!result.isLogined){ 807 808 loginPopup.open(gfnGoBbsMovePage, options); 809 }else{ //ë¡ê·¸ì¸í ê¶í ìì 810 alert(result.message); 811 } 812 } 813 }); 814 815} 816 817function gfnExpiredCookie(name) { 818 gfnSetCookie(name, "", -1); 819} 820 821function gfnSetCookie(name, value, exp) { 822 var date = new Date(); 823 date.setTime(date.getTime() + exp*24*60*60*1000); 824 document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/;SameSite=None; Secure'; 825} 826 827function gfnGetCookie(name) { 828 var value = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)'); 829 return value? value[2] : null; 830} 831 832function gfnIsHTML(str) { 833 var a = document.createElement('div'); 834 a.innerHTML = str; 835 836 for (var c = a.childNodes, i = c.length; i--; ) { 837 if (c[i].nodeType == 1) return true; 838 } 839 840 return false; 841} 842 843function gfnConvertBr(str){ 844 if(str){ 845 return str.replace(/(\n|\r\n)/g, '<br/>'); 846 }else{ 847 return ""; 848 } 849} 850 851function gfnConvertNr(str){ 852 return str.replace(/(<br>|<br\/>|<br \/>)/g, '\r\n'); 853} 854 855 856function getListFilter(list, key, value, key2, value2){ 857 return list.filter(function(object){ 858 var isTrue1 = object[key] === value; 859 860 var isTrue2 = true; 861 862 if(key2 && value2){ 863 isTrue2 = object[key2] === value2; 864 } 865 return isTrue1 && isTrue2; 866 }); 867} 868 869function getListFilterByDepth(list, mnuDepth, key, value){ 870 return list.filter(function(object){ 871 return object["mnuDepth"] === mnuDepth && object[key].split(",").includes(value) 872 }); 873} 874 875var SiteManager = function(){ 876 this._options; 877 this._depth = 0; 878}; 879 880 881SiteManager.prototype.load = function(_url, _options, _callback){ 882 this._options = _options; 883 //console.log(this._options); 884 ajaxSend(_url, JSON.stringify(this._options), _callback); 885 886} 887 888function gfnOpenLoginPopLayer(){ 889 loginPopup.open(); 890} 891 892function gfnLogout(){ 893 location.href="/web/site/logOut.do"; 894} 895 896 897function goTestFunc(data){ 898 console.log("goTestFunc data : ", data); 899} 900 901function goTestFunc22(data){ 902 console.log("goTestFunc22 data : ", data); 903} 904 905var loginPopup = { 906 907 open : function(callback, options){ 908 var $loginBtn = $("#login_div .btn_login"); 909 var $closeBtn = $("#login_div .close_login"); 910 var $idInput = $("#login_div input[name=id]"); 911 var $passwordInput = $("#login_div input[name=password]"); 912 var $idSaveInput = $("#login_div input[name=idSave]"); 913 var curUrl = location.href; 914
915 if(curUrl.indexOf("#") != -1){ 916 curUrl = curUrl.substring(0, curUrl.indexOf("#")); 917 } 918 919 $idInput.val(""); 920 $passwordInput.val(""); 921 $idSaveInput.prop("checked", false); 922 923 var saveid = gfnGetCookie("saveId"); 924 if (saveid !=null && saveid != "") { 925 $idSaveInput.prop("checked", true); 926 $idInput.val(saveid) 927 } else { 928 $idSaveInput.prop("checked", false); 929 $idInput.val(""); 930 } 931 932 $("#login_div").fadeIn("fast"); 933 934 $loginBtn.unbind("click").on("click", function(){ 935 var id = $.trim($idInput.val()); 936 var password = $.trim($passwordInput.val()); 937 938 if(id == ""){ 939 alert("ìì´ë를 ì ë ¥í´ ì£¼ì¸ì."); 940 $idInput.focus(); 941 return; 942 } 943 944 if(password == ""){ 945 alert("ë¹ë°ë²í¸ë¥¼ ì ë ¥í´ ì£¼ì¸ì."); 946 $passwordInput.focus(); 947 return; 948 } 949 950 var isIdSave = $idSaveInput.prop("checked"); 951 if(!isIdSave){ 952 gfnExpiredCookie("saveId"); 953 } 954 955 var sendMap = new GMap(); 956 sendMap.put("id", id); 957 sendMap.put("password", password); 958 959 ajaxSend("/web/site/loginProcApi.gen", sendMap.jsonString(), function(result){ 960 961 if(result.resultCode == 0){ 962 if(isIdSave){ 963 gfnSetCookie("saveId", id , 1); 964 } 965 966 if(typeof callback != 'undefined' && callback){ 967 968 console.log("callback "); 969 970 if(typeof callback == 'function'){ 971 callback(options); 972 } else { 973 if(callback) { 974 var callfunc = Function("options", "return "+callback+"(options)"); 975 callfunc(options); 976 } 977 } 978 }else{ 979 location.href= curUrl; 980 } 981 982 }else{ 983 alert(result.message); 984 } 985 986 }); 987 988 }); 989 990 $closeBtn.unbind("click").on("click", function(){ 991 $("#login_div").fadeOut("fast"); 992 }); 993 994 $idInput.unbind("click").on("keydown", function(e){ 995 if(e.keyCode==13){ 996 $loginBtn.trigger('click'); 997 } 998 }); 999 1000 $passwordInput.unbind("click").on("keydown", function(e){ 1001 if(e.keyCode==13){ 1002 $loginBtn.trigger('click'); 1003 } 1004 }); 1005 1006 }, 1007 1008 close : function(){ 1009 $("#login_div").hide(); 1010 } 1011 1012} 1013 1014 /** 1015 * ì´ë©ì¼ ì²´í¬ 1016 * @param toCheck : ì²´í¬ í ì´ë©ì¼ 1017 */ 1018function gfnCheckEmail(toCheck){ 1019 var checkEmail = /(\S+)@(\S+)\.(\S+)/; 1020 1021 if(!checkEmail.test(toCheck)){ 1022 return false; 1023 }else{ 1024 return true; 1025 } 1026} 1027 1028 1029function gfnGetFileSize(val) { 1030 var unit = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB']; 1031 var e = Math.floor(Math.log(val) / Math.log(1024)); 1032 return (val / Math.pow(1024, e)).toFixed(2) + " " + unit[e]; 1033} 1034 1035 1036function gfnLoadMoviePlay(id, movieUrl, title, imageUrl) { 1037 var protocal = location.protocol; 1038 if(movieUrl.endsWith(".m3u8")){ 1039 movieUrl = movieUrl.replace(/http:/gi, protocal); 1040 1041 $('#'+id).parent().removeClass("video_box"); 1042 jwplayer(id).setup({ 1043 file : movieUrl, 1044 title : title, 1045 image : imageUrl, 1046 width : '100%', 1047 height : '100%', 1048 mute : false, 1049 androidhls: true, 1050 autostart : false, 1051 abouttext : "íêµê²½ì ì¸ì´íí", 1052 primary : 'html5' 1053 }); 1054 1055 }else{ 1056 movieUrl = movieUrl.replace(/http:/gi, protocal); 1057 var html = '<iframe src="'+movieUrl+'" frameborder="0" allowfullscreen="" style="width:100%;height:100%;"></iframe>'; 1058 $('#'+id).append(html); 1059 } 1060} 1061 1062/** 1063 * ê°í문ì를 <br/>ë¡ ë³í 1064 * @returns 1065 */ 1066function fn_setNewLineToBr(str){ 1067 if(!str) return ""; 1068 var re = /\r\n/g //ê°í문ì를 ëíë´ë ì ê·ííì 1069 str = str.replace(re, "<br/>"); //ê°í문ì를 _ë¡ ì¹í 1070 return str; 1071} 1072 1073function setFocus(obj, message, resetVal){ 1074 1075 var resetVal = (resetVal != undefined && resetVal != "") ? resetVal : ""; 1076 1077 if(message != undefined && message != ""){ 1078 //$.prompt(message, {timeout: 1300, top: "40%", buttons : {}}); 1079 alert(message); 1080 } 1081 1082 obj.focus(); 1083 //obj.css({'background-color' : '#f0f1f2','background':'#f0f1f2'}); 1084} 1085 1086 1087function getDateFormat(date, se){ 1088 console.log("data : ", date); 1089 date = date.replace(/-/gi,""); 1090 if(date.length < 8) return date; 1091 if(!se) se = "-"; 1092 var year = date.substring(0,4);
1093 var month = date.substring(4,6); 1094 var day = date.substring(6,8); 1095 1096 return year + se + month +se+ day; 1097} 1098 1099 1100function gfn_download(nttId, atchFileId, fileSn){ 1101 var mnuId = $('#mnuId').val(); 1102 var url = "/web/file/"+mnuId+"/"+nttId+"/download.do?atchFileId="+atchFileId+"&fileSn="+fileSn; 1103 window.open(url); 1104} 1105 1106/** 1107 * ëª©ë¡ íì´ì§ ì´ë 1108 * @returns 1109 */ 1110function gfn_move_list_page() { 1111 var $form = $('form[name="frm"]'); 1112 $form.find('input[name=nttId]').val(0); 1113 $form.find('input[name=bbsFlag]').val("List"); 1114 $form.attr("method", "get"); 1115 $form.submit(); 1116} 1117 1118/** 1119 * ëª©ë¡ íì´ì§ ì´ë 1120 * @returns 1121 */ 1122function gfn_move_list_page2() { 1123 var $form = $('form[name="frmMove"]'); 1124 $form.find('input[name=nttId]').val(0); 1125 $form.find('input[name=bbsFlag]').val("List"); 1126 $form.attr("method", "get"); 1127 $form.submit(); 1128} 1129 1130 1131/** 1132 * ìµì 목ë¡(N) ë°ì´í° ì¡°í 1133 * @param pageNo 1134 * @returns 1135 */ 1136function gfn_top_list_articles(bbsId, topSize, callback){ 1137 var url = '/web/bbs/'+bbsId+'/list.json'; 1138 1139 var pageIndex = 1; 1140 var formData = {pageIndex : pageIndex, pageUnit : topSize}; 1141 1142 Tranport.transaction(url, "POST", "", JSON.stringify(formData), function(errorCode, req, res){ 1143 if(errorCode != "-999"){ 1144 callback(errorCode, req, res); 1145 } 1146 1147 }); 1148} 1149 1150/** 1151 * ëª©ë¡ ë°ì´í° ì¡°í 1152 * @param pageNo 1153 * @returns 1154 */ 1155function gfn_list_articles(pageIndex){ 1156 1157 var $form = $('#frm'); 1158 var bbsId = $form.find('input[name="bbsId"]').val(); 1159 var url = '/web/bbs/'+bbsId+'/list.json'; 1160 1161 var formData; 1162 var html = ''; 1163 1164 if(!pageIndex) { 1165 pageIndex = $form.find('input[name=pageIndex]').val(); 1166 if(pageIndex == "") {pageIndex = "1"} 1167 } 1168 $form.find('input[name=pageIndex]').val(pageIndex); 1169 formData = $form.serializeObject(); 1170 1171 Tranport.transaction(url, "POST", "", JSON.stringify(formData), function(errorCode, req, res){ 1172 if(errorCode != "-999"){ 1173 fn_list_articles_ui(errorCode, req, res); 1174 } 1175 1176 1177 }); 1178} 1179 1180/** 1181 * ìì¸ íì´ì§ ì´ë 1182 * @param bbsId 1183 * @param nttId 1184 * @returns 1185 */ 1186function gfn_move_view_page(nttId) { 1187 1188 var $form = $('form[name="frm"]'); 1189 $form.find('input[name=nttId]').val(nttId); 1190 $form.find('input[name=bbsFlag]').val("View"); 1191 $form.attr("method", "get"); 1192 1193 $form.submit(); 1194 1195} 1196 1197/** 1198 * ìì¸ íì´ì§ ì´ë 1199 * @param bbsId 1200 * @param nttId 1201 * @returns 1202 */ 1203function gfn_move_view_page2(nttId) { 1204 1205 var $form = $('form[name="frmMove"]'); 1206 $form.find('input[name=nttId]').val(nttId); 1207 $form.find('input[name=bbsFlag]').val("View"); 1208 $form.attr("method", "get"); 1209 1210 $form.submit(); 1211 1212} 1213 1214 1215/** 1216 * ìì¸ ë°ì´í° ì¡°í 1217 * @returns 1218 */ 1219function gfn_view_article() { 1220 1221 var $form = $('#frm'); 1222 var bbsId = $form.find('input[name=bbsId]').val(); 1223 var url = '/web/bbs/'+bbsId+'/view.json'; 1224 1225 1226 var formData = $form.serializeObject(); 1227 1228 console.log(formData); 1229 1230 Tranport.transaction(url, "POST", "", JSON.stringify(formData), function(errorCode, req, res){ 1231 if(errorCode != "-999"){ 1232 1233 if(errorCode == "408"){ 1234 alert("í´ë¹ê¸ì ë¹ê³µê° ê¸ì ëë¤."); 1235 history.back(); 1236 } 1237 1238 fn_view_article_ui(errorCode, req, res); 1239 } 1240 }); 1241} 1242 1243 1244/** 1245 * ì°ê¸° íì´ì§ ì´ë 1246 * @param bbsId 1247 * @param nttId 1248 * @returns 1249 */ 1250function gfn_move_write_page() { 1251 1252 var $form = $('form[name="contsfrm"]'); 1253 $form.find('input[name=bbsFlag]').val("Write"); 1254 $form.attr("method", "get"); 1255 1256 $form.submit(); 1257 1258} 1259 1260/** 1261 * ì°ê¸° íì´ì§ ì´ë 1262 * @param bbsId 1263 * @param nttId 1264 * @returns 1265 */ 1266function gfn_move_edit_page() { 1267 1268 var $form = $('form[name="contsfrm"]'); 1269 $form.find('input[name=bbsFlag]').val("Edit"); 1270 $form.attr("method", "get"); 1271 1272 $form.submit(); 1273 1274} 1275 1276 1277function shareFacebook(url){ 1278 var href = 'http://www.facebook.com/sharer.php?t=' + encodeURIComponent(document.title) + '&u=' + encodeURIComponent(url); 1279 var a = window.open(href, 'Facebook', 'width=600, height=320'); 1280 if (a) { 1281 a.focus(); 1282 } 1283} 1284 1285function shareTwitter(url){ 1286 var href = 'http://twitter.com/share?text=' + encodeURIComponent(document.title) + ' ' + encodeURIComponent(url); 1287 var a = window.open(href, 'twitter', 'width=466, height=356'); 1288 if (a) { 1289 a.focus(); 1290 } 1291} 1292 1293function gfn_SnsShare(snsType){ 1294 var url = location.href; 1295 console.log(url); 1296 1297 if(snsType == "facebook"){ 1298 shareFacebook(url); 1299 }else if(snsType == "twitter"){ 1300 shareTwitter(url); 1301 }else{ 1302 alert(snsType + "ì ëí SNSì íì´ ììµëë¤."); 1303 } 1304} 1305 1306 1307function gfn_print(){ 1308 var className = $(".content_area ").attr("class"); 1309 var html = ""; 1310 html +='<html><head>'; 1311 html +='<link rel="stylesheet" type="text/css" href="/resources/www/css/slick.css" />'; 1312 html +='<link rel="stylesheet" type="text/css" href="/resources/www/css/common.css" />'; 1313 html +='<link rel="stylesheet" type="text/css" href="/resources/www/css/eng.css" />'; 1314 html +='<link rel="stylesheet" type="text/css" href="/resources/www/css/style.css" />'; 1315 html +='</head>'; 1316 html +='<body>'; 1317 html +='<div id="bodyPrint" class="'+className+'">'; 1318 html += $(".content_area ").html(); 1319 html +='</div>'; 1320 html +='</body>'; 1321 html +='</html>'; 1322 1323 1324 var printPage = window.open("", "printPage"); 1325 self.focus(); 1326 1327 1328 printPage.document.open(); 1329 printPage.document.write(html); 1330 1331 printPage.document.close(); 1332 var is_chrome = Boolean(window.chrome); 1333 1334 if (is_chrome) { 1335 printPage.onload = function () { 1336 setTimeout(function () { 1337 printPage.print(); 1338 printPage.close(); 1339 }, 200); 1340 }; 1341 } 1342 else { 1343 printPage.print(); 1344 printPage.close(); 1345 } 1346} 1347 1348function gfnMaskPhoneNum(number){
1349 1350 var regNotNum = /[^0-9]/g; 1351 var padding = 0; 1352 var tel = ""; 1353 1354 // return blank 1355 if( number == "" || number == null ) return ""; 1356 1357 // delete not number 1358 number = number.replace(regNotNum,''); 1359 1360 // ìì¸ ì§ìë²í¸(02)ê° ë¤ì´ê°ë ê²½ì° -1ë§í¼ ìì¹ ì¡°ì 1361 if(number.startsWith('02')) { 1362 padding = -1; 1363 } 1364 1365 // 문ìì´ì ì르ë 기ì¤ìì ìì¸ì ê°ì ëºì¤(-)íë¤. 1366 // ê°ì´ 1ì¼ê²½ì° -1ì´ ë ê²ì´ê³ , ê°ì´ 0ì¼ê²½ì° ë³íê° ìë¤. 1367 if(number.length < (4 + padding)) { 1368 return number; 1369 } else if(number.length < (7 + padding)) { 1370 tel += number.substr(0, (3 + padding)); 1371 tel += "-"; 1372 tel += number.substr(3 + padding); 1373 } else if(number.length < (11 + padding)) { 1374 tel += number.substr(0, (3 + padding)); 1375 tel += "-"; 1376 tel += number.substr((3 + padding), 3); 1377 tel += "-"; 1378 tel += number.substr(6 + padding); 1379 } else { 1380 tel += number.substr(0, (3 + padding)); 1381 tel += "-"; 1382 tel += number.substr((3 + padding), 4); 1383 tel += "-"; 1384 tel += number.substr(7 + padding); 1385 } 1386 1387 return tel; 1388} 1389 1390 1391 1392function gfnCutByteLength (s, len, cutString) { 1393 1394 if (s == null || s.length == 0) { 1395 return 0; 1396 } 1397 if(!cutString){ 1398 cutString = ""; 1399 } 1400 var size = 0; 1401 var sLength = s.length; 1402 var rIndex = s.length; 1403 1404 for ( var i = 0; i < s.length; i++) { 1405 size += gfnCharByteSize(s.charAt(i)); 1406 if( size == len ) { 1407 rIndex = i + 1; 1408 break; 1409 } else if( size > len ) { 1410 rIndex = i; 1411 break; 1412 } 1413 } 1414 if(sLength <= len){ 1415 cutString = ""; 1416 } 1417 return s.substring(0, rIndex) + cutString; 1418 1419} 1420 1421 1422function gfnCharByteSize(ch) { 1423 1424 if (ch == null || ch.length == 0) { 1425 return 0; 1426 } 1427 1428 var charCode = ch.charCodeAt(0); 1429 1430 if (charCode <= 0x00007F) { 1431 return 1; 1432 } else if (charCode <= 0x0007FF) { 1433 return 2; 1434 } else if (charCode <= 0x00FFFF) { 1435 return 3; 1436 } else { 1437 return 4; 1438 } 1439} 1440 1441 1442$.validator.setDefaults({ 1443 onkeyup: false, 1444 onclick: false, 1445 onfocusout: false, 1446 showErrors: function(errorMap,errorList){ 1447 if(this.numberOfInvalids()){ // ìë¬ê° ìì¼ë©´ 1448 alert(errorList[0].message); // ê²½ê³ ì°½ì¼ë¡ ëì 1449 } 1450 } 1451}); 1452 1453 1454 1455 1456$.validator.addMethod( "loginIdCreat", function( value, element ) { 1457 return this.optional( element ) || /^[a-z\d]{4,12}$/i.test( value ); 1458}, "" ); 1459 1460$.validator.addMethod( "passwordCreat", function( value, element ) { 1461 return this.optional( element ) || (value.match(/[a-zA-Z]/g) && value.match(/[0-9]/g) && value.match(/[-_=+\|()*&^%$#@!~`?></;,.:]/g)); 1462}, "" ); 1463 1464$.validator.addMethod( "passwordSameWord", function( value, element ) { 1465 var ret = true; 1466 var ch = ''; 1467 var cnt = 0; 1468 1469 for(var i=0; i < value.length ; i++){ 1470 if(ch == value.charAt(i)){ 1471 cnt++; 1472 if(cnt > 3){ 1473 ret = false; 1474 break; 1475 } 1476 } else { 1477 ch = value.charAt(i); 1478 cnt = 1; 1479 } 1480 } 1481 1482 return this.optional( element ) || ret; 1483}, "" );
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.