5233
редагування
Admin (обговорення | внесок) (Створена сторінка: local p = {} --- Список турнірів у порядку local series_order = { "Women's Closed Cup I", "Men's Closed Cup I", "Combined Closed Cup I" -- Додай інші турніри в правильному порядку } --- Знаходить індекс турніру local function find_series_index(series_name) for i, name in ipairs(series_order) do if name == series_name then return i...) |
Admin (обговорення | внесок) Немає опису редагування |
||
| Рядок 3: | Рядок 3: | ||
--- Список турнірів у порядку | --- Список турнірів у порядку | ||
local series_order = { | local series_order = { | ||
"Get Names 01", | |||
"Get Names 02", | |||
"Get Names 03", | |||
"Get Names 04", | |||
"Get Names 05", | |||
"Get Names 06", | |||
"Get Names 07", | |||
"Get Names 08", | |||
"Get Names 09", | |||
"Women's Closed Cup I", | "Women's Closed Cup I", | ||
"Men's Closed Cup I", | "Men's Closed Cup I", | ||
"Combined Closed Cup I" | "Combined Closed Cup I" | ||
} | } | ||
| Рядок 19: | Рядок 27: | ||
end | end | ||
--- Повертає посилання на попередній турнір | --- Повертає посилання на попередній турнір (циклічно) | ||
function p.prevLink(frame) | function p.prevLink(frame) | ||
local current_series = frame.args[1] or mw.title.getCurrentTitle().text | local current_series = frame.args[1] or mw.title.getCurrentTitle().text | ||
local index = find_series_index(current_series) | local index = find_series_index(current_series) | ||
if not index | if not index then | ||
return '<span style="color:#666;">←</span>' | return '<span style="color:#666;">←</span>' | ||
end | end | ||
local | -- Циклічна навігація: якщо перший, то йдемо до останнього | ||
local prev_index = index == 1 and #series_order or index - 1 | |||
local prev_series = series_order[prev_index] | |||
return '[[' .. prev_series .. '|←]]' | return '[[' .. prev_series .. '|←]]' | ||
end | end | ||
--- Повертає посилання на наступний турнір | --- Повертає посилання на наступний турнір (циклічно) | ||
function p.nextLink(frame) | function p.nextLink(frame) | ||
local current_series = frame.args[1] or mw.title.getCurrentTitle().text | local current_series = frame.args[1] or mw.title.getCurrentTitle().text | ||
local index = find_series_index(current_series) | local index = find_series_index(current_series) | ||
if not index | if not index then | ||
return '<span style="color:#666;">→</span>' | return '<span style="color:#666;">→</span>' | ||
end | end | ||
local | -- Циклічна навігація: якщо останній, то йдемо до першого | ||
local next_index = index == #series_order and 1 or index + 1 | |||
local next_series = series_order[next_index] | |||
return '[[' .. next_series .. '|→]]' | return '[[' .. next_series .. '|→]]' | ||
end | end | ||
return p | return p | ||