Skip to content

Instantly share code, notes, and snippets.

@searls
Last active June 17, 2025 16:40
Show Gist options
  • Select an option

  • Save searls/7ba37ceb824321e5bd0a89c61bee049f to your computer and use it in GitHub Desktop.

Select an option

Save searls/7ba37ceb824321e5bd0a89c61bee049f to your computer and use it in GitHub Desktop.

Revisions

  1. searls revised this gist Aug 15, 2024. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion extension_murderer_controller.js
    Original 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 (node.nodeName.toLowerCase() === 'com-1password-button') {
    if (BANNED_NODES.includes(node.nodeName.toLowerCase())) {
    node.remove()
    }
    })
  2. searls created this gist Aug 15, 2024.
    24 changes: 24 additions & 0 deletions extension_murderer_controller.js
    Original 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
    }
    }
    }