Модуль:BotanyStats: различия между версиями

Нет описания правки
Нет описания правки
Строка 42: Строка 42:
         end
         end
         return words
         return words
    end
    -- Меняем цвета в зависимости от наличия параметра `mutation`
    local mutationClass = ""
    if mutation == nil then
        mutationClass = 'mutation-cell__plants'
    else
        mutationClass = 'mutation-cell__mutation'
     end
     end


Строка 50: Строка 58:
     elseif mutationId == "" then
     elseif mutationId == "" then
         -- Если параметр пуст
         -- Если параметр пуст
         mutationCells = '<div class="maturation-cell">Не имеет мутаций</div> \n'
         mutationCells = '<div class=' .. mutationClass .. '>Не имеет мутаций</div> \n'
     else
     else
         -- Если параметр задан и не пуст
         -- Если параметр задан и не пуст
         local words = splitWords(mutationId)
         local words = splitWords(mutationId)
         for _, word in ipairs(words) do
         for _, word in ipairs(words) do
             mutationCells = mutationCells .. '<div class="maturation-cell">{{#invoke:Entity Lookup|createimagetooltip|Файл:' .. word .. '.png|' .. word .. '|Мета=32x32px,link=}} [[#{{#invoke:Entity Lookup|getname|' .. word .. '}}|{{#invoke:Entity Lookup|getname|' .. word .. '}}]]</div>'
             mutationCells = mutationCells .. '<div class=' .. mutationClass .. '>{{#invoke:Entity Lookup|createimagetooltip|Файл:' .. word .. '.png|' .. word .. '|Мета=32x32px,link=}} [[#{{#invoke:Entity Lookup|getname|' .. word .. '}}|{{#invoke:Entity Lookup|getname|' .. word .. '}}]]</div>'
         end
         end
     end
     end
Строка 78: Строка 86:
     out = out .. frame:preprocess('* {{tooltip|Освещения|Оптимальный уровень освещения|color=#e1f6ff}}: ' .. '<b>' .. idealLight .. '</b>' .. '\n')
     out = out .. frame:preprocess('* {{tooltip|Освещения|Оптимальный уровень освещения|color=#e1f6ff}}: ' .. '<b>' .. idealLight .. '</b>' .. '\n')
     out = out .. '| ' .. description .. '\n'
     out = out .. '| ' .. description .. '\n'
    out = out .. frame:preprocess('|' .. mutationCells .. '\n')
      
      
     -- Добавление блока мутаций, если параметр не отсутствует
     -- Меняем цвета в зависимости от наличия параметра `mutation`
    if mutationId ~= nil then
     if mutation == nil then
        out = out .. frame:preprocess('|' .. mutationCells .. '\n')
    end
 
    -- Добавление блока с локацией, меняя цвета в зависимости от наличия параметра `mutationId`
     if mutationId == nil then
         out = out .. frame:preprocess('|{{SlideMenu|overlay|color=#e1f6ff|background-color=#301453|border-color=#211235|border-size=3px|title=Список|content=<p></p> \n' .. location .. '}} \n')
         out = out .. frame:preprocess('|{{SlideMenu|overlay|color=#e1f6ff|background-color=#301453|border-color=#211235|border-size=3px|title=Список|content=<p></p> \n' .. location .. '}} \n')
     else
     else
Строка 96: Строка 100:
     if firstRun then
     if firstRun then
         firstRun = false
         firstRun = false
         out = out .. '<div class="customCSS" style="display:none"> .maturation-cell { width: 100%; margin: 5px 0; box-sizing: border-box; text-align: left; background: #10673a; padding: 6px 10px; border-radius: 0.3em; border: 2px solid #094124; font-weight: 500; transition: background 0.05s; } .maturation-cell:hover { background: #126d3e; } </div>'
         out = out .. '<div class="customCSS" style="display:none"> .mutation-cell__mutation { width: 100%; margin: 5px 0; box-sizing: border-box; text-align: left; background: #10673a; padding: 6px 10px; border-radius: 0.3em; border: 2px solid #094124; font-weight: 500; transition: background 0.05s; } .mutation-cell__mutation:hover { background: #126d3e; } </div>'
     end
     end
     return out
     return out