// ==UserScript==
// @name Spoof as Firefox or Internet Explorer
// @author TarquinWJ 
// @namespace http://www.howtocreate.co.uk/ 
// @version 1.0
// @description  Attempts to completely mask your identity as either
//			Firefox or Internet Explorer.
// @ujs:category browser: enhancements
// @ujs:published 2005-05-30 22:13
// @ujs:modified 2005-09-19 09:19
// @ujs:documentation http://userjs.org/scripts/browser/enhancements/zz-spoof-id 
// @ujs:download http://userjs.org/scripts/download/browser/enhancements/zz-spoof-id.js
// ==/UserScript==


/* 
 * Please see
 * http://www.howtocreate.co.uk/operaStuff/userJavaScript.html#terms
 * for License and Terms of Use
 */

(function () {
	if( !window.opera ) { return; } // just in case
	if( navigator.userAgent.indexOf('Opera') == -1 ) {
		if( navigator.userAgent.indexOf('Gecko') + 1 ) {
			//delete document.all - cannot be overriden, so must be manually done by rewriting the scripts on the page
			window.opera.addEventListener(
				'BeforeScript',
				function (e) { e.element.text = e.element.text.replace(/\bdocument\.all\b/g,'document.allGoneAway'+(new Date()).getTime()); },
				false
			);
			delete window.opera;
			var opera_navigator = window.navigator;
			delete window.navigator;
			window.navigator = {
				appCodeName: 'Mozilla',
				appName: 'Netscape',
				appVersion: '5.0 (Windows; en)',
				cookieEnabled: opera_navigator.cookieEnabled,
				javaEnabled: opera_navigator.javaEnabled,
				language: 'en',
				mimeTypes: opera_navigator.mimeTypes,
				oscpu: 'Windows NT 5.1',
				platform: 'Win32',
				plugins: opera_navigator.plugins,
				preference: function () { return opera_navigator.preference( arguments ); },
				product: 'Gecko',
				productSub: '20050317',
				securityPolicy: '',
				taintEnabled: opera_navigator.taintEnabled,
				userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.7.6) Gecko/20050317 Firefox/1.0.2',
				vendor: 'Firefox',
				vendorSub: '1.0.2'
			};
			window.sidebar = {addPanel:function () {}};
		} else if( navigator.userAgent.indexOf('MSIE') + 1 ) {
			delete window.opera;
			var opera_navigator = window.navigator;
			delete window.navigator;
			window.navigator = {
				appCodeName: 'Mozilla',
				appName: 'Microsoft Internet Explorer',
				appVersion: '4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)',
				appMinorVersion: ';SP2;',
				browserLanguage: 'en', 
				systemLanguage: 'en',
				userLanguage: 'en',
				cookieEnabled: opera_navigator.cookieEnabled,
				cpuClass: 'x86',
				javaEnabled: opera_navigator.javaEnabled,
				mimeTypes: opera_navigator.mimeTypes,
				onLine: 'true',
				opsProfile: {addReadRequest:function () {},clearRequest:function () {},doReadRequest:function () {},getAttribute:function () {},setAttribute:function () {}},
				userProfile: {addReadRequest:function () {},clearRequest:function () {},doReadRequest:function () {},getAttribute:function () {},setAttribute:function () {}},
				platform: 'Win32',
				plugins: opera_navigator.plugins,
				taintEnabled: opera_navigator.taintEnabled,
				userAgent: 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)'
			};
			window.ActiveXObject = window.XMLHttpRequest;
			window.ScriptEngine = function () { return 'JScript'; }
			window.ScriptEngineBuildVersion = function () { return 8820; }
			window.ScriptEngineMajorVersion = function () { return 5; }
			window.ScriptEngineMinorVersion = function () { return 6; }
		}
	}
})();
