Anonymous
×
Create a new article
Write your page title here:
We currently have 15 articles on TwistedFates Database. Type your article name above or click on one of the titles below and start writing!



TwistedFates Database
15Articles

MediaWiki:Common.css and Module:Navbar: Difference between pages

(Difference between pages)
No edit summary
 
m (1 revision imported)
 
Line 1: Line 1:
/* CSS placed here will be applied to all skins */
local p = {}
/*MediaWiki:Common.css*/
local cfg = mw.loadData('Module:Navbar/configuration')


/* changes the background color of the bottom and left of each page, up to behind half of the logo */
local function get_title_arg(is_collapsible, template)
local title_arg = 1
if is_collapsible then title_arg = 2 end
if template then title_arg = 'template' end
return title_arg
end


body {
local function choose_links(template, args)
background-image: url(/w/resources/assets/ambrosiapattern.jpg);
-- The show table indicates the default displayed items.
background-repeat: repeat;
-- view, talk, edit, hist, move, watch
font-family: 'Roboto Mono', monospace;
-- TODO: Move to configuration.
font-weight:500;
local show = {true, true, true, false, false, false}
}
if template then
show[2] = false
show[3] = false
local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6,
talk = 2, edit = 3, hist = 4, move = 5, watch = 6}
-- TODO: Consider removing TableTools dependency.
for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do
local num = index[v]
if num then show[num] = true end
end
end


local remove_edit_link = args.noedit
if remove_edit_link then show[3] = false end
return show
end


/* changes the background color behind the top half of the logo and at top of each page */
local function add_link(link_description, ul, is_mini, font_style)
local l
if link_description.url then
l = {'[', '', ']'}
else
l = {'[[', '|', ']]'}
end
ul:tag('li')
:addClass('nv-' .. link_description.full)
:wikitext(l[1] .. link_description.link .. l[2])
:tag(is_mini and 'abbr' or 'span')
:attr('title', link_description.html_title)
:cssText(font_style)
:wikitext(is_mini and link_description.mini or link_description.full)
:done()
:wikitext(l[3])
:done()
end


#mw-page-base {background: #0A0A0A}
local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)
if not title then
error(cfg.invalid_title .. title_text)
end
local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''
-- TODO: Get link_descriptions and show into the configuration module.
-- link_descriptions should be easier...
local link_descriptions = {
{ ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template',
['link'] = title.fullText, ['url'] = false },
{ ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template',
['link'] = talkpage, ['url'] = false },
{ ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template',
['link'] = title:fullUrl('action=edit'), ['url'] = true },
{ ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template',
['link'] = title:fullUrl('action=history'), ['url'] = true },
{ ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template',
['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true },
{ ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template',
['link'] = title:fullUrl('action=watch'), ['url'] = true }
}


local ul = mw.html.create('ul')
if has_brackets then
ul:addClass(cfg.classes.brackets)
:cssText(font_style)
end
for i, _ in ipairs(displayed_links) do
if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end
end
return ul:done()
end


/****Edit Link Appearance****/
function p._navbar(args)
-- TODO: We probably don't need both fontstyle and fontcolor...
local font_style = args.fontstyle
local font_color = args.fontcolor
local is_collapsible = args.collapsible
local is_mini = args.mini
local is_plain = args.plain
local collapsible_class = nil
if is_collapsible then
collapsible_class = cfg.classes.collapsible
if not is_plain then is_mini = 1 end
if font_color then
font_style = (font_style or '') .. '; color: ' .. font_color .. ';'
end
end
local navbar_style = args.style
local div = mw.html.create():tag('div')
div
:addClass(cfg.classes.navbar)
:addClass(cfg.classes.plainlinks)
:addClass(cfg.classes.horizontal_list)
:addClass(collapsible_class) -- we made the determination earlier
:cssText(navbar_style)


div#mw-panel div.portal div.body ul li a {
if is_mini then div:addClass(cfg.classes.mini) end
color: #e4A732;
font-size: 16px;
}


div#mw-panel div.portal div.body ul li a:hover {
local box_text = (args.text or cfg.box_text) .. ' '
text-decoration: none;
-- the concatenated space guarantees the box text is separated
color: #a178a6 !important;
if not (is_mini or is_plain) then
}
div
:tag('span')
:addClass(cfg.classes.box_text)
:cssText(font_style)
:wikitext(box_text)
end
local template = args.template
local displayed_links = choose_links(template, args)
local has_brackets = args.brackets
local title_arg = get_title_arg(is_collapsible, template)
local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle())
local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
div:node(list)


div#mw-panel div.portal div.body ul li a:visited {color: #e4a732}
if is_collapsible then
local title_text_class
if is_mini then
title_text_class = cfg.classes.collapsible_title_mini
else
title_text_class = cfg.classes.collapsible_title_full
end
div:done()
:tag('div')
:addClass(title_text_class)
:cssText(font_style)
:wikitext(args[1])
end
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = cfg.templatestyles }
} .. tostring(div:done())
end


