Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Convert a search on a StackExchange site to a Google search of that site
// ==UserScript==
// @name Hippietrail's StackExchange search to Google search
// @description Convert a search on a StackExchange site to a Google search of that site
// @version 0.0
// @namespace hippietrail
// @include http://stackoverflow.com/search*
// @include http://meta.stackoverflow.com/search*
// @include http://serverfault.com/search*
// @include http://meta.serverfault.com/search*
// @include http://superuser.com/search*
// @include http://meta.superuser.com/search*
// @include http://stackapps.com/search*
// @include http://*.stackexchange.com/search*
// @include http://meta.*.stackexchange.com/search*
// ==/UserScript==
function main() {
$('#bigsearch tr:last td:first').removeProp('colspan')
.parent().append('<td><input type="button" name="google" value="google"></td>');
$('input[name=google]').click(function (event) {
location.href =
'http://google.com'
+ location.pathname
+ location.search + '+site:' + location.hostname;
});
}
function addJsNode(func) {
'use strict';
var targ = document.getElementsByTagName('head')[0] || document.body || document.documentElement,
scriptNode = document.createElement('script');
scriptNode.type = 'text/javascript';
scriptNode.textContent = '(' + func.toString() + ')()';
targ.appendChild(scriptNode);
}
addJsNode(main);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.