Модуль:ChampionshipNav

Версія від 15:58, 30 листопада 2025, створена Admin (обговорення | внесок) (Створена сторінка: local p = {} local championship_order = { "Mafia Closed Cup I", "Mafia Closed Cup I Online", "My Closest Circle I" -- Додай інші чемпіонати } local function find_championship_index(championship_name) for i, name in ipairs(championship_order) do if name == championship_name then return i end end return nil end function p.prevLink(frame) local current_championship = frame.args[...)
(різн.) ← Попередня версія | Поточна версія (різн.) | Новіша версія → (різн.)

Документацію для цього модуля можна створити у Модуль:ChampionshipNav/документація

local p = {}

local championship_order = {
    "Mafia Closed Cup I",
    "Mafia Closed Cup I Online",
    "My Closest Circle I"
    -- Додай інші чемпіонати
}

local function find_championship_index(championship_name)
    for i, name in ipairs(championship_order) do
        if name == championship_name then
            return i
        end
    end
    return nil
end

function p.prevLink(frame)
    local current_championship = frame.args[1] or mw.title.getCurrentTitle().text
    local index = find_championship_index(current_championship)
    
    if not index then
        return '<span style="color:#666;">←</span>'
    end
    
    local prev_index = index == 1 and #championship_order or index - 1
    local prev_championship = championship_order[prev_index]
    
    return '[[' .. prev_championship .. '|←]]'
end

function p.nextLink(frame)
    local current_championship = frame.args[1] or mw.title.getCurrentTitle().text
    local index = find_championship_index(current_championship)
    
    if not index then
        return '<span style="color:#666;">→</span>'
    end
    
    local next_index = index == #championship_order and 1 or index + 1
    local next_championship = championship_order[next_index]
    
    return '[[' .. next_championship .. '|→]]'
end

return p