diff --git a/wiktionary/quotes.html b/wiktionary/quotes.html index 1ce205d..59d060b 100644 --- a/wiktionary/quotes.html +++ b/wiktionary/quotes.html @@ -13,27 +13,59 @@ text-decoration-style: dotted; text-decoration: underline; } + html { + background-color: black; + filter: invert(1); + } @@ -42,36 +74,21 @@

en.wiktionary Quote Generator

(?)

-

Basic information

+
+

Basic information

+
+

- - - - - - - - -
-

Additional information

-
-
- - - - - +
+

Additional information

+
+
+


- +
@@ -105,20 +122,50 @@ generate(); navigator.clipboard.writeText(document.getElementById("out").innerHTML); } - function addNamedParameters(obj) { + function addNamedParameters(obj, ignore = ["type", "language"]) { let out = ""; for (const key in obj) { + if (obj[key] == "" || ignore.includes(key)) continue; out += `|${key}=${obj[key]}`; } return out; } function loadPresetList() { - const items = {...localStorage}; + const items = {...localStorage}; delete items.latestPreset; for (const key in items) { addPresetToMenu(key); } + console.log(localStorage.getItem("latestPreset")); + loadPreset(localStorage.getItem("latestPreset")); } - function addPresetToMenu(key) { + function generatePropertyInputs() { + for (const key in parameters) { + const label = document.createElement("label"); + label.innerText = parameters[key].label; + + let input; + if (parameters[key].type === "dropdown") { + input = document.createElement("select"); + for (const optionName in parameters[key].fields) { + const option = document.createElement("option"); + option.value = optionName; + option.innerText = parameters[key].fields[optionName]; + input.appendChild(option) + } + } else if (parameters[key].type === "textarea") { + input = document.createElement("textarea"); + input.cols = 60; + input.rows = 6; + } else { + input = document.createElement("input"); + input.type = "text"; + } + input.id = key; + document.getElementById(parameters[key].section).appendChild(label); + document.getElementById(parameters[key].section).appendChild(input); + } + } + function addPresetToMenu(key) { const existingPresets = document.querySelectorAll("#presets option"); for (const node of existingPresets) { if (node.value === key) { @@ -146,19 +193,17 @@ function loadPreset(presetName) { document.getElementById("preset-name").value = presetMenu.value; const parameterValues = JSON.parse(localStorage.getItem(presetName)); - console.log(parameterValues) for (const key in parameterValues) { document.getElementById(key).value = parameterValues[key]; } + localStorage.setItem("latestPreset", presetName); } function deletePreset() { const presetName = document.getElementById("preset-name").value; localStorage.removeItem(presetName); const existingPresets = presetMenu.children; let currentPresetOptionNode; - console.log(presetName); for (const node of existingPresets) { - console.log(node.value); if (node.value === presetName) { currentPresetOptionNode = node; break;