Skip to content

Instantly share code, notes, and snippets.

@cnicodeme
Created April 5, 2023 06:53
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 cnicodeme/02b94feea4bddaed0bfc1a636755949b to your computer and use it in GitHub Desktop.
Save cnicodeme/02b94feea4bddaed0bfc1a636755949b to your computer and use it in GitHub Desktop.
Remove all the "AI" and "GPT" from ProductHunt.com. Clears the UI too.
(function () {
const sidebar = document.querySelector('.sidebarWithSeparator')
if (sidebar) sidebar.remove()
const question = document.querySelector('[data-test="homepage-questions-card"]')
if (question) question.remove()
const containers = document.querySelectorAll('.layoutContainer')
if (containers.length == 2) { containers[0].remove() }
document.querySelector('main.layoutMain').firstChild.firstChild.childNodes[1].firstChild.querySelectorAll(':scope >div').forEach(x => {
if (x.firstChild.nodeName === 'A') {
return x.remove()
} else if ('test' in x.dataset && x.dataset.test.startsWith('ad-slot')) {
return x.remove()
}
const title = x.querySelector('[data-test^="post-name"]')
if (title) {
const titleText = title.innerText.toLowerCase()
if (titleText.indexOf('ai') > -1 || titleText.indexOf('gpt') > -1) {
x.remove()
}
}
const description = x.querySelector('[data-test$="tagline"]')
if (description) {
const descriptionText = description.innerText.toLowerCase()
if (descriptionText.indexOf('ai') > -1 || descriptionText.indexOf('gpt') > -1) {
x.remove()
}
}
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment