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

De Wiki Gla
Ir para navegação Ir para pesquisar
m
m
 
(303 revisões intermediárias por 3 usuários não estão sendo mostradas)
Linha 1: Linha 1:
<div class="home-button-container">
<div id="fc-carousel" style="position:relative; max-width:700px; margin:16px auto; border-radius:8px; overflow:hidden; background:#1a1a2e;">
  <!-- Card 1 -->
   <div id="fc-label" style="text-align:center; padding:8px 40px; color:#fff; font-weight:bold; font-size:14px;"></div>
   <div class="home-button-item">
  <div id="fc-track" style="display:flex; transition:transform 0.4s ease;">
    <a href="/index.php/Personagens" title="Personagens">
    <!--slides are injected by JS-->
      <div class="home-button-image">
        <img src="https://wiki.gla.com.br/images/a/a8/Personagens_card.png" alt="Personagens">
      </div>
      <div class="home-button-title">PERSONAGENS</div>
    </a>
   </div>
   </div>
 
   <div id="fc-prev" style="position:absolute; top:50%; left:8px; transform:translateY(-50%); width:32px; height:32px; background:rgba(0,0,0,0.6); border-radius:50%; cursor:pointer; display:flex; align-items:center; justify-content:center; z-index:2; user-select:none;" role="button" tabindex="0">
  <!-- Card 2 -->
    <span style="color:#fff; font-size:18px; line-height:1;">&#10094;</span>
   <div class="home-button-item">
    <a href="/index.php/Itens" title="Itens">
      <div class="home-button-image">
        <img src="https://wiki.gla.com.br/images/3/39/Itens_card.png" alt="Itens">
      </div>
      <div class="home-button-title">ITENS</div>
    </a>
   </div>
   </div>
 
   <div id="fc-next" style="position:absolute; top:50%; right:8px; transform:translateY(-50%); width:32px; height:32px; background:rgba(0,0,0,0.6); border-radius:50%; cursor:pointer; display:flex; align-items:center; justify-content:center; z-index:2; user-select:none;" role="button" tabindex="0">
  <!-- Card 3 -->
    <span style="color:#fff; font-size:18px; line-height:1;">&#10095;</span>
   <div class="home-button-item">
    <a href="/index.php/Boss_Semanais" title="Semanais">
      <div class="home-button-image">
        <img src="https://wiki.gla.com.br/images/6/65/Weeklyboss_card.png" alt="Weekly Bosses">
      </div>
      <div class="home-button-title">SEMANAIS</div>
    </a>
   </div>
   </div>
</div>


  <!-- Card 4 -->
<script>
   <div class="home-button-item">
