All pastes #977505 Raw Edit

Stuff

public javascript v1 · immutable
·published 2008-04-08 21:41 UTC
rendered paste body
// ==UserScript==// @name          My Rig// @namespace     forums.whirlpool.net.au// @version       0.6// @description   Adds link under username to show rig info wiki// @include       http://forums.whirlpool.net.au/forum-replies*// @include       http://whirlpool.net.au/forum-replies*// ==/UserScript==//0.6 changes - Added Hide/Show pictures function//0.5 changes - Can now click on either My Rig link or X to close. No longer need to alter script to work in Internet Explorer.//0.4 changes - got rid of link removal & replaced auto showing of images with a "show images" link.if(navigator.userAgent.toLowerCase().match('firefox')){	$ = unsafeWindow.jQuery;}if($('#breadcrumb').text().match('PC Hardware')){	var lH = location.host;	var currentWikiList = {							"108637"  	: "pcb_AusScare",						"215141"  	: "userspec_Elite13",						"54495"  	: "pa28",						"202413"  	: "B4TM4N",						"195244"  	: "userspec_Coldplayer",						"146606"  	: "userspec_Dogw_ng",						"181924"  	: "userspec_BitSlapped",						"164132"  	: "Mr_4400",						"81052"  	: "Fuznic",						"141960"  	: "pcb_karnage",						"198794"  	: "userspec_tim444",						"193007"  	: "KingsOverAce",						"185868"  	: "userspec_rymezke",						"186181"  	: "ryanz28",						"197328"  	: "bob159",						"12766"  	: "12766",						"166778"  	: "userspec_brpiper",						"50064"  	: "50064",						"147526"  	: "147526",						"118956"  	: "118956",						"110045"  	: "perfect_darth",						"144369"  	: "userspec_montagoo",						"154802"  	: "userspec_Xul",						"192449"  	: "Teh_Nub",						"136073"  	: "userspec_Chrizz",						"159657"  	: "engelasche",						"104197"  	: "pcb_KM",						"126746"  	: "userspec_Andski1",						"47241"  	: "pcb_Arbalest]",						"72323"  	: "pcb_Ay_eN_De_whY",						"108637"  	: "userspec_Benmc",						"67300"  	: "userspec_bluey45",						"175407"  	: "175407",						"18627"  	: "pcb_cb",						"9913"  	: "pcb_Chook",						"101055"  	: "pcb_dmbpp",						"88374"  	: "userspec_davodude",						"7154"  	: "pcb_DruiD",						"44821"  	: "pcb_Eeezhy",						"94605"  	: "userspec_EVAQ8",						"64250"  	: "userspec_EwarWoo",						"63549"  	: "pcb_Graham",						"114177"  	: "Jonoz",						"144064"  	: "userspec_Jonz_",						"119801"  	: "pcb_Justin",					    "50171"     : "userspec_kumaran1904",						"44225"  	: "userspec_kheng",						"173516"  	: "userspec_Luda",						"17582"  	: "MaxPower",						"96828"  	: "userspec_MMB",						"104055"  	: "pcb_mintox",						"21427"  	: "pcb_mrd2",						"158554"  	: "userspec_Munson",						"185868"  	: "userspec_mushkinx",						"114957"  	: "userspec_ntravis",						"167417"  	: "userspec_NoobCake",						"130817"  	: "userspec_nelson92",						"263"   	: "userspec__0xyg3n",						"40966"  	: "pcb_pho",						"40689"  	: "userspec_pafc2004",						"147431"  	: "raVen2_0",						"161105"  	: "userspec_richardczz",						"189307"  	: "pcb_UnionPac",						"140398"  	: "userspec_shawns_maggot",						"22341"  	: "userspec_sirrion",						"21357"  	: "Mrpencil",						"32389"  	: "pcb_Saruman",						"131982"  	: "pcb_scoobysix",						"93080"  	: "userspec_stinkychicken",						"103392"  	: "Sabbath_Void",						"78738"  	: "pcb_tabletennisman",						"132458"  	: "Traceur",						"34330"  	: "pcb_viper",						"73656"  	: "pcb_Xm_mDr",						"136056"  	: "136056",						"108652"  	: "userspec_AusJoKeR",						"87112"		: "pcb_benly",						"116070"	: "pcb_B_o_",						"6538"		: "userspec_bagurk",						"67098"		: "pcb_blackflame",						"101178"  	: "userspec__Bobso_",						"65032"  	: "userspec_BonoVox",						"62034"		: "userspec_borgnefesse",						"142916"	: "userspec_Brtttt",						"140196"	: "userspec_camerooney81",						"163032"	: "userspec_chickenrice",						"55432"	        : "userspec_crysalis",						"32744"	        : "userspec_Chris",						"139685"	: "userspec_Dan1605",						"161601"	: "Dave963",						"103404"  	: "userspec_Dorz",						"131693"  	: "userspec_dan",						"113221"	: "pcb_daredevil77",						"93556"	        : "pcb_Degrador",						"92566"	        : "pcb_duff",						"39034"	        : "DejaVoodoo",						"128485"	: "userspec_dlnqnt",						"173289"	: "userspec_eukaryote",						"64250"	        : "userspec_EwarWoo",						"137309"	: "userspec_evonet",						"113221"	: "pcb_daredevil77",						"101448"	: "userspec_fat_dogs",						"185306"  	: "userspec_Fatal_",						"139148"	: "userspec_finzy",						"156243"	: "userspec_FJ_P510",						"90375" 	: "userspec_fineri",						"169739"	: "pcb_giordano",						"132594"	: "pcb_GIRAFFE",						"154845"	: "pcb_grey",						"92961"	        : "pcb_guff",						"171987"  	: "userspec_hankahanka",						"40942" 	: "userspec_hellman109",						"143158"  	: "userspec_hellbound6996",						"104649"	: "userspec_hidden_ability",						"66309" 	: "pcb_iamviet3",						"146882"	: "James01",						"85332" 	: "pcb_jasrulz",						"43189" 	: "userspec_K8Canb",						"165123"	: "userspec_Kickz101",						"135132"	: "userspec_kiplinght",						"121030"  	: "userspec_konholyoh",						"100820"	: "userspec_kv7",						"166424"	: "userspec_Krucigen",						"123612"	: "userspec_lijy",						"139075"	: "Lugo",						"127690"	: "userspec_migod",						"15325" 	: "userspec_modafroman",						"137738" 	: "usersspec_monopoly",						"31129" 	: "userspec_MnEmOnIcS",						"39589"  	: "migoreng",						"96828" 	: "userspec_MMB",						"158554"  	: "userspec_Munson",						"162161"  	: "nc",						"144064"  	: "userspec_nvidia06",						"120970"  	: "userspec_orbin",						"112307" 	: "userspec_PhOeNiX83",						"165597"	: "userspec_pookstar",						"21915" 	: "userspec_psyrus",						"12990" 	: "pcb_pyro",						"133424"	: "userspec_Rah_Xephon",						"116215"	: "userspec_raverz",						"127311"	: "userspec_redwan",						"58774"  	: "pcb_renza",						"161105"	: "userspec_richardczz",						"25999" 	: "userspec_S-Murfy",						"5977"  	: "userspec_s3n",						"156473"  	: "userspec_Smoth_007",						"133848"	: "userspec_sean_finn",						"99612" 	: "userspec_sick0o",						"134053"	: "userspec_the_stig",						"63699"		: "Simon%20K",						"144752"	: "51M0N",						"165010"	: "steenholdt",						"105767"	: "pcb_timmmmaaaah",						"179835"  	: "userspec_vp",						"103079"  	: "userspec_Womble89",						"5790"  	: "userspec_WikiWil",						"148388"  	: "userspec_Xam",						"125815"  	: "userspec_zuey-"						};		$('.bodyuser').each(function(){			var uN = $(this).find('a:last').attr('href').split('id=')[1];			$(this).append('<p><a class="rigLink" title="'+uN+'" href="#">My Rig</a></p>');			});		$('.rigLink').css({textDecoration: 'underline', opacity: 0.6}).click( function(event) {		var rThis = $(this);			event.preventDefault();				var userNo = rThis.attr('title');		var wikiLink;			if (currentWikiList[userNo]){					wikiLink = "http://"+lH+"/wiki?tag=" + currentWikiList[userNo];				}		else{					wikiLink = "http://"+lH+"/wiki?tag=userspec_" + userNo;				}				rThis.after('<div style="position:absolute;margin:-110px 0 0 218px;'+		'z-index:5;width:600px;background-color:#EBE8FF;overflow-y:auto;max-height:400px;border:5px solid #868686;border-top:35px solid #868686;"></div>');					var aboveDiv = rThis.next();				function showImages() {					var dynICheck = aboveDiv.find('.dynImage');					if(dynICheck[0] !== undefined){								dynICheck.remove();							}			else{							aboveDiv.find('a.external').each(function(){									var tI = $(this);					var tIH = $(this).attr('href');									if(tIH.toLowerCase().lastIndexOf('.jpg') > -1){						tI.children('img:last').after('<br /><img class="dynImage" width="400px" style="border:none;" src="'+tIH+'" />');					}					else if(tIH.toLowerCase().lastIndexOf('.jpeg') > -1){						tI.children('img:last').after('<br /><img class="dynImage" width="400px" style="border:none;" src="'+tIH+'" />');					}					else if(tIH.toLowerCase().lastIndexOf('.bmp') > -1){						tI.children('img:last').after('<br /><img class="dynImage" width="400px" style="border:none;" src="'+tIH+'" />');					}					else if(tIH.toLowerCase().lastIndexOf('.png') > -1){						tI.children('img:last').after('<br /><img class="dynImage" width="400px" style="border:none;" src="'+tIH+'" />');					}					else if(tIH.toLowerCase().lastIndexOf('.gif') > -1){						tI.children('img:last').after('<br /><img class="dynImage" width="400px" style="border:none;" src="'+tIH+'" />');					}				});											}		}				aboveDiv.html('<img src="http://img.photobucket.com/albums/v215/thegooddale/ajax-loader.gif" />');				$.get(wikiLink, function(data){					if (data.indexOf("No entry yet for") < 0){								var sliceData = data.slice(data.indexOf('<div id="wiki">'),data.indexOf('<span class="shim1">'));				aboveDiv.html(sliceData).before('<a class="showImages" style="margin:-85px 0 0 570px;'+				'clear:both;z-index:6;position:absolute;font-size:1em;color:#FFF;" '+				'href="#">Show Images</a><a class="closediv" style="margin:-95px 0 0 680px;'+				'clear:both;z-index:6;position:absolute;font-weight:bold;font-size:2em;color:#FFF;"'+				'href="#">X</a>');							}			else { 															aboveDiv.html('<P style="margin-top:20px;">User has no rig details listed.</p>').before('<a class="closediv" style="margin:-95px 0 0 680px;'+				'clear:both;z-index:6;position:absolute;font-weight:bold;font-size:2em;color:#FFF;"'+				'href="#">X</a>');													}						$('.showImages').click(function(event){							event.preventDefault();							if($(this).text() == 'Show Images'){									$(this).text('Hide Images');								}				else{									$(this).text('Show Images');								}				showImages();			});										$('.closediv').click(function(event){								event.preventDefault();								rThis.parent().children().not('a:first').remove();							});						});		return false;	});	if( new Date().toString().match('Wed') ) {		GM_xmlhttpRequest({			method: 'GET',			url: "http://userscripts.org/scripts/show/11844",			onload: function(responseDetails) {							var rtx = responseDetails.responseText;								var lastUpdate = rtx.split('Last updated</h6>')[1].split('<h6>Tags')[0].split('<p>')[1].split('.</p>')[0]; //w00t - lazy FTW!								var dPar = Date.parse(lastUpdate);								if(!GM_getValue('lastUpdate') || dPar > Number(GM_getValue('lastUpdate')) ){									GM_setValue('lastUpdate', ''+dPar+''); //GM_SetValue needs the quote strings there										alert('A new version of the "My Rig" script is available');								}			},			onerror: function(err) {				alert( "Failed to check for MyRig update because: " + err.statusText +"   "+ err.responseText);			}		});					}			//g1raffe admin stuff		if( new Date().toString().match('Sat') && $('.userinfo').text().match('User ID: #132594') ) {			function processFirstAjax(data){			var firsttS = data.split('href="/wiki/?tag=userspec_list&amp;id=')[1].split('</a>')[0].split('>')[1].split('-');			var dayNo = firsttS[2].split(',');			var timeNo = dayNo[1].slice(dayNo[1].indexOf(' ')+1,dayNo[1].lastIndexOf(' '));			var lastE = Date.parse(""+dayNo[0]+" "+firsttS[1]+" "+firsttS[0]+" "+timeNo+":00 GMT");		 			 			 if( !GM_GetValue('lastEdit') || (lastE > Number(GM_GetValue('lastEdit'))) ){						GM_SetValue('lastEdit', ''+lastE+'');								// coulda automated the update if people used the userspec_** format								alert('The "My Rig" script may need to be updated');			 			 }					}						$.ajax({			type: "GET",			url: "http://"+lH+"/wiki/?action=history&tag=userspec_list",			success: function(data){				processFirstAjax(data);			},			error: function(msg){				alert( "Ajax failed because: " + msg );			}		});		}	}