SearchGoogleWithSwagbucks

Searches Google when searched on Swagbucks

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);