mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-05 21:16:26 -05:00
Battle tooltips
This commit is contained in:
parent
9c689df401
commit
a39f6f878e
|
|
@ -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('<div id="tooltipwrapper"></div>');
|
||||
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 += '</div></div>';
|
||||
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 = '<div class="tooltipinner"><div class="tooltip">';
|
||||
text += '<h2>' + pokemon.getFullName() + (pokemon.level !== 100 ? ' <small>L' + pokemon.level + '</small>' : '') + '<br />';
|
||||
|
||||
|
|
@ -865,8 +861,8 @@
|
|||
text += '</div></div>';
|
||||
break;
|
||||
}
|
||||
$('#tooltipwrapper').html(text);
|
||||
return true;
|
||||
if (!$('#tooltipwrapper').length) $(document.body).append('<div id="tooltipwrapper"></div>');
|
||||
$('#tooltipwrapper').html(text).appendTo(document.body);
|
||||
},
|
||||
hideTooltip: function() {
|
||||
$('#tooltipwrapper').html('');
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*********************************************************/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user