1window.addNative = true; 2 3/* Arrayì indexOfê° ì ìëì§ ììì ë. */ 4//if ( ! Array.prototype.indexOf ) { 5// Array.prototype.indexOf = function(obj, fromIndex) { 6// if (fromIndex == null) { 7// fromIndex = 0; 8// } 9// else if (fromIndex < 0) { 10// fromIndex = Math.max(0, this.length + fromIndex); 11// } 12// 13// for (var i = fromIndex, j = this.length; i < j; i++) { 14// if (this[i] === obj) 15// return i; 16// } 17// 18// return -1; 19// }; 20//} 21 22 23//if ( ! Array.prototype.merge ) { 24 /** 25 * 주ì´ì§ ë°°ì´ì 구ë³ì를 ë£ì´ íëì 문ìì´ë¡ ë§ë ë¤. 26 * 27 * @param array í©ì¹ ê°ì ê°ì§ê³ ìë ë°°ì´. 28 * @param delim 구ë³ì 29 * @param exceptEmpty ë¹ê°(undefined, null, '') ì ì¸ ì¬ë¶. 30 */ 31// Array.prototype.merge = function(delim, exceptEmpty) { 32// if ( ! exceptEmpty ) return this.join(delim); 33// 34// var arr = []; 35// for (var i = 0; i < this.length; i++) { 36// if ( this[i] == undefined 37// || this[i] == null 38// || this[i] == '' ) continue; 39// 40// arr.push(this[i]); 41// } 42// 43// return arr.join(delim); 44// }; 45//} 46 47 48 49/* Arrayì prevOf ê° ì ìëì§ ììì ë. */ 50/** 51 * 주ì´ì§ í목ì ì´ì í목ì ëë ¤ì¤ë¤. 52 * 주ì´ì§ í목ì ì°¾ì ì ìê±°ë ì´ì íëª©ì´ ìì¼ë©´ nullì ëë ¤ ì¤ë¤. 53 */ 54//if ( ! Array.prototype.prevOf ) { 55// Array.prototype.prevOf = function(obj, fromIndex) { 56// var index = this.indexOf(obj, fromIndex) - 1; 57// 58// return index < 0 ? null : this[index]; 59// }; 60//} 61 62/** 63 * 주ì´ì§ í목ì ë¤ì í목ì ëë ¤ì¤ë¤. 64 * 주ì´ì§ í목ì ì°¾ì ì ìê±°ë ë¤ì íëª©ì´ ìì¼ë©´ nullì ëë ¤ ì¤ë¤. 65 */ 66//if ( ! Array.prototype.nextOf ) { 67// Array.prototype.nextOf = function(obj, fromIndex) { 68// var index = this.indexOf(obj, fromIndex) + 1; 69// 70// return index < 0 || this.length <= index ? null : this[index]; 71// }; 72//} 73 74 75 76/** 77 * Stringì trim í¨ìê° ìì¼ë©´ ì¶ê°. 78 */ 79if ( ! String.prototype.trim ) { 80 String.prototype.trim = function() { 81 if ( ! String._trimRegExp ) { 82 String._trimRegExp = /(^\s+)|(\s+$)/gi; 83 } 84 85 return this.replace(String._trimRegExp, ""); 86 }; 87} 88 89/** 90 * Stringì startsWith í¨ìê° ìì¼ë©´ ì¶ê°. 91 */ 92if ( ! String.prototype.startsWith ) { 93 String.prototype.startsWith = function(searchString, position){ 94 position = position || 0; 95 96 return this.substr(position, searchString.length) === searchString; 97 }; 98} 99 100/** 101 * Stringì startsWith í¨ìê° ìì¼ë©´ ì¶ê°. 102 */ 103if ( ! String.prototype.endsWith ) { 104 String.prototype.endsWith = function(searchString, position) { 105 var subjectString = this.toString(); 106 if (typeof position !== 'number' || ! isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { 107 108 position = subjectString.length; 109 } 110 111 position -= searchString.length; 112 var lastIndex = subjectString.lastIndexOf(searchString, position); 113 114 return lastIndex !== -1 && lastIndex === position; 115 }; 116} 117 118/** 119 * Stringì padLeft ë©ìë ì¶ê°. 120 */ 121if ( ! String.prototype.padLeft ) { 122 String.prototype.lpad = String.prototype.padLeft = function(width, ch) { 123 width = Math.max(0, width); 124 ch = ch == undefined || ch == null ? ' ' : ch; 125 126 var str = this; 127 var count = width - this.length; 128 for (var i = 0; i < count; i++) { 129 str = ch + str; 130 } 131 132 return str; 133 }; 134} 135 136/** 137 * Stringì padRight ë©ìë ì¶ê°. 138 */ 139if ( ! String.prototype.padRight ) { 140 String.prototype.rpad = String.prototype.padRight = function(width, ch) { 141 width = Math.max(0, width); 142 ch = ch == undefined || ch == null ? ' ' : ch; 143 144 var str = this; 145 var count = width - this.length; 146 for (var i = 0; i < count; i++) { 147 str += ch; 148 } 149 150 return str; 151 }; 152} 153 154 155if ( ! String.prototype.hashCode ) { 156 String.prototype.hashCode = function() { 157 for (var r = 0, i = 0; i < this.length; i++) { 158 r = ( r << 5 ) - r + this.charCodeAt(i), r &= r; 159 } 160 161 return r 162 }; 163} 164 165 166if ( window.jQuery && jQuery.tmpl) { 167 if ( ! String.render ) { 168 /** 169 * í í릿ì ì´ì©í ë ëë¬. 170 * jquery.tmpl íë¬ê·¸ì¸ì ìì¡´íë¤. 171 * 172 * @param data íì¬ ë ëë§ ì¤ì¸ ì´ì ë°ì´í°. 173 * @param tmpl í í릿 문ìì´. 174 * @param tmplName í í릿 ìºì¬ ëª ì¹. 175 */ 176 String.render = function(data, tmpl, tmplName) { 177 if ( tmpl == undefined || tmpl === null ) return tmpl; 178 179 if ( typeof(tmpl) !== 'string' ) tmpl = tmpl.toString(); 180 181 if ( ! tmplName ) tmplName = 'tmpl-' + tmpl.hashCode(); 182 183 184 /* ë±ë¡ëì§ ìì Templateì´ë©´ ë±ë¡íë¤. */ 185 if (tmplName && ! $.template[tmplName] ) { 186 $.template(tmplName, tmpl); 187 } 188 189 var tmplFunc = $.template(tmplName); 190 191 return tmplFunc($, { data: data }).join(''); 192 }; 193 } 194} 195 196 197if ( ! String.prototype.render ) { 198 /** 199 * í í릿ì ì´ì©í ë ëë¬. 200 * jquery.tmpl íë¬ê·¸ì¸ì ìì¡´íë¤. 201 * 202 * @param data íì¬ ë ëë§ ì¤ì¸ ì´ì ë°ì´í°. 203 * @param tmpl í í릿 문ìì´. 204 * @param tmplName í í릿 ìºì¬ ëª ì¹. 205 */ 206 String.prototype.render = function(data, tmplName) { 207 return String.render(data, this.toString(), tmplName); 208 }; 209} 210 211 212/** 213 * Numberì padLeft ë©ìë ì¶ê°. 214 */ 215if ( ! Number.prototype.padLeft ) { 216 Number.prototype.lpad = Number.prototype.padLeft = function(width, ch) { 217 return this.toString().padLeft(width, ch); 218 }; 219} 220 221 222/** 223 * Numberì padRight ë©ìë ì¶ê°. 224 */ 225if ( ! Number.prototype.padRight ) { 226 Number.prototype.rpad = Number.prototype.padRight = function(width, ch) { 227 return this.toString().padRight(width, ch); 228 }; 229} 230 231/** 232 * Numberì format ë©ìë ì¶ê°. 233 */ 234if ( ! Number.prototype.format ) { 235 Number.FORMAT_REGEXP = /(^[+-]?\d+)(\d{3})/; 236 237 Number.prototype.format = function() { 238 if ( this == 0 ) return 0; 239 240 var reg = Number.FORMAT_REGEXP; 241 var noStr = (this + ''); 242 243 while (reg.test(noStr)) { 244 noStr = noStr.replace(reg, '$1' + ',' + '$2'); 245 } 246 247 return noStr; 248 }; 249} 250 251 252if ( ! Date.prototype.format ) { 253 Date.FORMAT_SHORT = 'yyyy-MM-dd'; 254 Date.FORMAT_MID = 'yyyy-MM-dd'; 255 Date.FORMAT_LONG = 'yyyy-MM-dd'; 256 Date.FORMAT_FULL = 'yyyy-MM-dd'; 257 258 Date.prototype.format = function(format) { 259 if ( ! this.valueOf()) return ''; 260 261 format = format || Date.FORMAT_SHORT; 262 263 264 var weekName = ['ì¼ìì¼', 'ììì¼', 'íìì¼', 'ììì¼', '목ìì¼', 'ê¸ìì¼', 'í ìì¼']; 265 var d = this; 266 267 return format.replace(/(yyyy|yy|MM|M|dd|d|E|HH|H|hh|h|mm|m|ss|s|a\/p)/g, function($1) { 268 var val = $1; 269 switch ($1) { 270 case 'yyyy': val = d.getFullYear(); break; 271 case 'yy' : val = (d.getFullYear() % 1000).padLeft(2, '0'); break; 272 case 'MM' : val = (d.getMonth() + 1).padLeft(2, '0'); break; 273 case 'M' : val = d.getMonth() + 1; break; 274 case 'dd' : val = d.getDate().padLeft(2, '0'); break; 275 case 'd' : val = d.getDate(); break; 276 case 'E' : val = weekName[d.getDay()]; break; 277 case 'HH' : val = d.getHours().padLeft(2, '0'); break; 278 case 'H' : val = d.getHours(); break;
279 case 'hh' : val = ((h = d.getHours() % 12) ? h : 12).padLeft(2, '0'); break; 280 case 'h' : val = ((h = d.getHours() % 12) ? h : 12); break; 281 case 'mm' : val = d.getMinutes().padLeft(2, '0'); break; 282 case 'm' : val = d.getMinutes(); break; 283 case 'ss' : val = d.getSeconds().padLeft(2, '0'); break; 284 case 's' : val = d.getSeconds(); break; 285 case 'a/p' : val = d.getHours() < 12 ? 'ì¤ì ' : 'ì¤í'; break; 286 default: 287 } 288 289 return val; 290 }); 291 }; 292 293 /** 294 * 주ì´ì§ Date ê°ì²´ë¥¼ 주ì´ì§ ííë¡ í¬ë§¤í íì¬ ëë ¤ ì¤ë¤. 295 * date íë¼ë¯¸í° ê°ì´ ìì¼ë©´ ë¹ ë¬¸ìì´ì ëë ¤ì£¼ê³ , 296 * ê°ì´ ìëë° Date ê°ì²´ê° ìë ëë ê·¸ëë¡ ëë ¤ ì¤ë¤. 297 */ 298 Date.format = function(date, format) { 299 if ( date == null ) return ''; 300 301 return date.getFullYear ? date.format(format) : (date || ''); 302 }; 303} 304 305if ( ! Date.addYear ) { 306 /** 307 * 주ì´ì§ Date ê°ì²´ì 주ì´ì§ ì°ì ë§í¼ ëí ìë¡ì´ Date ê°ì²´ë¥¼ ëë ¤ ì¤ë¤. 308 */ 309 Date.addYear = function(date, number) { 310 return new Date((date.getFullYear() + number), date.getMonth(), date.getDate()); 311 }; 312} 313 314if ( ! Date.addMonth ) { 315 /** 316 * 주ì´ì§ Date ê°ì²´ì 주ì´ì§ ê°ì ì ë§í¼ ëí ìë¡ì´ Date ê°ì²´ë¥¼ ëë ¤ ì¤ë¤. 317 */ 318 Date.addMonth = function(date, number) { 319 return new Date(date.getFullYear(), (date.getMonth() + number), date.getDate()); 320 }; 321} 322 323if ( ! Date.addDate) { 324 /** 325 * 주ì´ì§ Date ê°ì²´ì 주ì´ì§ ì¼ì ë§í¼ ëí ìë¡ì´ Date ê°ì²´ë¥¼ ëë ¤ ì¤ë¤. 326 */ 327 Date.addDate = function(date, number) { 328 return new Date(date.getFullYear(), date.getMonth(), (date.getDate()+number)); 329 }; 330} 331 332 333if ( ! Date.prototype.addMonth ) { 334 /** 335 * Date ê°ì²´ì 주ì´ì§ ê°ìì ë§í¼ ëíë¤. 336 */ 337 Date.prototype.addMonth = function(number) { 338 this.setFullYear(this.getFullYear(), this.getMonth() + number); 339 340 return this; 341 }; 342} 343 344(function() { 345 var reOnlyNo1 = /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/; 346 var reOnlyNo2 = /^(\d{4})(\d{2})(\d{2})$/; 347 var reISO = /^((\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}(?:\.\d*)))(?:Z|(\+|-)([\d|:]*))?$/; 348 349 if ( ! Date.converts ) { 350 /** 351 * ì ë ¥ë°ì ë ì§ì ë³´ 문ìì´ì Date ê°ì²´ë¡ ë³ííì¬ ëë ¤ ì¤ë¤. 352 * ë§ì¼ 문ìì´ì´ ìëê±°ë, íìì´ ë§ì§ ìì¼ë©´ ê°ì ê·¸ëë¡ ëë ¤ ì¤ë¤. 353 */ 354 Date.converts = function(value) { 355 if ( ! value || typeof value !== 'string' ) return value; 356 357 var date = null; 358 var a = null; 359 360 if ( reISO.test(value) ) { 361 a = reISO.exec(value); 362 if (a) { 363 date = new Date(a[1]); 364 } 365 } 366 else if ( reOnlyNo1.test(value) ) { 367 a = reOnlyNo1.exec(value); 368 if (a) { 369 date = new Date(a[1], a[2] - 1, a[3], a[4], a[5], a[6]); 370 } 371 } 372 else if ( reOnlyNo2.test(value) ) { 373 a = reOnlyNo2.exec(value); 374 if (a) { 375 date = new Date(a[1], a[2] - 1, a[3]); 376 } 377 } 378 379 return date; 380 }; 381 } 382})(); 383 384if ( ! Date.isDate ) { 385 /** 386 * 주ì´ì§ ê°ì´ Date ê°ì²´ì¸ì§ ì¬ë¶ë¥¼ ëë ¤ ì¤ë¤. 387 */ 388 Date.isDate = function(value) { 389 if ( ! value ) return false; 390 391 return ! ! value.getFullYear; 392 }; 393} 394 395 396if ( ! Date.prototype.compareTo ) { 397 Date.UNIT_YEAR = 0; 398 Date.UNIT_MONTH = 1; 399 Date.UNIT_DATE = 2; 400 Date.UNIT_HOUR = 3; 401 Date.UNIT_MINUTE = 4; 402 Date.UNIT_SECOND = 5; 403 Date.UNIT_MILISECOND = 6; 404 405 Date.COMP_METHOD_ARR = [ 406 'getFullYear' , 407 'getMonth' , 408 'getDate' , 409 'getHours' , 410 'getMinutes' , 411 'getSeconds' , 412 'getMilliseconds' 413 ]; 414 415 /** 416 * 주ì´ì§ Date ê°ì²´ì ë¹êµíì¬ ìì ì´ ì´ë¥´ë©´ 1ì, ê°ì¼ë©´ 0ì, ë리면 -1ì 417 * ëë ¤ ì¤ë¤. ë¨ íë¼ë¯¸í°ì ë°ë¼ ì°, ì, ì¼, ì, ë¶, ì´ê¹ì§ ë¹êµíë¤. 418 * 419 * @param compared ë¹êµ ëìì´ ë Date ê°ì²´. 420 * @param unit ë¹êµí ìµì ë¨ì. ìì¼ë©´ ë°ë¦¬ì´ê¹ì§ ë¹êµíë¤. 421 */ 422 Date.prototype.compareTo = function(compared, unit) { 423 if ( ! compared || ! compared['getFullYear'] ) {
424 throw 'ë¹êµí íë¼ë¯¸í°ì ê°ì¼ë¡ Date ê°ì²´ê° ìë ê°ì´ ëì´ììµëë¤.'; 425 } 426 427 if ( ! unit || unit < 0 || unit > 6 ) unit = Date.COMP_MILISECOND; 428 429 430 for (var i = 0; i < Date.COMP_METHOD_ARR.length; i++) { 431 var method = Date.COMP_METHOD_ARR[i]; 432 433 // ê°ì§ ìì ë íë¨. 434 if ( compared[method]() - this[method]() != 0 ) { 435 return compared[method]() - this[method]() > 0 ? 1 : -1; 436 } 437 438 // ê°ìë° íì¬ ë¨ìê¹ì§ ë¹êµë¼ë©´ 0 439 if ( i == unit ) return 0; 440 } 441 442 // ì¬ê¸°ê¹ì§ ìì¼ë©´ ê°ì ê° 443 return 0; 444 }; 445} 446 447if ( ! Date.prototype.same ) { 448 /** 449 * ì´ Date ê°ì²´ê° 주ì´ì§ Date ê°ì²´ì 주ì´ì§ ë¨ìê¹ì§ ê°ì´ 450 * ê°ìì§ ì¬ë¶ë¥¼ ëë ¤ ì¤ë¤. 451 */ 452 Date.prototype.same = function(compared, unit) { 453 return this.compareTo(compared, unit) == 0; 454 }; 455} 456 457if ( ! Date.prototype.before ) { 458 /** 459 * 주ì´ì§ ë¨ìê¹ì§ ë¹êµíì ë, ì´ Date ê°ì²´ê° 주ì´ì§ Date ê°ì²´ì 460 * ì´ì ì¸ì§ ì¬ë¶ë¥¼ ëë ¤ ì¤ë¤. 461 */ 462 Date.prototype.before = function(compared, unit) { 463 return this.compareTo(compared, unit) > 0;
464 } 465} 466 467if ( ! Date.prototype.beforeOrSame ) { 468 /** 469 * 주ì´ì§ ë¨ìê¹ì§ ë¹êµíì ë, ì´ Date ê°ì²´ê° 주ì´ì§ Date ê°ì²´ì 470 * ì´ì ì´ê±°ë ê°ìì§ ì¬ë¶ë¥¼ ëë ¤ ì¤ë¤. 471 */ 472 Date.prototype.beforeOrSame = function(compared, unit) { 473 return this.before(compared, unit) || this.same(compared, unit); 474 } 475} 476 477if ( ! Date.prototype.after ) { 478 /** 479 * 주ì´ì§ ë¨ìê¹ì§ ë¹êµíì ë, ì´ Date ê°ì²´ê° 주ì´ì§ Date ê°ì²´ì 480 * ì´íì¸ì§ ì¬ë¶ë¥¼ ëë ¤ ì¤ë¤. 481 */ 482 Date.prototype.after = function(compared, unit) { 483 return this.compareTo(compared, unit) < 0; 484 } 485} 486 487if ( ! Date.prototype.sameOrAfter ) { 488 /** 489 * 주ì´ì§ ë¨ìê¹ì§ ë¹êµíì ë, ì´ Date ê°ì²´ê° 주ì´ì§ Date ê°ì²´ì 490 * ê°ê±°ë ì´íì¸ì§ ì¬ë¶ë¥¼ ëë ¤ ì¤ë¤. 491 */ 492 Date.prototype.sameOrAfter = function(compared, unit) { 493 return this.same(compared, unit) || this.after(compared, unit); 494 } 495} 496 497 498if ( ! Date.prototype.formatDiff ) { 499 Date.MS_PER_SECOND = 1000; 500 Date.MS_PER_MINUTE = 1000 * 60; 501 Date.MS_PER_HOUR = 1000 * 60 * 60; 502 Date.MS_PER_DAY = 1000 * 60 * 60 * 24; 503 504 /** 505 * ì기ì 주ì´ì§ Date ê°ì²´ ì¬ì´ì ìê°ì°¨ë¥¼ '?ì¼ ?ìê° ?ë¶ ?ì´ ?ms' ííì 506 * 문ìì´ë¡ ëë ¤ ì¤ë¤. 507 * 508 * @param date ìê°ì°¨ë¥¼ 구í ëì Date ê°ì²´. ìì¼ë©´ íì¬ ìê°ì ë´ì Dateê°ì²´ê° ì¬ì©ëë¤. 509 * @param unitCh ì´ë ì ëê¹ì§ 구í ê²ì¸ê° ê°(ëì문ì 구ë³). 510 * ë°ë¦¬ì´('ms'), ì´('s'), ë¶('m'), ìê°('h'), ì¼('d'). ìê±°ë 기í ê°ì´ë©´ ì´('s')ê¹ì§ íí. 511 * @returns ìê°ì°¨ë¥¼ íííë 문ìì´. 512 */ 513 Date.prototype.formatDiff = function(date, unitCh) { 514 if ( typeof(date) === 'string' ) { 515 unitCh = date; 516 date = new Date(); 517 } 518 519 date = date || new Date(); 520 unitCh = unitCh || 's'; 521 522 var unit = 2; 523 var suffix = 'ì´'; 524 525 switch (unitCh) { 526 case 'd' : unit = 1; suffix = 'ì¼'; break; 527 case 'h' : unit = 2; suffix = 'ìê°'; break; 528 case 'm' : unit = 3; suffix = 'ë¶'; break; 529 case 's' : unit = 4; suffix = 'ì´'; break; 530 case 'ms' : unit = 5; suffix = 'ë°ë¦¬ì´'; break; 531 } 532 533 var intervalMs = Math.abs(this.getTime() - date.getTime()); 534 535 var texts = []; 536 537 if ( unit >= 1 && intervalMs / Date.MS_PER_DAY >= 1) { 538 texts.push(Math.round(intervalMs / Date.MS_PER_DAY) + 'ì¼'); 539 intervalMs = intervalMs % Date.MS_PER_DAY; 540 } 541 542 if ( unit >= 2 && (intervalMs / Date.MS_PER_HOUR >= 1 || texts.length > 0) ) { 543 texts.push(Math.round(intervalMs / Date.MS_PER_HOUR) + 'ìê°'); 544 intervalMs = intervalMs % Date.MS_PER_HOUR; 545 } 546 547 if ( unit >= 3 && (intervalMs / Date.MS_PER_MINUTE >= 1 || texts.length > 0) ) { 548 texts.push(Math.round(intervalMs / Date.MS_PER_MINUTE) + 'ë¶'); 549 intervalMs = intervalMs % Date.MS_PER_MINUTE; 550 } 551 552 if ( unit >= 4 && (intervalMs / Date.MS_PER_SECOND >= 1 || texts.length > 0) ) { 553 texts.push(Math.round(intervalMs / Date.MS_PER_SECOND) + 'ì´'); 554 intervalMs = intervalMs % Date.MS_PER_SECOND; 555 } 556 557 if ( unit >= 5 && ( intervalMs >= 1 || texts.length > 0) ) { 558 texts.push(intervalMs + 'ë°ë¦¬ì´'); 559 } 560 561 /* ì무ê²ë ìë¤ë©´. */ 562 if ( texts.length == 0 ) { 563 texts.push(0 + suffix); 564 } 565 566 567 return texts.join(' '); 568 } 569} 570 571 572(function() { 573 /** 574 * JSON ê° ì¤ ì¼ì(ìê°) íìì 문ìì´(yyyy-MM-ddTHH:mm:ss.Z)ì 575 * Date ê°ì²´ë¡ ì¹ííë ì²ë¦¬ë¥¼ í기 ìí´ ì JSON Parser를 Hooking íë¤. 576 */ 577 if ( ! window.JSON || ! window.JSON.parse ) return; 578 579 var reISO = /^((\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)))(?:Z|(\+|-)([\d|:]*))?$/; 580 var reMsAjax = /^\/Date\((d|-|.*)\)[\/|\\]$/; 581 582 var _origParse = window.JSON.parse; 583 584 window.JSON.parse = function(text) { 585 return _origParse(text, function(key, value) { 586 var a; 587 588 if (typeof value === 'string' 589 && value.length > 0 590 && (reISO.test(value) || reMsAjax.test(value)) ) { 591 var a = reISO.exec(value); 592 if (a) { 593 var date = new Date(a[1]); 594 595 date.setMinutes(date.getMinutes() - date.getTimezoneOffset()); 596 597 return date; 598 } 599 600 a = reMsAjax.exec(value); 601 if (a) { 602 var b = a[1].split(/[-+,.]/); 603 return new Date(b[0] ? +b[0] : 0 - +b[1]); 604 } 605 606 } 607 608 return value; 609 }); 610 }; 611})(); 612 613 614/** 615 * TextArea ì ë ¥í¼ì íì¬ ì»¤ì ìì¹ì ì½ì í기 í¨ì ì¶ê°. 616 */ 617if ( window.HTMLTextAreaElement != undefined && ! HTMLTextAreaElement.prototype.insertAtCaret ) { 618 HTMLTextAreaElement.prototype.insertAtCaret = function(value) { 619 if ( document.selection ) { 620 //IE support 621 this.focus(); 622 sel = document.selection.createRange(); 623 sel.text = value; 624 } 625 else if ( this.selectionStart || this.selectionStart == 0 ) { 626 // Chrome, Firefox, Netscape support 627 HTMLTextAreaElement.prototype.insertAtCaret = function(value) { 628 var startPos = this.selectionStart; 629 var endPos = this.selectionEnd; 630 631 this.value = this.value.substring(0, startPos) 632 + value 633 + this.value.substring(endPos); 634 }; 635 } 636 else { 637 this.value += value; 638 } 639 }; 640} 641 642 643if ( ! window.gui ) { 644 window.gui = {}; 645 646 /** 647 * ìëì°ë¥¼ 주ì´ì§ ì¢íì ëì´ë¤. ìì¹ê° 주ì´ì§ì§ ìì¼ë©´ 648 * ìëì°ê° íë©´ ê°ì´ë° ì¤ëë¡ ëì´ë¤. 649 * 650 * @param name ì°½ ì´ë¦. 651 * @param url ì°½ì ì¬ì©í 주ì. 652 * @param width ì°½ ëë¹. "full" íë©´ ê½ ì°¬ ëë¹. 653 * @param height ì°½ ëì´. "full" íë©´ ê½ ì°¬ ëì´. ê°ì´ ìì¼ë©´ width ê°ê³¼ ëì¼. 654 * @param option 기í Option 문ìì´. window.open ë©ìëì option ê°ì¼ë¡ ì¬ì©ëë¤. 655 * @param topPx ì°½ì ìë¨ì 기ì¤ì¼ë¡ í ìì¹. 656 * @param leftPx ì°½ì íë©´ ì¼ìª½ë©´ì 기ì¤ì¼ë¡ í ìì¹. 657 */ 658 window.gui.openWindow = function(name, url, width, height, option, topPx, leftPx) { 659 if ( ! height ) height = width; 660
661 if ( width == 'full' ) width = screen.availWidth; 662 if ( height == 'full' ) height = screen.availHeight; 663 664 width = Math.min(width , screen.availWidth ); 665 height = Math.min(height, screen.availHeight); 666 667 /* ì°½ì´ íë©´ ê°ì´ë° ìì¹íëë¡ í기 ìí´ left ìì¹ ê° ê³ì°. */ 668 if ( ! leftPx ) leftPx = ( screen.availWidth - width ) / 2; 669 670 /* ì°½ì´ íë©´ ê°ì´ë°ìì ì½ê°(?) ìì ìì¹íëë¡ í기 ìí´ top ìì¹ ê° ê³ì°. */ 671 if ( ! topPx ) { 672 topPx = ( screen.availHeight - height ) / 2; 673 topPx -= screen.availHeight * 0.02; 674 } 675 676 677 option = "width=" + width 678 + ",height=" + height 679 + ",top=" + topPx 680 + ",left=" + leftPx 681 + (option == undefined || option.length == 0 ? "" : "," + option); 682 683 name = name.replace(/-/g, '_'); 684 685 var win = window.open(url, name, option); 686 687 if ( win ) win.focus(); 688 689 return win; 690 } 691 692 693 /** 694 * ëí ì°½ì ëì´ë¤. 695 */ 696 window.gui.openDialog = function(name, url, width, height, option) { 697 if ( ! option ) option = ""; 698 699 option = (option.indexOf('alwaysRaised') > -1 ? '' : "alwaysRaised=yes") 700 + (option.indexOf('dependent') > -1 ? '' : ",dependent=yes") 701 + (option.indexOf('menubar') > -1 ? '' : ",menubar=no") 702 + (option.indexOf('location') > -1 ? '' : ",location=no") 703 + (option.indexOf('satatus') > -1 ? '' : ",satatus=no") 704 + (option.indexOf('toolbar') > -1 ? '' : ",toolbar=no") 705 + (option.indexOf('scrollbars') > -1 ? '' : ",scrollbars=yes") 706 + (option.indexOf('resizable') > -1 ? '' : ",resizable=no") 707 + "," + option; 708 709 return window.gui.openWindow(name, url, width, height, option); 710 } 711} 712 713(function($) { 714 $.fn.selectText = function() { 715 var doc = document; 716 var element = this[0]; 717 718 if (doc.body.createTextRange) { 719 var range = document.body.createTextRange(); 720 range.moveToElementText(element); 721 range.select(); 722 } else if (window.getSelection) { 723 var selection = window.getSelection(); 724 var range = document.createRange(); 725 range.selectNodeContents(element); 726 selection.removeAllRanges(); 727 selection.addRange(range); 728 } 729 }; 730})(jQuery); 731 732function copyToClipboard(element, message) { 733 var tempInput = document.createElement('input'); 734 var body = document.body; 735 736 body.appendChild(tempInput); 737 738 if ( element && element.appendChild ) { 739 tempInput.value = element.innerText; 740 } 741 else { 742 tempInput.value = element; 743 } 744 745 tempInput.select(); 746 747 document.execCommand("copy"); 748 749 body.removeChild(tempInput); 750 751 if ( message ) { 752 alert(message); 753 } 754}
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.