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,963 @@
1
+ /*!
2
+ * jQuery UI Resizable @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/resizable/
10
+ *
11
+ * Depends:
12
+ * jquery.ui.core.js
13
+ * jquery.ui.mouse.js
14
+ * jquery.ui.widget.js
15
+ */
16
+ (function( $, undefined ) {
17
+
18
+ function num(v) {
19
+ return parseInt(v, 10) || 0;
20
+ }
21
+
22
+ function isNumber(value) {
23
+ return !isNaN(parseInt(value, 10));
24
+ }
25
+
26
+ $.widget("ui.resizable", $.ui.mouse, {
27
+ version: "@VERSION",
28
+ widgetEventPrefix: "resize",
29
+ options: {
30
+ alsoResize: false,
31
+ animate: false,
32
+ animateDuration: "slow",
33
+ animateEasing: "swing",
34
+ aspectRatio: false,
35
+ autoHide: false,
36
+ containment: false,
37
+ ghost: false,
38
+ grid: false,
39
+ handles: "e,s,se",
40
+ helper: false,
41
+ maxHeight: null,
42
+ maxWidth: null,
43
+ minHeight: 10,
44
+ minWidth: 10,
45
+ // See #7960
46
+ zIndex: 90
47
+ },
48
+ _create: function() {
49
+
50
+ var n, i, handle, axis, hname,
51
+ that = this,
52
+ o = this.options;
53
+ this.element.addClass("ui-resizable");
54
+
55
+ $.extend(this, {
56
+ _aspectRatio: !!(o.aspectRatio),
57
+ aspectRatio: o.aspectRatio,
58
+ originalElement: this.element,
59
+ _proportionallyResizeElements: [],
60
+ _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
61
+ });
62
+
63
+ //Wrap the element if it cannot hold child nodes
64
+ if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
65
+
66
+ //Create a wrapper element and set the wrapper to the new current internal element
67
+ this.element.wrap(
68
+ $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
69
+ position: this.element.css("position"),
70
+ width: this.element.outerWidth(),
71
+ height: this.element.outerHeight(),
72
+ top: this.element.css("top"),
73
+ left: this.element.css("left")
74
+ })
75
+ );
76
+
77
+ //Overwrite the original this.element
78
+ this.element = this.element.parent().data(
79
+ "ui-resizable", this.element.data("ui-resizable")
80
+ );
81
+
82
+ this.elementIsWrapper = true;
83
+
84
+ //Move margins to the wrapper
85
+ this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
86
+ this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
87
+
88
+ //Prevent Safari textarea resize
89
+ this.originalResizeStyle = this.originalElement.css("resize");
90
+ this.originalElement.css("resize", "none");
91
+
92
+ //Push the actual element to our proportionallyResize internal array
93
+ this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" }));
94
+
95
+ // avoid IE jump (hard set the margin)
96
+ this.originalElement.css({ margin: this.originalElement.css("margin") });
97
+
98
+ // fix handlers offset
99
+ this._proportionallyResize();
100
+
101
+ }
102
+
103
+ this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" });
104
+ if(this.handles.constructor === String) {
105
+
106
+ if ( this.handles === "all") {
107
+ this.handles = "n,e,s,w,se,sw,ne,nw";
108
+ }
109
+
110
+ n = this.handles.split(",");
111
+ this.handles = {};
112
+
113
+ for(i = 0; i < n.length; i++) {
114
+
115
+ handle = $.trim(n[i]);
116
+ hname = "ui-resizable-"+handle;
117
+ axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
118
+
119
+ // Apply zIndex to all handles - see #7960
120
+ axis.css({ zIndex: o.zIndex });
121
+
122
+ //TODO : What's going on here?
123
+ if ("se" === handle) {
124
+ axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
125
+ }
126
+
127
+ //Insert into internal handles object and append to element
128
+ this.handles[handle] = ".ui-resizable-"+handle;
129
+ this.element.append(axis);
130
+ }
131
+
132
+ }
133
+
134
+ this._renderAxis = function(target) {
135
+
136
+ var i, axis, padPos, padWrapper;
137
+
138
+ target = target || this.element;
139
+
140
+ for(i in this.handles) {
141
+
142
+ if(this.handles[i].constructor === String) {
143
+ this.handles[i] = $(this.handles[i], this.element).show();
144
+ }
145
+
146
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
147
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
148
+
149
+ axis = $(this.handles[i], this.element);
150
+
151
+ //Checking the correct pad and border
152
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
153
+
154
+ //The padding type i have to apply...
155
+ padPos = [ "padding",
156
+ /ne|nw|n/.test(i) ? "Top" :
157
+ /se|sw|s/.test(i) ? "Bottom" :
158
+ /^e$/.test(i) ? "Right" : "Left" ].join("");
159
+
160
+ target.css(padPos, padWrapper);
161
+
162
+ this._proportionallyResize();
163
+
164
+ }
165
+
166
+ //TODO: What's that good for? There's not anything to be executed left
167
+ if(!$(this.handles[i]).length) {
168
+ continue;
169
+ }
170
+ }
171
+ };
172
+
173
+ //TODO: make renderAxis a prototype function
174
+ this._renderAxis(this.element);
175
+
176
+ this._handles = $(".ui-resizable-handle", this.element)
177
+ .disableSelection();
178
+
179
+ //Matching axis name
180
+ this._handles.mouseover(function() {
181
+ if (!that.resizing) {
182
+ if (this.className) {
183
+ axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
184
+ }
185
+ //Axis, default = se
186
+ that.axis = axis && axis[1] ? axis[1] : "se";
187
+ }
188
+ });
189
+
190
+ //If we want to auto hide the elements
191
+ if (o.autoHide) {
192
+ this._handles.hide();
193
+ $(this.element)
194
+ .addClass("ui-resizable-autohide")
195
+ .mouseenter(function() {
196
+ if (o.disabled) {
197
+ return;
198
+ }
199
+ $(this).removeClass("ui-resizable-autohide");
200
+ that._handles.show();
201
+ })
202
+ .mouseleave(function(){
203
+ if (o.disabled) {
204
+ return;
205
+ }
206
+ if (!that.resizing) {
207
+ $(this).addClass("ui-resizable-autohide");
208
+ that._handles.hide();
209
+ }
210
+ });
211
+ }
212
+
213
+ //Initialize the mouse interaction
214
+ this._mouseInit();
215
+
216
+ },
217
+
218
+ _destroy: function() {
219
+
220
+ this._mouseDestroy();
221
+
222
+ var wrapper,
223
+ _destroy = function(exp) {
224
+ $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
225
+ .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();
226
+ };
227
+
228
+ //TODO: Unwrap at same DOM position
229
+ if (this.elementIsWrapper) {
230
+ _destroy(this.element);
231
+ wrapper = this.element;
232
+ this.originalElement.css({
233
+ position: wrapper.css("position"),
234
+ width: wrapper.outerWidth(),
235
+ height: wrapper.outerHeight(),
236
+ top: wrapper.css("top"),
237
+ left: wrapper.css("left")
238
+ }).insertAfter( wrapper );
239
+ wrapper.remove();
240
+ }
241
+
242
+ this.originalElement.css("resize", this.originalResizeStyle);
243
+ _destroy(this.originalElement);
244
+
245
+ return this;
246
+ },
247
+
248
+ _mouseCapture: function(event) {
249
+ var i, handle,
250
+ capture = false;
251
+
252
+ for (i in this.handles) {
253
+ handle = $(this.handles[i])[0];
254
+ if (handle === event.target || $.contains(handle, event.target)) {
255
+ capture = true;
256
+ }
257
+ }
258
+
259
+ return !this.options.disabled && capture;
260
+ },
261
+
262
+ _mouseStart: function(event) {
263
+
264
+ var curleft, curtop, cursor,
265
+ o = this.options,
266
+ iniPos = this.element.position(),
267
+ el = this.element;
268
+
269
+ this.resizing = true;
270
+
271
+ // bugfix for http://dev.jquery.com/ticket/1749
272
+ if ( (/absolute/).test( el.css("position") ) ) {
273
+ el.css({ position: "absolute", top: el.css("top"), left: el.css("left") });
274
+ } else if (el.is(".ui-draggable")) {
275
+ el.css({ position: "absolute", top: iniPos.top, left: iniPos.left });
276
+ }
277
+
278
+ this._renderProxy();
279
+
280
+ curleft = num(this.helper.css("left"));
281
+ curtop = num(this.helper.css("top"));
282
+
283
+ if (o.containment) {
284
+ curleft += $(o.containment).scrollLeft() || 0;
285
+ curtop += $(o.containment).scrollTop() || 0;
286
+ }
287
+
288
+ //Store needed variables
289
+ this.offset = this.helper.offset();
290
+ this.position = { left: curleft, top: curtop };
291
+ this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
292
+ this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
293
+ this.originalPosition = { left: curleft, top: curtop };
294
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
295
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
296
+
297
+ //Aspect Ratio
298
+ this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
299
+
300
+ cursor = $(".ui-resizable-" + this.axis).css("cursor");
301
+ $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
302
+
303
+ el.addClass("ui-resizable-resizing");
304
+ this._propagate("start", event);
305
+ return true;
306
+ },
307
+
308
+ _mouseDrag: function(event) {
309
+
310
+ //Increase performance, avoid regex
311
+ var data,
312
+ el = this.helper, props = {},
313
+ smp = this.originalMousePosition,
314
+ a = this.axis,
315
+ prevTop = this.position.top,
316
+ prevLeft = this.position.left,
317
+ prevWidth = this.size.width,
318
+ prevHeight = this.size.height,
319
+ dx = (event.pageX-smp.left)||0,
320
+ dy = (event.pageY-smp.top)||0,
321
+ trigger = this._change[a];
322
+
323
+ if (!trigger) {
324
+ return false;
325
+ }
326
+
327
+ // Calculate the attrs that will be change
328
+ data = trigger.apply(this, [event, dx, dy]);
329
+
330
+ // Put this in the mouseDrag handler since the user can start pressing shift while resizing
331
+ this._updateVirtualBoundaries(event.shiftKey);
332
+ if (this._aspectRatio || event.shiftKey) {
333
+ data = this._updateRatio(data, event);
334
+ }
335
+
336
+ data = this._respectSize(data, event);
337
+
338
+ this._updateCache(data);
339
+
340
+ // plugins callbacks need to be called first
341
+ this._propagate("resize", event);
342
+
343
+ if (this.position.top !== prevTop) {
344
+ props.top = this.position.top + "px";
345
+ }
346
+ if (this.position.left !== prevLeft) {
347
+ props.left = this.position.left + "px";
348
+ }
349
+ if (this.size.width !== prevWidth) {
350
+ props.width = this.size.width + "px";
351
+ }
352
+ if (this.size.height !== prevHeight) {
353
+ props.height = this.size.height + "px";
354
+ }
355
+ el.css(props);
356
+
357
+ if (!this._helper && this._proportionallyResizeElements.length) {
358
+ this._proportionallyResize();
359
+ }
360
+
361
+ // Call the user callback if the element was resized
362
+ if ( ! $.isEmptyObject(props) ) {
363
+ this._trigger("resize", event, this.ui());
364
+ }
365
+
366
+ return false;
367
+ },
368
+
369
+ _mouseStop: function(event) {
370
+
371
+ this.resizing = false;
372
+ var pr, ista, soffseth, soffsetw, s, left, top,
373
+ o = this.options, that = this;
374
+
375
+ if(this._helper) {
376
+
377
+ pr = this._proportionallyResizeElements;
378
+ ista = pr.length && (/textarea/i).test(pr[0].nodeName);
379
+ soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
380
+ soffsetw = ista ? 0 : that.sizeDiff.width;
381
+
382
+ s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
383
+ left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null;
384
+ top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
385
+
386
+ if (!o.animate) {
387
+ this.element.css($.extend(s, { top: top, left: left }));
388
+ }
389
+
390
+ that.helper.height(that.size.height);
391
+ that.helper.width(that.size.width);
392
+
393
+ if (this._helper && !o.animate) {
394
+ this._proportionallyResize();
395
+ }
396
+ }
397
+
398
+ $("body").css("cursor", "auto");
399
+
400
+ this.element.removeClass("ui-resizable-resizing");
401
+
402
+ this._propagate("stop", event);
403
+
404
+ if (this._helper) {
405
+ this.helper.remove();
406
+ }
407
+
408
+ return false;
409
+
410
+ },
411
+
412
+ _updateVirtualBoundaries: function(forceAspectRatio) {
413
+ var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
414
+ o = this.options;
415
+
416
+ b = {
417
+ minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
418
+ maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
419
+ minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
420
+ maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
421
+ };
422
+
423
+ if(this._aspectRatio || forceAspectRatio) {
424
+ // We want to create an enclosing box whose aspect ration is the requested one
425
+ // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
426
+ pMinWidth = b.minHeight * this.aspectRatio;
427
+ pMinHeight = b.minWidth / this.aspectRatio;
428
+ pMaxWidth = b.maxHeight * this.aspectRatio;
429
+ pMaxHeight = b.maxWidth / this.aspectRatio;
430
+
431
+ if(pMinWidth > b.minWidth) {
432
+ b.minWidth = pMinWidth;
433
+ }
434
+ if(pMinHeight > b.minHeight) {
435
+ b.minHeight = pMinHeight;
436
+ }
437
+ if(pMaxWidth < b.maxWidth) {
438
+ b.maxWidth = pMaxWidth;
439
+ }
440
+ if(pMaxHeight < b.maxHeight) {
441
+ b.maxHeight = pMaxHeight;
442
+ }
443
+ }
444
+ this._vBoundaries = b;
445
+ },
446
+
447
+ _updateCache: function(data) {
448
+ this.offset = this.helper.offset();
449
+ if (isNumber(data.left)) {
450
+ this.position.left = data.left;
451
+ }
452
+ if (isNumber(data.top)) {
453
+ this.position.top = data.top;
454
+ }
455
+ if (isNumber(data.height)) {
456
+ this.size.height = data.height;
457
+ }
458
+ if (isNumber(data.width)) {
459
+ this.size.width = data.width;
460
+ }
461
+ },
462
+
463
+ _updateRatio: function( data ) {
464
+
465
+ var cpos = this.position,
466
+ csize = this.size,
467
+ a = this.axis;
468
+
469
+ if (isNumber(data.height)) {
470
+ data.width = (data.height * this.aspectRatio);
471
+ } else if (isNumber(data.width)) {
472
+ data.height = (data.width / this.aspectRatio);
473
+ }
474
+
475
+ if (a === "sw") {
476
+ data.left = cpos.left + (csize.width - data.width);
477
+ data.top = null;
478
+ }
479
+ if (a === "nw") {
480
+ data.top = cpos.top + (csize.height - data.height);
481
+ data.left = cpos.left + (csize.width - data.width);
482
+ }
483
+
484
+ return data;
485
+ },
486
+
487
+ _respectSize: function( data ) {
488
+
489
+ var o = this._vBoundaries,
490
+ a = this.axis,
491
+ ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
492
+ isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
493
+ dw = this.originalPosition.left + this.originalSize.width,
494
+ dh = this.position.top + this.size.height,
495
+ cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
496
+ if (isminw) {
497
+ data.width = o.minWidth;
498
+ }
499
+ if (isminh) {
500
+ data.height = o.minHeight;
501
+ }
502
+ if (ismaxw) {
503
+ data.width = o.maxWidth;
504
+ }
505
+ if (ismaxh) {
506
+ data.height = o.maxHeight;
507
+ }
508
+
509
+ if (isminw && cw) {
510
+ data.left = dw - o.minWidth;
511
+ }
512
+ if (ismaxw && cw) {
513
+ data.left = dw - o.maxWidth;
514
+ }
515
+ if (isminh && ch) {
516
+ data.top = dh - o.minHeight;
517
+ }
518
+ if (ismaxh && ch) {
519
+ data.top = dh - o.maxHeight;
520
+ }
521
+
522
+ // fixing jump error on top/left - bug #2330
523
+ if (!data.width && !data.height && !data.left && data.top) {
524
+ data.top = null;
525
+ } else if (!data.width && !data.height && !data.top && data.left) {
526
+ data.left = null;
527
+ }
528
+
529
+ return data;
530
+ },
531
+
532
+ _proportionallyResize: function() {
533
+
534
+ if (!this._proportionallyResizeElements.length) {
535
+ return;
536
+ }
537
+
538
+ var i, j, borders, paddings, prel,
539
+ element = this.helper || this.element;
540
+
541
+ for ( i=0; i < this._proportionallyResizeElements.length; i++) {
542
+
543
+ prel = this._proportionallyResizeElements[i];
544
+
545
+ if (!this.borderDif) {
546
+ this.borderDif = [];
547
+ borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")];
548
+ paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];
549
+
550
+ for ( j = 0; j < borders.length; j++ ) {
551
+ this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
552
+ }
553
+ }
554
+
555
+ prel.css({
556
+ height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
557
+ width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
558
+ });
559
+
560
+ }
561
+
562
+ },
563
+
564
+ _renderProxy: function() {
565
+
566
+ var el = this.element, o = this.options;
567
+ this.elementOffset = el.offset();
568
+
569
+ if(this._helper) {
570
+
571
+ this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
572
+
573
+ this.helper.addClass(this._helper).css({
574
+ width: this.element.outerWidth() - 1,
575
+ height: this.element.outerHeight() - 1,
576
+ position: "absolute",
577
+ left: this.elementOffset.left +"px",
578
+ top: this.elementOffset.top +"px",
579
+ zIndex: ++o.zIndex //TODO: Don't modify option
580
+ });
581
+
582
+ this.helper
583
+ .appendTo("body")
584
+ .disableSelection();
585
+
586
+ } else {
587
+ this.helper = this.element;
588
+ }
589
+
590
+ },
591
+
592
+ _change: {
593
+ e: function(event, dx) {
594
+ return { width: this.originalSize.width + dx };
595
+ },
596
+ w: function(event, dx) {
597
+ var cs = this.originalSize, sp = this.originalPosition;
598
+ return { left: sp.left + dx, width: cs.width - dx };
599
+ },
600
+ n: function(event, dx, dy) {
601
+ var cs = this.originalSize, sp = this.originalPosition;
602
+ return { top: sp.top + dy, height: cs.height - dy };
603
+ },
604
+ s: function(event, dx, dy) {
605
+ return { height: this.originalSize.height + dy };
606
+ },
607
+ se: function(event, dx, dy) {
608
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
609
+ },
610
+ sw: function(event, dx, dy) {
611
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
612
+ },
613
+ ne: function(event, dx, dy) {
614
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
615
+ },
616
+ nw: function(event, dx, dy) {
617
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
618
+ }
619
+ },
620
+
621
+ _propagate: function(n, event) {
622
+ $.ui.plugin.call(this, n, [event, this.ui()]);
623
+ (n !== "resize" && this._trigger(n, event, this.ui()));
624
+ },
625
+
626
+ plugins: {},
627
+
628
+ ui: function() {
629
+ return {
630
+ originalElement: this.originalElement,
631
+ element: this.element,
632
+ helper: this.helper,
633
+ position: this.position,
634
+ size: this.size,
635
+ originalSize: this.originalSize,
636
+ originalPosition: this.originalPosition
637
+ };
638
+ }
639
+
640
+ });
641
+
642
+ /*
643
+ * Resizable Extensions
644
+ */
645
+
646
+ $.ui.plugin.add("resizable", "animate", {
647
+
648
+ stop: function( event ) {
649
+ var that = $(this).data("ui-resizable"),
650
+ o = that.options,
651
+ pr = that._proportionallyResizeElements,
652
+ ista = pr.length && (/textarea/i).test(pr[0].nodeName),
653
+ soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
654
+ soffsetw = ista ? 0 : that.sizeDiff.width,
655
+ style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
656
+ left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null,
657
+ top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
658
+
659
+ that.element.animate(
660
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
661
+ duration: o.animateDuration,
662
+ easing: o.animateEasing,
663
+ step: function() {
664
+
665
+ var data = {
666
+ width: parseInt(that.element.css("width"), 10),
667
+ height: parseInt(that.element.css("height"), 10),
668
+ top: parseInt(that.element.css("top"), 10),
669
+ left: parseInt(that.element.css("left"), 10)
670
+ };
671
+
672
+ if (pr && pr.length) {
673
+ $(pr[0]).css({ width: data.width, height: data.height });
674
+ }
675
+
676
+ // propagating resize, and updating values for each animation step
677
+ that._updateCache(data);
678
+ that._propagate("resize", event);
679
+
680
+ }
681
+ }
682
+ );
683
+ }
684
+
685
+ });
686
+
687
+ $.ui.plugin.add("resizable", "containment", {
688
+
689
+ start: function() {
690
+ var element, p, co, ch, cw, width, height,
691
+ that = $(this).data("ui-resizable"),
692
+ o = that.options,
693
+ el = that.element,
694
+ oc = o.containment,
695
+ ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
696
+
697
+ if (!ce) {
698
+ return;
699
+ }
700
+
701
+ that.containerElement = $(ce);
702
+
703
+ if (/document/.test(oc) || oc === document) {
704
+ that.containerOffset = { left: 0, top: 0 };
705
+ that.containerPosition = { left: 0, top: 0 };
706
+
707
+ that.parentData = {
708
+ element: $(document), left: 0, top: 0,
709
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
710
+ };
711
+ }
712
+
713
+ // i'm a node, so compute top, left, right, bottom
714
+ else {
715
+ element = $(ce);
716
+ p = [];
717
+ $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
718
+
719
+ that.containerOffset = element.offset();
720
+ that.containerPosition = element.position();
721
+ that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
722
+
723
+ co = that.containerOffset;
724
+ ch = that.containerSize.height;
725
+ cw = that.containerSize.width;
726
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw );
727
+ height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
728
+
729
+ that.parentData = {
730
+ element: ce, left: co.left, top: co.top, width: width, height: height
731
+ };
732
+ }
733
+ },
734
+
735
+ resize: function( event ) {
736
+ var woset, hoset, isParent, isOffsetRelative,
737
+ that = $(this).data("ui-resizable"),
738
+ o = that.options,
739
+ co = that.containerOffset, cp = that.position,
740
+ pRatio = that._aspectRatio || event.shiftKey,
741
+ cop = { top:0, left:0 }, ce = that.containerElement;
742
+
743
+ if (ce[0] !== document && (/static/).test(ce.css("position"))) {
744
+ cop = co;
745
+ }
746
+
747
+ if (cp.left < (that._helper ? co.left : 0)) {
748
+ that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
749
+ if (pRatio) {
750
+ that.size.height = that.size.width / that.aspectRatio;
751
+ }
752
+ that.position.left = o.helper ? co.left : 0;
753
+ }
754
+
755
+ if (cp.top < (that._helper ? co.top : 0)) {
756
+ that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
757
+ if (pRatio) {
758
+ that.size.width = that.size.height * that.aspectRatio;
759
+ }
760
+ that.position.top = that._helper ? co.top : 0;
761
+ }
762
+
763
+ that.offset.left = that.parentData.left+that.position.left;
764
+ that.offset.top = that.parentData.top+that.position.top;
765
+
766
+ woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width );
767
+ hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
768
+
769
+ isParent = that.containerElement.get(0) === that.element.parent().get(0);
770
+ isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));
771
+
772
+ if(isParent && isOffsetRelative) {
773
+ woset -= that.parentData.left;
774
+ }
775
+
776
+ if (woset + that.size.width >= that.parentData.width) {
777
+ that.size.width = that.parentData.width - woset;
778
+ if (pRatio) {
779
+ that.size.height = that.size.width / that.aspectRatio;
780
+ }
781
+ }
782
+
783
+ if (hoset + that.size.height >= that.parentData.height) {
784
+ that.size.height = that.parentData.height - hoset;
785
+ if (pRatio) {
786
+ that.size.width = that.size.height * that.aspectRatio;
787
+ }
788
+ }
789
+ },
790
+
791
+ stop: function(){
792
+ var that = $(this).data("ui-resizable"),
793
+ o = that.options,
794
+ co = that.containerOffset,
795
+ cop = that.containerPosition,
796
+ ce = that.containerElement,
797
+ helper = $(that.helper),
798
+ ho = helper.offset(),
799
+ w = helper.outerWidth() - that.sizeDiff.width,
800
+ h = helper.outerHeight() - that.sizeDiff.height;
801
+
802
+ if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
803
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
804
+ }
805
+
806
+ if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
807
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
808
+ }
809
+
810
+ }
811
+ });
812
+
813
+ $.ui.plugin.add("resizable", "alsoResize", {
814
+
815
+ start: function () {
816
+ var that = $(this).data("ui-resizable"),
817
+ o = that.options,
818
+ _store = function (exp) {
819
+ $(exp).each(function() {
820
+ var el = $(this);
821
+ el.data("ui-resizable-alsoresize", {
822
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
823
+ left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
824
+ });
825
+ });
826
+ };
827
+
828
+ if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) {
829
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
830
+ else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
831
+ }else{
832
+ _store(o.alsoResize);
833
+ }
834
+ },
835
+
836
+ resize: function (event, ui) {
837
+ var that = $(this).data("ui-resizable"),
838
+ o = that.options,
839
+ os = that.originalSize,
840
+ op = that.originalPosition,
841
+ delta = {
842
+ height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
843
+ top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
844
+ },
845
+
846
+ _alsoResize = function (exp, c) {
847
+ $(exp).each(function() {
848
+ var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
849
+ css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
850
+
851
+ $.each(css, function (i, prop) {
852
+ var sum = (start[prop]||0) + (delta[prop]||0);
853
+ if (sum && sum >= 0) {
854
+ style[prop] = sum || null;
855
+ }
856
+ });
857
+
858
+ el.css(style);
859
+ });
860
+ };
861
+
862
+ if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
863
+ $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
864
+ }else{
865
+ _alsoResize(o.alsoResize);
866
+ }
867
+ },
868
+
869
+ stop: function () {
870
+ $(this).removeData("resizable-alsoresize");
871
+ }
872
+ });
873
+
874
+ $.ui.plugin.add("resizable", "ghost", {
875
+
876
+ start: function() {
877
+
878
+ var that = $(this).data("ui-resizable"), o = that.options, cs = that.size;
879
+
880
+ that.ghost = that.originalElement.clone();
881
+ that.ghost
882
+ .css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
883
+ .addClass("ui-resizable-ghost")
884
+ .addClass(typeof o.ghost === "string" ? o.ghost : "");
885
+
886
+ that.ghost.appendTo(that.helper);
887
+
888
+ },
889
+
890
+ resize: function(){
891
+ var that = $(this).data("ui-resizable");
892
+ if (that.ghost) {
893
+ that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width });
894
+ }
895
+ },
896
+
897
+ stop: function() {
898
+ var that = $(this).data("ui-resizable");
899
+ if (that.ghost && that.helper) {
900
+ that.helper.get(0).removeChild(that.ghost.get(0));
901
+ }
902
+ }
903
+
904
+ });
905
+
906
+ $.ui.plugin.add("resizable", "grid", {
907
+
908
+ resize: function() {
909
+ var that = $(this).data("ui-resizable"),
910
+ o = that.options,
911
+ cs = that.size,
912
+ os = that.originalSize,
913
+ op = that.originalPosition,
914
+ a = that.axis,
915
+ grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
916
+ gridX = (grid[0]||1),
917
+ gridY = (grid[1]||1),
918
+ ox = Math.round((cs.width - os.width) / gridX) * gridX,
919
+ oy = Math.round((cs.height - os.height) / gridY) * gridY,
920
+ newWidth = os.width + ox,
921
+ newHeight = os.height + oy,
922
+ isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
923
+ isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
924
+ isMinWidth = o.minWidth && (o.minWidth > newWidth),
925
+ isMinHeight = o.minHeight && (o.minHeight > newHeight);
926
+
927
+ o.grid = grid;
928
+
929
+ if (isMinWidth) {
930
+ newWidth = newWidth + gridX;
931
+ }
932
+ if (isMinHeight) {
933
+ newHeight = newHeight + gridY;
934
+ }
935
+ if (isMaxWidth) {
936
+ newWidth = newWidth - gridX;
937
+ }
938
+ if (isMaxHeight) {
939
+ newHeight = newHeight - gridY;
940
+ }
941
+
942
+ if (/^(se|s|e)$/.test(a)) {
943
+ that.size.width = newWidth;
944
+ that.size.height = newHeight;
945
+ } else if (/^(ne)$/.test(a)) {
946
+ that.size.width = newWidth;
947
+ that.size.height = newHeight;
948
+ that.position.top = op.top - oy;
949
+ } else if (/^(sw)$/.test(a)) {
950
+ that.size.width = newWidth;
951
+ that.size.height = newHeight;
952
+ that.position.left = op.left - ox;
953
+ } else {
954
+ that.size.width = newWidth;
955
+ that.size.height = newHeight;
956
+ that.position.top = op.top - oy;
957
+ that.position.left = op.left - ox;
958
+ }
959
+ }
960
+
961
+ });
962
+
963
+ })(jQuery);