upload tizen1.0 source
[framework/web/web-ui-fw.git] / src / widgets / progressbar / js / jquery.mobile.tizen.progressbar.js
old mode 100644 (file)
new mode 100755 (executable)
index 982f595..7ceba83
@@ -1,4 +1,3 @@
-/* TBD */
 /*
  * jQuery UI Progressbar @VERSION
  *
  */
 /* This is from jquery ui plugin - progressbar 11/16/2011 */
 
-(function( $, window, undefined ) {
-
-$.widget( "tizen.progressbar", $.mobile.widget, {
-       options: {
-               value: 0,
-               max: 100
-       },
-
-       min: 0,
-
-       _create: function() {
-               this.element
-                       .addClass( "ui-progressbar" )
-                       .attr({
-                               role: "progressbar",
-                               "aria-valuemin": this.min,
-                               "aria-valuemax": this.options.max,
-                               "aria-valuenow": this._value()
-                       });
-
-               this.valueDiv = $( "<div class='ui-progressbar-value'></div>" )
-                       .appendTo( this.element );
-
-               this.oldValue = this._value();
-               this._refreshValue();
-       },
-
-       _destroy: function() {
-               this.element
-                       .removeClass( "ui-progressbar" )
-                       .removeAttr( "role" )
-                       .removeAttr( "aria-valuemin" )
-                       .removeAttr( "aria-valuemax" )
-                       .removeAttr( "aria-valuenow" );
-
-               this.valueDiv.remove();
-       },
-
-       value: function( newValue ) {
-               if ( newValue === undefined ) {
-                       return this._value();
-               }
+(function ( $, window, undefined ) {
+
+       $.widget( "tizen.progressbar", $.mobile.widget, {
+               options: {
+                       value: 0,
+                       max: 100
+               },
+
+               min: 0,
 
-               this._setOption( "value", newValue );
-               return this;
-       },
+               _create: function () {
+                       this.element
+                               .addClass( "ui-progressbar" )
+                               .attr( {
+                                       role: "progressbar",
+                                       "aria-valuemin": this.min,
+                                       "aria-valuemax": this.options.max,
+                                       "aria-valuenow": this._value()
+                               } );
 
-       _setOption: function( key, value ) {
-               if ( key === "value" ) {
-                       this.options.value = value;
+                       this.valueDiv = $( "<div class='ui-progressbar-value'></div>" )
+                               .appendTo( this.element );
+
+                       this.oldValue = this._value();
                        this._refreshValue();
-                       if ( this._value() === this.options.max ) {
-                               this._trigger( "complete" );
+               },
+
+               _destroy: function () {
+                       this.element
+                               .removeClass( "ui-progressbar" )
+                               .removeAttr( "role" )
+                               .removeAttr( "aria-valuemin" )
+                               .removeAttr( "aria-valuemax" )
+                               .removeAttr( "aria-valuenow" );
+
+                       this.valueDiv.remove();
+               },
+
+               value: function ( newValue ) {
+                       if ( newValue === undefined ) {
+                               return this._value();
                        }
-               }
-               // jquery.ui.widget.js MUST be updated to new version!
-               //this._super( "_setOption", key, value );
-       },
-
-       _value: function() {
-               var val = this.options.value;
-               // normalize invalid value
-               if ( typeof val !== "number" ) {
-                       val = 0;
-               }
-               return Math.min( this.options.max, Math.max( this.min, val ) );
-       },
 
-       _percentage: function() {
-               return 100 * this._value() / this.options.max;
-       },
+                       this._setOption( "value", newValue );
+                       return this;
+               },
+
+               _setOption: function ( key, value ) {
+                       if ( key === "value" ) {
+                               this.options.value = value;
+                               this._refreshValue();
+                               if ( this._value() === this.options.max ) {
+                                       this._trigger( "complete" );
+                               }
+                       }
+                       // jquery.ui.widget.js MUST be updated to new version!
+                       //this._super( "_setOption", key, value );
+               },
+
+               _value: function () {
+                       var val = this.options.value;
+                       // normalize invalid value
+                       if ( typeof val !== "number" ) {
+                               val = 0;
+                       }
+                       return Math.min( this.options.max, Math.max( this.min, val ) );
+               },
 
-       _refreshValue: function() {
-               var value = this.value();
-               var percentage = this._percentage();
+               _percentage: function () {
+                       return 100 * this._value() / this.options.max;
+               },
 
-               if ( this.oldValue !== value ) {
-                       this.oldValue = value;
-                       this._trigger( "change" );
-               }
+               _refreshValue: function () {
+                       var value = this.value(),
+                               percentage = this._percentage();
 
-               this.valueDiv
-                       .toggle( value > this.min )
-                       .width( percentage.toFixed(0) + "%" );
-               this.element.attr( "aria-valuenow", value );
-       }
-});
+                       if ( this.oldValue !== value ) {
+                               this.oldValue = value;
+                               this._trigger( "change" );
+                       }
+
+                       this.valueDiv
+                               .toggle( value > this.min )
+                               .width( percentage.toFixed(0) + "%" );
+                       this.element.attr( "aria-valuenow", value );
+               }
+       } );
 
-// auto self-init widgets
-$(document).bind("pagecreate", function (e) {
-       $(e.target).find(":jqmData(role='progressbar')").progressbar();
-});
+       // auto self-init widgets
+       $( document ).bind( "pagecreate", function ( e ) {
+               $( e.target ).find( ":jqmData(role='progressbar')" ).progressbar();
+       } );
 
-})( jQuery, this );
+}( jQuery, this ) );