Can I auto-expand a bunch of Javascript message toggles
March 7, 2009 3:19 PM Subscribe
I'm trying to archive, in PDF form, a series of Web pages where the content won't expand unless I click "more" dozens and dozens of times to reveal each hidden item. Is there some time-saving Firefox add on--or other tool--that could do this for me automatically? It's a Javascript thing...
In code terms, the full content is all there in the source code (maybe I ought to just give up and save as HTML--what do you think?) but hidden via a Javascript gimmick.
Each of the many items on the page is concealed from view using a Javascript "onClick" attached to the links. When you click the link it runs a .js script called "toggleMessage," which gets the ID# of the item and then opens it. What I am envisioning is some sort of Firefox Web designer plugin where I could tell it the name of the script and it would go run it for me, expanding every panel.
Is this something Firebug, for example, would do?
Here's the script.
function toggleMessage(id)
{
var span = document.getElementById('msg'+id);
if (span.style.display == 'none')
{
// hide the more link
document.getElementById('msglink'+id).style.display='none';
// show the div
span.style.display = 'inline';
// show the less link
document.getElementById('msglesslink'+id).style.display='inline';
// switch the image
document.getElementById('image'+id).src=img_open;
}
else // it's already showing
{
// hide the less link
document.getElementById('msglesslink'+id).style.display='none';
// show the more link
document.getElementById('msglink'+id).style.display='inline';
// hide the span
span.style.display = 'none';
// switch the image
document.getElementById('image'+id).src=img_closed;
}
}
posted by Kirklander to computers & internet (6 answers total) 2 users marked this as a favorite
javascript:for(id=0;id<>>
posted by zsazsa at 3:27 PM on March 7, 2009