VOOZH about

URL: https://minecraft.wiki/w/Module:ForceAnimate

⇱ Module:ForceAnimate – Minecraft Wiki


Module:ForceAnimate

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[create] [purge]
This module has no documentation. If you know how to use this module, please create it.
localp={}
functionp.base(f)
localargs=f
iff==mw.getCurrentFrame()then
args=require('Module:ProcessArgs').merge(true)
else
f=mw.getCurrentFrame()
end
localcssText={}
localfile=''
locallink=args['link']
localclass=args['class']
localoption={}
localcaption=''
-- Image argument parser --
localmatch_patterns={
['^([0-9]+)x([0-9]+)px$']='WxH',
['^([0-9]+)px$']='width',
['^x([0-9]+)px$']='height',
['^right$']='right',
['^left$']='left',
['^center$']='center',
['^none$']='none',
['^thumb$']='thumb',
['^frame$']='frame',
}
localfunctionparse_args(value)
localmatch=false
forp,tinpairs(match_patterns)
do
localm,n=string.match(value,p)
ifmthen
ift=="WxH"andnthen
option['width']=m
option['height']=n
elseift=="width"then
option['width']=m
elseift=="height"then
option['height']=m
elseifstring.find(" left right ",m)then
option['float']=m
elseift=="frame"then
option['frame']=true
option['thumb']=true
else
option[m]=true
end
match=true
end
end
returnmatch
end
-- Parse arguments --
fork,vinpairs(args)
do
localnum=tonumber(k)
ifnumthen
ifnum==1then
file=v
else
ifnotparse_args(v)then
caption=v
end
end
end
end
iffile==''then
return''
end
ifoption['thumb']andnotoption['width']andnotoption['height']then
ifoption['frame']then
option['width']='300'
else
option['width']='180'
end
end
ifoption['width']then
cssText.width=tostring(option['width'])..'px'
end
ifoption['height']then
cssText.height=tostring(option['height'])..'px'
end
ifnotoption['thumb']then
ifoption['float']then
cssText.float=option['float']
elseifoption['center']then
cssText.display='table'
cssText.margin='0 auto'
elseifoption['none']then
cssText.display='block'
cssText.margin='auto'
else
cssText.display='inline-block'
end
end
-- Generate HTML --
localdiv=mw.html.create((option['float']oroption['thumb'])and'div'or'span')
:addClass('nothumb')
ifoption['none']then
div:addClass('floatnone')
end
localwikitext='[[File:'..mw.text.trim(file)
iflinkthen
wikitext=wikitext..'|link='..link
end
ifclassthen
wikitext=wikitext..
'|class='..class
end
wikitext=wikitext..']]'
ifoption['thumb']then
div:addClass('thumb')
ifoption['float']=='left'then
div:addClass('tleft')
else
div:addClass('tright')
end
localfigure=div:tag('div')
figure:addClass('thumbinner')
figure:css('display',"block")
localfigimage=figure:tag('div')
figimage:addClass('thumbimage')
figimage:wikitext(wikitext)
cssText.display="block"
figimage:css(cssText)
localfigcaption=figure:tag('div')
figcaption:addClass('thumbcaption')
-- Magnify icon --
ifoption['thumb']andnotoption['frame']then
localmagnify=figcaption:tag('div')
magnify:addClass('magnify')
magnify:wikitext('[[:File:'..mw.text.trim(file)..']]')
end
-- Caption --
figcaption:wikitext(caption)
else
div:wikitext(wikitext)
div:css(cssText)
end
returntostring(div)
end
returnp
Retrieved from "https://minecraft.wiki/w/Module:ForceAnimate?oldid=2377301"

Navigation menu