Module:Sandbox/LVL: Difference between revisions

Jump to navigation Jump to search
LVL (talk | contribs)
No edit summary
Tag: Manual revert
LVL (talk | contribs)
No edit summary
Line 2: Line 2:


-- Single pre-indexed lookup, built by the bot at deploy time.
-- Single pre-indexed lookup, built by the bot at deploy time.
-- mw.loadJsonData re-parses JSON on every page render, but is still
-- dramatically faster than loading 3 separate files and iterating them.
local iconData = mw.loadJsonData("Data:Sandbox.json")
local iconData = mw.loadJsonData("Data:Sandbox.json")
local lang_codes = mw.loadJsonData("Data:LangCodes.json")
local lang_codes = mw.loadJsonData("Data:LangCodes.json")
Line 9: Line 7:
local cachedLangCode, cachedLangData
local cachedLangCode, cachedLangData


-- Items that link to disambiguation pages
local linkOverrides = {
local linkOverrides = {
     ["Bullet Lifesteal"] = "Bullet Lifesteal (item)",
     ["Bullet Lifesteal"] = "Bullet Lifesteal (item)",
Line 106: Line 105:


     -- Style logic
     -- Style logic
    -- 'ability' class triggers .module-icon-ability CSS which normalizes
    -- ability icons to black/white silhouette for light/dark theme support
     local style
     local style
     if iconInfo.class and iconInfo.class:find("theme", 1, true) then
     if iconInfo.class == "ability" then
         style = 'class="module-icon-ability" style="position:relative; bottom:2px;"'
         style = 'class="module-icon-ability" style="position:relative; bottom:2px;"'
     else
     else