Skip to content

Instantly share code, notes, and snippets.

@jkcgs
Last active October 9, 2020 04:23
Show Gist options
  • Save jkcgs/9e559c976af6412851bd07290c87f6ec to your computer and use it in GitHub Desktop.
Save jkcgs/9e559c976af6412851bd07290c87f6ec to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name LibreMercado
// @namespace https://mak.wtf/
// @match *://*.mercadolibre.cl/*
// @grant none
// @version 1.1.0
// @author makzk
// @description 10/9/2020, 01:23:15 PM
// ==/UserScript==
// Basado en:
// https://github.com/ivanMSC/LibreMercadoPorFin
(function(d) {
// Cargar sólo si es una página de resultados
if (!d.querySelector('section.ui-search-results')) return;
(function load () {
// Apuntar al flair del tipo de productos, filtrar por los que dicen "Internacional",
// obtener el <li> parent, y filtrar los que no hayan sido ocultados.
let results = Array.from(d.querySelectorAll('span.ui-search-item__details'))
.filter(i => i.textContent === 'Internacional')
.map(j => j.closest('li.ui-search-layout__item'))
.filter(k => k.style.display !== "none");
// Si se encontraron productos internacionales, ocultarlos y volver a llamar
if (results.length > 0) {
results.forEach(i => { i.style.display = "none" });
setTimeout(load, 500);
}
})();
})(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment