Skip to content

Instantly share code, notes, and snippets.

@lestrrat
Created October 14, 2009 08:53
Show Gist options
  • Save lestrrat/209899 to your computer and use it in GitHub Desktop.
Save lestrrat/209899 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name NoRadioTube
// @namespace http://mt.endeworks.jp/d-6/
// @description Silences RadioYoutube. RY is cool, but it gets annoying
// when your timeline is full of those tweets.
// @include http://twitter.com/*
// ==/UserScript==
function xpath(query, ctxt) {
if (ctxt == null) {
ctxt = document;
}
return document.evaluate(query, ctxt, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
}
function noradiotube() {
var spanlist = xpath('//span[@class="status-body"]', document);
var re = new RegExp('^[a-zA-Z0-9_]+ (CLAP|STAND)!');
for( var i = 0; i < spanlist.snapshotLength; i++) {
var span = spanlist.snapshotItem(i);
if (re.test(span.textContent) ) {
span.parentNode.style.display = 'none';
}
}
}
(function() {
document.title += " (No Radiotube)";
noradiotube();
var enqueued = 0;
document.getElementById('timeline').addEventListener('DOMNodeInserted', function(e) {
if (! enqueued && e.target.nodeType == 1 && e.target.tagName == 'LI') {
enqueued = 1;
setTimeout( function() { noradiotube(); enqueued = 0; }, 2000 );
}
}
, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment