github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 876
    • 199
  • Source
  • Commits
  • Network (199)
  • Graphs
  • Tree: f349f90

click here to add a description

click here to add a homepage

  • Switch Branches (8)
    • bind
    • devpreview
    • formcontrols
    • master
    • menu
    • panel
    • tooltip
    • widget-super
  • Switch Tags (21)
    • 1.9m2
    • 1.9m1
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8.4
    • 1.8.3
    • 1.8.2
    • 1.8.1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
  • Contributors
Sending Request…

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Progressbar: Conform to coding standards.
scottgonzalez (author)
Sat Feb 06 19:40:13 -0800 2010
commit  f349f9080baf812a33fa
tree    b34e36ad47e1b38ce78b
parent  573a402d05ace6c33131
M ui/jquery.ui.progressbar.js 84 ••••
Txt ui/jquery.ui.progressbar.js
  • View file @ f349f90
... ...
@@ -11,19 +11,15 @@
11 11
  *   jquery.ui.core.js
12 12
  *   jquery.ui.widget.js
13 13
  */
14  
-(function($) {
  14
+(function( $ ) {
15 15
 
16  
-$.widget("ui.progressbar", {
  16
+$.widget( "ui.progressbar", {
17 17
   options: {
18 18
     value: 0
19 19
   },
20 20
   _create: function() {
21  
-
22 21
     this.element
23  
-      .addClass("ui-progressbar"
24  
-        + " ui-widget"
25  
-        + " ui-widget-content"
26  
-        + " ui-corner-all")
  22
+      .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
27 23
       .attr({
28 24
         role: "progressbar",
29 25
         "aria-valuemin": this._valueMin(),
... ...
@@ -31,89 +27,81 @@ $.widget("ui.progressbar", {
31 27
         "aria-valuenow": this._value()
32 28
       });
33 29
 
34  
-    this.valueDiv = $('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);
  30
+    this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
  31
+      .appendTo( this.element );
35 32
 
36 33
     this._refreshValue();
37  
-
38 34
   },
39 35
 
40 36
   destroy: function() {
41  
-
42 37
     this.element
43  
-      .removeClass("ui-progressbar"
44  
-        + " ui-widget"
45  
-        + " ui-widget-content"
46  
-        + " ui-corner-all")
47  
-      .removeAttr("role")
48  
-      .removeAttr("aria-valuemin")
49  
-      .removeAttr("aria-valuemax")
50  
-      .removeAttr("aria-valuenow")
51  
-      .removeData("progressbar")
52  
-      .unbind(".progressbar");
  38
+      .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  39
+      .removeAttr( "role" )
  40
+      .removeAttr( "aria-valuemin" )
  41
+      .removeAttr( "aria-valuemax" )
  42
+      .removeAttr( "aria-valuenow" );
53 43
 
54 44
     this.valueDiv.remove();
55 45
 
56  
-    $.Widget.prototype.destroy.apply(this, arguments);
57  
-
58  
-    return this;
  46
+    $.Widget.prototype.destroy.apply( this, arguments );
59 47
   },
60 48
 
61  
-  value: function(newValue) {
62  
-    if (newValue === undefined) {
  49
+  value: function( newValue ) {
  50
+    if ( newValue === undefined ) {
63 51
       return this._value();
64 52
     }
65  
-    
66  
-    this._setOption('value', newValue);
  53
+
  54
+    this._setOption( "value", newValue );
67 55
     return this;
68 56
   },
69 57
 
70  
-  _setOption: function(key, value) {
71  
-
72  
-    switch (key) {
73  
-      case 'value':
  58
+  _setOption: function( key, value ) {
  59
+    switch ( key ) {
  60
+      case "value":
74 61
         this.options.value = value;
75 62
         this._refreshValue();
76  
-        this._trigger('change', null, {});
  63
+        this._trigger( "change" );
77 64
         break;
78 65
     }
79 66
 
80  
-    $.Widget.prototype._setOption.apply(this, arguments);
81  
-
  67
+    $.Widget.prototype._setOption.apply( this, arguments );
82 68
   },
83 69
 
84 70
   _value: function() {
85 71
     var val = this.options.value;
86 72
     // normalize invalid value
87  
-    if (typeof val != "number")
  73
+    if ( typeof val !== "number" ) {
88 74
       val = 0;
89  
-    if (val < this._valueMin()) val = this._valueMin();
90  
-    if (val > this._valueMax()) val = this._valueMax();
  75
+    }
  76
+    if ( val < this._valueMin() ) {
  77
+      val = this._valueMin();
  78
+    }
  79
+    if ( val > this._valueMax() ) {
  80
+      val = this._valueMax();
  81
+    }
91 82
 
92 83
     return val;
93  
-
94 84
   },
95 85
 
96 86
   _valueMin: function() {
97  
-    var valueMin = 0;
98  
-    return valueMin;
  87
+    return 0;
99 88
   },
100 89
 
101 90
   _valueMax: function() {
102  
-    var valueMax = 100;
103  
-    return valueMax;
  91
+    return 100;
104 92
   },
105 93
 
106 94
   _refreshValue: function() {
107 95
     var value = this.value();
108  
-    this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right");
109  
-    this.valueDiv.width(value + '%');
110  
-    this.element.attr("aria-valuenow", value);
  96
+    this.valueDiv
  97
+      [ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
  98
+      .width( value + "%" );
  99
+    this.element.attr( "aria-valuenow", value );
111 100
   }
112  
-
113 101
 });
114 102
 
115  
-$.extend($.ui.progressbar, {
  103
+$.extend( $.ui.progressbar, {
116 104
   version: "@VERSION"
117 105
 });
118 106
 
119  
-})(jQuery);
  107
+})( jQuery );

0 notes on commit f349f90

Please log in to comment.
Blog | Support | Training | Job Board | Contact | API | Status | Twitter | Help
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy | Security
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server
  • English
  • Català
  • Čeština
  • Deutsch
  • Español
  • Français
  • Hrvatski
  • Indonesia
  • Italiano
  • 日本語
  • Nederlands
  • Norsk
  • Polski
  • Português (BR)
  • Српски
  • Svenska
  • 中文