GoogleRes

在谷歌搜索结果页面添加底部搜索框,并修改搜索结果打开方式为新窗口打开\n(add another input for search at the bottom of result page & change the way to open each result from "current tab" to "new tab")

当前为 2017-09-25 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        GoogleRes
// @version     0.1 beta
// @author      hey_233
// @namespace   Violentmonkey Scripts
// @include     *://www.google.com*/search*
// @require     https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js
// @grant       none
// @run-at      document-body
// @description 在谷歌搜索结果页面添加底部搜索框,并修改搜索结果打开方式为新窗口打开\n(add another input for search at the bottom of result page & change the way to open each result from "current tab" to "new tab")
// ==/UserScript==

'use strict';

(function(){
  $(function(){
    var $as = $('#rso').children().children().find('a'),
        $fas = $('#fbar').find('a'),
        $tsf = $('#tsf'),
        $resul = $('sbtc').children('.gstl_0.sbdd_a'),
        $lst = $('#lst-ib'),
        $cloneForm = $tsf.clone(true);
    $as.each(function(i,e){
      e.target = '_blank';
    });
    $fas.each(function(i,e){
      e.target = '_blank';
    });
    $cloneForm.attr('id','_cloneForm').find('#gs_st0').attr('id','_cloneGs_st0').next().find('#lst-ib').attr('id','_cloneLst-ib').on({
      click: function(e){
        e.stopPropagation();
      },
      focus: function(){        
        $tsf.css('position','fixed');
      },
      input: function(){
        $lst.val(this.value);//.trigger('input');
      },
      blur: function(){
        $resul.hide();
      }
    });
    $cloneForm.css('marginBottom','25px');
    $cloneForm.find('#_cloneGs_st0').children('a').on('click',function(){
      $('#gs_st0').children('a').click();console.log(2)
    });
    $('#rcnt').on('click',function(){
      $tsf.css('position','');
    }).append($cloneForm);
  });
}());