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