Skip to content

Instantly share code, notes, and snippets.

@justdanpo
Last active August 8, 2016 11:26
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 justdanpo/b55be42534feab3a1f2100d60f0ab769 to your computer and use it in GitHub Desktop.
Save justdanpo/b55be42534feab3a1f2100d60f0ab769 to your computer and use it in GitHub Desktop.
Disable Google Redirect
// ==UserScript==
// @name Disable Google Redirect
// @namespace https://gist.github.com/justdanpo
// @version 1.3
// @description Disable Google Redirect
// @author den_po
// @include http://www.google.com*
// @include https://www.google.com*
// @include http://www.google.ru*
// @include https://www.google.ru*
// @grant none
// ==/UserScript==
(function() {
window.addEventListener('DOMSubtreeModified', function(e) {
var element = e.srcElement;
var parent = element.parentNode;
if (element.nodeName == "A") {
if (
(element.querySelector('a > span.irc_but_t') == element.childNodes[0]) ||
(parent.querySelector('h3.r > a') == element)
) {
var newHref = element.getAttribute("data-href");
if (newHref && newHref != element.href)
element.href = newHref;
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment