Homepage
Games
News
News βΎ
All
Transfers
Drama
Business
Sponsors
Mergers
Investors
Hires
Companies
More
People
Tournaments
Brands
Brands βΎ
Companies
Organizations
Sponsors
Other
Locations
Search
Editing
Module:OpeningTimes
From TwogPedia
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local getArgs = require('Module:Arguments').getArgs local Times = {} function Times.main(frame) local args = getArgs(frame) local openingTimesIconHtml = '[[File:Work-hours-icon.png|30px|alt=Opening Times Icon]]' local container = mw.html.create('div'):addClass('container') container:node(mw.html.create('div'):addClass('news-icon'):wikitext(openingTimesIconHtml .. ' <span>Work hours </span>')) local tableContainer = mw.html.create('table'):addClass('striped-table') local headerRow = mw.html.create('tr'):addClass('headerRow') :node(mw.html.create('th'):wikitext('Day')) :node(mw.html.create('th'):wikitext('Opens')) :node(mw.html.create('th'):wikitext('Closes')) tableContainer:node(headerRow) local monday = Times.createRow('Monday') local tuesday = Times.createRow('Tuesday') local wednesday = Times.createRow('Wednesday') local thursday = Times.createRow('Thursday') local friday = Times.createRow('Friday') local saturday = Times.createRow('Saturday') local sunday = Times.createRow('Sunday') if args[247] or args.everyday then local openingTime, closingTime = '00:00', '00:00' if args.everyday then local splitTime = mw.text.split(args.everyday, '-') openingTime = splitTime[1] closingTime = splitTime[2] end if args.monday == nil then monday:node(Times.setTime(openingTime)):node(Times.setTime(closingTime)) end if args.tuesday == nil then tuesday:node(Times.setTime(openingTime)):node(Times.setTime(closingTime)) end if args.wednesday == nil then wednesday:node(Times.setTime(openingTime)):node(Times.setTime(closingTime)) end if args.thursday == nil then thursday:node(Times.setTime(openingTime)):node(Times.setTime(closingTime)) end if args.friday == nil then friday:node(Times.setTime(openingTime)):node(Times.setTime(closingTime)) end if args.saturday == nil then saturday:node(Times.setTime(openingTime)):node(Times.setTime(closingTime)) end if args.sunday == nil then sunday:node(Times.setTime(openingTime)):node(Times.setTime(closingTime)) end else if args.weekdays then local splitTime = mw.text.split(args.weekdays, '-') if args.monday == nil then monday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.tuesday == nil then tuesday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.wednesday == nil then wednesday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.thursday == nil then thursday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.friday == nil then friday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end end if args.weekend then local splitTime = mw.text.split(args.weekend, '-') if args.saturday == nil then saturday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.sunday == nil then sunday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end end end if args.monday then local splitTime = mw.text.split(args.monday, '-') monday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.tuesday then local splitTime = mw.text.split(args.tuesday, '-') tuesday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.wednesday then local splitTime = mw.text.split(args.wednesday, '-') wednesday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.thursday then local splitTime = mw.text.split(args.thursday, '-') thursday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.friday then local splitTime = mw.text.split(args.friday, '-') friday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.saturday then local splitTime = mw.text.split(args.saturday, '-') saturday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end if args.sunday then local splitTime = mw.text.split(args.sunday, '-') sunday:node(Times.setTime(splitTime[1])):node(Times.setTime(splitTime[2])) end -- Check if no times have been added to a day if string.find(tostring(monday), 'td') == nil then monday:node(mw.html.create('td'):addClass('tc'):attr('colspan', 2):wikitext('Closed')) end if string.find(tostring(tuesday), 'td') == nil then tuesday:node(mw.html.create('td'):addClass('tc'):attr('colspan', 2):wikitext('Closed')) end if string.find(tostring(wednesday), 'td') == nil then wednesday:node(mw.html.create('td'):addClass('tc'):attr('colspan', 2):wikitext('Closed')) end if string.find(tostring(thursday), 'td') == nil then thursday:node(mw.html.create('td'):addClass('tc'):attr('colspan', 2):wikitext('Closed')) end if string.find(tostring(friday), 'td') == nil then friday:node(mw.html.create('td'):addClass('tc'):attr('colspan', 2):wikitext('Closed')) end if string.find(tostring(saturday), 'td') == nil then saturday:node(mw.html.create('td'):addClass('tc'):attr('colspan', 2):wikitext('Closed')) end if string.find(tostring(sunday), 'td') == nil then sunday:node(mw.html.create('td'):addClass('tc'):attr('colspan', 2):wikitext('Closed')) end return container:node(tableContainer:node(monday):node(tuesday):node(wednesday):node(thursday):node(friday):node(saturday):node(sunday)) end function Times.createRow(text) return mw.html.create('tr'):addClass('bodyRow'):node(mw.html.create('th'):attr('scope', 'row'):wikitext(text)) end function Times.setTime(timeStr) return mw.html.create('td'):wikitext(Times.editTime(timeStr)) end function Times.editTime(str) if str == 'Late' or str == 'TBD' then return str end -- If string already has : in it if string.find(str, ':') then if #mw.text.split(str, ':')[1] == 1 then str = '0' .. str end return str else if #str == 1 then str = '0' .. str end return str .. ':00' end end return Times
Summary:
Please note that all contributions to TwogPedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TwogPedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Template used on this page:
Module:OpeningTimes/doc
(
edit
)
No categories
Edit