Skip to content

Instantly share code, notes, and snippets.

@RayPS
Last active November 6, 2022 13:24
Show Gist options
  • Save RayPS/41d37cae20ffc3caf08d64b97a4a7aff to your computer and use it in GitHub Desktop.
Save RayPS/41d37cae20ffc3caf08d64b97a4a7aff to your computer and use it in GitHub Desktop.
Remove the annoying "People also search for" from Google Search result
// ==UserScript==
// @name Remove "People also search for"
// @description Remove "People also search for" on Google
// @namespace [email protected]
// @version 0.1.1
// @author Ray
// @match https://*.google.com/search*
// @match https://*.google.com.hk/search*
// @icon https://www.google.com/s2/favicons?domain=google.com
// ==/UserScript==
(function() {
'use strict';
const mutationObserver = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.attributeName === 'style') {
if (mutation.target.style.transition === 'height 300ms ease-in-out 0s') {
mutation.target.setAttribute('style', '')
}
if (mutation.target.getAttribute('style') === 'display: block; opacity: 1;') {
mutation.target.remove()
}
}
});
});
mutationObserver.observe(document.querySelector('#search'), { subtree: true, attributeFilter: ['style'] })
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment