This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 25th, 2012  |  syntax: JavaScript  |  size: 0.51 KB  |  views: 290  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data