Skip to content

Instantly share code, notes, and snippets.

@anevins12
Last active March 12, 2020 23:25
Show Gist options
  • Save anevins12/18586083d7c12f6bc0fead891edc28fb to your computer and use it in GitHub Desktop.
Save anevins12/18586083d7c12f6bc0fead891edc28fb to your computer and use it in GitHub Desktop.
Asda: Adds button that hides out of stock groceries
// ==UserScript==
// @name Asda removes out of stock groceries
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Makes online shopping easier
// @author You
// @match https://groceries.asda.com/search/*
// @grant none
// ==/UserScript==
(function() {
function hideOutOfStock() {
jQuery('.co-item').each((i, v) => {
if ($('.unavailable-banner__product-status', v).length) {
$(v).hide();
}
});
}
const $newHideBtn = $('<button>Hide out of stock items</button>');
$newHideBtn
.on('click', hideOutOfStock)
.css({
'position': 'sticky',
'top': '20px',
'left': '20px',
'z-index': '10000'
});
$('body').prepend($newHideBtn);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment