Skip to content

Instantly share code, notes, and snippets.

@markpasc
Created December 8, 2008 02:08
Show Gist options
  • Save markpasc/33311 to your computer and use it in GitHub Desktop.
Save markpasc/33311 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name No Loudtwitter
// @namespace http://markpasc.org/code/gm/
// @description Removes Loudtwitter posts from friends pages
// @include http://markpasc.livejournal.com/friends*
// @include http://mark.vox.com/explore/neighborhood*
// ==/UserScript==
(function() {
function purge(expr) {
var xpr = document.evaluate(expr, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < xpr.snapshotLength; i++) {
var node = xpr.snapshotItem(i)
node.parentNode.removeChild(node);
}
}
// LJ and Vox posts that link to loudtwitter
purge("//a[starts-with(@href, 'http://www.loudtwitter.com')]/ancestor::div["
+ "contains(concat(' ', @class, ' '), ' entry ')"
+ " or contains(concat(' ', @class, ' '), ' asset ')"
+ "]");
// Vox posts titled "Tweets for Today"
purge("//a[contains(text(), 'Tweets for Today')]"
+ "/ancestor::h2[contains(concat(' ', @class, ' '), ' asset-name ')]"
+ "/ancestor::div["
+ "contains(concat(' ', @class, ' '), ' asset ')"
+ "]");
// LJ posts titled "Delicious LiveJournal Links" or "tweets for today"
purge("//a[contains(text(), 'Delicious LiveJournal Links')"
+ " or contains(text(), 'tweets for today')]"
+ "/ancestor::h3[@class='entry-header']"
+ "/ancestor::div["
+ "contains(concat(' ', @class, ' '), ' entry ')"
+ "]");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment