FANDOM


local BASE_STYLE = [====[
/***** ModularCSS/HideSpoilerTitle *****/
/* hide from wikiactivity, rc, and article content */
[=[a[href="/wiki/$TITLE"]:hover]=]
{
    color: #fff;
    text-decoration: none !important;
}
[=[a[href="/wiki/$TITLE"]]=]
{
    background-color: #000;
    color: #000;
}
 
/* prevent plainlink unmasking */
[=[.plainlinks a[href="/wiki/$TITLE"]]=] { background-color: #000 !important; }
[=[.plainlinks .unobscure a[href="/wiki/$TITLE"]]=]
{
    background: initial !important;
}
 
/* custom "unobscuring" class, apply to wiki header */
[=[.wds-tabs  a[href="/wiki/$TITLE"],
.unobscure a[href="/wiki/$TITLE"]]=]
{
    background: inherit;
    color: #337800; /* todo: user set */
}
 
/* hide from generated category galleries */
[=[.category-gallery .category-gallery-item a[href="/wiki/$TITLE"]]=]
{
    display: none;
}
 
/* spoiler postfix */
[=[a[href="/wiki/$TITLE"]::after]=]
{
    color: #ff0000;
    font-size: 80%;
    content: " (spoiler)";
}
 
/* prevent modifying wiki header dropdowns */
[=[.wds-tabs  a[href="/wiki/$TITLE"]::after,
.unobscure a[href="/wiki/$TITLE"]::after]=]
{ content: none; }
[=[.wds-tabs  a[href="/wiki/$TITLE"]:hover,
.unobscure a[href="/wiki/$TITLE"]:hover]=]
{ color: inherit; }
 
/* warn for spoilers in search results */
[=[.wds-global-navigation__search li[title="$STITLE"] a]=]
{ visibility: hidden; }
[=[.wds-global-navigation__search li[title="$STITLE"].wds-is-selected a]=]
{ visibility: visible; }
[=[.wds-global-navigation__search li[title="$STITLE"] a::before]=]
{ color:#ff0000; content:"SPOILER (hover to view)"; visibility: visible; }
[=[.wds-global-navigation__search li[title="$STITLE"].wds-is-selected a::before]=]
{ content: none; }
]====]
 
local CHUNK_CAPT = "%[=%[(.-)%]=%]"
 
return {
    page = "Project:Spoiler titles",
 
    main = function(parsed)
        local piles  = {}
 
        -- create piles
        for _,obj in pairs(parsed) do
            local pile_n = 0
 
            for chunk in BASE_STYLE:gmatch(CHUNK_CAPT) do
                pile_n = pile_n + 1
                piles[pile_n] = piles[pile_n] or {}
                table.insert(piles[pile_n],
                    (chunk
                        :gsub("$TITLE",  function()
                            local title = ""
 
                            for part in mw.text.gsplit(obj.self, '/') do
                                title = title
                                    .. mw.uri.encode(part, "WIKI") .. '/'
                            end
 
                            return title:sub(1, -2)
                        end)
                        :gsub("$STITLE", obj.self)
                    )
                )
            end
        end
 
        -- nothing provided
        if #piles == 0 then return '' end
 
        -- compile
        local pile_n = 0
        return BASE_STYLE:gsub(CHUNK_CAPT, function(chunk)
            local compiled = ""
 
            pile_n = pile_n + 1
            pile = piles[pile_n]
 
            for _,chunk in pairs(pile) do
                compiled = compiled .. chunk .. ",\n"
            end
 
            return compiled:sub(1,-3)
        end)
    end
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.