Module:Sidebox: Difference between revisions
From Jules RNG Wiki
More actions
Created page with "local p = {} function p.render(frame) local args = frame:getParent().args -- 1. CONFIGURATION (Default Values) local robloxGameLink = args['roblox_game'] or 'https://www.roblox.com/games/16883974868/Jules-RNG' local discordInvite = args['discord_invite'] or 'https://discord.gg/p728XznYPp' local robloxIcon = args['roblox_icon'] or 'Roblox_Logo.svg.png' local discordIcon = args['discord_icon'] or 'Discord_Logo.png' -- 2. STYLES lo..." |
No edit summary |
||
| Line 4: | Line 4: | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local robloxGameLink = args['roblox_game'] or 'https://www.roblox.com/games/16883974868/Jules-RNG' | local robloxGameLink = args['roblox_game'] or 'https://www.roblox.com/games/16883974868/Jules-RNG' | ||
local discordInvite = args['discord_invite'] or 'https://discord.gg/p728XznYPp' | local discordInvite = args['discord_invite'] or 'https://discord.gg/p728XznYPp' | ||
| Line 10: | Line 9: | ||
local discordIcon = args['discord_icon'] or 'Discord_Logo.png' | local discordIcon = args['discord_icon'] or 'Discord_Logo.png' | ||
-- | -- We remove specific width/float from inline styles and rely on class + desktop default | ||
local boxStyle = { | local boxStyle = { | ||
['float'] = 'right', | ['float'] = 'right', | ||
| Line 23: | Line 22: | ||
} | } | ||
local root = mw.html.create('div') | local root = mw.html.create('div') | ||
:addClass('citizen-sidebox') | :addClass('citizen-sidebox jule-sidebox') -- Added 'jule-sidebox' | ||
:css(boxStyle) | :css(boxStyle) | ||
-- | -- Join Community Section | ||
local commCard = root:tag('div'):css({['background']='var(--color-surface-1)', ['border']='1px solid var(--border-color-base)', ['border-radius']='8px', ['box-shadow']='var(--box-shadow-level-1)'}) | |||
commCard:tag('div'):css({['background']='var(--color-surface-2)', ['padding']='12px', ['font-weight']='bold', ['font-size']='0.95em', ['border-bottom']='1px solid var(--border-color-base)', ['color']='var(--color-subtle)', ['border-radius']='8px 8px 0 0'}):wikitext('Join the Community') | |||
local commCard = root:tag('div'):css( | |||
commCard:tag('div'):css( | |||
local commBody = commCard:tag('div') | local commBody = commCard:tag('div'):addClass('plainlinks'):css({['padding']='12px', ['display']='flex', ['flex-direction']='column', ['gap']='8px'}) | ||
commBody:tag('div'):css({['background']='#000', ['border-radius']='6px', ['padding']='10px', ['text-align']='center'}) | |||
commBody:tag('div') | :wikitext(string.format('<span style="vertical-align: middle; margin-right: 8px;">[[File:%s|40px|link=%s]]</span><span style="font-weight: bold; vertical-align: middle;">[%s <span style="color: #fff !important; text-decoration: none;">Play on Roblox</span>]</span>', robloxIcon, robloxGameLink, robloxGameLink)) | ||
:wikitext(string.format( | |||
commBody:tag('div'):css({['background']='#5865F2', ['border-radius']='6px', ['padding']='10px', ['text-align']='center'}) | |||
commBody:tag('div') | :wikitext(string.format('<span style="vertical-align: middle; margin-right: 8px;">[[File:%s|40px|link=%s]]</span><span style="font-weight: bold; vertical-align: middle;">[%s <span style="color: #fff !important; text-decoration: none;">Join Discord</span>]</span>', discordIcon, discordInvite, discordInvite)) | ||
:wikitext(string.format( | |||
-- | -- Developers Section | ||
if args['dev1'] then | if args['dev1'] then | ||
local devCard = root:tag('div'):css( | local devCard = root:tag('div'):css({['background']='var(--color-surface-1)', ['border']='1px solid var(--border-color-base)', ['border-radius']='8px', ['box-shadow']='var(--box-shadow-level-1)'}) | ||
devCard:tag('div'):css( | devCard:tag('div'):css({['background']='var(--color-surface-2)', ['padding']='12px', ['font-weight']='bold', ['font-size']='0.95em', ['border-bottom']='1px solid var(--border-color-base)', ['color']='var(--color-subtle)', ['border-radius']='8px 8px 0 0'}):wikitext('Developers') | ||
local devBody = devCard:tag('div'):addClass('plainlinks'):css({['padding'] = '8px 12px'}) | local devBody = devCard:tag('div'):addClass('plainlinks'):css({['padding']='8px 12px'}) | ||
local i = 1 | local i = 1 | ||
while args['dev' .. i] do | while args['dev' .. i] do | ||
local row = devBody:tag('div'):css({['display']='flex', ['align-items']='center', ['justify-content']='space-between', ['padding']='8px 0'}) | |||
if args['dev' .. (i+1)] then row:css('border-bottom', '1px solid var(--border-color-subtle)') end | |||
local row = devBody:tag('div') | |||
if args['dev' .. (i+1)] then | |||
local linkHtml = args['dev_id' .. i] and string.format('<br><span style="font-size: 0.85em; opacity: 0.8;">[https://www.roblox.com/users/%s/profile Roblox Profile →]</span>', args['dev_id' .. i]) or '' | |||
row:tag('div'):wikitext(string.format('<span style="font-weight: bold;">%s</span>%s', args['dev' .. i], linkHtml)) | |||
i = i + 1 | i = i + 1 | ||
end | end | ||
end | end | ||
-- | -- Contributors Section | ||
if args['contributors'] then | |||
local contribCard = root:tag('div'):css({['background']='var(--color-surface-1)', ['border']='1px solid var(--border-color-base)', ['border-radius']='8px', ['box-shadow']='var(--box-shadow-level-1)'}) | |||
contribCard:tag('div'):css({['background']='var(--color-surface-2)', ['padding']='12px', ['font-weight']='bold', ['font-size']='0.95em', ['border-bottom']='1px solid var(--border-color-base)', ['color']='var(--color-subtle)', ['border-radius']='8px 8px 0 0'}):wikitext('Contributors') | |||
contribCard:tag('div'):css({['padding']='12px', ['font-size']='0.9em', ['line-height']='1.6'}):wikitext(args['contributors']) | |||
local contribCard = root:tag('div'):css( | |||
contribCard:tag('div'):css( | |||
contribCard:tag('div') | |||
end | end | ||
return tostring(root) | -- Mobile CSS Fix | ||
local css = [[ | |||
@media screen and (max-width: 768px) { | |||
.jule-sidebox { float: none !important; width: 100% !important; margin: 0 0 1.5em 0 !important; } | |||
} | |||
]] | |||
return frame:extensionTag('style', css) .. tostring(root) | |||
end | end | ||
return p | return p | ||
Revision as of 05:10, 27 January 2026
Documentation for this module may be created at Module:Sidebox/doc
local p = {}
function p.render(frame)
local args = frame:getParent().args
local robloxGameLink = args['roblox_game'] or 'https://www.roblox.com/games/16883974868/Jules-RNG'
local discordInvite = args['discord_invite'] or 'https://discord.gg/p728XznYPp'
local robloxIcon = args['roblox_icon'] or 'Roblox_Logo.svg.png'
local discordIcon = args['discord_icon'] or 'Discord_Logo.png'
-- We remove specific width/float from inline styles and rely on class + desktop default
local boxStyle = {
['float'] = 'right',
['width'] = '300px',
['max-width'] = '100%',
['margin'] = '0 0 1rem 1rem',
['display'] = 'flex',
['flex-direction'] = 'column',
['gap'] = '12px',
['clear'] = 'right',
['box-sizing'] = 'border-box'
}
local root = mw.html.create('div')
:addClass('citizen-sidebox jule-sidebox') -- Added 'jule-sidebox'
:css(boxStyle)
-- Join Community Section
local commCard = root:tag('div'):css({['background']='var(--color-surface-1)', ['border']='1px solid var(--border-color-base)', ['border-radius']='8px', ['box-shadow']='var(--box-shadow-level-1)'})
commCard:tag('div'):css({['background']='var(--color-surface-2)', ['padding']='12px', ['font-weight']='bold', ['font-size']='0.95em', ['border-bottom']='1px solid var(--border-color-base)', ['color']='var(--color-subtle)', ['border-radius']='8px 8px 0 0'}):wikitext('Join the Community')
local commBody = commCard:tag('div'):addClass('plainlinks'):css({['padding']='12px', ['display']='flex', ['flex-direction']='column', ['gap']='8px'})
commBody:tag('div'):css({['background']='#000', ['border-radius']='6px', ['padding']='10px', ['text-align']='center'})
:wikitext(string.format('<span style="vertical-align: middle; margin-right: 8px;">[[File:%s|40px|link=%s]]</span><span style="font-weight: bold; vertical-align: middle;">[%s <span style="color: #fff !important; text-decoration: none;">Play on Roblox</span>]</span>', robloxIcon, robloxGameLink, robloxGameLink))
commBody:tag('div'):css({['background']='#5865F2', ['border-radius']='6px', ['padding']='10px', ['text-align']='center'})
:wikitext(string.format('<span style="vertical-align: middle; margin-right: 8px;">[[File:%s|40px|link=%s]]</span><span style="font-weight: bold; vertical-align: middle;">[%s <span style="color: #fff !important; text-decoration: none;">Join Discord</span>]</span>', discordIcon, discordInvite, discordInvite))
-- Developers Section
if args['dev1'] then
local devCard = root:tag('div'):css({['background']='var(--color-surface-1)', ['border']='1px solid var(--border-color-base)', ['border-radius']='8px', ['box-shadow']='var(--box-shadow-level-1)'})
devCard:tag('div'):css({['background']='var(--color-surface-2)', ['padding']='12px', ['font-weight']='bold', ['font-size']='0.95em', ['border-bottom']='1px solid var(--border-color-base)', ['color']='var(--color-subtle)', ['border-radius']='8px 8px 0 0'}):wikitext('Developers')
local devBody = devCard:tag('div'):addClass('plainlinks'):css({['padding']='8px 12px'})
local i = 1
while args['dev' .. i] do
local row = devBody:tag('div'):css({['display']='flex', ['align-items']='center', ['justify-content']='space-between', ['padding']='8px 0'})
if args['dev' .. (i+1)] then row:css('border-bottom', '1px solid var(--border-color-subtle)') end
local linkHtml = args['dev_id' .. i] and string.format('<br><span style="font-size: 0.85em; opacity: 0.8;">[https://www.roblox.com/users/%s/profile Roblox Profile →]</span>', args['dev_id' .. i]) or ''
row:tag('div'):wikitext(string.format('<span style="font-weight: bold;">%s</span>%s', args['dev' .. i], linkHtml))
i = i + 1
end
end
-- Contributors Section
if args['contributors'] then
local contribCard = root:tag('div'):css({['background']='var(--color-surface-1)', ['border']='1px solid var(--border-color-base)', ['border-radius']='8px', ['box-shadow']='var(--box-shadow-level-1)'})
contribCard:tag('div'):css({['background']='var(--color-surface-2)', ['padding']='12px', ['font-weight']='bold', ['font-size']='0.95em', ['border-bottom']='1px solid var(--border-color-base)', ['color']='var(--color-subtle)', ['border-radius']='8px 8px 0 0'}):wikitext('Contributors')
contribCard:tag('div'):css({['padding']='12px', ['font-size']='0.9em', ['line-height']='1.6'}):wikitext(args['contributors'])
end
-- Mobile CSS Fix
local css = [[
@media screen and (max-width: 768px) {
.jule-sidebox { float: none !important; width: 100% !important; margin: 0 0 1.5em 0 !important; }
}
]]
return frame:extensionTag('style', css) .. tostring(root)
end
return p