Add mutation observer to Leclerc Drive script
parent
66d893330f
commit
bdddde7c89
|
@ -4,7 +4,7 @@
|
|||
// @description Affiche une alerte lorsqu'un produit contient un des ingrédients interdits
|
||||
// @include https://*.leclercdrive.fr/*
|
||||
// @include http://*.leclercdrive.fr/*
|
||||
// @version 0.1
|
||||
// @version 1.0
|
||||
// @grant none
|
||||
// @require https://code.amnesix.eu/guillaume/allergies-userscripts/raw/branch/master/Allergies-1.1.js
|
||||
// ==/UserScript==
|
||||
|
@ -13,5 +13,15 @@
|
|||
if(ingredients != null) {
|
||||
Allergies.process(ingredients);
|
||||
}
|
||||
|
||||
var product = document.querySelector('div#divContenuCentre > div');
|
||||
|
||||
if(product != null) {
|
||||
var observer = new MutationObserver(function(mutations) {
|
||||
var composition = document.querySelector('div#fiche-produit-composition p.accordeons-detail-paragaphe');
|
||||
Allergies.process(composition);
|
||||
});
|
||||
observer.observe(product, {childList: true});
|
||||
}
|
||||
})();
|
||||
|
||||
|
|
Loading…
Reference in New Issue