"मोड्युल:Userbox" का संशोधनहरू बिचको अन्तर

Content deleted Content added
track bad colour contrast and userboxes in mainspace per protected edit request by User:Kephir
changes as per protected edit request by User:Kephir
पङ्क्ति २१५:
 
function p.render(data)
local legible = true
local contrast = require('Module:Color contrast')._ratio
 
-- Renders the userbox html using the content of the data table.
-- Render the div tag html.
Line २५४ ⟶ २५१:
:addClass(data.idClass)
:wikitext(data.id)
 
if contrast { data.idColor, data.idBackgroundColor, error = 0 } < 4.5 then
legible = false
end
end
 
Line २७३ ⟶ २६६:
:addClass(data.infoClass)
:wikitext(data.info)
 
if contrast { data.infoColor, data.backgroundColor, error = 0 } < 4.5 then
legible = false
end
-- Render the second id html.
Line २९३ ⟶ २८२:
:cssText(data.id2OtherParams)
:wikitext(data.id2)
end
 
if contrast { data.id2Color, data.id2BackgroundColor, error = 0 } < 4.5 then
local title = mw.title.getCurrentTitle()
if (title.namespace == 2) and not title.text:match("/") then
return tostring(root) -- regular user page
elseif title.namespace == 14 then
return tostring(root) -- category
end
 
local legible = true
local contrast = require('Module:Color contrast')._ratio
 
local function has_text(wikitext)
local function get_alt(text)
return text:match("|alt=([^|]*)") or ""
end
wikitext = wikitext:gsub("]]", "|]]")
wikitext = wikitext:gsub("%[%[%s*[Mm][Ee][Dd][Ii][Aa]%s*:[^|]-(|.-)]]", get_alt)
wikitext = wikitext:gsub("%[%[%s*[Ii][Mm][Aa][Gg][Ee]%s*:[^|]-(|.-)]]", get_alt)
wikitext = wikitext:gsub("%[%[%s*[Ff][Ii][Ll][Ee]%s*:[^|]-(|.-)]]", get_alt)
return mw.text.trim(wikitext) ~= ""
end
 
if contrast { data.infoColor, data.backgroundColor, error = 0 } < 4.5 then
legible = false
end
 
if data.showId and contrast { data.idColor, data.idBackgroundColor, error = 0 } < 4.5 then
if has_text(data.id or "") then
legible = false
end
end
 
if data.showId2 and contrast { data.id2Color, data.id2BackgroundColor, error = 0 } < 4.5 then
if has_text(data.id2 or "") then
legible = false
end
end
 
if not legible then
root:wikitext('[[Category:Potentially illegible userboxes]]')
"https://ne.wikipedia.org/wiki/मोड्युल:Userbox" बाट अनुप्रेषित