百度不到?谷歌一下!

在百度搜索结果页的搜索按钮下方添加隐藏的谷歌搜索按钮,鼠标移动到百度一下上会显示出来,在你百度搜不到的时候会很方便。

// ==UserScript==
// @author owl
// @name 百度不到?谷歌一下!
// @description 在百度搜索结果页的搜索按钮下方添加隐藏的谷歌搜索按钮,鼠标移动到百度一下上会显示出来,在你百度搜不到的时候会很方便。
// @include https://www.baidu.com*
// @include http://www.baidu.com*
// @version 2.0
// @grant none
// @namespace https://greasyfork.org/users/295606
// ==/UserScript==
var e = document.getElementById('su');
var q = '';
var q2 = '';
var input = document.createElement('input');
input.style.display = 'none';
//input.setAttribute('class','bg s_btn');
var input2 = document.createElement('input');
input2.style.display = 'none';
//input2.setAttribute('class','bg s_btn');
e.parentNode.addEventListener('mouseenter',function(){
  if(document.title!='百度一下,你就知道'){
    q = 'https://www.google.com/search?q=' + document.title.replace('_百度搜索','');
    input.setAttribute('value','谷歌');
    input.setAttribute('type','button');
    input.setAttribute('style','color:white;background:#0aa858;width:50px;height:35px;border:1px solid;float:left;border-radius:20px;display:inline;cursor:help;');
    q2 = 'https://duckduckgo.com/?q=' + document.title.replace('_百度搜索','');
    input2.setAttribute('value','DuckGo');
    input2.setAttribute('type','button');
    input2.setAttribute('style','color:white;background:#DE5833;width:60px;height:35px;border:1px solid;float:left;border-radius:20px;display:inline;cursor:help;');
  }
});
e.parentNode.addEventListener('mouseleave',function(){
  input.style.display = 'none';
  input2.style.display = 'none';
});
input.addEventListener('click',function(){
  window.open(q);
});
input2.addEventListener('click',function(){
  window.open(q2);
});
e.parentNode.appendChild(input);
e.parentNode.appendChild(input2);