Skip to content

Instantly share code, notes, and snippets.

@anevins12
Created July 7, 2021 20:52
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/c4c469ce08525deff892cba140b4f4e9 to your computer and use it in GitHub Desktop.
Save anevins12/c4c469ce08525deff892cba140b4f4e9 to your computer and use it in GitHub Desktop.
James Allen ring hider
// ==UserScript==
// @name James Allen ring hider
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Provides a button for each ring to hide it, should you be in a position of narrowing it down. Refreshing the page undoes the hiding.
// @author You
// @match https://www.jamesallen.com/engagement-rings/solitaire/14k-rose-gold-2mm-comfort-fit-solitaire-engagement-ring-item-41238
// @icon https://www.google.com/s2/favicons?domain=jamesallen.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
const rings = document.getElementsByClassName('item--1Q-0x');
rings.forEach(item => {
const button = document.createElement('button');
button.innerHTML = 'Hide ring';
button.style.backgroundColor = 'red';
button.style.color = 'white';
button.style.fontSize = '24px';
button.style.position = 'absolute';
button.style.top = 0;
button.style.zIndex = 9999;
button.addEventListener('click', event => {
event.target.parentElement.style.display = 'none';
});
item.appendChild(button);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment