2024-10-15 18:02:26 +00:00
|
|
|
const addStringButton = document.getElementById("add-string-button");
|
|
|
|
addStringButton.addEventListener("click", (e) => {
|
|
|
|
const stringName = prompt("Enter a string name: ");
|
2024-10-15 18:19:24 +00:00
|
|
|
if (!stringName) {
|
2024-10-15 18:02:26 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (let section of document.getElementsByClassName("translation-section")) {
|
|
|
|
// <label for="{{ string }}">{{ string }}</label>
|
|
|
|
// <input type="text" id="{{ string }}" name="{{ string }}" value="{{ translation }}">
|
|
|
|
// <br>
|
|
|
|
const label = document.createElement("label");
|
|
|
|
label.setAttribute("for", stringName);
|
|
|
|
label.innerText = stringName;
|
|
|
|
|
|
|
|
const input = document.createElement("input");
|
|
|
|
input.setAttribute("type", "text");
|
|
|
|
input.setAttribute("id", stringName);
|
|
|
|
input.setAttribute("name", stringName);
|
|
|
|
input.setAttribute("value", "");
|
|
|
|
|
|
|
|
const br = document.createElement("br");
|
|
|
|
|
|
|
|
section.appendChild(label);
|
|
|
|
section.appendChild(input);
|
|
|
|
section.appendChild(br);
|
|
|
|
}
|
|
|
|
});
|