View Single Post
Old 2005-02-26, 10:05 AM   #1
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
Want to shrink your TGP's?

No, not make them smaller, but at least shrink the file size and make them load faster

I was going through one of my script folders and found a javascript I used when I had TGP's. I was never a fan of having something random in the status bar. So the solution was to have an onmouseover + onfocus on all links, which made the pages HUGE. A regular link would look something like this:

<a href="thumbs.php?pct=85&link=pic3&url=http://www.gallerydomain.com/00276197-01-01/pictures/05/index.php" onMouseover="window.status='http://www.gallerydomain.com/00276197-01-01/pictures/05/index.php'; return true;" onFocus="window.status='http://www.gallerydomain.com/00276197-01-01/pictures/05/index.php'; return true;" onMouseout="window.status=''>

That link is 355 bytes.

Now lets change it to something smaller

<a href="thumbs.php?pct=60&link=pic47&url=http://www.gallerydomain.com/00276197-01-01/pictures/05/index.php" onMouseover="ds(href);return true" onFocus="ds(href);return true" onMouseout="os()">

That link is 193 bytes.

What you need to put between your <head> and </head> is this:

<script>
function ds(msg) {
var surl = msg.match(/url=([^&]*)/, "$1")
status=unescape(surl[1])
}
function os() {
status=''
}
</script>


So if your TGP has 300 links you would save 47kB. That's a lot of load time if you're on a modem
swedguy is offline   Reply With Quote