Kari’s Weblog

expressions unlimited

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 864 other followers

  • Twitter

    Error: Twitter did not respond. Please wait a few minutes and refresh this page.

  • Find me on

  • Bookmarks

  • Categories

My First Greece Monkey Script

Posted by karthikjcecs on December 4, 2008

I was reading a blog of my friend. The blog had a background color of black. It was so irritating for me to read, so I decided to change the background color somehow. I had seen Greece monkey scripts doing great things around the world thought why not give it a try. So here I started

  1. Installed Greecemonkey 0.8 addon into my firefox. Install from here and restart the firefox. Make sure a small monkey face appears at that bottom right corner of the browser. If its not in color click on it to turn it color. This ensures greecemonkey extension is active
  2. Open a text editor copy paste the following code

    // ==UserScript==
    // @name Change Bg color
    // @namespace <http://taguri.org/&gt;
    // @description Changes the backgroud color of the selected web pages
    // @include http://gowthamghatke.blogspot.com/
    // ==/UserScript==

    col_val = “#000000”;
    document.getElementsByTagName(“body”)[0].setAttribute(“style”, “background:”+col_val);

  3. Change the url at @include field above to the url of the site to which this script should be run. If you want to add multiple sites then add one site per line and with @include in every line. Later also you can add some more sites if you want
  4. Save the file as bgColor.user.js, make sure that type of file is selected as “All Types” otherwise windows will add .txt to it.
  5. Open the file with Firefox (right click on the file, select open with->choose program and select Firefox from the window and click on ok)
  6. A pop-op appears on your brower that includes name of your script, click on install. This will install your user script.
  7. Reload the site that you have added in @include, in my case its http://gowthamghatke.blogspot.com/ The background color of the site will change to white.

Yeppie!!! Did it. There may be thousands of more advanced products but the joy using own product is different.

Now coming to code part. Greece monkey uses some format to understand where to excecute user script, which script to exclude, name, description and things like that. The above commented part give those deatails to the greecemonkey extension. More detailed document is here

Next part is the color changing part. The whole content of a page will be in a <body> tag of html. document.getElementByTag(“body”)[0] gives you the tag first tag of the page with tag name body. setAttribute(“style”, -> Sets any one of the style of the selected tag.

“background:”+col_val) -> sets the background color to value of variable col_val

Advertisements

4 Responses to “My First Greece Monkey Script”

  1. Jyothi said

    Interesting!!

  2. karthikjcecs said

    To test email notification from Feedburner

  3. ahsan said

    i dnt know how to put a script plzzz reply……………

  4. Rodger Vanderlee said

    Love the blog…people are missing out not using Twitter more

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: