
mgnl-resources.media.js.upload.Fx.ProgressBar.js Maven / Gradle / Ivy
/*
*
* Magnolia SimpleMedia Module (http://www.openmindlab.com/lab/products/media.html)
* Copyright (C)2008 - 2010, Openmind S.r.l. http://www.openmindonline.it
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
Fx.ProgressBar = new Class({
Extends: Fx,
options: {
text: null,
transition: Fx.Transitions.Circ.easeOut,
link: 'cancel'
},
initialize: function(element, options) {
this.element = $(element);
this.parent(options);
this.text = $(this.options.text);
this.set(0);
},
start: function(to, total) {
return this.parent(this.now, (arguments.length == 1) ? to.limit(0, 100) : to / total * 100);
},
set: function(to) {
this.now = to;
this.element.setStyle('backgroundPosition', (100 - to) + '% 0px');
if (this.text) this.text.set('text', Math.round(to) + '%');
return this;
}
});
© 2015 - 2025 Weber Informatics LLC | Privacy Policy