1 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
2 //>>description: Shows progressbar
4 //>>group: Tizen:Widgets
6 define( [ '../jquery.mobile.tizen.core' ], function ( ) {
7 //>>excludeEnd("jqmBuildExclude");
10 * jQuery UI Progressbar @VERSION
12 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
13 * Dual licensed under the MIT or GPL Version 2 licenses.
14 * http://jquery.org/license
16 * http://docs.jquery.com/UI/Progressbar
22 * jquery.ui.progressbar.js
24 /* This is from jquery ui plugin - progressbar 11/16/2011 */
29 The progress bar widget shows a control that indicates the progress percentage of an on-going operation. This widget can be scaled to fit inside a parent container.
31 To add a progress bar widget to the application, use the following code:
33 <div id="foo" data-role="progressbar"</div>
37 The progress bar can define a callback for the change event, which is fired when the progress value is changed:
38 <div id="foo" data-role="progressbar"></div>
39 $("#foo").bind("change", function (ev, val) {
40 Console.log("Value is changed to " + val);
45 You can use the value method with the pickers to set or get the current default progress bar value:
47 <div id="foo" data-role="progressbar"></div>
48 var oldVal = $("#foo").progressbar("value");
49 $("#foo").progressbar("value", 50);
52 (function ( $, window, undefined ) {
54 $.widget( "tizen.progressbar", $.mobile.widget, {
62 _create: function () {
64 .addClass( "ui-progressbar" )
67 "aria-valuemin": this.min,
68 "aria-valuemax": this.options.max,
69 "aria-valuenow": this._value()
72 this.valueDiv = $( "<div class='ui-progressbar-value'></div>" )
73 .appendTo( this.element );
75 this.valueDiv.wrap("<div class='ui-progressbar-bg'></div>");
77 this.oldValue = this._value();
81 _destroy: function () {
83 .removeClass( "ui-progressbar" )
85 .removeAttr( "aria-valuemin" )
86 .removeAttr( "aria-valuemax" )
87 .removeAttr( "aria-valuenow" );
89 this.valueDiv.remove();
92 value: function ( newValue ) {
93 if ( newValue === undefined ) {
97 this._setOption( "value", newValue );
101 _setOption: function ( key, value ) {
102 if ( key === "value" ) {
103 this.options.value = value;
104 this._refreshValue();
105 if ( this._value() === this.options.max ) {
106 this.element.trigger( "complete" );
109 // jquery.ui.widget.js MUST be updated to new version!
110 //this._super( "_setOption", key, value );
113 _value: function () {
114 var val = this.options.value;
115 // normalize invalid value
116 if ( typeof val !== "number" ) {
119 return Math.min( this.options.max, Math.max( this.min, val ) );
122 _percentage: function () {
123 return 100 * this._value() / this.options.max;
126 _refreshValue: function () {
127 var value = this.value(),
128 percentage = this._percentage();
130 if ( this.oldValue !== value ) {
131 this.oldValue = value;
132 this.element.trigger( "change" );
136 .toggle( value > this.min )
137 .width( percentage.toFixed(0) + "%" );
138 this.element.attr( "aria-valuenow", value );
142 // auto self-init widgets
143 $( document ).bind( "pagecreate", function ( e ) {
144 $( e.target ).find( ":jqmData(role='progressbar')" ).progressbar();
149 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
151 //>>excludeEnd("jqmBuildExclude");