Skip to content

Commit

Permalink
idiot checks added
Browse files Browse the repository at this point in the history
  • Loading branch information
SunWorldDev committed Nov 30, 2023
1 parent 9a33266 commit a3383bd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ document.addEventListener("DOMContentLoaded", function() {
document.getElementById("addBtn").addEventListener("click", (e) => {
addFrame();
});

});

function openPopup() {
Expand All @@ -27,6 +26,15 @@ function closePopup() {

async function addFrame() {

if (document.getElementById('title').value == "") {
alert("Please enter a title!");
return;
}
if (document.getElementById('code').value == "") {
alert("Please enter a wiki code snippet!");
return;
}

await saveData();

closePopup();
Expand Down Expand Up @@ -86,7 +94,11 @@ async function loadData() {
for (const key in data) {
let frame = document.createElement("div");
frame.setAttribute("class", "frame");
frame.innerHTML = "<h2 data-code='" + data[key] + "'>" + key + "</h2>"
frame.setAttribute("data-code", data[key]);
frame.innerHTML = "<h2>" + key + "</h2>"
frame.addEventListener("click", (e) => {
navigator.clipboard.writeText(e.currentTarget.getAttribute("data-code"));
});
parent.appendChild(frame);
}
} catch (error) {
Expand Down

0 comments on commit a3383bd

Please sign in to comment.