百度不到?谷歌一下!

在百度搜索结果页的搜索按钮旁边添加一个隐藏的谷歌搜索按钮,鼠标移动到百度一下上会显示出来,在你百度搜不到的时候会很方便,作为辅助,所以目前采用title为搜索关键词。

当前为 2019-08-01 提交的版本,查看 最新版本

// ==UserScript==
// @author owl
// @name 百度不到?谷歌一下!
// @description 在百度搜索结果页的搜索按钮旁边添加一个隐藏的谷歌搜索按钮,鼠标移动到百度一下上会显示出来,在你百度搜不到的时候会很方便,作为辅助,所以目前采用title为搜索关键词。
// @include https://www.baidu.com*
// @include http://www.baidu.com*
// @version 1.5
// @grant none
// @namespace https://greasyfork.org/users/295606
// ==/UserScript==
var e = document.getElementById('su');
var q = '';
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.style.display = 'none';
e.parentNode.addEventListener('mouseenter',function(){
  if(document.title!='百度一下,你就知道'){
    q = 'https://www.google.com/search?q=' + document.title.replace('_百度搜索','');
    input.style.display = 'inline';
  }
});
e.parentNode.addEventListener('mouseleave',function(){
  input.style.display = 'none';
});
input.addEventListener('click',function(){
  window.open(q);
});
e.parentNode.appendChild(input);