1 /* ***************************************************************************
2 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software" ),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 * ***************************************************************************
24 (function ( $, window, undefined) {
25 $.widget( "tizen.progress", $.mobile.widget, {
33 $( this.element ).append( this.html );
36 var style = this.options.style;
37 $( this.element ).addClass( "ui-progress-container-" + style + "-bg" );
39 .find( ".ui-progress-" + style )
40 .addClass( this.runningClass );
45 .find( ".ui-progress-" + this.options.style )
46 .removeClass( this.runningClass );
49 running: function ( newRunning ) {
51 if ( newRunning === undefined ) {
52 return this.options.running;
56 this._setOption( "running", newRunning );
60 _setOption: function ( key, value ) {
61 if ( key === "running" ) {
62 // normalize invalid value
63 if ( typeof value !== "boolean" ) {
64 window.alert( "running value MUST be boolean type!" );
67 this.options.running = value;
72 _refresh: function () {
73 if ( this.options.running ) {
80 _create: function () {
82 element = this.element,
83 style = element.jqmData( "style" ),
87 this.options.style = style;
90 this.html = $( '<div class="ui-progress-container-' + style + '">' +
91 '<div class="ui-progress-' + style + '"></div>' +
94 runningClass = "ui-progress-" + style + "-running";
98 runningClass: runningClass
102 } ); /* End of widget */
104 // auto self-init widgets
105 $( document ).bind( "pagecreate", function ( e ) {
106 $( e.target ).find( ":jqmData(role='progress')" ).progress();