<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AArbcom_election_banner</id>
	<title>Module:Arbcom election banner - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AArbcom_election_banner"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Arbcom_election_banner&amp;action=history"/>
	<updated>2026-06-14T13:26:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:Arbcom_election_banner&amp;diff=470992&amp;oldid=prev</id>
		<title>Zoran: Moved page from wikipedia:en:Module:Arbcom election banner</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Arbcom_election_banner&amp;diff=470992&amp;oldid=prev"/>
		<updated>2021-07-08T19:18:22Z</updated>

		<summary type="html">&lt;p&gt;Moved page from &lt;a href=&quot;/index.php?title=Wikipedia:en:Module:Arbcom_election_banner&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Wikipedia:en:Module:Arbcom election banner (page does not exist)&quot;&gt;wikipedia:en:Module:Arbcom election banner&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local messageBox = require('Module:Message box')&lt;br /&gt;
local navbarModule = require('Module:Navbar')&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Get constants.&lt;br /&gt;
local lang = mw.language.getContentLanguage()&lt;br /&gt;
local currentUnixDate = lang:formatDate('U')&lt;br /&gt;
currentUnixDate = tonumber(currentUnixDate)&lt;br /&gt;
&lt;br /&gt;
local function err(msg)&lt;br /&gt;
	return mw.ustring.format('&amp;lt;b class=&amp;quot;error&amp;quot;&amp;gt;%s&amp;lt;/b&amp;gt;', msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getUnixDate(date)&lt;br /&gt;
	local success, unixDate = pcall(lang.formatDate, lang, 'U', date)&lt;br /&gt;
	if success then&lt;br /&gt;
		return tonumber(unixDate)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function unixDateError(date)&lt;br /&gt;
	return err(tostring(date) .. ' is not a valid date.')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function makeOmbox(oargs)&lt;br /&gt;
	return messageBox.main('ombox', oargs)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function makeNavbar(name)&lt;br /&gt;
	return navbarModule.navbar{name, mini = '1'}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function randomizeArray(t)&lt;br /&gt;
	-- Iterate through the array backwards, each time swapping the entry &amp;quot;i&amp;quot; with a random entry.&lt;br /&gt;
	-- Courtesy of Xinhuan at http://forums.wowace.com/showthread.php?p=279756&lt;br /&gt;
	math.randomseed(mw.site.stats.edits)&lt;br /&gt;
	for i = #t, 2, -1 do&lt;br /&gt;
		local r = math.random(i)&lt;br /&gt;
		t[i], t[r] = t[r], t[i]&lt;br /&gt;
	end&lt;br /&gt;
	return t&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getArgNums(args, prefix)&lt;br /&gt;
	-- Returns a table containing the numbers of the arguments that exist for the specified prefix. For example, if the prefix&lt;br /&gt;
	-- was 'data', and 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}.&lt;br /&gt;
	local nums = {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		k = tostring(k)&lt;br /&gt;
		local num = mw.ustring.match(k, '^' .. prefix .. '([1-9]%d*)$')&lt;br /&gt;
		if num then&lt;br /&gt;
			table.insert(nums, tonumber(num))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(nums)&lt;br /&gt;
	return nums&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function showBeforeDate(datePairs)&lt;br /&gt;
	-- Shows a value if it is before a given date.&lt;br /&gt;
	for i, datePair in ipairs(datePairs) do&lt;br /&gt;
		local date = datePair.date&lt;br /&gt;
		local val = datePair.val&lt;br /&gt;
		if not date then -- No date specified, so assume we have no more dates to process.&lt;br /&gt;
			return val&lt;br /&gt;
		end&lt;br /&gt;
		local unixDate = getUnixDate(date)&lt;br /&gt;
		if not unixDate then return unixDateError(date) end&lt;br /&gt;
		if currentUnixDate &amp;lt; unixDate then -- The specified date is in the future.&lt;br /&gt;
			return val&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function countdown(date, event)&lt;br /&gt;
	if type(event) ~= 'string' then return err('No event name provided.') end&lt;br /&gt;
	-- Get the current date unix timestamp.&lt;br /&gt;
	local unixDate = getUnixDate(date)&lt;br /&gt;
	if not unixDate then return unixDateError(date) end&lt;br /&gt;
	unixDate = tonumber(unixDate)&lt;br /&gt;
	-- Subtract the timestamp from the current unix timestamp to find the time left, and output that in a readable way.&lt;br /&gt;
	local secondsLeft = unixDate - currentUnixDate&lt;br /&gt;
	if secondsLeft &amp;lt;= 0 then return end&lt;br /&gt;
	local timeLeft = lang:formatDuration(secondsLeft, {'weeks', 'days', 'hours'})&lt;br /&gt;
	-- Find whether we are plural or not.&lt;br /&gt;
	local isOrAre&lt;br /&gt;
	if mw.ustring.match(timeLeft, '^%d+') == '1' then&lt;br /&gt;
		isOrAre = 'is'&lt;br /&gt;
	else&lt;br /&gt;
		isOrAre = 'are'&lt;br /&gt;
	end&lt;br /&gt;
	-- Make the numbers red and bold, because that's what {{countdown}} does and it makes them look important.&lt;br /&gt;
	local timeLeft = mw.ustring.gsub(timeLeft, '(%d+)', '&amp;lt;span style=&amp;quot;color: #F00; font-weight: bold;&amp;quot;&amp;gt;%1&amp;lt;/span&amp;gt;')&lt;br /&gt;
	-- Make the refresh link, and join it all together.&lt;br /&gt;
	local refreshLink = mw.title.getCurrentTitle():fullUrl{action = 'purge'}&lt;br /&gt;
	refreshLink = mw.ustring.format('&amp;lt;small&amp;gt;&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;([%s refresh])&amp;lt;/span&amp;gt;&amp;lt;/small&amp;gt;', refreshLink)&lt;br /&gt;
	return mw.ustring.format('There %s %s until %s. %s', isOrAre, timeLeft, event, refreshLink)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function collapse(s, heading, bg)&lt;br /&gt;
	local ret = [=[&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left: 0px;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;navbox collapsible collapsed&amp;quot; style=&amp;quot;background: transparent; text-align: left; border: 1px solid silver; margin-top: 0.2em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background-color: %s; text-align: center; font-size: 112%%;&amp;quot; | %s&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border: solid 1px silver; padding: 8px; background-color: white; font-size: 112%%;&amp;quot; | %s&lt;br /&gt;
|}&amp;lt;/div&amp;gt;]=]&lt;br /&gt;
	return mw.ustring.format(ret, bg or '#e0f8e2', heading, s)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(args)&lt;br /&gt;
	-- Get data for the box, plus the box title.&lt;br /&gt;
	local year = lang:formatDate('Y')&lt;br /&gt;
	local name = args.name or 'ACE' .. year&lt;br /&gt;
	local navbar = makeNavbar(name)&lt;br /&gt;
	local electionpage = args.electionpage or mw.ustring.format(&lt;br /&gt;
		'[[Wikipedia:Arbitration Committee Elections December %s|%s Arbitration Committee Elections]]',&lt;br /&gt;
		year, year&lt;br /&gt;
	)&lt;br /&gt;
	-- Get nomination or voting link, depending on the date.&lt;br /&gt;
	local beforenomlink = args.beforenomlink or mw.ustring.format('[[Wikipedia:Requests for comment/Arbitration Committee Elections December %s/Electoral Commission|Electoral Commission RFC]]', year)&lt;br /&gt;
	local nomstart = args.nomstart or error('No nomstart date supplied')&lt;br /&gt;
	local nomlink = args.nomlink or mw.ustring.format('[[Wikipedia:Arbitration Committee Elections December %s/Candidates|Nominate]]', year)&lt;br /&gt;
	local nomend = args.nomend or error('No nomend date supplied')&lt;br /&gt;
	local votestart = args.votestart or error('No votestart date supplied')&lt;br /&gt;
	local votepage = args.votepage or '[[Special:SecurePoll|Vote]]'&lt;br /&gt;
	local votelog = args.votelog or mw.ustring.format('[[Wikipedia:Arbitration Committee Elections December %s/Log|Voter log]]', year)&lt;br /&gt;
	local votelink = args.votelink or mw.ustring.format(&amp;quot;'''%s'''\n* %s&amp;quot;, votepage, votelog)&lt;br /&gt;
	local voteend = args.voteend or error('No voteend date supplied')&lt;br /&gt;
	local voteendlink = args.voteendlink or votelog&lt;br /&gt;
	local scheduleText = showBeforeDate{&lt;br /&gt;
		{val = beforenomlink, date = nomstart},&lt;br /&gt;
		{val = nomlink, date = nomend},&lt;br /&gt;
		{val = countdown(votestart, 'voting begins'), date = votestart},&lt;br /&gt;
		{val = votelink, date = voteend},&lt;br /&gt;
		{val = voteendlink}&lt;br /&gt;
	}&lt;br /&gt;
	-- Get other links.&lt;br /&gt;
	local contact = args.contact or mw.ustring.format('[[WT:COORD%s|Contact the coordinators]]', mw.ustring.sub(year, 3, 4))&lt;br /&gt;
	local discuss = args.discuss or mw.ustring.format('[[WT:ACE%s|Discuss the elections]]', year)&lt;br /&gt;
	local cguide = args.cguide or mw.ustring.format('[[Wikipedia:Arbitration Committee Elections December %s/Candidates/Guide|Candidate guide]]', year)&lt;br /&gt;
	local cstatements = args.cstatements or mw.ustring.format('[[Wikipedia:Arbitration Committee Elections December %s/Candidates|Candidate statements]]', year)&lt;br /&gt;
	local cquestions = args.cquestions or mw.ustring.format('[[Wikipedia:Arbitration Committee Elections December %s/Questions|Questions for the candidates]]', year)&lt;br /&gt;
	local cdiscuss = args.cdiscuss or mw.ustring.format('[[Wikipedia:Arbitration Committee Elections December %s/Candidates/Discussion|Discuss the candidates]]', year)&lt;br /&gt;
	-- Get voter guides&lt;br /&gt;
	local guideNums = getArgNums(args, 'guide')&lt;br /&gt;
	local guides = {}&lt;br /&gt;
	for _, num in ipairs(guideNums) do&lt;br /&gt;
		table.insert(guides, '\n* ' .. args['guide' .. tostring(num)])&lt;br /&gt;
	end&lt;br /&gt;
	guides = randomizeArray(guides)&lt;br /&gt;
	guides = table.concat(guides)&lt;br /&gt;
	guides = '&amp;lt;div class=&amp;quot;hlist&amp;quot;&amp;gt;\nThese [[:Category:Wikipedia Arbitration Committee Elections 2020 voter guides|guides]] represent the thoughts of their authors. All individually written voter guides are eligible for inclusion. Guides to other guides are ineligible.\n' .. guides .. '&amp;lt;/div&amp;gt;'&lt;br /&gt;
	guides = collapse(guides, 'Voter guides', '#e0f8e2')&lt;br /&gt;
	-- Get the text field of ombox.&lt;br /&gt;
	local text = [=[&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right&amp;quot;&amp;gt;%s&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;hlist&amp;quot;&amp;gt;&lt;br /&gt;
* '''%s'''&lt;br /&gt;
* %s&lt;br /&gt;
* %s&lt;br /&gt;
* %s&lt;br /&gt;
* [[Wikipedia:5-minute guide to ArbCom elections|Quick guide]]&amp;lt;/div&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;div class=&amp;quot;hlist&amp;quot;&amp;gt;&lt;br /&gt;
; Candidates&lt;br /&gt;
: %s&lt;br /&gt;
: %s&lt;br /&gt;
: %s&lt;br /&gt;
: %s&amp;lt;/div&amp;gt;&lt;br /&gt;
%s]=]&lt;br /&gt;
	text = mw.ustring.format(&lt;br /&gt;
		text,&lt;br /&gt;
		navbar,&lt;br /&gt;
		electionpage,&lt;br /&gt;
		scheduleText,&lt;br /&gt;
		contact,&lt;br /&gt;
		discuss,&lt;br /&gt;
		cguide,&lt;br /&gt;
		cstatements,&lt;br /&gt;
		cquestions,&lt;br /&gt;
		cdiscuss,&lt;br /&gt;
		guides&lt;br /&gt;
	)&lt;br /&gt;
	-- Build the ombox args&lt;br /&gt;
	local oargs = {}&lt;br /&gt;
	oargs.image = args.image or '[[File:Judges cupola.svg|50px|ArbCom|link=]]'&lt;br /&gt;
	oargs.style = args.style or 'background-color: #e0f8e2'&lt;br /&gt;
	oargs.text = text&lt;br /&gt;
	return makeOmbox(oargs)		&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