(function() {
     <a href="/index.php/World_Boss" title="World Bosses">
  var slides = [];
      <div class="home-button-image">
   var raw = [
        <img src="https://wiki.gla.com.br/images/8/87/Worldboss_card.png" alt="World Bosses">
    { img: "{{{img1|}}}", label: "{{{label1|}}}" },
      </div>
     { img: "{{{img2|}}}", label: "{{{label2|}}}" },
      <div class="home-button-title">WORLD BOSS</div>
    { img: "{{{img3|}}}", label: "{{{label3|}}}" },
     </a>
    { img: "{{{img4|}}}", label: "{{{label4|}}}" },
   </div>
    { img: "{{{img5|}}}", label: "{{{label5|}}}" },
    { img: "{{{img6|}}}", label: "{{{label6|}}}" },
    { img: "{{{img7|}}}", label: "{{{label7|}}}" },
     { img: "{{{img8|}}}", label: "{{{label8|}}}" }
   ];


   <div class="home-button-item">
   for (var i = 0; i < raw.length; i++) {
     <a href="/index.php/Wanted_Pirates" title="Piratas Procurados">
     if (raw[i].img && raw[i].img.length > 0) {
      <div class="home-button-image">
       slides.push(raw[i]);
        <img src="https://wiki.gla.com.br/images/9/9d/Wantedpirates_card.png" alt="Wanted Pirates">
     }
       </div>
   }
      <div class="home-button-title">WANTED PIRATES</div>
    </a>
  </div>
 
  <div class="home-button-item">
    <a href="/wiki/NolandTales" title="Noland Tales">
      <div class="home-button-image">
        <img src="URL_DA_IMAGEM_NOLAND" alt="Noland Tales">
      </div>
      <div class="home-button-title">NOLAND TALES</div>
     </a>
   </div>


   <div class="home-button-item">
   if (slides.length === 0) return;
    <a href="/wiki/NolandTales" title="Noland Tales">
      <div class="home-button-image">
        <img src="URL_DA_IMAGEM_NOLAND" alt="Noland Tales">
      </div>
      <div class="home-button-title">NOLAND TALES</div>
    </a>
  </div>


   <div class="home-button-item">
   var current = 0;
    <a href="/wiki/NolandTales" title="Noland Tales">
  var interval = 3000;
      <div class="home-button-image">
  var timer = null;
        <img src="URL_DA_IMAGEM_NOLAND" alt="Noland Tales">
  var paused = false;
      </div>
      <div class="home-button-title">NOLAND TALES</div>
    </a>
  </div>
</div>
<style>
  .home-button-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 10px;
    box-sizing: border-box;
  }


   .home-button-item {
   var carousel = document.getElementById('fc-carousel');
    position: relative;
  var track = document.getElementById('fc-track');
    overflow: hidden;
  var label = document.getElementById('fc-label');
    border: 1px solid #ddd;
  var prevBtn = document.getElementById('fc-prev');
    border-radius: 8px;
  var nextBtn = document.getElementById('fc-next');
    background: #fff;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
  }


   .home-button-item:hover {
   function getFileUrl(filename) {
     border-color: #007bff;
     var base = mw && mw.config ? mw.config.get('wgScript') : '/index.php';
     box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
     return base + '?title=Especial:FilePath/' + encodeURIComponent(filename);
   }
   }


   .home-button-item a {
   for (var i = 0; i < slides.length; i++) {
     display: block;
    var div = document.createElement('div');
     text-decoration: none;
    div.style.cssText = 'flex:0 0 100%; text-align:center; padding:4px; box-sizing:border-box;';
     color: inherit;
    var img = document.createElement('img');
    img.src = getFileUrl(slides[i].img);
     img.style.cssText = 'max-width:100%; height:auto; display:block; margin:0 auto; border-radius:4px;';
    img.alt = slides[i].label || '';
     div.appendChild(img);
     track.appendChild(div);
   }
   }


   .home-button-image {
   function goTo(index) {
     width: 100%;
    if (index < 0) index = slides.length - 1;
     aspect-ratio: 16/9;
    if (index >= slides.length) index = 0;
     overflow: hidden;
     current = index;
     track.style.transform = 'translateX(-' + (current * 100) + '%)';
     label.textContent = slides[current].label || '';
   }
   }


   .home-button-image img {
   function startTimer() {
     width: 100%;
     stopTimer();
     height: 100%;
     timer = setInterval(function() {
    object-fit: cover;
      if (!paused) goTo(current + 1);
    display: block;
     }, interval);
     transition: transform 0.2s ease;
   }
   }


   .home-button-item:hover .home-button-image img {
   function stopTimer() {
     transform: scale(1.01);
     if (timer) { clearInterval(timer); timer = null; }
   }
   }


   .home-button-title {
   prevBtn.addEventListener('click', function() { goTo(current - 1); startTimer(); });
    font-weight: bold;
  nextBtn.addEventListener('click', function() { goTo(current + 1); startTimer(); });
    font-size: 1.1em;
    background: #fff;
    color: #000;
    margin: 0;
    padding: 10px 5px;
    position: relative;
    text-transform: uppercase;
    border-top: 1px solid #ddd;
    text-align: center;
    transition: background-color 0.2s ease;
  }


   .home-button-item:hover .home-button-title {
   carousel.addEventListener('mouseenter', function() { paused = true; });
    background-color: #f9f9f9;
   carousel.addEventListener('mouseleave', function() { paused = false; });
   }


   @media (max-width: 1280px) {
   goTo(0);
    .home-button-container {
  startTimer();
      grid-template-columns: repeat(2, 1fr);
})();
    }
</script>
  }
</style>

Edição atual tal como às 23h10min de 16 de março de 2026

<script> (function() {

 var slides = [];
 var raw = [
   { img: "", label: "" },
   { img: "", label: "" },
   { img: "", label: "" },
   { img: "", label: "" },
   { img: "", label: "" },
   { img: "", label: "" },
   { img: "", label: "" },
   { img: "", label: "" }
 ];
 for (var i = 0; i < raw.length; i++) {
   if (raw[i].img && raw[i].img.length > 0) {
     slides.push(raw[i]);
   }
 }
 if (slides.length === 0) return;
 var current = 0;
 var interval = 3000;
 var timer = null;
 var paused = false;
 var carousel = document.getElementById('fc-carousel');
 var track = document.getElementById('fc-track');
 var label = document.getElementById('fc-label');
 var prevBtn = document.getElementById('fc-prev');
 var nextBtn = document.getElementById('fc-next');
 function getFileUrl(filename) {
   var base = mw && mw.config ? mw.config.get('wgScript') : '/index.php';
   return base + '?title=Especial:FilePath/' + encodeURIComponent(filename);
 }
 for (var i = 0; i < slides.length; i++) {
   var div = document.createElement('div');
   div.style.cssText = 'flex:0 0 100%; text-align:center; padding:4px; box-sizing:border-box;';
   var img = document.createElement('img');
   img.src = getFileUrl(slides[i].img);
   img.style.cssText = 'max-width:100%; height:auto; display:block; margin:0 auto; border-radius:4px;';
   img.alt = slides[i].label || ;
   div.appendChild(img);
   track.appendChild(div);
 }
 function goTo(index) {
   if (index < 0) index = slides.length - 1;
   if (index >= slides.length) index = 0;
   current = index;
   track.style.transform = 'translateX(-' + (current * 100) + '%)';
   label.textContent = slides[current].label || ;
 }
 function startTimer() {
   stopTimer();
   timer = setInterval(function() {
     if (!paused) goTo(current + 1);
   }, interval);
 }
 function stopTimer() {
   if (timer) { clearInterval(timer); timer = null; }
 }
 prevBtn.addEventListener('click', function() { goTo(current - 1); startTimer(); });
 nextBtn.addEventListener('click', function() { goTo(current + 1); startTimer(); });
 carousel.addEventListener('mouseenter', function() { paused = true; });
 carousel.addEventListener('mouseleave', function() { paused = false; });
 goTo(0);
 startTimer();

})(); </script>