Last active
June 17, 2025 16:40
-
-
Save searls/7ba37ceb824321e5bd0a89c61bee049f to your computer and use it in GitHub Desktop.
Revisions
-
searls revised this gist
Aug 15, 2024 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,12 @@ import { Controller } from '@hotwired/stimulus' const BANNED_NODES = ['com-1password-button', 'com-1password-menu'] export default class extends Controller { connect () { this.observer = new window.MutationObserver(mutations => { mutations.forEach(mutation => { mutation.addedNodes.forEach(node => { if (BANNED_NODES.includes(node.nodeName.toLowerCase())) { node.remove() } }) -
searls created this gist
Aug 15, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import { Controller } from '@hotwired/stimulus' export default class extends Controller { connect () { this.observer = new window.MutationObserver(mutations => { mutations.forEach(mutation => { mutation.addedNodes.forEach(node => { if (node.nodeName.toLowerCase() === 'com-1password-button') { node.remove() } }) }) }) this.observer.observe(document.body, { childList: true, subtree: true }) } disconnect () { if (this.observer) { this.observer.disconnect() this.observer = null } } }