Apache2-UploadProgress

 view release on metacpan or  search on metacpan

extra/progress.js  view on Meta::CPAN

function startEmbeddedProgressBar(form) {
    progress = {};
    progress.id         = generateProgressID();
    if (form.action.match(/\?/))
        form.action += '&progress_id=' + progress.id;
    else
        form.action += '?progress_id=' + progress.id;
    progress.starttime  = new Date();
    progress.lasttime   = new Date(progress.starttime);
    progress.lastamount = 0;
    window.setTimeout( reportUploadProgress, 100 );
    return true;
}

function updateHTMLProgressBar(progress) {
    if (progress.size > progress.received)
        window.setTimeout( function() { window.location.reload() }, 1000 );
    updateProgressBar( progress );
    return true;
}

function updateProgressBar(progress) {

    if (progress.received == progress.size)
        progress.finished = 1;

    // Only calculate rates and times is we were given a starttime

extra/progress.js  view on Meta::CPAN

        state.starttime       = progress.starttime;
        state.lasttime        = progress.lasttime;
        state.lastamount      = progress.lastamount;

        progress.lasttime     = new Date();
        progress.lastamount   = state.received;
        progress.size         = state.size;
        progress.received     = state.received;

        if ( progress.received != progress.size ) {
            window.setTimeout( reportUploadProgress, 1000 );
        }

        updateProgressBar(state);
    }
}

function formatTime(time) {
    var seconds = Math.round(time);
    var minutes = 0;
    if (time >= 60) {

extra/progress.js  view on Meta::CPAN

      if (this.onreadystatechange) {
        this.onreadystatechange();
      }
    };
    this.send = function(data) {
      if (!navigator.javaEnabled()) {
        alert("XMLHttpRequest.send() - Java must be installed and enabled.");
        return;
      }
      if (this._async) {
        setTimeout(this._sendasync, 0, this, data);
        // this is not really asynchronous and won't execute until the current
        // execution context ends
      } else {
        this._sendsync(data);
      }
    }
    this._sendasync = function(req, data) {
      if (!req._aborted) {
        req._sendsync(data);
      }



( run in 0.229 second using v1.01-cache-2.11-cpan-4d50c553e7e )