Skip to content

Commit

Permalink
devcomthanks
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost committed Oct 19, 2023
1 parent 026f478 commit 086cb80
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 24 deletions.
8 changes: 3 additions & 5 deletions core/dumpling/a-dumpling.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ window.Frames = staticize(
)

function staticize(...names) {
const methodName = names[0]

function action(id, ...args) {
const action = (name) => (id, ...args) => {
const el = document.getElementById(id)
return el[methodName](...args)
return el[name](...args)
}

const actions = {}
for (const name of names) {
actions[name] = action
actions[name] = action(name)
}

return actions
Expand Down
1 change: 1 addition & 0 deletions forest/inventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export class Inventory {
const record = {
id: $el.id,
src,
partial: $inner.tagName === "P-ARTIAL",
attrs,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ <h2 id="limit" class="Limit"></h2>
<button id="action" class="Action">start</button>
</section>
</main>

<a-dumpling
id="devthanks"
w=69 h=69,
temperament="choleric",
no-back
no-close
hidden
>
<p-artial
src="/forest/items/devthanks/devthanks.html"
/>
</a-dumpling>
</body>

<style>
Expand Down Expand Up @@ -93,6 +106,8 @@ <h2 id="limit" class="Limit"></h2>
</style>

<script type="module">
import { Inventory } from "/forest/inventory.js"

// -- types --
const Actions = {
Start: 0,
Expand Down Expand Up @@ -406,10 +421,20 @@ <h2 id="limit" class="Limit"></h2>
return Math.floor(new Date().getTime() / 1000)
}

// window.addEventListener("show-frame", (evt) => {
// debugger
// console.log("devcom show frame", evt)
// })
d.State.listen("hasDevcom", () => {
if (d.State.hasDevcom) {
document.getElementById("devthanks").remove()
} else {
Inventory.get().addNamed("devthanks", {
"id": "devthanks",
"w": 69,
"h": 69,
"temperament": "choleric",
"no-back": true,
"no-close": true
})
}
})

// -- bootstrap --
init()
Expand Down
16 changes: 1 addition & 15 deletions index.p.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1 class="WorldName-text">
hidden
>
<p-artial
src="./forest/items/devcommentary/devcommentary.html"
src="./forest/items/devcom/devcom.html"
/>
</a-dumpling>
</main>
Expand Down Expand Up @@ -166,18 +166,4 @@ <h1 class="WorldName-text">
function OnDevToggleClicked() {
Frames.show("devcom")
}

// function OnDevCommentaryChanged() {
// if (d.State.hasDevcommentary) {
// document.getElementById("devthanks").hide()
// return
// }

// mInventory.addNamed("devthanks", {
// "w": 69, "h": 69,
// "temperament": "choleric",
// "no-back": true,
// "no-close": true,
// })
// }
</script>

0 comments on commit 086cb80

Please sign in to comment.