Skip to content

Instantly share code, notes, and snippets.

@anevins12
Last active March 12, 2020 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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