Skip to content

Instantly share code, notes, and snippets.

@kennethrapp
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennethrapp/5b5e413220afb93c9c93 to your computer and use it in GitHub Desktop.
Save kennethrapp/5b5e413220afb93c9c93 to your computer and use it in GitHub Desktop.
HN cure undead
// ==UserScript==
// @name HN Cure Undead
// @namespace kennethrapp1@gmail.com
// @include *news.ycombinator.com*
// @description unfade HN comments
// @version 2
// @grant none
// ==/UserScript==
var HackerNewsCureUndead = {
AffectDOMPath: function (expression, callback) {
var result = document.evaluate(expression, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
if (result.snapshotLength) {
for (i = 0; i <= result.snapshotLength - 1; i++) {
callback.call(this, result.snapshotItem(i));
}
}
},
Run: function () {
var regex;
// unfade comments
this.AffectDOMPath('//span[@class=\'comment\']', function (node) {
regex = new RegExp('<span class="c([0-9A-F]{2})">', 'gim');
node.innerHTML = node.innerHTML.replace(regex, function (i) {
return '<span clas="c00">';
});
});
// unfade text posts
this.AffectDOMPath('//td', function (node) {
node.setAttribute('style', 'color:#000000');
});
}
}.Run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment