View Single Post
Old 04-24-2012, 08:47 AM   #1
mike2046
Member
mike2046 knows what time it ismike2046 knows what time it ismike2046 knows what time it ismike2046 knows what time it ismike2046 knows what time it ismike2046 knows what time it ismike2046 knows what time it ismike2046 knows what time it ismike2046 knows what time it ismike2046 knows what time it ismike2046 knows what time it is
 
Posts: 15
Karma: 2006
Join Date: Mar 2012
Location: UK
Device: Kindle
Mobipocket Creator IE9 Table of Contents possible work round

In a previous post I gave a work round for the problem with the Guide option in Mobipocket Creator (see thread "Mobipocket Creator - work round for IE9 problem"). DDHarriman and Hitch kindly looked at that and through their responses I realized that this only fixed a problem with the Guide option, and didn't fix the problem with the Table of Contents option - which I hadn't been using.

I've now investigated the Table of Contents problem further and I believe I may have found a solution, and would appreciate others checking to confirm this.

The problem with the Table of Contents option seems to stem from the way empty fields are processed. This is clearly different in IE9 and resulted in the crashes.

To fix this, I made the following modifications to the function "update_toc()" within the "Table of Contents.html" file. (located in c:\Program Files\Mobipocket.com\Mobipocket Creator\rsrc\html)

After the line (near the start of the function)
Code:
      var parameters = new Array();
add the following line
Code:
      var size = 0;
this declares a variable to be used for checking the size of the attribute and value fields.

Now add the following four lines
Code:
      size = attribute.length;
      if (size < 1) {attribute="";}
      size = value.length;
      if (size < 1) {value = "";}
immediately between the following two lines near the end of the function. It is ESSENTIAL that they appear before the "parameters[i]..." line - otherwise nothing is fixed and the crashes will continue.
Code:
     last_non_empty_level = i;
     parameters[i] = [ tag, attribute, value ];
The extra code ensures that if the attribute and/or value fields are empty then they are set to zero length strings, which are successfully processed at the end of the function.

In addition to the above changes, the changes I outlined in

http://www.mobileread.com/forums/sho...d.php?t=172371

also need to be applied.

The Table of Contents option should now work.

Only do this if you are comfortable with editing the html and javascript code in the html file, and make a backup copy of "Table of Contents.html" before attempting these changes, so that you can get back to your original set up.

Last edited by mike2046; 04-24-2012 at 07:21 PM. Reason: "value" missing after "attribute and/or"
mike2046 is offline   Reply With Quote