Anonymous

Module:SkillNav: Difference between revisions

From Elwiki
no edit summary
No edit summary
No edit summary
Line 59: Line 59:
             ['name'] = 'Couple Skill',
             ['name'] = 'Couple Skill',
             ['abbr'] = 'Wed'
             ['abbr'] = 'Wed'
        },
        -- Force Skill Nav
        [12] = {
            ['name'] = 'Force Active',
            ['abbr'] = 'FA3',
            ['type'] = 'third'
        },
        [13] = {
            ['name'] = 'Force Passive',
            ['abbr'] = 'FP3',
            ['type'] = 'third'
        },
        [14] = {
            ['name'] = 'Force Active',
            ['abbr'] = 'FAM',
            ['type'] = 'master'
        },
        [15] = {
            ['name'] = 'Force Passive',
            ['abbr'] = 'FPM',
            ['type'] = 'master'
         }
         }
     }
     }
Line 71: Line 92:
     -- Main block
     -- Main block
     local skill_nav = mw.html.create('div'):addClass('skill-nav');
     local skill_nav = mw.html.create('div'):addClass('skill-nav');
    if (args.forcenav ~= nil) then
        skill_nav:addClass('force-nav');
    end


     -- Header
     -- Header
Line 81: Line 105:
         colors = args.color;
         colors = args.color;
     end
     end
     header:attr('style', 'background-color:' .. colors):wikitext(frame:expandTemplate{
     header:attr('style', 'background-color:' .. colors)
        title = 'Face',
    if (args.forcenav == nil) then
        args = {
        header:wikitext(frame:expandTemplate{
            args.char,
            title = 'Face',
            args.pic,
            args = {
            link = args.name,
                args.char,
            scale = '0.75'
                args.pic,
         }
                link = args.name,
     })
                scale = '0.75'
            }
         })
     end
     -- Header text with a link
     -- Header text with a link
     header:tag('span'):wikitext('[[' .. args.name .. ']] - Skills');
     if (args.forcenav == nil) then
        header:tag('span'):wikitext('[[' .. args.name .. ']] - Skills');
    else
        header:tag('span'):wikitext('[[Force Skills]]');
    end
   
     -- Generate the navigation's body
     -- Generate the navigation's body
     local skill_nav_wrap = skill_nav:tag('div'):addClass('skill-nav-inner-wrap border-color')
     local skill_nav_wrap = skill_nav:tag('div'):addClass('skill-nav-inner-wrap border-color')
Line 107: Line 139:
         local name = v2['name'];
         local name = v2['name'];
         local abbr = v2['abbr'];
         local abbr = v2['abbr'];
        local type = v2['type'];
         if (inArgs(abbr)) then
         if (inArgs(abbr)) then
             local skills = split(args[abbr], ';');
             local skills = split(args[abbr], ';');
Line 127: Line 160:
             end
             end
             local i = 1;
             local i = 1;
            -- If Force Nav, append an extra header before "Force Active" if needed.
            if (abbr == 'FA3' or abbr == 'FAM') then
                local extra_head = skill_nav_wrap:tag('div'):addClass(
                    'skill-nav-sub-head skill-nav-extra-head border-color tone-7 color-normal-force-link');
                if (type == 'third') then
                    extra_head:wikitext('[[3rd Jobs|3rd Job]]');
                elseif (type == 'master') then
                    extra_head:wikitext('[[Master Class]]');
                end
            end
             -- Append header fields on the left.
             -- Append header fields on the left.
             skill_nav_wrap:tag('div'):addClass('skill-nav-sub-head border-color tone-4'):wikitext(name .. mc_skill_name_head);
             skill_nav_wrap:tag('div'):addClass('skill-nav-sub-head border-color tone-4'):wikitext(name .. mc_skill_name_head);
             -- Append skill fields on the right.
             -- Append skill fields on the right.
             local content = skill_nav_wrap:tag('div'):addClass('skill-nav-skill-content border-color tone-6');
             local content = skill_nav_wrap:tag('div'):addClass('skill-nav-skill-content border-color tone-6');
Line 140: Line 186:
                 if (i % 2 == 0) then
                 if (i % 2 == 0) then
                     -- Append the actual skills.
                     -- Append the actual skills.
                     local skill_entry = content:tag('div'):addClass('skill-nav-skill tone-7-hover color-normal-force-link tone-8-active');
                     local skill_entry = content:tag('div'):addClass(
                        'skill-nav-skill tone-7-hover color-normal-force-link tone-8-active');
                     local skill_icon = skill_entry:tag('div'):addClass('skill-nav-image')
                     local skill_icon = skill_entry:tag('div'):addClass('skill-nav-image')
                     if (abbr == 'FC' or abbr == 'MDF') then
                     if (abbr == 'FC' or abbr == 'MDF') then
Line 161: Line 208:
                             skill_entry:wikitext('[[' .. v .. '|' .. v_display_name .. ']]');
                             skill_entry:wikitext('[[' .. v .. '|' .. v_display_name .. ']]');
                         end
                         end
                       
 
                         skill_icon:wikitext('[[File:' .. trim(skills[i - 1]) .. '|30px|link= ' .. v .. ']]');
                         skill_icon:wikitext('[[File:' .. trim(skills[i - 1]) .. '|30px|link= ' .. v .. ']]');
                     end
                     end