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