Mudanças entre as edições de "Widget:Teste"

De Wiki Gla
Ir para navegação Ir para pesquisar
m
Etiqueta: Revertido
m (Limpou toda a página)
Etiquetas: Reversão manual anulando
Linha 1: Linha 1:
<!-- Widget:Teste — apenas CSS+JS para thumbs de GIF -->
<style>
/* Estilos isolados do “thumb fake” */
.gtr-thumb { margin: .5em 0; }
.gtr-thumb.tright  { float: right;  clear: right;  margin-left: 1.4em; }
.gtr-thumb.tleft  { float: left;  clear: left;  margin-right: 1.4em; }
.gtr-thumb.tcenter { float: none; display: table; margin: .5em auto; }


.gtr-thumb .thumbinner {
  border: 1px solid #a2a9b1;
  background-color: #f8f9fa;
  padding: 3px;
  text-align: center;
  display: inline-block;
  max-width: 100%;
  box-sizing: content-box; /* largura = img + 2px da borda */
}
.gtr-thumb .thumbimage {
  display: block;
  max-width: 100%;
  height: auto;
}
.gtr-thumb .thumbcaption {
  margin-top: 3px;
  font-size: 88%;
  color: #202122;
  line-height: 1.3;
}
</style>
<script>
/* Ajusta automaticamente a largura do .thumbinner quando o template
  não fixar width. Funciona para qualquer bloco .gtr-thumb na página. */
(function () {
  function fitOne(root) {
    try {
      var inner = root.querySelector('.thumbinner');
      var img  = root.querySelector('img.thumbimage');
      if (!inner || !img) return;
      var hasFixed = inner.getAttribute('style') && /width\s*:/.test(inner.getAttribute('style'));
      if (hasFixed) return;
      function fit() {
        var w = Math.round(img.getBoundingClientRect().width);
        if (w > 0) inner.style.width = (w + 2) + 'px'; // +2 pela borda (1px de cada lado)
      }
      if (img.complete) { fit(); }
      else { img.addEventListener('load', fit, { once: true }); }
      window.addEventListener('resize', fit);
    } catch (e) {}
  }
  function boot() {
    document.querySelectorAll('.gtr-thumb').forEach(fitOne);
  }
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', boot);
  } else {
    boot();
  }
})();
</script>

Edição das 02h08min de 14 de agosto de 2025