Skip to content

Instantly share code, notes, and snippets.

@Pictor13
Last active May 9, 2024 16:09
Show Gist options
  • Select an option

  • Save Pictor13/7ec054642632478ca562a6e9283bf9ed to your computer and use it in GitHub Desktop.

Select an option

Save Pictor13/7ec054642632478ca562a6e9283bf9ed to your computer and use it in GitHub Desktop.
Tampermonkey userscript to remove the annoying first fake results (they are ADs), form Google SERP
// ==UserScript==
// @name remove-google-ads
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove ADs fake-search-results on Google SRP
// @author Igor Pellegrini
// @include /^https?\:\/\/.*.google\..*\/search.*$/
// @grant GM_log
// ==/UserScript==
(function() {
console.log('Remove annoying AD results');
if (document.getElementById('privatelayer')) {
document.getElementById('privatelayer').remove(); // remove iframe with ADs search results
Array.prototype.map.call(document.getElementsByClassName('ads-ad'), (el) => el.remove());
if (document.getElementById('search')) document.getElementById('search').style.marginTop = 0;
GM_log('Google ADs iframe removed by Tampermonkey script. Check your browser extensions.');
} else {
console.log('Nothing annoying to remove');
}
})();
@Pictor13
Copy link
Copy Markdown
Author

Pictor13 commented Jul 11, 2019

Wrote a quick script to remove those nerves-tearing AD-results on Google, that occupy the whole vertical viewport and are just distracting and not relevant to the search.

Get your search results back!

PS - Please comment to update the script, in case the Google SERP markup changes and this script doesn't work anymore. Thank you ๐Ÿ˜‰

@Hrjcushghdsj
Copy link
Copy Markdown

It unfortunately does not work as of now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment