Greasy Fork

Greasy Fork is available in English.

Google Searches Exactly What You Type

Google searches for exactly what you type in by inserting nfpr=1 into the url.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           Google Searches Exactly What You Type
// @version       1.0.1
// @namespace      null
// @description    Google searches for exactly what you type in by inserting nfpr=1 into the url.
// @include        http://*.google.*/
// @include        https://*.google.*/
// @include        http://*.google.*/*q=*
// @include        https://*.google.*/*q=*
// @exclude        http://*.google.*/*nfpr=*
// @exclude        https://*.google.*/*nfpr=*
// @exclude        https://*.google.*/imgres*
// @exclude        http://*.google.*/imgres*
// @exclude        http://books.google.com/*
// @exclude        https://books.google.com/*
// @exclude        http*maps.google.com/*
// @exclude        http://news.google.com/newspapers*
// @exclude        https://news.google.com/newspapers*
// ==/UserScript==


var sTargetURL = window.location.href;
var sTargetURL1 = window.location.href.replace(/&q=/, '&nfpr=1&q=');
var sTargetURL2 = window.location.href.replace(/\?q=/, '?nfpr=1&q=');


if(sTargetURL1 == sTargetURL)
sTargetURL=sTargetURL2;
else
sTargetURL=sTargetURL1;

if(sTargetURL1 != sTargetURL2)
window.location.replace( sTargetURL );

var searchForms = document.querySelectorAll('form[action="/search"]');
var searchFormsLength = searchForms.length;
if (searchFormsLength) {

  var input   = document.createElement("input");
  input.name  = "nfpr";
  input.type  = "hidden";
  input.value = 1;

  var i = searchFormsLength;
  while (i--) {
    searchForms[i].appendChild(input);
  }
}