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