Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.