plz help, trying to improve Attachment Sizes extension

Talk about add-ons and extension development.
Post Reply
leeoniya
Posts: 72
Joined: April 5th, 2006, 10:41 am
Location: Northbrook, IL

plz help, trying to improve Attachment Sizes extension

Post by leeoniya »

the original extension is here:
https://addons.mozilla.org/firefox/878/

i'm trying to improve this extension because of the following issues:

1. all file sizes are given in KB only, and to be specific, KiB. and the decimal places are too many.
2. in the compose dialog, when an attachment is added, the size precedes the filename, and is also in KiB

i'm making changes to the js files inside.

so far i have successfully resolved issue 1. i added conditional if statements to one js file so that attachments in received messages are now displayed in bytes (0 decimal places) for less that 1024, KB (with 1 decimal place) for less than or = 1024^2, and MB (with 2 decimal places) for >1024^2.

i have also been able to reverse the order....it is now <filename> (size). but as soon as i add essentially identical "if" statements to the second js file that controls how attachment sizes are displayed in the compose dialog, the sizes disappear altogether. i am pretty sure it isn't syntax, but i have no idea what it could be, i get no errors or anything.

this is the original and works:
http://24.13.207.101/attbytesC.js

this is my modded one:
http://24.13.207.101/attbytesCmod.js
(if you comment out my additional "if" statements, the order of size and filename and kB is replaced by KB) not sure why ifs dont work :(
please help if u can, thanks,
Leon
Old Ausdilecce
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Ausdilecce »

You could have just sent a message to the author.. That would be me ;)

The latest version ( on my site, not UMO ) has support for choosing kB or KiB with a pref.
Note that most ISPs will limit message sizes on KiB (not kB), which is my the extension uses that as the default.

The reason why the extension puts the size before the name is because, with long file names, the size *could* be pushed over to the right, outside of the viewable area of the listbox, meaning that the user would have to scroll right to see the sizes.. Also, the sizes would not all be lined up, so the user sould have to scroll right and left to see which attachements have what sizes.. There was some method to the madness..

I could have added a pref to control the number of decimal places etc etc..
User avatar
goofyFr
Posts: 70
Joined: June 26th, 2005, 2:03 pm
Location: France

Post by goofyFr »

[SideNote] Strings like "Attachment" and "Kb" should be localized throughout a stringbundle reading from a locale .properties file. Keep on the good work, devs! :) [/SideNote]
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Post by Philip Chee »

ausdilecce wrote:The latest version ( on my site, not UMO ) has support for choosing kB or KiB with a pref.
Note that most ISPs will limit message sizes on KiB (not kB), which is my the extension uses that as the default.
Lots of extensions there, but I can't find the Attachment Sizes extension there. By the way I have a SeaMonkey port at: http://xsidebar.mozdev.org/modifiedmisc.html#attrbytes

Phil
Old Ausdilecce
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Ausdilecce »

Thanks philip.

I have not updated the text on my site for some time..

However, all of the xpis are on my site in their most current versions..

So, latest Attachment Sizes is there www.supportware.net/mozilla/AttachmentSizes.xpi ( version 0.0.8 )
Philip, this version contains the install.js from your modded version (I only changed the version number, your credits are still there ).. Can you check if it installs correctly on SM ? I have no test env for SM.

GoofyFr, the latest version has been localized.

The 0.0.8 version contains an options panel that allows for changing the units ( kB, mB, gB, KiB, MiB, GiB, Auto, AutoB )
..Auto will use bytes if size is under 10^3 bytes, kB if size is under 10^6 bytes, mB if under 10^9, and gB if over 10^9
..AutoB will use bytes if size is under 2^10 bytes, KiB if size is under 2^20 bytes, MiB if under 2^30, and GiB if over 2^30

you can also change the # decimal places (autos will use default decimal places of 0 for bytes, 1 for kB or KiB, 2 for all others)
you can also change the order of text ( (size) name, or name (size) )

Leeoniya, I have not looked at your code, but thanks for the comments, suggestions

Cheers
User avatar
Cato62
Posts: 684
Joined: March 7th, 2005, 10:06 am
Location: Eugene, OR

Post by Cato62 »

