All pastes #468709 Raw Edit

Something

public javascript v1 · immutable
·published 2007-05-03 09:19 UTC
rendered paste body
// ==UserScript==// @name          Digg replace comments// @namespace     http://userscripts.org// @description   Replace digg comments with reddit comments// @include       http://digg.com/*// @include       http://*.digg.com/* // ==/UserScript==// Check if Prototype's loadedfunction GM_wait() {	if(typeof unsafeWindow.Prototype == 'undefined') { window.setTimeout(GM_wait,100); }	else { $ = unsafeWindow.Prototype; letsPrototype(); }}GM_wait();// All your GM code must be inside this functionfunction letsPrototype() {	var getLink = $('title').childNodes[0].href;	$('wrapper').getElementsByClassName('comment').first().hide();			$('sub-nav').setStyle({clear: "both", marginBottom: 35});		new Insertion.After('sub-nav', '<div id="ajax-loader" style="text-align:center;"><p style="opacity:0.6;">Loading Reddit Comments</p><img src="http://img443.imageshack.us/img443/4199/ajaxloaderml4.gif"/></div>');			GM_xmlhttpRequest({		method: 'GET',		url: 'http://reddit.com/search?q=http://travel.state.gov/passport/eppt/epptnew_2807.html',		headers: {			'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',		},		onload: function(responseDetails) {			var data = responseDetails.responseText;			if (data.indexOf("also submit to reddit") === -1){				var trimmedData = data.slice(data.indexOf('<div class="content" style="width: 70%">'),data.indexOf("<div id='footer'>"));				$('ajax-loader').remove();								new Insertion.After(trimmedData);				var getonce = $('wrapper').getElementsByClassName('content').first();				getonce.setStyle({width: "auto"});				var saveForm = $('commentform');				$('commentform').remove();				new Insertion.Bottom(commentform, saveForm);			}		}	});	}