v0.7 Release – The Scroll Bar Solution

As a part of one of my goals for this release I want to find a solution to the pesky scroll bar problem. I explained the problem and my futile attempts to find a solution in my previous blog post.

So, as I mentioned earlier Dave Humphrey had shown me a different way of looking at the problem. Basically, I want to load more entries until the scroll bar appears. Now, my problem is that I don’t know how you would do this in JavaScript. I asked around and did some research to find a solution. The following is what I came up with:

function fillPage() {
  start = ($("div").attr("id")) - 10;
  var vHeight = 0;
  if (document.documentElement) {
    vHeight = document.documentElement.clientHeight;
  } else {
    vHeight = document.body.clientHeight
  if (document.body.offsetHeight < vHeight) {
    //calculate how many times to run loadEntries
    for(var count = 0, offSetHeight = document.body.offsetHeight;
        offSetHeight < vHeight;
        count++, offSetHeight += 180);
    if(count > 0)

I get the height of the body and then compare it to the offsetHeight. Basically, I keep on loading more entries until the body height and the body offsetHeight are equal. On larger screens the difference between these two properties will be bigger than on smaller screens.

To do this I increment count by 1 and offSetHeight by 180 each time through the loop. Why 180 you ask? Each time loadEntries(1) is called it loads 20 entries which is at least a height of 180px. Once offSetHeight equals vHeight I pass the value of count to loadEntries() and then according to the value of count more entries are loaded. When count is equal to one 20 entries are loaded, when its value is two then 40 entries are loaded and so on.

This solution completely fixes my problem. I’ve tested it on larger screens in the CDOT area and on my 15inch laptop.  The solution works flawlessly. I’m so glad to finally find a fix for this pesky issue. Unfortunately screenshots won’t be able to prove that this functionality works. I would have to take a video of it in action. For now you’ll have to take my word for it or download the patch (when I upload it) and see for yourself.

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

4 Responses to v0.7 Release – The Scroll Bar Solution

  1. Sid,

    Congrats on 0.7. Good stuff. I’m wondering if the person has their font sizes set to a different default size will it affect the height of 180px? Or is the 180px constant regardless?

  2. Sid says:


    Thanks for the comment. This is an interesting question. I hadn’t considered this. I just ran a little test to see what happens. I changed my default font size to 22. I checked Google to see that the font size increased and then reloaded the pushlog to see what happens. The font size for the pushlog remained the same, which means the default font size is being ignored in this case. Thus, I don’t have to worry about this issue.

    Great question though, I really appreciate the input.

  3. What happens if you go to View->Zoom->Zoom Text Only, then increase the font by doing Ctrl ++ ?

  4. Sid says:

    Tried what you suggested, it still works :)

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>