jquery-ui-middleman 4.1.0

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