Page zooming in Firefox? IE does it (sort of)

Discussion of features in Mozilla Firefox
User avatar
Peter(6)
Posts: 13011
Joined: September 4th, 2003, 1:26 am
Location: Maassluis, The Netherlands

Post by Peter(6) »

I'm a bit disappointed about the zoom all, it's fairly slowwwww.

I found these 2 bookmarklets for imagezoom only and they are fast, like ctrl+/-

zoom image in

javascript:(function(){ function zoomImage(image, amt) { if(image.initialHeight == null) { /* avoid accumulating integer-rounding error */ image.initialHeight=image.height; image.initialWidth=image.width; image.scalingFactor=1; } image.scalingFactor*=amt; image.width=image.scalingFactor*image.initialWidth; image.height=image.scalingFactor*image.initialHeight; } var i,L=document.images.length; for (i=0;i<L;++i) zoomImage(document.images[i], 2); if (!L) alert("This page contains no images."); })();

zoom image out
javascript:(function(){ function zoomImage(image, amt) { if(image.initialHeight == null) { /* avoid accumulating integer-rounding error */ image.initialHeight=image.height; image.initialWidth=image.width; image.scalingFactor=1; } image.scalingFactor*=amt; image.width=image.scalingFactor*image.initialWidth; image.height=image.scalingFactor*image.initialHeight; } var i,L=document.images.length; for (i=0;i<L;++i) zoomImage(document.images[i],.5); if (!L) alert("This page contains no images."); })();
nightly build threads 20040225 (FF 0.8.0+) - 20120331 (FF14a)
User avatar
laszlo
Posts: 5225
Joined: November 4th, 2002, 6:13 pm
Location: .de
Contact:

Post by laszlo »

Here are the bookmarklets I use in conjunction for the purpose of Image Zooming, among them one to reset to original size:

http://people.freenet.de/laszlo/ImageZo ... klets.html
"I'll be dead after I die. I was dead before I was born. Life is a break from death." - Hlynur, 101 Reykjavík
james_firefoxrookie
Posts: 36
Joined: February 22nd, 2004, 6:47 am
Location: London, UK

Post by james_firefoxrookie »

Try this one, it's full page zooming with a prompt.

http://www.zen33339.zen.co.uk/

javascript:function zoomImage(image, amt){if(image.initialHeight == null){image.initialHeight = image.height;image.initialWidth = image.width;image.scalingFactor = 1;}image.scalingFactor *= amt;image.width = image.scalingFactor * image.initialWidth;image.height = image.scalingFactor * image.initialHeight;}function rZoomFont(n, node){for ( var i = 0;i < node.childNodes.length; i++ ){if (node.childNodes[i].nodeType == 1) rZoomFont(n, node.childNodes[i]);}startSize = getComputedStyle(node,'').getPropertyValue('font-size');startSize = Number(startSize.substr(0,startSize.length-2));lh = getComputedStyle(node,'').getPropertyValue('line-height');if (lh != 'normal') {lh = Number(lh.substr(0,lh.length-2)) * n + 'px';node.style.lineHeight = lh;}newSize = (startSize * n) +'px';node.style.fontSize = newSize;}var zoomamount = (prompt('Zoom Factor (Decimal)?','2.0'));rZoomFont(zoomamount,document.getElementsByTagName('body')[0]);for (i=0; i<document.images.length; ++i) zoomImage(document.images[i], zoomamount);
hminney
Posts: 13
Joined: February 20th, 2004, 9:25 am
Location: Durham, UK
Contact:

Post by hminney »

I feel really silly because everyone else knows how to do this, but I will ask anyway. How do you save the above javascript so you can use it? ie how do you save Bookmarklets?

Hugo
Hugo
james_firefoxrookie
Posts: 36
Joined: February 22nd, 2004, 6:47 am
Location: London, UK

Post by james_firefoxrookie »

Lots of ways really - copying the code and then just paste it into your address bar works. But you want it to use on other sites, so....

If it's a link - like the 'here' on http://www.zen33339.zen.co.uk/ just right click and choose 'bookmark this link'

However if the script isn't a link (like in this forum), copy it to the clipboard, then click 'bookmarks'>'manage bookmarks...' and then 'New bookmark' and paste it into the location field. Make sure you get all of it.

Good luck, it's easy really :)
hminney
Posts: 13
Joined: February 20th, 2004, 9:25 am
Location: Durham, UK
Contact:

Post by hminney »

Brilliant thanks - that really works! If it is so simple to do with a little bit of javascript, surely it won't add too much to Firefox and won't make it bloatware? Or am I being too simple?
Hugo
User avatar
laszlo
Posts: 5225
Joined: November 4th, 2002, 6:13 pm
Location: .de
Contact:

Post by laszlo »

This Bookmarklet is the best solution I've seen so far, it's almost perfect, but it's not a real zoom. It's still missing some elements, that's why it's still just a workaround.

What the Mozilla devs have in mind is real zooming like if looking at the page through a magnifying glass.
"I'll be dead after I die. I was dead before I was born. Life is a break from death." - Hlynur, 101 Reykjavík
james_firefoxrookie
Posts: 36
Joined: February 22nd, 2004, 6:47 am
Location: London, UK

Post by james_firefoxrookie »

How do you get Bug 4821 (http://bugzilla.mozilla.org/show_bug.cgi?id=4821) to apply to Firefox as well as Mozilla - or does it apply to both by default. And should we all be voting for it?

If development misses the 1.7 release (when Firefox branches permanently), and it looks like it will, then do us Firefox users not get page zooming – because I really want it :)

James
User avatar
laszlo
Posts: 5225
Joined: November 4th, 2002, 6:13 pm
Location: .de
Contact:

Post by laszlo »

james_firefoxrookie wrote:How do you get Bug 4821 (http://bugzilla.mozilla.org/show_bug.cgi?id=4821) to apply to Firefox as well as Mozilla - or does it apply to both by default. And should we all be voting for it?

As soon as the backend for this gets implemented, it will be in Firefox as well, because they share the same rendering engine. The only thing that would have to be done then is create a UI access to it.

On the other hand I wouldn't expect this to get fixed soon, obviously because of architectural difficulties (that's what David Baron's comments in the bug seem to imply at least. He's one of the core developers).
hminney
Posts: 13
Joined: February 20th, 2004, 9:25 am
Location: Durham, UK
Contact:

Post by hminney »

I voted for it! This forum is brilliant! Everyone is so friendly and helpful! I only joined last week and already I've fixed two of the things than have been bugging me for ages (it would be truer to say that you fixed them), and learnt a bit more about Javascript!

Been great fun and I look forward to more . . .

H
PS I voted!
Hugo
Post Reply