.ve-activated #catlinks a, a.new:visited, #p-personal a.new:visited{color:#E4A732}
function p.navbar(frame)
a:link{
return p._navbar(require('Module:Arguments').getArgs(frame))
color: #e4a732;
end
text-decoration: none;
}


@media screen {
return p
    a {
color: #e4a732;
text-decoration: none !important;
}
 
a:hover {
color: #a178a6 !important;
}
 
div.vectorTabs span > a {
    float: left;
    display: block;
color: #fefde2;
font-weight: 800;
font-size: 14px;
border: none;
}
 
div.vectorTabs li.selected a, div.vectorTabs li.selected a:visited {
color: #fefde2;
font-weight: 800;
text-shadow:
  -.5px -.5px 0 #000,
    .5px -.5px 0 #000,
    -.5px .5px 0 #000,
    .5px .5px 0 #000;
font-size: 16px;
border: none;
}
 
div.vectorTabs li a {
color: #fefde2;
font-weight: 800;
font-size: 14px;
        background-color: #200D24;
}
 
div.vectorTabs li a:hover {
color: #a178a6;
        background-color: #200D24;
}
 
div.vectorTabs li.new a, div.vectorTabs li.new a:visited {
background-color: #200D24;
border: none;
}
 
a:visited{color:#e4a732}
 
/*Edit Gallery Appearance*/
 
ul.mw-gallery-packed-hover li.gallerybox:hover div.gallerytextwrapper, ul.mw-gallery-packed-overlay li.gallerybox div.gallerytextwrapper, ul.mw-gallery-packed-hover li.gallerybox.mw-gallery-focused div.gallerytextwrapper{background-color:rgba(0,0,0,0.3)}
 
 
/*Edit Table Appearance*/
 
table.wikitable > ,tr > th, table.wikitable > tr > td, table.wikitable > * > tr > th, table.wikitable > * > tr > td{border: 0 !important;
border-radius: 4px !important;
padding: 3px !important;}
table.wikitable {
border: 0;
}
th {
border: 0;
background-color: rgba(255,255,255,0.0);
}
tr{
border: 0;
}
 
 
/*Edit UI Appearance*/
#wpSaveWidget{
background-color: #e4a732;
border: 0;
border-radius: 4px;
}
 
 
/*Edit DIV Appearance*/
 
.catlinks{
background-color: rgba(255,255,255,0.3);
border: 0;
border-radius: 4px;
padding-left: 5%;
}
 
div.thumbinner, table.wikitable, tbody, .toc, .mw-warning, .toccolours {
    border: 0;
    background-color: rgba(255,255,255,0.4) !important;
    padding: 5px;
    font-size: 95%;
    border-radius: 4px;
    color: #200D24;
}
 
#content {background-color: #200D24}
 
#mw-content-text {background-color: #200D24;
color: #EFF6F8;}
.mw-editform .editOptions{
background-color: rgba(255,255,255,0.4) !important;
border: 0 !important;
border-radius: 4px !important;
}
.mw-body .firstHeading {
color: #fefde2;
font-family: 'Roboto Mono', monospace;
text-shadow:
  -.5px -.5px 0 #000,
    .5px -.5px 0 #000,
    -.5px .5px 0 #000,
    .5px .5px 0 #000;
}
div#mw-panel{position:fixed}
 
/*Edit List Appearance*/
div.vectorTabs ul li {background-color: #200D24;
border: 0;
}
div.vectorTabs li{border-radius: 4px 4px 0px 0px}
div.vectorTabs{
background-image: none;
background-color: transparent;}
 
div.vectorTabs li.selected {background-color: #200D24;
border: 0;
}
 
 
/*Edit Global Text Appearance*/
 
div#mw-panel div.portal
h3 {
    display: block;
    font-size: 1.17em;
color: #fefde2;
    -webkit-margin-before: 3px;
    -webkit-margin-after: 3px;
    -webkit-margin-start: 0px;
    -webkit-margin-end: 0px;
    font-weight: bold;
text-align: center;
}
.mw-body{border:none;
color: #fff;
}
h1, h2, h3, h4, h5 {
font-family: 'Roboto Mono', monospace !important;
font-weight: bold;
color: #EFF6F8;
}
.mw-body h1, .mw-body-content h1, .mw-body-content h2 {
  font-family: 'Roboto Mono', monospace !important;
font-weight: bold;
color: #EFF6F8;
}
 
 
/* OTHER CONFIGURATIONS */
 
/** Hide Main Page Heading **/
h1#firstHeading.firstHeading{
display: none;
margin-top: -5%;
}
 
 
 
/* TAB MODIFICATIONS */
 
/**** VECTOR TABS & VECTOR MENU ****/
 
.vector-menu-tabs, .vector-menu-tabs a, #mw-head .vector-menu-dropdown h3 {
background-color: #200D24 !important;
background-image: none !important;
border-radius: 4px;
}
 
 
  /*Remove annoying white shit around edges of the tabs*/
