Module:Game: Difference between revisions

From StrategyWiki, the video game walkthrough and strategy guide wiki
24 bytes removed ,  5 September 2023
m
Protected "Module:Game": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
m (Undo revision 955748 by Prod (talk), not working)
Tag: Undo
m (Protected "Module:Game": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(24 intermediate revisions by 2 users not shown)
Line 22: Line 22:


local function renderCompletion()
local function renderCompletion()
if args.completion then
args.completion = args.completion or "0"
newRoot:wikitext(mw.getCurrentFrame():extensionTag(
if args.completion == "5" then
'indicator',
link = "[[:Category:Guides at completion stage 5|Featured]]"
"[[File:000" .. args.completion
else
.. ".svg|32px|This guide is at completion stage " .. args.completion  
link = "[[:Category:Guides at completion stage " .. args.completion .. "|Stage " .. args.completion .. "]]"
.. ". Click here for more information.|link=:Category:Guides at completion stage "  
.. args.completion .. "]]",
{ name = 'cs' } ) )
end
end
newRoot:wikitext(mw.getCurrentFrame():extensionTag(
'indicator',
"[[File:000" .. args.completion
.. ".svg|32px|This guide is at completion stage " .. args.completion
.. ". Click here for more information.|link=:Category:Guides at completion stage "
.. args.completion .. "]] " .. link,
{ name = 'cs' } ) )
end
end


Line 39: Line 43:
local seriesCat = mw.title.new( args.seriesDisambig, 14 )
local seriesCat = mw.title.new( args.seriesDisambig, 14 )
newRoot
newRoot
:wikitext("''This is the first game in the '''" .. seriesCat.text .. "''' series. For other games in the series see the [[:" .. seriesCat.prefixedText .. "|" .. seriesCat.text .. " category]].''" )
:wikitext("<p class='noexcerpt'>''This is the first game in the '''" .. seriesCat.text .. "''' series. For other games in the series see the [[:" .. seriesCat.prefixedText .. "|" .. seriesCat.text .. " category]].''</p>" )
end
end
end
end
Line 96: Line 100:
local function renderRows()
local function renderRows()
if args.japanese then addRow( {label = 'Japanese title', data = args.japanese} ) end
if args.japanese then addRow( {label = 'Japanese title', data = args.japanese} ) end
if args.distributor then addRow( {label = 'Distributor(s)', data = args.distributor} ) end
if args.designer then addRow( {label = 'Designer(s)', data = args.designer} ) end
if args.designer then addRow( {label = 'Designer(s)', data = args.designer} ) end
if not args.year then
addRow( { label = 'Release date(s)', labelstyle = 'white-space: nowrap;', data = args.released } )
end
addRow( { label = 'Genre(s)', data = args.genre, rowclass = 'mw-row-no-collapse' } )
addRow( { label = 'Genre(s)', data = args.genre, rowclass = 'mw-row-no-collapse' } )
if args.players then addRow( {label = 'Players', data = args.players} ) end
if args.players then addRow( {label = 'Players', data = args.players} ) end
Line 112: Line 112:
addRow( { label = 'Developer(s)', data = args.developer } )
addRow( { label = 'Developer(s)', data = args.developer } )
addRow( { label = 'Publisher(s)', data = args.publisher } )
addRow( { label = 'Publisher(s)', data = args.publisher } )
if args.year then
if args.year then dataYear = '[[:Category:' .. args.year .. '|' .. args.year .. ']]' else dataYear = "" end
addRow( { label = 'Year released', data = '[[:Category:' .. args.year .. '|' .. args.year .. ']]' } )
addRow( { label = 'Year released', data = dataYear } )
end
addRow( { label = 'System(s)', data = args.systems, rowclass = 'mw-row-no-collapse' } )
addRow( { label = 'System(s)', data = args.systems, rowclass = 'mw-row-no-collapse' } )
if args.expansion then addRow( { label = 'Expansion pack(s)', labelstyle = 'white-space: nowrap;', data = args.expansion } ) end
if args.expansion then addRow( { label = 'Expansion pack(s)', labelstyle = 'white-space: nowrap;', data = args.expansion } ) end
Line 150: Line 149:


local function renderSocialRows()
local function renderSocialRows()
local urlData, pcgwData, twitterData, facebookData, twitchData
local linksData = ''
 
local pagename = mw.uri.encode( mw.title.getCurrentTitle().text, "PATH" )
local pagename = mw.uri.encode( mw.title.getCurrentTitle().text, "PATH" )
linksData = linksData .. mw.getCurrentFrame():preprocess( '{{switcherlink}}' )


if args.website then
if args.website then
urlData = '<span class="img-ib-inline">[[File:Link icon.svg|x20px|link=' .. args.website .. '|' .. 'Official website]]</span>'
linksData = linksData .. '<span class="img-ib-inline">[[File:Link icon.svg|x20px|link=' .. args.website .. '|' .. 'Official website]]</span>'
else
urlData = ''
end
end


if args.pcgamingwiki then
if args.pcgamingwiki then
pcgwData = '<span class="img-ib-inline">[[File:PCGamingWikiLink.svg|x20px|link=pcgamingwiki:' .. args.pcgamingwiki .. '|' .. mw.title.getCurrentTitle().text .. ' at PCGamingWiki]]</span>'
linksData = linksData .. '<span class="img-ib-inline">[[File:PCGamingWikiLink.svg|x20px|link=pcgamingwiki:' .. args.pcgamingwiki .. '|' .. mw.title.getCurrentTitle().text .. ' at PCGamingWiki]]</span>'
else
pcgwData = ''
end
end


if args.twitch then
if args.twitch then
twitchData = '<span class="img-ib-inline">[[File:Twitch icon.png|x20px|link=https://www.twitch.tv/directory/game/' .. mw.uri.encode( args.twitch, "PATH" ) .. '|' .. args.twitch .. ' Channel]]</span>'
linksData = linksData .. '<span class="img-ib-inline">[[File:Twitch icon.png|x20px|link=https://www.twitch.tv/directory/game/' .. mw.uri.encode( args.twitch, "PATH" ) .. '|' .. args.twitch .. ' Channel]]</span>'
else
else
twitchData = '<span class="img-ib-inline img-greyscale">[[File:Twitch icon.png|x20px|link=https://www.twitch.tv/directory/game/' .. pagename .. '|' .. mw.title.getCurrentTitle().text .. ' Channel]]</span>'
linksData = linksData .. '<span class="img-ib-inline img-greyscale">[[File:Twitch icon.png|x20px|link=https://www.twitch.tv/directory/game/' .. pagename .. '|' .. mw.title.getCurrentTitle().text .. ' Channel]]</span>'
end
end


if args.twitter then
if args.twitter then
twitterData = '<span class="img-ib-inline">[[File:Twitter icon.png|x20px|link=https://twitter.com/' .. args.twitter .. '|' .. args.twitter .. ']]</span>'
linksData = linksData .. '<span class="img-ib-inline">[[File:Twitter icon.png|x20px|link=https://twitter.com/' .. args.twitter .. '|' .. args.twitter .. ']]</span>'
else
else
twitterData = '<span class="img-ib-inline img-greyscale">[[File:Twitter icon.png|x20px|link=https://twitter.com/search?f=user&q=' .. pagename .. '|Search]]</span>'
linksData = linksData .. '<span class="img-ib-inline img-greyscale">[[File:Twitter icon.png|x20px|link=https://twitter.com/search?f=user&q=' .. pagename .. '|Search]]</span>'
end
end


if args.facebook then
if args.facebook then
facebookData = '<span class="img-ib-inline">[[File:Facebook icon.png|x20px|link=https://www.facebook.com/' .. args.facebook .. '|' .. args.facebook .. ']]</span>'
linksData = linksData .. '<span class="img-ib-inline">[[File:Facebook icon.png|x20px|link=https://www.facebook.com/' .. args.facebook .. '|' .. args.facebook .. ']]</span>'
else
else
facebookData = '<span class="img-ib-inline img-greyscale">[[File:Facebook icon.png|x20px|link=https://www.facebook.com/search/pages/?q=' .. pagename .. '|Search]]</span>'
linksData = linksData .. '<span class="img-ib-inline img-greyscale">[[File:Facebook icon.png|x20px|link=https://www.facebook.com/search/pages/?q=' .. pagename .. '|Search]]</span>'
  end
  end


addRow( { label = 'Links', data = urlData .. pcgwData .. twitchData .. twitterData .. facebookData } )
addRow( { label = 'Links', data = linksData } )


end
end
Line 202: Line 200:
end
end


if not args.developer or not args.publisher or not args.genre or not args.systems or (not args.released and not args.year) then
if not args.developer or not args.publisher or not args.genre or not args.systems or not args.year then
root:wikitext( '[[Category:Pages needing an infobox]]' )
root:wikitext( '[[Category:Pages needing an infobox]]' )
end
end
Line 217: Line 215:
if args.series4 then
if args.series4 then
root:wikitext( '[[Category:' .. args.series4 .. ']]' )
root:wikitext( '[[Category:' .. args.series4 .. ']]' )
end
if args.distributor then
root:wikitext( '[[Category:Deprecated template usage]]' )
end
end
end
end
Line 259: Line 253:
:addClass( 'mw-collapsible' )
:addClass( 'mw-collapsible' )
:addClass( 'mw-collapsed' )
:addClass( 'mw-collapsed' )
:css( 'margin-top', '-0.5em' )


renderRelease( num )
renderRelease( num )
Line 270: Line 263:
:addClass( 'infobox' )
:addClass( 'infobox' )
:addClass( 'bordered' )
:addClass( 'bordered' )
:css( 'margin-top', '-0.5em' )
:addClass( 'noprint' )
:css( 'clear', 'right' )
:css( 'clear', 'right' )


root
root
:wikitext( mw.getCurrentFrame():preprocess( '<NeoLink />' ) )
:wikitext( mw.getCurrentFrame():preprocess( '<NeoLink />' ) )
:wikitext( mw.getCurrentFrame():preprocess( '<SwitcherLink />' ) )


renderSocialRows()
renderSocialRows()
Line 282: Line 274:
newRoot:node( root )
newRoot:node( root )


return tostring( newRoot ) .. '<div style="clear: left;"></div>'
return tostring( newRoot ) .. mw.getCurrentFrame():expandTemplate{ title = 'WikiList', args = { 'games', args.title } } .. '<div style="clear: left;"></div>'
end
end