SHARE
TWEET

Untitled

a guest May 25th, 2012 358 Never
  1. function updateQuota() {
  2.   if (!quota_elem) {
  3.   return;
  4.   }
  5.   var now = (new Date()).getTime();
  6.   var i;
  7.   for (i = 0; i < CP.length; i++) {
  8.     if (now < CP[i][0]) {
  9.       break;
  10.     }
  11.   }
  12.   if (i == 0) {
  13.     setTimeout(updateQuota, 1000);
  14.   } else if (i == CP.length) {
  15.     quota_elem.innerHTML = CP[i - 1][1];
  16.   } else {
  17.     var ts = CP[i - 1][0];
  18.     var bs = CP[i - 1][1];
  19.     quota_elem.innerHTML = format(((now-ts) / (CP[i][0]-ts) * (CP[i][1]-bs)) + bs);
  20.     setTimeout(updateQuota, 1000);
  21.   }
  22. }
RAW Paste Data
Top