Skip to content

Instantly share code, notes, and snippets.

@SamDudley
Last active January 21, 2018 16:59
Show Gist options
  • Save SamDudley/0ca0792299aba81414d3a7bea4a2db54 to your computer and use it in GitHub Desktop.
Save SamDudley/0ca0792299aba81414d3a7bea4a2db54 to your computer and use it in GitHub Desktop.
Hides all the sponsered job search results shown by indeed.
function hideAllSponseredResults() {
// A little helper function to convert node lists returned from querySelector
// to a proper array so we can use methods like filter.
function toArray(nodeList) {
let array = []
nodeList.forEach(node => array.push(node))
return array
}
// Find all the results.
let results = toArray(document.querySelectorAll('#resultsCol div.row.result'))
// Filter the results down to just the sponsored results.
let sponsored = results.filter(result => {
// This is how I am testing for a sponsored result.
return result.querySelector('.sponsoredGray') !== null
})
// Loop over each sponsored result and hide it.
sponsored.forEach(el => el.style.display = 'none')
}
// Run our function.
hideAllSponseredResults()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment