Forgot your password?

typodupeerror

Submission Summary: 0 pending, 6 declined, 0 accepted (6 total, 0.00% accepted)

Programming

A WSJ hack for Firefox users

Submitted by
Fordiman
Fordiman writes "One of the more annoying things about the way the Wall Street Journal is set up is its assumption that you're some kind of corporate news theif. As a result, you can't directly access articles by their link, and 'open in new tab' just brings up another search window.

Also, due to an error in the way Firefox handles text wrapping, sometimes article printouts come out clipped on the right side.

To fix both of these issues, I wrote a quick Javascriptlet (javascript: type bookmark) that fixes these issues in a single click. All that's needed is to bookmark the preceeding link, and to use it on search pages at WSJ and on print pages that don't 'look' right.

Let us look at the code, shall we? (Formatting should be removed before using the following code)

javascript:
(function(){ //We do this in order to suppress a return value
var X=document.getElementsByTagName('A'); //Get all the links
for (i=0; i X[i].onclick=function(){}; // Clear the onClick handler
if(X[i].innerHTML.indexOf(',')!=-1) // If the link has a comma,
X[i].innerHTML=X[i].innerHTML.replace(',',', '); // Make it wrappable by adding a space
var a = X[i].href.indexOf('#SB'); // Article links contain this string
if (a!=-1)
X[i].href= //Essentailly, clip off the '#',
'http://online.wsj.com/article_print/'+ //prepend it with this
X[i].href.substr(a+1,X[i].href.length-a-1)+
'.html'; // and append it with '.html'
}
X=document.getElementsByTagName('table'); // another hack; sometimes tables expand the page
for(i=0;i if(typeof X[i].width!='undefined')X[i].width=''; // Set the width to nuffin'
})(); //Close up our function
"

An idealist is one who helps the other fellow to make a profit. -- Henry Ford

Working...