Skip to content

Instantly share code, notes, and snippets.

@igolaizola
Last active April 2, 2022 13:01
Show Gist options
  • Save igolaizola/dba4dd0492e550ea7602b154621709dd to your computer and use it in GitHub Desktop.
Save igolaizola/dba4dd0492e550ea7602b154621709dd to your computer and use it in GitHub Desktop.
Mercadona sync tool
<a href='javascript:(function(){if (window.location.host == "tienda.mercadona.es") {c="";JSON.parse(localStorage.getItem("MO-cart")).lines.forEach(function(e) { c+="xc"+e.product_id+"a"+e.quantity+"ab"; });open("https://www.telecompra.mercadona.es/ns/principal.php?cart="+c);} else if (window.location.host == "www.telecompra.mercadona.es") {const params = new Proxy(new URLSearchParams(window.location.search), {get: (searchParams, prop) => searchParams.get(prop),}); document.cookie="cesta="+params.cart;location.reload();}})();'>
merca-sync
</a>
javascript: (function() {
if (window.location.host == "tienda.mercadona.es") {
c = "";
JSON.parse(localStorage.getItem("MO-cart")).lines.forEach(function(e) {
c += "xc" + e.product_id + "a" + e.quantity + "ab";
});
open("https://www.telecompra.mercadona.es/ns/principal.php?cart=" + c);
} else if (window.location.host == "www.telecompra.mercadona.es") {
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
document.cookie = "cesta=" + params.cart;
location.reload();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment