Add "open all art" to every artwork-container

This commit is contained in:
iacore 2024-02-17 23:45:04 +00:00
parent 25fe08e6f4
commit d2695fc180
Signed by untrusted user who does not match committer: iacore
GPG key ID: F8C16E5157A63006
3 changed files with 14 additions and 0 deletions

View 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

File diff suppressed because one or more lines are too long

View file

@ -125,5 +125,6 @@
<main>
{{ embed() }}
</main>
<script type="module" src="/js/run-at-document-end.js" ></script>
</body>
</html>