transit 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/Gemfile +19 -11
  2. data/app/assets/images/transit/icon24x24.png +0 -0
  3. data/app/assets/images/transit/icon24x24_files.png +0 -0
  4. data/app/assets/images/transit/jplayer.swf +0 -0
  5. data/app/assets/images/transit/uploadify.swf +0 -0
  6. data/app/assets/images/transit/video_player.swf +0 -0
  7. data/app/assets/javascripts/jqtools/expose.js +224 -0
  8. data/app/assets/javascripts/jqtools/flashembed.js +300 -0
  9. data/app/assets/javascripts/jqtools/overlay.js +294 -0
  10. data/app/assets/javascripts/jqtools/scrollable.js +3 -0
  11. data/app/assets/javascripts/jqtools/scrollable/autoscroll.js +81 -0
  12. data/app/assets/javascripts/jqtools/scrollable/base.js +335 -0
  13. data/app/assets/javascripts/jqtools/scrollable/navigator.js +139 -0
  14. data/app/assets/javascripts/jqtools/validator.js +590 -0
  15. data/app/assets/javascripts/jqueryui/accordion.js +611 -0
  16. data/app/assets/javascripts/jqueryui/autocomplete.js +612 -0
  17. data/app/assets/javascripts/jqueryui/button.js +388 -0
  18. data/app/assets/javascripts/jqueryui/core.js +312 -0
  19. data/app/assets/javascripts/jqueryui/datepicker.js +1791 -0
  20. data/app/assets/javascripts/jqueryui/dialog.js +878 -0
  21. data/app/assets/javascripts/jqueryui/draggable.js +815 -0
  22. data/app/assets/javascripts/jqueryui/droppable.js +285 -0
  23. data/app/assets/javascripts/jqueryui/effects/blind.js +49 -0
  24. data/app/assets/javascripts/jqueryui/effects/bounce.js +78 -0
  25. data/app/assets/javascripts/jqueryui/effects/clip.js +54 -0
  26. data/app/assets/javascripts/jqueryui/effects/core.js +746 -0
  27. data/app/assets/javascripts/jqueryui/effects/drop.js +50 -0
  28. data/app/assets/javascripts/jqueryui/effects/explode.js +79 -0
  29. data/app/assets/javascripts/jqueryui/effects/fade.js +32 -0
  30. data/app/assets/javascripts/jqueryui/effects/fold.js +56 -0
  31. data/app/assets/javascripts/jqueryui/effects/highlight.js +50 -0
  32. data/app/assets/javascripts/jqueryui/effects/pulsate.js +51 -0
  33. data/app/assets/javascripts/jqueryui/effects/scale.js +178 -0
  34. data/app/assets/javascripts/jqueryui/effects/shake.js +57 -0
  35. data/app/assets/javascripts/jqueryui/effects/slide.js +50 -0
  36. data/app/assets/javascripts/jqueryui/effects/transfer.js +45 -0
  37. data/app/assets/javascripts/jqueryui/mouse.js +160 -0
  38. data/app/assets/javascripts/jqueryui/position.js +252 -0
  39. data/app/assets/javascripts/jqueryui/progressbar.js +109 -0
  40. data/app/assets/javascripts/jqueryui/resizable.js +814 -0
  41. data/app/assets/javascripts/jqueryui/selectable.js +266 -0
  42. data/app/assets/javascripts/jqueryui/slider.js +666 -0
  43. data/app/assets/javascripts/jqueryui/sortable.js +1077 -0
  44. data/app/assets/javascripts/jqueryui/tabs.js +758 -0
  45. data/app/assets/javascripts/jqueryui/widget.js +262 -0
  46. data/app/assets/javascripts/libs/backbone.js +1152 -0
  47. data/app/assets/javascripts/libs/cookie.js +89 -0
  48. data/app/assets/javascripts/libs/fileinput.js +130 -0
  49. data/app/assets/javascripts/libs/jplayer.js +1768 -0
  50. data/app/assets/javascripts/libs/proper.js +541 -0
  51. data/app/assets/javascripts/libs/sanitize.js +282 -0
  52. data/app/assets/javascripts/libs/selecttolist.js +75 -0
  53. data/app/assets/javascripts/libs/underscore.js +807 -0
  54. data/app/assets/javascripts/libs/uploadify.js +677 -0
  55. data/app/assets/javascripts/libs/wymeditor.js +9538 -0
  56. data/app/assets/javascripts/transit.js +4 -0
  57. data/app/assets/javascripts/transit/admin.js +22 -0
  58. data/app/assets/javascripts/transit/admin/contexts.js +52 -0
  59. data/app/assets/javascripts/transit/admin/fields.js +36 -0
  60. data/app/assets/javascripts/transit/admin/upload.js +109 -0
  61. data/app/assets/javascripts/transit/config.js.erb +101 -0
  62. data/app/assets/javascripts/transit/contexts/audio.js +39 -0
  63. data/app/assets/javascripts/transit/contexts/video.js +79 -0
  64. data/app/assets/javascripts/transit/core.js +171 -0
  65. data/app/assets/javascripts/transit/frontend.js +3 -0
  66. data/app/assets/javascripts/transit/lib/base64.js +120 -0
  67. data/app/assets/javascripts/transit/lib/editor.js +177 -0
  68. data/app/assets/javascripts/transit/views/audio_player.jst +22 -0
  69. data/app/assets/javascripts/transit/views/editor_toolbar.jst +12 -0
  70. data/app/assets/javascripts/transit/views/file_upload.jst +5 -0
  71. data/app/assets/javascripts/transit/views/video_player.jst +20 -0
  72. data/app/assets/javascripts/transit/views/wym_box.jst +4 -0
  73. data/app/assets/javascripts/transit/views/wym_iframe.jst +3 -0
  74. data/app/assets/stylesheets/transit.css.scss.erb +42 -0
  75. data/app/assets/stylesheets/transit/forms.css.scss +66 -0
  76. data/app/assets/stylesheets/transit/media/audio.css.scss +65 -0
  77. data/app/assets/stylesheets/transit/media/video.css.scss +30 -0
  78. data/app/assets/stylesheets/transit/panel.css.scss +100 -0
  79. data/app/assets/stylesheets/transit/ui.css.scss +507 -0
  80. data/app/controllers/pages_controller.rb +3 -0
  81. data/app/controllers/posts_controller.rb +3 -0
  82. data/app/controllers/transit/assets_controller.rb +38 -0
  83. data/app/controllers/transit/contexts_controller.rb +12 -9
  84. data/app/controllers/transit/pages_controller.rb +26 -0
  85. data/app/controllers/transit/posts_controller.rb +31 -0
  86. data/app/controllers/transit/topics_controller.rb +5 -0
  87. data/app/controllers/transit_controller.rb +16 -0
  88. data/app/helpers/transit/admin_helper.rb +43 -0
  89. data/app/helpers/transit/form_helper.rb +17 -0
  90. data/app/helpers/transit/package_helper.rb +41 -0
  91. data/app/helpers/transit/pagination_helper.rb +58 -0
  92. data/app/helpers/transit_helper.rb +42 -0
  93. data/app/models/comment.rb +37 -0
  94. data/app/models/contexts/audio.rb +12 -0
  95. data/app/models/{text.rb → contexts/text.rb} +0 -0
  96. data/app/models/contexts/video.rb +24 -0
  97. data/app/models/topic.rb +19 -0
  98. data/app/models/transit/asset.rb +68 -0
  99. data/{lib → app/models}/transit/context.rb +29 -0
  100. data/app/views/contexts/_text.html.erb +1 -1
  101. data/app/views/posts/index.rss.builder +18 -0
  102. data/app/views/transit/assets/_file.html.erb +4 -0
  103. data/app/views/transit/assets/_image.html.erb +13 -0
  104. data/app/views/transit/assets/create.js.erb +8 -0
  105. data/app/views/transit/assets/destroy.js.erb +3 -0
  106. data/app/views/transit/assets/manage.html.erb +20 -0
  107. data/app/views/transit/contexts/_audio.html.erb +18 -0
  108. data/app/views/transit/contexts/_text.html.erb +6 -0
  109. data/app/views/transit/contexts/_video.html.erb +13 -0
  110. data/app/views/transit/contexts/destroy.js.erb +1 -0
  111. data/app/views/transit/contexts/index.html.erb +5 -0
  112. data/app/views/transit/contexts/new.js.erb +7 -0
  113. data/app/views/transit/contexts/show.html.erb +8 -0
  114. data/app/views/transit/index.html.erb +26 -0
  115. data/app/views/transit/index.js.erb +1 -0
  116. data/app/views/transit/interface/post_panel.html.erb +96 -0
  117. data/app/views/transit/pages/_table.html.erb +7 -0
  118. data/app/views/transit/pages/edit.html.erb +17 -0
  119. data/app/views/transit/pages/index.html.erb +17 -0
  120. data/app/views/transit/pages/update.js.erb +1 -0
  121. data/app/views/transit/posts/_form.html.erb +49 -0
  122. data/app/views/transit/posts/edit.html.erb +14 -0
  123. data/app/views/transit/posts/new.html.erb +21 -0
  124. data/app/views/transit/table.html.erb +13 -0
  125. data/app/views/transit/table.js.erb +8 -0
  126. data/app/views/transit/topics/manage.html.erb +28 -0
  127. data/config/locales/en.yml +22 -0
  128. data/config/routes.rb +3 -3
  129. data/lib/transit.rb +51 -17
  130. data/lib/transit/admin.rb +85 -0
  131. data/lib/transit/builders/form_builder.rb +319 -0
  132. data/lib/transit/builders/jst_builder.rb +38 -0
  133. data/lib/transit/builders/package_builder.rb +45 -0
  134. data/lib/transit/config.rb +20 -0
  135. data/lib/transit/controller/generator.rb +42 -0
  136. data/lib/transit/controller/responder.rb +34 -0
  137. data/lib/transit/core_ext.rb +18 -0
  138. data/lib/transit/errors/resource_not_found.rb +6 -0
  139. data/lib/transit/model/assets.rb +14 -0
  140. data/lib/transit/model/attachments.rb +55 -0
  141. data/lib/transit/model/auto_increment.rb +22 -0
  142. data/lib/transit/model/base.rb +56 -0
  143. data/lib/transit/model/comments.rb +19 -0
  144. data/lib/transit/model/hooks.rb +38 -0
  145. data/lib/transit/model/owners.rb +14 -0
  146. data/lib/transit/model/paginator.rb +92 -0
  147. data/lib/transit/model/topics.rb +14 -0
  148. data/lib/transit/package/page.rb +20 -12
  149. data/lib/transit/package/post.rb +87 -33
  150. data/lib/transit/package/post/validations.rb +14 -0
  151. data/lib/transit/rails/engine.rb +29 -13
  152. data/lib/transit/rails/railtie.rb +31 -0
  153. data/lib/transit/rails/routing.rb +11 -6
  154. data/lib/transit/services.rb +13 -0
  155. data/lib/transit/services/base.rb +14 -0
  156. data/lib/transit/services/facebook.rb +13 -0
  157. data/lib/transit/services/ted.rb +10 -0
  158. data/lib/transit/services/twitter.rb +13 -0
  159. data/lib/transit/services/vimeo.rb +10 -0
  160. data/lib/transit/services/you_tube.rb +12 -0
  161. data/lib/transit/version.rb +1 -1
  162. metadata +178 -31
  163. data/app/assets/stylesheets/includes/_compat.scss +0 -24
  164. data/app/assets/stylesheets/includes/_defaults.scss +0 -99
  165. data/app/assets/stylesheets/includes/_global.scss +0 -16
  166. data/app/assets/stylesheets/includes/_imports.scss +0 -27
  167. data/app/assets/stylesheets/includes/_mixins.scss +0 -38
  168. data/app/assets/stylesheets/includes/_setup.scss +0 -85
  169. data/app/assets/stylesheets/layout.css.scss +0 -29
  170. data/app/assets/stylesheets/transit.css +0 -3
  171. data/app/controllers/application_controller.rb +0 -5
  172. data/app/controllers/transit/index_controller.rb +0 -7
  173. data/app/controllers/transit/packages_controller.rb +0 -64
  174. data/app/controllers/transit/transit_controller.rb +0 -4
  175. data/app/helpers/routing_helpers.rb +0 -7
  176. data/app/models/audio.rb +0 -4
  177. data/app/models/package_asset.rb +0 -11
  178. data/app/models/video.rb +0 -8
  179. data/app/views/contexts/_audio.html.erb +0 -1
  180. data/app/views/contexts/_video.html.erb +0 -1
  181. data/app/views/layouts/transit.html.erb +0 -31
  182. data/app/views/transit/index/index.html.erb +0 -0
  183. data/lib/transit/helpers/controller_helpers.rb +0 -40
  184. data/lib/transit/helpers/model_helpers.rb +0 -26
  185. data/lib/transit/package.rb +0 -25
  186. data/lib/transit/package/base.rb +0 -49
@@ -0,0 +1,109 @@
1
+ /*
2
+ * jQuery UI Progressbar 1.8.13
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Progressbar
9
+ *
10
+ * Depends:
11
+ * jquery.ui.core.js
12
+ * jquery.ui.widget.js
13
+ */
14
+ (function( $, undefined ) {
15
+
16
+ $.widget( "ui.progressbar", {
17
+ options: {
18
+ value: 0,
19
+ max: 100
20
+ },
21
+
22
+ min: 0,
23
+
24
+ _create: function() {
25
+ this.element
26
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
27
+ .attr({
28
+ role: "progressbar",
29
+ "aria-valuemin": this.min,
30
+ "aria-valuemax": this.options.max,
31
+ "aria-valuenow": this._value()
32
+ });
33
+
34
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
35
+ .appendTo( this.element );
36
+
37
+ this.oldValue = this._value();
38
+ this._refreshValue();
39
+ },
40
+
41
+ destroy: function() {
42
+ this.element
43
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
44
+ .removeAttr( "role" )
45
+ .removeAttr( "aria-valuemin" )
46
+ .removeAttr( "aria-valuemax" )
47
+ .removeAttr( "aria-valuenow" );
48
+
49
+ this.valueDiv.remove();
50
+
51
+ $.Widget.prototype.destroy.apply( this, arguments );
52
+ },
53
+
54
+ value: function( newValue ) {
55
+ if ( newValue === undefined ) {
56
+ return this._value();
57
+ }
58
+
59
+ this._setOption( "value", newValue );
60
+ return this;
61
+ },
62
+
63
+ _setOption: function( key, value ) {
64
+ if ( key === "value" ) {
65
+ this.options.value = value;
66
+ this._refreshValue();
67
+ if ( this._value() === this.options.max ) {
68
+ this._trigger( "complete" );
69
+ }
70
+ }
71
+
72
+ $.Widget.prototype._setOption.apply( this, arguments );
73
+ },
74
+
75
+ _value: function() {
76
+ var val = this.options.value;
77
+ // normalize invalid value
78
+ if ( typeof val !== "number" ) {
79
+ val = 0;
80
+ }
81
+ return Math.min( this.options.max, Math.max( this.min, val ) );
82
+ },
83
+
84
+ _percentage: function() {
85
+ return 100 * this._value() / this.options.max;
86
+ },
87
+
88
+ _refreshValue: function() {
89
+ var value = this.value();
90
+ var percentage = this._percentage();
91
+
92
+ if ( this.oldValue !== value ) {
93
+ this.oldValue = value;
94
+ this._trigger( "change" );
95
+ }
96
+
97
+ this.valueDiv
98
+ .toggle( value > this.min )
99
+ .toggleClass( "ui-corner-right", value === this.options.max )
100
+ .width( percentage.toFixed(0) + "%" );
101
+ this.element.attr( "aria-valuenow", value );
102
+ }
103
+ });
104
+
105
+ $.extend( $.ui.progressbar, {
106
+ version: "1.8.13"
107
+ });
108
+
109
+ })( jQuery );
@@ -0,0 +1,814 @@
1
+ /*
2
+ * jQuery UI Resizable 1.8.13
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Resizables
9
+ *
10
+ * Depends:
11
+ * jquery.ui.core.js
12
+ * jquery.ui.mouse.js
13
+ * jquery.ui.widget.js
14
+ */
15
+ (function( $, undefined ) {
16
+
17
+ $.widget("ui.resizable", $.ui.mouse, {
18
+ widgetEventPrefix: "resize",
19
+ options: {
20
+ alsoResize: false,
21
+ animate: false,
22
+ animateDuration: "slow",
23
+ animateEasing: "swing",
24
+ aspectRatio: false,
25
+ autoHide: false,
26
+ containment: false,
27
+ ghost: false,
28
+ grid: false,
29
+ handles: "e,s,se",
30
+ helper: false,
31
+ maxHeight: null,
32
+ maxWidth: null,
33
+ minHeight: 10,
34
+ minWidth: 10,
35
+ zIndex: 1000
36
+ },
37
+ _create: function() {
38
+
39
+ var self = this, o = this.options;
40
+ this.element.addClass("ui-resizable");
41
+
42
+ $.extend(this, {
43
+ _aspectRatio: !!(o.aspectRatio),
44
+ aspectRatio: o.aspectRatio,
45
+ originalElement: this.element,
46
+ _proportionallyResizeElements: [],
47
+ _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
48
+ });
49
+
50
+ //Wrap the element if it cannot hold child nodes
51
+ if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
52
+
53
+ //Opera fix for relative positioning
54
+ if (/relative/.test(this.element.css('position')) && $.browser.opera)
55
+ this.element.css({ position: 'relative', top: 'auto', left: 'auto' });
56
+
57
+ //Create a wrapper element and set the wrapper to the new current internal element
58
+ this.element.wrap(
59
+ $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
60
+ position: this.element.css('position'),
61
+ width: this.element.outerWidth(),
62
+ height: this.element.outerHeight(),
63
+ top: this.element.css('top'),
64
+ left: this.element.css('left')
65
+ })
66
+ );
67
+
68
+ //Overwrite the original this.element
69
+ this.element = this.element.parent().data(
70
+ "resizable", this.element.data('resizable')
71
+ );
72
+
73
+ this.elementIsWrapper = true;
74
+
75
+ //Move margins to the wrapper
76
+ this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
77
+ this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
78
+
79
+ //Prevent Safari textarea resize
80
+ this.originalResizeStyle = this.originalElement.css('resize');
81
+ this.originalElement.css('resize', 'none');
82
+
83
+ //Push the actual element to our proportionallyResize internal array
84
+ this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
85
+
86
+ // avoid IE jump (hard set the margin)
87
+ this.originalElement.css({ margin: this.originalElement.css('margin') });
88
+
89
+ // fix handlers offset
90
+ this._proportionallyResize();
91
+
92
+ }
93
+
94
+ 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' });
95
+ if(this.handles.constructor == String) {
96
+
97
+ if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
98
+ var n = this.handles.split(","); this.handles = {};
99
+
100
+ for(var i = 0; i < n.length; i++) {
101
+
102
+ var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
103
+ var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
104
+
105
+ // increase zIndex of sw, se, ne, nw axis
106
+ //TODO : this modifies original option
107
+ if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
108
+
109
+ //TODO : What's going on here?
110
+ if ('se' == handle) {
111
+ axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
112
+ };
113
+
114
+ //Insert into internal handles object and append to element
115
+ this.handles[handle] = '.ui-resizable-'+handle;
116
+ this.element.append(axis);
117
+ }
118
+
119
+ }
120
+
121
+ this._renderAxis = function(target) {
122
+
123
+ target = target || this.element;
124
+
125
+ for(var i in this.handles) {
126
+
127
+ if(this.handles[i].constructor == String)
128
+ this.handles[i] = $(this.handles[i], this.element).show();
129
+
130
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
131
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
132
+
133
+ var axis = $(this.handles[i], this.element), padWrapper = 0;
134
+
135
+ //Checking the correct pad and border
136
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
137
+
138
+ //The padding type i have to apply...
139
+ var padPos = [ 'padding',
140
+ /ne|nw|n/.test(i) ? 'Top' :
141
+ /se|sw|s/.test(i) ? 'Bottom' :
142
+ /^e$/.test(i) ? 'Right' : 'Left' ].join("");
143
+
144
+ target.css(padPos, padWrapper);
145
+
146
+ this._proportionallyResize();
147
+
148
+ }
149
+
150
+ //TODO: What's that good for? There's not anything to be executed left
151
+ if(!$(this.handles[i]).length)
152
+ continue;
153
+
154
+ }
155
+ };
156
+
157
+ //TODO: make renderAxis a prototype function
158
+ this._renderAxis(this.element);
159
+
160
+ this._handles = $('.ui-resizable-handle', this.element)
161
+ .disableSelection();
162
+
163
+ //Matching axis name
164
+ this._handles.mouseover(function() {
165
+ if (!self.resizing) {
166
+ if (this.className)
167
+ var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
168
+ //Axis, default = se
169
+ self.axis = axis && axis[1] ? axis[1] : 'se';
170
+ }
171
+ });
172
+
173
+ //If we want to auto hide the elements
174
+ if (o.autoHide) {
175
+ this._handles.hide();
176
+ $(this.element)
177
+ .addClass("ui-resizable-autohide")
178
+ .hover(function() {
179
+ if (o.disabled) return;
180
+ $(this).removeClass("ui-resizable-autohide");
181
+ self._handles.show();
182
+ },
183
+ function(){
184
+ if (o.disabled) return;
185
+ if (!self.resizing) {
186
+ $(this).addClass("ui-resizable-autohide");
187
+ self._handles.hide();
188
+ }
189
+ });
190
+ }
191
+
192
+ //Initialize the mouse interaction
193
+ this._mouseInit();
194
+
195
+ },
196
+
197
+ destroy: function() {
198
+
199
+ this._mouseDestroy();
200
+
201
+ var _destroy = function(exp) {
202
+ $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
203
+ .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
204
+ };
205
+
206
+ //TODO: Unwrap at same DOM position
207
+ if (this.elementIsWrapper) {
208
+ _destroy(this.element);
209
+ var wrapper = this.element;
210
+ wrapper.after(
211
+ this.originalElement.css({
212
+ position: wrapper.css('position'),
213
+ width: wrapper.outerWidth(),
214
+ height: wrapper.outerHeight(),
215
+ top: wrapper.css('top'),
216
+ left: wrapper.css('left')
217
+ })
218
+ ).remove();
219
+ }
220
+
221
+ this.originalElement.css('resize', this.originalResizeStyle);
222
+ _destroy(this.originalElement);
223
+
224
+ return this;
225
+ },
226
+
227
+ _mouseCapture: function(event) {
228
+ var handle = false;
229
+ for (var i in this.handles) {
230
+ if ($(this.handles[i])[0] == event.target) {
231
+ handle = true;
232
+ }
233
+ }
234
+
235
+ return !this.options.disabled && handle;
236
+ },
237
+
238
+ _mouseStart: function(event) {
239
+
240
+ var o = this.options, iniPos = this.element.position(), el = this.element;
241
+
242
+ this.resizing = true;
243
+ this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
244
+
245
+ // bugfix for http://dev.jquery.com/ticket/1749
246
+ if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
247
+ el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
248
+ }
249
+
250
+ //Opera fixing relative position
251
+ if ($.browser.opera && (/relative/).test(el.css('position')))
252
+ el.css({ position: 'relative', top: 'auto', left: 'auto' });
253
+
254
+ this._renderProxy();
255
+
256
+ var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
257
+
258
+ if (o.containment) {
259
+ curleft += $(o.containment).scrollLeft() || 0;
260
+ curtop += $(o.containment).scrollTop() || 0;
261
+ }
262
+
263
+ //Store needed variables
264
+ this.offset = this.helper.offset();
265
+ this.position = { left: curleft, top: curtop };
266
+ this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
267
+ this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
268
+ this.originalPosition = { left: curleft, top: curtop };
269
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
270
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
271
+
272
+ //Aspect Ratio
273
+ this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
274
+
275
+ var cursor = $('.ui-resizable-' + this.axis).css('cursor');
276
+ $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
277
+
278
+ el.addClass("ui-resizable-resizing");
279
+ this._propagate("start", event);
280
+ return true;
281
+ },
282
+
283
+ _mouseDrag: function(event) {
284
+
285
+ //Increase performance, avoid regex
286
+ var el = this.helper, o = this.options, props = {},
287
+ self = this, smp = this.originalMousePosition, a = this.axis;
288
+
289
+ var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
290
+ var trigger = this._change[a];
291
+ if (!trigger) return false;
292
+
293
+ // Calculate the attrs that will be change
294
+ var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
295
+
296
+ if (this._aspectRatio || event.shiftKey)
297
+ data = this._updateRatio(data, event);
298
+
299
+ data = this._respectSize(data, event);
300
+
301
+ // plugins callbacks need to be called first
302
+ this._propagate("resize", event);
303
+
304
+ el.css({
305
+ top: this.position.top + "px", left: this.position.left + "px",
306
+ width: this.size.width + "px", height: this.size.height + "px"
307
+ });
308
+
309
+ if (!this._helper && this._proportionallyResizeElements.length)
310
+ this._proportionallyResize();
311
+
312
+ this._updateCache(data);
313
+
314
+ // calling the user callback at the end
315
+ this._trigger('resize', event, this.ui());
316
+
317
+ return false;
318
+ },
319
+
320
+ _mouseStop: function(event) {
321
+
322
+ this.resizing = false;
323
+ var o = this.options, self = this;
324
+
325
+ if(this._helper) {
326
+ var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
327
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
328
+ soffsetw = ista ? 0 : self.sizeDiff.width;
329
+
330
+ var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) },
331
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
332
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
333
+
334
+ if (!o.animate)
335
+ this.element.css($.extend(s, { top: top, left: left }));
336
+
337
+ self.helper.height(self.size.height);
338
+ self.helper.width(self.size.width);
339
+
340
+ if (this._helper && !o.animate) this._proportionallyResize();
341
+ }
342
+
343
+ $('body').css('cursor', 'auto');
344
+
345
+ this.element.removeClass("ui-resizable-resizing");
346
+
347
+ this._propagate("stop", event);
348
+
349
+ if (this._helper) this.helper.remove();
350
+ return false;
351
+
352
+ },
353
+
354
+ _updateCache: function(data) {
355
+ var o = this.options;
356
+ this.offset = this.helper.offset();
357
+ if (isNumber(data.left)) this.position.left = data.left;
358
+ if (isNumber(data.top)) this.position.top = data.top;
359
+ if (isNumber(data.height)) this.size.height = data.height;
360
+ if (isNumber(data.width)) this.size.width = data.width;
361
+ },
362
+
363
+ _updateRatio: function(data, event) {
364
+
365
+ var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
366
+
367
+ if (data.height) data.width = (csize.height * this.aspectRatio);
368
+ else if (data.width) data.height = (csize.width / this.aspectRatio);
369
+
370
+ if (a == 'sw') {
371
+ data.left = cpos.left + (csize.width - data.width);
372
+ data.top = null;
373
+ }
374
+ if (a == 'nw') {
375
+ data.top = cpos.top + (csize.height - data.height);
376
+ data.left = cpos.left + (csize.width - data.width);
377
+ }
378
+
379
+ return data;
380
+ },
381
+
382
+ _respectSize: function(data, event) {
383
+
384
+ var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
385
+ ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
386
+ isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
387
+
388
+ if (isminw) data.width = o.minWidth;
389
+ if (isminh) data.height = o.minHeight;
390
+ if (ismaxw) data.width = o.maxWidth;
391
+ if (ismaxh) data.height = o.maxHeight;
392
+
393
+ var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
394
+ var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
395
+
396
+ if (isminw && cw) data.left = dw - o.minWidth;
397
+ if (ismaxw && cw) data.left = dw - o.maxWidth;
398
+ if (isminh && ch) data.top = dh - o.minHeight;
399
+ if (ismaxh && ch) data.top = dh - o.maxHeight;
400
+
401
+ // fixing jump error on top/left - bug #2330
402
+ var isNotwh = !data.width && !data.height;
403
+ if (isNotwh && !data.left && data.top) data.top = null;
404
+ else if (isNotwh && !data.top && data.left) data.left = null;
405
+
406
+ return data;
407
+ },
408
+
409
+ _proportionallyResize: function() {
410
+
411
+ var o = this.options;
412
+ if (!this._proportionallyResizeElements.length) return;
413
+ var element = this.helper || this.element;
414
+
415
+ for (var i=0; i < this._proportionallyResizeElements.length; i++) {
416
+
417
+ var prel = this._proportionallyResizeElements[i];
418
+
419
+ if (!this.borderDif) {
420
+ var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
421
+ p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
422
+
423
+ this.borderDif = $.map(b, function(v, i) {
424
+ var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
425
+ return border + padding;
426
+ });
427
+ }
428
+
429
+ if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
430
+ continue;
431
+
432
+ prel.css({
433
+ height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
434
+ width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
435
+ });
436
+
437
+ };
438
+
439
+ },
440
+
441
+ _renderProxy: function() {
442
+
443
+ var el = this.element, o = this.options;
444
+ this.elementOffset = el.offset();
445
+
446
+ if(this._helper) {
447
+
448
+ this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
449
+
450
+ // fix ie6 offset TODO: This seems broken
451
+ var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
452
+ pxyoffset = ( ie6 ? 2 : -1 );
453
+
454
+ this.helper.addClass(this._helper).css({
455
+ width: this.element.outerWidth() + pxyoffset,
456
+ height: this.element.outerHeight() + pxyoffset,
457
+ position: 'absolute',
458
+ left: this.elementOffset.left - ie6offset +'px',
459
+ top: this.elementOffset.top - ie6offset +'px',
460
+ zIndex: ++o.zIndex //TODO: Don't modify option
461
+ });
462
+
463
+ this.helper
464
+ .appendTo("body")
465
+ .disableSelection();
466
+
467
+ } else {
468
+ this.helper = this.element;
469
+ }
470
+
471
+ },
472
+
473
+ _change: {
474
+ e: function(event, dx, dy) {
475
+ return { width: this.originalSize.width + dx };
476
+ },
477
+ w: function(event, dx, dy) {
478
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
479
+ return { left: sp.left + dx, width: cs.width - dx };
480
+ },
481
+ n: function(event, dx, dy) {
482
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
483
+ return { top: sp.top + dy, height: cs.height - dy };
484
+ },
485
+ s: function(event, dx, dy) {
486
+ return { height: this.originalSize.height + dy };
487
+ },
488
+ se: function(event, dx, dy) {
489
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
490
+ },
491
+ sw: function(event, dx, dy) {
492
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
493
+ },
494
+ ne: function(event, dx, dy) {
495
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
496
+ },
497
+ nw: function(event, dx, dy) {
498
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
499
+ }
500
+ },
501
+
502
+ _propagate: function(n, event) {
503
+ $.ui.plugin.call(this, n, [event, this.ui()]);
504
+ (n != "resize" && this._trigger(n, event, this.ui()));
505
+ },
506
+
507
+ plugins: {},
508
+
509
+ ui: function() {
510
+ return {
511
+ originalElement: this.originalElement,
512
+ element: this.element,
513
+ helper: this.helper,
514
+ position: this.position,
515
+ size: this.size,
516
+ originalSize: this.originalSize,
517
+ originalPosition: this.originalPosition
518
+ };
519
+ }
520
+
521
+ });
522
+
523
+ $.extend($.ui.resizable, {
524
+ version: "1.8.13"
525
+ });
526
+
527
+ /*
528
+ * Resizable Extensions
529
+ */
530
+
531
+ $.ui.plugin.add("resizable", "alsoResize", {
532
+
533
+ start: function (event, ui) {
534
+ var self = $(this).data("resizable"), o = self.options;
535
+
536
+ var _store = function (exp) {
537
+ $(exp).each(function() {
538
+ var el = $(this);
539
+ el.data("resizable-alsoresize", {
540
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
541
+ left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10),
542
+ position: el.css('position') // to reset Opera on stop()
543
+ });
544
+ });
545
+ };
546
+
547
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
548
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
549
+ else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
550
+ }else{
551
+ _store(o.alsoResize);
552
+ }
553
+ },
554
+
555
+ resize: function (event, ui) {
556
+ var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
557
+
558
+ var delta = {
559
+ height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
560
+ top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
561
+ },
562
+
563
+ _alsoResize = function (exp, c) {
564
+ $(exp).each(function() {
565
+ var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
566
+ css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
567
+
568
+ $.each(css, function (i, prop) {
569
+ var sum = (start[prop]||0) + (delta[prop]||0);
570
+ if (sum && sum >= 0)
571
+ style[prop] = sum || null;
572
+ });
573
+
574
+ // Opera fixing relative position
575
+ if ($.browser.opera && /relative/.test(el.css('position'))) {
576
+ self._revertToRelativePosition = true;
577
+ el.css({ position: 'absolute', top: 'auto', left: 'auto' });
578
+ }
579
+
580
+ el.css(style);
581
+ });
582
+ };
583
+
584
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
585
+ $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
586
+ }else{
587
+ _alsoResize(o.alsoResize);
588
+ }
589
+ },
590
+
591
+ stop: function (event, ui) {
592
+ var self = $(this).data("resizable"), o = self.options;
593
+
594
+ var _reset = function (exp) {
595
+ $(exp).each(function() {
596
+ var el = $(this);
597
+ // reset position for Opera - no need to verify it was changed
598
+ el.css({ position: el.data("resizable-alsoresize").position });
599
+ });
600
+ };
601
+
602
+ if (self._revertToRelativePosition) {
603
+ self._revertToRelativePosition = false;
604
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
605
+ $.each(o.alsoResize, function (exp) { _reset(exp); });
606
+ }else{
607
+ _reset(o.alsoResize);
608
+ }
609
+ }
610
+
611
+ $(this).removeData("resizable-alsoresize");
612
+ }
613
+ });
614
+
615
+ $.ui.plugin.add("resizable", "animate", {
616
+
617
+ stop: function(event, ui) {
618
+ var self = $(this).data("resizable"), o = self.options;
619
+
620
+ var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
621
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
622
+ soffsetw = ista ? 0 : self.sizeDiff.width;
623
+
624
+ var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
625
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
626
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
627
+
628
+ self.element.animate(
629
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
630
+ duration: o.animateDuration,
631
+ easing: o.animateEasing,
632
+ step: function() {
633
+
634
+ var data = {
635
+ width: parseInt(self.element.css('width'), 10),
636
+ height: parseInt(self.element.css('height'), 10),
637
+ top: parseInt(self.element.css('top'), 10),
638
+ left: parseInt(self.element.css('left'), 10)
639
+ };
640
+
641
+ if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
642
+
643
+ // propagating resize, and updating values for each animation step
644
+ self._updateCache(data);
645
+ self._propagate("resize", event);
646
+
647
+ }
648
+ }
649
+ );
650
+ }
651
+
652
+ });
653
+
654
+ $.ui.plugin.add("resizable", "containment", {
655
+
656
+ start: function(event, ui) {
657
+ var self = $(this).data("resizable"), o = self.options, el = self.element;
658
+ var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
659
+ if (!ce) return;
660
+
661
+ self.containerElement = $(ce);
662
+
663
+ if (/document/.test(oc) || oc == document) {
664
+ self.containerOffset = { left: 0, top: 0 };
665
+ self.containerPosition = { left: 0, top: 0 };
666
+
667
+ self.parentData = {
668
+ element: $(document), left: 0, top: 0,
669
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
670
+ };
671
+ }
672
+
673
+ // i'm a node, so compute top, left, right, bottom
674
+ else {
675
+ var element = $(ce), p = [];
676
+ $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
677
+
678
+ self.containerOffset = element.offset();
679
+ self.containerPosition = element.position();
680
+ self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
681
+
682
+ var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
683
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
684
+
685
+ self.parentData = {
686
+ element: ce, left: co.left, top: co.top, width: width, height: height
687
+ };
688
+ }
689
+ },
690
+
691
+ resize: function(event, ui) {
692
+ var self = $(this).data("resizable"), o = self.options,
693
+ ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
694
+ pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
695
+
696
+ if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
697
+
698
+ if (cp.left < (self._helper ? co.left : 0)) {
699
+ self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
700
+ if (pRatio) self.size.height = self.size.width / o.aspectRatio;
701
+ self.position.left = o.helper ? co.left : 0;
702
+ }
703
+
704
+ if (cp.top < (self._helper ? co.top : 0)) {
705
+ self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
706
+ if (pRatio) self.size.width = self.size.height * o.aspectRatio;
707
+ self.position.top = self._helper ? co.top : 0;
708
+ }
709
+
710
+ self.offset.left = self.parentData.left+self.position.left;
711
+ self.offset.top = self.parentData.top+self.position.top;
712
+
713
+ var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
714
+ hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
715
+
716
+ var isParent = self.containerElement.get(0) == self.element.parent().get(0),
717
+ isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
718
+
719
+ if(isParent && isOffsetRelative) woset -= self.parentData.left;
720
+
721
+ if (woset + self.size.width >= self.parentData.width) {
722
+ self.size.width = self.parentData.width - woset;
723
+ if (pRatio) self.size.height = self.size.width / self.aspectRatio;
724
+ }
725
+
726
+ if (hoset + self.size.height >= self.parentData.height) {
727
+ self.size.height = self.parentData.height - hoset;
728
+ if (pRatio) self.size.width = self.size.height * self.aspectRatio;
729
+ }
730
+ },
731
+
732
+ stop: function(event, ui){
733
+ var self = $(this).data("resizable"), o = self.options, cp = self.position,
734
+ co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
735
+
736
+ var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
737
+
738
+ if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
739
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
740
+
741
+ if (self._helper && !o.animate && (/static/).test(ce.css('position')))
742
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
743
+
744
+ }
745
+ });
746
+
747
+ $.ui.plugin.add("resizable", "ghost", {
748
+
749
+ start: function(event, ui) {
750
+
751
+ var self = $(this).data("resizable"), o = self.options, cs = self.size;
752
+
753
+ self.ghost = self.originalElement.clone();
754
+ self.ghost
755
+ .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
756
+ .addClass('ui-resizable-ghost')
757
+ .addClass(typeof o.ghost == 'string' ? o.ghost : '');
758
+
759
+ self.ghost.appendTo(self.helper);
760
+
761
+ },
762
+
763
+ resize: function(event, ui){
764
+ var self = $(this).data("resizable"), o = self.options;
765
+ if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
766
+ },
767
+
768
+ stop: function(event, ui){
769
+ var self = $(this).data("resizable"), o = self.options;
770
+ if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
771
+ }
772
+
773
+ });
774
+
775
+ $.ui.plugin.add("resizable", "grid", {
776
+
777
+ resize: function(event, ui) {
778
+ var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
779
+ o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
780
+ 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);
781
+
782
+ if (/^(se|s|e)$/.test(a)) {
783
+ self.size.width = os.width + ox;
784
+ self.size.height = os.height + oy;
785
+ }
786
+ else if (/^(ne)$/.test(a)) {
787
+ self.size.width = os.width + ox;
788
+ self.size.height = os.height + oy;
789
+ self.position.top = op.top - oy;
790
+ }
791
+ else if (/^(sw)$/.test(a)) {
792
+ self.size.width = os.width + ox;
793
+ self.size.height = os.height + oy;
794
+ self.position.left = op.left - ox;
795
+ }
796
+ else {
797
+ self.size.width = os.width + ox;
798
+ self.size.height = os.height + oy;
799
+ self.position.top = op.top - oy;
800
+ self.position.left = op.left - ox;
801
+ }
802
+ }
803
+
804
+ });
805
+
806
+ var num = function(v) {
807
+ return parseInt(v, 10) || 0;
808
+ };
809
+
810
+ var isNumber = function(value) {
811
+ return !isNaN(parseInt(value, 10));
812
+ };
813
+
814
+ })(jQuery);