Greasy Fork

Greasy Fork is available in English.

SearchGoogleWithSwagbucks

Searches Google when searched on Swagbucks

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        SearchGoogleWithSwagbucks
// @namespace   shatranjkakhiladi
// @description Searches Google when searched on Swagbucks
// @include     http://www.swagbucks.com/*q=*
// @include     https://www.swagbucks.com/*q=*
// @version     1.01
// @grant       none
// ==/UserScript==

var url = window.location.href.toLowerCase();
var title = document.title;
var googleTab = null;
var SECONDS_TO_KEEP_GOOGLE_PAGE = 3;

function getQuerystring(key, default_)
{
  if (default_===null) default_="";
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs === null)
	return default_;
  else
	return qs[1];
}


function SearchGoogle()
{
	var swagbucksSearchQuery = getQuerystring('q');
	googleTab = window.open("https://www.google.com/search?q=" + swagbucksSearchQuery + "&ie=utf-8&oe=utf-8");
	if(googleTab)
		window.setTimeout(function() { googleTab.close(); }, SECONDS_TO_KEEP_GOOGLE_PAGE * 1000);
}

 
window.setTimeout(SearchGoogle, 1000);