1/****************/ 2/* API FUNCTION */ 3/****************/ 4 5/* 6(function(){ 7 var name = g_csrf_token; // document.querySelector('meta[name="csrf-name"]').content; 8 var hash = g_csrf_hash; //document.querySelector('meta[name="csrf-hash"]').content; 9 10 $.ajaxSetup({ 11 beforeSend: function(xhr, settings){ 12 if ((settings.type||'').toUpperCase() === 'POST') { 13 if (typeof settings.data === 'string') { 14 settings.data += (settings.data ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(hash); 15 } else if (settings.data instanceof FormData) { 16 settings.data.append(name, hash); 17 } else { 18 settings.data = Object.assign(settings.data||{}, { [name]: hash }); 19 } 20 } 21 } 22 }); 23})(); 24*/ 25 26 // ë©í ì½ê¸°/ì°ê¸° 27 function getMetaName(){ return document.querySelector('meta[name="csrf-token-name"]')?.content || ''; } 28 function getMetaToken(){ return document.querySelector('meta[name="csrf-token"]')?.content || ''; } 29 function setMeta(name, value){ 30 var m1 = document.querySelector('meta[name="csrf-token-name"]'); 31 var m2 = document.querySelector('meta[name="csrf-token"]'); 32 if (!m1) { m1 = document.createElement('meta'); m1.setAttribute('name','csrf-token-name'); document.head.appendChild(m1); } 33 if (!m2) { m2 = document.createElement('meta'); m2.setAttribute('name','csrf-token'); document.head.appendChild(m2); } 34 m1.content = name; m2.content = value; 35 } 36 37function refreshCsrfSync(){ 38 var ok = false; 39 $.ajax({ 40 url: '/csrf/token', 41 type: 'GET', 42 dataType: 'json', 43 async: false, // â ë기ì 44 cache: false, 45 data: {_: Date.now()}, 46 success: function(res){ 47 if (res && res.token_name && res.token_value) { 48 setMeta(res.token_name, res.token_value); 49 50 g_csrf_token = res.token_name; 51 g_csrf_hash = res.token_value; 52 53 _lastRefreshedAt = Date.now(); 54 ok = true; 55 } 56 } 57 }); 58 return ok; 59} 60 61 62 63 64function donus_api_json(sub_url, param, callbackFunc, processing, async) { 65 if (async == null) async = true; 66 67 if (sub_url == "") { 68 console.log("[DONUS API] API ê²½ë¡ ëë½"); 69 return; 70 } 71 try { 72 param[g_csrf_token] = g_csrf_hash; 73 74 $.ajax({
75 type: "POST", 76 url: sub_url, 77 contentType: "application/x-www-form-urlencoded; charset=utf-8", 78 data: param, 79 processData: true, 80 dataType: "json", 81 async: async, 82 beforeSend: start_progressing(processing), 83 success: function (data) { 84 if (typeof callbackFunc === "function") { 85 callbackFunc(data); 86 } 87 return; 88 }, 89 complete: function () { 90 end_progressing(processing); 91 g_processing = false; 92 }, 93 error: function (xhr, status, error) { 94 if (processing) donuspay.endprocessing(); 95 alert( 96 "Status : " + 97 status + 98 "\nError : " + 99 error + 100 "\n\nì¤ë¥ê° ê³ìëë©´ ê´ë¦¬ììê² ë¬¸ì ë°ëëë¤." 101 ); 102 }, 103 }); 104 } catch (e) { 105 console.log(e.stack); 106 end_progressing(); 107 donuspay.endprocessing(); 108 return; 109 } 110} 111 112 113 114// Main Api Function 115// ì¸ì ë§ë£/미ë¡ê·¸ì¸ ê³µíµ ì²ë¦¬ â ìë´ í ë¡ê·¸ì¸ íì´ì§(ììì¹ ë³µê· referurl í¬í¨)ë¡ ì´ë 116function goLoginRequired() { 117 alert("ì¸ì ì´ ë§ë£ëììµëë¤. ë¤ì ë¡ê·¸ì¸í´ 주ì¸ì."); 118 window.location.href = "/login?referurl=" + encodeURIComponent(window.location.pathname + window.location.search); 119} 120 121function donus_api(sub_url, param, callbackFunc, processing, async) { 122 if (async == null) async = true; 123 var retried = false; 124 125 if (sub_url == "") { 126 console.log("[DONUS API] API ê²½ë¡ ëë½"); 127 return; 128 } 129 try { 130 131 param[g_csrf_token] = g_csrf_hash; 132 133 $.ajax({
134 type: "POST", 135 url: sub_url, 136 contentType: "application/x-www-form-urlencoded; charset=utf-8", 137 data: param, 138 processData: true, 139 dataType: "xml", 140 async: async, 141 beforeSend: start_progressing(processing), 142 success: function (data) { 143 donus_api_callback(data, callbackFunc); 144 return; 145 }, 146 complete: function () { 147 end_progressing(processing); 148 g_processing = false; 149 }, 150 error: function (xhr, status, error) { 151 152 // 403ì´ë©´ ë기 ê°±ì â ì í í°ì¼ë¡ 1í ì¬ìë 153 if (xhr && xhr.status === 403 && !retried && typeof refreshCsrfSync === 'function') { 154 retried = true; 155 if (refreshCsrfSync()) { 156 157 // ì¬ìë 158 param[g_csrf_token] = g_csrf_hash; 159 $.ajax({ 160 type: "POST", 161 url: sub_url, 162 contentType: "application/x-www-form-urlencoded; charset=utf-8", 163 data: param, 164 processData: true, 165 dataType: "xml", 166 async: async, 167 beforeSend: start_progressing(processing), 168 success: function (data) { 169 donus_api_callback(data, callbackFunc); 170 return; 171 }, 172 complete: function () { 173 end_progressing(processing); 174 g_processing = false; 175 }, 176 error: function (xhr, status, error) { 177 if (processing) donuspay.endprocessing(); 178 if (xhr && xhr.status === 403) { goLoginRequired(); return; } 179 alert( 180 "Status : " + 181 status + 182 "\nError : " + 183 error + 184 "\n\nì¤ë¥ê° ê³ìëë©´ ê´ë¦¬ììê² ë¬¸ì ë°ëëë¤." 185 ); 186 }, 187 }); 188 189 190 } else { 191 if (processing) donuspay.endprocessing(); 192 goLoginRequired(); 193 return; 194 } 195 } else { 196 if (processing) donuspay.endprocessing(); 197 alert( 198 "Status : " + 199 status + 200 "\nError : " + 201 error + 202 "\n\nì¤ë¥ê° ê³ìëë©´ ê´ë¦¬ììê² ë¬¸ì ë°ëëë¤." 203 ); 204 } 205 206 }, 207 }); 208 209 } catch (e) { 210 console.log(e.stack); 211 end_progressing(); 212 donuspay.endprocessing(); 213 return; 214 } 215} 216 217 218function donus_api_callback(returnData, callbackFunc) { 219 var result = true; 220 var reason = ""; 221 222 //console.log('donus_api_callback', returnData); 223 if (returnData == null) { 224 console.log("[DONUS API] 리í´ê° ìì\nìë² ë¦¬í´ë¶ íì¸ì"); 225 return; 226 } else { 227 // console.log('returnData', returnData); 228 if (returnData.documentElement.getAttribute("RESULT") == "0") { 229 // console.log('return location 1 ', returnData.documentElement.getAttribute("RESULT")); 230 result = false; 231 reason = returnData.documentElement.getAttribute("REASON"); 232 } else { 233 result = true; 234 // 1. set variables 235 var totalcount = ""; 236 var returnVal, xml; 237 238 // 2. Xml 239 xml = returnData; 240 241 // 3. TotalCount 242 try { 243 totalcount = xml.documentElement.getAttribute("TOTALCOUNT"); 244 } catch (e1) { 245 totalcount = ""; 246 } 247 248 try { 249 console.log('xml.documentElement', xml.documentElement); 250 returnVal = xml_elem_build_structure(xml.documentElement); 251 console.log('returnVal', returnVal); 252 } catch (e2) { 253 console.log("[DONUS API] Xml Parsing Error"); 254 return; 255 } 256 } 257 258 donuspay[callbackFunc](result, reason, totalcount, returnVal); 259 } 260 261 return; 262} 263 264///////////////////// Other Functions ////////////////////////// 265 266function start_progressing(run) { 267 var isios = 268 !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); 269 270 if (run) { 271 if ($("#page_loader").length == 0) $(".progress_bg").fadeIn(); 272 else if (!isios) $("#page_loader").removeClass("hide"); 273 else $("#page_loader_transparent").removeClass("hide"); 274 } 275 return; 276} 277 278function end_progressing(run) { 279 var isios = 280 !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); 281 282 if (run) { 283 if ($("#page_loader").length == 0) $(".progress_bg").fadeOut(); 284 else if (!isios) $("#page_loader").addClass("hide"); 285 else $("#page_loader_transparent").addClass("hide"); 286 } 287 return; 288} 289 290$(document).ready(function () { 291 var div = $( 292 "<div class='progress_bg' style='position:fixed;top:0;left:0;width:100%;height:100%;background:#fff;-khtml-opacity:.70;-ms-filter:\"alpha(opacity=70)\";-moz-opacity:.70;filter:alpha(opacity=70);opacity:.70;z-index:1001;text-align:center;display:none;'><div style='height:45%;'></div><img src='/static/images/api/loading_1.webp' style='position:relative;display:block;width:120px;height:100px;margin:auto;vertical-align:middle;z-index:999;'/></div>" 293 ); 294 295 $("body").append(div); 296}); 297 298// Email Validation Check 299function validateEmail(email) { 300 var re = 301 /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 302 303 var korean = /[ê°-í£]+/; 304 305 if (korean.test(email)) return false; 306 307 return re.test(email); 308} 309 310// Name Byte Limit 311function is_overbyte_length(input, byte) { 312 var newtitle = ""; 313 var len = 0; 314 315 for (var i = 0; i < input.length; i++) { 316 var chr = input.substr(i, 1); 317 318 if (chr.charCodeAt(0) > 128) len = len + 2; 319 else len = len + 1; 320 } 321 322 if (len > byte) return true; 323 else return false; 324} 325 326/* Overriding getElementsByClassName */ 327var getElementsByClassName = function (className, tag, elm) { 328 if (document.getElementsByClassName) { 329 getElementsByClassName = function (className, tag, elm) { 330 elm = elm || document; 331 var elements = elm.getElementsByClassName(className), 332 nodeName = tag ? new RegExp("\\b" + tag + "\\b", "i") : null, 333 returnElements = [], 334 current; 335 for (var i = 0, il = elements.length; i < il; i += 1) { 336 current = elements[i]; 337 if (!nodeName || nodeName.test(current.nodeName)) { 338 returnElements.push(current); 339 } 340 } 341 return returnElements; 342 }; 343 } else if (document.evaluate) { 344 getElementsByClassName = function (className, tag, elm) { 345 tag = tag || "*"; 346 elm = elm || document; 347 var classes = className.split(" "), 348 classesToCheck = "", 349 xhtmlNamespace = "http://www.w3.org/1999/xhtml", 350 namespaceResolver = 351 document.documentElement.namespaceURI === xhtmlNamespace 352 ? xhtmlNamespace 353 : null, 354 returnElements = [], 355 elements, 356 node; 357 for (var j = 0, jl = classes.length; j < jl; j += 1) { 358 classesToCheck += 359 "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]"; 360 }
361 try { 362 elements = document.evaluate( 363 ".//" + tag + classesToCheck, 364 elm, 365 namespaceResolver, 366 0, 367 null 368 ); 369 } catch (e) { 370 elements = document.evaluate( 371 ".//" + tag + classesToCheck, 372 elm, 373 null, 374 0, 375 null 376 ); 377 } 378 while ((node = elements.iterateNext())) { 379 returnElements.push(node); 380 } 381 return returnElements; 382 }; 383 } else { 384 getElementsByClassName = function (className, tag, elm) { 385 tag = tag || "*"; 386 elm = elm || document; 387 var classes = className.split(" "), 388 classesToCheck = [], 389 elements = 390 tag === "*" && elm.all ? elm.all : elm.getElementsByTagName(tag), 391 current, 392 returnElements = [], 393 match; 394 for (var k = 0, kl = classes.length; k < kl; k += 1) { 395 classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)")); 396 } 397 for (var l = 0, ll = elements.length; l < ll; l += 1) { 398 current = elements[l]; 399 match = false; 400 for (var m = 0, ml = classesToCheck.length; m < ml; m += 1) { 401 match = classesToCheck[m].test(current.className); 402 if (!match) { 403 break; 404 } 405 } 406 if (match) { 407 returnElements.push(current); 408 } 409 } 410 return returnElements; 411 }; 412 } 413 return getElementsByClassName(className, tag, elm); 414}; 415 416function xml_elem_build_structure(element) { 417 if (element.getAttribute("TYPE") == "LIST") { 418 var list = new Array(); 419 var elems = element.childNodes; 420 421 for (var i = 0; i < elems.length; i++) { 422 list.push(xml_elem_build_structure(elems[i])); 423 } 424 425 return list; 426 } else if (element.getAttribute("TYPE") == "MAP") { 427 var map = new HashMap(); 428 var elems = element.childNodes; 429 430 for (var i = 0; i < elems.length; i++) { 431 map.put(elems[i].tagName, xml_elem_build_structure(elems[i])); 432 } 433 434 return map; 435 } else return xml_elem_value(element); 436} 437 438function xml_elem_value(element) { 439 if (element.firstChild == null) return ""; 440 else return element.firstChild.nodeValue; 441} 442 443var HashMap = function () { 444 var mapVal = {}; 445 var pos = new Array(); 446 447 this.get = function (key) { 448 return mapVal[key]; 449 }; 450 451 this.getPos = function (n) { 452 return mapVal[pos[n]]; 453 }; 454 455 this.getKey = function (n) { 456 return pos[n]; 457 }; 458 459 this.remove = function (n) { 460 var ary = new Array(); 461 462 for (var i = 0; i < map.size(); i++) { 463 if (i != n) { 464 ary.push(pos[i]); 465 } 466 } 467 468 pos = ary; 469 }; 470 471 this.put = function (key, val) { 472 mapVal[key] = val; 473 474 var flg = true; 475 476 for (var i = 0; i < pos.length; i++) { 477 if (key == pos[i]) flg = false; 478 } 479 480 if (flg) pos.push(key); 481 }; 482 483 this.size = function () { 484 return pos.length; 485 }; 486 487 this.length = function () { 488 return pos.length; 489 }; 490}; 491 492// common_util.js íì¼ìì ê°ì ¸ì´ 493 494// ê¸ì¡ ííì ì«ìë¡ ë³í 495function strip_price_format(price) { 496 return ReplaceText(price, ",", ""); 497} 498 499// ì«ì 문ìì´ì #,### íìì¼ë¡ ë³í 500function make_price_format(price) { 501 price = price + ""; 502 503 var newprice = ""; 504 var isminus = false; 505 506 var checklist = "0123456789-"; 507 508 for (var i = 0; i < price.length; i++) { 509 if (checklist.indexOf(price.substr(i, 1)) != -1) 510 newprice += price.substr(i, 1); 511 } 512 513 price = newprice; 514 newprice = ""; 515 516 if (price.substr(0, 1) == "-") { 517 isminus = true; 518 price = price.substr(1); 519 } 520 521 while (price != "") { 522 if (price.length > 3) { 523 newprice = "," + price.substr(price.length - 3) + newprice; 524 price = price.substr(0, price.length - 3); 525 } else { 526 newprice = price + newprice; 527 price = ""; 528 } 529 } 530 531 if (isminus) return "-" + newprice; 532 else return newprice; 533} 534 535// ì§§ì date 문ìì´(yyyy.mm.dd)ë¡ ë¬¸ìì´ ë³í 536function short_date_format(date) { 537 return ReplaceText(date.substr(0, 10), "-", "."); 538} 539 540function manual_date_focus(elem) { 541 elem.setAttribute("old_date", elem.value); 542} 543 544function manual_date_blur(elem) { 545 var date = ReplaceText(elem.value, "-", ""); 546 date = ReplaceText(date, " ", ""); 547 548 date = date.substr(0, 4) + "-" + date.substr(4, 2) + "-" + date.substr(6, 2); 549 550 if (convert_date_str(convert_date(date)) == date) elem.value = date; 551 else { 552 if (elem.value != "") { 553 alert("ì¬ë°ë¥´ì§ ìì ë ì§ í¬ë§·ì ëë¤."); 554 555 if ( 556 elem.getAttribute("old_date") != "" && 557 (elem.getAttribute("old_date") == null || 558 convert_date_str(convert_date(elem.getAttribute("old_date"))) != 559 elem.getAttribute("old_date")) 560 ) 561 return; 562 else elem.value = elem.getAttribute("old_date"); 563 } 564 } 565} 566 567// 문ìì´ ì¹í 568function ReplaceText(orgStr, findStr, replaceStr) { 569 var re = new RegExp(findStr, "gi"); 570 571 return orgStr.replace(re, replaceStr); 572} 573 574// 문ìì´ì 길ì´ì ë°ë¼ ì르기 575function get_left_title(title, length) { 576 var newtitle = ""; 577 var len = 0; 578 579 for (var i = 0; i < title.length; i++) { 580 var chr = title.substr(i, 1); 581 582 if (chr.charCodeAt(0) > 128) len = len + 1; 583 else len = len + 0.7; 584 585 if (len > length) break; 586 587 newtitle += chr; 588 } 589 590 if (newtitle != title) newtitle += ".."; 591 592 return newtitle; 593} 594 595function fromChatCodeExt(code_point) { 596 if (code_point < 0x10000) { 597 return String.fromCharCode(code_point); 598 } 599
600 code_point -= 0x10000; 601 return String.fromCharCode( 602 0xd800 + (code_point >> 10), 603 0xdc00 + (code_point & 0x3ff) 604 ); 605} 606 607function mb_strwidth(str) { 608 var i = 0; 609 var str_width = 0; 610 var next_char_code = 0; 611 var char_code = 0; 612 613 while (!Number.isNaN((char_code = str.charCodeAt(i++)))) { 614 if (0xd800 <= char_code && char_code <= 0xdbff) { 615 next_char_code = str.charCodeAt(i); 616 char_code = 617 (char_code - 0xd800) * 0x400 + (next_char_code - 0xdc00) + 0x10000; 618 i++; 619 } 620 621 if (0x0 <= char_code && char_code <= 0x10ff) { 622 str_width += 1; 623 } else if (0x1100 <= char_code && char_code <= 0x115f) { 624 str_width += 2; 625 } else if (0x1160 <= char_code && char_code <= 0x11a2) { 626 str_width += 1; 627 } else if (0x11a3 <= char_code && char_code <= 0x11a7) { 628 str_width += 2; 629 } else if (0x11a8 <= char_code && char_code <= 0x11f9) { 630 str_width += 1; 631 } else if (0x11fa <= char_code && char_code <= 0x11ff) { 632 str_width += 2; 633 } else if (0x1200 <= char_code && char_code <= 0x2328) { 634 str_width += 1; 635 } else if (0x2329 <= char_code && char_code <= 0x232a) { 636 str_width += 2; 637 } else if (0x232b <= char_code && char_code <= 0x2e7f) { 638 str_width += 1; 639 } else if (0x2e80 <= char_code && char_code <= 0x2e99) { 640 str_width += 2; 641 } else if (0x2e9a <= char_code && char_code <= 0x2e9a) { 642 str_width += 1; 643 } else if (0x2e9b <= char_code && char_code <= 0x2ef3) { 644 str_width += 2; 645 } else if (0x2ef4 <= char_code && char_code <= 0x2eff) { 646 str_width += 1; 647 } else if (0x2f00 <= char_code && char_code <= 0x2fd5) { 648 str_width += 2; 649 } else if (0x2fd6 <= char_code && char_code <= 0x2fef) { 650 str_width += 1; 651 } else if (0x2ff0 <= char_code && char_code <= 0x2ffb) { 652 str_width += 2; 653 } else if (0x2ffc <= char_code && char_code <= 0x2fff) { 654 str_width += 1; 655 } else if (0x3000 <= char_code && char_code <= 0x303e) { 656 str_width += 2; 657 } else if (0x303f <= char_code && char_code <= 0x3040) { 658 str_width += 1; 659 } else if (0x3041 <= char_code && char_code <= 0x3096) { 660 str_width += 2; 661 } else if (0x3097 <= char_code && char_code <= 0x3098) { 662 str_width += 1; 663 } else if (0x3099 <= char_code && char_code <= 0x30ff) { 664 str_width += 2; 665 } else if (0x3100 <= char_code && char_code <= 0x3104) { 666 str_width += 1; 667 } else if (0x3105 <= char_code && char_code <= 0x312d) { 668 str_width += 2; 669 } else if (0x312e <= char_code && char_code <= 0x3130) { 670 str_width += 1; 671 } else if (0x3131 <= char_code && char_code <= 0x318e) { 672 str_width += 2; 673 } else if (0x318f <= char_code && char_code <= 0x318f) { 674 str_width += 1; 675 } else if (0x3190 <= char_code && char_code <= 0x31ba) { 676 str_width += 2; 677 } else if (0x31bb <= char_code && char_code <= 0x31bf) { 678 str_width += 1; 679 } else if (0x31c0 <= char_code && char_code <= 0x31e3) { 680 str_width += 2; 681 } else if (0x31e4 <= char_code && char_code <= 0x31ef) { 682 str_width += 1; 683 } else if (0x31f0 <= char_code && char_code <= 0x321e) { 684 str_width += 2; 685 } else if (0x321f <= char_code && char_code <= 0x321f) { 686 str_width += 1; 687 } else if (0x3220 <= char_code && char_code <= 0x3247) { 688 str_width += 2; 689 } else if (0x3248 <= char_code && char_code <= 0x324f) { 690 str_width += 1; 691 } else if (0x3250 <= char_code && char_code <= 0x32fe) { 692 str_width += 2; 693 } else if (0x32ff <= char_code && char_code <= 0x32ff) { 694 str_width += 1; 695 } else if (0x3300 <= char_code && char_code <= 0x4dbf) { 696 str_width += 2; 697 } else if (0x4dc0 <= char_code && char_code <= 0x4dff) { 698 str_width += 1; 699 } else if (0x4e00 <= char_code && char_code <= 0xa48c) { 700 str_width += 2; 701 } else if (0xa48d <= char_code && char_code <= 0xa48f) { 702 str_width += 1; 703 } else if (0xa490 <= char_code && char_code <= 0xa4c6) { 704 str_width += 2; 705 } else if (0xa4c7 <= char_code && char_code <= 0xa95f) { 706 str_width += 1;
707 } else if (0xa960 <= char_code && char_code <= 0xa97c) { 708 str_width += 2; 709 } else if (0xa97d <= char_code && char_code <= 0xabff) { 710 str_width += 1; 711 } else if (0xac00 <= char_code && char_code <= 0xd7a3) { 712 str_width += 2; 713 } else if (0xd7a4 <= char_code && char_code <= 0xd7af) { 714 str_width += 1; 715 } else if (0xd7b0 <= char_code && char_code <= 0xd7c6) { 716 str_width += 2; 717 } else if (0xd7c7 <= char_code && char_code <= 0xd7ca) { 718 str_width += 1; 719 } else if (0xd7cb <= char_code && char_code <= 0xd7fb) { 720 str_width += 2; 721 } else if (0xd7fc <= char_code && char_code <= 0xf8ff) { 722 str_width += 1; 723 } else if (0xf900 <= char_code && char_code <= 0xfaff) { 724 str_width += 2; 725 } else if (0xfb00 <= char_code && char_code <= 0xfe0f) { 726 str_width += 1; 727 } else if (0xfe10 <= char_code && char_code <= 0xfe19) { 728 str_width += 2; 729 } else if (0xfe1a <= char_code && char_code <= 0xfe2f) { 730 str_width += 1; 731 } else if (0xfe30 <= char_code && char_code <= 0xfe52) { 732 str_width += 2; 733 } else if (0xfe53 <= char_code && char_code <= 0xfe53) { 734 str_width += 1; 735 } else if (0xfe54 <= char_code && char_code <= 0xfe66) { 736 str_width += 2; 737 } else if (0xfe67 <= char_code && char_code <= 0xfe67) { 738 str_width += 1; 739 } else if (0xfe68 <= char_code && char_code <= 0xfe6b) { 740 str_width += 2; 741 } else if (0xfe6c <= char_code && char_code <= 0xff00) { 742 str_width += 1; 743 } else if (0xff01 <= char_code && char_code <= 0xff60) { 744 str_width += 2; 745 } else if (0xff61 <= char_code && char_code <= 0xffdf) { 746 str_width += 1; 747 } else if (0xffe0 <= char_code && char_code <= 0xffe6) { 748 str_width += 2; 749 } else if (0xffe7 <= char_code && char_code <= 0x1afff) { 750 str_width += 1; 751 } else if (0x1b000 <= char_code && char_code <= 0x1b001) { 752 str_width += 2; 753 } else if (0x1b002 <= char_code && char_code <= 0x1f1ff) { 754 str_width += 1; 755 } else if (0x1f200 <= char_code && char_code <= 0x1f202) { 756 str_width += 2; 757 } else if (0x1f203 <= char_code && char_code <= 0x1f20f) { 758 str_width += 1; 759 } else if (0x1f210 <= char_code && char_code <= 0x1f23a) { 760 str_width += 2; 761 } else if (0x1f23b <= char_code && char_code <= 0x1f23f) { 762 str_width += 1; 763 } else if (0x1f240 <= char_code && char_code <= 0x1f248) { 764 str_width += 2; 765 } else if (0x1f249 <= char_code && char_code <= 0x1f24f) { 766 str_width += 1; 767 } else if (0x1f250 <= char_code && char_code <= 0x1f251) { 768 str_width += 2; 769 } else if (0x1f252 <= char_code && char_code <= 0x1ffff) { 770 str_width += 1; 771 } else if (0x20000 <= char_code && char_code <= 0x2fffd) { 772 str_width += 2; 773 } else if (0x2fffe <= char_code && char_code <= 0x2ffff) { 774 str_width += 1; 775 } else if (0x30000 <= char_code && char_code <= 0x3fffd) { 776 str_width += 2; 777 } else if (0x3fffe <= char_code && char_code <= 0x10ffff) { 778 str_width += 1; 779 } 780 } 781 782 return str_width; 783} 784 785// 문ìì´ì ëì´ì ë°ë¼ ì르기 (ì문ë문ì/íê¸/ì¹´íì¹´ëíë¼ê°ë/íì - 2(byte), 공백/ì«ì/ì문ì문ì - 1(byte)) 786/************************************************************************************************* 787 * str : 문ìì´, start : ìì 문ìì´, width : ìë¥´ê³ ì íë ëë¹, trimmarker : ì른 ë¤ íìí 문ìì´ 788 * PHPì mb_strimwidthì ëì¼í¨ 789 *************************************************************************************************/ 790function mb_strimwidth(str, start, width, trimmarker) { 791 if (trimmarker == null) { 792 trimmarker = ""; 793 } 794 795 var trimmarker_width = mb_strwidth(trimmarker); 796 797 var stacker = []; 798 var total_width = 0; 799 800 var current_char = ""; 801 var current_char_code = 0; 802 var current_width = 0; 803 804 var next_char = ""; 805 var next_char_code = 0; 806 var next_width = 0; 807 808 var irregular_caution = 809 (str.charCodeAt(0) < 0x21 || 0x7e < str.charCodeAt(0)) && 810 trimmarker == "" && 811 width == 1; 812 813 var illegal_range_list = [ 814 [0x1100, 0x115f], 815 [0x11a3, 0x11a7], 816 [0x11fa, 0x11ff], 817 [0x2329, 0x2329],
818 [0x232a, 0x232a], 819 [0x2e80, 0x2e99], 820 [0x2e9b, 0x2ef3], 821 [0x2f00, 0x2fd5], 822 [0x2ff0, 0x2ffb], 823 [0x3000, 0x303e], 824 [0x3041, 0x3096], 825 [0x3099, 0x30ff], 826 [0x3105, 0x312d], 827 [0x3131, 0x318e], 828 [0x3190, 0x31ba], 829 [0x31c0, 0x31e3], 830 [0x31f0, 0x321e], 831 [0x3220, 0x3247], 832 [0x3250, 0x32fe], 833 [0x3300, 0x4dbf], 834 [0x4e00, 0xa48c], 835 [0xa490, 0xa4c6], 836 [0xa960, 0xa97c], 837 [0xac00, 0xd7a3], 838 [0xd7b0, 0xd7c6], 839 [0xd7cb, 0xd7fb], 840 [0xf900, 0xfaff], 841 [0xfe10, 0xfe19], 842 [0xfe30, 0xfe52], 843 [0xfe54, 0xfe66], 844 [0xfe68, 0xfe6b], 845 [0xff01, 0xff60], 846 [0xffe0, 0xffe6], 847 [0x1b000, 0x1b001], 848 [0x1f200, 0x1f202], 849 [0x1f210, 0x1f23a], 850 [0x1f240, 0x1f248], 851 [0x1f250, 0x1f251], 852 [0x20000, 0x2fffd], 853 [0x30000, 0x3fffd], 854 ]; 855 var illegal_range_length = illegal_range_list.length; 856 857 var irregular_pattern = function (char_code) { 858 for (var i = 0; i < illegal_range_length; i++) { 859 if ( 860 illegal_range_list[i][0] <= char_code && 861 char_code <= illegal_range_list[i][1] 862 ) { 863 return true; 864 } 865 } 866 return false; 867 }; 868 869 for (var i = start, length = start + width; i < length; i++) { 870 current_char_code = str.charCodeAt(i); 871 next_char_code = str.charCodeAt(1 + i); 872 873 if (0xd800 <= current_char_code && current_char_code <= 0xdbff) { 874 current_char_code = 875 (current_char_code - 0xd800) * 0x400 + 876 (next_char_code - 0xdc00) + 877 0x10000; 878 i++; 879 next_char_code = str.charCodeAt(i + 1); 880 } 881 882 if (0xd800 <= next_char_code && next_char_code <= 0xdbff) { 883 i++; 884 next_char_code = 885 (next_char_code - 0xd800) * 0x400 + 886 (str.charCodeAt(i + 1) - 0xdc00) + 887 0x10000; 888 } 889 890 if (irregular_caution) { 891 if (irregular_pattern(current_char_code)) { 892 return ""; 893 } 894 if (irregular_pattern(next_char_code)) { 895 return ""; 896 } 897 } 898 899 if (Number.isNaN(current_char_code)) { 900 break; 901 } 902 903 current_char = fromChatCodeExt(current_char_code); 904 next_char = Number.isNaN(next_char_code) 905 ? "" 906 : fromChatCodeExt(next_char_code); 907 908 current_width = mb_strwidth(current_char); 909 next_width = mb_strwidth(next_char); 910 911 if (width < total_width + next_width + trimmarker_width) { 912 stacker.push(trimmarker); 913 break; 914 } 915 916 total_width += current_width; 917 stacker.push(current_char); 918 919 if (width <= total_width) { 920 break; 921 } 922 } 923 924 return stacker.join(""); 925} 926 927function IsNumber(str) { 928 var Number = "1234567890"; 929 var kiki = Number; 930 var i; 931 for (i = 0; i < str.length; i++) { 932 if (kiki.indexOf(str.substring(i, i + 1)) < 0) { 933 return false; 934 } 935 } //for 936 return true; 937} 938 939function IsFloat(str) { 940 var Number = "1234567890."; 941 var kiki = Number; 942 var i; 943 for (i = 0; i < str.length; i++) { 944 if (kiki.indexOf(str.substring(i, i + 1)) < 0) { 945 return false; 946 } 947 } //for 948 return true; 949} 950 951// 주민ë²í¸ ê²ì¦ 952function checkCitizenNumber(szCitizenBasic, szCitizenDetail) { 953 if (!IsNumber(szCitizenBasic)) return false; 954 955 if (!IsNumber(szCitizenBasic)) return false; 956 957 if (szCitizenBasic.length != 6) { 958 return false; 959 } else if (szCitizenDetail.length != 7) { 960 return false; 961 } else { 962 var str_serial1 = szCitizenBasic; 963 var str_serial2 = szCitizenDetail; 964 var digit = 0; 965 for (var i = 0; i < str_serial1.length; i++) { 966 var str_dig = str_serial1.substring(i, i + 1); 967 if (str_dig < "0" || str_dig > "9") { 968 digit = digit + 1; 969 } 970 } 971 if (str_serial1 == "" || digit != 0) { 972 return false; 973 } 974 975 var digit1 = 0; 976 for (var i = 0; i < str_serial2.length; i++) { 977 var str_dig1 = str_serial2.substring(i, i + 1); 978 if (str_dig1 < "0" || str_dig1 > "9") { 979 digit1 = digit1 + 1; 980 } 981 } 982 983 if (str_serial2 == "" || digit1 != 0) { 984 return false; 985 }
986 if (str_serial1.substring(2, 3) > 1) { 987 return false; 988 } 989 if (str_serial1.substring(4, 5) > 3) { 990 return false; 991 } 992 if (str_serial2.substring(0, 1) > 8 || str_serial2.substring(0, 1) == 0) { 993 return false; 994 } 995 996 // 2020-10ì 주민ë±ë¡ë²í¸ ì²´ê³ ê°í¸ 997 if (str_serial2.substring(0, 1) >= 5) { 998 return check_fgnno(szCitizenBasic, szCitizenDetail); 999 } 1000 1001 // 2020-10ì 주민ë±ë¡ë²í¸ ì²´ê³ ê°í¸ 1002 var a1 = str_serial1.substring(0, 1); 1003 var a2 = str_serial1.substring(1, 2); 1004 var a3 = str_serial1.substring(2, 3); 1005 var a4 = str_serial1.substring(3, 4); 1006 var a5 = str_serial1.substring(4, 5); 1007 var a6 = str_serial1.substring(5, 6); 1008 var check_digit = a1 * 2 + a2 * 3 + a3 * 4 + a4 * 5 + a5 * 6 + a6 * 7; 1009 var b1 = str_serial2.substring(0, 1); 1010 var b2 = str_serial2.substring(1, 2); 1011 var b3 = str_serial2.substring(2, 3); 1012 var b4 = str_serial2.substring(3, 4); 1013 var b5 = str_serial2.substring(4, 5); 1014 var b6 = str_serial2.substring(5, 6); 1015 var b7 = str_serial2.substring(6, 7); 1016 var check_digit = 1017 check_digit + b1 * 8 + b2 * 9 + b3 * 2 + b4 * 3 + b5 * 4 + b6 * 5; 1018 1019 check_digit = check_digit % 11; 1020 check_digit = 11 - check_digit; 1021 check_digit = check_digit % 10; 1022 1023 if (check_digit != b7) { 1024 return checkCitizenNumber202010(a1, a2, a3, a4, b1, false); 1025 } else { 1026 return checkCitizenNumber202010(a1, a2, a3, a4, b1, true); 1027 } 1028 } 1029} 1030 1031function checkCitizenNumber202010(d1, d2, d3, d4, d7, oldcheckpath) { 1032 var re; 1033 if ("3478".indexOf(d7) < 0) { 1034 re = checkCitizenNumberConfirm(false, oldcheckpath); 1035 } else { 1036 var y = 0; 1037 var m = 0; 1038 y = parseInt(d1) * 10 + parseInt(d2); 1039 m = parseInt(d3) * 10 + parseInt(d4); 1040 1041 if (y > 20 || (y === 20 && m >= 10)) 1042 re = checkCitizenNumberConfirm(true, oldcheckpath); 1043 else re = checkCitizenNumberConfirm(false, oldcheckpath); 1044 } 1045 return re; 1046} 1047 1048function checkCitizenNumberConfirm(newissuedate, oldcheckpath) { 1049 var re; 1050 if (!newissuedate) { 1051 if (!oldcheckpath) 1052 re = confirm( 1053 '2020ë 10ì ì´í ì¬ë°ê¸ë 주민ë²í¸ê° ìëê²½ì° \n주민ë²í¸ê° ì못 기ì¥ëììµëë¤. \n\n- ë²í¸ê° ë§ì¼ë©´ "íì¸" ë²í¼ì\n- í리면 "ì·¨ì" ë²í¼ì í´ë¦í´ì£¼ì¸ì.' 1054 ); 1055 else re = true; 1056 } else { 1057 re = confirm( 1058 '2020ë 10ì ì´í ì¶ììì 주민ë²í¸ ì ëë¤.\n주민ë²í¸ ì ë ¥ì ë¤ìíë² íì¸í´ 주ì¸ì. \n\n- ë²í¸ê° ë§ì¼ë©´ "íì¸" ë²í¼ì\n- í리면 "ì·¨ì" ë²í¼ì í´ë¦í´ì£¼ì¸ì.' 1059 ); 1060 } 1061 return re; 1062} 1063 1064function check_fgnno(szCitizenBasic, szCitizenDetail) { 1065 return confirm( 1066 'ì¸êµì¸ 주민ë²í¸ ì ëë¤.\n주민ë²í¸ ì ë ¥ì ë¤ìíë² íì¸í´ 주ì¸ì. \n\n- ë²í¸ê° ë§ì¼ë©´ "íì¸" ë²í¼ì\n- í리면 "ì·¨ì" ë²í¼ì í´ë¦í´ì£¼ì¸ì.' 1067 ); 1068 /* 1069 var fgnno = szCitizenBasic + szCitizenDetail; 1070 var sum = 0; 1071 var odd = 0; 1072 buf = new Array(13); 1073 for (i = 0; i < 13; i++) { buf[i] = parseInt(fgnno.charAt(i)); } 1074 odd = buf[7] * 10 + buf[8]; 1075 if (odd % 2 != 0) { return false; } 1076 if ((buf[11] != 6) && (buf[11] != 7) && (buf[11] != 8) && (buf[11] != 9)) { 1077 return false; 1078 } 1079 multipliers = [2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5]; 1080 for (i = 0, sum = 0; i < 12; i++) { sum += (buf[i] *= multipliers[i]); } 1081 sum = 11 - (sum % 11); 1082 if (sum >= 10) { sum -= 10; } 1083 sum += 2; 1084 if (sum >= 10) { sum -= 10; } 1085 if (sum != buf[12]) { return false } 1086 return true; 1087 */ 1088}
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.