ausdilecce wrote:The 0.0.8 version contains an options panel that allows for changing the units ( kB, mB, gB, KiB, MiB, GiB, Auto, AutoB )
..Auto will use bytes if size is under 10^3 bytes, kB if size is under 10^6 bytes, mB if under 10^9, and gB if over 10^9
..AutoB will use bytes if size is under 2^10 bytes, KiB if size is under 2^20 bytes, MiB if under 2^30, and GiB if over 2^30

you can also change the # decimal places (autos will use default decimal places of 0 for bytes, 1 for kB or KiB, 2 for all others)
you can also change the order of text ( (size) name, or name (size) )


Thanks ausdilecce for the options panel. It's nice to be able to set this the way <I><b>I</b></I> want it to read. Nice job on a handy extension!
"It is difficult to fight against anger, for a man will buy revenge with his soul." ~ Heraclites, 500 B.C.

The Blood Series: BloodFire, BloodFire 3, BloodThunder, BloodSun, & BloodSong
Old Bozz
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Bozz »

Thanks Frank. Good work with the Options panel. Dummy question...what is the "Debug" selection?

Does anyone know how to increase the length or width of the attachment file name display?
alta88
Posts: 1029
Joined: January 28th, 2006, 3:08 pm

Post by alta88 »

bozz wrote:Does anyone know how to increase the length or width of the attachment file name display?


here's what i've done, might help..

Code: Select all

#attachmentView  {
    -moz-appearance: none !important;
    background-color: #b7c691 !important;
    border-top: 0px !important;
    border-right: 0px !important;
    border-bottom: 1px solid threedshadow !important;
    border-left: 1px solid threedshadow !important;
    overflow-y: scroll !important;
    margin: 0px !important;
    height: 30px !important;
}
#attachmentLabel {
    display: none !important;
}
#attachmentList {
    -moz-appearance: none !important;
    margin: 2px 0px 2px 1px !important;
    border-right: 0px !important;
}
.attachmentBox {
    -moz-appearance: none !important;
    min-width: 10px !important;
}
descriptionitem:hover,
descriptionitem[checked="true"]:hover {
    -moz-appearance: none !important;
    cursor: pointer !important; 
    color: -moz-dialogtext !important;
    border: 1px solid #758d5e !important;
    background-image: url(chrome://global/skin/toolbar/select.png);
    background-repeat: repeat-x !important;
}
Old Bozz
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Bozz »

Thanks alta88. I figured it out last night but the forums were down when I was on line and couldn't post back.

Code: Select all

.attachmentBox {
width: auto !important;
/*max-width: none !important;
min-width: 15em !important;*/ }
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Post by Philip Chee »

ausdilecce wrote:So, latest Attachment Sizes is there www.supportware.net/mozilla/AttachmentSizes.xpi ( version 0.0.8 )
Philip, this version contains the install.js from your modded version (I only changed the version number, your credits are still there ).. Can you check if it installs correctly on SM ? I have no test env for SM.
Sorry for the delay. I can report that v 0.0.8 works fine in SeaMonkey 1.0.5 and 1.5a. Only one nit: you need to correct the version number in content/contents.rdf (currently 0.1) or just remove it.

Phil
suethomo
Posts: 44
Joined: February 26th, 2005, 11:15 am

Post by suethomo »

Can someone tell me where the Options panel is on version 0.0.8?
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Post by Philip Chee »

suethomo wrote:Can someone tell me where the Options panel is on version 0.0.8?
chrome://attbytes/content/settings.xul

Otherwise access it from the usual place in the extension manager.

Phil
User avatar
Karlosak
Posts: 10
Joined: September 2nd, 2006, 2:26 am
Location: Prague, Czech Republic, EU
Contact:

Post by Karlosak »

I really like this extension, but the inability to show longer file names in their full form makes the extension quite impractical. Would it be possible to include some user option to select max file name display width? Or at least make the three truncation dots positioned right before the file extension or next to the parenthesis (example: Mypic...jpg(30Kb) or Mypictureof...(30Kb)). The behaviour seems pretty random right now.

Thanks!
Old Bozz
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Bozz »

Is this what your looking for?

Code: Select all

/* Display attachment filenames full length */
.attachmentBox {
-moz-appearance: none !important;
width: auto !important;
}
Post Reply