Last active
March 12, 2020 23:25
-
-
Save anevins12/18586083d7c12f6bc0fead891edc28fb to your computer and use it in GitHub Desktop.
Asda: Adds button that hides out of stock groceries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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