diff options
author | WlodekM <[email protected]> | 2024-11-30 19:17:18 +0200 |
---|---|---|
committer | WlodekM <[email protected]> | 2024-11-30 19:17:18 +0200 |
commit | 9a51a4caf91c455ec5072fa2d50668dd69df5c02 (patch) | |
tree | 5d5e7ce9a7bb79acf6020cb9db98f24184acf9a3 /lib | |
parent | 97157622be86c68f69e6e48f3746ca2c70b7e8a8 (diff) |
replies n shit
Diffstat (limited to 'lib')
-rw-r--r-- | lib/htmlbuilder.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/htmlbuilder.js b/lib/htmlbuilder.js index 7343116..483b77b 100644 --- a/lib/htmlbuilder.js +++ b/lib/htmlbuilder.js @@ -32,9 +32,15 @@ function makeSigmaHtmlPlusElement(elem) { return elem.parentElement } elem.for = function (array, func) { - array.forEach(element => elem.appendChild(func(element))); + array.forEach((element, i) => elem.appendChild(func(element, i))); return elem } + elem.if = function (condition, type) { + if(condition) return; + let childElem = makeSigmaHtmlPlusElement(document.createElement(type)); + elem.appendChild(childElem) + return childElem; + } return elem; } |