Last active
April 23, 2018 21:39
-
-
Save lancehilliard/1353475392345d30cd20f53e6ee8bc61 to your computer and use it in GitHub Desktop.
[userscript] Change how certain Kroger products are displayed to make ClickList shopping easier
This file contains hidden or 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 Kroger ClickList Products Display Changer | |
// @namespace cc.digitalcreations.kroger | |
// @version 0.1 | |
// @downloadURL https://gist.github.com/lancehilliard/1353475392345d30cd20f53e6ee8bc61#file-kroger_clicklist_products_display_changer.js | |
// @description Change how certain Kroger products are displayed to make ClickList shopping easier | |
// @author lancehilliard | |
// @match https://www.kroger.com/products/* | |
// @grant none | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var productLinksToIgnore = [ | |
'https://www.kroger.com/add/links/here/containing/thirteen-digit/UPCs/like/#############' | |
]; | |
var scanForItems; | |
scanForItems = function() { | |
for (var i = 0; i < productLinksToIgnore.length; i++) { | |
var productLinkToIgnore = productLinksToIgnore[i]; | |
var upc = productLinkToIgnore.match(/\d{13}/); | |
var $upcLink = $('a[href$="'+upc+'"]:not([upc_processed]'); | |
if ($upcLink.length > 0) { | |
var $gridCell = $upcLink.closest('div.GridCell'); | |
if ($gridCell.length > 0) { | |
$gridCell.find('div.ProductCard').css('border', '1px solid red'); | |
$gridCell.parent().append($gridCell); | |
$upcLink.attr('upc_processed','true'); | |
} | |
} | |
} | |
setTimeout(scanForItems, 1000); | |
}; | |
scanForItems(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment