diff --git a/public/global.css b/public/global.css index 157a1a0..cdc1c58 100644 --- a/public/global.css +++ b/public/global.css @@ -42,14 +42,19 @@ input:disabled { button { color: #333; - background-color: #f4f4f4; + background-color: #f4f4f463; outline: none; + padding: 0.1rem 0.1rem; + margin-left: 0.3rem; } button:disabled { color: #999; } +button:disabled:hover { + cursor: default; +} .button { color: #333; background-color: #f4f4f4; @@ -67,6 +72,9 @@ button:focus { border-color: #666; } +button:hover { + cursor: pointer; +} /* custom part */ .formgrid { @@ -160,11 +168,29 @@ select { } .fmShown { + display: block; +} + +.fmMetaTitle { + margin-bottom: 0.3rem; + text-transform: capitalize; + display: block; + background: #00000008; + text-align: right; + font-size: smaller; +} + +.fmMeta { + border-bottom: 2px #0000001a solid; + padding-bottom: 1rem; + margin-bottom: 0.5rem; + background: #ffffff1c; +} + +.fmItem { display: grid; grid-template-columns: auto 1fr; grid-gap: 1rem; - padding-bottom: 1rem; - margin-bottom: 0.5rem; } .fmCollapse, .fmExpand { @@ -185,6 +211,7 @@ select { #fmicon, #frontmatter, input.hasinput { background-color: #ffccbc; + padding-right: 0.3rem; } .newtiers { diff --git a/src/App.svelte b/src/App.svelte index c90279c..db8b613 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -14,7 +14,7 @@ let hasesCandidates = []; let frontmatter = {}; frontmatter["triad"] = []; - frontmatter["ascriptions"] = []; + frontmatter["ascription"] = []; frontmatter["notsand"] = []; function keyUp(e) { @@ -28,7 +28,7 @@ ...frontmatter["triad"].map((t) => { return t.fmKey; }), - ...frontmatter["ascriptions"].map((t) => { + ...frontmatter["ascription"].map((t) => { return t.fmKey; }), ]); @@ -46,21 +46,21 @@ let tiers = []; let candidates = []; if (fmKey == "_new") { - hasesCandidates = [... new Set(reckonHasesCandidates())] + hasesCandidates = [...new Set(reckonHasesCandidates())]; if (hasesCandidates.length > 0) { - fmKey = hasesCandidates[0] + fmKey = hasesCandidates[0]; } } if (fmKey != "_new") { if (fmValue) { - METASP[fmKey].tiers.forEach((t) => { - if (fmValue.includes(t.file)) { - tiers.push(t); - } else { - candidates.push(t); - } - }) + METASP[fmKey].tiers.forEach((t) => { + if (fmValue.includes(t.file)) { + tiers.push(t); + } else { + candidates.push(t); + } + }); } else { tiers = []; candidates = METASP[fmKey].tiers; @@ -72,8 +72,8 @@ }); frontmatter = { ...frontmatter }; } - hasesCandidates = [... new Set(reckonHasesCandidates())] - toggleNewTiersButtons() + hasesCandidates = [...new Set(reckonHasesCandidates())]; + toggleNewTiersButtons(); } function loadHugoPageMetadata(editHash) { @@ -97,14 +97,14 @@ fmKey = fmKey.substr(4); } } else if (hases.includes(fmKey.toLowerCase())) { - fmKeyType = "ascriptions"; + fmKeyType = "ascription"; } else if (["abstract", "keywords"].includes(fmKey.toLowerCase())) { fmKeyType = "journal"; } else { fmKeyType = "notsand"; } - if (["triad", "ascriptions"].includes(fmKeyType)) { + if (["triad", "ascription"].includes(fmKeyType)) { if (Array.isArray(fmValue)) { newTier(fmKeyType, fmKey, fmValue); } @@ -149,6 +149,19 @@ } } + function fmItemDottedBorder(e) { + e.target.parentNode.parentNode.style.border = "2px #ff000075 dotted"; + } + + function fmItemNoBorder(e) { + e.target.parentNode.parentNode.style.border = "0px"; + } + + function removeTier(fmKey, fmValue) { + frontmatter[fmKey] = frontmatter[fmKey].filter((v) => v["fmKey"] != fmValue["fmKey"]); + toggleNewTiersButtons(); + } + function toggleFold() { let e = document.getElementById("frontmatter"); if (e && e.classList.contains("fmHidden")) { @@ -168,24 +181,24 @@ } } - function toggleNewTiersButtons() { - hasesCandidates = [... new Set(reckonHasesCandidates())] + function toggleNewTiersButtons() { + hasesCandidates = [...new Set(reckonHasesCandidates())]; - if (hasesCandidates.length == 0) { - document.querySelectorAll(".newtiers").forEach((button)=> { - button.style.display = "none"; - }) - } else { - document.querySelectorAll(".newtiers").forEach((button)=> { - button.style.display = "block"; - }) - } + if (hasesCandidates.length == 0) { + document.querySelectorAll(".newtiers").forEach((button) => { + button.style.display = "none"; + }); + } else { + document.querySelectorAll(".newtiers").forEach((button) => { + button.style.display = "block"; + }); + } - const ct = Object.entries(frontmatter).filter((i) => i[1].length == 0 && i[0] == "triad")[0]; - if (!ct) { - document.getElementById("newtriad").style.display = "none"; - } - } + const ct = Object.entries(frontmatter).filter((i) => i[1].length == 0 && i[0] == "triad")[0]; + if (!ct) { + document.getElementById("newtriad").style.display = "none"; + } + } function dispatchHash() { const searchParams = new URLSearchParams(location.search); @@ -194,17 +207,17 @@ loadHugoPageMetadata(editHash); } else { let newPage = searchParams.get("new"); - console.log({newPage}); + console.log({ newPage }); } } onMount(() => { dispatchHash(); // loadHugoPageMetadata(); - console.dir({frontmatter}); + console.dir({ frontmatter }); }); - $: hashChanged = () => dispatchHash(); + $: hashChanged = () => dispatchHash(); @@ -217,36 +230,65 @@ {#each Object.entries(frontmatter) as fmItems} {#each fmItems[1] as fmItem, i} - {#if ["ascriptions", "triad"].includes(fmItems[0])} - - - + {#if ["ascription", "triad"].includes(fmItems[0])} +
+
+ {fmItems[0]} +
+
+ + + +
+
{:else if fmItems[0] == "journal"} - +
+
+ {fmItems[0]} +
+
+ +
+
{/if} {/each} {/each}
-
newTier("triad", "_new", null)}>NEW TIER
-
newTier("ascriptions", "_new", null)}> +
newTier("triad", "_new", null)}> + NEW TIER +
+
newTier("ascription", "_new", null)} + > NEW ASCRIPTION