cleanup + disabled autocomplete for form selectboxes

This commit is contained in:
Leon van Kammen 2026-08-11 22:29:08 +02:00
parent 257b9f56e1
commit 70e03b2b71
2 changed files with 8 additions and 6 deletions

View file

@ -18,14 +18,17 @@ function pluginInput(opt)
local key = opt.key:gsub("^app.opts.","")
local value = EscapeHtml( app.opts[ key ] )
if type(opt.values) == 'table' then
html = html .. util.template('<select name="${key}" value="${value}">\n', {
html = html .. util.template('<select name="${key}" autocomplete="off">\n', {
key = opt.key,
value = value
})
foreach( opt.values, function(k,v)
html = html .. util.template('<option value="${k}">${v}</option>\n',{
local selected = ''
if value == k then selected = 'selected="selected"' end
html = html .. util.template('<option value="${k}" ${selected}>${v}</option>\n',{
k=k,
v=v
v=v,
selected=selected
})
end)
html = html .. "</select>\n"
@ -85,11 +88,11 @@ function saveData()
end
end)
if saveconfig then
app.set('app.opts', app.opts )
data.notification = '<div class="notification">updated</div>'
else
data.notification = '<div class="notification">no changes detected</div>'
end
print(app.opts.plugin_global_homepage)
end
end

View file

@ -43,7 +43,6 @@ end}
function addPortal(id,x,v,url,i,z,thumb,rotation,scale)
print('\t<object js_id="' .. id .. '_' .. i .. '" pos="' .. x .. ' 0 ' .. z .. '" rotation="' .. rotation .. '">')
print('\t <link url="' .. url .. '" ' .. thumb .. ' title_col="0.4 0.37 0.4" pos="0 0 0.001" draw_glow="true" scale="3 3 0.1" />')
print('\t <link url="' .. url .. '" shader_id="xrforgeportal" pos="0 0 0.003" draw_glow="false" scale="3 3 0.1" />')
print('\t <text text="' .. v.title .. '" pos="0 3.4 0" col="1 1 1" font_scale="false" scale="' .. scale .. '" />')
print('\t</object>')
end
@ -58,7 +57,7 @@ end}
local center = -((#items*width)/1.3) + (i*width)
local url = v.url
local thumb = ' shader_id="defaultportal"'
if v.thumbnail then
if #v.thumbnail > 0 then
thumb = ' thumb_id="img' .. i .. '" '
end
if v.dir then url = url .. "/" end