Keeping up appearances

I was brainstorming ideas for a post named “keeping up appearances” and found myself on statuspage.io. It’s a status page service that tracks system status and uptime and other important metrics for startups and big companies. It’s super popular.

I noticed that all statuspage.io pages reload themselves after being open for a bit, like this dropbox one: https://status.dropbox.com/.

Here’s the code that’s doing that:

SP.pollForChanges = function(t) {
    var e = this.pollURL;
    e(t).done(function() {
        setInterval(function() {
            e(t).done(function(t, e, i) {
                304 !== i.status && window.location.reload(!0)
            })
        }, 6e4)
    }).fail(function() {
        setTimeout(function() {
            SP.pollForChanges(t)
        }, 6e4)
    })
}

It’s checking if it needs to reload the page every 60000 ms by making a request to some json endpoint and checking the response status. For some reason the status code is always 200 in Firefox, so that’s probably a bug.

What’s more is that the location.reload() parameter doesn’t actually exist. It almost did, but it doesn’t. Firefox still supports it, obviously. It’s used to control hard reload, so I imagine there’s room for a perceived perf win there. Maybe one of you Mozilla engineers can take a look.

Anyway, while looking for that pollForChanges function I noticed a bunch of 'yes's and 'no's being logged to the console on dropbox’s status page.

Here’s the code that’s doing that:

$(function() {
  $(window).on('scroll', function() {
    if ($(window).scrollTop() > 250) {
      $('#logos-container').addClass('scrolled');
      console.log('yes');
    }
    else {
      $('#logos-container').removeClass('scrolled');
      console.log('no');
    }
  });
});

It’s toggling a class on the logo when the window scrolls below 250px. To add an animation when the user scrolls below the fold. For aesthetics.

But the developer forgot to remove their debug statements! I thought it was particularly wild that they used yes and no of all things.