FANDOM


--<source lang="lua">
-- http://c.wikia.com/wiki/User:Vuh
-- {{#invoke:Crosspath|main|link=|file=filename}}
-- ex. {{#invoke:Crosspath|main|link=pl.elderscrolls|file=Wiki-wordmark.png|size=100}}
p={}
local m=require("Module:MD5")
local e=mw.loadData("Module:Crosspath/data")
 
function p.c(v)
	local s,r=pcall(function() return e[mw.ustring.lower(v)] end)
	return s and r or v
end
 
function p.m(v1,v2)
	return mw.ustring.sub(m.sumhexa(v1),1,v2)
end
 
function p.main(frame)
	local u,f='',''
	local d=mw.html.create('div')
	local a=frame.args
	local i,n=mw.ustring.match(p.c(a.link),"(.*)%.(.*)")
	if not a.hack then f=('#.'..mw.ustring.match(a.file,"%.(.*)")) or '' end
	if not i and not n then n=p.c(a.link) end
	if not n then n='' end
	if not i then i='' end
	a.file=a.file:gsub(' ','_')
 
	if a.size then
		u=u..'/scale-to-width-down/'..a.size
	end
	if a["scale-to-width"] then
		u=u..'/scale-to-width/'..a["scale-to-width"]
	end
	if a["scale-to-height-down"] then
		u=u..'/scale-to-height-down/'..a["scale-to-height-down"]
	end
	if a["fixed-aspect-ratio-width"] and a["fixed-aspect-ratio-height"] then
		u=u..'/fixed-aspect-ratio/width/'..a["fixed-aspect-ratio-width"]..'/height/'..a["fixed-aspect-ratio-height"]
	end
	if a["fixed-aspect-ratio-down-width"] and a["fixed-aspect-ratio-down-height"] then
		u=u..'/fixed-aspect-ratio-down/width/'..a["fixed-aspect-ratio-down-width"]..'/height/'..a["fixed-aspect-ratio-down-height"]
	end
	if a["thumbnail-width"] and a["thumbnail-height"] then
		u=u..'/thumbnail/width/'..a["thumbnail-width"]..'/height/'..a["thumbnail-height"]
	end
	if a["thumbnail-down-width"] and a["thumbnail-down-height"] then
		u=u..'/thumbnail-down/width/'..a["thumbnail-down-width"]..'/height/'..a["thumbnail-down-height"]
	end
	if a["top-crop-width"] and a["top-crop-height"] then
		u=u..'/top-crop/width/'..a["top-crop-width"]..'/height/'..a["top-crop-height"]
	end
	if a["top-crop-down-width"] and a["top-crop-down-height"] then
		u=u..'/top-crop-down/width/'..a["top-crop-down-width"]..'/height/'..a["top-crop-down-height"]
	end
	if a["window-crop-width"] and a["window-crop-x-offset"] and a["window-crop-y-offset"] and a["window-crop-window-width"] and a["window-crop-window-height"] then
		u=u..'/window-crop/width/'..a["window-crop-width"]..'/x-offset/'..a["window-crop-x-offset"]..'/y-offset/'..a["window-crop-y-offset"]..'/window-width/'..a["window-crop-window-width"]..'/window-height/'..a["window-crop-window-height"]
	end
	if a["window-crop-fixed-width"] and a["window-crop-fixed-x-offset"] and a["window-crop-fixed-y-offset"] and a["window-crop-fixed-window-width"] and a["window-crop-fixed-window-height"] then
		u=u..'/window-crop-fixed/width/'..a["window-crop-fixed-width"]..'/x-offset/'..a["window-crop-fixed-x-offset"]..'/y-offset/'..a["window-crop-fixed-y-offset"]..'/window-width/'..a["window-crop-fixed-window-width"]..'/window-height/'..a["window-crop-fixed-window-height"]
	end
	if a["zoom-crop-width"] and a["zoom-crop-height"] then
		u=u..'/zoom-crop/width/'..a["zoom-crop-width"]..'/height/'..a["zoom-crop-height"]
	end
	if a["zoom-crop-down-width"] and a["zoom-crop-down-height"] then
		u=u..'/zoom-crop-down/width/'..a["zoom-crop-down-width"]..'/height/'..a["zoom-crop-down-height"]
	end
 
	if a.fill then c='&fill='..a.fill else c='' end
 
	v='http://vignette.wikia.nocookie.net/'..n..'/images/'..p.m(a.file,1)..'/'..p.m(a.file,2)..'/'..a.file..'/revision/latest'..u..'?path-prefix='..i..c..f
 
	if a.align then
		if a.align == 'center' then
			return d:css('width','100%'):css('text-align',a.align):css('margin-right','auto'):css('margin-left','auto'):css('clear','both'):wikitext(v)
		else
			return d:css('float',a.align):css('clear',a.align):wikitext(v)
		end
	else
		return v
	end
end
 
return p
--</source>

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Więcej z Fandomu

Losowa wiki