百度不到?谷歌一下!

在百度搜索结果页的搜索按钮旁边添加一个谷歌搜索按钮一键直达,在你百度搜不到的时候会很方便,作为辅助,所以目前采用title为搜索关键词。

目前為 2019-04-27 提交的版本,檢視 最新版本

// ==UserScript==
// @author owl
// @name 百度不到?谷歌一下!
// @description 在百度搜索结果页的搜索按钮旁边添加一个谷歌搜索按钮一键直达,在你百度搜不到的时候会很方便,作为辅助,所以目前采用title为搜索关键词。
// @match *://www.baidu.com/s?*
// @version 1.2
// @grant none
// @namespace https://greasyfork.org/users/295606
// ==/UserScript==
var e = document.getElementById('su');
var q;
setInterval(function(){
  q = 'https://www.google.com/search?q=' + document.title.replace('_百度搜索','');
},2000)
var width = e.offsetWidth;
var height = e.offsetHeight;
var input = document.createElement('input');
input.setAttribute('class','bg s_btn');
input.setAttribute('type','button');
input.setAttribute('value','谷歌一下');
input.style.width = width + 'px';
input.style.height = height + 'px';
input.style.backgroundColor = '#0aa858';
input.addEventListener('click',function() {
  window.open(q);
});
e.parentNode.appendChild(input);