Module:User contrib
Appearance
![]() | This Lua module is used on approximately 5,200 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
![]() | This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
Usage
Implements {{User contrib}}
local p = {}
local Userbox = require('Module:Userbox')
local getArgs = require('Module:Arguments').getArgs
function p.contrib(frame, args)
if not args then
args = getArgs(frame)
end
local count = tonumber(args[1])
local username = args[2] or mw.title.getCurrentTitle().baseText
local id_fc, id_c, info_fc, info_c
if count < 5000 then id_fc = '#ffffff'; id_c = '#186A3B'; info_fc = '#000000'; info_c = '#1D8348'
elseif count < 10000 then id_fc = '#ffffff'; id_c = '#1D8348'; info_fc = '#000000'; info_c = '#239B56'
elseif count < 15000 then id_fc = '#ffffff'; id_c = '#239B56'; info_fc = '#000000'; info_c = '#28B463'
elseif count < 20000 then id_fc = '#000000'; id_c = '#28B463'; info_fc = '#000000'; info_c = '#2ECC71'
elseif count < 25000 then id_fc = '#000000'; id_c = '#2ECC71'; info_fc = '#ffffff'; info_c = '#58D68D'
elseif count < 30000 then id_fc = '#ffffff'; id_c = '#1B4F72'; info_fc = '#000000'; info_c = '#2874A6'
elseif count < 35000 then id_fc = '#ffffff'; id_c = '#2874A6'; info_fc = '#000000'; info_c = '#3498DB'
elseif count < 40000 then id_fc = '#ffffff'; id_c = '#3498DB'; info_fc = '#000000'; info_c = '#85C1E9'
elseif count < 45000 then id_fc = '#000000'; id_c = '#85C1E9'; info_fc = '#000000'; info_c = '#D6EAF8'
elseif count < 50000 then id_fc = '#000000'; id_c = '#D6EAF8'; info_fc = '#ffffff'; info_c = '#1B4F72'
-- https://htmlcolorcodes.com/
elseif count < 55000 then id_fc = '#ffffff'; id_c = '#4A235A'; info_fc = '#000000'; info_c = '#6C3483'
elseif count < 60000 then id_fc = '#ffffff'; id_c = '#6C3483'; info_fc = '#000000'; info_c = '#8E44AD'
elseif count < 65000 then id_fc = '#ffffff'; id_c = '#8E44AD'; info_fc = '#000000'; info_c = '#BB8FCE'
elseif count < 70000 then id_fc = '#000000'; id_c = '#BB8FCE'; info_fc = '#000000'; info_c = '#E8DAEF'
elseif count < 75000 then id_fc = '#000000'; id_c = '#E8DAEF'; info_fc = '#ffffff'; info_c = '#4A235A'
elseif count < 80000 then id_fc = '#000000'; id_c = '#dddddd'; info_fc = '#000000'; info_c = '#eeeeee'
elseif count < 85000 then id_fc = '#000000'; id_c = '#dddddd'; info_fc = '#000000'; info_c = '#eeeeee'
elseif count < 90000 then id_fc = '#ffffff'; id_c = '#000000'; info_fc = '#000000'; info_c = '#eeeeee'
elseif count < 95000 then id_fc = '#000000'; id_c = '#dddddd'; info_fc = '#000000'; info_c = '#eeeeee'
elseif count < 100000 then id_fc = '#000000'; id_c = '#33FFFF'; info_fc = '#000000'; info_c = '#99FFFF'
else id_fc = '#000000'; id_c = '#dddddd'; info_fc = '#000000'; info_c = '#eeeeee'
end
local user_args = {}
user_args['info-c'] = info_c
user_args['id-c'] = id_c
user_args['info-fc'] = info_fc
user_args['id-fc'] = id_fc
user_args['id'] = args[1] .. '+'
user_args['info'] = 'This user has made [https://xtools.wmflabs.org/ec/en.wikipedia.org/'..username..' more than' .. args[1] .. 'contributions] to Wikipedia.'
return Userbox.main('_userbox', user_args)
end
return p
-- if modular < 5000 then font_color = '#f00'
-- elseif modular < 10000 then font_color = '#0f0'
-- elseif modular < 15000 then font_color = '#00f'
-- elseif modular < 20000 then font_color = '#f0f'
-- else font_color = '#0ff'
-- end
-- if count < 25000 then bg_color = '#eeeeee' id_color = '#dddddd'
-- elseif count < 50000 then bg_color = '#dddddd'; id_color = '#ccc'
-- elseif count < 75000 then bg_color = '#ccc'; id_color = '#bbb'
-- else bg_color = '#bbb'; id_color = '#aaa'
-- end