Add "open all art" to every artwork-container
This commit is contained in:
parent
25fe08e6f4
commit
d2695fc180
11
views/js/run-at-document-end.js
Normal file
11
views/js/run-at-document-end.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { render, html } from './uhtml/index.js'
|
||||||
|
|
||||||
|
for (const el of document.querySelectorAll('.artwork-container,.artwork-container-scroll')) {
|
||||||
|
const artwork_container_actions_node = document.createElement('div');
|
||||||
|
el.parentElement.insertBefore(artwork_container_actions_node, el);
|
||||||
|
const openAllArt = () => {
|
||||||
|
let xs = el.querySelectorAll('div.artwork-small > a')
|
||||||
|
Array.from(xs).map(x=> window.open(x.href))
|
||||||
|
}
|
||||||
|
render(artwork_container_actions_node, html`<button onclick=${openAllArt}>Open all artworks</button>`);
|
||||||
|
}
|
2
views/js/uhtml/index.js
Normal file
2
views/js/uhtml/index.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -125,5 +125,6 @@
|
||||||
<main>
|
<main>
|
||||||
{{ embed() }}
|
{{ embed() }}
|
||||||
</main>
|
</main>
|
||||||
|
<script type="module" src="/js/run-at-document-end.js" ></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue