Thank you so much for getting back to me lustek, even after the topic was dormant for a year!
It still doesn't work though, it's actually ASDA's site not Tesco's, and the structure is completely different, I have to use a Element Scroll Down rather than Element, and I thought I have changed the "getElementsByClassName" bit of code accordingly, but it's still not right. I suspect it's this "getElements" bit I also have to change, but not sure what to.
Would you mind taking a quick look at my code, it will probably only take you a minute (I spent almost the whole morning on it xD):
Thank you so much!
Tampermonkey:
// ==UserScript==
// @name New Userscript
// @namespace https://groceries.asda.com
// @version 0.1
// @description try to take over the world!
// @author You
// @include https://groceries.asda.com/
// @grant none
// ==/UserScript==
(function (){
'use strict';
var anchor=document.getElementsByClassName("#listingsContainer div.product-content");
for(var i = 0; i < anchor.length; i++){
anchor[i].href=anchor[i].href + "#from=" +window.location.href ;
};
})()
ASDA Site Map:
{"id":"atp-asda","startUrl":["https://groceries.asda.com/aisle/vegetarian-free-from/vegetarian//103590"],"selectors":[{"id":"section","type":"SelectorLink","parentSelectors":["_root"],"selector":".noChild a","multiple":true,"delay":0},{"id":"scroll","type":"SelectorElementScroll","parentSelectors":["section"],"selector":"#listingsContainer div.product-content","multiple":true,"delay":"1000"},{"id":"item","type":"SelectorLink","parentSelectors":["scroll"],"selector":"a.line-clamp","multiple":false,"delay":0},{"id":"name","type":"SelectorText","parentSelectors":["item"],"selector":"h1","multiple":false,"regex":"","delay":0},{"id":"price","type":"SelectorText","parentSelectors":["item"],"selector":"span.prod-price-inner","multiple":false,"regex":"","delay":0},{"id":"productcode","type":"SelectorText","parentSelectors":["item"],"selector":".prod-code span","multiple":false,"regex":"","delay":0},{"id":"weight","type":"SelectorText","parentSelectors":["item"],"selector":"span.weight","multiple":false,"regex":"","delay":0},{"id":"allergy","type":"SelectorText","parentSelectors":["item"],"selector":"strong p","multiple":false,"regex":"","delay":0},{"id":"ingredients","type":"SelectorText","parentSelectors":["item"],"selector":".product-description p:nth-of-type(3)","multiple":false,"regex":"","delay":0},{"id":"nutrition","type":"SelectorText","parentSelectors":["item"],"selector":"div.nv-table","multiple":false,"regex":"","delay":0},{"id":"address","type":"SelectorText","parentSelectors":["item"],"selector":"span:nth-of-type(1) p","multiple":false,"regex":"","delay":0}]}