Mercurial > judyates
view e2gallerypro/e2upload/Source/Uploader/Fx.ProgressBar.js @ 12:2f433df9b961 judyates
[svn r13] Modified esgallery source to enable multiple paypal buttons; got the photo gallery operational and tested.
author | rlm |
---|---|
date | Mon, 12 Apr 2010 03:24:08 -0400 |
parents | 3f6b44aa6b35 |
children |
line wrap: on
line source
1 /**2 * Fx.ProgressBar3 *4 * @version 1.15 *6 * @license MIT License7 *8 * @author Harald Kirschner <mail [at] digitarald [dot] de>9 * @copyright Authors10 */12 Fx.ProgressBar = new Class({14 Extends: Fx,16 options: {17 text: null,18 url: null,19 transition: Fx.Transitions.Circ.easeOut,20 fit: true,21 link: 'cancel'22 },24 initialize: function(element, options) {25 this.element = $(element);26 this.parent(options);28 var url = this.options.url;29 if (url) {30 this.element.setStyles({31 'background-image': 'url(' + url + ')',32 'background-repeat': 'no-repeat'33 });34 }36 if (this.options.fit) {37 url = url || this.element.getStyle('background-image').replace(/^url\(["']?|["']?\)$/g, '');38 if (url) {39 var fill = new Image();40 fill.onload = function() {41 this.fill = fill.width;42 fill = fill.onload = null;43 this.set(this.now || 0);44 }.bind(this);45 fill.src = url;46 if (!this.fill && fill.width) fill.onload();47 }48 } else {49 this.set(0);50 }51 },53 start: function(to, total) {54 return this.parent(this.now, (arguments.length == 1) ? to.limit(0, 100) : to / total * 100);55 },57 set: function(to) {58 this.now = to;59 var css = (this.fill)60 ? (((this.fill / -2) + (to / 100) * (this.element.width || 1) || 0).round() + 'px')61 : ((100 - to) + '%');63 this.element.setStyle('backgroundPosition', css + ' 0px').title = Math.round(to) + '%';65 var text = $(this.options.text);66 if (text) text.set('text', Math.round(to) + '%');68 return this;69 }71 });