fix max module name length and hidden module power (1. and 2. of #337)

This commit is contained in:
lumapu 2022-10-11 16:13:28 +02:00
parent 7cd075fbad
commit f53933b473
2 changed files with 54 additions and 49 deletions

View file

@ -1,5 +1,5 @@
function toggle(name, hide) {
var elm = document.getElementsByName(name)[0];
function toggle(id, hide) {
var elm = document.getElementById(id);
if(hide) {
if(!elm.classList.contains("hide"))
elm.classList.add("hide");
@ -32,19 +32,22 @@ function des(val) {
return e;
}
function lbl(id, val) {
function lbl(htmlfor, val, cl=null, id=null) {
e = document.createElement('label');
e.htmlFor = id;
e.htmlFor = htmlfor;
e.innerHTML = val;
if(null != cl) e.classList.add(...cl);
if(null != id) e.id = id;
return e;
}
function inp(name, val, max=32, cl=["text"]) {
function inp(name, val, max=32, cl=["text"], id=null) {
e = document.createElement('input');
e.classList.add(...cl);
e.name = name;
e.value = val;
e.maxLength = max;
if(null != id) e.id = id;
return e;
}