My First GreaseMonkey Script For Full As A Goog

Posted October 16, 2006 at 9:01 AM

Tags: Javascript / DHTML

I just authored my first every GreaseMonkey script. In the past I complained about the fact that Full As A Goog opens up links in the same window. To remedy this, I have created a GreaseMonkey script that grabs all the feed links and sets the TARGET attribute of their links to be "_blank". And just like that, the links work perfectly.

I have never done a GreaseMonkey script before and I have to say, it was really easy and fun. This might be something that I start doing for any site that bugs me.

Here is the simple script:

 Launch code in new window » Download code as text file »

  • // ==UserScript==
  • // @name Full As A Goog - Blank Window
  • // @namespace http://www.bennadel.com/
  • // @description This forces the RSS links in fullasagoog.com to open up in a new window.
  • // @include http://fullasagoog.com/*
  • // @include http://www.fullasagoog.com/*
  • // ==/UserScript==
  •  
  •  
  • // Get all of the links in the page.
  • var arrLinks = document.getElementsByTagName( "a" );
  •  
  • // Loo over the links so we can check the value for the url.
  • // We only care about links that are being routed through
  • // "go.cfm" but we have to get all of them from the DOM first.
  • for (var i = 0 ; i < arrLinks.length ; i++){
  •  
  • // Check to see if the link is one that redirects to an
  • // RSS feed blog entry.
  • if (
  • arrLinks[ i ].getAttribute( "href" ) &&
  • (arrLinks[ i ].getAttribute( "href" ).indexOf( "go.cfm" ) >= 0)
  • ){
  •  
  • // This is a link that points to a site. Set the target
  • // to open up in a new window.
  • arrLinks[ i ].setAttribute( "target", "_blank" );
  •  
  • }
  •  
  • }

Download Code Snippet ZIP File

Post Comment  |  Ask Ben  |  Other Searches  |  Print Page



Learning ColdFusion 9 - ColdFusion 9 tutorials, samples, examples, demos

Reader Comments

There are no comments posted for this web log entry.


Post Comment  |  Ask Ben

Recent Blog Comments
Mar 18, 2010 at 11:22 AM
Exploring ColdFusion Component Runtime Class Properties And Serialization
@Zarko, Ha ha, you know ColdFusion is my first love ;) ... read »
Mar 18, 2010 at 11:15 AM
Exploring ColdFusion Component Runtime Class Properties And Serialization
Hi Ben, nice to have you back! I already gave up on you, thinking you'll write about jQuery and iPhone for the rest our our lives! :) ... read »
Mar 18, 2010 at 10:36 AM
Ask Ben: Javascript Replace And Multiple Lines / Line Breaks
@Ben Nadel, Hey Ben, thanks for you're response. It works!! However.. if you could please kindly look at http://edeals.zzl.org/divchange2.php where I am trying it out you will see that with the " ... read »
Mar 18, 2010 at 9:56 AM
SQL COUNT( NULLIF( .. ) ) Is Totally Awesome
This works too. I learned this trick a long time ago and it's really powerful for flags. SELECT g.hair , COUNT(*) AS girl_count , sum(did_date) AS did_date_count , sum(abs(did_date - 1)) AS did_ ... read »
Mar 18, 2010 at 9:16 AM
Using A SQL JOIN In A SQL DELETE Statement (Thanks Pinal Dave!)
Forget the last part of that. Wasn't thinking straight and hadn't done it exactly that way myself. It'll work if you're doing an 'In' but if you're doing a 'Not In' as above it'll do each check acr ... read »
Mar 18, 2010 at 9:16 AM
Ask Ben: Blocking WSDL Access In A ColdFusion Application
Ben, Robert great stuff that I can use. Thanks. ... read »
Mar 18, 2010 at 8:45 AM
Using A SQL JOIN In A SQL DELETE Statement (Thanks Pinal Dave!)
Hi guys, Sort of in response to Kevin.. Just thought I'd point out something to any relative newbies like me trying to use the where clause subquery method with more than one join. I'm using MS Ac ... read »
Mar 18, 2010 at 6:59 AM
Using A Name Suffix In ColdFusion's CFMail Tag
Thanks Ben. This is really a very helpful article. Keep posting... Congrats. ... read »