pakunok 0.0.1

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