Source for "LJ Twitterless"

By Xtina
Has 11 other scripts.


// ==UserScript==
// @name          LJ Twitterless
// @namespace     http://twilite.org/~xtina/scripts/
// @description   This removes the bullet list from LoudTwitter posts.
// @include       http://*.livejournal.com/friends
// @include       http://*.livejournal.com/friends/*
// ==/UserScript==

// This is 100% straight from this script:
// http://www.gozer.org/mozilla/greasemonkey/scripts/adblockfilter.user.js
// Bless you, whoever you are.

// NOTE: This currently only works with the Expressive/Mixit LJ style.  I'm
// working on having it work on most any style.  Until then, if you want to
// make use of plain ol' removing the bullet list items until I get there,
// follow the commented instructions below.


// If you're switching from Expressive-removal to generic-removal, start
// deleting here, and don't stop until the next comment says so.

(function() {

var elm, thing, regex, uls;

elm = [ 'ul' ];
thing = [ 'class' ];

regex = new RegExp("loudtwitter", "gi");

// Get the twits.
var allTwits = document.evaluate(
  "//div[@class='asset-body']",
  document,
  null,
  XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
  null);

for (var i = 0; i < allTwits.snapshotLength; i++) {
  var thisTwit = allTwits.snapshotItem(i);

  for(var x = 0; x < elm.length; x++) {
    uls = thisTwit.getElementsByTagName(elm[x]);
  
    for(var y = 0; y < uls.length; y++) {
      if(!uls[y] || !uls[y].hasAttributes())
        continue;
  
      for(var z = 0; z < thing.length; z++)
        if(uls[y].hasAttribute(thing[z]))
          if(uls[y].getAttribute(thing[z]).match(regex))
// Yup, this is ugly.
            thisTwit.parentNode.parentNode.parentNode.parentNode.removeChild(thisTwit.parentNode.parentNode.parentNode);
      }
    }
  }
})();

// Okay, stop deleting.  Remove the next line and the last line ('/*' and '*/',
// respectively), and go nuts!

/*
(function() {

var elm, thing, regex, uls;

elm = [ 'ul' ];
thing = [ 'class' ];

regex = new RegExp("loudtwitter", "gi");

for(var x = 0; x < elm.length; x++) {
  uls = document.getElementsByTagName(elm[x]);

  for(var y = 0; y < uls.length; y++) {
    if(!uls[y] || !uls[y].hasAttributes())
      continue;

    for(var z = 0; z < thing.length; z++)
      if(uls[y].hasAttribute(thing[z]))
        if(uls[y].getAttribute(thing[z]).match(regex))
          uls[y].parentNode.parentNode.removeChild(uls[y].parentNode);
    }
  }
})();
*/