markpasc (owner)

Revisions

gist: 33311 Download_button fork
public
Public Clone URL: git://gist.github.com/33311.git
Embed All Files: show embed
no-loudtwitter.user.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ==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 ')"
        + "]");
})();