PDA

View Full Version : Jim's DHTML Meny V5.7 File Size Problem



demtro
09-25-2005, 03:38 AM
Jim's DHTML Meny V5.7

http://www.dynamicdrive.com/dynamicindex1/jimmenu/index.htm

The site where the menu can be viewed is
http://development.ourfamilygenealogy.com

my problem is with the size of the config3.js file. I modified the file to contain the menu options that I needed and the file size is now 18K there are 294 lines of code int he file, due to the size it now takes approx 10 seconds for my site to load the menu. I was wondering if there is any way I can reduce the size of the file or if i can break the file up into multiple parts to increase load time. Any help would be appreciated. Below is the code from the config3.js file. I already tried removing the spaces from in between the menus and that did not have an affect on the size of the file. IS there any other information I can remove or anything I can do to get this smaller.

This is only a portion of the file, due to character limitations in this forum I was unable to post the entire file. if you need additional code from the file please let me know and I will arrange to make it available on the site.

Thank you




function init()
{
menus[0] = new menu(20, "horizontal", 100, 100, 0, -2, "img:images/background1.jpg", "img:images/background2.jpg", "Arial,Helvetica", 9, "bold",
"bold", "white", "white", 0, "white", 2, "rollover:images/tri-down1.gif:images/tri-down2.gif", false, false, true, false, 0, true, 4, 4, "gray");
menus[0].addItem("index.htm", "", 60, "center", "Home", 1);
menus[0].addItem("surnamesa-g.htm", "", 119, "center", "Surnames (A-G)", 2);
menus[0].addItem("surnamesh-m.htm", "", 125, "center", "Surnames (H-M)", 10);
menus[0].addItem("surnamesn-t.htm", "", 125, "center", "Surnames (N-T)", 17);
menus[0].addItem("surnamesu-z.htm", "", 125, "center", "Surnames (U-Z)", 25);
menus[0].addItem("aboutus.htm", "", 100, "center", "About Us", 0);
menus[0].addItem("contactus.htm", "", 100, "center", "Contact Us", 0);
menus[0].addItem("links.htm", "", 60, "center", "Links", 0);
menus[0].floatMenu(1024, 768, 10, 0);

menus[1] = new menu(150, "vertical", 0, 0, -5, -5, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 187, false, false, false, false, 0, true, 4, 4, "gray");
menus[1].addItem("kingfamily.ourfamilygenealogy.com", "", 22, "center", "King Family History", 0);
menus[1].addSeparator(1, "black");
menus[1].addItem("janfamily.ourfamilygenealogy.com", "", 22, "center", "Jan's Family History", 0);
menus[1].addSeparator(1, "black");

menus[2] = new menu(22, "vertical", 0, 0, 0, -2, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, "rollover:images/tri-right1.gif:images/tri-right2.gif", false, true, false, false, 0, true, 4, 4, "gray");
menus[2].addItem("#", "", 22, "left", "A", 3);
menus[2].addItem("#", "", 22, "left", "B", 4);
menus[2].addItem("#", "", 22, "left", "C", 5);
menus[2].addItem("#", "", 22, "left", "D", 6);
menus[2].addItem("#", "", 22, "left", "E", 7);
menus[2].addItem("#", "", 22, "left", "F", 8);
menus[2].addItem("#", "", 22, "left", "G", 9);

menus[3] = new menu(100, "vertical", 0, 0, 0, 0, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[3].addItem("#", "", 22, "left", "Alquire", 0);

menus[4] = new menu(100, "vertical", 0, 0, -5, -5, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[4].addItem("#", "", 22, "left", "Baker", 0);
menus[4].addItem("#", "", 22, "left", "Baranowski", 0);
menus[4].addItem("#", "", 22, "left", "Barbaro", 0);
menus[4].addItem("#", "", 22, "left", "Bartnik", 0);
menus[4].addItem("#", "", 22, "left", "Bigow", 0);
menus[4].addItem("#", "", 22, "left", "Birknew", 0);
menus[4].addItem("#", "", 22, "left", "Bonczar", 0);
menus[4].addItem("#", "", 22, "left", "Bormolini", 0);
menus[4].addItem("#", "", 22, "left", "Bredahl", 0);
menus[4].addItem("#", "", 22, "left", "Bronovitski", 0);
menus[4].addItem("#", "", 22, "left", "Broz", 0);
menus[4].addItem("#", "", 22, "left", "Brzozowska", 0);
menus[4].addItem("#", "", 22, "left", "Budzinski", 0);

menus[5] = new menu(100, "vertical", 0, 0, 0, 0, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[5].addItem("#", "", 22, "left", "Carpenter", 0);
menus[5].addItem("#", "", 22, "left", "Clavette", 0);
menus[5].addItem("#", "", 22, "left", "Connelly", 0);
menus[5].addItem("#", "", 22, "left", "Creegan", 0);
menus[5].addItem("#", "", 22, "left", "Csar", 0);

menus[6] = new menu(100, "vertical", 0, 0, 0, 0, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[6].addItem("#", "", 22, "left", "Davidson", 0);
menus[6].addItem("#", "", 22, "left", "DeFranco", 0);
menus[6].addItem("#", "", 22, "left", "DePuy", 0);
menus[6].addItem("#", "", 22, "left", "Dormer", 0);
menus[6].addItem("#", "", 22, "left", "Duma", 0);
menus[6].addItem("#", "", 22, "left", "Dwight", 0);
menus[6].addItem("#", "", 22, "left", "Dziura", 0);

menus[7] = new menu(100, "vertical", 0, 0, 0, 0, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[7].addItem("#", "", 22, "left", "Ellis", 0);
menus[7].addItem("#", "", 22, "left", "Entwistle", 0);
menus[7].addItem("#", "", 22, "left", "Evens", 0);

menus[8] = new menu(100, "vertical", 0, 0, 0, 0, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[8].addItem("#", "", 22, "left", "Fijalkowski", 0);
menus[8].addItem("#", "", 22, "left", "Forgey", 0);
menus[8].addItem("#", "", 22, "left", "Fowler", 0);
menus[8].addItem("#", "", 22, "left", "Frackowiak", 0);
menus[8].addItem("#", "", 22, "left", "Fruman", 0);

menus[9] = new menu(100, "vertical", 0, 0, 0, 0, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[9].addItem("#", "", 22, "left", "Gabalowski", 0);
menus[9].addItem("#", "", 22, "left", "Gawel", 0);
menus[9].addItem("#", "", 22, "left", "Gorman", 0);
menus[9].addItem("#", "", 22, "left", "Gorska", 0);
menus[9].addItem("#", "", 22, "left", "Grinsteiner", 0);

menus[10] = new menu(22, "vertical", 0, 0, 0, -2, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, "rollover:images/tri-right1.gif:images/tri-right2.gif", false, true, false, false, 0, true, 4, 4, "gray");
menus[10].addItem("#", "", 22, "left", "H", 11);
menus[10].addItem("#", "", 22, "left", "I", 12);
menus[10].addItem("#", "", 22, "left", "J", 13);
menus[10].addItem("#", "", 22, "left", "K", 14);
menus[10].addItem("#", "", 22, "left", "L", 15);
menus[10].addItem("#", "", 22, "left", "M", 16);

menus[11] = new menu(100, "vertical", 0, 0, 0, 0, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[11].addItem("#", "", 22, "left", "Hamilton", 0);
menus[11].addItem("#", "", 22, "left", "Hankins", 0);
menus[11].addItem("#", "", 22, "left", "Hess", 0);
menus[11].addItem("#", "", 22, "left", "Hutchinson", 0);

menus[12] = new menu(100, "vertical", 0, 0, 0, 0, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[12].addItem("#", "", 22, "left", "Iversen", 0);

menus[13] = new menu(100, "vertical", 0, 0, 0, 0, "white", "royalblue", "Arial,Helvetica", 9, "",
"bold", "black", "white", 1, "black", 2, 0, false, true, false, false, 0, true, 4, 4, "gray");
menus[13].addItem("#", "", 22, "left", "Jabczon", 0);
menus[13].addItem("#", "", 22, "left", "Jastrzebska", 0);
menus[13].addItem("#", "", 22, "left", "Jessen", 0);
menus[13].addItem("#", "", 22, "left", "Johnson", 0);
menus[13].addItem("#", "", 22, "left", "Jorgensen", 0);
menus[13].addItem("#", "", 22, "left", "Juszczenka", 0);

ddadmin
09-26-2005, 11:45 PM
Hmmm everything in the .js files are required for the most part, and it's probably not a good idea to remove parts arbitrarily, as you or I don't know exactly what they do sometimes. One suggestion is to try and run the .js file through a JavaScript compressor, such as http://brainjar.com/js/crunch/ If it doesn't work (ie: the code mangles as a result), you'll know instantly from the errors and the menu failing to load.

demtro
09-26-2005, 11:49 PM
Thank you for the Reply, I tried to run the code through that and it only compressed it down to 17.5 not enough to make a different. Would you minde going to development.ourfamilygenealogy.com and let me know if you think that is a normal amount of time for a java script menu to load? When i add more content it may not be noticable but want to be sure. Again thanks for the reply.

ddadmin
09-27-2005, 03:16 AM
Hi Demtro:
It definitely feels sluggish. The problem however doesn't appear to be file size, as the sluggishness is from the menu rendering, not downloading. It might be you have too many submenus defined. Also, removing the background image for the menu and replacing that with just a color may help with efficiency as well.

This will mean some hassle, but you may want to try out some of the other menu systems, such as HV Menu or JsDOMenuBar listed here: http://www.dynamicdrive.com/dynamicindex1/indexc.html