From caa53ec2467473cccd2a4932c35d4271bc714068 Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Wed, 13 Feb 2019 14:41:41 +0100 Subject: [PATCH] Add script for Auchan Drive --- AuchanDrive_allergies.user.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 AuchanDrive_allergies.user.js diff --git a/AuchanDrive_allergies.user.js b/AuchanDrive_allergies.user.js new file mode 100644 index 0000000..4b6758c --- /dev/null +++ b/AuchanDrive_allergies.user.js @@ -0,0 +1,17 @@ +// ==UserScript== +// @name Auchan Drive allergies +// @namespace http://amnesix.eu +// @description Affiche une alerte lorsqu'un produit contient un des ingrédients interdits +// @include https://www.auchandrive.fr/* +// @include http://www.auchandrive.fr/* +// @version 0.1 +// @grant none +// @require https://code.amnesix.eu/guillaume/allergies-userscripts/raw/branch/master/Allergies-1.1.js +// ==/UserScript== +(function() { + var ingredients = Array.from(document.querySelectorAll('div.pdp-bottom-infos__title span')) + .filter(function(span) { return span.textContent == 'Composition'; }) + .map(function(span) { return span.closest('div.pdp-bottom-infos__container').querySelector('div.pdp-bottom-infos__content'); }) + + ingredients.forEach(Allergies.process); +})();