diff --git a/js/client-battle.js b/js/client-battle.js index ecb23f41d..36651792f 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -766,23 +766,19 @@ return ' onmouseover="room.showTooltip(\'' + Tools.escapeHTML(''+thing, true) + '\',\'' + type + '\', this, ' + (ownHeight ? 'true' : 'false') + ', ' + (isActive ? 'true' : 'false') + ')" onmouseout="room.hideTooltip()" onmouseup="room.hideTooltip()"'; }, showTooltip: function(thing, type, elem, ownHeight, isActive) { - if (!$('#tooltipwrapper')) $(body).append('
'); - return false; var offset = { left: 150, top: 500 }; if (elem) offset = $(elem).offset(); - var x = offset.left - 25; + var x = offset.left - 2; if (elem) { if (ownHeight) offset = $(elem).offset(); else offset = $(elem).parent().offset(); } - var y = offset.top - 15; + var y = offset.top - 5; - if (widthClass === 'tiny-layout') { - if (x > 360) x = 360; - } + if (x > 335) x = 335; if (y < 140) y = 140; $('#tooltipwrapper').css({ left: x, @@ -809,11 +805,11 @@ text += ''; break; case 'pokemon': - var pokemon = curRoom.battle.getPokemon(thing); + var pokemon = this.battle.getPokemon(thing); if (!pokemon) return; //fallthrough case 'sidepokemon': - if (!pokemon) pokemon = curRoom.battle.mySide.pokemon[parseInt(thing)]; + if (!pokemon) pokemon = this.battle.mySide.pokemon[parseInt(thing)]; text = '
'; text += '

' + pokemon.getFullName() + (pokemon.level !== 100 ? ' L' + pokemon.level + '' : '') + '
'; @@ -865,8 +861,8 @@ text += '

'; break; } - $('#tooltipwrapper').html(text); - return true; + if (!$('#tooltipwrapper').length) $(document.body).append('
'); + $('#tooltipwrapper').html(text).appendTo(document.body); }, hideTooltip: function() { $('#tooltipwrapper').html(''); diff --git a/style/client.css b/style/client.css index 2e5aa4e99..b17169dce 100644 --- a/style/client.css +++ b/style/client.css @@ -1094,6 +1094,46 @@ a.ilink:hover { color: #777777 !important; } +/****************/ + +#tooltipwrapper { + position: absolute; + top: 400px; + left: 100px; + text-align: left; + color: black; +} +#tooltipwrapper .tooltipinner { + position: relative; +} +#tooltipwrapper .tooltip { + position: absolute; + bottom: 0; + left: 0; + width: 300px; + border: 1px solid #888888; + background: #EEEEEE; + background: rgba(240,240,240,.9); + border-radius: 5px; +} +#tooltipwrapper .tooltip h2 { + padding: 2px 4px; + margin: 0; + border-bottom: 1px solid #888888; + font-size: 10pt; +} +#tooltipwrapper .tooltip h2 small { + font-weight: normal; +} +#tooltipwrapper .tooltip p { + padding: 2px 4px; + margin: 0; + font-size: 8pt; +} +#tooltipwrapper .tooltip p.section { + border-top: 1px solid #888888; +} + /********************************************************* * Teambuilder *********************************************************/