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

De Wiki Gla
Ir para navegação Ir para pesquisar
 
(13 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
local p = {}
  <widget>
 
  <div style="background:#21223a; border-radius:10px; padding:15px; width:350px; color:#f1e9d3; font-family:sans-serif;">
function p.render(frame)
     <div style="display:flex; align-items:center; margin-bottom:10px;">
    -- pega parâmetros
      <div style="width:60px; height:60px; border-radius:8px; overflow:hidden; background:#252736; margin-right:10px;">
    local args = frame:getParent().args
        <img src="{{{imagem|https://via.placeholder.com/60}}}" alt="Imagem da criatura" style="width:60px; height:60px;">
    local imagem  = args.imagem  or ""
      </div>
     local selo    = args.selo    or ""
      <div>
    local tag      = args.tag      or "NOVO"
        <div style="font-size:1.3em; font-weight:bold; color:#f7de72;">{{{nome|Criatura}}}</div>
    local titulo  = args.titulo  or "Título"
         <div style="font-size:1em; color:#b0b0b0;">{{{tipo|Tipo desconhecido}}}</div>
    local subtitulo= args.subtitulo or "Capítulo"
         <div style="font-size:0.94em; color:#67b06a; margin-top:2px;">{{{habitat|Habitat desconhecido}}}</div>
    local data    = args.data    or "Hoje"
        <div style="font-size:0.97em; color:#e55a5a;">Perigo: {{{perigo|?}}}</div>
    local botao    = args.botao    or "Ler agora"
      </div>
    local link    = args.link    or "#"
     </div>
 
     <div style="margin-top:10px;">
    -- constrói HTML
      <div style="background:#171821; border-radius:8px; padding:8px 10px; margin-bottom:6px;">
    local html = mw.html.create("div")
        <span style="font-weight:bold; color:#f7de72;">Drops</span><br />
         :addClass("widget-capitulo")
        <span style="font-size:0.98em;">{{{drops|Sem drops.}}}</span>
         :css("background-image", "url(" .. mw.uri.encode(mw.title.makeTitle("File", imagem).fullUrl) .. ")")
      </div>
 
     </div>
    -- barra superior
  </div>
    local top = html:tag("div"):addClass("top-bar")
  </widget>
    if selo ~= "" then
 
        top:tag("div"):addClass("chip"):wikitext(selo)
  ----
     end
 
     if tag ~= "" then
  ==Predefinição:Bestiario==
        top:tag("div"):addClass("chip novo"):wikitext(tag)
  <pre>
    end
  {{#invoke:Widget|render|Gb
 
  |nome={{{nome|}}}
    -- gradiente
  |imagem={{{imagem|}}}
    html:tag("div"):addClass("gradient")
  |tipo={{{tipo|}}}
 
  |habitat={{{habitat|}}}
    -- textos
  |perigo={{{perigo|}}}
    local text = html:tag("div"):addClass("text")
  |drops={{{drops|}}}
    text:tag("div"):addClass("title"):wikitext(titulo)
  }}
     text:tag("div"):addClass("subtitle"):wikitext(subtitulo)
  </pre>
    text:tag("div"):addClass("date"):wikitext(data)
 
    -- botão
    html:tag("a")
        :addClass("button")
        :attr("href", link)
        :wikitext(botao)
 
    return tostring(html)
end
 
return p

Edição atual tal como às 06h23min de 16 de novembro de 2025

 <widget>
       <img src="https://via.placeholder.com/60" alt="Imagem da criatura" style="width:60px; height:60px;">
Criatura
Tipo desconhecido
Habitat desconhecido
Perigo: ?
       Drops
Sem drops.
 </widget>
 
 ----
 
 ==Predefinição:Bestiario==
  {{#invoke:Widget|render|Gb
  |nome={{{nome|}}}
  |imagem={{{imagem|}}}
  |tipo={{{tipo|}}}
  |habitat={{{habitat|}}}
  |perigo={{{perigo|}}}
  |drops={{{drops|}}}
  }}