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

De Wiki Gla
Ir para navegação Ir para pesquisar
Etiqueta: Reversão manual
Linha 1: Linha 1:
<div style="background: linear-gradient(90deg, #1f3d2c, #56947a);
local p = {}
border-radius: 8px;
 
padding: 15px;
function p.render(frame)
color: #ffffff;
    -- pega parâmetros
font-family: sans-serif;
    local args = frame:getParent().args
font-size: 14px;
    local imagem  = args.imagem  or ""
margin: 8px 100;">
    local selo    = args.selo    or ""
<div style="font-weight: bold; color: #9ef59b; display: flex; align-items: center; gap: 6px;">
    local tag      = args.tag      or "NOVO"
🔔 Aviso
    local titulo  = args.titulo  or "Título"
</div>
    local subtitulo= args.subtitulo or "Capítulo"
<hr style="border: none; border-top: 1px solid rgba(255,255,255,0.2); margin: 8px 0;">
    local data    = args.data    or "Hoje"
<div style="text-align: center; line-height: 1.5;">
    local botao    = args.botao    or "Ler agora"
Mensagem de aviso teste  teste teste teste teste teste teste teste
    local link    = args.link    or "#"
</div>
 
</div>
    -- constrói HTML
    local html = mw.html.create("div")
        :addClass("widget-capitulo")
        :css("background-image", "url(" .. mw.uri.encode(mw.title.makeTitle("File", imagem).fullUrl) .. ")")
 
    -- barra superior
    local top = html:tag("div"):addClass("top-bar")
    if selo ~= "" then
        top:tag("div"):addClass("chip"):wikitext(selo)
    end
    if tag ~= "" then
        top:tag("div"):addClass("chip novo"):wikitext(tag)
    end
 
    -- gradiente
    html:tag("div"):addClass("gradient")
 
    -- textos
    local text = html:tag("div"):addClass("text")
    text:tag("div"):addClass("title"):wikitext(titulo)
    text:tag("div"):addClass("subtitle"):wikitext(subtitulo)
    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 das 00h39min de 27 de agosto de 2025

local p = {}

function p.render(frame)

   -- pega parâmetros
   local args = frame:getParent().args
   local imagem   = args.imagem   or ""
   local selo     = args.selo     or ""
   local tag      = args.tag      or "NOVO"
   local titulo   = args.titulo   or "Título"
   local subtitulo= args.subtitulo or "Capítulo"
   local data     = args.data     or "Hoje"
   local botao    = args.botao    or "Ler agora"
   local link     = args.link     or "#"
   -- constrói HTML
   local html = mw.html.create("div")
       :addClass("widget-capitulo")
       :css("background-image", "url(" .. mw.uri.encode(mw.title.makeTitle("File", imagem).fullUrl) .. ")")
   -- barra superior
   local top = html:tag("div"):addClass("top-bar")
   if selo ~= "" then
       top:tag("div"):addClass("chip"):wikitext(selo)
   end
   if tag ~= "" then
       top:tag("div"):addClass("chip novo"):wikitext(tag)
   end
   -- gradiente
   html:tag("div"):addClass("gradient")
   -- textos
   local text = html:tag("div"):addClass("text")
   text:tag("div"):addClass("title"):wikitext(titulo)
   text:tag("div"):addClass("subtitle"):wikitext(subtitulo)
   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