Reddit without some stuff

By lazyttrick Last update Feb 1, 2010 — Installed 249 times.

There are 9 previous versions of this script.

// ==UserScript==
// @name           Reddit without some stuff
// @namespace      meh
// @include        http://www.reddit.com
// @include        http://www.reddit.com/
// @include        http://www.reddit.com/r/*
// @exclude        http://www.reddit.com/r/*/comments/*
// ==/UserScript==

// rank number
xp('//span[@class="rank"]').forEach(function(s) {
	s.parentNode.removeChild(s);
});

// domain
xp('//span[@class="domain"]').forEach(function(s) {
	s.parentNode.removeChild(s);
});

// subreddit
xp('//a[contains(@class, "subreddit hover")]').forEach(function(a){
	var title = xp('.//p[@class="title"]', a.parentNode.parentNode)[0];
	title.insertBefore(document.createElement('br'), title.firstChild);
	title.insertBefore(a, title.firstChild);
	a.style.fontSize = 'small';
});

//tagline
xp('//p[@class="tagline"]').forEach(function(p) {
	p.parentNode.removeChild(p);
});

//score
xp('//div[contains(@class,"score")]').forEach(function(p) {
	p.parentNode.removeChild(p);
});

//comments 
xp('//a[contains(@class,"comments")]').forEach(function(a) {
	if(a.getAttribute('class').search(/^\s*comments/) > -1) {
		var entry = a.parentNode.parentNode.parentNode;
		entry.appendChild(a);
	}
});


// hide and save
xp('//div[starts-with(@class,"entry")]/ul/li/form[@class="state-button hide-button" or @class="state-button save-button" or @class="state-button unsave-button"]').forEach(function(f) {
	var entry = f.parentNode.parentNode.parentNode;
	var space =  document.createElement('span');
	space.innerHTML = '   '
	entry.appendChild(space);
	entry.appendChild(f);
});


// "buttons"
xp('//ul[@class="flat-list buttons"]').forEach(function(u) {
	u.parentNode.removeChild(u);
});



function xp(p, context) {
  if (!context) 
	context = document;
  var i, arr = [], xpr = document.evaluate(p, context, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  for (i = 0; item = xpr.snapshotItem(i); i++) 
	arr.push(item);
  return arr;
}


//TODO:  print debugObj with added variables
function debug(str)
{
	var d = document.getElementById('debuggg');
	if(!d) {
		d = document.createElement('textarea');
		d.setAttribute('id','debuggg');
		d.setAttribute('style',"height:200px; width:50%; position:fixed; bottom:0px; right:0px;");
		document.body.appendChild(d);
	}
	d.innerHTML += '\n' + str;
	d.scrollTop = d.scrollHeight;
}