Открыть меню
Переключить меню настроек
Открыть персональное меню
Вы не представились системе
Ваш IP-адрес будет виден всем, если вы внесёте какие-либо изменения.

Модуль:Carousel

Материал из YastreWiki
Версия от 16:43, 20 февраля 2026; DimaYastrebov (обсуждение | вклад) (Новая страница: «local p = {} function p.render(frame) local parent = frame:getParent() local args = parent.args local root = mw.html.create('div') :addClass('yastre-carousel-container') local inner = root:tag('div') :addClass('yastre-carousel') local i = 1 local total = 0 while args do total = total + 1; i = i + 1 end i = 1 while args do local file = mw.text.trim(args) local item = inner:tag('div'):add...»)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

Для документации этого модуля может быть создана страница Модуль:Carousel/doc

local p = {}

function p.render(frame)
    local parent = frame:getParent()
    local args = parent.args

    local root = mw.html.create('div')
        :addClass('yastre-carousel-container')

    local inner = root:tag('div')
        :addClass('yastre-carousel')

    local i = 1
    local total = 0
    while args do total = total + 1; i = i + 1 end

    i = 1
    while args do
        local file = mw.text.trim(args)
        local item = inner:tag('div'):addClass('carousel-item')
        
        if i == 1 then
            item:addClass('active')
        elseif i == 2 then
            item:addClass('next')
        elseif i == total then
            item:addClass('prev')
        else
            item:addClass('hidden')
        end

        item:wikitext('[]')
        
        i = i + 1
    end

    return tostring(root)
end

return p