Skip to content

Instantly share code, notes, and snippets.

@nogweii
Created April 23, 2010 02:04
Show Gist options
  • Save nogweii/376070 to your computer and use it in GitHub Desktop.
Save nogweii/376070 to your computer and use it in GitHub Desktop.
An attempt at making the news feed better, cleaner, and less noisy.
// ==UserScript==
// @name Github news feed minimizer
// @namespace evaryont.me
// @include https://github.com/
// @include https://github.com/dashboard/yours
// @datecreated 2010-04-22
// @version 0.1
// @author Colin 'Evaryont' Shea
// @license MIT
// @description Do many little things, but overall, make the whole page a lot better.
// ==/UserScript==
// Lazy function, w00t. Takes two parameters, a XPath expression that returns a
// series of elements, and a function (anonymous or not) to be executed for each
// element in the series.
var forEach = function(xpath, action) {
var allElements, thisDiv;
allElements = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < allElements.snapshotLength; i++) {
action(allElements.snapshotItem(i));
}
}
// Remove the larger avatars
forEach("//div[@class='gravatar']", function(node){
node.parentNode.removeChild(node);
});
// Remove the grey top bar, the tabs
forEach("//ul[@class='tabs']", function(node){
node.parentNode.removeChild(node);
});
// Left-align the individual commit messages.
// Other types of events (issues, gists, etc) are already aligned left
forEach("//div[@class='commits']/ul/li", function(node){
node.style.marginLeft = 0;
});
// Remove the dividing lines, as well as remove the icons
forEach("//div[@class='body']", function(node){
node.style.borderBottomWidth = 0;
node.parentNode.setAttribute("class", "alert")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment