2 * jQuery UI Progressbar @VERSION
4 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5 * Dual licensed under the MIT or GPL Version 2 licenses.
6 * http://jquery.org/license
8 * http://docs.jquery.com/UI/Progressbar
14 * jquery.ui.progressbar.js
16 /* This is from jquery ui plugin - progressbar 11/16/2011 */
18 (function ( $, window, undefined ) {
20 $.widget( "tizen.progressbar", $.mobile.widget, {
28 _create: function () {
30 .addClass( "ui-progressbar" )
33 "aria-valuemin": this.min,
34 "aria-valuemax": this.options.max,
35 "aria-valuenow": this._value()
38 this.valueDiv = $( "<div class='ui-progressbar-value'></div>" )
39 .appendTo( this.element );
41 this.oldValue = this._value();
45 _destroy: function () {
47 .removeClass( "ui-progressbar" )
49 .removeAttr( "aria-valuemin" )
50 .removeAttr( "aria-valuemax" )
51 .removeAttr( "aria-valuenow" );
53 this.valueDiv.remove();
56 value: function ( newValue ) {
57 if ( newValue === undefined ) {
61 this._setOption( "value", newValue );
65 _setOption: function ( key, value ) {
66 if ( key === "value" ) {
67 this.options.value = value;
69 if ( this._value() === this.options.max ) {
70 this._trigger( "complete" );
73 // jquery.ui.widget.js MUST be updated to new version!
74 //this._super( "_setOption", key, value );
78 var val = this.options.value;
79 // normalize invalid value
80 if ( typeof val !== "number" ) {
83 return Math.min( this.options.max, Math.max( this.min, val ) );
86 _percentage: function () {
87 return 100 * this._value() / this.options.max;
90 _refreshValue: function () {
91 var value = this.value(),
92 percentage = this._percentage();
94 if ( this.oldValue !== value ) {
95 this.oldValue = value;
96 this._trigger( "change" );
100 .toggle( value > this.min )
101 .width( percentage.toFixed(0) + "%" );
102 this.element.attr( "aria-valuenow", value );
106 // auto self-init widgets
107 $( document ).bind( "pagecreate", function ( e ) {
108 $( e.target ).find( ":jqmData(role='progressbar')" ).progressbar();