Get File Size Extension

Talk about add-ons and extension development.
User avatar
Stefan
Posts: 2051
Joined: November 5th, 2002, 2:46 am

Post by Stefan »

Cusser wrote:Surely it should be the same, if only for the sake of consistency. What is KiB anyway, and is it really that important?


The problem with the "consistency" thing is that it's the wrong way. It's the same as saying Mozilla should have implemented the IE boxmodel bug, since that would have been "consistant" with other browsers on the market :D

Anyway, reading this should get you up to speed on what this is about
http://physics.nist.gov/cuu/Units/binary.html

For the record, FF will not use KiB instead of KB in the default frontend areas for the forseeable future, but there are plans to start implementing it slowly in eg about:cashe and other less visable places.
sbc
Posts: 147
Joined: February 18th, 2004, 12:47 pm

Post by sbc »

I think the problem isn't helped by Windows - where file sizes are in KB, MB and GB when they really mean KiB MiB and GiB. Also whenever you get a hard drive that says it is 20GB, people may expect Windows to display that size, but in reality it is 19.5GB. If you need to store 20GB of data, you really need a 30GB or higher drive. The same thing happens in usb drives - i.e. get a 32MB drive if you need 16MiB.

i.e. a 32 KB file in Windows is 32,768 bytes when strictly it should be 32,000 if the standards were followed.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Torisugari
Posts: 1634
Joined: November 4th, 2002, 8:34 pm
Location: Kyoto, Nippon (GMT +9)
Contact:

Post by Torisugari »

sbc wrote:I wonder what the HTTP headers text box would look like with a white background and a border - probably look out of place?

Border is OK, but white back ground is a bit difficult, because it requires "!important" option. If I hard code "!important", it can conflict with userChrome.css or user's theme. So I believe a extension author should not use "!important" in any style sheet.
As for it displaying the size/date in the status bar, that would probably cause problems (hits to the site everytime you went over a link) - it would look good though.

Exactly. When a user move mouse cursor quickly, some 20 or 30 hover events can be dispatched for a instance. statusbar handler ignores if anchor href is equal to current status bar url. So overwriting may cause some trouble. Though I'll try it, anyway.
Can't get file sizes for some links though - perhaps due to Pragma: no-cache in the header and/or the response not containing Content-Length. Sometimes last modified isn't returned either. Those seem to be webserver issues rather than browser issues.

Yes. In theory, even if header doesn't contains Content-Length, user agent can get size via "chunked" transfer-coding in advance. But it's difficult to implement it only with script.

http://www.w3.org/Protocols/rfc2616/rfc ... tml#sec4.4

>KB, KiB, KKB
hmm... This is not only for techsavy users even though it might used only by them. I don't mind either of them is. Or dividing with 1000 instead of 1024 is also OK.
User avatar
BenBasson
Moderator
Posts: 13671
Joined: February 13th, 2004, 5:49 am
Location: London, UK
Contact:

Post by BenBasson »

The problem with the "consistency" thing is that it's the wrong way. It's the same as saying Mozilla should have implemented the IE boxmodel bug, since that would have been "consistant" with other browsers on the market

I'm not saying we should be consistent with everyone else, or the specific standard, I'm just saying that there should at least be consistency within Firefox and it's extensions as to what units to use, even if Firefox is not technically correct. Anything else would just be confusing for end-users.

Thanks for the explanation, I know what you mean by KiB now. I learnt all about that ages ago, but never saw the KiB unit used. I figure that anyone who's clever enough to notice the difference (or understand KiB) would be fine with KB anyway, and nobody else would care - obviously an assumption that Microsoft and Mozilla.org share with me.

Maybe you should adapt the extension if it bothers you :p
Torisugari
Posts: 1634
Joined: November 4th, 2002, 8:34 pm
Location: Kyoto, Nippon (GMT +9)
Contact:

Post by Torisugari »

Cusser wrote:I figure that anyone who's clever enough to notice the difference (or understand KiB) would be fine with KB anyway, and nobody else would care - obviously an assumption that Microsoft and Mozilla.org share with me.


Now, you can select whichever locale you like.
http://cgi29.plala.or.jp/~mozzarel/addo ... e1_1_1.xpi

1.1.1
+ border around header field
+ selectable locales on install
User avatar
ehume
Posts: 6743
Joined: November 17th, 2002, 12:33 pm
Location: Princeton, NJ, USA

Post by ehume »

Most excellent. thank you very much.
Firefox: Sic transit gloria mundi.
User avatar
Stefan
Posts: 2051
Joined: November 5th, 2002, 2:46 am

Post by Stefan »

Torisugari wrote:+ selectable locales on install


Greate :)
The yes/no question could be a bit less cryptic though :D
Eg "Use correct SI units for filesizes (KiB instead of KB)"
User avatar
BenBasson
Moderator
Posts: 13671
Joined: February 13th, 2004, 5:49 am
Location: London, UK
Contact:

Post by BenBasson »

It'd be better if you added a pref in the options instead of a yes/no question. Otherwise, great :)
observer
Posts: 32
Joined: February 10th, 2004, 10:42 pm

Post by observer »

Is it possible to make it work on plain text links?
Thanks
Torisugari
Posts: 1634
Joined: November 4th, 2002, 8:34 pm
Location: Kyoto, Nippon (GMT +9)
Contact:

Post by Torisugari »

Stefan wrote:The yes/no question could be a bit less cryptic though :D
Eg "Use correct SI units for filesizes (KiB instead of KB)"

You are right. Thanks.

Cusser wrote:It'd be better if you added a pref in the options instead of a yes/no question.

No. This is because there's no way for a locale author to edit default pref value. And I believe , for a technical, it's easy enough to edit properties file in the locale dir.

observer wrote:Is it possible to make it work on plain text links?

Yes, but do you really need it? There are already a lot of "from text to a link" extensions, though I've never installed either of them. If one of them implements "right click + properties" feature, this extension works automatically. And other extension authors are ready to listen to your request, I believe.
observer
Posts: 32
Joined: February 10th, 2004, 10:42 pm

Post by observer »

I could not locate any of those text to url extensions getting me the filesize. Is there any? Please let me know.

Thanks
Thanks
Torisugari
Posts: 1634
Joined: November 4th, 2002, 8:34 pm
Location: Kyoto, Nippon (GMT +9)
Contact:

Post by Torisugari »

observer wrote:Is there any?

No, afaik. But "link properties" is a default functionality.
Torisugari
Posts: 1634
Joined: November 4th, 2002, 8:34 pm
Location: Kyoto, Nippon (GMT +9)
Contact:

Post by Torisugari »

As I said before, statusbar version is available. If you've never installed get file size 1.1.x, please install both, because they share a locale file for some reason.
http://cgi29.plala.or.jp/~mozzarel/addo ... bar0_1.xpi
tksh
Posts: 12
Joined: November 19th, 2003, 9:24 am

Post by tksh »

I don't suppose you can somehow combine the file size info with this extension?

http://forums.mozillazine.org/viewtopic.php?t=9299
sbc
Posts: 147
Joined: February 18th, 2004, 12:47 pm

Post by sbc »

Torisugari wrote:
Cusser wrote:I figure that anyone who's clever enough to notice the difference (or understand KiB) would be fine with KB anyway, and nobody else would care - obviously an assumption that Microsoft and Mozilla.org share with me.


Now, you can select whichever locale you like.
http://cgi29.plala.or.jp/~mozzarel/addo ... e1_1_1.xpi

1.1.1
+ border around header field
+ selectable locales on install

How would padding in the header field look, so the text does not go right up to the border of the text area? Thanks for spending the time developing this extension.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Post Reply