Last active
September 29, 2017 00:40
-
-
Save ronekko/0ccb489975b25a773c97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name add link to google scholar in google header | |
// @namespace http://profile.livedoor.com/ronekko/ | |
// @description add link to google scholar in google header | |
// @include https://www.google.co.jp/search?* | |
// @version 1 | |
// ==/UserScript== | |
function get_url_vars() | |
{ | |
var vars = {}, params; | |
var temp_params = window.location.search.substring(1).split('&'); | |
for(var i = 0; i <temp_params.length; i++) { | |
params = temp_params[i].split('='); | |
vars[params[0]] = params[1]; | |
} | |
return vars; | |
} | |
var query_str = get_url_vars()['q']; | |
var link_str = 'http://scholar.google.co.jp/scholar?hl=ja&q=' + query_str | |
var span = document.createElement('span'); | |
span.textContent = 'Scholer'; | |
span.className = 'gbts'; | |
var a = document.createElement('a'); | |
a.href = link_str; | |
a.className = 'gbzt'; | |
a.appendChild(span); | |
var header = document.querySelector('#hdtb-msb'); | |
header.appendChild(a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment