treehouse/static/js/usability.js

19 lines
570 B
JavaScript
Raw Normal View History

2023-08-18 20:58:07 +02:00
// Bits and pieces to make the treehouse just a bit more easy to explore.
2023-08-18 17:04:12 +02:00
// We want to let the user have a selection on collapsible blocks without collapsing them when
// the user finishes marking their selection.
document.addEventListener("click", event => {
if (getSelection().type == "Range") {
event.preventDefault();
}
})
2024-02-20 23:30:36 +01:00
// Certain words don't make sense if scripts are disabled.
class YesScript extends HTMLElement {
connectedCallback() {
this.classList.add("yes-indeed");
}
}
customElements.define("th-yesscript", YesScript);