Sha256: cf821f15ba93592c5815a9a454ade56285cc84583955d47b43d84984929ce3a5

Contents?: true

Size: 916 Bytes

Versions: 4

Compression:

Stored size: 916 Bytes

Contents

/*!
 * jQuery timed progress bar v.0.1
 *
 * Copyright (c) 2009 Erik Kastner
 *
 * Usage:
 *  // show a progress bar for 30 seconds
 *  $('#bar_dif').timed_bar(30);
 *
 */
;(function($) {
  $.fn.timed_bar = function(total_time) {
    return this.each(function() {
      var $this = $(this);
      var started = new Date();

      var div = $('<div>').addClass('bar').css({"height": "100%", "width": "0%" });
      var span = $('<span>').addClass('deploying').text('Deploying');
      $this.append(span, div);

      interval = setInterval(function() {
        diff = ((new Date()) - started) / 1000;
        if (diff >= total_time) {
          div.css("width", "100%");
          clearInterval(interval);
        }
        else {
          percent = diff / total_time * 100;
          if (percent >= 99) { percent = 99; }
          div.css("width", percent + "%");
        }
      }, 350);
    });
  };
})(jQuery);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
etsy-deployinator-1.1.1 lib/deployinator/static/js/jquery.timed_bar.js
etsy-deployinator-1.1.0 lib/deployinator/static/js/jquery.timed_bar.js
etsy-deployinator-1.0.2 lib/deployinator/static/js/jquery.timed_bar.js
etsy-deployinator-1.0.1 lib/deployinator/static/js/jquery.timed_bar.js