nodality
Version:
A lightweight library for declarative UI elements.
2 lines • 2.62 kB
JavaScript
/*! For license information please see cardGetter.cjs.js.LICENSE.txt */
(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function n(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,r(n.key),n)}}function r(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}e.r(t),e.d(t,{CardGen:()=>a});var a=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"cards",value:function(e,t,o){console.log("PP"),console.log(o);for(var n=[],r=0;r<e.children.length;r++){var a=e.children[r];"text"===a&&this.insertTextToCard(n,t,e,o),"image"!==a||e.backgroundCard||n.push('\n new Image("https://upload.wikimedia.org/wikipedia/commons/3/3a/Starship_S20.jpg").set({})'),"link"===a&&(t.op?n.push("\n ".concat(o.tabSpace(6)," ").concat(o.link[t.op.theme.toLowerCase()].code)):n.push("\n ".concat(o.tabSpace(6)," ").concat(o.link.base.code)))}return n}},{key:"insertTextToCard",value:function(e,t,o,n){if(t.op)if(t.op.ops&&t.op.ops.includes("text-blast")){var r="\n ".concat(n.tabSpace(6)," ").concat(n.text[t.op.theme.toLowerCase()].code),a=n.ops[t.op.theme.toLowerCase()].blast.code;o.backgroundCard||(a=n.ops[t.op.theme.toLowerCase()].blastFun(1));var c=this.insertTextBetween(r,a);e.push(c)}else e.push("\n ".concat(n.tabSpace(6)," ").concat(n.text[t.op.theme.toLowerCase()].code));else e.push("\n ".concat(n.tabSpace(6)," ").concat(n.text.base.code))}},{key:"insertTextBetween",value:function(e,t){var o=e.match(/(color: ".+?",)(.+?)(id: ".+?")/);if(o){var n=o.index+o[0].length,r=e.slice(0,n)+", "+t+", "+e.slice(n);return console.log("RETA"),console.log(r),r}return e}}],null&&n(e.prototype,null),t&&n(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();module.exports=t})();