v0.3 Release – Further Problems with Loading More Items, bug 459727

I put up a couple of patches today to fix problems with an earlier patch I had submitted for bug 459727. It seems that my fix for the problem of the initial results not loading enough entries to fill up the window does not work. Justin Wood pointed that out on the bug page, comment 15. He is right it seems.

I’ve been trying to figure out ways to make this work and the following is what I have come up with.

The Fix

var start;
function setup()
{
  if ('getElementsByClassName' in document) {
    var l = document.getElementById("localize");
    l.style.display = "";
    l.onclick = localizeDates;
 
    start = 0;
    getMaxEntries();
 
    var docHeight = document.body.clientHeight;
    while(docHeight <= window.innerHeight) {
      if(start > 0) {
        renderMorePushLogResults();
        docHeight += 500;
      }
    }
  }
}

The setup() function is called once the inital entries have loaded. Then we measure the document height and set it to the variable, docHeight. A while loop is run until docHeight is greater than the window height. Each time you enter the while loop a new set of entries are loaded and the docHeight’s value is increased by 500 pixels (the approximate height of the new entries). This should load new entries according to the size of every users individual window height.

The Problem

Now, with this new code I am getting the following script error when I load the page:


 
I think this may be because of the while loop. Firefox maybe waiting for the while loop to finish before it does anything else and then this error occurs. I’m not exactly sure, this is just a poke in the dark.

It is important to note that if you click continue it works and more entries are loaded properly to fill the rest of the page.

This new code for the pushlog.tmpl can be found here

I don’t know if this is a major problem or not but I can’t see a way around this for now.

This entry was posted in Mercurial Project, Open Source and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>