stuff_to_do_plugin 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. data/COPYRIGHT.txt +18 -0
  2. data/CREDITS.txt +6 -0
  3. data/GPL.txt +339 -0
  4. data/README.rdoc +61 -0
  5. data/Rakefile +38 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/stuff_to_do_controller.rb +161 -0
  8. data/app/helpers/stuff_to_do_helper.rb +88 -0
  9. data/app/models/stuff_to_do.rb +208 -0
  10. data/app/models/stuff_to_do_filter.rb +32 -0
  11. data/app/models/stuff_to_do_mailer.rb +16 -0
  12. data/app/views/settings/_stuff_to_do_settings.html.erb +27 -0
  13. data/app/views/stuff_to_do/_issue.html.erb +16 -0
  14. data/app/views/stuff_to_do/_item.html.erb +5 -0
  15. data/app/views/stuff_to_do/_left_panes.html.erb +51 -0
  16. data/app/views/stuff_to_do/_panes.html.erb +11 -0
  17. data/app/views/stuff_to_do/_project.html.erb +6 -0
  18. data/app/views/stuff_to_do/_right_panes.html.erb +25 -0
  19. data/app/views/stuff_to_do/_time_grid.html.erb +113 -0
  20. data/app/views/stuff_to_do/_time_grid_form.html.erb +32 -0
  21. data/app/views/stuff_to_do/index.html.erb +44 -0
  22. data/app/views/stuff_to_do_mailer/recommended_below_threshold.erb +3 -0
  23. data/app/views/stuff_to_do_mailer/recommended_below_threshold.text.html.rhtml +1 -0
  24. data/assets/images/b.png +0 -0
  25. data/assets/images/bl.png +0 -0
  26. data/assets/images/br.png +0 -0
  27. data/assets/images/closelabel.gif +0 -0
  28. data/assets/images/loading.gif +0 -0
  29. data/assets/images/tl.png +0 -0
  30. data/assets/images/tr.png +0 -0
  31. data/assets/javascripts/facebox.js +319 -0
  32. data/assets/javascripts/jquery-1.2.6.min.js +32 -0
  33. data/assets/javascripts/jquery-ui.js +2839 -0
  34. data/assets/javascripts/jquery.contextMenu.js +212 -0
  35. data/assets/javascripts/semantic.cache +15 -0
  36. data/assets/javascripts/stuff-to-do.js +270 -0
  37. data/assets/javascripts/ui/build.xml +24 -0
  38. data/assets/javascripts/ui/effects.blind.js +49 -0
  39. data/assets/javascripts/ui/effects.bounce.js +78 -0
  40. data/assets/javascripts/ui/effects.clip.js +54 -0
  41. data/assets/javascripts/ui/effects.core.js +510 -0
  42. data/assets/javascripts/ui/effects.drop.js +50 -0
  43. data/assets/javascripts/ui/effects.explode.js +79 -0
  44. data/assets/javascripts/ui/effects.fold.js +55 -0
  45. data/assets/javascripts/ui/effects.highlight.js +48 -0
  46. data/assets/javascripts/ui/effects.pulsate.js +55 -0
  47. data/assets/javascripts/ui/effects.scale.js +180 -0
  48. data/assets/javascripts/ui/effects.shake.js +57 -0
  49. data/assets/javascripts/ui/effects.slide.js +50 -0
  50. data/assets/javascripts/ui/effects.transfer.js +59 -0
  51. data/assets/javascripts/ui/i18n/ui.datepicker-ar.js +26 -0
  52. data/assets/javascripts/ui/i18n/ui.datepicker-bg.js +25 -0
  53. data/assets/javascripts/ui/i18n/ui.datepicker-ca.js +25 -0
  54. data/assets/javascripts/ui/i18n/ui.datepicker-cs.js +25 -0
  55. data/assets/javascripts/ui/i18n/ui.datepicker-da.js +25 -0
  56. data/assets/javascripts/ui/i18n/ui.datepicker-de.js +25 -0
  57. data/assets/javascripts/ui/i18n/ui.datepicker-eo.js +25 -0
  58. data/assets/javascripts/ui/i18n/ui.datepicker-es.js +25 -0
  59. data/assets/javascripts/ui/i18n/ui.datepicker-fa.js +25 -0
  60. data/assets/javascripts/ui/i18n/ui.datepicker-fi.js +25 -0
  61. data/assets/javascripts/ui/i18n/ui.datepicker-fr.js +25 -0
  62. data/assets/javascripts/ui/i18n/ui.datepicker-he.js +25 -0
  63. data/assets/javascripts/ui/i18n/ui.datepicker-hr.js +25 -0
  64. data/assets/javascripts/ui/i18n/ui.datepicker-hu.js +25 -0
  65. data/assets/javascripts/ui/i18n/ui.datepicker-hy.js +25 -0
  66. data/assets/javascripts/ui/i18n/ui.datepicker-id.js +25 -0
  67. data/assets/javascripts/ui/i18n/ui.datepicker-is.js +25 -0
  68. data/assets/javascripts/ui/i18n/ui.datepicker-it.js +25 -0
  69. data/assets/javascripts/ui/i18n/ui.datepicker-ja.js +26 -0
  70. data/assets/javascripts/ui/i18n/ui.datepicker-ko.js +25 -0
  71. data/assets/javascripts/ui/i18n/ui.datepicker-lt.js +25 -0
  72. data/assets/javascripts/ui/i18n/ui.datepicker-lv.js +25 -0
  73. data/assets/javascripts/ui/i18n/ui.datepicker-nl.js +25 -0
  74. data/assets/javascripts/ui/i18n/ui.datepicker-no.js +25 -0
  75. data/assets/javascripts/ui/i18n/ui.datepicker-pl.js +25 -0
  76. data/assets/javascripts/ui/i18n/ui.datepicker-pt-BR.js +25 -0
  77. data/assets/javascripts/ui/i18n/ui.datepicker-ro.js +25 -0
  78. data/assets/javascripts/ui/i18n/ui.datepicker-ru.js +25 -0
  79. data/assets/javascripts/ui/i18n/ui.datepicker-sk.js +25 -0
  80. data/assets/javascripts/ui/i18n/ui.datepicker-sl.js +26 -0
  81. data/assets/javascripts/ui/i18n/ui.datepicker-sq.js +25 -0
  82. data/assets/javascripts/ui/i18n/ui.datepicker-sv.js +25 -0
  83. data/assets/javascripts/ui/i18n/ui.datepicker-th.js +25 -0
  84. data/assets/javascripts/ui/i18n/ui.datepicker-tr.js +25 -0
  85. data/assets/javascripts/ui/i18n/ui.datepicker-uk.js +25 -0
  86. data/assets/javascripts/ui/i18n/ui.datepicker-zh-CN.js +25 -0
  87. data/assets/javascripts/ui/i18n/ui.datepicker-zh-TW.js +25 -0
  88. data/assets/javascripts/ui/svn.log +11 -0
  89. data/assets/javascripts/ui/ui.accordion.js +400 -0
  90. data/assets/javascripts/ui/ui.core.js +533 -0
  91. data/assets/javascripts/ui/ui.datepicker.js +1754 -0
  92. data/assets/javascripts/ui/ui.dialog.js +630 -0
  93. data/assets/javascripts/ui/ui.draggable.js +696 -0
  94. data/assets/javascripts/ui/ui.droppable.js +314 -0
  95. data/assets/javascripts/ui/ui.progressbar.js +114 -0
  96. data/assets/javascripts/ui/ui.resizable.js +805 -0
  97. data/assets/javascripts/ui/ui.selectable.js +266 -0
  98. data/assets/javascripts/ui/ui.slider.js +552 -0
  99. data/assets/javascripts/ui/ui.sortable.js +1012 -0
  100. data/assets/javascripts/ui/ui.tabs.js +572 -0
  101. data/assets/stylesheets/stuff_to_do.css +216 -0
  102. data/config/locales/bg.yml +18 -0
  103. data/config/locales/ca-fr.yml +18 -0
  104. data/config/locales/cs.yml +16 -0
  105. data/config/locales/da.yml +16 -0
  106. data/config/locales/de.yml +18 -0
  107. data/config/locales/en.yml +24 -0
  108. data/config/locales/es.yml +19 -0
  109. data/config/locales/fr.yml +17 -0
  110. data/config/locales/hu.yml +16 -0
  111. data/config/locales/it.yml +16 -0
  112. data/config/locales/ja.yml +18 -0
  113. data/config/locales/ko.yml +18 -0
  114. data/config/locales/lt.yml +18 -0
  115. data/config/locales/nl.yml +20 -0
  116. data/config/locales/pt-BR.yml +18 -0
  117. data/config/locales/ru.yml +19 -0
  118. data/config/locales/sv.yml +19 -0
  119. data/config/locales/tr.yml +18 -0
  120. data/config/routes.rb +3 -0
  121. data/init.rb +54 -0
  122. data/lang/bg.yml +17 -0
  123. data/lang/ca-fr.yml +17 -0
  124. data/lang/cs.yml +15 -0
  125. data/lang/da.yml +15 -0
  126. data/lang/de.yml +17 -0
  127. data/lang/en.yml +21 -0
  128. data/lang/es.yml +18 -0
  129. data/lang/fr.yml +16 -0
  130. data/lang/hu.yml +15 -0
  131. data/lang/it.yml +15 -0
  132. data/lang/ja.yml +17 -0
  133. data/lang/ko.yml +17 -0
  134. data/lang/lt.yml +17 -0
  135. data/lang/pt-br.yml +17 -0
  136. data/lang/ru.yml +15 -0
  137. data/lang/sv.yml +18 -0
  138. data/lang/tr.yml +17 -0
  139. data/lib/redmine_stuff_to_do/stuff_to_do_compatibility.rb +15 -0
  140. data/lib/stuff_to_do_array_patch.rb +8 -0
  141. data/lib/stuff_to_do_issue_patch.rb +57 -0
  142. data/lib/stuff_to_do_project_patch.rb +31 -0
  143. data/lib/stuff_to_do_user_patch.rb +10 -0
  144. data/rails/init.rb +1 -0
  145. data/spec/controllers/stuff_to_do_controller_add_to_time_grid_spec.rb +58 -0
  146. data/spec/controllers/stuff_to_do_controller_index_spec.rb +155 -0
  147. data/spec/controllers/stuff_to_do_controller_remove_from_time_grid_spec.rb +56 -0
  148. data/spec/controllers/stuff_to_do_controller_reorder_spec.rb +179 -0
  149. data/spec/controllers/stuff_to_do_controller_save_time_entries_spec.rb +56 -0
  150. data/spec/controllers/stuff_to_do_private_methods_spec.rb +82 -0
  151. data/spec/lib/stuff_to_do_issue_patch_spec.rb +60 -0
  152. data/spec/lib/stuff_to_do_project_patch_spec.rb +50 -0
  153. data/spec/lib/stuff_to_do_user_patch_spec.rb +8 -0
  154. data/spec/models/stuff_to_do_filter_spec.rb +3 -0
  155. data/spec/models/stuff_to_do_mailer_spec.rb +42 -0
  156. data/spec/models/stuff_to_do_spec.rb +426 -0
  157. data/spec/sanity_spec.rb +7 -0
  158. data/spec/spec_helper.rb +130 -0
  159. metadata +211 -0
