Talk:Google doubles Gmail storage, adds text formatting/Notes

Additional detailed code analysis on google's code's functionality.

The increase in storage is announced on the main Gmail page with a Javascript counter that increases the quoted available storage in relation to the current date. The array below, from the source of the page at Gmail.com, defines three Unix timestamps at which the description of the storage available will be updated.

var CP = [
 [ 1112331600000, 1025 ],
 [ 1112439600000, 2050 ],
 [ 1113062400000, 2075 ]
];

The timestamps correspond to April 1 at 5 AM GMT, April 2 at 11 AM GMT, and April 9 at 4 PM GMT.

function updateQuota() { 
  if (!quota) {
    return;
  }
 
  var now = (new Date()).getTime(); 
  var i;
  for (i = 0; i < CP.length; i++) {
    if (now < CP[i][0]) {
      break;
    }
  }
  if (i == 0) {
    setTimeout(updateQuota, 1000); 
  } else if (i == CP.length) {
    quota.innerHTML = 'Over ' + CP[i - 1][1];
  } else {
    var ts = CP[i - 1][0];
    var bs = CP[i - 1][1];
    quota.innerHTML = format(((now-ts) / (CP[i][0]-ts) * (CP[i][1]-bs)) + bs); 
    setTimeout(updateQuota, 50); 
  } 
}

Between April 2 and April 9, the updateQuota() function scales the advertised storage linearly between 2050 MB and 2075 MB. If the same code were running in the first window, between April 1 and April 2, the function would have scaled the advertised storage linearly between 1025 MB and 2050 MB, though it is not known whether this code, downloaded around 6 PM GMT on April 2, was in effect then.

If the code is not changed, the function above will return the phrase "Over 2075" after the April 9 deadline defined in the array above. This will be concatenated with text in the rest of the source to describe the available storage as over 2075 MB.

Start a discussion about Google doubles Gmail storage, adds text formatting/Notes

Start a discussion
Return to "Google doubles Gmail storage, adds text formatting/Notes" page.