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

Module:Talent: Difference between revisions

From eSportsAmaze
Created page with "local p = {} local html = mw.html function p.main(frame) local args = frame:getParent().args local container = html.create('div'):addClass('talent-box') -- Iterate through group1, group2, group3... to keep order for i = 1, 20 do local role = args['group' .. i] local people = args['list' .. i] if role and role ~= "" and people and people ~= "" then -- 1. Create the Group Section local section =..."
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
function p.main(frame)
function p.main(frame)
     local args = frame:getParent().args
     local args = frame:getParent().args
     local container = html.create('div'):addClass('talent-box')
     local container = html.create('div'):addClass('talent-container')
   
 
     -- Iterate through group1, group2, group3... to keep order
     -- Loop through group1, group2...
     for i = 1, 20 do
     for i = 1, 20 do
         local role = args['group' .. i]
         local role = args['group' .. i]
         local people = args['list' .. i]
         local people = args['list' .. i]
       
 
         if role and role ~= "" and people and people ~= "" then
         if role and role ~= "" and people and people ~= "" then
             -- 1. Create the Group Section
             -- Create the Row
             local section = container:tag('div'):addClass('talent-section')
             local row = container:tag('div'):addClass('talent-row')
 
            -- 1. The Header (Left Side)
            row:tag('div'):addClass('talent-header'):wikitext(role)
 
            -- 2. The Pills Container (Right Side)
            local listDiv = row:tag('div'):addClass('talent-list')
              
              
            -- Role Title (e.g., "HOSTS")
             local items = mw.text.split(people, ",")
            section:tag('div'):addClass('talent-role-header'):wikitext(role)
             for _, name in ipairs(items) do
           
            -- Grid for Chips
            local grid = section:tag('div'):addClass('talent-grid')
           
            -- 2. Process the list of names
             local names = mw.text.split(people, ",")
             for _, name in ipairs(names) do
                 name = mw.text.trim(name)
                 name = mw.text.trim(name)
                -- If user accidentally leaves an empty comma
                 if name ~= "" then
                 if name ~= "" then
                     local chip = grid:tag('div'):addClass('talent-chip')
                     -- Simple Text Pill
                   
                     listDiv:tag('div'):addClass('talent-pill')
                    -- A. Avatar Image (Assumes "File:PlayerName.png")
                    -- We use [[File:Name.png|...]] syntax
                    local imgName = "File:" .. name .. ".png"
                   
                    -- This div holds the image (and handles fallback via CSS if needed)
                    chip:tag('div'):addClass('talent-img')
                        :wikitext('[[File:' .. name .. '.png|link=|class=talent-avatar-img|50px]]')
                   
                    -- B. Name Label (Linked)
                     chip:tag('div'):addClass('talent-name')
                         :wikitext('[[' .. name .. ']]')
                         :wikitext('[[' .. name .. ']]')
                 end
                 end

Latest revision as of 12:31, 6 February 2026

Documentation for this module may be created at Module:Talent/doc

local p = {}
local html = mw.html

function p.main(frame)
    local args = frame:getParent().args
    local container = html.create('div'):addClass('talent-container')

    -- Loop through group1, group2...
    for i = 1, 20 do
        local role = args['group' .. i]
        local people = args['list' .. i]

        if role and role ~= "" and people and people ~= "" then
            -- Create the Row
            local row = container:tag('div'):addClass('talent-row')

            -- 1. The Header (Left Side)
            row:tag('div'):addClass('talent-header'):wikitext(role)

            -- 2. The Pills Container (Right Side)
            local listDiv = row:tag('div'):addClass('talent-list')
            
            local items = mw.text.split(people, ",")
            for _, name in ipairs(items) do
                name = mw.text.trim(name)
                -- If user accidentally leaves an empty comma
                if name ~= "" then
                    -- Simple Text Pill
                    listDiv:tag('div'):addClass('talent-pill')
                        :wikitext('[[' .. name .. ']]')
                end
            end
        end
    end
    
    return tostring(container)
end

return p