Skip to main content
Ben Nadel at cf.Objective() 2010 (Minneapolis, MN) with: Doug Hughes and Ezra Parker and Dan Wilson and John Mason and Jason Dean and Luis Majano and Mark Mandel and Brian Kotek and Wil Genovese and Rob Brooks-Bilson and Andy Matthews and Simeon Bateman and Ray Camden and Chris Rockett and Joe Bernard and Dan Skaggs and Byron Raines and Barney Boisvert and Simon Free and Steve 'Cutter' Blades and Seth Bienek and Katie Bienek and Jeff Coughlin
Ben Nadel at cf.Objective() 2010 (Minneapolis, MN) with: Doug Hughes Ezra Parker Dan Wilson John Mason Jason Dean Luis Majano Mark Mandel Brian Kotek Wil Genovese Rob Brooks-Bilson Andy Matthews Simeon Bateman Ray Camden Chris Rockett Joe Bernard Dan Skaggs Byron Raines Barney Boisvert Simon Free Steve 'Cutter' Blades Seth Bienek Katie Bienek Jeff Coughlin

My First GreaseMonkey Script For Full As A Goog

By
Published in

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" );

	}

}

Want to use code from this post? Check out the license.

Reader Comments

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel
Managed hosting services provided by:
xByte Cloud Logo