Skip to content

Instantly share code, notes, and snippets.

@Koc
Created June 1, 2015 11:32
Show Gist options
  • Save Koc/68f355c426e41a78e02d to your computer and use it in GitHub Desktop.
Save Koc/68f355c426e41a78e02d to your computer and use it in GitHub Desktop.
Google Open Search Result In Nes Tab
// ==UserScript==
// @name Google Open Search Result In Nes Tab
// @version 0.1
// @author Konstantin Myakshin
// @grant none
//
// @include *://www.google.*/*q=*
// @include *://www.google.*/*tbs=*
// @include *://www.google.*/search?*
// @include *://www.google.*/webhp?*
// @include *://www.google.*/cse?*
// @include *://www.google.*/?*
// @include *://www.google.*/#*
// @include *://www.google.*/
// @include *://encrypted.google.*
// @include *://ipv6.google.*
// @include *://www.google.*/news*
// @include *://news.google.*/*
// @include *://plus.google.com/_/scs/apps-static/_/js/*
// @include *://images.google.com/*
// @include *://docs.google.com/*
// @include *://maps.google.com/*
// @include *://www.google.com/maps*
// @include *://ditu.google.com/*
// @include *://www.youtube.*
// @include *://groups.google.com/group/*
// @include *://www.google.com/bookmarks/*
// @include *://history.google.com/bookmarks/*
// @include *://www.google.com/history/*
// @include *://www.google.com/prdhp*
// @include *://www.google.com/products/catalog?*
// @include *://www.google.com/shopping/product/*
// @include *://mail.google.com/*
// @include *://www.google.com/mail*
// @include *://play.google.com/store*
// @exclude *://www.google.com/reader/*
// ==/UserScript==
function replaceLinks()
{
var els = document.querySelectorAll('#ires .g h3 a');
for (var i = 0, n = els.length; i < n; i++) {
els[i].setAttribute('target', '_blank');
}
}
replaceLinks();
var target = document.querySelector('#ires');
document.addEventListener("DOMNodeInserted", function(e) {
//console.log(e.path.indexOf(target) > -1);
replaceLinks()
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment