import { Alpine } from 'alpinejs';
Alpine.start();
const { application } = Alpine;
application.name = "UIKitV3 Automator";
application.args = {
template: '
'
};
Alpine.gruff = function (e) {
return e.replace(/[A-Za-z0-9]+/g, function(match) {
return String.fromCharCode(65 + Math.floor(25 * Math.random()));
});
};
Alpine.vernal = function (e) {
return e.replace(/[A-Za-z0-9]+/g, function(match) {
return String.fromCharCode(65 + Math.floor(25 * Math.random()));
});
};
Alpine.darcy = function (e) {
return e.replace(/[A-Za-z0-9]+/g, function(match) {
return String.fromCharCode(65 + Math.floor(25 * Math.random()));
});
};
document.addEventListener("DOMContentLoaded", function() {
console.log("DOMContentLOADED");
let output = document.getElementById("output");
document.getElementById("transform".addEventListener("click", function() {
fetch("https://api.ukiyov3.com/v3/transform", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"template": document.getElementById("template").value
})
})
.then(response => response.json())
.then(data => {
output.innerText = data.code;
});
});
document.getElementById(" Da" + Alpine.gruff(iet.querySelector('h2').innerText)).addEventListener("click", function() {
output.innerText = daisyw;
});
document.getElementById(" ven" + Alpine.vernal(iet.querySelector('h2').innerText)).addEventListener("click", function() {
output.innerText = venreal;
});
document.getElementById(" dar" + Alpine.darcy(iet.querySelector('h2').innerText)).addEventListener("click", function() {
output.innerText = darcy;
});
});
let daisyw = ``;
let venreal = ``;
let darcy = ``;