1/* jshint -W100 */ 2if (!window.INVEN || typeof window.INVEN !== 'object') { 3 window.INVEN = {}; 4} 5if (!INVEN.hasOwnProperty('customAction') || typeof INVEN.customAction !== 'function' || typeof INVEN.customAction.constructor !== 'function') { 6 delete INVEN.customAction; 7 INVEN.customAction = null; 8} 9 10INVEN.customAction = function(target) { 11 try { 12 if (!(this instanceof INVEN.customAction)) { throw '_000_'; } 13 if (typeof target !== 'string' || target.length === 0) { throw '_001_'; } 14 this._PANE_ = $('#' + target); 15 if (!this._PANE_.length) { throw '_002_'; } 16 this._init_(); 17 } catch (e) { 18 this._error_(e.message || e); 19 } 20}; 21/** 22 * 기본 íë¡í¼í°, ë©ìë 23 */ 24INVEN.customAction.prototype = { 25 _VERSION_: '1.5.2', 26 _CUSTOM_EVENT_: ['data-inven-toggle', 'data-inven-show', 'data-inven-hide', 'data-inven-random', 'data-inven-list'], 27 _CUSTOM_STYLE_: ['data-inven-click-css', 'data-inven-over-css', 'data-inven-out-css'], 28 _CUSTOM_TOOLTIP_: null, 29 _CUSTOM_ACTION_: { 'search-profile': true, 'last-attack-1': true, 'last-attack-5': true, 'last-attack-10': true, 'last-attack-20': true, 'last-attack-all': true, 'send-note': true }, 30 /** 31 * @todo ë°ì¹ì 2ê°ë¡ ìì 32 */ 33 _CUSTOM_ACTION_TAG_MAX_: 20, 34 _CUSTOM_ACTION_STYLE_INSTALLED_: false, 35 _JQUERY_PLACEHOLDER_INSTALLED_: false, 36 _ID_: null, 37 _PANE_: null, 38 _REGEXP_ID_: /[^a-z0-9\-_]/i, 39 /** 40 * ìë¬ ë©ìì§ 41 */ 42 _ERROR_: { 43 _000_: 'INVEN.customActionì ì¸ì¤í´ì¤ê° ìëëë¤.', 44 _001_: 'ì못ë target ì§ì ì ëë¤.', 45 _002_: 'target ì ì°¾ì ì ììµëë¤.', 46 _003_: 'ëë¤ìì ì ë ¥íì¬ ì£¼ììì¤', 47 _004_: 'ëë¤ìì ì ë ¥íì¬ ì£¼ììì¤' 48 }, 49 /** 50 * error ì¶ë ¥ 51 * @param {String} errCode ìë¬ì½ë ëë ë©ì¸ì§ 52 * @param {Boolean} consoleLogOnly ì½ì ë¡ê·¸ë§ ì¶ë ¥í ê²ì¸ì§ 53 */ 54 _error_: function(errCode, consoleLogOnly) { 55 var msg = '[invenCustomAction-error] :: '; 56 try { 57 if (this._ERROR_.hasOwnProperty(errCode)) { 58 msg += this._ERROR_[errCode]; 59 } else { 60 if (typeof errCode === 'string' && errCode.length) { msg += errCode; } 61 } 62 } catch (e) { 63 msg = e.message; 64 } 65 if (!consoleLogOnly) { alert(msg); } 66 if (typeof window.console === 'object' && typeof window.console.log === 'function') { console.log(msg); } 67 msg = null; 68 }, 69 _init_: null, 70 _events_: null, 71 _styles_: null, 72 _tabs_: null, 73 _tooltip_: null, 74 _useraction_: null, 75 _dday_: null, 76 /** 77 * CSS Parse 78 * @param {String} cssText css íì± 79 */ 80 parseCss: function(cssText) { 81 var obj = null; 82 try { 83 if (typeof cssText === 'string') { 84 // json parsing 85 cssText = cssText.replace(/\'/g, '"').replace(/[\r\n]+/, '').replace(/[\s\u00A0]/g, ' ');//.replace(/\"[^":]*:[^0-9\[\"\{]*/g, '":'); 86 obj = $.parseJSON(cssText); 87 } 88 return obj; 89 } catch (e) { 90 this._error_(e.message); 91 return false; 92 } finally { 93 obj = null; 94 } 95 }, 96 /** 97 * css apply 98 * @param {Object} elem node element ëë jQuery ì ëí° ê²°ê³¼ 99 * @param {String} cssAttr css ë°ì´í°ê° ìë ìì± 100 */ 101 applyCss: function(elem, cssAttr) { 102 var css, id, me = elem, cssData; 103 try { 104 if (typeof elem !== 'object') { return; } 105 if (elem.nodeType && elem.nodeName) { me = $(elem); } 106 css = this.parseCss(me.attr(cssAttr)); 107 if (typeof css === 'object' && css instanceof Object && css.constructor === Object) { 108 for (id in css) { 109 if (!css.hasOwnProperty(id)) { continue; } 110 cssData = css[id]; 111 if (typeof cssData !== 'object' || !(cssData instanceof Object) || cssData.constructor !== Object) { continue; } 112 if (id.match(this.regexp_ID)) { 113 if (id === '_SELF_') { me.css(cssData); } 114 else { this._ID_.filter('[data-inven-id="' + id + '"]').css(cssData); } 115 } 116 } 117 } 118 } catch (e) { 119 this._error_('[applyCss] => ' + e.message); 120 } finally { 121 css = null; id = null; me = null; cssData = null; 122 } 123 }, 124 /** 125 * ë¤ë¥¸ ì ì ì¸ì¥ì´ê¸° 126 */ 127 openSearchProfile: function(nick) { 128 nick = $.trim(nick); 129 var invenInventorySearch; 130 try { 131 if (!nick || nick.length === 0) { throw '_003_'; } 132 invenInventorySearch = window.open( 133 'https://www.inven.co.kr/member/inventory/view_inventory.php?nick=' + encodeURIComponent(nick), 134 'invenInventorySearch', 135 'width=724,height=515,toolbar=no,scrollbars=yes,resizable=yes'); 136 invenInventorySearch.focus(); 137 } catch (ex) { 138 this._error_(ex); 139 } 140 }, 141 /** 142 * 쪽ì§ë³´ë´ê¸° 143 */ 144 sendNoteTo: function(nick) { 145 nick = $.trim(nick); 146 var noteWindow; 147 try { 148 if (!nick || nick.length === 0) { throw '_004_'; } 149 noteWindow = window.open('https://www.inven.co.kr/member/note/?act=write&rurl=_close&nick=' + encodeURIComponent(nick), '_blank', 'width=400,height=510,toolbar=no,scrollbars=no'); 150 noteWindow.focus(); 151 } catch (ex) { 152 this._error_(ex); 153 } 154 } 155}; 156/** 157 * ì´ê¸° ì¤ì 158 */ 159INVEN.customAction.prototype._init_ = function() { 160 this._ID_ = this._PANE_.find('[data-inven-id]'); 161 this._hidden_(); 162 this._events_(); 163 this._prevent_(); 164 this._tabs_(); 165 this._useraction_(); 166 this._tooltip_(); 167 this._dday_(); 168 this._styles_(); 169}; 170 171/** 172 * ì´ë²¤í¸ ì¤ì (toggle, show, hide) 173 */ 174INVEN.customAction.prototype._events_ = function() { 175 var len = this._CUSTOM_EVENT_.length, evts = []; 176 try { 177 for (; len--; ) { evts.push('[' + this._CUSTOM_EVENT_[len] + ']'); } 178 evts = this._PANE_.find(evts.join(',')); 179 evts.on('click', { _self_: this }, function(evt) { 180 var targets, i = 0, j = 0, len = 0, types = [], type, exec, id, _self_ = evt.data._self_; 181 var customEvent = _self_._CUSTOM_EVENT_, regexp_ID = _self_._REGEXP_ID_; 182 evt.preventDefault(); 183 try { 184 // event type check 185 i = customEvent.length; 186 for (;i--;) { 187 if (this.getAttribute(customEvent[i])) { types.push(customEvent[i].match(/data-inven-([a-z]+)/i)[1]); } 188 } 189 // run each event 190 i = types.length; 191 for (;i--;) { 192 type = types[i]; 193 exec = type === 'random' || type === 'list' ? exec = 'hide' : type; 194 targets = this.getAttribute('data-inven-' + type).split(','); 195 len = targets.length; 196 for (j = len; j--;) { targets[j] = $.trim(targets[j]); } 197 if (type === 'random') { 198 var randomCheck = true; 199 for (j = len; j--;) { 200 if (targets[j] === '_SELF_') { randomCheck = false; break; } 201 } 202 if (!randomCheck) { continue; } 203 j = targets.length; 204 } 205 for (j = len; j--;) { 206 id = targets[j]; 207 if (id.match(regexp_ID)) { continue; } 208 if (id === '_SELF_') { $(this)[exec](); } 209 else { _self_._ID_.filter('[data-inven-id="' + id + '"]')[exec](); } 210 } 211 // Random ì¶ë ¥ì¼ ê²½ì° 212 if (type === 'random') { 213 j = len; 214 while (1) { 215 id = targets[Math.floor(Math.random() * ((j - 1) - 0 + 1)) + 0]; 216 if (j > 1) { 217 if (this.getAttribute('data-random-id') === id) { continue; } 218 if (id.match(regexp_ID)) { continue; } 219 if (id === '_SELF_') { continue; } 220 else { _self_._ID_.filter('[data-inven-id="' + id + '"]').show(); } 221 } else { 222 if (id.match(regexp_ID)) { _self_._ID_.filter('[data-inven-id="' + id + '"]').show(); } 223 break; 224 } 225 this.setAttribute('data-random-id', id); 226 break; 227 } 228 } 229 // ìì°¨ ì¶ë ¥ì¼ ê²½ì° 230 else if (type === 'list') { 231 if (len > 0) { 232 id = this.getAttribute('data-list-id'); 233 if (!id) { 234 id = targets[0]; 235 } else { 236 if ((j = $.inArray(id, targets)) > -1) { id = ((++j) >= len) ? targets[0] : targets[j]; } 237 else { id = targets[0]; } 238 } 239 _self_._ID_.filter('[data-inven-id="' + id + '"]').show(); 240 this.setAttribute('data-list-id', id); 241 } 242 } 243 } 244 } catch (e) { 245 _self_._error_(e.message || e); 246 } finally { 247 targets = null; i = null; j = null; len = null; 248 types = null; type = null; exec = null; id = null; 249 customEvent = null; _self_ = null; 250 } 251 }).css('cursor', 'pointer'); 252 evts.filter('[data-inven-random]').click(); 253 } catch (e) { 254 this._error_(e.message || e); 255 } finally { 256 len = null; 257 } 258}; 259 260/** 261 * ì¤íì¼ ì¤ì (click, mouseover, mouseout) 262 */ 263INVEN.customAction.prototype._styles_ = function() { 264 var len = this._CUSTOM_STYLE_.length, evts = [], styles = {}, styleToggle = {}; 265 try { 266 for (; len--; ) { evts.push('[' + this._CUSTOM_STYLE_[len] + ']'); } 267 evts = this._PANE_.find(evts.join(',')); 268 evts.on('click mouseover mouseout', { _self_: this, css: styles, cssToggle: styleToggle }, function(evt) { 269 var id, targets, target, css, attr, style, i, t, toggle, el, eType = evt.type.replace('mouse', ''), 270 _self_ = evt.data._self_, cssData = evt.data.css, 271 cssToggle = evt.data.cssToggle; 272 try { 273 if (eType !== 'click' || (this.nodeName === 'A' && this.getAttribute('href', 2) === '#')) { evt.preventDefault(); } 274 if (typeof this.getAttribute('data-inven-' + eType + '-css') === 'object') { return; } 275 id = this.getAttribute('data-inven-id'); 276 // inven-click-css parse 277 if (!cssData.hasOwnProperty(id) || typeof cssData[id] !== 'object' || !cssData[id].hasOwnProperty(eType) || typeof cssData[id][eType] !== 'object') { 278 try { 279 if (!cssData.hasOwnProperty(id) || typeof cssData[id] !== 'object') { cssData[id] = {}; cssToggle[id] = {}; } 280 cssData[id][eType] = _self_.parseCss(this.getAttribute('data-inven-' + eType + '-css')); 281 cssToggle[id][eType] = {}; 282 for (target in cssData[id][eType]) { 283 css = cssData[id][eType][target]; 284 cssToggle[id][eType][target] = typeof css === 'object' && css instanceof Array ? 0 : null; 285 } 286 } catch (e) { 287 throw 'ì못ë inven-css íìì ëë¤. ::' + this.getAttribute('data-inven-' + eType + '-css'); 288 } 289 } 290 // apply css 291 for (target in cssData[id][eType]) { 292 css = cssData[id][eType][target]; 293 toggle = cssToggle[id][eType][target]; 294 el = []; 295 // multi targets 296 if (target.match(/,/)) { 297 targets = target.split(','); 298 for (t in targets) { 299 el.push(_self_._ID_.filter('[data-inven-id="' + $.trim(targets[t]) + '"]')); 300 } 301 } 302 // single target 303 else { 304 el.push(target === '_SELF_' ? $(this) : _self_._ID_.filter('[data-inven-id="' + target + '"]')); 305 } 306 for (i in el) { 307 // toggle === null 308 if (typeof toggle === 'object' && !(toggle instanceof Object)) { 309 el[i].css(css); 310 } 311 // toggle === Number 312 else { 313 el[i].css(css[toggle++]); 314 if (toggle == css.length) { toggle = 0; } 315 cssToggle[id][eType][target] = toggle; 316 } 317 } 318 } 319 } catch (e) { 320 _self_._error_(e.message || e); 321 } finally { 322 id = null; target = null; css = null; attr = null; style = null; 323 toggle = null; el = null; eType = null; _self_ = null; targets = null; t= null; 324 } 325 }).each(function(i) { 326 if (!this.getAttribute('data-inven-id')) { 327 this.setAttribute('data-inven-id', 'inven-css-id-' + i); 328 } 329 }); 330 } catch (e) { 331 this._error(e.message || e); 332 } finally { 333 len = null; 334 } 335}; 336 337/** 338 * inven-data-tab 339 */ 340INVEN.customAction.prototype._tabs_ = function() { 341 var tabs, _self_ = this; 342 try { 343 tabs = this._PANE_.find('[data-inven-tabs]'); 344 tabs.each(function(idx) { 345 var pane = $(this), 346 bttns, tabs; 347 try { 348 pane.attr('data-inven-tabs-index', idx); 349 bttns = pane.find('[data-inven-tab-for]').attr('data-inven-tabs-index', idx); 350 tabs = pane.find('[data-inven-tab-id]').attr('data-inven-tabs-index', idx).hide(); 351 bttns.on('click', function(e) { 352 var me = $(this); 353 var tabID = me.attr('data-inven-tab-for'), 354 tabs = me.closest('[data-inven-tabs]').find('div[data-inven-tab-id]').filter('[data-inven-tabs-index="' + (me.attr('data-inven-tabs-index') || '') + '"]'), 355 css, 356 id = me.attr('data-inven-id'), 357 tabIndex = me.attr('data-inven-tabs-index'); 358 try { 359 e.preventDefault(); 360 // -- í íì±í 361 if (!me.is('[data-inven-tab-selected]')) { 362 _self_.applyCss(me.attr('data-inven-tab-selected', 'true'), 'data-inven-selected-css'); 363 tabs.filter('[data-inven-tab-id="' + tabID + '"]').show(); 364 if (!pane.is('[data-inven-tab-multi]')) { 365 tabs.filter('[data-inven-tabs-index="' + tabIndex + '"]').filter(':not([data-inven-tab-id="' + tabID + '"])').hide(); 366 bttns.filter('[data-inven-tabs-index="' + tabIndex + '"]').filter(':not([data-inven-tab-for="' + tabID + '"])').removeAttr('data-inven-tab-selected').each(function() { _self_.applyCss(this, 'data-inven-unselected-css'); }); 367 } 368 } 369 // -- í ë¹íì±í 370 else { 371 if (pane.is('[data-inven-tab-multi]')) { 372 tabs.filter('[data-inven-tabs-index="' + tabIndex + '"]').filter('[data-inven-tab-id="' + tabID + '"]').hide(); 373 _self_.applyCss(me.removeAttr('data-inven-tab-selected'), 'data-inven-unselected-css'); 374 } 375 } 376 } catch (ex3) { 377 _self_._error_(ex3.message || ex3); 378 } finally { 379 me = null; tabID = null; id = null; css = null; 380 } 381 }).css('cursor', 'pointer'); 382 if (pane.attr('data-inven-tab-selected')) { 383 bttns.filter('[data-inven-tab-for="' + (pane.attr('data-inven-tab-selected')) + '"]').click(); 384 } else if (pane.is('[data-inven-tab-random]')) { 385 bttns.filter(':eq(' + (Math.floor(Math.random() * bttns.length)) + ')').click(); 386 } else { 387 bttns.filter(':eq(0)').click(); 388 } 389 } catch (ex2) { 390 _self_._error_(ex2.message || ex2); 391 } 392 }); 393 } catch (ex) { 394 _self_._error_(ex.message || ex); 395 } 396}; 397 398/** 399 * data-inven-hidden ìì±ì´ ìë ê²ë¤ ì¨ê¸°ê¸° 400 */ 401INVEN.customAction.prototype._hidden_ = function() { 402 this._PANE_.find('[data-inven-hidden]').hide().css('cursor', 'default'); 403}; 404 405/** 406 * ì´ë²¤í¸ ë°©ì§ 407 */ 408INVEN.customAction.prototype._prevent_ = function() { 409 this._PANE_.find('[data-inven-prevent]').each(function() { 410 var me, types, type, len, i; 411 try { 412 me = $(this); 413 types = me.attr('data-inven-prevent').split(','); 414 len = types.length; 415 for (i = 0; i < len; i++) { 416 type = $.trim(types[i]); 417 if (type === 'contextmenu') { me.on('contextmenu', function(e) { e.preventDefault(); }); } 418 else if (type === 'drag') { me.on('dragstart', function(e) { e.preventDefault(); }); } 419 else if (type === 'select') { me.on('selectstart', function(e) { e.preventDefault(); }); } 420 } 421 } catch (ex) { 422 } finally { 423 me = null; 424 } 425 }); 426}; 427 428/** 429 * inven-data-tooltip 430 */ 431INVEN.customAction.prototype._tooltip_ = function() { 432 var evts, tooltip; 433 try { 434 evts = this._PANE_.find('[data-inven-tooltip]'); 435 if (evts.length) { 436 // -- tooltip box setup 437 tooltip = $('<div id="invenProfileToolTipLayer" style="position: absolute; display: none; background-color: #ffff00; border: 1px solid #000000; padding: 5px; max-width: 300px; line-height: 1.4em; white-space: normal; overflow: hidden; z-index: 1000;"></div>'); 438 $('body').append(tooltip); 439 this._CUSTOM_TOOLTIP_ = { 440 tooltipObj: tooltip[0], 441 content: function(content) { 442 this.tooltipObj.innerHTML = content.replace(/^(?:(#[0-9a-f]{6}|rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:\d+\.\d+|\.\d+|\d+)\s*)?\))?;)?(?:(#[0-9a-f]{6}|rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:\d+\.\d+|\.\d+|\d+)\s*)?\))?;)?(?:(#[0-9a-f]{6}|rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:\d+\.\d+|\.\d+|\d+)\s*)?\))?;)?/i, function($0, $1, $2, $3) { 443 if ($1) { tooltip.css('color', $1); } 444 if ($2) { tooltip.css('backgroundColor', $2); } 445 if ($3) { tooltip.css('borderColor', $3); } 446 return ''; 447 }).replace(/([<>&])/g, function($0, $1) { 448 return ($0 === '<') ? '<' : ($0 === '>' ? '>' : '&'); 449 }); 450 }, 451 show: function(content) { 452 if (!!content && typeof content === 'string') { this.content(content); } 453 INVEN.Layer.show(this.tooltipObj, 10, 10); 454 }, 455 hide: function() { 456 INVEN.Layer.hide(this.tooltipObj); 457 tooltip.css({ color: '#000000', backgroundColor: '#ffff00', borderColor: '#000000' }); 458 } 459 }; 460 // -- event connent 461 evts.on('mouseover mouseout mousemove', { _self_: this }, function(evt) { 462 var me, data, _self_ = evt.data._self_; 463 try { 464 if (evt.type == 'mouseover') { 465 data = this.getAttribute('data-inven-tooltip'); 466 if (!!data && data.length) { 467 _self_._CUSTOM_TOOLTIP_.show(data); 468 } 469 } else if (evt.type == 'mousemove') { 470 _self_._CUSTOM_TOOLTIP_.show(); 471
471 } else { 472 _self_._CUSTOM_TOOLTIP_.hide(); 473 } 474 } finally { 475 me = null; data = null; _self_ = null; 476 } 477 }); 478 } 479 } catch (e) { 480 this._error_(e.message || e); 481 } finally { 482 } 483}; 484 485/** 486 * ì¸ì¥ê²ì / ë§ê²©ë°ì¬ê¸° (beta) 487 */ 488INVEN.customAction.prototype.lastAttackProcessing = false; 489INVEN.customAction.prototype._fn_lastattack_ = function(evt) { 490 var me = $(this); 491 var parent = me.closest('div.data-inven-action'); 492 var resultPane = parent.is('[data-inven-align="center"][data-inven-result-pane="2"]') ? 493 parent.parent().next('center.clear').find('div.inven-profile-action-result') : 494 parent[parent.is('[data-inven-result-pane="2"]') ? 'next' : 'find']('div.inven-profile-action-result'); 495 var v = $.trim(parent.find('input').val()), 496 resultDetail = parent.is('[data-inven-result-detail]'), 497 remainResult = parent.is('[data-inven-result-remain]'); 498 try { 499 evt.preventDefault(); 500 if (!v.length) { alert('ëë¤ìì ì ë ¥íì¸ì'); return; } 501 // -- ë§ê²© 502 if (me.hasClass('inven-profile-last-attack')) {
503 if (INVEN.customAction.prototype.lastAttackProcessing) { return false; } 504 var cnt = parseInt(me.attr('data-attack') === 'all' ? 40 : me.attr('data-attack'), 10), 505 totalUpExp = 0, 506 target = v, 507 msg = '', 508 eachResult = [], 509 critical = 0; 510 st = (resultPane.data('st') || -1); 511 if (!confirm(target + 'ëìê² ë§ë¬´ë¦¬ ì¼ê²©ì ' + (me.attr('data-attack') === 'all' ? '모ë' : (cnt + 'ë²')) + ' ì¬ì©íìê² ìµëê¹?')) { return false; } 512 var fn = function(doing) { 513 $.ajax({ 514 type: 'POST', 515 dataType: 'xml', 516 url: 'https://www.inven.co.kr/member/skill/casting_lasthit.xml.php', 517 data: { nick: target, out: 'xml' } 518 }).done(function(r) { 519 if (r) { 520 try { 521 var data = r.getElementsByTagName('result')[0]; 522 var success = parseInt(data.getElementsByTagName('success')[0].childNodes[0].nodeValue, 10), 523 message = data.getElementsByTagName('message')[0].childNodes[0].nodeValue, 524 exp = parseInt(data.getElementsByTagName('resultlasthit')[0].childNodes[0].nodeValue, 10); 525 if (!success) { 526 throw message + (doing > 1 ? ('<br><br><span>' + target + '</span>ëìê² ë§ë¬´ë¦¬ ì¼ê²©ì <span>' + (doing - 1) + '</span>í ì¬ì©íì¬<br><span>' + totalUpExp + '</span>ë§í¼ì ê²½íì¹ë¥¼ ì¦ê°ìì¼°ìµëë¤.' + (resultDetail ? ('<br><br>ë´ì: ' + eachResult.join(', ') + '<br>íê· : ' + (totalUpExp/(doing - 1 || 1)).toFixed(2) + '<br>í¬ë¦¬í°ì»¬: ' + critical + 'í') : '')) : ''); 527 } 528 critical += exp >= 10 ? 1 : 0; 529 totalUpExp += exp; 530 eachResult.push(exp); 531 if (doing === cnt) { 532 throw '<span>' + target + '</span>ëìê² ë§ë¬´ë¦¬ ì¼ê²©ì <span>' + doing + '</span>í ì¬ì©íì¬<br><span>' + totalUpExp + '</span>ë§í¼ì ê²½íì¹ë¥¼ ì¦ê°ìì¼°ìµëë¤.' + (resultDetail ? ('<br><br>ë´ì: ' + eachResult.join(', ') + '<br>íê· : ' + (totalUpExp/doing).toFixed(2) + '<br>í¬ë¦¬í°ì»¬: ' + critical + 'í') : ''); 533 } 534 fn(++doing); 535 } catch (e) { 536 if (typeof e === 'string') { msg = e; } 537 else { msg = 'ì¤ë¥ê° ë°ìíììµëë¤. ì ì í ë¤ì ìëíì¬ ì£¼ììì¤.'; } 538 if (resultPane.length) { 539 clearTimeout(st); 540 resultPane.html('<div class="wrap">' + msg + '</div>').removeClass('pane-hidden'); 541 if (!remainResult) { 542 st = setTimeout(function() { resultPane.addClass('pane-hidden'); clearTimeout(resultPane.data('st')); resultPane = null; }, 5000); 543 resultPane.data('st', st); 544 } 545 } 546 else { alert(msg.replace(/<\/?span>/g, '').replace(/<br>/g, '\n')); } 547 INVEN.customAction.prototype.lastAttackProcessing = false; 548 return; 549 } 550 } else { 551 msg = 'ì¤ë¥ê° ë°ìíììµëë¤. ì ì í ë¤ì ìëíì¬ ì£¼ììì¤.'; 552 if (resultPane.length) { 553 clearTimeout(st); 554 resultPane.html('<div class="wrap">' + msg + '</div>').removeClass('pane-hidden'); 555 if (!remainResult) { 556 st = setTimeout(function() { resultPane.addClass('pane-hidden'); clearTimeout(resultPane.data('st')); resultPane = null; }, 5000); 557 resultPane.data('st', st); 558 } 559 } 560 else { alert(msg); } 561 INVEN.customAction.prototype.lastAttackProcessing = false; 562 } 563 }).fail(function() { 564 msg = 'ì¤ë¥ê° ë°ìíììµëë¤. ì ì í ë¤ì ìëíì¬ ì£¼ììì¤.'; 565 if (resultPane.length) { 566 clearTimeout(st); 567 resultPane.html('<div class="wrap">' + msg + '</div>').removeClass('pane-hidden'); 568 if (!remainResult) { 569 st = setTimeout(function() { resultPane.addClass('pane-hidden'); clearTimeout(resultPane.data('st')); resultPane = null; }, 5000); 570 resultPane.data('st', st); 571 } 572 } 573 else { alert(msg); } 574 INVEN.customAction.prototype.lastAttackProcessing = false; 575 }); 576 }; 577 INVEN.customAction.prototype.lastAttackProcessing = true; 578 fn(1); 579 } 580 // ìª½ì§ ë³´ë´ê¸° 581 else if (me.hasClass('inven-send-note')) { 582 INVEN.customAction.prototype.sendNoteTo(v); 583 } 584 // ì¸ì¥ê²ì 585 else { 586 INVEN.customAction.prototype.openSearchProfile(v); 587 } 588 } finally { 589 me = null; v = null; 590 } 591}; 592INVEN.customAction.prototype._useraction_ = function() { 593 //if (true) { return; } 594 var action, _self_, styles = [], bttns = [], customEvt_over = [], customEvt_out = [], customTexts = []; 595 try { 596 if (!INVEN.customAction.prototype._CUSTOM_ACTION_STYLE_INSTALLED_) { 597 $('head').append( 598 '<style type="text/css">' + 599 '#powerbbsContent div.data-inven-action,' + 600 '.memberProfile .powerbbsContent div.data-inven-action,' + 601 'div.data-inven-action { border: 1px solid #cdcdcd; border-radius: .248em; padding: .4em; _zoom: 1; width: auto; font-size: 12px; margin: 2px 0; display: inline-block; _display: inline; zoom: 1; }' + 602 'div.data-inven-action label { margin-right: 2px; display: block; float: left; font-size: 12px; height: 18px; line-height: 19px; }' + 603 'div.data-inven-action input { width: 120px; display: block; float: left; border: 1px solid #9c9c9c; padding: 1px; height: 18px; line-height: 15px; }' + 604 'div.data-inven-action button { margin-left: 2px; width: 3em; text-align: center; text-decoration: none !important; display: block; float: left; padding: 1px .2em; border: 1px solid #c9c9c9; font-size: 12px; height: 18px; _height: 18px; line-height: 15px; background-color: #dedede; cursor: pointer; white-space: nowrap; }' + 605 'div.data-inven-action:after { content: " "; clear: both; display: block; height: 0; visibility: hidden; overflow: hidden; }' + 606 'div.data-inven-action div.action-wrapper { position: relative; float: left !important; /*position: relative; right: -50%;*/ }' + 607 'div.data-inven-action div.action-wrapper div.inner-wrapper { float: none !important; /*position: relative; right: 50%;*/ white-space: nowrap; }' + 608 'div.data-inven-action div.action-wrapper div.inner-wrapper:after { content:" "; display: table; clear: both; }' + 609 'center.clear div.data-inven-action div.action-wrapper { text-align: center; }' + 610 'center.clear div.data-inven-action div.action-wrapper div.inner-wrapper { display: inline-block !important; _display: inline !important; _zoom: 1 }' + 611 '#powerbbsContent div.data-inven-action-full,' + 612 '.memberProfile .powerbbsContent div.data-inven-action-full,' + 613 'div.data-inven-action-full { display: block; }' + 614 'div.data-inven-action-full-center div.action-wrapper { float: none !important; position: relative; /*right: -50%;*/ text-align: center; }' + 615 'div.data-inven-action-full-center div.action-wrapper div.inner-wrapper { float: none !important; position: relative; /*right: 50%;*/ display: inline-block !important; _display: inline !important; _zoom: 1; }' + 616 'div.data-inven-action-full-center div.action-wrapper div.inven-profile-action-result { position: relative; /*right: 50%;*/ }' + 617 'div.data-inven-action-full-right div.action-wrapper { float: right !important; }' + 618 'div.data-inven-action-full-left div.action-wrapper { float: left; }' + 619 '#powerbbsContent div.data-inven-action-left,' + 620 '.memberProfile .powerbbsContent div.data-inven-action-left,' + 621 'div.data-inven-action-left { display: block; float: left !important; clear: both; width: auto; }' + 622 '#powerbbsContent div.data-inven-action-right,' + 623 '.memberProfile .powerbbsContent div.data-inven-action-right,' + 624 'div.data-inven-action-right { display: block; float: right !important; clear: both; width: auto; }' + 625 'div.data-inven-action-center { clear: both; width: auto; float: none !important; }' + 626 'div.inven-profile-action-result { clear: both; float: none !important; display: block !important; width: auto; max-width: 100%; margin-top: 4px; border: 1px solid #cdcdcd; border-radius: .248em; padding: .4em 0; font-size: 12px; text-align: left; text-indent: 0; white-space: nowrap; _zoom: 1; }' + 627 'div.inven-profile-action-result:after { content: " "; height: 0; overflow: hidden; display: block; visibility: hidden; overflow: hidden; clear: both; }' + 628 'div.inven-profile-action-result div.wrap { white-space: normal !important; display: inline-block !important; _display: inline; _zoom: 1; width: auto; padding: 0 .4em; }' + 629 'div.inven-profile-action-result-left { float: left !important; width: auto; }' + 630 'div.inven-profile-action-result-right { float: right !important; width: auto; }' + 631 'div.inven-profile-action-result-center { float: none !important; display: inline-block !important; _display: inline !important; _zoom: 1; width: auto; }' + 632 'div.inven-profile-action-result-full-left,' + 633 'div.inven-profile-action-result-full-center,' + 634 'div.inven-profile-action-result-full-right { float: none !important; width: auto; }' + 635 'div.inven-profile-action-result-full-center { text-align: center; }' + 636 'div.inven-profile-action-result-full-right { text-align: right; }' + 637 'div.data-inven-action-full-center div.inven-profileaction-result { position: relative; /*right: 50%;*/ _margin-top: 8px; }' + 638 'div.pane-hidden { display: none !important; }' + 639 'center.clear { clear: both; }' + 640 '</style>' 641 ); 642 INVEN.customAction.prototype._CUSTOM_ACTION_STYLE_INSTALLED_ = true; 643 } 644 action = this._PANE_.find('div[data-inven-action]:lt(' + this._CUSTOM_ACTION_TAG_MAX_ + ')'); 645 _self_ = this; 646 action.each(function(idx) { 647 var me = $(this), align = this.getAttribute('data-inven-align'), i, _el; 648 try { 649 styles[idx] = {}; 650 customEvt_over[idx] = {}; 651 customEvt_out[idx] = {}; 652 customTexts[idx] = {}; 653 bttns[idx] = {}; 654 me.find('> span[data-inven-attr-for]').each(function() { 655 var val, m, me = $(this); 656 if ((val = $.trim(this.getAttribute('data-inven-attr-for')))) { 657 if (val === 'input' || val === 'label' || val === 'button') { 658 styles[idx][val] = me.attr('style'); 659 customEvt_over[idx][val] = me.attr('data-inven-over-css'); 660 customEvt_out[idx][val] = me.attr('data-inven-out-css'); 661 } else if ((m = val.match(/^last-attack-(1|5|10|20|all)$/))) { 662 bttns[idx][m[0]] = '<button class="inven-profile-last-attack" data-attack="' + m[1] + '" href="#last-attack-' + m[1] + '" title="ë§ê²©">' + (m[1] === 'all' ? '모ë' : (m[1] + 'ë²')) + '</button>'; 663 styles[idx][m[0]] = me.attr('style'); 664 customTexts[idx][m[0]] = $.trim(me.attr('data-inven-text') || ''); 665 customEvt_over[idx][m[0]] = me.attr('data-inven-over-css'); 666 customEvt_out[idx][m[0]] = me.attr('data-inven-out-css'); 667 } else if (val === 'search-profile') { 668 bttns[idx][val] = '<button class="inven-profile-search" href="#search-profile" title="ì¸ì¥ê²ì">ê²ì</button>'; 669 styles[idx][val] = me.attr('style'); 670 customTexts[idx][val] = $.trim(me.attr('data-inven-text') || ''); 671 customEvt_over[idx][val] = me.attr('data-inven-over-css'); 672 customEvt_out[idx][val] = me.attr('data-inven-out-css'); 673 } else if (val === 'send-note') { 674 bttns[idx][val] = '<button class="inven-send-note" href="#send-note" title="쪽ì§ë³´ë´ê¸°">쪽ì§</button>'; 675 styles[idx][val] = me.attr('style'); 676 customTexts[idx][val] = $.trim(me.attr('data-inven-text') || ''); 677 customEvt_over[idx][val] = me.attr('data-inven-over-css'); 678 customEvt_out[idx][val] = me.attr('data-inven-out-css'); 679 } else if (val === 'action-result') { 680 me.parent().attr('data-inven-result-pane', me.is('[data-position="out"]') ? '2' : '1'); 681 if (me.is('[data-remain-result]')) { me.parent().attr('data-inven-result-remain', '1'); } 682 styles[idx][val] = me.attr('style'); 683 } 684 } 685 }); 686 /* -- ë²í¼ìì ì¶ê° */ 687 me.html('<div class="action-wrapper"><div class="inner-wrapper"></div></div>'); 688 for (i in bttns[idx]) { 689 if (bttns[idx].hasOwnProperty(i)) { 690 _el = $(bttns[idx][i]).attr('style', (styles[idx] && styles[idx].hasOwnProperty(i) ? styles[idx][i] : '')); 691 if (customTexts[idx] && customTexts[idx].hasOwnProperty(i) && customTexts[idx][i].length) { _el.text(customTexts[idx][i]); } 692 if (customEvt_over[idx] && customEvt_over[idx].hasOwnProperty(i)) { _el.attr('data-inven-over-css', customEvt_over[idx][i]); } 693 if (customEvt_out[idx] && customEvt_out[idx].hasOwnProperty(i)) { _el.attr('data-inven-out-css', customEvt_out[idx][i]); } 694 me.find('div.inner-wrapper').append(_el); 695 } 696 } 697 /* -- ê²°ê³¼íì */ 698 if (me.attr('data-inven-result-pane') == '1') { 699 me.find('div.action-wrapper').append($('<div class="inven-profile-action-result pane-hidden"></div>').attr('style', styles[idx]['action-result'])); 700 } else if (me.attr('data-inven-result-pane') == '2') { 701 me.after($('<div class="inven-profile-action-result' + (typeof align === 'string' && $.inArray(align, ['left', 'right', 'center'] > -1) ? (' inven-profile-action-result-' + align) : '') + ' pane-hidden"></div>').attr('style', styles[idx]['action-result'])); 702 } 703 /* -- ì ë ¬ */ 704 if (typeof align === 'string') { 705 algin = $.trim(align); 706 switch (align) { 707 case 'full-left': 708 me.addClass('data-inven-action-full data-inven-action-full-left'); 709 break; 710 case 'full-right': 711 me.addClass('data-inven-action-full data-inven-action-full-right'); 712 break; 713 case 'full-center': 714 me.addClass('data-inven-action-full data-inven-action-full-center'); 715 break; 716 case 'left': 717 me.addClass('data-inven-action-left'); 718 break; 719 case 'right': 720 me.addClass('data-inven-action-right'); 721 break; 722 case 'center': 723 me.next('div.inven-profile-action-result').wrap('<center class="clear"></center>'); 724 me.wrap('<center class="clear"></center>'); 725 break; 726 } 727 } 728 } catch (ex) { 729 } finally { 730 me = null; 731 } 732 }); 733 action.each(function(idx) { 734 var me = $(this), attr, i = 0, v, len, m, _el; 735 var pane = me.find('> div.action-wrapper > div.inner-wrapper'); 736 try { 737 me.addClass('data-inven-action'); 738 attr = me.attr('data-inven-action').split(','); 739 len = attr.length;/*.sort(function(a, b) { 740 var m1 = a.match(/^last-attack-(\d+)$/), 741 m2 = b.match(/^last-attack-(\d+)$/); 742 if (m1 && m2) { 743 return parseInt(m1[1], 10) > parseInt(m2[1], 10) ? 1 : -1; 744 } else { 745 return a > b ? 1 : -1; 746 } 747 }).length;*/ 748 if (len) { 749 for (; i < len; i++) { 750 v = attr[i]; 751 if (_self_._CUSTOM_ACTION_.hasOwnProperty(v)) { 752 if ((m = v.match(/^last-attack-(1|5|10|20|all)$/))) { 753 if (pane.find('button[data-attack=""]').length === 0) { 754 pane.append('<button class="inven-profile-last-attack" data-attack="' + m[1] + '" href="#last-attack-' + m[1] + '" title="ë§ê²©">' + (m[1] === 'all' ? '모ë' : (m[1] + 'ë²')) + '</button>'); 755 } 756 } else if ((m = v.match(/^send-note$/))) { 757 if (pane.find('button.inven-send-note').length === 0) { 758 pane.append('<button class="inven-send-note" href="#send-note" title="쪽ì§ë³´ë´ê¸°">쪽ì§</button>'); 759 } 760 } else { 761 if (pane.find('button.inven-profile-search').length === 0) { 762 pane.append('<button class="inven-profile-search" href="#search-profile" title="ì¸ì¥ê²ì">ê²ì</button>'); 763 } 764 } 765 } 766 } 767 pane.prepend( 768 $('<input class="inven-profile-search-nick" placeholder="ëë¤ìì ì ë ¥íì¸ì" ' + (me.is('[data-no-tooltip]') ? '' : ' data-inven-tooltip="ê²ì/ë§ê²©í ëìì ëë¤ìì ì ë ¥íì¬ ì£¼ììì¤."') + '>') 769 .val(me.attr('data-inven-nick-default') ? (me.attr('data-inven-nick-default').replace(/[<>\/&\?\\\/\*\$]/g, '') || '') : '') 770 .on('keydown', function(evt) { 771 var v = $.trim(this.value); 772 try { 773 if (evt.keyCode === 13 || evt.charCode === 13) { 774 evt.preventDefault(); 775 if (!v.length) { alert('ê²ìí ëë¤ìì ì ë ¥íì¬ ì£¼ììì¤.'); } 776 _self_.openSearchProfile(v); 777 } 778 } finally { 779 v = null; 780 } 781 }) 782 ).on('click', 'button', INVEN.customAction.prototype._fn_lastattack_);//.placeholder(); 783 if (styles[idx] && typeof styles[idx] === 'object') { 784 if (styles[idx].hasOwnProperty('input')) { pane.find('input')
784.attr('style', styles[idx].input); } 785 if (styles[idx].hasOwnProperty('button')) { 786 _el = pane.find('button').attr('style', styles[idx].button); 787 if (customEvt_over[idx] && customEvt_over[idx].hasOwnProperty('button')) { _el.attr('data-inven-over-css', customEvt_over[idx].button); } 788 if (customEvt_out[idx] && customEvt_out[idx].hasOwnProperty('button')) { _el.attr('data-inven-out-css', customEvt_out[idx].button); } 789 } 790 } 791 } 792 if (me.attr('data-inven-label')) { 793 pane.prepend('<label>' + $.trim(me.attr('data-inven-label')).replace(/[<>&\?\\\*\$]/g, '') + '</label>'); 794 if (styles[idx].hasOwnProperty('label')) { pane.find('label').attr('style', styles[idx].label); } 795 } 796 } catch (e) { 797 _self_._error_(e.message || e); 798 } finally { 799 attr = null; 800 } 801 }); 802 } catch (e) { 803 this._error_(e.message || e); 804 } finally { 805 action = null; 806 } 807}; 808/** 809 * d-day ê³ì° 810 */ 811INVEN.customAction.prototype._dday_ = function() { 812 var evts; 813 try { 814 evts = this._PANE_.find('[data-inven-dday]'); 815 evts.each(function(el) { 816 var me, day, m, year, month, date, now, dday, gap, odd; 817 try { 818 me = $(this); 819 day = me.attr('data-inven-dday'); 820 odd = me.is('[data-inven-dday-odd]') ? 1 : 0; 821 if (day && typeof day === 'string' && (m = day.match(/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/))) { 822 year = '0000'.substring(0, 4 - m[1].length) + m[1]; 823 month = parseInt(m[2], 10); 824 date = parseInt(m[3], 10); 825 now = new Date(); 826 now = new Date(now.getFullYear(), now.getMonth(), now.getDate()); 827 dday = new Date(year, month - 1, date); 828 dday.setFullYear(year); 829 if (now.getTime() < dday.getTime()) { 830 gap = Math.floor((dday.getTime() - now.getTime()) / (1000 * 60 * 60 * 24)); 831 } else { 832 gap = Math.floor((now.getTime() - dday.getTime()) / (1000 * 60 * 60 * 24)); 833 } 834 me.html((gap < 0 ? (gap * -1) : gap) + odd); 835 } else { 836 me.html('0'); 837 } 838 } catch (e) { 839 this._error_(e.message || e); 840 } finally { 841 me = null; day = null; year = null; month = null; 842 date = null; now = null; dday = null; gap = null; 843 } 844 }); 845 } catch (e) { 846 this._error_(e.message || e); 847 } finally { 848 evts = null; 849 } 850};
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.