Created
April 5, 2023 06:53
-
-
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.
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
(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