Site notice
Welcome! Please check To-Do List to see what pages need help, who is working on what, etc.

Difference between revisions of "Module:Header"

From Mega Man Wiki
 
(30 intermediate revisions by 3 users not shown)
Line 27: Line 27:
end
end
local article_cell = mw.html.create( 'td' )
--[==[ if mw.site.namespaces ~= 0 and args["title"] ~= nil  then
     :css( 'width', '33%' )
quote_text = "[[" .. args["title"] .. "|Quotes]]"
    :wikitext( article_text )
else
   
quote_text = "Quotes"
    local category_cell = mw.html.create( 'td' )
end]==]
    :wikitext( category_text )
quote_text = "Quotes"
--[==[ if mw.site.namespaces ~= 0 and args["title"] ~= nil  then
walkthrough_text = "[[" .. args["title"] .. "|Walkthrough]]"
else
quote_text = "Walkthrough"
end]==]
walkthrough_text = "Walkthrough"
 
--[==[ if mw.site.namespaces ~= 0 and args["title"] ~= nil  then
walkthrough_text = "[[" .. args["title"] .. "|Damage_data]]"
else
quote_text = "damage_data"
end]==]
damage_data_text = "Damage data"
 
--[==[ if mw.site.namespaces ~= 0 and args["title"] ~= nil  then
quote_text = "[[" .. args["title"] .. "|Script]]"
else
quote_text = "Script"
end]==]
script_text = "Script"
local article_cell
local gallery_cell
local walkthrough_cell
local damage_data_cell
local quote_cell
local script_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 )
   
    walkthrough_cell = mw.html.create( 'span' )
    :wikitext( walkthrough_text )
   
    damage_data_cell = mw.html.create( 'span' )
    :wikitext( damage_data_text )
   
    quote_cell = mw.html.create( 'span' )
    :wikitext( quote_text )
   
    script_cell = mw.html.create( 'span' )
    :wikitext( script_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(walkthrough_cell) .. " • "
          .. tostring(damage_data_cell) .. " • "
          .. tostring(script_cell) .. " • "
          .. tostring(category_cell)
          ) 
     else
        t = mw.html.create( 'span' )
        :wikitext( tostring(article_cell)  .. " • "
          .. tostring(gallery_cell) .. " • "
            .. tostring(walkthrough_cell) .. " • "
          .. tostring(quote_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 )
   
    walkthrough_cell = mw.html.create( 'div' )
    :addClass('button')
    :wikitext( walkthrough_text )
   
    damage_data_cell = mw.html.create( 'div' )
    :addClass('button')
    :wikitext( damage_data_text )
   
    quote_cell = mw.html.create( 'div' )
    :addClass('button')
    :wikitext( quote_text )
   
    script_cell = mw.html.create( 'div' )
    :addClass('button')
    :wikitext( script_text )
   
    category_cell = mw.html.create( 'div' )
    :addClass('button')
    :wikitext( category_text )
      
      
     local gallery_cell = mw.html.create( 'td' )
     if args["subtype"] ~= nil and args["subtype"] == "game" then
    :css( 'width', '33%' )
        t = mw.html.create( 'div' )
    :wikitext( gallery_text )
          t:css( 'width', '100%' )
   
          t:css( 'margin-bottom', '0px;')
local row = mw.html.create( 'tr' )
          t:css( 'margin-top', '0px;')
    :wikitext( tostring(article_cell) .. tostring(category_cell) .. tostring(gallery_cell) )
          t:css( 'text-align', 'center;')
   
          :wikitext( tostring(article_cell)  
      
          .. tostring(gallery_cell)
local t = mw.html.create( 'table' )
            .. tostring(walkthrough_cell)
    t:addClass( "wikitable")
          .. tostring(damage_data_cell)  
    t:css( 'width', '100%' )
          .. tostring(script_cell)  
    t:css( 'margin-bottom', '0px;')
          .. tostring(category_cell)  
    t:wikitext( tostring(row) )
          ) 
 
     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)
            .. tostring(walkthrough_cell)
          .. tostring(quote_cell)  
          )
    end
        end
return tostring( t )
return tostring( t )
end
end


return p
return p

Latest revision as of 17:20, 14 December 2023

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 ~= 100 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
	
--[==[	if mw.site.namespaces ~= 0 and args["title"] ~= nil  then 
		quote_text = "[[" .. args["title"] .. "|Quotes]]" 
	else 
		quote_text = "Quotes" 
	end]==]
	
	quote_text = "Quotes" 
	
--[==[	if mw.site.namespaces ~= 0 and args["title"] ~= nil  then 
		walkthrough_text = "[[" .. args["title"] .. "|Walkthrough]]" 
	else 
		quote_text = "Walkthrough" 
	end]==]
	
	walkthrough_text = "Walkthrough" 

--[==[	if mw.site.namespaces ~= 0 and args["title"] ~= nil  then 
		walkthrough_text = "[[" .. args["title"] .. "|Damage_data]]" 
	else 
		quote_text = "damage_data" 
	end]==]
	
	damage_data_text = "Damage data" 

--[==[	if mw.site.namespaces ~= 0 and args["title"] ~= nil  then 
		quote_text = "[[" .. args["title"] .. "|Script]]" 
	else 
		quote_text = "Script" 
	end]==]
	
	script_text = "Script" 
	
	local article_cell 
	local gallery_cell
	local walkthrough_cell
	local damage_data_cell
	local quote_cell
	local script_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 )
	     
	    walkthrough_cell = mw.html.create( 'span' )
	     :wikitext( walkthrough_text )
	     
	    damage_data_cell = mw.html.create( 'span' )
	     :wikitext( damage_data_text )
	     
	    quote_cell = mw.html.create( 'span' )
	     :wikitext( quote_text )
	     
	    script_cell = mw.html.create( 'span' )
	     :wikitext( script_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(walkthrough_cell) .. " • "
	          	.. tostring(damage_data_cell) .. " • "
	          	.. tostring(script_cell) .. " • "
	          	.. tostring(category_cell) 
	          	)  
     else 
	        t = mw.html.create( 'span' )
	        	:wikitext( tostring(article_cell)  .. " • "
          	.. tostring(gallery_cell) .. " • "
            .. tostring(walkthrough_cell) .. " • "
          	.. tostring(quote_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 )
	     
	    walkthrough_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( walkthrough_text )
	     
	    damage_data_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( damage_data_text )
	     
	    quote_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( quote_text )
	     
	    script_cell = mw.html.create( 'div' )
	     :addClass('button')
	     :wikitext( script_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(walkthrough_cell) 
          	.. tostring(damage_data_cell) 
          	.. tostring(script_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) 
            .. tostring(walkthrough_cell) 
          	.. tostring(quote_cell) 
          )
     end
         end
return tostring( t )
end	

return p