diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-11-12 04:32:26 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-11-12 04:32:26 +0200 |
commit | 073352cb2bec05be8898385b54d74122846886e0 (patch) | |
tree | 781452834ae0f74047b57a998f246dcc7cca16ed /client | |
parent | 926c843a5f45bc79ac1d9f3f59cb379fef04043e (diff) | |
download | arching-kaos-radio-073352cb2bec05be8898385b54d74122846886e0.tar.gz arching-kaos-radio-073352cb2bec05be8898385b54d74122846886e0.tar.bz2 arching-kaos-radio-073352cb2bec05be8898385b54d74122846886e0.zip |
AK generator integration
Diffstat (limited to 'client')
-rw-r--r-- | client/index.html | 2 | ||||
-rw-r--r-- | client/js/app.js | 1 | ||||
-rw-r--r-- | client/js/arching-kaos-generator.js | 63 |
3 files changed, 66 insertions, 0 deletions
diff --git a/client/index.html b/client/index.html index 9d0ef33..426de56 100644 --- a/client/index.html +++ b/client/index.html @@ -207,7 +207,9 @@ </div> </div> </div> + <script src="./js/arching-kaos-generator.js"></script> <script src="./js/image_generator.js"></script> + <script src="./js/app.js"></script> <script src="./js/radio_emulator.js"></script> </body> </html> diff --git a/client/js/app.js b/client/js/app.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/client/js/app.js @@ -0,0 +1 @@ + diff --git a/client/js/arching-kaos-generator.js b/client/js/arching-kaos-generator.js new file mode 100644 index 0000000..67ab351 --- /dev/null +++ b/client/js/arching-kaos-generator.js @@ -0,0 +1,63 @@ +/* Arching Kaos Generator + * + * Kaotisk Hund - 2024 + * + * @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0 + * + */ +function makeElement(obj, attachTo) +{ + if (obj.element !== 'head' && obj.element !== 'body' ) + { + var temp = document.createElement(obj.element); + } + else if ( obj.id !== null && document.querySelector('#'+obj.id) ) + { + var temp = document.querySelector('#'+obj.id); + } + else + { + var temp = document.querySelector(obj.element); + } + if ( obj.id !== undefined ) temp.id = obj.id; + if ( obj.name !== undefined ) temp.name = obj.name; + if ( obj.type !== undefined ) temp.type = obj.type; + if ( obj.content !== undefined ) temp.content = obj.content; + if ( obj.property !== undefined ) temp.property = obj.property; + if ( obj.className !== undefined ) temp.className = obj.className; + if ( obj.rel !== undefined ) temp.rel = obj.rel; + if ( obj.href !== undefined ) temp.href = obj.href; + if ( obj.src !== undefined ) temp.src = obj.src; + if ( obj.as !== undefined ) temp.as = obj.as; + if ( obj.target !== undefined ) temp.target = obj.target; + if ( obj.alt !== undefined ) temp.alt = obj.alt; + if ( obj.charset !== undefined ) temp.charset = obj.charset; + if ( obj.value !== undefined ) temp.value = obj.value; + if ( obj.controls !== undefined ) temp.controls = obj.controls; + if ( obj.hidden !== undefined ) temp.hidden = obj.hidden; + if ( obj.placeholder !== undefined ) temp.placeholder = obj.placeholder; + if ( obj.classes !== undefined ) temp.classList = obj.classes; + if ( obj.innerText !== undefined ) temp.innerText = obj.innerText; + if ( obj.innerHTML !== undefined && Array.isArray(obj.innerHTML) ) + { + obj.innerHTML.forEach((value)=>{makeElement(value, temp)}); + } + else if ( obj.innerHTML !== undefined && typeof(obj.innerHTML) === "string" ) + { + temp.innerHTML = obj.innerHTML; + } + attachTo.appendChild(temp); +} + +function makeUpSite(tree, root){ + if ( tree !== undefined && Array.isArray(tree) ) + { + for (var i = 0; i < tree.length; i++) + { + makeElement(tree[i], root) + } + } +} + + +// @license-end |