Welcome to the Lylat Wiki, all about the Star Fox series! If you'd like to help out, please take a look at our community portal.

Module:Header

From Lylat Wiki, your source on Star Fox information. By Fans, for Fans.
Jump to navigationJump to search

Documentation for this module may be created at Module:Header/doc

local p = {} --p stands for package

function p.header(frame)
	-- A passthrough that gets args from the frame and all
	mArguments = require('Module:Arguments')
	args = mArguments.getArgs(frame)
	return p._header(args)
end

function p._header(args, options) 
	if mw.site.namespaces ~= 502 and args["title"] ~= nil then 
		gallery_text = "[[Gallery:" .. args["title"] .. "|Gallery]]" 
	else 
		gallery_text = "Gallery" 
	end
	
	if mw.site.namespaces ~= 14 and args["title"] ~= nil then 
		category_text = "[[:Category:" .. args["title"] .. "|Category]]" 
	else 
		category_text = "Category" 
	end
	
	if mw.site.namespaces ~= 0 and args["title"] ~= nil  then 
		article_text = "[[" .. args["title"] .. "|Article]]" 
	else 
		article_text = "Article" 
	end
		
	local article_cell 
	local gallery_cell
	local category_cell
	local t
	
    if args["links-only"] ~= nil and args["links-only"] == "yes" then
		article_cell = mw.html.create( 'span' )
	     :wikitext( article_text )
	     
	     gallery_cell = mw.html.create( 'span' )
	     :wikitext( gallery_text )
	     
	     category_cell = mw.html.create( 'span' )
	     :wikitext( category_text )
		
		if args["subtype"] ~= nil and args["subtype"] == "game" then
	        t = mw.html.create( 'span' )
	        	:wikitext( tostring(article_cell) .. " • "
	          	.. tostring(gallery_cell) .. " • "
	          	.. tostring(category_cell) 
	          	)  
     else 
	        t = mw.html.create( 'span' )
	        	:wikitext( tostring(article_cell)  .. " • "
          	.. tostring(gallery_cell) .. " • "
          	)
		end
	else 
		article_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( article_text )
	     
	     gallery_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( gallery_text )
	     
	     category_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( category_text )
     
     if args["subtype"] ~= nil and args["subtype"] == "game" then
        t = mw.html.create( 'div' )
          t:css( 'width', '100%' )
          t:css( 'margin-bottom', '0px;')
          t:css( 'margin-top', '0px;')
          t:css( 'text-align', 'center;')
          :wikitext( tostring(article_cell) 
          	.. tostring(gallery_cell) 
          	.. tostring(category_cell) 
          	)  
     else 
      t = mw.html.create( 'div' )
          t:css( 'width', '100%' )
          t:css( 'margin-bottom', '0px;')
          t:css( 'margin-top', '0px;')
          t:css( 'text-align', 'center;')
          :wikitext( tostring(article_cell) 
          	.. tostring(gallery_cell) 
          )
     end
         end
return tostring( t )
end	

return p