Mudanças entre as edições de "Widget:Item"
Ir para navegação
Ir para pesquisar
m |
m |
||
| Linha 1: | Linha 1: | ||
<includeonly> | <includeonly> | ||
<!-- | <!-- | ||
Tooltip | Tooltip: HTML vem do Módulo:Item.renderTooltip via renderOne (Scribunto). | ||
Este widget aplica estilos e posiciona .item-tooltip no hover. | |||
--> | --> | ||
<style> | <style> | ||
| Linha 36: | Linha 31: | ||
text-align: center; | text-align: center; | ||
overflow: visible; | overflow: visible; | ||
filter: none; | |||
} | } | ||
| Linha 41: | Linha 37: | ||
display: block; | display: block; | ||
margin: 0 auto; | margin: 0 auto; | ||
filter: none; | |||
box-shadow: none; | |||
} | } | ||
| Linha 68: | Linha 66: | ||
line-height: 1; | line-height: 1; | ||
white-space: nowrap; | white-space: nowrap; | ||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0. | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); | ||
z-index: 10; | z-index: 10; | ||
} | } | ||
| Linha 78: | Linha 76: | ||
} | } | ||
.wikitable td .reward-items .item-wrapper { | .wikitable td .reward-items .item-wrapper { | ||
margin-bottom: 10px; | margin-bottom: 10px; | ||
} | } | ||
.item-tooltip { | .item-tooltip { | ||
| Linha 94: | Linha 87: | ||
flex-direction: column; | flex-direction: column; | ||
align-items: center; | align-items: center; | ||
filter: | filter: none; | ||
} | } | ||
| Linha 113: | Linha 106: | ||
box-sizing: border-box; | box-sizing: border-box; | ||
font-family: Tahoma, "Segoe UI", Arial, sans-serif; | font-family: Tahoma, "Segoe UI", Arial, sans-serif; | ||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22); | |||
box-shadow: | |||
} | } | ||
| Linha 142: | Linha 134: | ||
height: 1px; | height: 1px; | ||
background: #5c4a31; | background: #5c4a31; | ||
margin: 8px -14px 10px; | margin: 8px -14px 10px; | ||
width: calc(100% + 28px); | width: calc(100% + 28px); | ||
| Linha 233: | Linha 224: | ||
} | } | ||
.item-tooltip-arrow { | .item-tooltip-arrow { | ||
display: block; | display: block; | ||
| Linha 254: | Linha 244: | ||
} | } | ||
.item-tooltip.tooltip-shift-right { | .item-tooltip.tooltip-shift-right { | ||
align-items: flex-start; | align-items: flex-start; | ||
| Linha 269: | Linha 258: | ||
.item-tooltip.tooltip-shift-left .item-tooltip-arrow { | .item-tooltip.tooltip-shift-left .item-tooltip-arrow { | ||
margin-right: var(--arrow-offset, 12px); | margin-right: var(--arrow-offset, 12px); | ||
} | } | ||
</style> | </style> | ||
| Linha 283: | Linha 268: | ||
var activeTip = null; | var activeTip = null; | ||
var activeWrapper = null; | var activeWrapper = null; | ||
function showTooltip(wrapper) { | |||
function | |||
hideTooltip(); | hideTooltip(); | ||
var tip = wrapper.querySelector(".item-tooltip"); | |||
if ( | if (!tip) return; | ||
activeWrapper = wrapper; | |||
activeTip = tip; | |||
tip.classList.add("tooltip-visible"); | tip.classList.add("tooltip-visible"); | ||
tip.style.visibility = "hidden"; | |||
tip.classList.remove("tooltip-below", "tooltip-shift-right", "tooltip-shift-left"); | tip.classList.remove("tooltip-below", "tooltip-shift-right", "tooltip-shift-left"); | ||
tip.style.removeProperty("--arrow-offset"); | tip.style.removeProperty("--arrow-offset"); | ||
document.body.appendChild(tip); | |||
var rect = wrapper.getBoundingClientRect(); | var rect = wrapper.getBoundingClientRect(); | ||
| Linha 491: | Linha 317: | ||
tip.style.top = top + "px"; | tip.style.top = top + "px"; | ||
tip.style.left = left + "px"; | tip.style.left = left + "px"; | ||
tip.style.visibility = ""; | |||
} | } | ||
function | function hideTooltip() { | ||
if (activeTip) { | if (activeTip && activeWrapper) { | ||
activeTip.remove(); | activeTip.classList.remove("tooltip-visible", "tooltip-below", "tooltip-shift-right", "tooltip-shift-left"); | ||
activeTip.style.top = ""; | |||
activeTip.style.left = ""; | |||
activeTip.style.visibility = ""; | |||
activeTip.style.removeProperty("--arrow-offset"); | |||
activeWrapper.appendChild(activeTip); | |||
activeTip = null; | activeTip = null; | ||
activeWrapper = null; | activeWrapper = null; | ||
} | } | ||
} | } | ||
document.addEventListener("mouseover", function (e) { | document.addEventListener("mouseover", function (e) { | ||
var wrapper = e.target.closest ? e.target.closest(".item-wrapper") : null; | var wrapper = e.target.closest ? e.target.closest(".item-wrapper") : null; | ||
if ( | if (wrapper && wrapper !== activeWrapper) { | ||
showTooltip(wrapper); | showTooltip(wrapper); | ||
} | } | ||
| Linha 587: | Linha 341: | ||
document.addEventListener("mouseout", function (e) { | document.addEventListener("mouseout", function (e) { | ||
if (!activeWrapper) return; | if (!activeWrapper) return; | ||
var wrapper = e.target.closest ? e.target.closest(".item-wrapper") : null; | var wrapper = e.target.closest ? e.target.closest(".item-wrapper") : null; | ||