function p.main(frame)&lt;br /&gt;
        -- If called via #invoke, use the args passed into the invoking template, or the args passed to #invoke if any exist.&lt;br /&gt;
        -- Otherwise assume args are being passed directly in from the debug console or from another Lua module.&lt;br /&gt;
        local origArgs&lt;br /&gt;
        if frame == mw.getCurrentFrame() then&lt;br /&gt;
                origArgs = frame:getParent().args&lt;br /&gt;
                for k, v in pairs(frame.args) do&lt;br /&gt;
                        origArgs = frame.args&lt;br /&gt;
                        break&lt;br /&gt;
                end&lt;br /&gt;
        else&lt;br /&gt;
                origArgs = frame&lt;br /&gt;
        end&lt;br /&gt;
        -- Trim whitespace and remove blank arguments.&lt;br /&gt;
        local args = {}&lt;br /&gt;
        for k, v in pairs(origArgs) do&lt;br /&gt;
                if type(v) == 'string' then&lt;br /&gt;
                        v = mw.text.trim(v)&lt;br /&gt;
                end&lt;br /&gt;
                if v ~= '' then&lt;br /&gt;
                        args[k] = v&lt;br /&gt;
                end&lt;br /&gt;
        end&lt;br /&gt;
        return p._main(args)&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>