Crazycatz00 / Swagbucks DuckDuckGo Results

// ==UserScript==
// @name		Swagbucks DuckDuckGo Results
// @namespace	Crazycatz00
// @description	Changes Swagbucks results to use DuckDuckGo instead of Yahoo.
// @icon		https://www.swagbucks.com/favicon.ico
// @include		/^https?:\/\/www\.swagbucks\.com\/.*[?&]q=/
// @version		4.0.0
// @grant		none
// @run-at		document-start
// @noframes
// ==/UserScript==

(function(){'use strict';
	var hasLoaded = false,
		type = '';
	if(window.location.search.search(/[?&]t=([^&]+)(?:&|$)/) !== -1){
		switch(RegExp.$1){
			case 'i': type = '&ia=images'; break;
			case 'v': type = '&ia=videos'; break;
		}
	}

	Object.defineProperty(window, 'getIframeSRC', {
		enumerable: true,
		configurable: false,
		writable: false,
		value: function(){
			hasLoaded = true;

			var search = searchTerm || origSearchVal || (document.getElementById('field') || {}).value;
			search = (typeof search==='string' ? encodeURIComponent(search) : (window.location.search.search(/[?&]q=([^&]+)(?:&|$)/)!==-1 ? RegExp.$1 : ''))

			return 'https://duckduckgo.com/?q=' + search + '&kv=m&kf=fw&kw=w&iax=1' /*+ '&ko=-1&k1=-1'*/ + type;
		}
	});

	window.addEventListener('load', function(){
		if(!hasLoaded){window.createIframe('resultsContainer');}

		var t = document.getElementById('topResultsCont');
		if(t){t.parentNode.removeChild(t);}
	}, false);
}());