Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Sidebox: Difference between revisions

From Jules RNG Wiki
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
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
     local args = frame:getParent().args
     local args = frame:getParent().args


     -- 1. CONFIGURATION (Default Values)
     -- 1. SETUP LINKS
     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/julesrng'
     local robloxIcon    = args['roblox_icon'] or 'Roblox_Logo.svg.png'
     local robloxIcon    = args['roblox_icon'] or 'Roblox_Logo.svg.png'
     local discordIcon    = args['discord_icon'] or 'Discord_Logo.png'
     local discordIcon    = args['discord_icon'] or 'Discord_Logo.png'


     -- 2. STYLES
     -- 2. CREATE ROOT (Using class 'jule-sidebox' for CSS control)
    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 cardStyle = {
        ['background'] = 'var(--color-surface-1)',
        ['border'] = '1px solid var(--border-color-base)',
        ['border-radius'] = 'var(--border-radius-base, 8px)',
        ['box-shadow'] = 'var(--box-shadow-level-1)',
        ['box-sizing'] = 'border-box'
    }
 
    local headerStyle = {
        ['background'] = 'var(--color-surface-2)',
        ['padding'] = '12px',
        ['font-weight'] = 'bold',
        ['font-size'] = '0.95em',
        ['border-bottom'] = '1px solid var(--border-color-base)',
        ['text-transform'] = 'uppercase',
        ['letter-spacing'] = '0.05em',
        ['color'] = 'var(--color-subtle)',
        ['border-radius'] = '8px 8px 0 0'
    }
 
    -- 3. BUILD ROOT CONTAINER
     local root = mw.html.create('div')
     local root = mw.html.create('div')
         :addClass('citizen-sidebox')
         :addClass('citizen-sidebox jule-sidebox')
         :css(boxStyle)
         :css({
            ['display'] = 'flex',
            ['flex-direction'] = 'column',
            ['gap'] = '12px',
            ['box-sizing'] = 'border-box'
        })


     -- ===========================
     -- 3. JOIN COMMUNITY CARD
    -- SECTION 1: JOIN COMMUNITY
     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(cardStyle)
     commCard:tag('div'):css(headerStyle):wikitext('Join the Community')
      
      
     local commBody = commCard:tag('div')
     local commBody = commCard:tag('div'):addClass('plainlinks'):css({['padding']='12px', ['display']='flex', ['flex-direction']='column', ['gap']='8px'})
        :addClass('plainlinks')
        :css({['padding'] = '12px', ['display'] = 'flex', ['flex-direction'] = 'column', ['gap'] = '8px'})


     -- Roblox Button
     -- Buttons
     commBody:tag('div')
     commBody:tag('div'):css({['background']='#000', ['border-radius']='6px', ['padding']='10px', ['text-align']='center'})
        :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))
         :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
        ))


    -- Discord Button
     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))
        :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
        ))


     -- ===========================
     -- 4. DEVELOPERS CARD
    -- SECTION 2: DEVELOPERS
    -- ===========================
    -- We loop through dev1, dev2, dev3...
     if args['dev1'] then
     if args['dev1'] then
         local devCard = root:tag('div'):css(cardStyle)
         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(headerStyle):wikitext('Developers')
         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 name = args['dev' .. i]
             local row = devBody:tag('div'):css({['display']='flex', ['align-items']='center', ['justify-content']='space-between', ['padding']='8px 0'})
            local id  = args['dev_id' .. i]
             if args['dev' .. (i+1)] then row:css('border-bottom', '1px solid var(--border-color-subtle)') end
           
             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 = ''
            if id then
                linkHtml = string.format('<br><span style="font-size: 0.85em; opacity: 0.8;">[https://www.roblox.com/users/%s/profile Roblox Profile &rarr;]</span>', id)
            end
 
            row:tag('div'):wikitext(string.format('<span style="font-weight: bold;">%s</span>%s', name, linkHtml))
              
              
            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 &rarr;]</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


     -- ===========================
     -- 5. CONTRIBUTORS CARD
    -- SECTION 3: CONTRIBUTORS
     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)'})
    local contribs = args['contributors'] or ''
         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')
    if contribs ~= '' then
         contribCard:tag('div'):css({['padding']='12px', ['font-size']='0.9em', ['line-height']='1.6'}):wikitext(args['contributors'])
         local contribCard = root:tag('div'):css(cardStyle)
         contribCard:tag('div'):css(headerStyle):wikitext('Contributors')
         contribCard:tag('div')
            :css({['padding'] = '12px', ['font-size'] = '0.9em', ['line-height'] = '1.6'})
            :wikitext(contribs)
     end
     end



Latest revision as of 06:32, 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

    -- 1. SETUP LINKS
    local robloxGameLink = args['roblox_game'] or 'https://www.roblox.com/games/16883974868/Jules-RNG'
    local discordInvite  = args['discord_invite'] or 'https://discord.gg/julesrng'
    local robloxIcon     = args['roblox_icon'] or 'Roblox_Logo.svg.png'
    local discordIcon    = args['discord_icon'] or 'Discord_Logo.png'

    -- 2. CREATE ROOT (Using class 'jule-sidebox' for CSS control)
    local root = mw.html.create('div')
        :addClass('citizen-sidebox jule-sidebox')
        :css({
            ['display'] = 'flex',
            ['flex-direction'] = 'column',
            ['gap'] = '12px',
            ['box-sizing'] = 'border-box'
        })

    -- 3. JOIN COMMUNITY CARD
    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'})

    -- Buttons
    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))

    -- 4. DEVELOPERS CARD
    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 &rarr;]</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

    -- 5. CONTRIBUTORS CARD
    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

    return tostring(root)
end

return p