jquery-ui-rails 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jquery-ui-rails might be problematic. Click here for more details.

Files changed (137) hide show
  1. data/.gitignore +0 -1
  2. data/History.md +6 -0
  3. data/README.md +1 -0
  4. data/Rakefile +13 -2
  5. data/lib/jquery/ui/rails/version.rb +1 -1
  6. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  7. data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  8. data/vendor/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  9. data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  10. data/vendor/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
  11. data/vendor/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  12. data/vendor/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  13. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  14. data/vendor/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
  15. data/vendor/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
  16. data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  17. data/vendor/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
  18. data/vendor/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
  19. data/vendor/assets/javascripts/jquery.effects.all.js +14 -0
  20. data/vendor/assets/javascripts/jquery.effects.blind.js +51 -0
  21. data/vendor/assets/javascripts/jquery.effects.bounce.js +80 -0
  22. data/vendor/assets/javascripts/jquery.effects.clip.js +56 -0
  23. data/vendor/assets/javascripts/jquery.effects.core.js +763 -0
  24. data/vendor/assets/javascripts/jquery.effects.drop.js +52 -0
  25. data/vendor/assets/javascripts/jquery.effects.explode.js +81 -0
  26. data/vendor/assets/javascripts/jquery.effects.fade.js +34 -0
  27. data/vendor/assets/javascripts/jquery.effects.fold.js +58 -0
  28. data/vendor/assets/javascripts/jquery.effects.highlight.js +52 -0
  29. data/vendor/assets/javascripts/jquery.effects.pulsate.js +53 -0
  30. data/vendor/assets/javascripts/jquery.effects.scale.js +180 -0
  31. data/vendor/assets/javascripts/jquery.effects.shake.js +59 -0
  32. data/vendor/assets/javascripts/jquery.effects.slide.js +52 -0
  33. data/vendor/assets/javascripts/jquery.effects.transfer.js +47 -0
  34. data/vendor/assets/javascripts/jquery.ui.accordion.js +614 -0
  35. data/vendor/assets/javascripts/jquery.ui.all.js +31 -0
  36. data/vendor/assets/javascripts/jquery.ui.autocomplete.js +635 -0
  37. data/vendor/assets/javascripts/jquery.ui.button.js +417 -0
  38. data/vendor/assets/javascripts/jquery.ui.core.js +321 -0
  39. data/vendor/assets/javascripts/jquery.ui.datepicker-af.js +25 -0
  40. data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +25 -0
  41. data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +25 -0
  42. data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +25 -0
  43. data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +26 -0
  44. data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +25 -0
  45. data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +25 -0
  46. data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +25 -0
  47. data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +25 -0
  48. data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +25 -0
  49. data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +25 -0
  50. data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +25 -0
  51. data/vendor/assets/javascripts/jquery.ui.datepicker-en-AU.js +25 -0
  52. data/vendor/assets/javascripts/jquery.ui.datepicker-en-GB.js +25 -0
  53. data/vendor/assets/javascripts/jquery.ui.datepicker-en-NZ.js +25 -0
  54. data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +25 -0
  55. data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +25 -0
  56. data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +25 -0
  57. data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +25 -0
  58. data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +61 -0
  59. data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +25 -0
  60. data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +25 -0
  61. data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +25 -0
  62. data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +27 -0
  63. data/vendor/assets/javascripts/jquery.ui.datepicker-ge.js +23 -0
  64. data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +25 -0
  65. data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +25 -0
  66. data/vendor/assets/javascripts/jquery.ui.datepicker-hi.js +25 -0
  67. data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +25 -0
  68. data/vendor/assets/javascripts/jquery.ui.datepicker-hu.js +25 -0
  69. data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +25 -0
  70. data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +25 -0
  71. data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +25 -0
  72. data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +25 -0
  73. data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +25 -0
  74. data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +25 -0
  75. data/vendor/assets/javascripts/jquery.ui.datepicker-km.js +25 -0
  76. data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +25 -0
  77. data/vendor/assets/javascripts/jquery.ui.datepicker-lb.js +25 -0
  78. data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +25 -0
  79. data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +25 -0
  80. data/vendor/assets/javascripts/jquery.ui.datepicker-mk.js +25 -0
  81. data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +25 -0
  82. data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +25 -0
  83. data/vendor/assets/javascripts/jquery.ui.datepicker-nl-BE.js +25 -0
  84. data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +25 -0
  85. data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +25 -0
  86. data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +25 -0
  87. data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +25 -0
  88. data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +24 -0
  89. data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +23 -0
  90. data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +28 -0
  91. data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +25 -0
  92. data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +25 -0
  93. data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +26 -0
  94. data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +25 -0
  95. data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +25 -0
  96. data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +25 -0
  97. data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +25 -0
  98. data/vendor/assets/javascripts/jquery.ui.datepicker-ta.js +25 -0
  99. data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +25 -0
  100. data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +25 -0
  101. data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +25 -0
  102. data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +26 -0
  103. data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +25 -0
  104. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +25 -0
  105. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +25 -0
  106. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +25 -0
  107. data/vendor/assets/javascripts/jquery.ui.datepicker.js +1826 -0
  108. data/vendor/assets/javascripts/jquery.ui.dialog.js +882 -0
  109. data/vendor/assets/javascripts/jquery.ui.draggable.js +835 -0
  110. data/vendor/assets/javascripts/jquery.ui.droppable.js +301 -0
  111. data/vendor/assets/javascripts/jquery.ui.mouse.js +168 -0
  112. data/vendor/assets/javascripts/jquery.ui.position.js +298 -0
  113. data/vendor/assets/javascripts/jquery.ui.progressbar.js +112 -0
  114. data/vendor/assets/javascripts/jquery.ui.resizable.js +811 -0
  115. data/vendor/assets/javascripts/jquery.ui.selectable.js +271 -0
  116. data/vendor/assets/javascripts/jquery.ui.slider.js +666 -0
  117. data/vendor/assets/javascripts/jquery.ui.sortable.js +1085 -0
  118. data/vendor/assets/javascripts/jquery.ui.tabs.js +760 -0
  119. data/vendor/assets/javascripts/jquery.ui.widget.js +272 -0
  120. data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +23 -0
  121. data/vendor/assets/stylesheets/jquery.ui.all.css.erb +13 -0
  122. data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +57 -0
  123. data/vendor/assets/stylesheets/jquery.ui.base.css.erb +23 -0
  124. data/vendor/assets/stylesheets/jquery.ui.button.css.erb +42 -0
  125. data/vendor/assets/stylesheets/jquery.ui.core.css.erb +38 -0
  126. data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +72 -0
  127. data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +25 -0
  128. data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +15 -0
  129. data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +24 -0
  130. data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +14 -0
  131. data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +28 -0
  132. data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +22 -0
  133. data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +250 -0
  134. metadata +111 -113
  135. data/jquery-ui/GPL-LICENSE.txt +0 -278
  136. data/jquery-ui/MIT-LICENSE.txt +0 -25
  137. data/jquery-ui/package.json +0 -36
@@ -0,0 +1,271 @@
1
+ //= require jquery.ui.core
2
+ //= require jquery.ui.widget
3
+ //= require jquery.ui.mouse
4
+
5
+ /*!
6
+ * jQuery UI Selectable 1.8.20
7
+ *
8
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
9
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10
+ * http://jquery.org/license
11
+ *
12
+ * http://docs.jquery.com/UI/Selectables
13
+ *
14
+ * Depends:
15
+ * jquery.ui.core.js
16
+ * jquery.ui.mouse.js
17
+ * jquery.ui.widget.js
18
+ */
19
+ (function( $, undefined ) {
20
+
21
+ $.widget("ui.selectable", $.ui.mouse, {
22
+ options: {
23
+ appendTo: 'body',
24
+ autoRefresh: true,
25
+ distance: 0,
26
+ filter: '*',
27
+ tolerance: 'touch'
28
+ },
29
+ _create: function() {
30
+ var self = this;
31
+
32
+ this.element.addClass("ui-selectable");
33
+
34
+ this.dragged = false;
35
+
36
+ // cache selectee children based on filter
37
+ var selectees;
38
+ this.refresh = function() {
39
+ selectees = $(self.options.filter, self.element[0]);
40
+ selectees.addClass("ui-selectee");
41
+ selectees.each(function() {
42
+ var $this = $(this);
43
+ var pos = $this.offset();
44
+ $.data(this, "selectable-item", {
45
+ element: this,
46
+ $element: $this,
47
+ left: pos.left,
48
+ top: pos.top,
49
+ right: pos.left + $this.outerWidth(),
50
+ bottom: pos.top + $this.outerHeight(),
51
+ startselected: false,
52
+ selected: $this.hasClass('ui-selected'),
53
+ selecting: $this.hasClass('ui-selecting'),
54
+ unselecting: $this.hasClass('ui-unselecting')
55
+ });
56
+ });
57
+ };
58
+ this.refresh();
59
+
60
+ this.selectees = selectees.addClass("ui-selectee");
61
+
62
+ this._mouseInit();
63
+
64
+ this.helper = $("<div class='ui-selectable-helper'></div>");
65
+ },
66
+
67
+ destroy: function() {
68
+ this.selectees
69
+ .removeClass("ui-selectee")
70
+ .removeData("selectable-item");
71
+ this.element
72
+ .removeClass("ui-selectable ui-selectable-disabled")
73
+ .removeData("selectable")
74
+ .unbind(".selectable");
75
+ this._mouseDestroy();
76
+
77
+ return this;
78
+ },
79
+
80
+ _mouseStart: function(event) {
81
+ var self = this;
82
+
83
+ this.opos = [event.pageX, event.pageY];
84
+
85
+ if (this.options.disabled)
86
+ return;
87
+
88
+ var options = this.options;
89
+
90
+ this.selectees = $(options.filter, this.element[0]);
91
+
92
+ this._trigger("start", event);
93
+
94
+ $(options.appendTo).append(this.helper);
95
+ // position helper (lasso)
96
+ this.helper.css({
97
+ "left": event.clientX,
98
+ "top": event.clientY,
99
+ "width": 0,
100
+ "height": 0
101
+ });
102
+
103
+ if (options.autoRefresh) {
104
+ this.refresh();
105
+ }
106
+
107
+ this.selectees.filter('.ui-selected').each(function() {
108
+ var selectee = $.data(this, "selectable-item");
109
+ selectee.startselected = true;
110
+ if (!event.metaKey && !event.ctrlKey) {
111
+ selectee.$element.removeClass('ui-selected');
112
+ selectee.selected = false;
113
+ selectee.$element.addClass('ui-unselecting');
114
+ selectee.unselecting = true;
115
+ // selectable UNSELECTING callback
116
+ self._trigger("unselecting", event, {
117
+ unselecting: selectee.element
118
+ });
119
+ }
120
+ });
121
+
122
+ $(event.target).parents().andSelf().each(function() {
123
+ var selectee = $.data(this, "selectable-item");
124
+ if (selectee) {
125
+ var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
126
+ selectee.$element
127
+ .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
128
+ .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
129
+ selectee.unselecting = !doSelect;
130
+ selectee.selecting = doSelect;
131
+ selectee.selected = doSelect;
132
+ // selectable (UN)SELECTING callback
133
+ if (doSelect) {
134
+ self._trigger("selecting", event, {
135
+ selecting: selectee.element
136
+ });
137
+ } else {
138
+ self._trigger("unselecting", event, {
139
+ unselecting: selectee.element
140
+ });
141
+ }
142
+ return false;
143
+ }
144
+ });
145
+
146
+ },
147
+
148
+ _mouseDrag: function(event) {
149
+ var self = this;
150
+ this.dragged = true;
151
+
152
+ if (this.options.disabled)
153
+ return;
154
+
155
+ var options = this.options;
156
+
157
+ var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
158
+ if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
159
+ if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
160
+ this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
161
+
162
+ this.selectees.each(function() {
163
+ var selectee = $.data(this, "selectable-item");
164
+ //prevent helper from being selected if appendTo: selectable
165
+ if (!selectee || selectee.element == self.element[0])
166
+ return;
167
+ var hit = false;
168
+ if (options.tolerance == 'touch') {
169
+ hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
170
+ } else if (options.tolerance == 'fit') {
171
+ hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
172
+ }
173
+
174
+ if (hit) {
175
+ // SELECT
176
+ if (selectee.selected) {
177
+ selectee.$element.removeClass('ui-selected');
178
+ selectee.selected = false;
179
+ }
180
+ if (selectee.unselecting) {
181
+ selectee.$element.removeClass('ui-unselecting');
182
+ selectee.unselecting = false;
183
+ }
184
+ if (!selectee.selecting) {
185
+ selectee.$element.addClass('ui-selecting');
186
+ selectee.selecting = true;
187
+ // selectable SELECTING callback
188
+ self._trigger("selecting", event, {
189
+ selecting: selectee.element
190
+ });
191
+ }
192
+ } else {
193
+ // UNSELECT
194
+ if (selectee.selecting) {
195
+ if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
196
+ selectee.$element.removeClass('ui-selecting');
197
+ selectee.selecting = false;
198
+ selectee.$element.addClass('ui-selected');
199
+ selectee.selected = true;
200
+ } else {
201
+ selectee.$element.removeClass('ui-selecting');
202
+ selectee.selecting = false;
203
+ if (selectee.startselected) {
204
+ selectee.$element.addClass('ui-unselecting');
205
+ selectee.unselecting = true;
206
+ }
207
+ // selectable UNSELECTING callback
208
+ self._trigger("unselecting", event, {
209
+ unselecting: selectee.element
210
+ });
211
+ }
212
+ }
213
+ if (selectee.selected) {
214
+ if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
215
+ selectee.$element.removeClass('ui-selected');
216
+ selectee.selected = false;
217
+
218
+ selectee.$element.addClass('ui-unselecting');
219
+ selectee.unselecting = true;
220
+ // selectable UNSELECTING callback
221
+ self._trigger("unselecting", event, {
222
+ unselecting: selectee.element
223
+ });
224
+ }
225
+ }
226
+ }
227
+ });
228
+
229
+ return false;
230
+ },
231
+
232
+ _mouseStop: function(event) {
233
+ var self = this;
234
+
235
+ this.dragged = false;
236
+
237
+ var options = this.options;
238
+
239
+ $('.ui-unselecting', this.element[0]).each(function() {
240
+ var selectee = $.data(this, "selectable-item");
241
+ selectee.$element.removeClass('ui-unselecting');
242
+ selectee.unselecting = false;
243
+ selectee.startselected = false;
244
+ self._trigger("unselected", event, {
245
+ unselected: selectee.element
246
+ });
247
+ });
248
+ $('.ui-selecting', this.element[0]).each(function() {
249
+ var selectee = $.data(this, "selectable-item");
250
+ selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
251
+ selectee.selecting = false;
252
+ selectee.selected = true;
253
+ selectee.startselected = true;
254
+ self._trigger("selected", event, {
255
+ selected: selectee.element
256
+ });
257
+ });
258
+ this._trigger("stop", event);
259
+
260
+ this.helper.remove();
261
+
262
+ return false;
263
+ }
264
+
265
+ });
266
+
267
+ $.extend($.ui.selectable, {
268
+ version: "1.8.20"
269
+ });
270
+
271
+ })(jQuery);
@@ -0,0 +1,666 @@
1
+ //= require jquery.ui.core
2
+ //= require jquery.ui.widget
3
+ //= require jquery.ui.mouse
4
+
5
+ /*!
6
+ * jQuery UI Slider 1.8.20
7
+ *
8
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
9
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10
+ * http://jquery.org/license
11
+ *
12
+ * http://docs.jquery.com/UI/Slider
13
+ *
14
+ * Depends:
15
+ * jquery.ui.core.js
16
+ * jquery.ui.mouse.js
17
+ * jquery.ui.widget.js
18
+ */
19
+ (function( $, undefined ) {
20
+
21
+ // number of pages in a slider
22
+ // (how many times can you page up/down to go through the whole range)
23
+ var numPages = 5;
24
+
25
+ $.widget( "ui.slider", $.ui.mouse, {
26
+
27
+ widgetEventPrefix: "slide",
28
+
29
+ options: {
30
+ animate: false,
31
+ distance: 0,
32
+ max: 100,
33
+ min: 0,
34
+ orientation: "horizontal",
35
+ range: false,
36
+ step: 1,
37
+ value: 0,
38
+ values: null
39
+ },
40
+
41
+ _create: function() {
42
+ var self = this,
43
+ o = this.options,
44
+ existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
45
+ handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
46
+ handleCount = ( o.values && o.values.length ) || 1,
47
+ handles = [];
48
+
49
+ this._keySliding = false;
50
+ this._mouseSliding = false;
51
+ this._animateOff = true;
52
+ this._handleIndex = null;
53
+ this._detectOrientation();
54
+ this._mouseInit();
55
+
56
+ this.element
57
+ .addClass( "ui-slider" +
58
+ " ui-slider-" + this.orientation +
59
+ " ui-widget" +
60
+ " ui-widget-content" +
61
+ " ui-corner-all" +
62
+ ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
63
+
64
+ this.range = $([]);
65
+
66
+ if ( o.range ) {
67
+ if ( o.range === true ) {
68
+ if ( !o.values ) {
69
+ o.values = [ this._valueMin(), this._valueMin() ];
70
+ }
71
+ if ( o.values.length && o.values.length !== 2 ) {
72
+ o.values = [ o.values[0], o.values[0] ];
73
+ }
74
+ }
75
+
76
+ this.range = $( "<div></div>" )
77
+ .appendTo( this.element )
78
+ .addClass( "ui-slider-range" +
79
+ // note: this isn't the most fittingly semantic framework class for this element,
80
+ // but worked best visually with a variety of themes
81
+ " ui-widget-header" +
82
+ ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
83
+ }
84
+
85
+ for ( var i = existingHandles.length; i < handleCount; i += 1 ) {
86
+ handles.push( handle );
87
+ }
88
+
89
+ this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) );
90
+
91
+ this.handle = this.handles.eq( 0 );
92
+
93
+ this.handles.add( this.range ).filter( "a" )
94
+ .click(function( event ) {
95
+ event.preventDefault();
96
+ })
97
+ .hover(function() {
98
+ if ( !o.disabled ) {
99
+ $( this ).addClass( "ui-state-hover" );
100
+ }
101
+ }, function() {
102
+ $( this ).removeClass( "ui-state-hover" );
103
+ })
104
+ .focus(function() {
105
+ if ( !o.disabled ) {
106
+ $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
107
+ $( this ).addClass( "ui-state-focus" );
108
+ } else {
109
+ $( this ).blur();
110
+ }
111
+ })
112
+ .blur(function() {
113
+ $( this ).removeClass( "ui-state-focus" );
114
+ });
115
+
116
+ this.handles.each(function( i ) {
117
+ $( this ).data( "index.ui-slider-handle", i );
118
+ });
119
+
120
+ this.handles
121
+ .keydown(function( event ) {
122
+ var index = $( this ).data( "index.ui-slider-handle" ),
123
+ allowed,
124
+ curVal,
125
+ newVal,
126
+ step;
127
+
128
+ if ( self.options.disabled ) {
129
+ return;
130
+ }
131
+
132
+ switch ( event.keyCode ) {
133
+ case $.ui.keyCode.HOME:
134
+ case $.ui.keyCode.END:
135
+ case $.ui.keyCode.PAGE_UP:
136
+ case $.ui.keyCode.PAGE_DOWN:
137
+ case $.ui.keyCode.UP:
138
+ case $.ui.keyCode.RIGHT:
139
+ case $.ui.keyCode.DOWN:
140
+ case $.ui.keyCode.LEFT:
141
+ event.preventDefault();
142
+ if ( !self._keySliding ) {
143
+ self._keySliding = true;
144
+ $( this ).addClass( "ui-state-active" );
145
+ allowed = self._start( event, index );
146
+ if ( allowed === false ) {
147
+ return;
148
+ }
149
+ }
150
+ break;
151
+ }
152
+
153
+ step = self.options.step;
154
+ if ( self.options.values && self.options.values.length ) {
155
+ curVal = newVal = self.values( index );
156
+ } else {
157
+ curVal = newVal = self.value();
158
+ }
159
+
160
+ switch ( event.keyCode ) {
161
+ case $.ui.keyCode.HOME:
162
+ newVal = self._valueMin();
163
+ break;
164
+ case $.ui.keyCode.END:
165
+ newVal = self._valueMax();
166
+ break;
167
+ case $.ui.keyCode.PAGE_UP:
168
+ newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
169
+ break;
170
+ case $.ui.keyCode.PAGE_DOWN:
171
+ newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
172
+ break;
173
+ case $.ui.keyCode.UP:
174
+ case $.ui.keyCode.RIGHT:
175
+ if ( curVal === self._valueMax() ) {
176
+ return;
177
+ }
178
+ newVal = self._trimAlignValue( curVal + step );
179
+ break;
180
+ case $.ui.keyCode.DOWN:
181
+ case $.ui.keyCode.LEFT:
182
+ if ( curVal === self._valueMin() ) {
183
+ return;
184
+ }
185
+ newVal = self._trimAlignValue( curVal - step );
186
+ break;
187
+ }
188
+
189
+ self._slide( event, index, newVal );
190
+ })
191
+ .keyup(function( event ) {
192
+ var index = $( this ).data( "index.ui-slider-handle" );
193
+
194
+ if ( self._keySliding ) {
195
+ self._keySliding = false;
196
+ self._stop( event, index );
197
+ self._change( event, index );
198
+ $( this ).removeClass( "ui-state-active" );
199
+ }
200
+
201
+ });
202
+
203
+ this._refreshValue();
204
+
205
+ this._animateOff = false;
206
+ },
207
+
208
+ destroy: function() {
209
+ this.handles.remove();
210
+ this.range.remove();
211
+
212
+ this.element
213
+ .removeClass( "ui-slider" +
214
+ " ui-slider-horizontal" +
215
+ " ui-slider-vertical" +
216
+ " ui-slider-disabled" +
217
+ " ui-widget" +
218
+ " ui-widget-content" +
219
+ " ui-corner-all" )
220
+ .removeData( "slider" )
221
+ .unbind( ".slider" );
222
+
223
+ this._mouseDestroy();
224
+
225
+ return this;
226
+ },
227
+
228
+ _mouseCapture: function( event ) {
229
+ var o = this.options,
230
+ position,
231
+ normValue,
232
+ distance,
233
+ closestHandle,
234
+ self,
235
+ index,
236
+ allowed,
237
+ offset,
238
+ mouseOverHandle;
239
+
240
+ if ( o.disabled ) {
241
+ return false;
242
+ }
243
+
244
+ this.elementSize = {
245
+ width: this.element.outerWidth(),
246
+ height: this.element.outerHeight()
247
+ };
248
+ this.elementOffset = this.element.offset();
249
+
250
+ position = { x: event.pageX, y: event.pageY };
251
+ normValue = this._normValueFromMouse( position );
252
+ distance = this._valueMax() - this._valueMin() + 1;
253
+ self = this;
254
+ this.handles.each(function( i ) {
255
+ var thisDistance = Math.abs( normValue - self.values(i) );
256
+ if ( distance > thisDistance ) {
257
+ distance = thisDistance;
258
+ closestHandle = $( this );
259
+ index = i;
260
+ }
261
+ });
262
+
263
+ // workaround for bug #3736 (if both handles of a range are at 0,
264
+ // the first is always used as the one with least distance,
265
+ // and moving it is obviously prevented by preventing negative ranges)
266
+ if( o.range === true && this.values(1) === o.min ) {
267
+ index += 1;
268
+ closestHandle = $( this.handles[index] );
269
+ }
270
+
271
+ allowed = this._start( event, index );
272
+ if ( allowed === false ) {
273
+ return false;
274
+ }
275
+ this._mouseSliding = true;
276
+
277
+ self._handleIndex = index;
278
+
279
+ closestHandle
280
+ .addClass( "ui-state-active" )
281
+ .focus();
282
+
283
+ offset = closestHandle.offset();
284
+ mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
285
+ this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
286
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
287
+ top: event.pageY - offset.top -
288
+ ( closestHandle.height() / 2 ) -
289
+ ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
290
+ ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
291
+ ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
292
+ };
293
+
294
+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {
295
+ this._slide( event, index, normValue );
296
+ }
297
+ this._animateOff = true;
298
+ return true;
299
+ },
300
+
301
+ _mouseStart: function( event ) {
302
+ return true;
303
+ },
304
+
305
+ _mouseDrag: function( event ) {
306
+ var position = { x: event.pageX, y: event.pageY },
307
+ normValue = this._normValueFromMouse( position );
308
+
309
+ this._slide( event, this._handleIndex, normValue );
310
+
311
+ return false;
312
+ },
313
+
314
+ _mouseStop: function( event ) {
315
+ this.handles.removeClass( "ui-state-active" );
316
+ this._mouseSliding = false;
317
+
318
+ this._stop( event, this._handleIndex );
319
+ this._change( event, this._handleIndex );
320
+
321
+ this._handleIndex = null;
322
+ this._clickOffset = null;
323
+ this._animateOff = false;
324
+
325
+ return false;
326
+ },
327
+
328
+ _detectOrientation: function() {
329
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
330
+ },
331
+
332
+ _normValueFromMouse: function( position ) {
333
+ var pixelTotal,
334
+ pixelMouse,
335
+ percentMouse,
336
+ valueTotal,
337
+ valueMouse;
338
+
339
+ if ( this.orientation === "horizontal" ) {
340
+ pixelTotal = this.elementSize.width;
341
+ pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
342
+ } else {
343
+ pixelTotal = this.elementSize.height;
344
+ pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
345
+ }
346
+
347
+ percentMouse = ( pixelMouse / pixelTotal );
348
+ if ( percentMouse > 1 ) {
349
+ percentMouse = 1;
350
+ }
351
+ if ( percentMouse < 0 ) {
352
+ percentMouse = 0;
353
+ }
354
+ if ( this.orientation === "vertical" ) {
355
+ percentMouse = 1 - percentMouse;
356
+ }
357
+
358
+ valueTotal = this._valueMax() - this._valueMin();
359
+ valueMouse = this._valueMin() + percentMouse * valueTotal;
360
+
361
+ return this._trimAlignValue( valueMouse );
362
+ },
363
+
364
+ _start: function( event, index ) {
365
+ var uiHash = {
366
+ handle: this.handles[ index ],
367
+ value: this.value()
368
+ };
369
+ if ( this.options.values && this.options.values.length ) {
370
+ uiHash.value = this.values( index );
371
+ uiHash.values = this.values();
372
+ }
373
+ return this._trigger( "start", event, uiHash );
374
+ },
375
+
376
+ _slide: function( event, index, newVal ) {
377
+ var otherVal,
378
+ newValues,
379
+ allowed;
380
+
381
+ if ( this.options.values && this.options.values.length ) {
382
+ otherVal = this.values( index ? 0 : 1 );
383
+
384
+ if ( ( this.options.values.length === 2 && this.options.range === true ) &&
385
+ ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
386
+ ) {
387
+ newVal = otherVal;
388
+ }
389
+
390
+ if ( newVal !== this.values( index ) ) {
391
+ newValues = this.values();
392
+ newValues[ index ] = newVal;
393
+ // A slide can be canceled by returning false from the slide callback
394
+ allowed = this._trigger( "slide", event, {
395
+ handle: this.handles[ index ],
396
+ value: newVal,
397
+ values: newValues
398
+ } );
399
+ otherVal = this.values( index ? 0 : 1 );
400
+ if ( allowed !== false ) {
401
+ this.values( index, newVal, true );
402
+ }
403
+ }
404
+ } else {
405
+ if ( newVal !== this.value() ) {
406
+ // A slide can be canceled by returning false from the slide callback
407
+ allowed = this._trigger( "slide", event, {
408
+ handle: this.handles[ index ],
409
+ value: newVal
410
+ } );
411
+ if ( allowed !== false ) {
412
+ this.value( newVal );
413
+ }
414
+ }
415
+ }
416
+ },
417
+
418
+ _stop: function( event, index ) {
419
+ var uiHash = {
420
+ handle: this.handles[ index ],
421
+ value: this.value()
422
+ };
423
+ if ( this.options.values && this.options.values.length ) {
424
+ uiHash.value = this.values( index );
425
+ uiHash.values = this.values();
426
+ }
427
+
428
+ this._trigger( "stop", event, uiHash );
429
+ },
430
+
431
+ _change: function( event, index ) {
432
+ if ( !this._keySliding && !this._mouseSliding ) {
433
+ var uiHash = {
434
+ handle: this.handles[ index ],
435
+ value: this.value()
436
+ };
437
+ if ( this.options.values && this.options.values.length ) {
438
+ uiHash.value = this.values( index );
439
+ uiHash.values = this.values();
440
+ }
441
+
442
+ this._trigger( "change", event, uiHash );
443
+ }
444
+ },
445
+
446
+ value: function( newValue ) {
447
+ if ( arguments.length ) {
448
+ this.options.value = this._trimAlignValue( newValue );
449
+ this._refreshValue();
450
+ this._change( null, 0 );
451
+ return;
452
+ }
453
+
454
+ return this._value();
455
+ },
456
+
457
+ values: function( index, newValue ) {
458
+ var vals,
459
+ newValues,
460
+ i;
461
+
462
+ if ( arguments.length > 1 ) {
463
+ this.options.values[ index ] = this._trimAlignValue( newValue );
464
+ this._refreshValue();
465
+ this._change( null, index );
466
+ return;
467
+ }
468
+
469
+ if ( arguments.length ) {
470
+ if ( $.isArray( arguments[ 0 ] ) ) {
471
+ vals = this.options.values;
472
+ newValues = arguments[ 0 ];
473
+ for ( i = 0; i < vals.length; i += 1 ) {
474
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );
475
+ this._change( null, i );
476
+ }
477
+ this._refreshValue();
478
+ } else {
479
+ if ( this.options.values && this.options.values.length ) {
480
+ return this._values( index );
481
+ } else {
482
+ return this.value();
483
+ }
484
+ }
485
+ } else {
486
+ return this._values();
487
+ }
488
+ },
489
+
490
+ _setOption: function( key, value ) {
491
+ var i,
492
+ valsLength = 0;
493
+
494
+ if ( $.isArray( this.options.values ) ) {
495
+ valsLength = this.options.values.length;
496
+ }
497
+
498
+ $.Widget.prototype._setOption.apply( this, arguments );
499
+
500
+ switch ( key ) {
501
+ case "disabled":
502
+ if ( value ) {
503
+ this.handles.filter( ".ui-state-focus" ).blur();
504
+ this.handles.removeClass( "ui-state-hover" );
505
+ this.handles.propAttr( "disabled", true );
506
+ this.element.addClass( "ui-disabled" );
507
+ } else {
508
+ this.handles.propAttr( "disabled", false );
509
+ this.element.removeClass( "ui-disabled" );
510
+ }
511
+ break;
512
+ case "orientation":
513
+ this._detectOrientation();
514
+ this.element
515
+ .removeClass( "ui-slider-horizontal ui-slider-vertical" )
516
+ .addClass( "ui-slider-" + this.orientation );
517
+ this._refreshValue();
518
+ break;
519
+ case "value":
520
+ this._animateOff = true;
521
+ this._refreshValue();
522
+ this._change( null, 0 );
523
+ this._animateOff = false;
524
+ break;
525
+ case "values":
526
+ this._animateOff = true;
527
+ this._refreshValue();
528
+ for ( i = 0; i < valsLength; i += 1 ) {
529
+ this._change( null, i );
530
+ }
531
+ this._animateOff = false;
532
+ break;
533
+ }
534
+ },
535
+
536
+ //internal value getter
537
+ // _value() returns value trimmed by min and max, aligned by step
538
+ _value: function() {
539
+ var val = this.options.value;
540
+ val = this._trimAlignValue( val );
541
+
542
+ return val;
543
+ },
544
+
545
+ //internal values getter
546
+ // _values() returns array of values trimmed by min and max, aligned by step
547
+ // _values( index ) returns single value trimmed by min and max, aligned by step
548
+ _values: function( index ) {
549
+ var val,
550
+ vals,
551
+ i;
552
+
553
+ if ( arguments.length ) {
554
+ val = this.options.values[ index ];
555
+ val = this._trimAlignValue( val );
556
+
557
+ return val;
558
+ } else {
559
+ // .slice() creates a copy of the array
560
+ // this copy gets trimmed by min and max and then returned
561
+ vals = this.options.values.slice();
562
+ for ( i = 0; i < vals.length; i+= 1) {
563
+ vals[ i ] = this._trimAlignValue( vals[ i ] );
564
+ }
565
+
566
+ return vals;
567
+ }
568
+ },
569
+
570
+ // returns the step-aligned value that val is closest to, between (inclusive) min and max
571
+ _trimAlignValue: function( val ) {
572
+ if ( val <= this._valueMin() ) {
573
+ return this._valueMin();
574
+ }
575
+ if ( val >= this._valueMax() ) {
576
+ return this._valueMax();
577
+ }
578
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
579
+ valModStep = (val - this._valueMin()) % step,
580
+ alignValue = val - valModStep;
581
+
582
+ if ( Math.abs(valModStep) * 2 >= step ) {
583
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
584
+ }
585
+
586
+ // Since JavaScript has problems with large floats, round
587
+ // the final value to 5 digits after the decimal point (see #4124)
588
+ return parseFloat( alignValue.toFixed(5) );
589
+ },
590
+
591
+ _valueMin: function() {
592
+ return this.options.min;
593
+ },
594
+
595
+ _valueMax: function() {
596
+ return this.options.max;
597
+ },
598
+
599
+ _refreshValue: function() {
600
+ var oRange = this.options.range,
601
+ o = this.options,
602
+ self = this,
603
+ animate = ( !this._animateOff ) ? o.animate : false,
604
+ valPercent,
605
+ _set = {},
606
+ lastValPercent,
607
+ value,
608
+ valueMin,
609
+ valueMax;
610
+
611
+ if ( this.options.values && this.options.values.length ) {
612
+ this.handles.each(function( i, j ) {
613
+ valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
614
+ _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
615
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
616
+ if ( self.options.range === true ) {
617
+ if ( self.orientation === "horizontal" ) {
618
+ if ( i === 0 ) {
619
+ self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
620
+ }
621
+ if ( i === 1 ) {
622
+ self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
623
+ }
624
+ } else {
625
+ if ( i === 0 ) {
626
+ self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
627
+ }
628
+ if ( i === 1 ) {
629
+ self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
630
+ }
631
+ }
632
+ }
633
+ lastValPercent = valPercent;
634
+ });
635
+ } else {
636
+ value = this.value();
637
+ valueMin = this._valueMin();
638
+ valueMax = this._valueMax();
639
+ valPercent = ( valueMax !== valueMin ) ?
640
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
641
+ 0;
642
+ _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
643
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
644
+
645
+ if ( oRange === "min" && this.orientation === "horizontal" ) {
646
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
647
+ }
648
+ if ( oRange === "max" && this.orientation === "horizontal" ) {
649
+ this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
650
+ }
651
+ if ( oRange === "min" && this.orientation === "vertical" ) {
652
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
653
+ }
654
+ if ( oRange === "max" && this.orientation === "vertical" ) {
655
+ this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
656
+ }
657
+ }
658
+ }
659
+
660
+ });
661
+
662
+ $.extend( $.ui.slider, {
663
+ version: "1.8.20"
664
+ });
665
+
666
+ }(jQuery));