Mudanças entre as edições de "Widget:Gb"
Ir para navegação
Ir para pesquisar
Etiqueta: Reversão manual |
|||
| Linha 1: | Linha 1: | ||
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 | |||
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