Module:Keyboard
ꠍꠥꠞꠔ ꠢꠣꠟ
Documentation for this module may be created at Module:Keyboard/doc
-- Module:Keyboard
local p = {}
-- Function to render the keyboard
function p.render()
-- The layout of the keyboard in HTML
local keyboardHTML = '<div class="keyboard">'
-- Add the keys dynamically (this will make it easier to modify the layout later)
local keys = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L' }
for _, key in ipairs(keys) do
keyboardHTML = keyboardHTML .. string.format('<button class="key" onclick="appendToOutput(\'%s\')">%s</button>', key, key)
end
keyboardHTML = keyboardHTML .. '</div>'
keyboardHTML = keyboardHTML .. '<div id="output"></div>' -- Output area for the keys
return keyboardHTML -- Return the final keyboard HTML
end
return p