Skip to content

Instantly share code, notes, and snippets.

@Alistair1231
Created January 14, 2025 18:29
Show Gist options
  • Save Alistair1231/ec7ddc4c6b908cccfc191981d0fa3fa0 to your computer and use it in GitHub Desktop.
Save Alistair1231/ec7ddc4c6b908cccfc191981d0fa3fa0 to your computer and use it in GitHub Desktop.
amazon hide entries <4.5 Stars
javascript:(function()%7Bfunction%20findByText(text)%20%7B%0A%20%20let%20entries%20%3D%20new%20Set()%0A%0A%20%20this.forEach((element)%20%3D%3E%20%7B%0A%20%20%20%20if%20(textMatches(element.innerHTML%2C%20text))%20%7B%0A%20%20%20%20%20%20entries.add(element)%0A%20%20%20%20%7D%0A%20%20%7D)%0A%0A%20%20return%20Array.from(entries)%0A%0A%20%20function%20textMatches(content%2C%20searchText)%20%7B%0A%20%20%20%20return%20searchText%20instanceof%20RegExp%0A%20%20%20%20%20%20%3F%20searchText.test(content)%0A%20%20%20%20%20%20%3A%20content.includes(searchText)%0A%20%20%7D%0A%7D%0A%0AObject.defineProperty(Array.prototype%2C%20'findByText'%2C%20%7B%0A%20%20enumerable%3A%20false%2C%0A%20%20writable%3A%20true%2C%0A%20%20value%3A%20findByText%2C%0A%7D)%0AObject.defineProperty(NodeList.prototype%2C%20'findByText'%2C%20%7B%0A%20%20enumerable%3A%20false%2C%0A%20%20writable%3A%20true%2C%0A%20%20value%3A%20findByText%2C%0A%7D)%0A%2F%2F%3F%20%5E%20---%20Find%20by%20text%20---%20%5E%0A%0Aconst%20items%20%3D%20document.querySelectorAll('div.template%5C%5C%3DSEARCH_RESULTS')%0Aconst%20validItems%20%3D%20%5B%0A%20%20...items.findByText(%0A%20%20%20%20%2F%3Cspan%20aria-hidden%3D%22true%22%20class%3D%22a-size-small%20a-color-base%22%3E4%5B%2C.%5D%5B5-9%5D%3C%5C%2Fspan%3E%2F%0A%20%20)%2C%0A%5D%0Aconsole.log(validItems)%0Aitems.forEach((item)%20%3D%3E%20%7B%0A%20%20if%20(!validItems.includes(item))%20%7B%0A%20%20%20%20item.parentElement.parentElement.style.display%20%3D%20'none'%0A%20%20%7D%0A%7D)%7D)()%3B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment