Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Clickable button 2: Difference between revisions

Content added Content deleted
(fix data.style variable name)
(formatting tweaks)
Line 6: Line 6:


function p.main(frame)
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Clickable button 2'})
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Clickable button 2'
})
return p.luaMain(args)
return p.luaMain(args)
end
end
Line 47: Line 49:
local success, linkTitle = pcall(mw.title.new, args[1])
local success, linkTitle = pcall(mw.title.new, args[1])
if success and mw.title.equals(currentTitle, linkTitle) then
if success and mw.title.equals(currentTitle, linkTitle) then
if class == 'ui-button-blue' or class == 'mw-ui-progressive' then
if class == 'ui-button-blue'
or class == 'mw-ui-progressive'
then
data.backgroundColor = '#2962CB'
data.backgroundColor = '#2962CB'
elseif class == 'ui-button-green' or class == 'mw-ui-constructive' then
elseif class == 'ui-button-green'
or class == 'mw-ui-constructive'
then
data.backgroundColor = '#008B6D'
data.backgroundColor = '#008B6D'
elseif class == 'ui-button-red' or class == 'mw-ui-destructive' then
elseif class == 'ui-button-red'
or class == 'mw-ui-destructive'
then
data.backgroundColor = '#A6170F'
data.backgroundColor = '#A6170F'
else
else
Line 61: Line 69:
end
end


-- Get the link and display values, and find whether we are outputting a wikilink or a URL.
-- Get the link and display values, and find whether we are outputting a
-- wikilink or a URL.
if args.url then
if args.url then
data.isUrl = true
data.isUrl = true
Cookies help us deliver our services. By using our services, you agree to our use of cookies.