.vector-menu-tabs li
{
background-image: none;
}
 
.vector-menu-tabs .selected{
background: none;
}
 
  /* remove borders between tabs */
    span {
        background: none;
 
        /* move tab text up */
        a {
            padding-top: 1em;
            height: 2.25em;
        }
 
    }
 
}
 
/* hide "read" tab */
#ca-view {
    display: none;
}

Revision as of 21:14, 21 May 2021

Lua error: callParserFunction: function "#translation" was not found.

Module Quality

[[Category:Modules{{#translation:}}]]


local p = {}
local cfg = mw.loadData('Module:Navbar/configuration')

local function get_title_arg(is_collapsible, template)
	local title_arg = 1
	if is_collapsible then title_arg = 2 end
	if template then title_arg = 'template' end
	return title_arg
end

local function choose_links(template, args)
	-- The show table indicates the default displayed items.
	-- view, talk, edit, hist, move, watch
	-- TODO: Move to configuration.
	local show = {true, true, true, false, false, false}
	if template then
		show[2] = false
		show[3] = false
		local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6,
			talk = 2, edit = 3, hist = 4, move = 5, watch = 6}
		-- TODO: Consider removing TableTools dependency.
		for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do
			local num = index[v]
			if num then show[num] = true end
		end
	end

	local remove_edit_link = args.noedit
	if remove_edit_link then show[3] = false end
	
	return show
	
end

local function add_link(link_description, ul, is_mini, font_style)
	local l
	if link_description.url then
		l = {'[', '', ']'}
	else
		l = {'[[', '|', ']]'}
	end
	ul:tag('li')
		:addClass('nv-' .. link_description.full)
		:wikitext(l[1] .. link_description.link .. l[2])
		:tag(is_mini and 'abbr' or 'span')
			:attr('title', link_description.html_title)
			:cssText(font_style)
			:wikitext(is_mini and link_description.mini or link_description.full)
			:done()
		:wikitext(l[3])
		:done()
end

local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
	
	local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)
	if not title then
		error(cfg.invalid_title .. title_text)
	end
	local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''
	
	-- TODO: Get link_descriptions and show into the configuration module.
	-- link_descriptions should be easier...
	local link_descriptions = {
		{ ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template',
			['link'] = title.fullText, ['url'] = false },
		{ ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template',
			['link'] = talkpage, ['url'] = false },
		{ ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template',
			['link'] = title:fullUrl('action=edit'), ['url'] = true },
		{ ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template',
			['link'] = title:fullUrl('action=history'), ['url'] = true },
		{ ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template',
			['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true },
		{ ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', 
			['link'] = title:fullUrl('action=watch'), ['url'] = true }
	}

	local ul = mw.html.create('ul')
	if has_brackets then
		ul:addClass(cfg.classes.brackets)
			:cssText(font_style)
	end
	
	for i, _ in ipairs(displayed_links) do
		if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end
	end
	return ul:done()
	
end

function p._navbar(args)
	
	-- TODO: We probably don't need both fontstyle and fontcolor...
	local font_style = args.fontstyle
	local font_color = args.fontcolor
	local is_collapsible = args.collapsible
	local is_mini = args.mini
	local is_plain = args.plain
	
	local collapsible_class = nil
	if is_collapsible then
		collapsible_class = cfg.classes.collapsible
		if not is_plain then is_mini = 1 end
		if font_color then
			font_style = (font_style or '') .. '; color: ' .. font_color .. ';'
		end
	end
	
	local navbar_style = args.style
	local div = mw.html.create():tag('div')
	div
		:addClass(cfg.classes.navbar)
		:addClass(cfg.classes.plainlinks)
		:addClass(cfg.classes.horizontal_list)
		:addClass(collapsible_class) -- we made the determination earlier
		:cssText(navbar_style)

	if is_mini then div:addClass(cfg.classes.mini) end

	local box_text = (args.text or cfg.box_text) .. ' '
	 -- the concatenated space guarantees the box text is separated
	if not (is_mini or is_plain) then
		div
			:tag('span')
				:addClass(cfg.classes.box_text)
				:cssText(font_style)
				:wikitext(box_text)
	end
	
	local template = args.template
	local displayed_links = choose_links(template, args)
	local has_brackets = args.brackets
	local title_arg = get_title_arg(is_collapsible, template)
	local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle())
	local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
	div:node(list)

	if is_collapsible then
		local title_text_class
		if is_mini then
			title_text_class = cfg.classes.collapsible_title_mini
		else
			title_text_class = cfg.classes.collapsible_title_full
		end
		div:done()
			:tag('div')
			:addClass(title_text_class)
			:cssText(font_style)
			:wikitext(args[1])
	end
	
	return mw.getCurrentFrame():extensionTag{
		name = 'templatestyles', args = { src = cfg.templatestyles }
	} .. tostring(div:done())
end

function p.navbar(frame)
	return p._navbar(require('Module:Arguments').getArgs(frame))
end

return p