spiderfw 0.6.27 → 0.6.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/CHANGELOG +4 -0
  2. data/VERSION +1 -1
  3. data/apps/core/admin/admin.rb +6 -2
  4. data/apps/core/admin/controllers/admin_controller.rb +10 -3
  5. data/apps/core/admin/controllers/app_admin_controller.rb +15 -0
  6. data/apps/core/admin/public/css/sass/admin.css +29 -33
  7. data/apps/core/admin/public/css/sass/grid.css +14 -0
  8. data/apps/core/admin/public/sass/admin.scss +3 -2
  9. data/apps/core/admin/views/admin.layout.shtml +1 -0
  10. data/apps/core/auth/controllers/mixins/auth_helper.rb +15 -5
  11. data/apps/core/components/assets.rb +60 -41
  12. data/apps/core/components/public/js/jquery/jquery-1.8.3.js +9472 -0
  13. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/jquery.ui.core.js +1 -1
  14. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/button_bg.png +0 -0
  15. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/datepicker.gif +0 -0
  16. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/icon_sprite.png +0 -0
  17. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/progress_bar.gif +0 -0
  18. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_h_bg.gif +0 -0
  19. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_handles.png +0 -0
  20. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_v_bg.gif +0 -0
  21. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/tab_bg.gif +0 -0
  22. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/the_gradient.gif +0 -0
  23. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-anim_basic_16x16.gif +0 -0
  24. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  25. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  26. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_flat_10_000000_40x100.png +0 -0
  27. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  28. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  29. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  30. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  31. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  32. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  33. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_222222_256x240.png +0 -0
  34. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_228ef1_256x240.png +0 -0
  35. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ef8c08_256x240.png +0 -0
  36. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ffd27a_256x240.png +0 -0
  37. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ffffff_256x240.png +0 -0
  38. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/jquery-ui.custom.css +528 -0
  39. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-af.js +23 -0
  40. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
  41. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ar.js +23 -0
  42. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-az.js +23 -0
  43. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-be.js +23 -0
  44. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-bg.js +24 -0
  45. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-bs.js +23 -0
  46. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ca.js +23 -0
  47. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-cs.js +23 -0
  48. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-cy-GB.js +23 -0
  49. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-da.js +23 -0
  50. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-de.js +23 -0
  51. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-el.js +23 -0
  52. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-AU.js +23 -0
  53. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-GB.js +23 -0
  54. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
  55. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-eo.js +23 -0
  56. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-es.js +23 -0
  57. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-et.js +23 -0
  58. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-eu.js +23 -0
  59. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fa.js +59 -0
  60. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fi.js +23 -0
  61. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fo.js +23 -0
  62. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr-CA.js +23 -0
  63. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
  64. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr.js +25 -0
  65. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-gl.js +23 -0
  66. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-he.js +23 -0
  67. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hi.js +23 -0
  68. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hr.js +23 -0
  69. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hu.js +23 -0
  70. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hy.js +23 -0
  71. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-id.js +23 -0
  72. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-is.js +23 -0
  73. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-it.js +23 -0
  74. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ja.js +23 -0
  75. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ka.js +21 -0
  76. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-kk.js +23 -0
  77. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-km.js +23 -0
  78. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ko.js +23 -0
  79. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ky.js +24 -0
  80. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lb.js +23 -0
  81. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lt.js +23 -0
  82. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lv.js +23 -0
  83. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-mk.js +23 -0
  84. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ml.js +23 -0
  85. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ms.js +23 -0
  86. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nb.js +22 -0
  87. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nl-BE.js +23 -0
  88. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nl.js +23 -0
  89. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nn.js +22 -0
  90. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-no.js +23 -0
  91. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pl.js +23 -0
  92. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
  93. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pt.js +22 -0
  94. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-rm.js +21 -0
  95. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ro.js +26 -0
  96. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ru.js +23 -0
  97. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sk.js +23 -0
  98. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sl.js +24 -0
  99. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sq.js +23 -0
  100. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
  101. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sr.js +23 -0
  102. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sv.js +23 -0
  103. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ta.js +23 -0
  104. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-th.js +23 -0
  105. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-tj.js +23 -0
  106. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-tr.js +23 -0
  107. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-uk.js +24 -0
  108. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-vi.js +23 -0
  109. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-CN.js +23 -0
  110. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
  111. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-TW.js +23 -0
  112. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.accordion.js +571 -0
  113. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.autocomplete.js +614 -0
  114. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.button.js +419 -0
  115. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.core.js +324 -0
  116. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.datepicker.js +2044 -0
  117. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.dialog.js +767 -0
  118. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.draggable.js +941 -0
  119. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.droppable.js +364 -0
  120. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-blind.js +82 -0
  121. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-bounce.js +113 -0
  122. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-clip.js +67 -0
  123. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-drop.js +65 -0
  124. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-explode.js +97 -0
  125. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-fade.js +30 -0
  126. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-fold.js +76 -0
  127. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-highlight.js +50 -0
  128. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-pulsate.js +63 -0
  129. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-scale.js +318 -0
  130. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-shake.js +74 -0
  131. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-slide.js +64 -0
  132. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-transfer.js +47 -0
  133. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect.js +1259 -0
  134. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.menu.js +621 -0
  135. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.mouse.js +169 -0
  136. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.position.js +497 -0
  137. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.progressbar.js +145 -0
  138. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.resizable.js +963 -0
  139. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.selectable.js +269 -0
  140. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.slider.js +641 -0
  141. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.sortable.js +1236 -0
  142. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.spinner.js +492 -0
  143. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.tabs.js +846 -0
  144. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.tooltip.js +400 -0
  145. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.widget.js +521 -0
  146. data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.js +3 -1
  147. data/apps/core/components/public/js/plugins/sortable.js +5 -5
  148. data/apps/core/components/widgets/month_calendar/month_calendar.shtml +1 -1
  149. data/apps/core/components/widgets/table/table.rb +18 -5
  150. data/apps/core/forms/public/date_time.js +3 -0
  151. data/apps/core/forms/widgets/form/form.rb +1 -1
  152. data/apps/core/forms/widgets/inputs/date_time/date_time.rb +5 -0
  153. data/apps/core/forms/widgets/inputs/file_input/file_input.rb +1 -1
  154. data/apps/core/forms/widgets/inputs/select/select.rb +11 -16
  155. data/apps/messenger/config/options.rb +5 -5
  156. data/apps/messenger/controllers/messenger_admin_controller.rb +1 -1
  157. data/apps/messenger/controllers/messenger_controller.rb +1 -1
  158. data/apps/messenger/lib/backends/mobyt.rb +1 -1
  159. data/apps/messenger/messenger.rb +4 -2
  160. data/apps/messenger/views/admin/index.shtml +1 -1
  161. data/lib/spiderfw/controller/dispatcher.rb +5 -5
  162. data/lib/spiderfw/controller/mixins/visual.rb +10 -8
  163. data/lib/spiderfw/http/http.rb +1 -1
  164. data/lib/spiderfw/model/base_model.rb +2 -2
  165. data/lib/spiderfw/model/mappers/db_mapper.rb +4 -2
  166. data/lib/spiderfw/model/mixins/tree.rb +4 -5
  167. data/lib/spiderfw/model/model.rb +2 -1
  168. data/lib/spiderfw/model/storage/db/adapters/mysql.rb +18 -20
  169. data/lib/spiderfw/model/storage/db/adapters/oracle.rb +1 -1
  170. data/lib/spiderfw/spider.rb +5 -1
  171. data/lib/spiderfw/templates/blocks/layout_assets.rb +5 -2
  172. data/lib/spiderfw/templates/layout.rb +7 -3
  173. data/lib/spiderfw/templates/template.rb +8 -1
  174. data/lib/spiderfw/utils/monkey/date_time.rb +7 -5
  175. data/lib/spiderfw/utils/monkey/module.rb +12 -0
  176. metadata +373 -157
  177. data/lib/spiderfw/model/storage/db/connectors/mysql.rb +0 -16
  178. data/lib/spiderfw/model/storage/db/connectors/mysql2.rb +0 -9
  179. /data/apps/core/admin/public/img/{icons-s845a69dd9f.png → icons-s8b18557db6.png} +0 -0
@@ -0,0 +1,641 @@
1
+ /*!
2
+ * jQuery UI Slider @VERSION
3
+ * http://jqueryui.com
4
+ *
5
+ * Copyright 2012 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: "@VERSION",
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
+
38
+ _create: function() {
39
+ var i, handleCount,
40
+ o = this.options,
41
+ existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
42
+ handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
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
+
59
+ this.range = $([]);
60
+
61
+ if ( o.range ) {
62
+ if ( o.range === true ) {
63
+ if ( !o.values ) {
64
+ o.values = [ this._valueMin(), this._valueMin() ];
65
+ } else if ( o.values.length && o.values.length !== 2 ) {
66
+ o.values = [ o.values[0], o.values[0] ];
67
+ } else if ( $.isArray( o.values ) ) {
68
+ o.values = o.values.slice(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
+ handleCount = ( o.values && o.values.length ) || 1;
82
+
83
+ for ( i = existingHandles.length; i < handleCount; i++ ) {
84
+ handles.push( handle );
85
+ }
86
+
87
+ this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
88
+
89
+ this.handle = this.handles.eq( 0 );
90
+
91
+ this.handles.add( this.range ).filter( "a" )
92
+ .click(function( event ) {
93
+ event.preventDefault();
94
+ })
95
+ .mouseenter(function() {
96
+ if ( !o.disabled ) {
97
+ $( this ).addClass( "ui-state-hover" );
98
+ }
99
+ })
100
+ .mouseleave(function() {
101
+ $( this ).removeClass( "ui-state-hover" );
102
+ })
103
+ .focus(function() {
104
+ if ( !o.disabled ) {
105
+ $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
106
+ $( this ).addClass( "ui-state-focus" );
107
+ } else {
108
+ $( this ).blur();
109
+ }
110
+ })
111
+ .blur(function() {
112
+ $( this ).removeClass( "ui-state-focus" );
113
+ });
114
+
115
+ this.handles.each(function( i ) {
116
+ $( this ).data( "ui-slider-handle-index", i );
117
+ });
118
+
119
+ this._setOption( "disabled", o.disabled );
120
+
121
+ this._on( this.handles, {
122
+ keydown: function( event ) {
123
+ /*jshint maxcomplexity:25*/
124
+ var allowed, curVal, newVal, step,
125
+ index = $( event.target ).data( "ui-slider-handle-index" );
126
+
127
+ switch ( event.keyCode ) {
128
+ case $.ui.keyCode.HOME:
129
+ case $.ui.keyCode.END:
130
+ case $.ui.keyCode.PAGE_UP:
131
+ case $.ui.keyCode.PAGE_DOWN:
132
+ case $.ui.keyCode.UP:
133
+ case $.ui.keyCode.RIGHT:
134
+ case $.ui.keyCode.DOWN:
135
+ case $.ui.keyCode.LEFT:
136
+ event.preventDefault();
137
+ if ( !this._keySliding ) {
138
+ this._keySliding = true;
139
+ $( event.target ).addClass( "ui-state-active" );
140
+ allowed = this._start( event, index );
141
+ if ( allowed === false ) {
142
+ return;
143
+ }
144
+ }
145
+ break;
146
+ }
147
+
148
+ step = this.options.step;
149
+ if ( this.options.values && this.options.values.length ) {
150
+ curVal = newVal = this.values( index );
151
+ } else {
152
+ curVal = newVal = this.value();
153
+ }
154
+
155
+ switch ( event.keyCode ) {
156
+ case $.ui.keyCode.HOME:
157
+ newVal = this._valueMin();
158
+ break;
159
+ case $.ui.keyCode.END:
160
+ newVal = this._valueMax();
161
+ break;
162
+ case $.ui.keyCode.PAGE_UP:
163
+ newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) );
164
+ break;
165
+ case $.ui.keyCode.PAGE_DOWN:
166
+ newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
167
+ break;
168
+ case $.ui.keyCode.UP:
169
+ case $.ui.keyCode.RIGHT:
170
+ if ( curVal === this._valueMax() ) {
171
+ return;
172
+ }
173
+ newVal = this._trimAlignValue( curVal + step );
174
+ break;
175
+ case $.ui.keyCode.DOWN:
176
+ case $.ui.keyCode.LEFT:
177
+ if ( curVal === this._valueMin() ) {
178
+ return;
179
+ }
180
+ newVal = this._trimAlignValue( curVal - step );
181
+ break;
182
+ }
183
+
184
+ this._slide( event, index, newVal );
185
+ },
186
+ keyup: function( event ) {
187
+ var index = $( event.target ).data( "ui-slider-handle-index" );
188
+
189
+ if ( this._keySliding ) {
190
+ this._keySliding = false;
191
+ this._stop( event, index );
192
+ this._change( event, index );
193
+ $( event.target ).removeClass( "ui-state-active" );
194
+ }
195
+ }
196
+ });
197
+
198
+ this._refreshValue();
199
+
200
+ this._animateOff = false;
201
+ },
202
+
203
+ _destroy: function() {
204
+ this.handles.remove();
205
+ this.range.remove();
206
+
207
+ this.element
208
+ .removeClass( "ui-slider" +
209
+ " ui-slider-horizontal" +
210
+ " ui-slider-vertical" +
211
+ " ui-widget" +
212
+ " ui-widget-content" +
213
+ " ui-corner-all" );
214
+
215
+ this._mouseDestroy();
216
+ },
217
+
218
+ _mouseCapture: function( event ) {
219
+ var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
220
+ that = this,
221
+ o = this.options;
222
+
223
+ if ( o.disabled ) {
224
+ return false;
225
+ }
226
+
227
+ this.elementSize = {
228
+ width: this.element.outerWidth(),
229
+ height: this.element.outerHeight()
230
+ };
231
+ this.elementOffset = this.element.offset();
232
+
233
+ position = { x: event.pageX, y: event.pageY };
234
+ normValue = this._normValueFromMouse( position );
235
+ distance = this._valueMax() - this._valueMin() + 1;
236
+ this.handles.each(function( i ) {
237
+ var thisDistance = Math.abs( normValue - that.values(i) );
238
+ if (( distance > thisDistance ) ||
239
+ ( distance === thisDistance &&
240
+ (i === that._lastChangedValue || that.values(i) === o.min ))) {
241
+ distance = thisDistance;
242
+ closestHandle = $( this );
243
+ index = i;
244
+ }
245
+ });
246
+
247
+ allowed = this._start( event, index );
248
+ if ( allowed === false ) {
249
+ return false;
250
+ }
251
+ this._mouseSliding = true;
252
+
253
+ this._handleIndex = index;
254
+
255
+ closestHandle
256
+ .addClass( "ui-state-active" )
257
+ .focus();
258
+
259
+ offset = closestHandle.offset();
260
+ mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
261
+ this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
262
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
263
+ top: event.pageY - offset.top -
264
+ ( closestHandle.height() / 2 ) -
265
+ ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
266
+ ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
267
+ ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
268
+ };
269
+
270
+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {
271
+ this._slide( event, index, normValue );
272
+ }
273
+ this._animateOff = true;
274
+ return true;
275
+ },
276
+
277
+ _mouseStart: function() {
278
+ return true;
279
+ },
280
+
281
+ _mouseDrag: function( event ) {
282
+ var position = { x: event.pageX, y: event.pageY },
283
+ normValue = this._normValueFromMouse( position );
284
+
285
+ this._slide( event, this._handleIndex, normValue );
286
+
287
+ return false;
288
+ },
289
+
290
+ _mouseStop: function( event ) {
291
+ this.handles.removeClass( "ui-state-active" );
292
+ this._mouseSliding = false;
293
+
294
+ this._stop( event, this._handleIndex );
295
+ this._change( event, this._handleIndex );
296
+
297
+ this._handleIndex = null;
298
+ this._clickOffset = null;
299
+ this._animateOff = false;
300
+
301
+ return false;
302
+ },
303
+
304
+ _detectOrientation: function() {
305
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
306
+ },
307
+
308
+ _normValueFromMouse: function( position ) {
309
+ var pixelTotal,
310
+ pixelMouse,
311
+ percentMouse,
312
+ valueTotal,
313
+ valueMouse;
314
+
315
+ if ( this.orientation === "horizontal" ) {
316
+ pixelTotal = this.elementSize.width;
317
+ pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
318
+ } else {
319
+ pixelTotal = this.elementSize.height;
320
+ pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
321
+ }
322
+
323
+ percentMouse = ( pixelMouse / pixelTotal );
324
+ if ( percentMouse > 1 ) {
325
+ percentMouse = 1;
326
+ }
327
+ if ( percentMouse < 0 ) {
328
+ percentMouse = 0;
329
+ }
330
+ if ( this.orientation === "vertical" ) {
331
+ percentMouse = 1 - percentMouse;
332
+ }
333
+
334
+ valueTotal = this._valueMax() - this._valueMin();
335
+ valueMouse = this._valueMin() + percentMouse * valueTotal;
336
+
337
+ return this._trimAlignValue( valueMouse );
338
+ },
339
+
340
+ _start: function( event, index ) {
341
+ var uiHash = {
342
+ handle: this.handles[ index ],
343
+ value: this.value()
344
+ };
345
+ if ( this.options.values && this.options.values.length ) {
346
+ uiHash.value = this.values( index );
347
+ uiHash.values = this.values();
348
+ }
349
+ return this._trigger( "start", event, uiHash );
350
+ },
351
+
352
+ _slide: function( event, index, newVal ) {
353
+ var otherVal,
354
+ newValues,
355
+ allowed;
356
+
357
+ if ( this.options.values && this.options.values.length ) {
358
+ otherVal = this.values( index ? 0 : 1 );
359
+
360
+ if ( ( this.options.values.length === 2 && this.options.range === true ) &&
361
+ ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
362
+ ) {
363
+ newVal = otherVal;
364
+ }
365
+
366
+ if ( newVal !== this.values( index ) ) {
367
+ newValues = this.values();
368
+ newValues[ index ] = newVal;
369
+ // A slide can be canceled by returning false from the slide callback
370
+ allowed = this._trigger( "slide", event, {
371
+ handle: this.handles[ index ],
372
+ value: newVal,
373
+ values: newValues
374
+ } );
375
+ otherVal = this.values( index ? 0 : 1 );
376
+ if ( allowed !== false ) {
377
+ this.values( index, newVal, true );
378
+ }
379
+ }
380
+ } else {
381
+ if ( newVal !== this.value() ) {
382
+ // A slide can be canceled by returning false from the slide callback
383
+ allowed = this._trigger( "slide", event, {
384
+ handle: this.handles[ index ],
385
+ value: newVal
386
+ } );
387
+ if ( allowed !== false ) {
388
+ this.value( newVal );
389
+ }
390
+ }
391
+ }
392
+ },
393
+
394
+ _stop: function( event, index ) {
395
+ var uiHash = {
396
+ handle: this.handles[ index ],
397
+ value: this.value()
398
+ };
399
+ if ( this.options.values && this.options.values.length ) {
400
+ uiHash.value = this.values( index );
401
+ uiHash.values = this.values();
402
+ }
403
+
404
+ this._trigger( "stop", event, uiHash );
405
+ },
406
+
407
+ _change: function( event, index ) {
408
+ if ( !this._keySliding && !this._mouseSliding ) {
409
+ var uiHash = {
410
+ handle: this.handles[ index ],
411
+ value: this.value()
412
+ };
413
+ if ( this.options.values && this.options.values.length ) {
414
+ uiHash.value = this.values( index );
415
+ uiHash.values = this.values();
416
+ }
417
+
418
+ //store the last changed value index for reference when handles overlap
419
+ this._lastChangedValue = index;
420
+
421
+ this._trigger( "change", event, uiHash );
422
+ }
423
+ },
424
+
425
+ value: function( newValue ) {
426
+ if ( arguments.length ) {
427
+ this.options.value = this._trimAlignValue( newValue );
428
+ this._refreshValue();
429
+ this._change( null, 0 );
430
+ return;
431
+ }
432
+
433
+ return this._value();
434
+ },
435
+
436
+ values: function( index, newValue ) {
437
+ var vals,
438
+ newValues,
439
+ i;
440
+
441
+ if ( arguments.length > 1 ) {
442
+ this.options.values[ index ] = this._trimAlignValue( newValue );
443
+ this._refreshValue();
444
+ this._change( null, index );
445
+ return;
446
+ }
447
+
448
+ if ( arguments.length ) {
449
+ if ( $.isArray( arguments[ 0 ] ) ) {
450
+ vals = this.options.values;
451
+ newValues = arguments[ 0 ];
452
+ for ( i = 0; i < vals.length; i += 1 ) {
453
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );
454
+ this._change( null, i );
455
+ }
456
+ this._refreshValue();
457
+ } else {
458
+ if ( this.options.values && this.options.values.length ) {
459
+ return this._values( index );
460
+ } else {
461
+ return this.value();
462
+ }
463
+ }
464
+ } else {
465
+ return this._values();
466
+ }
467
+ },
468
+
469
+ _setOption: function( key, value ) {
470
+ var i,
471
+ valsLength = 0;
472
+
473
+ if ( $.isArray( this.options.values ) ) {
474
+ valsLength = this.options.values.length;
475
+ }
476
+
477
+ $.Widget.prototype._setOption.apply( this, arguments );
478
+
479
+ switch ( key ) {
480
+ case "disabled":
481
+ if ( value ) {
482
+ this.handles.filter( ".ui-state-focus" ).blur();
483
+ this.handles.removeClass( "ui-state-hover" );
484
+ this.handles.prop( "disabled", true );
485
+ } else {
486
+ this.handles.prop( "disabled", false );
487
+ }
488
+ break;
489
+ case "orientation":
490
+ this._detectOrientation();
491
+ this.element
492
+ .removeClass( "ui-slider-horizontal ui-slider-vertical" )
493
+ .addClass( "ui-slider-" + this.orientation );
494
+ this._refreshValue();
495
+ break;
496
+ case "value":
497
+ this._animateOff = true;
498
+ this._refreshValue();
499
+ this._change( null, 0 );
500
+ this._animateOff = false;
501
+ break;
502
+ case "values":
503
+ this._animateOff = true;
504
+ this._refreshValue();
505
+ for ( i = 0; i < valsLength; i += 1 ) {
506
+ this._change( null, i );
507
+ }
508
+ this._animateOff = false;
509
+ break;
510
+ case "min":
511
+ case "max":
512
+ this._animateOff = true;
513
+ this._refreshValue();
514
+ this._animateOff = false;
515
+ break;
516
+ }
517
+ },
518
+
519
+ //internal value getter
520
+ // _value() returns value trimmed by min and max, aligned by step
521
+ _value: function() {
522
+ var val = this.options.value;
523
+ val = this._trimAlignValue( val );
524
+
525
+ return val;
526
+ },
527
+
528
+ //internal values getter
529
+ // _values() returns array of values trimmed by min and max, aligned by step
530
+ // _values( index ) returns single value trimmed by min and max, aligned by step
531
+ _values: function( index ) {
532
+ var val,
533
+ vals,
534
+ i;
535
+
536
+ if ( arguments.length ) {
537
+ val = this.options.values[ index ];
538
+ val = this._trimAlignValue( val );
539
+
540
+ return val;
541
+ } else {
542
+ // .slice() creates a copy of the array
543
+ // this copy gets trimmed by min and max and then returned
544
+ vals = this.options.values.slice();
545
+ for ( i = 0; i < vals.length; i+= 1) {
546
+ vals[ i ] = this._trimAlignValue( vals[ i ] );
547
+ }
548
+
549
+ return vals;
550
+ }
551
+ },
552
+
553
+ // returns the step-aligned value that val is closest to, between (inclusive) min and max
554
+ _trimAlignValue: function( val ) {
555
+ if ( val <= this._valueMin() ) {
556
+ return this._valueMin();
557
+ }
558
+ if ( val >= this._valueMax() ) {
559
+ return this._valueMax();
560
+ }
561
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
562
+ valModStep = (val - this._valueMin()) % step,
563
+ alignValue = val - valModStep;
564
+
565
+ if ( Math.abs(valModStep) * 2 >= step ) {
566
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
567
+ }
568
+
569
+ // Since JavaScript has problems with large floats, round
570
+ // the final value to 5 digits after the decimal point (see #4124)
571
+ return parseFloat( alignValue.toFixed(5) );
572
+ },
573
+
574
+ _valueMin: function() {
575
+ return this.options.min;
576
+ },
577
+
578
+ _valueMax: function() {
579
+ return this.options.max;
580
+ },
581
+
582
+ _refreshValue: function() {
583
+ var lastValPercent, valPercent, value, valueMin, valueMax,
584
+ oRange = this.options.range,
585
+ o = this.options,
586
+ that = this,
587
+ animate = ( !this._animateOff ) ? o.animate : false,
588
+ _set = {};
589
+
590
+ if ( this.options.values && this.options.values.length ) {
591
+ this.handles.each(function( i ) {
592
+ valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
593
+ _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
594
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
595
+ if ( that.options.range === true ) {
596
+ if ( that.orientation === "horizontal" ) {
597
+ if ( i === 0 ) {
598
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
599
+ }
600
+ if ( i === 1 ) {
601
+ that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
602
+ }
603
+ } else {
604
+ if ( i === 0 ) {
605
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
606
+ }
607
+ if ( i === 1 ) {
608
+ that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
609
+ }
610
+ }
611
+ }
612
+ lastValPercent = valPercent;
613
+ });
614
+ } else {
615
+ value = this.value();
616
+ valueMin = this._valueMin();
617
+ valueMax = this._valueMax();
618
+ valPercent = ( valueMax !== valueMin ) ?
619
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
620
+ 0;
621
+ _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
622
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
623
+
624
+ if ( oRange === "min" && this.orientation === "horizontal" ) {
625
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
626
+ }
627
+ if ( oRange === "max" && this.orientation === "horizontal" ) {
628
+ this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
629
+ }
630
+ if ( oRange === "min" && this.orientation === "vertical" ) {
631
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
632
+ }
633
+ if ( oRange === "max" && this.orientation === "vertical" ) {
634
+ this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
635
+ }
636
+ }
637
+ }
638
+
639
+ });
640
+
641
+ }(jQuery));