Skip to content

Commit

Permalink
contextjs example and ubg print playtest cards
Browse files Browse the repository at this point in the history
SQUASHED: AUTO-COMMIT-demos-contextjs-showfocuslayer.md,AUTO-COMMIT-demos-stefan-untitled-board-game-ubg-cards-exporter.js,AUTO-COMMIT-src-client-vivide-vivide.js,AUTO-COMMIT-src-client-vivide-Vivide.png,AUTO-COMMIT-src-components-widgets-ubg-cards.html,AUTO-COMMIT-src-components-widgets-ubg-cards.js,
  • Loading branch information
onsetsu committed Sep 9, 2024
1 parent 69e039a commit 1e04683
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
21 changes: 15 additions & 6 deletions demos/contextjs/showfocuslayer.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# ShowFocus Layer
# ContextJS in Action: ShowFocus Layer

And I wrote it again.... Because I did not look for <edit://demos/contextjs/showfocuslayer.js> first
<script>
import {autoRunSnippet} from "src/client/essay.js";
autoRunSnippet(this, ".testScript")
</script>

```js
```JavaScript {.testScript}
import * as cop from "src/client/ContextJS/src/contextjs.js";

cop.layer(window, "ShowFocus").refineClass(HTMLElement, {
Expand All @@ -15,7 +18,13 @@ cop.layer(window, "ShowFocus").refineClass(HTMLElement, {

})

ShowFocus.beGlobal()
const group = <div>
Click the buttons to activate the layer globally.<br/>
While active, the layer visually shows which HTMLElements get focussed.
<button click={evt => ShowFocus.beGlobal()}>Make Global</button>
<button click={evt => ShowFocus.beNotGlobal()}>Undo Global</button>
Done using the following code:
</div>;

ShowFocus.beNotGlobal()
```
group
```
8 changes: 8 additions & 0 deletions demos/stefan/untitled-board-game/ubg-cards-exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ export default class CardExporter {
}
document.title = `cards-${moment().format('YYYY-MM-DD-HH-mm-ss')}`


lively.removeEventListener('cards-printer')
lively.addEventListener('cards-printer', window, 'beforeprint', evt => {
console.log('bPrint')
})
lively.addEventListener('cards-printer', window, 'afterprint', evt => {
console.log('aPrint')
})
await lively.sleep(1000)
window.print()
await lively.sleep(1000)
Expand Down
Binary file added src/client/vivide/Vivide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/client/vivide/vivide.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

/*MD # Vivide
![Vivide](./Vivide.png)
MD*/
/**
* The high level entry point to vivide
* call at least with some data as Array as argument
Expand Down
2 changes: 2 additions & 0 deletions src/components/widgets/ubg-cards.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
<div id="buttons">
<input id="filter" title="Ctrl+/" placeholder="filter: regex fire\b or > c.getId() > 1000"/>
<button id="onlyGoodCards" title="adjust filter to only the best cards"><i class="fa fa-thumbs-o-up" aria-hidden="true"></i></button>
<button id="onlyCardsToTest" title="adjust filter to only cards to test"><i class="fa fa-comments-o" aria-hidden="true"></i></button>
<button id="onlyNewCards" title="adjust filter to only new cards"><i class="fa fa-plus-square-o" aria-hidden="true"></i></button>
<button id="startCardScanner" title="start scanning playtested cards"><i class="fa fa-barcode" aria-hidden="true"></i></button>
<button id="sortById" title="sort cards by id"><i class="fa fa-sort" aria-hidden="true"></i>by id</button>
<button id="sortByName" title="sort cards by name"><i class="fa fa-sort" aria-hidden="true"></i>by name</button>
Expand Down
9 changes: 9 additions & 0 deletions src/components/widgets/ubg-cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,15 @@ export default class Cards extends Morph {
this.filterChanged(evt)
}

onOnlyCardsToTest(evt) {
this.filter.value = `> !c.getRating() || c.getRating() === 'to test'`
this.filterChanged(evt)
}

onOnlyNewCards(evt) {
this.filter.value = `> !c.getRating()`
this.filterChanged(evt)
}
onStartCardScanner(evt) {
lively.openComponentInWindow('ubg-cards-scanner', undefined, lively.pt(1000, 800))
}
Expand Down

0 comments on commit 1e04683

Please sign in to comment.