My First GreaseMonkey Script For Full As A Goog

Posted October 16, 2006 at 9:01 AM by Ben Nadel

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:

  • // ==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" );
  •  
  • }
  •  
  • }


Reader Comments

There are no comments posted for this web log entry.

Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 21, 2013 at 7:46 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
No luck. At least I have uncovered the cause, URLScan 3.1. Here is what I see in the IIS log when a file is over 30mb. 2013-05-21 23:29:05 10.105.45.128 GET /plupload/assets/jquery/jquery-1.8. ... read »
May 21, 2013 at 6:12 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
Ben, I did not see you after Pete Freitag's Lockdown session at cfObjective but he said that IIS sets file size limits at 30MB by default which just happened to be the threshold for file size when ... read »
May 21, 2013 at 11:51 AM
Ask Ben: Parsing Very Large XML Documents In ColdFusion
Looking at my first ever XML document that I have to parse and put into MS SQL 2000 with CF8. I get it to list the desired Field name, many times over, and have a long list of this field name displa ... read »
May 21, 2013 at 9:25 AM
Turning Off and On Identity Column in SQL Server
you are awesome..i am lucky to get this blog between such a garbage one....Thanks, Prashant ... read »
May 20, 2013 at 4:38 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, Your confusion is well founded, since this is a very confusing features. In fact, it ONLY works if you use array notation. Meaning, that this: arrayToList( query[ "columnName" ] ) ... read »
May 20, 2013 at 4:34 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I was thinking chicken and the egg, I wouldn't have expected it to work in the valuelist going in I guess. Maybe I just need a beer, long day :) ... read »
May 20, 2013 at 4:29 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, That's if you're trying to reference a specific row. In this case, we're trying to reference the entire query column as one cohesive value. So, you are correct that if you wanted to output a ... read »
May 20, 2013 at 4:24 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I thought when you used array notation to reference queries you always had to have the row or it would throw a similar error as well? ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools