jquery-ui-rails 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jquery-ui-rails might be problematic. Click here for more details.
- data/.gitignore +0 -1
- data/History.md +6 -0
- data/README.md +1 -0
- data/Rakefile +13 -2
- data/lib/jquery/ui/rails/version.rb +1 -1
- data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery.effects.all.js +14 -0
- data/vendor/assets/javascripts/jquery.effects.blind.js +51 -0
- data/vendor/assets/javascripts/jquery.effects.bounce.js +80 -0
- data/vendor/assets/javascripts/jquery.effects.clip.js +56 -0
- data/vendor/assets/javascripts/jquery.effects.core.js +763 -0
- data/vendor/assets/javascripts/jquery.effects.drop.js +52 -0
- data/vendor/assets/javascripts/jquery.effects.explode.js +81 -0
- data/vendor/assets/javascripts/jquery.effects.fade.js +34 -0
- data/vendor/assets/javascripts/jquery.effects.fold.js +58 -0
- data/vendor/assets/javascripts/jquery.effects.highlight.js +52 -0
- data/vendor/assets/javascripts/jquery.effects.pulsate.js +53 -0
- data/vendor/assets/javascripts/jquery.effects.scale.js +180 -0
- data/vendor/assets/javascripts/jquery.effects.shake.js +59 -0
- data/vendor/assets/javascripts/jquery.effects.slide.js +52 -0
- data/vendor/assets/javascripts/jquery.effects.transfer.js +47 -0
- data/vendor/assets/javascripts/jquery.ui.accordion.js +614 -0
- data/vendor/assets/javascripts/jquery.ui.all.js +31 -0
- data/vendor/assets/javascripts/jquery.ui.autocomplete.js +635 -0
- data/vendor/assets/javascripts/jquery.ui.button.js +417 -0
- data/vendor/assets/javascripts/jquery.ui.core.js +321 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-af.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +26 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-AU.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-GB.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-NZ.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +61 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +27 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ge.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hi.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hu.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-km.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-lb.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-mk.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl-BE.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +24 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +28 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +26 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ta.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +26 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker.js +1826 -0
- data/vendor/assets/javascripts/jquery.ui.dialog.js +882 -0
- data/vendor/assets/javascripts/jquery.ui.draggable.js +835 -0
- data/vendor/assets/javascripts/jquery.ui.droppable.js +301 -0
- data/vendor/assets/javascripts/jquery.ui.mouse.js +168 -0
- data/vendor/assets/javascripts/jquery.ui.position.js +298 -0
- data/vendor/assets/javascripts/jquery.ui.progressbar.js +112 -0
- data/vendor/assets/javascripts/jquery.ui.resizable.js +811 -0
- data/vendor/assets/javascripts/jquery.ui.selectable.js +271 -0
- data/vendor/assets/javascripts/jquery.ui.slider.js +666 -0
- data/vendor/assets/javascripts/jquery.ui.sortable.js +1085 -0
- data/vendor/assets/javascripts/jquery.ui.tabs.js +760 -0
- data/vendor/assets/javascripts/jquery.ui.widget.js +272 -0
- data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +23 -0
- data/vendor/assets/stylesheets/jquery.ui.all.css.erb +13 -0
- data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +57 -0
- data/vendor/assets/stylesheets/jquery.ui.base.css.erb +23 -0
- data/vendor/assets/stylesheets/jquery.ui.button.css.erb +42 -0
- data/vendor/assets/stylesheets/jquery.ui.core.css.erb +38 -0
- data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +72 -0
- data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +25 -0
- data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +15 -0
- data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +24 -0
- data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +14 -0
- data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +28 -0
- data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +22 -0
- data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +250 -0
- metadata +111 -113
- data/jquery-ui/GPL-LICENSE.txt +0 -278
- data/jquery-ui/MIT-LICENSE.txt +0 -25
- data/jquery-ui/package.json +0 -36
@@ -0,0 +1,298 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery UI Position 1.8.20
|
3
|
+
*
|
4
|
+
* Copyright 2012, 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/Position
|
9
|
+
*/
|
10
|
+
(function( $, undefined ) {
|
11
|
+
|
12
|
+
$.ui = $.ui || {};
|
13
|
+
|
14
|
+
var horizontalPositions = /left|center|right/,
|
15
|
+
verticalPositions = /top|center|bottom/,
|
16
|
+
center = "center",
|
17
|
+
support = {},
|
18
|
+
_position = $.fn.position,
|
19
|
+
_offset = $.fn.offset;
|
20
|
+
|
21
|
+
$.fn.position = function( options ) {
|
22
|
+
if ( !options || !options.of ) {
|
23
|
+
return _position.apply( this, arguments );
|
24
|
+
}
|
25
|
+
|
26
|
+
// make a copy, we don't want to modify arguments
|
27
|
+
options = $.extend( {}, options );
|
28
|
+
|
29
|
+
var target = $( options.of ),
|
30
|
+
targetElem = target[0],
|
31
|
+
collision = ( options.collision || "flip" ).split( " " ),
|
32
|
+
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
|
33
|
+
targetWidth,
|
34
|
+
targetHeight,
|
35
|
+
basePosition;
|
36
|
+
|
37
|
+
if ( targetElem.nodeType === 9 ) {
|
38
|
+
targetWidth = target.width();
|
39
|
+
targetHeight = target.height();
|
40
|
+
basePosition = { top: 0, left: 0 };
|
41
|
+
// TODO: use $.isWindow() in 1.9
|
42
|
+
} else if ( targetElem.setTimeout ) {
|
43
|
+
targetWidth = target.width();
|
44
|
+
targetHeight = target.height();
|
45
|
+
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
|
46
|
+
} else if ( targetElem.preventDefault ) {
|
47
|
+
// force left top to allow flipping
|
48
|
+
options.at = "left top";
|
49
|
+
targetWidth = targetHeight = 0;
|
50
|
+
basePosition = { top: options.of.pageY, left: options.of.pageX };
|
51
|
+
} else {
|
52
|
+
targetWidth = target.outerWidth();
|
53
|
+
targetHeight = target.outerHeight();
|
54
|
+
basePosition = target.offset();
|
55
|
+
}
|
56
|
+
|
57
|
+
// force my and at to have valid horizontal and veritcal positions
|
58
|
+
// if a value is missing or invalid, it will be converted to center
|
59
|
+
$.each( [ "my", "at" ], function() {
|
60
|
+
var pos = ( options[this] || "" ).split( " " );
|
61
|
+
if ( pos.length === 1) {
|
62
|
+
pos = horizontalPositions.test( pos[0] ) ?
|
63
|
+
pos.concat( [center] ) :
|
64
|
+
verticalPositions.test( pos[0] ) ?
|
65
|
+
[ center ].concat( pos ) :
|
66
|
+
[ center, center ];
|
67
|
+
}
|
68
|
+
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
|
69
|
+
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
|
70
|
+
options[ this ] = pos;
|
71
|
+
});
|
72
|
+
|
73
|
+
// normalize collision option
|
74
|
+
if ( collision.length === 1 ) {
|
75
|
+
collision[ 1 ] = collision[ 0 ];
|
76
|
+
}
|
77
|
+
|
78
|
+
// normalize offset option
|
79
|
+
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
|
80
|
+
if ( offset.length === 1 ) {
|
81
|
+
offset[ 1 ] = offset[ 0 ];
|
82
|
+
}
|
83
|
+
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
|
84
|
+
|
85
|
+
if ( options.at[0] === "right" ) {
|
86
|
+
basePosition.left += targetWidth;
|
87
|
+
} else if ( options.at[0] === center ) {
|
88
|
+
basePosition.left += targetWidth / 2;
|
89
|
+
}
|
90
|
+
|
91
|
+
if ( options.at[1] === "bottom" ) {
|
92
|
+
basePosition.top += targetHeight;
|
93
|
+
} else if ( options.at[1] === center ) {
|
94
|
+
basePosition.top += targetHeight / 2;
|
95
|
+
}
|
96
|
+
|
97
|
+
basePosition.left += offset[ 0 ];
|
98
|
+
basePosition.top += offset[ 1 ];
|
99
|
+
|
100
|
+
return this.each(function() {
|
101
|
+
var elem = $( this ),
|
102
|
+
elemWidth = elem.outerWidth(),
|
103
|
+
elemHeight = elem.outerHeight(),
|
104
|
+
marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
|
105
|
+
marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
|
106
|
+
collisionWidth = elemWidth + marginLeft +
|
107
|
+
( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
|
108
|
+
collisionHeight = elemHeight + marginTop +
|
109
|
+
( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
|
110
|
+
position = $.extend( {}, basePosition ),
|
111
|
+
collisionPosition;
|
112
|
+
|
113
|
+
if ( options.my[0] === "right" ) {
|
114
|
+
position.left -= elemWidth;
|
115
|
+
} else if ( options.my[0] === center ) {
|
116
|
+
position.left -= elemWidth / 2;
|
117
|
+
}
|
118
|
+
|
119
|
+
if ( options.my[1] === "bottom" ) {
|
120
|
+
position.top -= elemHeight;
|
121
|
+
} else if ( options.my[1] === center ) {
|
122
|
+
position.top -= elemHeight / 2;
|
123
|
+
}
|
124
|
+
|
125
|
+
// prevent fractions if jQuery version doesn't support them (see #5280)
|
126
|
+
if ( !support.fractions ) {
|
127
|
+
position.left = Math.round( position.left );
|
128
|
+
position.top = Math.round( position.top );
|
129
|
+
}
|
130
|
+
|
131
|
+
collisionPosition = {
|
132
|
+
left: position.left - marginLeft,
|
133
|
+
top: position.top - marginTop
|
134
|
+
};
|
135
|
+
|
136
|
+
$.each( [ "left", "top" ], function( i, dir ) {
|
137
|
+
if ( $.ui.position[ collision[i] ] ) {
|
138
|
+
$.ui.position[ collision[i] ][ dir ]( position, {
|
139
|
+
targetWidth: targetWidth,
|
140
|
+
targetHeight: targetHeight,
|
141
|
+
elemWidth: elemWidth,
|
142
|
+
elemHeight: elemHeight,
|
143
|
+
collisionPosition: collisionPosition,
|
144
|
+
collisionWidth: collisionWidth,
|
145
|
+
collisionHeight: collisionHeight,
|
146
|
+
offset: offset,
|
147
|
+
my: options.my,
|
148
|
+
at: options.at
|
149
|
+
});
|
150
|
+
}
|
151
|
+
});
|
152
|
+
|
153
|
+
if ( $.fn.bgiframe ) {
|
154
|
+
elem.bgiframe();
|
155
|
+
}
|
156
|
+
elem.offset( $.extend( position, { using: options.using } ) );
|
157
|
+
});
|
158
|
+
};
|
159
|
+
|
160
|
+
$.ui.position = {
|
161
|
+
fit: {
|
162
|
+
left: function( position, data ) {
|
163
|
+
var win = $( window ),
|
164
|
+
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
|
165
|
+
position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
|
166
|
+
},
|
167
|
+
top: function( position, data ) {
|
168
|
+
var win = $( window ),
|
169
|
+
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
|
170
|
+
position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
|
171
|
+
}
|
172
|
+
},
|
173
|
+
|
174
|
+
flip: {
|
175
|
+
left: function( position, data ) {
|
176
|
+
if ( data.at[0] === center ) {
|
177
|
+
return;
|
178
|
+
}
|
179
|
+
var win = $( window ),
|
180
|
+
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
|
181
|
+
myOffset = data.my[ 0 ] === "left" ?
|
182
|
+
-data.elemWidth :
|
183
|
+
data.my[ 0 ] === "right" ?
|
184
|
+
data.elemWidth :
|
185
|
+
0,
|
186
|
+
atOffset = data.at[ 0 ] === "left" ?
|
187
|
+
data.targetWidth :
|
188
|
+
-data.targetWidth,
|
189
|
+
offset = -2 * data.offset[ 0 ];
|
190
|
+
position.left += data.collisionPosition.left < 0 ?
|
191
|
+
myOffset + atOffset + offset :
|
192
|
+
over > 0 ?
|
193
|
+
myOffset + atOffset + offset :
|
194
|
+
0;
|
195
|
+
},
|
196
|
+
top: function( position, data ) {
|
197
|
+
if ( data.at[1] === center ) {
|
198
|
+
return;
|
199
|
+
}
|
200
|
+
var win = $( window ),
|
201
|
+
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
|
202
|
+
myOffset = data.my[ 1 ] === "top" ?
|
203
|
+
-data.elemHeight :
|
204
|
+
data.my[ 1 ] === "bottom" ?
|
205
|
+
data.elemHeight :
|
206
|
+
0,
|
207
|
+
atOffset = data.at[ 1 ] === "top" ?
|
208
|
+
data.targetHeight :
|
209
|
+
-data.targetHeight,
|
210
|
+
offset = -2 * data.offset[ 1 ];
|
211
|
+
position.top += data.collisionPosition.top < 0 ?
|
212
|
+
myOffset + atOffset + offset :
|
213
|
+
over > 0 ?
|
214
|
+
myOffset + atOffset + offset :
|
215
|
+
0;
|
216
|
+
}
|
217
|
+
}
|
218
|
+
};
|
219
|
+
|
220
|
+
// offset setter from jQuery 1.4
|
221
|
+
if ( !$.offset.setOffset ) {
|
222
|
+
$.offset.setOffset = function( elem, options ) {
|
223
|
+
// set position first, in-case top/left are set even on static elem
|
224
|
+
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
|
225
|
+
elem.style.position = "relative";
|
226
|
+
}
|
227
|
+
var curElem = $( elem ),
|
228
|
+
curOffset = curElem.offset(),
|
229
|
+
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
|
230
|
+
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
|
231
|
+
props = {
|
232
|
+
top: (options.top - curOffset.top) + curTop,
|
233
|
+
left: (options.left - curOffset.left) + curLeft
|
234
|
+
};
|
235
|
+
|
236
|
+
if ( 'using' in options ) {
|
237
|
+
options.using.call( elem, props );
|
238
|
+
} else {
|
239
|
+
curElem.css( props );
|
240
|
+
}
|
241
|
+
};
|
242
|
+
|
243
|
+
$.fn.offset = function( options ) {
|
244
|
+
var elem = this[ 0 ];
|
245
|
+
if ( !elem || !elem.ownerDocument ) { return null; }
|
246
|
+
if ( options ) {
|
247
|
+
return this.each(function() {
|
248
|
+
$.offset.setOffset( this, options );
|
249
|
+
});
|
250
|
+
}
|
251
|
+
return _offset.call( this );
|
252
|
+
};
|
253
|
+
}
|
254
|
+
|
255
|
+
// fraction support test (older versions of jQuery don't support fractions)
|
256
|
+
(function () {
|
257
|
+
var body = document.getElementsByTagName( "body" )[ 0 ],
|
258
|
+
div = document.createElement( "div" ),
|
259
|
+
testElement, testElementParent, testElementStyle, offset, offsetTotal;
|
260
|
+
|
261
|
+
//Create a "fake body" for testing based on method used in jQuery.support
|
262
|
+
testElement = document.createElement( body ? "div" : "body" );
|
263
|
+
testElementStyle = {
|
264
|
+
visibility: "hidden",
|
265
|
+
width: 0,
|
266
|
+
height: 0,
|
267
|
+
border: 0,
|
268
|
+
margin: 0,
|
269
|
+
background: "none"
|
270
|
+
};
|
271
|
+
if ( body ) {
|
272
|
+
$.extend( testElementStyle, {
|
273
|
+
position: "absolute",
|
274
|
+
left: "-1000px",
|
275
|
+
top: "-1000px"
|
276
|
+
});
|
277
|
+
}
|
278
|
+
for ( var i in testElementStyle ) {
|
279
|
+
testElement.style[ i ] = testElementStyle[ i ];
|
280
|
+
}
|
281
|
+
testElement.appendChild( div );
|
282
|
+
testElementParent = body || document.documentElement;
|
283
|
+
testElementParent.insertBefore( testElement, testElementParent.firstChild );
|
284
|
+
|
285
|
+
div.style.cssText = "position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;";
|
286
|
+
|
287
|
+
offset = $( div ).offset( function( _, offset ) {
|
288
|
+
return offset;
|
289
|
+
}).offset();
|
290
|
+
|
291
|
+
testElement.innerHTML = "";
|
292
|
+
testElementParent.removeChild( testElement );
|
293
|
+
|
294
|
+
offsetTotal = offset.top + offset.left + ( body ? 2000 : 0 );
|
295
|
+
support.fractions = offsetTotal > 21 && offsetTotal < 22;
|
296
|
+
})();
|
297
|
+
|
298
|
+
}( jQuery ));
|
@@ -0,0 +1,112 @@
|
|
1
|
+
//= require jquery.ui.core
|
2
|
+
//= require jquery.ui.widget
|
3
|
+
|
4
|
+
/*!
|
5
|
+
* jQuery UI Progressbar 1.8.20
|
6
|
+
*
|
7
|
+
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
|
8
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
9
|
+
* http://jquery.org/license
|
10
|
+
*
|
11
|
+
* http://docs.jquery.com/UI/Progressbar
|
12
|
+
*
|
13
|
+
* Depends:
|
14
|
+
* jquery.ui.core.js
|
15
|
+
* jquery.ui.widget.js
|
16
|
+
*/
|
17
|
+
(function( $, undefined ) {
|
18
|
+
|
19
|
+
$.widget( "ui.progressbar", {
|
20
|
+
options: {
|
21
|
+
value: 0,
|
22
|
+
max: 100
|
23
|
+
},
|
24
|
+
|
25
|
+
min: 0,
|
26
|
+
|
27
|
+
_create: function() {
|
28
|
+
this.element
|
29
|
+
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
|
30
|
+
.attr({
|
31
|
+
role: "progressbar",
|
32
|
+
"aria-valuemin": this.min,
|
33
|
+
"aria-valuemax": this.options.max,
|
34
|
+
"aria-valuenow": this._value()
|
35
|
+
});
|
36
|
+
|
37
|
+
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
|
38
|
+
.appendTo( this.element );
|
39
|
+
|
40
|
+
this.oldValue = this._value();
|
41
|
+
this._refreshValue();
|
42
|
+
},
|
43
|
+
|
44
|
+
destroy: function() {
|
45
|
+
this.element
|
46
|
+
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
|
47
|
+
.removeAttr( "role" )
|
48
|
+
.removeAttr( "aria-valuemin" )
|
49
|
+
.removeAttr( "aria-valuemax" )
|
50
|
+
.removeAttr( "aria-valuenow" );
|
51
|
+
|
52
|
+
this.valueDiv.remove();
|
53
|
+
|
54
|
+
$.Widget.prototype.destroy.apply( this, arguments );
|
55
|
+
},
|
56
|
+
|
57
|
+
value: function( newValue ) {
|
58
|
+
if ( newValue === undefined ) {
|
59
|
+
return this._value();
|
60
|
+
}
|
61
|
+
|
62
|
+
this._setOption( "value", newValue );
|
63
|
+
return this;
|
64
|
+
},
|
65
|
+
|
66
|
+
_setOption: function( key, value ) {
|
67
|
+
if ( key === "value" ) {
|
68
|
+
this.options.value = value;
|
69
|
+
this._refreshValue();
|
70
|
+
if ( this._value() === this.options.max ) {
|
71
|
+
this._trigger( "complete" );
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
$.Widget.prototype._setOption.apply( this, arguments );
|
76
|
+
},
|
77
|
+
|
78
|
+
_value: function() {
|
79
|
+
var val = this.options.value;
|
80
|
+
// normalize invalid value
|
81
|
+
if ( typeof val !== "number" ) {
|
82
|
+
val = 0;
|
83
|
+
}
|
84
|
+
return Math.min( this.options.max, Math.max( this.min, val ) );
|
85
|
+
},
|
86
|
+
|
87
|
+
_percentage: function() {
|
88
|
+
return 100 * this._value() / this.options.max;
|
89
|
+
},
|
90
|
+
|
91
|
+
_refreshValue: function() {
|
92
|
+
var value = this.value();
|
93
|
+
var percentage = this._percentage();
|
94
|
+
|
95
|
+
if ( this.oldValue !== value ) {
|
96
|
+
this.oldValue = value;
|
97
|
+
this._trigger( "change" );
|
98
|
+
}
|
99
|
+
|
100
|
+
this.valueDiv
|
101
|
+
.toggle( value > this.min )
|
102
|
+
.toggleClass( "ui-corner-right", value === this.options.max )
|
103
|
+
.width( percentage.toFixed(0) + "%" );
|
104
|
+
this.element.attr( "aria-valuenow", value );
|
105
|
+
}
|
106
|
+
});
|
107
|
+
|
108
|
+
$.extend( $.ui.progressbar, {
|
109
|
+
version: "1.8.20"
|
110
|
+
});
|
111
|
+
|
112
|
+
})( jQuery );
|
@@ -0,0 +1,811 @@
|
|
1
|
+
//= require jquery.ui.core
|
2
|
+
//= require jquery.ui.widget
|
3
|
+
//= require jquery.ui.mouse
|
4
|
+
|
5
|
+
/*!
|
6
|
+
* jQuery UI Resizable 1.8.20
|
7
|
+
*
|
8
|
+
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
|
9
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
10
|
+
* http://jquery.org/license
|
11
|
+
*
|
12
|
+
* http://docs.jquery.com/UI/Resizables
|
13
|
+
*
|
14
|
+
* Depends:
|
15
|
+
* jquery.ui.core.js
|
16
|
+
* jquery.ui.mouse.js
|
17
|
+
* jquery.ui.widget.js
|
18
|
+
*/
|
19
|
+
(function( $, undefined ) {
|
20
|
+
|
21
|
+
$.widget("ui.resizable", $.ui.mouse, {
|
22
|
+
widgetEventPrefix: "resize",
|
23
|
+
options: {
|
24
|
+
alsoResize: false,
|
25
|
+
animate: false,
|
26
|
+
animateDuration: "slow",
|
27
|
+
animateEasing: "swing",
|
28
|
+
aspectRatio: false,
|
29
|
+
autoHide: false,
|
30
|
+
containment: false,
|
31
|
+
ghost: false,
|
32
|
+
grid: false,
|
33
|
+
handles: "e,s,se",
|
34
|
+
helper: false,
|
35
|
+
maxHeight: null,
|
36
|
+
maxWidth: null,
|
37
|
+
minHeight: 10,
|
38
|
+
minWidth: 10,
|
39
|
+
zIndex: 1000
|
40
|
+
},
|
41
|
+
_create: function() {
|
42
|
+
|
43
|
+
var self = this, o = this.options;
|
44
|
+
this.element.addClass("ui-resizable");
|
45
|
+
|
46
|
+
$.extend(this, {
|
47
|
+
_aspectRatio: !!(o.aspectRatio),
|
48
|
+
aspectRatio: o.aspectRatio,
|
49
|
+
originalElement: this.element,
|
50
|
+
_proportionallyResizeElements: [],
|
51
|
+
_helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
|
52
|
+
});
|
53
|
+
|
54
|
+
//Wrap the element if it cannot hold child nodes
|
55
|
+
if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
|
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
|
+
// Apply zIndex to all handles - see #7960
|
106
|
+
axis.css({ zIndex: o.zIndex });
|
107
|
+
|
108
|
+
//TODO : What's going on here?
|
109
|
+
if ('se' == handle) {
|
110
|
+
axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
|
111
|
+
};
|
112
|
+
|
113
|
+
//Insert into internal handles object and append to element
|
114
|
+
this.handles[handle] = '.ui-resizable-'+handle;
|
115
|
+
this.element.append(axis);
|
116
|
+
}
|
117
|
+
|
118
|
+
}
|
119
|
+
|
120
|
+
this._renderAxis = function(target) {
|
121
|
+
|
122
|
+
target = target || this.element;
|
123
|
+
|
124
|
+
for(var i in this.handles) {
|
125
|
+
|
126
|
+
if(this.handles[i].constructor == String)
|
127
|
+
this.handles[i] = $(this.handles[i], this.element).show();
|
128
|
+
|
129
|
+
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
|
130
|
+
if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
|
131
|
+
|
132
|
+
var axis = $(this.handles[i], this.element), padWrapper = 0;
|
133
|
+
|
134
|
+
//Checking the correct pad and border
|
135
|
+
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
|
136
|
+
|
137
|
+
//The padding type i have to apply...
|
138
|
+
var padPos = [ 'padding',
|
139
|
+
/ne|nw|n/.test(i) ? 'Top' :
|
140
|
+
/se|sw|s/.test(i) ? 'Bottom' :
|
141
|
+
/^e$/.test(i) ? 'Right' : 'Left' ].join("");
|
142
|
+
|
143
|
+
target.css(padPos, padWrapper);
|
144
|
+
|
145
|
+
this._proportionallyResize();
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
//TODO: What's that good for? There's not anything to be executed left
|
150
|
+
if(!$(this.handles[i]).length)
|
151
|
+
continue;
|
152
|
+
|
153
|
+
}
|
154
|
+
};
|
155
|
+
|
156
|
+
//TODO: make renderAxis a prototype function
|
157
|
+
this._renderAxis(this.element);
|
158
|
+
|
159
|
+
this._handles = $('.ui-resizable-handle', this.element)
|
160
|
+
.disableSelection();
|
161
|
+
|
162
|
+
//Matching axis name
|
163
|
+
this._handles.mouseover(function() {
|
164
|
+
if (!self.resizing) {
|
165
|
+
if (this.className)
|
166
|
+
var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
|
167
|
+
//Axis, default = se
|
168
|
+
self.axis = axis && axis[1] ? axis[1] : 'se';
|
169
|
+
}
|
170
|
+
});
|
171
|
+
|
172
|
+
//If we want to auto hide the elements
|
173
|
+
if (o.autoHide) {
|
174
|
+
this._handles.hide();
|
175
|
+
$(this.element)
|
176
|
+
.addClass("ui-resizable-autohide")
|
177
|
+
.hover(function() {
|
178
|
+
if (o.disabled) return;
|
179
|
+
$(this).removeClass("ui-resizable-autohide");
|
180
|
+
self._handles.show();
|
181
|
+
},
|
182
|
+
function(){
|
183
|
+
if (o.disabled) return;
|
184
|
+
if (!self.resizing) {
|
185
|
+
$(this).addClass("ui-resizable-autohide");
|
186
|
+
self._handles.hide();
|
187
|
+
}
|
188
|
+
});
|
189
|
+
}
|
190
|
+
|
191
|
+
//Initialize the mouse interaction
|
192
|
+
this._mouseInit();
|
193
|
+
|
194
|
+
},
|
195
|
+
|
196
|
+
destroy: function() {
|
197
|
+
|
198
|
+
this._mouseDestroy();
|
199
|
+
|
200
|
+
var _destroy = function(exp) {
|
201
|
+
$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
|
202
|
+
.removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
|
203
|
+
};
|
204
|
+
|
205
|
+
//TODO: Unwrap at same DOM position
|
206
|
+
if (this.elementIsWrapper) {
|
207
|
+
_destroy(this.element);
|
208
|
+
var wrapper = this.element;
|
209
|
+
wrapper.after(
|
210
|
+
this.originalElement.css({
|
211
|
+
position: wrapper.css('position'),
|
212
|
+
width: wrapper.outerWidth(),
|
213
|
+
height: wrapper.outerHeight(),
|
214
|
+
top: wrapper.css('top'),
|
215
|
+
left: wrapper.css('left')
|
216
|
+
})
|
217
|
+
).remove();
|
218
|
+
}
|
219
|
+
|
220
|
+
this.originalElement.css('resize', this.originalResizeStyle);
|
221
|
+
_destroy(this.originalElement);
|
222
|
+
|
223
|
+
return this;
|
224
|
+
},
|
225
|
+
|
226
|
+
_mouseCapture: function(event) {
|
227
|
+
var handle = false;
|
228
|
+
for (var i in this.handles) {
|
229
|
+
if ($(this.handles[i])[0] == event.target) {
|
230
|
+
handle = true;
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
return !this.options.disabled && handle;
|
235
|
+
},
|
236
|
+
|
237
|
+
_mouseStart: function(event) {
|
238
|
+
|
239
|
+
var o = this.options, iniPos = this.element.position(), el = this.element;
|
240
|
+
|
241
|
+
this.resizing = true;
|
242
|
+
this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
|
243
|
+
|
244
|
+
// bugfix for http://dev.jquery.com/ticket/1749
|
245
|
+
if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
|
246
|
+
el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
|
247
|
+
}
|
248
|
+
|
249
|
+
this._renderProxy();
|
250
|
+
|
251
|
+
var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
|
252
|
+
|
253
|
+
if (o.containment) {
|
254
|
+
curleft += $(o.containment).scrollLeft() || 0;
|
255
|
+
curtop += $(o.containment).scrollTop() || 0;
|
256
|
+
}
|
257
|
+
|
258
|
+
//Store needed variables
|
259
|
+
this.offset = this.helper.offset();
|
260
|
+
this.position = { left: curleft, top: curtop };
|
261
|
+
this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
|
262
|
+
this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
|
263
|
+
this.originalPosition = { left: curleft, top: curtop };
|
264
|
+
this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
|
265
|
+
this.originalMousePosition = { left: event.pageX, top: event.pageY };
|
266
|
+
|
267
|
+
//Aspect Ratio
|
268
|
+
this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
|
269
|
+
|
270
|
+
var cursor = $('.ui-resizable-' + this.axis).css('cursor');
|
271
|
+
$('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
|
272
|
+
|
273
|
+
el.addClass("ui-resizable-resizing");
|
274
|
+
this._propagate("start", event);
|
275
|
+
return true;
|
276
|
+
},
|
277
|
+
|
278
|
+
_mouseDrag: function(event) {
|
279
|
+
|
280
|
+
//Increase performance, avoid regex
|
281
|
+
var el = this.helper, o = this.options, props = {},
|
282
|
+
self = this, smp = this.originalMousePosition, a = this.axis;
|
283
|
+
|
284
|
+
var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
|
285
|
+
var trigger = this._change[a];
|
286
|
+
if (!trigger) return false;
|
287
|
+
|
288
|
+
// Calculate the attrs that will be change
|
289
|
+
var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
|
290
|
+
|
291
|
+
// Put this in the mouseDrag handler since the user can start pressing shift while resizing
|
292
|
+
this._updateVirtualBoundaries(event.shiftKey);
|
293
|
+
if (this._aspectRatio || event.shiftKey)
|
294
|
+
data = this._updateRatio(data, event);
|
295
|
+
|
296
|
+
data = this._respectSize(data, event);
|
297
|
+
|
298
|
+
// plugins callbacks need to be called first
|
299
|
+
this._propagate("resize", event);
|
300
|
+
|
301
|
+
el.css({
|
302
|
+
top: this.position.top + "px", left: this.position.left + "px",
|
303
|
+
width: this.size.width + "px", height: this.size.height + "px"
|
304
|
+
});
|
305
|
+
|
306
|
+
if (!this._helper && this._proportionallyResizeElements.length)
|
307
|
+
this._proportionallyResize();
|
308
|
+
|
309
|
+
this._updateCache(data);
|
310
|
+
|
311
|
+
// calling the user callback at the end
|
312
|
+
this._trigger('resize', event, this.ui());
|
313
|
+
|
314
|
+
return false;
|
315
|
+
},
|
316
|
+
|
317
|
+
_mouseStop: function(event) {
|
318
|
+
|
319
|
+
this.resizing = false;
|
320
|
+
var o = this.options, self = this;
|
321
|
+
|
322
|
+
if(this._helper) {
|
323
|
+
var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
324
|
+
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
|
325
|
+
soffsetw = ista ? 0 : self.sizeDiff.width;
|
326
|
+
|
327
|
+
var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) },
|
328
|
+
left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
|
329
|
+
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
|
330
|
+
|
331
|
+
if (!o.animate)
|
332
|
+
this.element.css($.extend(s, { top: top, left: left }));
|
333
|
+
|
334
|
+
self.helper.height(self.size.height);
|
335
|
+
self.helper.width(self.size.width);
|
336
|
+
|
337
|
+
if (this._helper && !o.animate) this._proportionallyResize();
|
338
|
+
}
|
339
|
+
|
340
|
+
$('body').css('cursor', 'auto');
|
341
|
+
|
342
|
+
this.element.removeClass("ui-resizable-resizing");
|
343
|
+
|
344
|
+
this._propagate("stop", event);
|
345
|
+
|
346
|
+
if (this._helper) this.helper.remove();
|
347
|
+
return false;
|
348
|
+
|
349
|
+
},
|
350
|
+
|
351
|
+
_updateVirtualBoundaries: function(forceAspectRatio) {
|
352
|
+
var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
|
353
|
+
|
354
|
+
b = {
|
355
|
+
minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
|
356
|
+
maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
|
357
|
+
minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
|
358
|
+
maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
|
359
|
+
};
|
360
|
+
|
361
|
+
if(this._aspectRatio || forceAspectRatio) {
|
362
|
+
// We want to create an enclosing box whose aspect ration is the requested one
|
363
|
+
// First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
|
364
|
+
pMinWidth = b.minHeight * this.aspectRatio;
|
365
|
+
pMinHeight = b.minWidth / this.aspectRatio;
|
366
|
+
pMaxWidth = b.maxHeight * this.aspectRatio;
|
367
|
+
pMaxHeight = b.maxWidth / this.aspectRatio;
|
368
|
+
|
369
|
+
if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
|
370
|
+
if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
|
371
|
+
if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
|
372
|
+
if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
|
373
|
+
}
|
374
|
+
this._vBoundaries = b;
|
375
|
+
},
|
376
|
+
|
377
|
+
_updateCache: function(data) {
|
378
|
+
var o = this.options;
|
379
|
+
this.offset = this.helper.offset();
|
380
|
+
if (isNumber(data.left)) this.position.left = data.left;
|
381
|
+
if (isNumber(data.top)) this.position.top = data.top;
|
382
|
+
if (isNumber(data.height)) this.size.height = data.height;
|
383
|
+
if (isNumber(data.width)) this.size.width = data.width;
|
384
|
+
},
|
385
|
+
|
386
|
+
_updateRatio: function(data, event) {
|
387
|
+
|
388
|
+
var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
|
389
|
+
|
390
|
+
if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
|
391
|
+
else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
|
392
|
+
|
393
|
+
if (a == 'sw') {
|
394
|
+
data.left = cpos.left + (csize.width - data.width);
|
395
|
+
data.top = null;
|
396
|
+
}
|
397
|
+
if (a == 'nw') {
|
398
|
+
data.top = cpos.top + (csize.height - data.height);
|
399
|
+
data.left = cpos.left + (csize.width - data.width);
|
400
|
+
}
|
401
|
+
|
402
|
+
return data;
|
403
|
+
},
|
404
|
+
|
405
|
+
_respectSize: function(data, event) {
|
406
|
+
|
407
|
+
var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
|
408
|
+
ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
|
409
|
+
isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
|
410
|
+
|
411
|
+
if (isminw) data.width = o.minWidth;
|
412
|
+
if (isminh) data.height = o.minHeight;
|
413
|
+
if (ismaxw) data.width = o.maxWidth;
|
414
|
+
if (ismaxh) data.height = o.maxHeight;
|
415
|
+
|
416
|
+
var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
|
417
|
+
var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
|
418
|
+
|
419
|
+
if (isminw && cw) data.left = dw - o.minWidth;
|
420
|
+
if (ismaxw && cw) data.left = dw - o.maxWidth;
|
421
|
+
if (isminh && ch) data.top = dh - o.minHeight;
|
422
|
+
if (ismaxh && ch) data.top = dh - o.maxHeight;
|
423
|
+
|
424
|
+
// fixing jump error on top/left - bug #2330
|
425
|
+
var isNotwh = !data.width && !data.height;
|
426
|
+
if (isNotwh && !data.left && data.top) data.top = null;
|
427
|
+
else if (isNotwh && !data.top && data.left) data.left = null;
|
428
|
+
|
429
|
+
return data;
|
430
|
+
},
|
431
|
+
|
432
|
+
_proportionallyResize: function() {
|
433
|
+
|
434
|
+
var o = this.options;
|
435
|
+
if (!this._proportionallyResizeElements.length) return;
|
436
|
+
var element = this.helper || this.element;
|
437
|
+
|
438
|
+
for (var i=0; i < this._proportionallyResizeElements.length; i++) {
|
439
|
+
|
440
|
+
var prel = this._proportionallyResizeElements[i];
|
441
|
+
|
442
|
+
if (!this.borderDif) {
|
443
|
+
var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
|
444
|
+
p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
|
445
|
+
|
446
|
+
this.borderDif = $.map(b, function(v, i) {
|
447
|
+
var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
|
448
|
+
return border + padding;
|
449
|
+
});
|
450
|
+
}
|
451
|
+
|
452
|
+
if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
|
453
|
+
continue;
|
454
|
+
|
455
|
+
prel.css({
|
456
|
+
height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
|
457
|
+
width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
|
458
|
+
});
|
459
|
+
|
460
|
+
};
|
461
|
+
|
462
|
+
},
|
463
|
+
|
464
|
+
_renderProxy: function() {
|
465
|
+
|
466
|
+
var el = this.element, o = this.options;
|
467
|
+
this.elementOffset = el.offset();
|
468
|
+
|
469
|
+
if(this._helper) {
|
470
|
+
|
471
|
+
this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
|
472
|
+
|
473
|
+
// fix ie6 offset TODO: This seems broken
|
474
|
+
var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
|
475
|
+
pxyoffset = ( ie6 ? 2 : -1 );
|
476
|
+
|
477
|
+
this.helper.addClass(this._helper).css({
|
478
|
+
width: this.element.outerWidth() + pxyoffset,
|
479
|
+
height: this.element.outerHeight() + pxyoffset,
|
480
|
+
position: 'absolute',
|
481
|
+
left: this.elementOffset.left - ie6offset +'px',
|
482
|
+
top: this.elementOffset.top - ie6offset +'px',
|
483
|
+
zIndex: ++o.zIndex //TODO: Don't modify option
|
484
|
+
});
|
485
|
+
|
486
|
+
this.helper
|
487
|
+
.appendTo("body")
|
488
|
+
.disableSelection();
|
489
|
+
|
490
|
+
} else {
|
491
|
+
this.helper = this.element;
|
492
|
+
}
|
493
|
+
|
494
|
+
},
|
495
|
+
|
496
|
+
_change: {
|
497
|
+
e: function(event, dx, dy) {
|
498
|
+
return { width: this.originalSize.width + dx };
|
499
|
+
},
|
500
|
+
w: function(event, dx, dy) {
|
501
|
+
var o = this.options, cs = this.originalSize, sp = this.originalPosition;
|
502
|
+
return { left: sp.left + dx, width: cs.width - dx };
|
503
|
+
},
|
504
|
+
n: function(event, dx, dy) {
|
505
|
+
var o = this.options, cs = this.originalSize, sp = this.originalPosition;
|
506
|
+
return { top: sp.top + dy, height: cs.height - dy };
|
507
|
+
},
|
508
|
+
s: function(event, dx, dy) {
|
509
|
+
return { height: this.originalSize.height + dy };
|
510
|
+
},
|
511
|
+
se: function(event, dx, dy) {
|
512
|
+
return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
|
513
|
+
},
|
514
|
+
sw: function(event, dx, dy) {
|
515
|
+
return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
|
516
|
+
},
|
517
|
+
ne: function(event, dx, dy) {
|
518
|
+
return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
|
519
|
+
},
|
520
|
+
nw: function(event, dx, dy) {
|
521
|
+
return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
|
522
|
+
}
|
523
|
+
},
|
524
|
+
|
525
|
+
_propagate: function(n, event) {
|
526
|
+
$.ui.plugin.call(this, n, [event, this.ui()]);
|
527
|
+
(n != "resize" && this._trigger(n, event, this.ui()));
|
528
|
+
},
|
529
|
+
|
530
|
+
plugins: {},
|
531
|
+
|
532
|
+
ui: function() {
|
533
|
+
return {
|
534
|
+
originalElement: this.originalElement,
|
535
|
+
element: this.element,
|
536
|
+
helper: this.helper,
|
537
|
+
position: this.position,
|
538
|
+
size: this.size,
|
539
|
+
originalSize: this.originalSize,
|
540
|
+
originalPosition: this.originalPosition
|
541
|
+
};
|
542
|
+
}
|
543
|
+
|
544
|
+
});
|
545
|
+
|
546
|
+
$.extend($.ui.resizable, {
|
547
|
+
version: "1.8.20"
|
548
|
+
});
|
549
|
+
|
550
|
+
/*
|
551
|
+
* Resizable Extensions
|
552
|
+
*/
|
553
|
+
|
554
|
+
$.ui.plugin.add("resizable", "alsoResize", {
|
555
|
+
|
556
|
+
start: function (event, ui) {
|
557
|
+
var self = $(this).data("resizable"), o = self.options;
|
558
|
+
|
559
|
+
var _store = function (exp) {
|
560
|
+
$(exp).each(function() {
|
561
|
+
var el = $(this);
|
562
|
+
el.data("resizable-alsoresize", {
|
563
|
+
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
|
564
|
+
left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
|
565
|
+
});
|
566
|
+
});
|
567
|
+
};
|
568
|
+
|
569
|
+
if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
|
570
|
+
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
|
571
|
+
else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
|
572
|
+
}else{
|
573
|
+
_store(o.alsoResize);
|
574
|
+
}
|
575
|
+
},
|
576
|
+
|
577
|
+
resize: function (event, ui) {
|
578
|
+
var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
|
579
|
+
|
580
|
+
var delta = {
|
581
|
+
height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
|
582
|
+
top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
|
583
|
+
},
|
584
|
+
|
585
|
+
_alsoResize = function (exp, c) {
|
586
|
+
$(exp).each(function() {
|
587
|
+
var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
|
588
|
+
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
|
589
|
+
|
590
|
+
$.each(css, function (i, prop) {
|
591
|
+
var sum = (start[prop]||0) + (delta[prop]||0);
|
592
|
+
if (sum && sum >= 0)
|
593
|
+
style[prop] = sum || null;
|
594
|
+
});
|
595
|
+
|
596
|
+
el.css(style);
|
597
|
+
});
|
598
|
+
};
|
599
|
+
|
600
|
+
if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
|
601
|
+
$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
|
602
|
+
}else{
|
603
|
+
_alsoResize(o.alsoResize);
|
604
|
+
}
|
605
|
+
},
|
606
|
+
|
607
|
+
stop: function (event, ui) {
|
608
|
+
$(this).removeData("resizable-alsoresize");
|
609
|
+
}
|
610
|
+
});
|
611
|
+
|
612
|
+
$.ui.plugin.add("resizable", "animate", {
|
613
|
+
|
614
|
+
stop: function(event, ui) {
|
615
|
+
var self = $(this).data("resizable"), o = self.options;
|
616
|
+
|
617
|
+
var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
618
|
+
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
|
619
|
+
soffsetw = ista ? 0 : self.sizeDiff.width;
|
620
|
+
|
621
|
+
var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
|
622
|
+
left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
|
623
|
+
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
|
624
|
+
|
625
|
+
self.element.animate(
|
626
|
+
$.extend(style, top && left ? { top: top, left: left } : {}), {
|
627
|
+
duration: o.animateDuration,
|
628
|
+
easing: o.animateEasing,
|
629
|
+
step: function() {
|
630
|
+
|
631
|
+
var data = {
|
632
|
+
width: parseInt(self.element.css('width'), 10),
|
633
|
+
height: parseInt(self.element.css('height'), 10),
|
634
|
+
top: parseInt(self.element.css('top'), 10),
|
635
|
+
left: parseInt(self.element.css('left'), 10)
|
636
|
+
};
|
637
|
+
|
638
|
+
if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
|
639
|
+
|
640
|
+
// propagating resize, and updating values for each animation step
|
641
|
+
self._updateCache(data);
|
642
|
+
self._propagate("resize", event);
|
643
|
+
|
644
|
+
}
|
645
|
+
}
|
646
|
+
);
|
647
|
+
}
|
648
|
+
|
649
|
+
});
|
650
|
+
|
651
|
+
$.ui.plugin.add("resizable", "containment", {
|
652
|
+
|
653
|
+
start: function(event, ui) {
|
654
|
+
var self = $(this).data("resizable"), o = self.options, el = self.element;
|
655
|
+
var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
|
656
|
+
if (!ce) return;
|
657
|
+
|
658
|
+
self.containerElement = $(ce);
|
659
|
+
|
660
|
+
if (/document/.test(oc) || oc == document) {
|
661
|
+
self.containerOffset = { left: 0, top: 0 };
|
662
|
+
self.containerPosition = { left: 0, top: 0 };
|
663
|
+
|
664
|
+
self.parentData = {
|
665
|
+
element: $(document), left: 0, top: 0,
|
666
|
+
width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
|
667
|
+
};
|
668
|
+
}
|
669
|
+
|
670
|
+
// i'm a node, so compute top, left, right, bottom
|
671
|
+
else {
|
672
|
+
var element = $(ce), p = [];
|
673
|
+
$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
|
674
|
+
|
675
|
+
self.containerOffset = element.offset();
|
676
|
+
self.containerPosition = element.position();
|
677
|
+
self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
|
678
|
+
|
679
|
+
var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
|
680
|
+
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
|
681
|
+
|
682
|
+
self.parentData = {
|
683
|
+
element: ce, left: co.left, top: co.top, width: width, height: height
|
684
|
+
};
|
685
|
+
}
|
686
|
+
},
|
687
|
+
|
688
|
+
resize: function(event, ui) {
|
689
|
+
var self = $(this).data("resizable"), o = self.options,
|
690
|
+
ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
|
691
|
+
pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
|
692
|
+
|
693
|
+
if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
|
694
|
+
|
695
|
+
if (cp.left < (self._helper ? co.left : 0)) {
|
696
|
+
self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
|
697
|
+
if (pRatio) self.size.height = self.size.width / self.aspectRatio;
|
698
|
+
self.position.left = o.helper ? co.left : 0;
|
699
|
+
}
|
700
|
+
|
701
|
+
if (cp.top < (self._helper ? co.top : 0)) {
|
702
|
+
self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
|
703
|
+
if (pRatio) self.size.width = self.size.height * self.aspectRatio;
|
704
|
+
self.position.top = self._helper ? co.top : 0;
|
705
|
+
}
|
706
|
+
|
707
|
+
self.offset.left = self.parentData.left+self.position.left;
|
708
|
+
self.offset.top = self.parentData.top+self.position.top;
|
709
|
+
|
710
|
+
var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
|
711
|
+
hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
|
712
|
+
|
713
|
+
var isParent = self.containerElement.get(0) == self.element.parent().get(0),
|
714
|
+
isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
|
715
|
+
|
716
|
+
if(isParent && isOffsetRelative) woset -= self.parentData.left;
|
717
|
+
|
718
|
+
if (woset + self.size.width >= self.parentData.width) {
|
719
|
+
self.size.width = self.parentData.width - woset;
|
720
|
+
if (pRatio) self.size.height = self.size.width / self.aspectRatio;
|
721
|
+
}
|
722
|
+
|
723
|
+
if (hoset + self.size.height >= self.parentData.height) {
|
724
|
+
self.size.height = self.parentData.height - hoset;
|
725
|
+
if (pRatio) self.size.width = self.size.height * self.aspectRatio;
|
726
|
+
}
|
727
|
+
},
|
728
|
+
|
729
|
+
stop: function(event, ui){
|
730
|
+
var self = $(this).data("resizable"), o = self.options, cp = self.position,
|
731
|
+
co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
|
732
|
+
|
733
|
+
var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
|
734
|
+
|
735
|
+
if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
|
736
|
+
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
737
|
+
|
738
|
+
if (self._helper && !o.animate && (/static/).test(ce.css('position')))
|
739
|
+
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
740
|
+
|
741
|
+
}
|
742
|
+
});
|
743
|
+
|
744
|
+
$.ui.plugin.add("resizable", "ghost", {
|
745
|
+
|
746
|
+
start: function(event, ui) {
|
747
|
+
|
748
|
+
var self = $(this).data("resizable"), o = self.options, cs = self.size;
|
749
|
+
|
750
|
+
self.ghost = self.originalElement.clone();
|
751
|
+
self.ghost
|
752
|
+
.css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
|
753
|
+
.addClass('ui-resizable-ghost')
|
754
|
+
.addClass(typeof o.ghost == 'string' ? o.ghost : '');
|
755
|
+
|
756
|
+
self.ghost.appendTo(self.helper);
|
757
|
+
|
758
|
+
},
|
759
|
+
|
760
|
+
resize: function(event, ui){
|
761
|
+
var self = $(this).data("resizable"), o = self.options;
|
762
|
+
if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
|
763
|
+
},
|
764
|
+
|
765
|
+
stop: function(event, ui){
|
766
|
+
var self = $(this).data("resizable"), o = self.options;
|
767
|
+
if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
|
768
|
+
}
|
769
|
+
|
770
|
+
});
|
771
|
+
|
772
|
+
$.ui.plugin.add("resizable", "grid", {
|
773
|
+
|
774
|
+
resize: function(event, ui) {
|
775
|
+
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;
|
776
|
+
o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
|
777
|
+
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);
|
778
|
+
|
779
|
+
if (/^(se|s|e)$/.test(a)) {
|
780
|
+
self.size.width = os.width + ox;
|
781
|
+
self.size.height = os.height + oy;
|
782
|
+
}
|
783
|
+
else if (/^(ne)$/.test(a)) {
|
784
|
+
self.size.width = os.width + ox;
|
785
|
+
self.size.height = os.height + oy;
|
786
|
+
self.position.top = op.top - oy;
|
787
|
+
}
|
788
|
+
else if (/^(sw)$/.test(a)) {
|
789
|
+
self.size.width = os.width + ox;
|
790
|
+
self.size.height = os.height + oy;
|
791
|
+
self.position.left = op.left - ox;
|
792
|
+
}
|
793
|
+
else {
|
794
|
+
self.size.width = os.width + ox;
|
795
|
+
self.size.height = os.height + oy;
|
796
|
+
self.position.top = op.top - oy;
|
797
|
+
self.position.left = op.left - ox;
|
798
|
+
}
|
799
|
+
}
|
800
|
+
|
801
|
+
});
|
802
|
+
|
803
|
+
var num = function(v) {
|
804
|
+
return parseInt(v, 10) || 0;
|
805
|
+
};
|
806
|
+
|
807
|
+
var isNumber = function(value) {
|
808
|
+
return !isNaN(parseInt(value, 10));
|
809
|
+
};
|
810
|
+
|
811
|
+
})(jQuery);
|