Модуль:GeneratePlayerPages: відмінності між версіями

нема опису редагування
Немає опису редагування
Немає опису редагування
 
(Не показані 2 проміжні версії цього користувача)
Рядок 491: Рядок 491:
         table.insert(output, "| finalist = 0")
         table.insert(output, "| finalist = 0")
     end
     end
   
     table.insert(output, "}}")
     table.insert(output, "}}")
     table.insert(output, "")
     table.insert(output, "")
Рядок 508: Рядок 507:
     table.insert(output, facts_code)
     table.insert(output, facts_code)
      
      
     -- ВИПРАВЛЕННЯ: Використовуємо HTML textarea для копіювання
     -- НАЙПРОСТІШЕ РІШЕННЯ: Додаємо пробіл на початку кожного рядка
     local final_code = table.concat(output, "\n")
     local final_code = table.concat(output, "\n")
      
      
     -- Екрануємо HTML спецсимволи
     -- Розбиваємо на рядки та додаємо пробіл
     final_code = mw.text.encode(final_code)
     local result = {}
    for line in final_code:gmatch("([^\n]*)\n?") do
        if line ~= "" then
            table.insert(result, " " .. line)
        else
            table.insert(result, "")
        end
    end
      
      
     return string.format(
    -- Додаємо заголовок
        '<div style="background:#f9f9f9; border:1px solid #ddd; padding:10px; margin:10px 0;">' ..
     return "'''Код для гравця " .. player_name .. ":'''\n\n" .. table.concat(result, "\n")
        '<textarea readonly style="width:100%%; height:400px; font-family:monospace; font-size:12px;">%s</textarea>' ..
        '<button onclick="this.previousElementSibling.select();document.execCommand(\'copy\');" style="margin-top:5px; padding:5px 10px; cursor:pointer;">📋 Копіювати</button>' ..
        '</div>',
        final_code
    )
end
end


-- Генерувати для всіх гравців
-- Генерувати для всіх гравців