minecraft-monitor/web/js/svg-click.js

10 lines
351 B
JavaScript

// add a simple click event to the SVG for browsers that don't allow you to hover
document.addEventListener('DOMContentLoaded', (event) => {
document.querySelector('svg').addEventListener('click', (event) => {
const maybeTitle = event.target.firstChild
if (maybeTitle instanceof SVGTitleElement)
alert(maybeTitle.textContent)
})
})