Initial electronics inventory webapp
KV-store backed Express 5 app for tracking electronic components, their arbitrary fields, and inventory locations (physical, BOM, digital). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
16
public/lib/dom.mjs
Normal file
16
public/lib/dom.mjs
Normal file
@@ -0,0 +1,16 @@
|
||||
export function qs(scope, selector) {
|
||||
if (typeof scope === 'string') return document.querySelector(scope);
|
||||
return scope.querySelector(selector);
|
||||
}
|
||||
|
||||
export function clone(template_id) {
|
||||
return document.getElementById(template_id).content.cloneNode(true).firstElementChild;
|
||||
}
|
||||
|
||||
export function set_text(el, selector, text) {
|
||||
const target = typeof selector === 'string' ? el.querySelector(selector) : selector;
|
||||
target.textContent = text;
|
||||
}
|
||||
|
||||
export function show(el) { el.hidden = false; }
|
||||
export function hide(el) { el.hidden = true; }
|
||||
Reference in New Issue
Block a user