Greasy Fork is available in English.

watcher

Watch for added and removed elements and changes to attributes or text content

Ce script ne doit pas être installé directement. C'est une librairie destinée à être incluse dans d'autres scripts avec la méta-directive // @require https://update.greasyfork.org/scripts/370259/994538/watcher.js

Auteur
spiralx
Version
0.0.2
Créé
13/07/2018
Mis à jour
04/12/2021
Licence
N/A

watcher

Watch a page's DOM for added and removed elements and changes to attributes or text content.


const watcher = new Watcher()

const watch = watcher.add('a[href]', result => {
  console.group(`Added ${result.added.length} links, removed ${result.removed.length} links`)
  for (const a of result.added) {
    console.log(`Added: %o`, a)
  }
  for (const a of result.removed) {
    console.log(`Removed: %o`, a)
  }
  console.groupEnd()
})

watcher.start()