@@ -0,0 +1,314 @@
1
+ /*
2
+ * jQuery UI Droppable @VERSION
3
+ *
4
+ * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Droppables
9
+ *
10
+ * Depends:
11
+ * ui.core.js
12
+ * ui.draggable.js
13
+ */
14
+ (function($) {
15
+
16
+ $.widget("ui.droppable", {
17
+
18
+ _init: function() {
19
+
20
+ var o = this.options, accept = o.accept;
21
+ this.isover = 0; this.isout = 1;
22
+
23
+ this.options.accept = this.options.accept && $.isFunction(this.options.accept) ? this.options.accept : function(d) {
24
+ return d.is(accept);
25
+ };
26
+
27
+ //Store the droppable's proportions
28
+ this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
29
+
30
+ // Add the reference and positions to the manager
31
+ $.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
32
+ $.ui.ddmanager.droppables[this.options.scope].push(this);
33
+
34
+ (this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-droppable"));
35
+
36
+ },
37
+
38
+ destroy: function() {
39
+ var drop = $.ui.ddmanager.droppables[this.options.scope];
40
+ for ( var i = 0; i < drop.length; i++ )
41
+ if ( drop[i] == this )
42
+ drop.splice(i, 1);
43
+
44
+ this.element
45
+ .removeClass("ui-droppable-disabled")
46
+ .removeData("droppable")
47
+ .unbind(".droppable");
48
+ },
49
+
50
+ _setData: function(key, value) {
51
+
52
+ if(key == 'accept') {
53
+ this.options.accept = value && $.isFunction(value) ? value : function(d) {
54
+ return d.is(accept);
55
+ };
56
+ } else {
57
+ $.widget.prototype._setData.apply(this, arguments);
58
+ }
59
+
60
+ },
61
+
62
+ _activate: function(event) {
63
+
64
+ var draggable = $.ui.ddmanager.current;
65
+ $.ui.plugin.call(this, 'activate', [event, this.ui(draggable)]);
66
+ if(draggable) this.element.triggerHandler("dropactivate", [event, this.ui(draggable)], this.options.activate);
67
+
68
+ },
69
+
70
+ _deactivate: function(event) {
71
+
72
+ var draggable = $.ui.ddmanager.current;
73
+ $.ui.plugin.call(this, 'deactivate', [event, this.ui(draggable)]);
74
+ if(draggable) this.element.triggerHandler("dropdeactivate", [event, this.ui(draggable)], this.options.deactivate);
75
+
76
+ },
77
+
78
+ _over: function(event) {
79
+
80
+ var draggable = $.ui.ddmanager.current;
81
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
82
+
83
+ if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
84
+ $.ui.plugin.call(this, 'over', [event, this.ui(draggable)]);
85
+ this.element.triggerHandler("dropover", [event, this.ui(draggable)], this.options.over);
86
+ }
87
+
88
+ },
89
+
90
+ _out: function(event) {
91
+
92
+ var draggable = $.ui.ddmanager.current;
93
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
94
+
95
+ if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
96
+ $.ui.plugin.call(this, 'out', [event, this.ui(draggable)]);
97
+ this.element.triggerHandler("dropout", [event, this.ui(draggable)], this.options.out);
98
+ }
99
+
100
+ },
101
+
102
+ _drop: function(event,custom) {
103
+
104
+ var draggable = custom || $.ui.ddmanager.current;
105
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
106
+
107
+ var childrenIntersection = false;
108
+ this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
109
+ var inst = $.data(this, 'droppable');
110
+ if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
111
+ childrenIntersection = true; return false;
112
+ }
113
+ });
114
+ if(childrenIntersection) return false;
115
+
116
+ if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
117
+ $.ui.plugin.call(this, 'drop', [event, this.ui(draggable)]);
118
+ this.element.triggerHandler("drop", [event, this.ui(draggable)], this.options.drop);
119
+ return this.element;
120
+ }
121
+
122
+ return false;
123
+
124
+ },
125
+
126
+ plugins: {},
127
+
128
+ ui: function(c) {
129
+ return {
130
+ draggable: (c.currentItem || c.element),
131
+ helper: c.helper,
132
+ position: c.position,
133
+ absolutePosition: c.positionAbs,
134
+ options: this.options,
135
+ element: this.element
136
+ };
137
+ }
138
+
139
+ });
140
+
141
+ $.extend($.ui.droppable, {
142
+ version: "@VERSION",
143
+ defaults: {
144
+ activeClass: null,
145
+ cssNamespace: 'ui',
146
+ greedy: false,
147
+ hoverClass: null,
148
+ scope: 'default',
149
+ tolerance: 'intersect'
150
+ }
151
+ });
152
+
153
+ $.ui.intersect = function(draggable, droppable, toleranceMode) {
154
+
155
+ if (!droppable.offset) return false;
156
+
157
+ var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
158
+ y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
159
+ var l = droppable.offset.left, r = l + droppable.proportions.width,
160
+ t = droppable.offset.top, b = t + droppable.proportions.height;
161
+
162
+ switch (toleranceMode) {
163
+ case 'fit':
164
+ return (l < x1 && x2 < r
165
+ && t < y1 && y2 < b);
166
+ break;
167
+ case 'intersect':
168
+ return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
169
+ && x2 - (draggable.helperProportions.width / 2) < r // Left Half
170
+ && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
171
+ && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
172
+ break;
173
+ case 'pointer':
174
+ var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
175
+ draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
176
+ isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
177
+ return isOver;
178
+ break;
179
+ case 'touch':
180
+ return (
181
+ (y1 >= t && y1 <= b) || // Top edge touching
182
+ (y2 >= t && y2 <= b) || // Bottom edge touching
183
+ (y1 < t && y2 > b) // Surrounded vertically
184
+ ) && (
185
+ (x1 >= l && x1 <= r) || // Left edge touching
186
+ (x2 >= l && x2 <= r) || // Right edge touching
187
+ (x1 < l && x2 > r) // Surrounded horizontally
188
+ );
189
+ break;
190
+ default:
191
+ return false;
192
+ break;
193
+ }
194
+
195
+ };
196
+
197
+ /*
198
+ This manager tracks offsets of draggables and droppables
199
+ */
200
+ $.ui.ddmanager = {
201
+ current: null,
202
+ droppables: { 'default': [] },
203
+ prepareOffsets: function(t, event) {
204
+
205
+ var m = $.ui.ddmanager.droppables[t.options.scope];
206
+ var type = event ? event.type : null; // workaround for #2317
207
+ var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
208
+
209
+ droppablesLoop: for (var i = 0; i < m.length; i++) {
210
+
211
+ if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element,(t.currentItem || t.element)))) continue; //No disabled and non-accepted
212
+ for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
213
+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
214
+
215
+ m[i].offset = m[i].element.offset();
216
+ m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
217
+
218
+ if(type == "dragstart" || type == "sortactivate") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
219
+
220
+ }
221
+
222
+ },
223
+ drop: function(draggable, event) {
224
+
225
+ var dropped = false;
226
+ $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
227
+
228
+ if(!this.options) return;
229
+ if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
230
+ dropped = this._drop.call(this, event);
231
+
232
+ if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
233
+ this.isout = 1; this.isover = 0;
234
+ this._deactivate.call(this, event);
235
+ }
236
+
237
+ });
238
+ return dropped;
239
+
240
+ },
241
+ drag: function(draggable, event) {
242
+
243
+ //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
244
+ if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
245
+
246
+ //Run through all droppables and check their positions based on specific tolerance options
247
+
248
+ $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
249
+
250
+ if(this.options.disabled || this.greedyChild || !this.visible) return;
251
+ var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
252
+
253
+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
254
+ if(!c) return;
255
+
256
+ var parentInstance;
257
+ if (this.options.greedy) {
258
+ var parent = this.element.parents(':data(droppable):eq(0)');
259
+ if (parent.length) {
260
+ parentInstance = $.data(parent[0], 'droppable');
261
+ parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
262
+ }
263
+ }
264
+
265
+ // we just moved into a greedy child
266
+ if (parentInstance && c == 'isover') {
267
+ parentInstance['isover'] = 0;
268
+ parentInstance['isout'] = 1;
269
+ parentInstance._out.call(parentInstance, event);
270
+ }
271
+
272
+ this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
273
+ this[c == "isover" ? "_over" : "_out"].call(this, event);
274
+
275
+ // we just moved out of a greedy child
276
+ if (parentInstance && c == 'isout') {
277
+ parentInstance['isout'] = 0;
278
+ parentInstance['isover'] = 1;
279
+ parentInstance._over.call(parentInstance, event);
280
+ }
281
+ });
282
+
283
+ }
284
+ };
285
+
286
+ /*
287
+ * Droppable Extensions
288
+ */
289
+
290
+ $.ui.plugin.add("droppable", "activeClass", {
291
+ activate: function(event, ui) {
292
+ $(this).addClass(ui.options.activeClass);
293
+ },
294
+ deactivate: function(event, ui) {
295
+ $(this).removeClass(ui.options.activeClass);
296
+ },
297
+ drop: function(event, ui) {
298
+ $(this).removeClass(ui.options.activeClass);
299
+ }
300
+ });
301
+
302
+ $.ui.plugin.add("droppable", "hoverClass", {
303
+ over: function(event, ui) {
304
+ $(this).addClass(ui.options.hoverClass);
305
+ },
306
+ out: function(event, ui) {
307
+ $(this).removeClass(ui.options.hoverClass);
308
+ },
309
+ drop: function(event, ui) {
310
+ $(this).removeClass(ui.options.hoverClass);
311
+ }
312
+ });
313
+
314
+ })(jQuery);
@@ -0,0 +1,114 @@
1
+ /*
2
+ * jQuery UI Progressbar @VERSION
3
+ *
4
+ * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Progressbar
9
+ *
10
+ * Depends:
11
+ * ui.core.js
12
+ */
13
+ (function($) {
14
+
15
+ $.widget("ui.progressbar", {
16
+
17
+ _init: function() {
18
+
19
+ var self = this,
20
+ options = this.options;
21
+
22
+ this.element
23
+ .addClass("ui-progressbar"
24
+ + " ui-widget"
25
+ + " ui-widget-content"
26
+ + " ui-corner-all")
27
+ .attr({
28
+ role: "progressbar",
29
+ "aria-valuemin": this._valueMin(),
30
+ "aria-valuemax": this._valueMax(),
31
+ "aria-valuenow": this._value()
32
+ });
33
+
34
+ this.valueDiv = $('<div class="ui-progressbar-value ui-state-default ui-corner-left"></div>').appendTo(this.element);
35
+
36
+ this._refreshValue();
37
+
38
+ },
39
+
40
+ destroy: function() {
41
+
42
+ this.element
43
+ .removeClass("ui-progressbar"
44
+ + " ui-widget"
45
+ + " ui-widget-content"
46
+ + " ui-corner-all")
47
+ .removeAttr("role")
48
+ .removeAttr("aria-valuemin")
49
+ .removeAttr("aria-valuemax")
50
+ .removeAttr("aria-valuenow")
51
+ .removeData("progressbar")
52
+ .unbind(".progressbar");
53
+
54
+ this.valueDiv.remove();
55
+
56
+ $.widget.prototype.destroy.apply(this, arguments);
57
+
58
+ },
59
+
60
+ value: function(newValue) {
61
+ arguments.length && this._setData("value", newValue);
62
+
63
+ return this._value();
64
+ },
65
+
66
+ _setData: function(key, value){
67
+ switch (key) {
68
+ case 'value':
69
+ this.options.value = value;
70
+ this._refreshValue();
71
+ this._trigger('change', null, {});
72
+ break;
73
+ }
74
+
75
+ $.widget.prototype._setData.apply(this, arguments);
76
+ },
77
+
78
+ _value: function() {
79
+ var val = this.options.value;
80
+ if (val < this._valueMin()) val = this._valueMin();
81
+ if (val > this._valueMax()) val = this._valueMax();
82
+
83
+ return val;
84
+ },
85
+
86
+ _valueMin: function() {
87
+ var valueMin = 0;
88
+
89
+ return valueMin;
90
+ },
91
+
92
+ _valueMax: function() {
93
+ var valueMax = 100;
94
+
95
+ return valueMax;
96
+ },
97
+
98
+ _refreshValue: function() {
99
+ var value = this.value();
100
+ this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right");
101
+ this.valueDiv.width(value + '%');
102
+ this.element.attr("aria-valuenow", value);
103
+ }
104
+
105
+ });
106
+
107
+ $.extend($.ui.progressbar, {
108
+ version: "@VERSION",
109
+ defaults: {
110
+ value: 0
111
+ }
112
+ });
113
+
114
+ })(jQuery);
@@ -0,0 +1,805 @@
1
+ /*
2
+ * jQuery UI Resizable @VERSION
3
+ *
4
+ * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Resizables
9
+ *
10
+ * Depends:
11
+ * ui.core.js
12
+ */
13
+ (function($) {
14
+
15
+ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
16
+
17
+ _init: function() {
18
+
19
+ var self = this, o = this.options;
20
+
21
+ var elpos = this.element.css('position');
22
+
23
+ this.originalElement = this.element;
24
+
25
+ // simulate .ui-resizable { position: relative; }
26
+ this.element.addClass("ui-resizable").css({ position: /static/.test(elpos) ? 'relative' : elpos });
27
+
28
+ $.extend(o, {
29
+ _aspectRatio: !!(o.aspectRatio),
30
+ helper: o.helper || o.ghost || o.animate ? o.helper || 'proxy' : null,
31
+ knobHandles: o.knobHandles === true ? 'ui-resizable-knob-handle' : o.knobHandles
32
+ });
33
+
34
+ //Default Theme
35
+ var aBorder = '1px solid #DEDEDE';
36
+
37
+ o.defaultTheme = {
38
+ 'ui-resizable': { display: 'block' },
39
+ 'ui-resizable-handle': { position: 'absolute', background: '#F2F2F2', fontSize: '0.1px' },
40
+ 'ui-resizable-n': { cursor: 'n-resize', height: '4px', left: '0px', right: '0px', borderTop: aBorder },
41
+ 'ui-resizable-s': { cursor: 's-resize', height: '4px', left: '0px', right: '0px', borderBottom: aBorder },
42
+ 'ui-resizable-e': { cursor: 'e-resize', width: '4px', top: '0px', bottom: '0px', borderRight: aBorder },
43
+ 'ui-resizable-w': { cursor: 'w-resize', width: '4px', top: '0px', bottom: '0px', borderLeft: aBorder },
44
+ 'ui-resizable-se': { cursor: 'se-resize', width: '4px', height: '4px', borderRight: aBorder, borderBottom: aBorder },
45
+ 'ui-resizable-sw': { cursor: 'sw-resize', width: '4px', height: '4px', borderBottom: aBorder, borderLeft: aBorder },
46
+ 'ui-resizable-ne': { cursor: 'ne-resize', width: '4px', height: '4px', borderRight: aBorder, borderTop: aBorder },
47
+ 'ui-resizable-nw': { cursor: 'nw-resize', width: '4px', height: '4px', borderLeft: aBorder, borderTop: aBorder }
48
+ };
49
+
50
+ o.knobTheme = {
51
+ 'ui-resizable-handle': { background: '#F2F2F2', border: '1px solid #808080', height: '8px', width: '8px' },
52
+ 'ui-resizable-n': { cursor: 'n-resize', top: '0px', left: '45%' },
53
+ 'ui-resizable-s': { cursor: 's-resize', bottom: '0px', left: '45%' },
54
+ 'ui-resizable-e': { cursor: 'e-resize', right: '0px', top: '45%' },
55
+ 'ui-resizable-w': { cursor: 'w-resize', left: '0px', top: '45%' },
56
+ 'ui-resizable-se': { cursor: 'se-resize', right: '0px', bottom: '0px' },
57
+ 'ui-resizable-sw': { cursor: 'sw-resize', left: '0px', bottom: '0px' },
58
+ 'ui-resizable-nw': { cursor: 'nw-resize', left: '0px', top: '0px' },
59
+ 'ui-resizable-ne': { cursor: 'ne-resize', right: '0px', top: '0px' }
60
+ };
61
+
62
+ o._nodeName = this.element[0].nodeName;
63
+
64
+ //Wrap the element if it cannot hold child nodes
65
+ if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)) {
66
+ var el = this.element;
67
+
68
+ //Opera fixing relative position
69
+ if (/relative/.test(el.css('position')) && $.browser.opera)
70
+ el.css({ position: 'relative', top: 'auto', left: 'auto' });
71
+
72
+ //Create a wrapper element and set the wrapper to the new current internal element
73
+ el.wrap(
74
+ $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css( {
75
+ position: el.css('position'),
76
+ width: el.outerWidth(),
77
+ height: el.outerHeight(),
78
+ top: el.css('top'),
79
+ left: el.css('left')
80
+ })
81
+ );
82
+
83
+ var oel = this.element; this.element = this.element.parent();
84
+
85
+ // store instance on wrapper
86
+ this.element.data('resizable', this);
87
+
88
+ //Move margins to the wrapper
89
+ this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"),
90
+ marginRight: oel.css("marginRight"), marginBottom: oel.css("marginBottom")
91
+ });
92
+
93
+ oel.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
94
+
95
+ //Prevent Safari textarea resize
96
+ if ($.browser.safari && o.preventDefault) oel.css('resize', 'none');
97
+
98
+ o.proportionallyResize = oel.css({ position: 'static', zoom: 1, display: 'block' });
99
+
100
+ // avoid IE jump
101
+ this.element.css({ margin: oel.css('margin') });
102
+
103
+ // fix handlers offset
104
+ this._proportionallyResize();
105
+ }
106
+
107
+ if(!o.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' };
108
+ if(o.handles.constructor == String) {
109
+
110
+ o.zIndex = o.zIndex || 1000;
111
+
112
+ if(o.handles == 'all') o.handles = 'n,e,s,w,se,sw,ne,nw';
113
+
114
+ var n = o.handles.split(","); o.handles = {};
115
+
116
+ // insertions are applied when don't have theme loaded
117
+ var insertionsDefault = {
118
+ handle: 'position: absolute; display: none; overflow:hidden;',
119
+ n: 'top: 0pt; width:100%;',
120
+ e: 'right: 0pt; height:100%;',
121
+ s: 'bottom: 0pt; width:100%;',
122
+ w: 'left: 0pt; height:100%;',
123
+ se: 'bottom: 0pt; right: 0px;',
124
+ sw: 'bottom: 0pt; left: 0px;',
125
+ ne: 'top: 0pt; right: 0px;',
126
+ nw: 'top: 0pt; left: 0px;'
127
+ };
128
+
129
+ for(var i = 0; i < n.length; i++) {
130
+ var handle = $.trim(n[i]), dt = o.defaultTheme, hname = 'ui-resizable-'+handle, loadDefault = !$.ui.css(hname) && !o.knobHandles, userKnobClass = $.ui.css('ui-resizable-knob-handle'),
131
+ allDefTheme = $.extend(dt[hname], dt['ui-resizable-handle']), allKnobTheme = $.extend(o.knobTheme[hname], !userKnobClass ? o.knobTheme['ui-resizable-handle'] : {});
132
+
133
+ // increase zIndex of sw, se, ne, nw axis
134
+ var applyZIndex = /sw|se|ne|nw/.test(handle) ? { zIndex: ++o.zIndex } : {};
135
+
136
+ var defCss = (loadDefault ? insertionsDefault[handle] : ''),
137
+ axis = $(['<div class="ui-resizable-handle ', hname, '" style="', defCss, insertionsDefault.handle, '"></div>'].join('')).css( applyZIndex );
138
+ o.handles[handle] = '.ui-resizable-'+handle;
139
+
140
+ this.element.append(
141
+ //Theme detection, if not loaded, load o.defaultTheme
142
+ axis.css( loadDefault ? allDefTheme : {} )
143
+ // Load the knobHandle css, fix width, height, top, left...
144
+ .css( o.knobHandles ? allKnobTheme : {} ).addClass(o.knobHandles ? 'ui-resizable-knob-handle' : '').addClass(o.knobHandles)
145
+ );
146
+ }
147
+
148
+ if (o.knobHandles) this.element.addClass('ui-resizable-knob').css( !$.ui.css('ui-resizable-knob') ? { /*border: '1px #fff dashed'*/ } : {} );
149
+ }
150
+
151
+ this._renderAxis = function(target) {
152
+ target = target || this.element;
153
+
154
+ for(var i in o.handles) {
155
+ if(o.handles[i].constructor == String)
156
+ o.handles[i] = $(o.handles[i], this.element).show();
157
+
158
+ if (o.transparent)
159
+ o.handles[i].css({opacity:0});
160
+
161
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
162
+ if (this.element.is('.ui-wrapper') &&
163
+ o._nodeName.match(/textarea|input|select|button/i)) {
164
+
165
+ var axis = $(o.handles[i], this.element), padWrapper = 0;
166
+
167
+ //Checking the correct pad and border
168
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
169
+
170
+ //The padding type i have to apply...
171
+ var padPos = [ 'padding',
172
+ /ne|nw|n/.test(i) ? 'Top' :
173
+ /se|sw|s/.test(i) ? 'Bottom' :
174
+ /^e$/.test(i) ? 'Right' : 'Left' ].join("");
175
+
176
+ if (!o.transparent)
177
+ target.css(padPos, padWrapper);
178
+
179
+ this._proportionallyResize();
180
+ }
181
+ if(!$(o.handles[i]).length) continue;
182
+ }
183
+ };
184
+
185
+ this._renderAxis(this.element);
186
+ o._handles = $('.ui-resizable-handle', self.element);
187
+
188
+ if (o.disableSelection)
189
+ o._handles.disableSelection();
190
+
191
+ //Matching axis name
192
+ o._handles.mouseover(function() {
193
+ if (!o.resizing) {
194
+ if (this.className)
195
+ var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
196
+ //Axis, default = se
197
+ self.axis = o.axis = axis && axis[1] ? axis[1] : 'se';
198
+ }
199
+ });
200
+
201
+ //If we want to auto hide the elements
202
+ if (o.autoHide) {
203
+ o._handles.hide();
204
+ $(self.element).addClass("ui-resizable-autohide").hover(function() {
205
+ $(this).removeClass("ui-resizable-autohide");
206
+ o._handles.show();
207
+ },
208
+ function(){
209
+ if (!o.resizing) {
210
+ $(this).addClass("ui-resizable-autohide");
211
+ o._handles.hide();
212
+ }
213
+ });
214
+ }
215
+
216
+ this._mouseInit();
217
+ },
218
+
219
+ destroy: function() {
220
+ var el = this.element, wrapped = el.children(".ui-resizable").get(0);
221
+
222
+ this._mouseDestroy();
223
+
224
+ var _destroy = function(exp) {
225
+ $(exp).removeClass("ui-resizable ui-resizable-disabled")
226
+ .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
227
+ };
228
+
229
+ _destroy(el);
230
+
231
+ if (el.is('.ui-wrapper') && wrapped) {
232
+ el.parent().append(
233
+ $(wrapped).css({
234
+ position: el.css('position'),
235
+ width: el.outerWidth(),
236
+ height: el.outerHeight(),
237
+ top: el.css('top'),
238
+ left: el.css('left')
239
+ })
240
+ ).end().remove();
241
+
242
+ _destroy(wrapped);
243
+ }
244
+ },
245
+
246
+ _mouseCapture: function(event) {
247
+
248
+ if(this.options.disabled) return false;
249
+
250
+ var handle = false;
251
+ for(var i in this.options.handles) {
252
+ if($(this.options.handles[i])[0] == event.target) handle = true;
253
+ }
254
+ if (!handle) return false;
255
+
256
+ return true;
257
+
258
+ },
259
+
260
+ _mouseStart: function(event) {
261
+
262
+ var o = this.options, iniPos = this.element.position(), el = this.element,
263
+ num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7;
264
+ o.resizing = true;
265
+ o.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
266
+
267
+ // bugfix #1749
268
+ if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
269
+
270
+ // sOffset decides if document scrollOffset will be added to the top/left of the resizable element
271
+ var sOffset = $.browser.msie && !o.containment && (/absolute/).test(el.css('position')) && !(/relative/).test(el.parent().css('position'));
272
+ var dscrollt = sOffset ? o.documentScroll.top : 0, dscrolll = sOffset ? o.documentScroll.left : 0;
273
+
274
+ el.css({ position: 'absolute', top: (iniPos.top + dscrollt), left: (iniPos.left + dscrolll) });
275
+ }
276
+
277
+ //Opera fixing relative position
278
+ if ($.browser.opera && (/relative/).test(el.css('position')))
279
+ el.css({ position: 'relative', top: 'auto', left: 'auto' });
280
+
281
+ this._renderProxy();
282
+
283
+ var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
284
+
285
+ if (o.containment) {
286
+ curleft += $(o.containment).scrollLeft()||0;
287
+ curtop += $(o.containment).scrollTop()||0;
288
+ }
289
+
290
+ //Store needed variables
291
+ this.offset = this.helper.offset();
292
+ this.position = { left: curleft, top: curtop };
293
+ this.size = o.helper || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
294
+ this.originalSize = o.helper || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
295
+ this.originalPosition = { left: curleft, top: curtop };
296
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
297
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
298
+
299
+ //Aspect Ratio
300
+ o.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height)||1);
301
+
302
+ if (o.preserveCursor) {
303
+ var cursor = $('.ui-resizable-' + this.axis).css('cursor');
304
+ $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
305
+ }
306
+
307
+ this._propagate("start", event);
308
+ return true;
309
+ },
310
+
311
+ _mouseDrag: function(event) {
312
+
313
+ //Increase performance, avoid regex
314
+ var el = this.helper, o = this.options, props = {},
315
+ self = this, smp = this.originalMousePosition, a = this.axis;
316
+
317
+ var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
318
+ var trigger = this._change[a];
319
+ if (!trigger) return false;
320
+
321
+ // Calculate the attrs that will be change
322
+ var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
323
+
324
+ if (o._aspectRatio || event.shiftKey)
325
+ data = this._updateRatio(data, event);
326
+
327
+ data = this._respectSize(data, event);
328
+
329
+ // plugins callbacks need to be called first
330
+ this._propagate("resize", event);
331
+
332
+ el.css({
333
+ top: this.position.top + "px", left: this.position.left + "px",
334
+ width: this.size.width + "px", height: this.size.height + "px"
335
+ });
336
+
337
+ if (!o.helper && o.proportionallyResize)
338
+ this._proportionallyResize();
339
+
340
+ this._updateCache(data);
341
+
342
+ // calling the user callback at the end
343
+ this.element.triggerHandler("resize", [event, this.ui()], this.options["resize"]);
344
+
345
+ return false;
346
+ },
347
+
348
+ _mouseStop: function(event) {
349
+
350
+ this.options.resizing = false;
351
+ var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this;
352
+
353
+ if(o.helper) {
354
+ var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName),
355
+ soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
356
+ soffsetw = ista ? 0 : self.sizeDiff.width;
357
+
358
+ var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
359
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
360
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
361
+
362
+ if (!o.animate)
363
+ this.element.css($.extend(s, { top: top, left: left }));
364
+
365
+ if (o.helper && !o.animate) this._proportionallyResize();
366
+ }
367
+
368
+ if (o.preserveCursor)
369
+ $('body').css('cursor', 'auto');
370
+
371
+ this._propagate("stop", event);
372
+
373
+ if (o.helper) this.helper.remove();
374
+
375
+ return false;
376
+ },
377
+
378
+ _updateCache: function(data) {
379
+ var o = this.options;
380
+ this.offset = this.helper.offset();
381
+ if (data.left) this.position.left = data.left;
382
+ if (data.top) this.position.top = data.top;
383
+ if (data.height) this.size.height = data.height;
384
+ if (data.width) this.size.width = data.width;
385
+ },
386
+
387
+ _updateRatio: function(data, event) {
388
+
389
+ var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
390
+
391
+ if (data.height) data.width = (csize.height * o.aspectRatio);
392
+ else if (data.width) data.height = (csize.width / o.aspectRatio);
393
+
394
+ if (a == 'sw') {
395
+ data.left = cpos.left + (csize.width - data.width);
396
+ data.top = null;
397
+ }
398
+ if (a == 'nw') {
399
+ data.top = cpos.top + (csize.height - data.height);
400
+ data.left = cpos.left + (csize.width - data.width);
401
+ }
402
+
403
+ return data;
404
+ },
405
+
406
+ _respectSize: function(data, event) {
407
+
408
+ var el = this.helper, o = this.options, pRatio = o._aspectRatio || event.shiftKey, a = this.axis,
409
+ ismaxw = data.width && o.maxWidth && o.maxWidth < data.width, ismaxh = data.height && o.maxHeight && o.maxHeight < data.height,
410
+ isminw = data.width && o.minWidth && o.minWidth > data.width, isminh = data.height && o.minHeight && o.minHeight > data.height;
411
+
412
+ if (isminw) data.width = o.minWidth;
413
+ if (isminh) data.height = o.minHeight;
414
+ if (ismaxw) data.width = o.maxWidth;
415
+ if (ismaxh) data.height = o.maxHeight;
416
+
417
+ var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
418
+ var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
419
+
420
+ if (isminw && cw) data.left = dw - o.minWidth;
421
+ if (ismaxw && cw) data.left = dw - o.maxWidth;
422
+ if (isminh && ch) data.top = dh - o.minHeight;
423
+ if (ismaxh && ch) data.top = dh - o.maxHeight;
424
+
425
+ // fixing jump error on top/left - bug #2330
426
+ var isNotwh = !data.width && !data.height;
427
+ if (isNotwh && !data.left && data.top) data.top = null;
428
+ else if (isNotwh && !data.top && data.left) data.left = null;
429
+
430
+ return data;
431
+ },
432
+
433
+ _proportionallyResize: function() {
434
+ var o = this.options;
435
+ if (!o.proportionallyResize) return;
436
+ var prel = o.proportionallyResize, el = this.helper || this.element;
437
+
438
+ if (!o.borderDif) {
439
+ var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
440
+ p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
441
+
442
+ o.borderDif = $.map(b, function(v, i) {
443
+ var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
444
+ return border + padding;
445
+ });
446
+ }
447
+ prel.css({
448
+ height: (el.height() - o.borderDif[0] - o.borderDif[2]) + "px",
449
+ width: (el.width() - o.borderDif[1] - o.borderDif[3]) + "px"
450
+ });
451
+ },
452
+
453
+ _renderProxy: function() {
454
+ var el = this.element, o = this.options;
455
+ this.elementOffset = el.offset();
456
+
457
+ if(o.helper) {
458
+ this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
459
+
460
+ // fix ie6 offset
461
+ var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
462
+ pxyoffset = ( ie6 ? 2 : -1 );
463
+
464
+ this.helper.addClass(o.helper).css({
465
+ width: el.outerWidth() + pxyoffset,
466
+ height: el.outerHeight() + pxyoffset,
467
+ position: 'absolute',
468
+ left: this.elementOffset.left - ie6offset +'px',
469
+ top: this.elementOffset.top - ie6offset +'px',
470
+ zIndex: ++o.zIndex
471
+ });
472
+
473
+ this.helper.appendTo("body");
474
+
475
+ if (o.disableSelection)
476
+ this.helper.disableSelection();
477
+
478
+ } else {
479
+ this.helper = el;
480
+ }
481
+ },
482
+
483
+ _change: {
484
+ e: function(event, dx, dy) {
485
+ return { width: this.originalSize.width + dx };
486
+ },
487
+ w: function(event, dx, dy) {
488
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
489
+ return { left: sp.left + dx, width: cs.width - dx };
490
+ },
491
+ n: function(event, dx, dy) {
492
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
493
+ return { top: sp.top + dy, height: cs.height - dy };
494
+ },
495
+ s: function(event, dx, dy) {
496
+ return { height: this.originalSize.height + dy };
497
+ },
498
+ se: function(event, dx, dy) {
499
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
500
+ },
501
+ sw: function(event, dx, dy) {
502
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
503
+ },
504
+ ne: function(event, dx, dy) {
505
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
506
+ },
507
+ nw: function(event, dx, dy) {
508
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
509
+ }
510
+ },
511
+
512
+ _propagate: function(n, event) {
513
+ $.ui.plugin.call(this, n, [event, this.ui()]);
514
+ if (n != "resize") this.element.triggerHandler(["resize", n].join(""), [event, this.ui()], this.options[n]);
515
+ },
516
+
517
+ plugins: {},
518
+
519
+ ui: function() {
520
+ return {
521
+ originalElement: this.originalElement,
522
+ element: this.element,
523
+ helper: this.helper,
524
+ position: this.position,
525
+ size: this.size,
526
+ options: this.options,
527
+ originalSize: this.originalSize,
528
+ originalPosition: this.originalPosition
529
+ };
530
+ }
531
+
532
+ }));
533
+
534
+ $.extend($.ui.resizable, {
535
+ version: "@VERSION",
536
+ defaults: {
537
+ alsoResize: false,
538
+ animate: false,
539
+ animateDuration: "slow",
540
+ animateEasing: "swing",
541
+ aspectRatio: false,
542
+ autoHide: false,
543
+ cancel: ":input",
544
+ containment: false,
545
+ disableSelection: true,
546
+ distance: 1,
547
+ delay: 0,
548
+ ghost: false,
549
+ grid: false,
550
+ knobHandles: false,
551
+ maxHeight: null,
552
+ maxWidth: null,
553
+ minHeight: 10,
554
+ minWidth: 10,
555
+ preserveCursor: true,
556
+ preventDefault: true,
557
+ proportionallyResize: false,
558
+ transparent: false
559
+ }
560
+ });
561
+
562
+ /*
563
+ * Resizable Extensions
564
+ */
565
+
566
+ $.ui.plugin.add("resizable", "alsoResize", {
567
+
568
+ start: function(event, ui) {
569
+ var o = ui.options, self = $(this).data("resizable"),
570
+
571
+ _store = function(exp) {
572
+ $(exp).each(function() {
573
+ $(this).data("resizable-alsoresize", {
574
+ width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
575
+ left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10)
576
+ });
577
+ });
578
+ };
579
+
580
+ if (typeof(o.alsoResize) == 'object') {
581
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
582
+ else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
583
+ }else{
584
+ _store(o.alsoResize);
585
+ }
586
+ },
587
+
588
+ resize: function(event, ui){
589
+ var o = ui.options, self = $(this).data("resizable"), os = self.originalSize, op = self.originalPosition;
590
+
591
+ var delta = {
592
+ height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
593
+ top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
594
+ },
595
+
596
+ _alsoResize = function(exp, c) {
597
+ $(exp).each(function() {
598
+ var start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
599
+
600
+ $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
601
+ var sum = (start[prop]||0) + (delta[prop]||0);
602
+ if (sum && sum >= 0)
603
+ style[prop] = sum || null;
604
+ });
605
+ $(this).css(style);
606
+ });
607
+ };
608
+
609
+ if (typeof(o.alsoResize) == 'object') {
610
+ $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
611
+ }else{
612
+ _alsoResize(o.alsoResize);
613
+ }
614
+ },
615
+
616
+ stop: function(event, ui){
617
+ $(this).removeData("resizable-alsoresize-start");
618
+ }
619
+ });
620
+
621
+ $.ui.plugin.add("resizable", "animate", {
622
+
623
+ stop: function(event, ui) {
624
+ var o = ui.options, self = $(this).data("resizable");
625
+
626
+ var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName),
627
+ soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
628
+ soffsetw = ista ? 0 : self.sizeDiff.width;
629
+
630
+ var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
631
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
632
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
633
+
634
+ self.element.animate(
635
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
636
+ duration: o.animateDuration,
637
+ easing: o.animateEasing,
638
+ step: function() {
639
+
640
+ var data = {
641
+ width: parseInt(self.element.css('width'), 10),
642
+ height: parseInt(self.element.css('height'), 10),
643
+ top: parseInt(self.element.css('top'), 10),
644
+ left: parseInt(self.element.css('left'), 10)
645
+ };
646
+
647
+ if (pr) pr.css({ width: data.width, height: data.height });
648
+
649
+ // propagating resize, and updating values for each animation step
650
+ self._updateCache(data);
651
+ self._propagate("animate", event);
652
+
653
+ }
654
+ }
655
+ );
656
+ }
657
+
658
+ });
659
+
660
+ $.ui.plugin.add("resizable", "containment", {
661
+
662
+ start: function(event, ui) {
663
+ var o = ui.options, self = $(this).data("resizable"), el = self.element;
664
+ var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
665
+ if (!ce) return;
666
+
667
+ self.containerElement = $(ce);
668
+
669
+ if (/document/.test(oc) || oc == document) {
670
+ self.containerOffset = { left: 0, top: 0 };
671
+ self.containerPosition = { left: 0, top: 0 };
672
+
673
+ self.parentData = {
674
+ element: $(document), left: 0, top: 0,
675
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
676
+ };
677
+ }
678
+
679
+ // i'm a node, so compute top, left, right, bottom
680
+ else{
681
+ self.containerOffset = $(ce).offset();
682
+ self.containerPosition = $(ce).position();
683
+ self.containerSize = { height: $(ce).innerHeight(), width: $(ce).innerWidth() };
684
+
685
+ var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
686
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
687
+
688
+ self.parentData = {
689
+ element: ce, left: co.left, top: co.top, width: width, height: height
690
+ };
691
+ }
692
+ },
693
+
694
+ resize: function(event, ui) {
695
+ var o = ui.options, self = $(this).data("resizable"),
696
+ ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
697
+ pRatio = o._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
698
+
699
+ if (ce[0] != document && (/static/).test(ce.css('position')))
700
+ cop = self.containerPosition;
701
+
702
+ if (cp.left < (o.helper ? co.left : cop.left)) {
703
+ self.size.width = self.size.width + (o.helper ? (self.position.left - co.left) : (self.position.left - cop.left));
704
+ if (pRatio) self.size.height = self.size.width / o.aspectRatio;
705
+ self.position.left = o.helper ? co.left : cop.left;
706
+ }
707
+
708
+ if (cp.top < (o.helper ? co.top : 0)) {
709
+ self.size.height = self.size.height + (o.helper ? (self.position.top - co.top) : self.position.top);
710
+ if (pRatio) self.size.width = self.size.height * o.aspectRatio;
711
+ self.position.top = o.helper ? co.top : 0;
712
+ }
713
+
714
+ var woset = (o.helper ? self.offset.left - co.left : (self.position.left - cop.left)) + self.sizeDiff.width,
715
+ hoset = (o.helper ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height;
716
+
717
+ if (woset + self.size.width >= self.parentData.width) {
718
+ self.size.width = self.parentData.width - woset;
719
+ if (pRatio) self.size.height = self.size.width / o.aspectRatio;
720
+ }
721
+
722
+ if (hoset + self.size.height >= self.parentData.height) {
723
+ self.size.height = self.parentData.height - hoset;
724
+ if (pRatio) self.size.width = self.size.height * o.aspectRatio;
725
+ }
726
+ },
727
+
728
+ stop: function(event, ui){
729
+ var o = ui.options, self = $(this).data("resizable"), cp = self.position,
730
+ co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
731
+
732
+ var helper = $(self.helper), ho = helper.offset(), w = helper.innerWidth(), h = helper.innerHeight();
733
+
734
+ if (o.helper && !o.animate && (/relative/).test(ce.css('position')))
735
+ $(this).css({ left: (ho.left - co.left), top: (ho.top - co.top), width: w, height: h });
736
+
737
+ if (o.helper && !o.animate && (/static/).test(ce.css('position')))
738
+ $(this).css({ left: cop.left + (ho.left - co.left), top: cop.top + (ho.top - co.top), width: w, height: h });
739
+
740
+ }
741
+ });
742
+
743
+ $.ui.plugin.add("resizable", "ghost", {
744
+
745
+ start: function(event, ui) {
746
+ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize, cs = self.size;
747
+
748
+ if (!pr) self.ghost = self.element.clone();
749
+ else self.ghost = pr.clone();
750
+
751
+ self.ghost.css(
752
+ { opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }
753
+ )
754
+ .addClass('ui-resizable-ghost').addClass(typeof o.ghost == 'string' ? o.ghost : '');
755
+
756
+ self.ghost.appendTo(self.helper);
757
+
758
+ },
759
+
760
+ resize: function(event, ui){
761
+ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
762
+
763
+ if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
764
+
765
+ },
766
+
767
+ stop: function(event, ui){
768
+ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
769
+ if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
770
+ }
771
+
772
+ });
773
+
774
+ $.ui.plugin.add("resizable", "grid", {
775
+
776
+ resize: function(event, ui) {
777
+ var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
778
+ o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
779
+ var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
780
+
781
+ if (/^(se|s|e)$/.test(a)) {
782
+ self.size.width = os.width + ox;
783
+ self.size.height = os.height + oy;
784
+ }
785
+ else if (/^(ne)$/.test(a)) {
786
+ self.size.width = os.width + ox;
787
+ self.size.height = os.height + oy;
788
+ self.position.top = op.top - oy;
789
+ }
790
+ else if (/^(sw)$/.test(a)) {
791
+ self.size.width = os.width + ox;
792
+ self.size.height = os.height + oy;
793
+ self.position.left = op.left - ox;
794
+ }
795
+ else {
796
+ self.size.width = os.width + ox;
797
+ self.size.height = os.height + oy;
798
+ self.position.top = op.top - oy;
799
+ self.position.left = op.left - ox;
800
+ }
801
+ }
802
+
803
+ });
804
+
805
+ })(jQuery);