tweak source showing

This commit is contained in:
nate smith 2024-02-19 00:15:47 -08:00
parent b482fb2a44
commit 240efcfac1
2 changed files with 8 additions and 6 deletions

View File

@ -20,17 +20,19 @@ class Button extends HTMLButtonElement {
}
class SourceShower extends Button {
connectedCallback() {
this.innerText = "?"
}
click() {
this.closest("div.line").querySelector("p[is=source-text]").toggle()
if (this.innerText == "show source") {
this.innerText = "hide source";
if (this.innerHTML.includes("strong")) {
this.innerHTML = "?";
} else {
this.innerText = "show source";
this.innerHTML = "<strong>?</strong>";
}
}
}
class LineRemover extends Button {
click() {
const container = this.closest("div.line");

View File

@ -3,7 +3,7 @@
<head>
<title>Trunkless</title>
<style>
div.line:not(.unpinned) {
div.line:not(.unpinned) > .linetext {
font-weight: bold;
}
</style>
@ -22,7 +22,7 @@
<button is="line-upper">up</button>
<button is="line-downer">down</button>
<button is="line-remover">remove</button>
<button is="source-shower">show source</button>
<button is="source-shower"></button>
</span>
<span class="linetext"></span>
<p is="source-text"></p>