Add to Technorati Favorites
Add to del.icio.us   StumbleUpon Toolbar

Video: Firebug Copy & Paste Trick

March 8, 2007  | Tags: firefox, firebug, javascript, tutorial, sxsw

Yesterday, I was looking at the Interactive panel schedule for this year's SXSW. I wanted to copy the list of times and panel titles to a document on my PC. When I tried to copy and paste the nearly 200 panel titles, they each carried over a block of description text that did not appear in the browser. The text was microformat data that was being hidden via CSS, but Internet Explorer and Firefox both copied the hidden text when I selected the entire list.

It would take far too long remove the extra text from each entry, so I decided to go GEEK and solve the problem with a few lines of code. Using Firebug, I quickly destroyed the microformat data and was then able to copy and paste the list successfully.

True, there are other (and more efficient) ways to go about solving this problem, but a little troubleshooting and programming never hurt anyone! I figured the process I went through to solve this problem would make an interesting screencast (to some people). Here it is:



The code:

losers = new Array();
all = document.getElementsByTagName("*");
for (i=0;i< all.length;i++)
{
if (all[i].className == "vevent")
losers[losers.length] = all[i];
}
for (i=0;i< losers.length;i++)
{
losers[i].innerHTML = "";
}


Note: The page I used in the example does not have the microformat tags any more. You might be able to see from the address bar in the video that I was using a Google cache copy of the panel schedule page.

Feedback: brian @ shaler . name

 


Copyright © 2007 - Brian Shaler | Site Map
This site is powered by Brian's keyboard.