Mudanças entre as edições de "Widget:Larifk"
(Criou página com '.') |
Etiqueta: Revertido |
||
| Linha 1: | Linha 1: | ||
. | <div class="carousel-container"> | ||
<div class="carousel-track"> | |||
<div class="carousel-slide global-event-widget"> | |||
<a id="global-event-link" style="display: block;" href="https://wiki.gla.com.br/index.php/Eventos_Globais" target="_blank"> | |||
<img class="global-event-image" src="/images/0/0a/Anyevent.png" alt="Global Event"> | |||
</a> | |||
<div id="global-event-timer"></div> | |||
</div> | |||
<div class="carousel-slide worldboss-widget"> | |||
<a id="worldboss-link" style="display: block;" href="#" target="_blank"> | |||
<img class="worldboss-imagen" src="/images/9/93/Anywb_event.png"> | |||
</a> | |||
<div id="worldboss-timer"></div> | |||
</div> | |||
<div class="carousel-slide rankedd-widget"> | |||
<a id="ranked-link" style="display: block;" href="https://wiki.gla.com.br/index.php/PVP" target="_blank"> | |||
<img class="rankedd-image" src="/images/b/b0/Ranked_semranked_event.png" alt="Ranked Event"> | |||
</a> | |||
<div id="rankedd-timer"></div> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="carousel-controls-images"> | |||
<i class="fa-solid fa-star carousel-thumb active" data-index="0"></i> | |||
<i class="fa-solid fa-skull carousel-thumb" data-index="1"></i> | |||
<i class="fa-solid fa-shield-halved carousel-thumb" data-index="2"></i> | |||
</div> | |||
<script> | |||
(function(){ | |||
let globalEventsTimer,globalEventsImage,worldBossTimer,worldBossImage,rankedTimer,rankedImage; | |||
let globalEventsInterval,worldBossInterval,rankedInterval; | |||
let globalEventsInfo={}; | |||
const bossLinks={ | |||
"Aokiji_wb_event.png":"https://wiki.gla.com.br/index.php/Aokiji_(World_Boss)", | |||
"Barbanegra_wb_event.png":"https://wiki.gla.com.br/index.php/Barba_Negra", | |||
"Shai_hulud_wb_event.png":"https://wiki.gla.com.br/index.php/Shai-Hulud", | |||
"Plesiosaur_wb_event.png":"https://wiki.gla.com.br/index.php/Plesiosaur", | |||
"Mihawk_wb_event.png":"https://wiki.gla.com.br/index.php/Mihawk_(World_Boss)", | |||
"Bananawani_wb_event.png":"https://wiki.gla.com.br/index.php/Bananawani", | |||
"Byakko_wb_event.png":"https://wiki.gla.com.br/index.php/Byakko", | |||
"Hiking_bear_wb_event.png":"https://wiki.gla.com.br/index.php/Hiking_Bear" | |||
}; | |||
function bossLink(img,image){ | |||
const src=img||image; | |||
const file=src.split('/').pop(); | |||
const link=bossLinks[file]||'https://wiki.gla.com.br/index.php/World_Boss'; | |||
document.getElementById('worldboss-link').setAttribute('href',link); | |||
} | |||
function pad(v){return v<10?'0'+v:v} | |||
function getBrazilTime(){ | |||
const f=new Intl.DateTimeFormat('en-US',{ | |||
timeZone:'America/Sao_Paulo', | |||
hour12:false, | |||
year:'numeric', | |||
month:'2-digit', | |||
day:'2-digit', | |||
hour:'2-digit', | |||
minute:'2-digit', | |||
second:'2-digit' | |||
}) | |||
const parts=f.formatToParts(new Date()); | |||
const val=Object.fromEntries(parts.map(p=>[p.type,p.value])); | |||
return new Date( | |||
parseInt(val.year), | |||
parseInt(val.month)-1, | |||
parseInt(val.day), | |||
parseInt(val.hour), | |||
parseInt(val.minute), | |||
parseInt(val.second) | |||
) | |||
} | |||
function worldBossCountdown(start,end){ | |||
if(worldBossInterval)clearInterval(worldBossInterval); | |||
worldBossInterval=setInterval(()=>{ | |||
const now=getBrazilTime().getTime(); | |||
if(now<start){ | |||
const diff=start-now; | |||
const s=Math.floor(diff/1000); | |||
const h=Math.floor(s/3600); | |||
const m=Math.floor((s%3600)/60); | |||
const sec=s%60; | |||
worldBossTimer.innerHTML='Começa em: '+pad(h)+':'+pad(m)+':'+pad(sec) | |||
} | |||
else if(now>=start&&now<end){ | |||
const diff=end-now; | |||
const s=Math.floor(diff/1000); | |||
const h=Math.floor(s/3600); | |||
const m=Math.floor((s%3600)/60); | |||
const sec=s%60; | |||
worldBossTimer.innerHTML='Em andamento: '+pad(h)+':'+pad(m)+':'+pad(sec) | |||
} | |||
else{ | |||
clearInterval(worldBossInterval); | |||
worldBossTimer.innerHTML='Evento finalizado' | |||
} | |||
},1000) | |||
} | |||
async function obtenerImagenWorldBoss(modo='actual'){ | |||
try{ | |||
const r=await fetch('https://wiki.gla.com.br/index.php?title=Wbevents.json&action=raw') | |||
const data=await r.json() | |||
const events=data.world_boss_events | |||
const now=getBrazilTime().getTime() | |||
for(const d of Object.keys(events).sort()){ | |||
const [y,m,day]=d.split('-').map(Number) | |||
const start=new Date(y,m-1,day,11,0).getTime() | |||
const end=start+22*60*60*1000 | |||
if(modo==='actual'&&now>=start&&now<end)return events[d] | |||
if(modo==='proximo'&&now<start)return events[d] | |||
} | |||
}catch(e){} | |||
return null | |||
} | |||
function setWorldBossEvent(){ | |||
const now=getBrazilTime() | |||
const today=now.getDay() | |||
c | |||
Edição das 16h00min de 13 de março de 2026
<script>
(function(){
let globalEventsTimer,globalEventsImage,worldBossTimer,worldBossImage,rankedTimer,rankedImage; let globalEventsInterval,worldBossInterval,rankedInterval; let globalEventsInfo={};
const bossLinks={ "Aokiji_wb_event.png":"https://wiki.gla.com.br/index.php/Aokiji_(World_Boss)", "Barbanegra_wb_event.png":"https://wiki.gla.com.br/index.php/Barba_Negra", "Shai_hulud_wb_event.png":"https://wiki.gla.com.br/index.php/Shai-Hulud", "Plesiosaur_wb_event.png":"https://wiki.gla.com.br/index.php/Plesiosaur", "Mihawk_wb_event.png":"https://wiki.gla.com.br/index.php/Mihawk_(World_Boss)", "Bananawani_wb_event.png":"https://wiki.gla.com.br/index.php/Bananawani", "Byakko_wb_event.png":"https://wiki.gla.com.br/index.php/Byakko", "Hiking_bear_wb_event.png":"https://wiki.gla.com.br/index.php/Hiking_Bear" };
function bossLink(img,image){ const src=img||image; const file=src.split('/').pop(); const link=bossLinks[file]||'https://wiki.gla.com.br/index.php/World_Boss'; document.getElementById('worldboss-link').setAttribute('href',link); }
function pad(v){return v<10?'0'+v:v}
function getBrazilTime(){
const f=new Intl.DateTimeFormat('en-US',{ timeZone:'America/Sao_Paulo', hour12:false, year:'numeric', month:'2-digit', day:'2-digit', hour:'2-digit', minute:'2-digit', second:'2-digit' })
const parts=f.formatToParts(new Date()); const val=Object.fromEntries(parts.map(p=>[p.type,p.value]));
return new Date( parseInt(val.year), parseInt(val.month)-1, parseInt(val.day), parseInt(val.hour), parseInt(val.minute), parseInt(val.second) )
}
function worldBossCountdown(start,end){
if(worldBossInterval)clearInterval(worldBossInterval);
worldBossInterval=setInterval(()=>{
const now=getBrazilTime().getTime();
if(now<start){
const diff=start-now; const s=Math.floor(diff/1000);
const h=Math.floor(s/3600); const m=Math.floor((s%3600)/60); const sec=s%60;
worldBossTimer.innerHTML='Começa em: '+pad(h)+':'+pad(m)+':'+pad(sec)
}
else if(now>=start&&now<end){
const diff=end-now; const s=Math.floor(diff/1000);
const h=Math.floor(s/3600); const m=Math.floor((s%3600)/60); const sec=s%60;
worldBossTimer.innerHTML='Em andamento: '+pad(h)+':'+pad(m)+':'+pad(sec)
}
else{
clearInterval(worldBossInterval); worldBossTimer.innerHTML='Evento finalizado'
}
},1000)
}
async function obtenerImagenWorldBoss(modo='actual'){
try{
const r=await fetch('https://wiki.gla.com.br/index.php?title=Wbevents.json&action=raw') const data=await r.json()
const events=data.world_boss_events
const now=getBrazilTime().getTime()
for(const d of Object.keys(events).sort()){
const [y,m,day]=d.split('-').map(Number)
const start=new Date(y,m-1,day,11,0).getTime() const end=start+22*60*60*1000
if(modo==='actual'&&now>=start&&now<end)return events[d] if(modo==='proximo'&&now<start)return events[d]
}
}catch(e){}
return null
}
function setWorldBossEvent(){
const now=getBrazilTime()
const today=now.getDay()
c