var crfHTML={}; crfHTML.print= function(msg){ console.log(msg); } crfHTML.init= function(cb=null){ LABKEY.requiresCss("crfTecant/crfHTML.css"); this.print('CSS loaded'); if (cb) cb(); } crfHTML.makeSelect= function(qMap,id=null,el=null){ let fName='[makeSelect]'; let input=document.createElement('select'); let opt = document.createElement("option"); opt.text = ""); //add other, label them with LUT for (let v in qMap) { this.print(fName+': populating '+v+': '+qMap[v]); let opt = document.createElement("option"); opt.text = qMap[v]; opt.value = v; input.options[input.options.length] = opt; } input.selectedIndex=0; this.append(input,id,el); return input; } crfHTML.append= function(element,id=null,el=null){ if (id) document.getElementById(id).appendChild(element); if (el) el.appendChild(element); } crfHTML.clear= function(el){ while (el.hasChildNodes()){ el.removeChild(el.lastChild); } } crfHTML.createTable= function(id=null,el=null,style=null){ let table=document.createElement('table'); this.append(table,id,el); if (style) this.addStyle(style); return table; } crfHTML.addStyle= function(el,style){ el.classList.add(style); } crfHTML.createBox= function(id=null,el=null){ let fbox=document.createElement('div'); fbox.classList.add("box"); this.append(fbox,id,el); return fbox; } crfHTML.createParagraph= function(text,id=null,el=null){ let fp=document.createElement("p"); fp.innerHTML=text; fp.classList.add("center"); this.append(fp,id,el); }