modifying Yahoo Finance Portfolio tables with greasemonkey

View: New views
1 Messages — Rating Filter:   Alert me  

modifying Yahoo Finance Portfolio tables with greasemonkey

by krick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to modify my yahoo finance portfolio with greasemonkey so that I can cut and paste the table to a spreadsheet.  Here's the URL, but you'll have to log into yahoo and create your own portfolio to actually see anything...   http://finance.yahoo.com/p?k=pf_2

The unmodified page has several span tags with 'display:none' that show up when I cut and paste the page.  Additionally, the table has small arrow images indicating up or down before the data in certain cells that also shows up.

I'm trying to strip out all the span tags and img tags using this seemingly simple greasemonkey code, but it doesn't seem to work right and I'm not sure what I'm doing wrong...

//-------------------------

var allItems, thisItem;
allItems = document.getElementsByTagName('span');
for (var i = 0; i < allItems.length; i++) {
    thisItem = allItems[i];
    if (thisItem.style == 'display:none')
      thisItem.parentNode.removeChild(thisItem);
}

allItems = document.getElementsByTagName('img');
for (var i = 0; i < allItems.length; i++) {
    thisItem = allItems[i];
    thisItem.parentNode.removeChild(thisItem);
}

//------------------------------------