The forgotten Milk

LifeHacks + Coding = HappyLife

5/13/2007

My first MonkeyScript

I was so amazed with the script plugins on firefox. Yeah! They enhance the website UI so much!
Now I use GreaseMonke and Stylish for GoogleReader, Gmail, last.fm, DeviantArt, Flickr, Hotmail, Download.com, Twitter, Photobucket and so on.


I am a Naruto fan. And I found one online comic site about Naruto. But one block of advertiesment make me crazy! Who can bear this?

So the impulse to write one script to hide the block come out from my brain.

After read some source scripts, I wrote as the below:












// ==UserScript==
// @name 1mh comic
// @description Say goodbye to Demonoid's most annoying ads ever. (v1.1)
// @include http://www.1mh.org/html/*
// ==/UserScript==

var adContainer = document.getElementsByTagName('table')[0];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

adContainer = document.getElementsByTagName('table')[1];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

adContainer = document.getElementsByTagName('table')[2];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

adContainer = document.getElementsByTagName('table')[5];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

adContainer = document.getElementsByTagName('table')[6];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

--------------------------------------------------------------------

Yes, I only keep the 3rd(image) and 4th(page control) table. So simple! The script is dirty, but I needn't make it clean.

After install my script, the result page display so clean.




















So cool! Ok, let's code anywhere and anytime.

Labels: ,

1 Comments:

  • At 7:15 pm , Blogger Big Eclipse said...

    Hey terababy:

    Big Eclipse here. i deleted my Twitter account and now use Jaiku -- http://bigeclipse.jaiku.com -- exclusively. At any rate, i still check your blog to see the new goodies that you have posted. i love this script to block out the ads on that site. Very cool!

    Just dropping a quick note to say "Hi". Keep up the good work, i look forward to the updates.


    Big Eclipse

     

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home