Module:Infobox interval: Difference between revisions

Plumtree (talk | contribs)
mNo edit summary
Plumtree (talk | contribs)
mNo edit summary
Line 9: Line 9:
local function value_provided(s)
local function value_provided(s)
return type(s) == 'string' and #s > 0
return type(s) == 'string' and #s > 0
end
local used_ids = {}
local function gen_id()
local id = math.random(0, 100000)
while used_ids[id] do
id = math.random(0, 100000)
end
used_ids[id] = true
return id
end
end


Line 334: Line 344:
-- is it within hearing range?
-- is it within hearing range?
if hz >= 20 and hz <= 20000 then
if hz >= 20 and hz <= 20000 then
-- TODO: better ids
local html_id = 'interval_' .. gen_id()
local html_id = 'interval_' .. math.random(0, 100000)
table.insert(infobox_data, {
table.insert(infobox_data, {
'<div style="display: flex; justify-content: space-around;"><div style="width: 270px; text-align: center;">'
'<div style="display: flex; justify-content: space-around;"><div style="width: 270px; text-align: center;">'