62 737
modifications
mAucun résumé des modifications |
mAucun résumé des modifications |
||
Ligne 6 : | Ligne 6 : | ||
local DEFAULT_SIZE = 'normal' | local DEFAULT_SIZE = 'normal' | ||
local STANDARD_SIZE = { | local STANDARD_SIZE = { | ||
normal = ' | normal = '18', | ||
grand = ' | grand = '24', | ||
big = ' | big = '24' | ||
} | } | ||
function buildIcon(args) | function p.buildIcon(args) | ||
local name = args[1] or DEFAULT_ICON_NAME | local name = args[1] or DEFAULT_ICON_NAME | ||
local link = args['lien'] or args['link'] or '' | local link = args['lien'] or args['link'] or '' | ||
Ligne 19 : | Ligne 19 : | ||
local tooltip = args['infobulle'] or args['tooltip'] or icon.tooltip | local tooltip = args['infobulle'] or args['tooltip'] or icon.tooltip | ||
local | -- Calcul des dimensions | ||
size = STANDARD_SIZE[size | local userSize = args[2] or DEFAULT_SIZE | ||
local size = STANDARD_SIZE[userSize] | |||
if not size then | |||
size = userSize:gsub('[px]', '') | |||
size = tonumber(size) | |||
if not size then | |||
size = STANDARD_SIZE[DEFAULT_SIZE] | |||
end | |||
end | |||
return tostring(mw.html.create('span') | return tostring(mw.html.create('span') | ||
:css('cursor', 'help') | :css('cursor', 'help') | ||
:attr('title', tooltip) | :attr('title', tooltip) | ||
:wikitext('[[Fichier:'..filename..'|'..size..'x'..size..'px|link='..link..']]') | :wikitext('[[Fichier:'..filename..'|'..size..'x'..size..'px|link='..link..'|alt=]]') | ||
:allDone()) | :allDone()) | ||
end | end | ||
Ligne 65 : | Ligne 73 : | ||
function p.build(frame) | function p.build(frame) | ||
return buildIcon(require('Module:Outils').extractArgs(frame)) | return buildIcon(require( 'Module:Outils' ).extractArgs(frame)) | ||
end | end | ||
return p | return p |
modifications