Compression error

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
sa}{en
Advanced
Advanced
Posts: 11
Joined: Fri Jul 22, 2005 11:34 am

Compression error

Post by sa}{en »

I've tried to compress my menu_data.js with your online compressor.

http://milonic.com/jscompactor.php

When trying the compressed version the menu will not work. is this a common error? My file is quite big, so it would be nice with a little compression.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I just tried using the compressor and found that when I just copied and pasted the output to a file and saved it, the menu using that file works fine, but when I clicked the link to download the .js file and used that file, I got errors and the menu wouldn't show.

Ruth
sa}{en
Advanced
Advanced
Posts: 11
Joined: Fri Jul 22, 2005 11:34 am

Still have trouble

Post by sa}{en »

The file will still not work. Would I need some special editor when pasteing? I just use notepad, and thought it would work fine.

The file i try to compress is:
http://www.elefun.no/webshop/js2/menu_data.js

You see the menu at http://www.elefun.no

By the way. Is there other ways to make it faster or smaller to load. It's quite big right now.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Try removing all the top stuff that isn't usually in the menu_data.js file. Begin the file with _menuCloseDelay=500; Then after it's compressed, paste the other stuff back into it. I just tested your page and that seemed to work.

Ruth
sa}{en
Advanced
Advanced
Posts: 11
Joined: Fri Jul 22, 2005 11:34 am

Thank you

Post by sa}{en »

Thank you. It worked fine now. But it didn't help much. Is there another way to compress more or to make the file smaler? Would it help haveing the menu_data in more files or something like that?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

There's not much you can do since it contains so much. Even if you split it, you still have the same amount, just in different files. One thing you can do is make sure you eliminate all the lines you have slashed out. The ones with // in front of them. You can remove the copyright since that is in the program files. And, you can use the copyOf method for your styles.

In place of the visstistyle put this

Code: Select all

visstistyle=new copyOf(mainstyletopp);
visstistyle.oncolor="#000000";
visstistyle.offcolor="#000000";
since, both that style and the mainstyletopp only have two items different.

In place of the menuStyle2 and menuStyletopp you can put these

Code: Select all

menuStyle2=new copyOf(menuStyle);
menuStyle2.offbgcolor="#85c3ea";
menuStyle2.pagebgcolor="#ff0000";
menuStyle2.pageimage=""; 

menuStyleTopp=new copyOf(menuStyle);
menuStyleTopp.itemwidth="";
menuStyleTopp.onbgcolor="#77beec";
menuStyleTopp.oncolor="#000000";
menuStyleTopp.offbgcolor="transparent";
menuStyleTopp.subimage="arrow.gif";
menuStyleTopp.subimagepadding=3;
menuStyleTopp.image="../js2/blank.gif";
menuStyleTopp.imagepadding=3;
menuStyleTopp.menubgimage="../js2/topp_bak.gif";
menuStyleTopp.padding=4;
menuStyleTopp.separatoralign="right";
menuStyleTopp.separatorcolor="#C5C2B8";
menuStyleTopp.separatorpadding=1;
menuStyleTopp.separatorwidth="80%";
menuStyleTopp.menubgcolor="#ffffff";
menuStyleTopp.pagebgcolor="#C1D2EE";
menuStyleTopp.onborder="2px solid #e7f6fd";
menuStyleTopp.overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color=#999999, Direction=135, Strength=5)";       
I'm pretty sure they are correct, but you need to check the menuStyle from which they take their copyOf since you have two pagebgcolors listed in it. That cut another 1kb off the regular file size, before compression so it was 39kb, don't know what it would be after compression. Every kb helps.

Hope that helps.

Ruth
Post Reply