Skip to content

Instantly share code, notes, and snippets.

@craigds
Forked from ireeymonse/MuteRdioAds.js
Last active November 9, 2015 02:53
Show Gist options
  • Save craigds/14db5022a00b946ee14f to your computer and use it in GitHub Desktop.
Save craigds/14db5022a00b946ee14f to your computer and use it in GitHub Desktop.
Mute Rdio Ads (bookmarklet)
javascript:(function()%7Bvar%20r%20%3D%20R.player%2C%20oVol%20%3D%20r.volume()%2C%20tf%20%3D%20r._onTrackFinished%2C%20ar%20%3D%20r._onAudioReady%2C%20n%20%3D%20r._next%3Br._onTrackFinished%20%3D%20function()%20%7Bconsole.log(%22iree%3AtrackFinished%3A%22%2Barguments)%3Bif%20(.001%20!%3D%3D%20r.volume())%7BoVol%20%3D%20r.volume()%3Br.volume(.001)%3B%7Dreturn%20tf.apply(this%2C%20arguments)%3B%7D%3Br._onAudioReady%20%3D%20function()%20%7Bconsole.log(%22iree%3AaudioReady%3A%22%2Br.playingAd())%3Bif%20(!r.playingAd())%7Br.volume(oVol)%3B%7Dreturn%20ar.apply(this%2C%20arguments)%3B%7D%3Bdocument.getElementById('header').style.backgroundColor%20%3D%20'blue'%7D)()
var r = R.player, oVol = r.volume(), tf = r._onTrackFinished, ar = r._onAudioReady, n = r._next;
r._onTrackFinished = function() {
console.log("iree:trackFinished:"+arguments);
if (.001 !== r.volume()){
oVol = r.volume();
r.volume(.001);
}
return tf.apply(this, arguments);
};
r._onAudioReady = function() {
console.log("iree:audioReady:"+r.playingAd());
if (!r.playingAd()){
r.volume(oVol);
}
return ar.apply(this, arguments);
};
// make rdio header blueish so we know it worked
document.getElementById('header').style.backgroundColor = 'blue';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment