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