pager-jrails 0.3.20080506
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +21 -0
- data/README +17 -0
- data/README.GEM +4 -0
- data/install.rb +9 -0
- data/javascripts/jquery-fx.js +28 -0
- data/javascripts/jquery-ui.js +85 -0
- data/javascripts/jquery.js +32 -0
- data/javascripts/jrails.js +4 -0
- data/javascripts/sources/jquery-fx.js +1053 -0
- data/javascripts/sources/jquery-ui.js +2158 -0
- data/javascripts/sources/jrails.js +174 -0
- data/lib/jrails.rb +284 -0
- data/lib/pager-jrails.rb +3 -0
- data/rails/init.rb +1 -0
- data/tasks/jrails.rake +19 -0
- metadata +71 -0
@@ -0,0 +1,1053 @@
|
|
1
|
+
(function($) {
|
2
|
+
|
3
|
+
$.ec = $.ec || {}; //Add the 'ec' scope
|
4
|
+
|
5
|
+
$.extend($.ec, {
|
6
|
+
save: function(el, set) {
|
7
|
+
for(var i=0;i<set.length;i++) {
|
8
|
+
if(set[i] !== null) $.data(el[0], "ec.storage."+set[i], el.css(set[i]));
|
9
|
+
}
|
10
|
+
},
|
11
|
+
restore: function(el, set) {
|
12
|
+
for(var i=0;i<set.length;i++) {
|
13
|
+
if(set[i] !== null) el.css(set[i], $.data(el[0], "ec.storage."+set[i]));
|
14
|
+
}
|
15
|
+
},
|
16
|
+
setMode: function(el, mode) {
|
17
|
+
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
|
18
|
+
return mode;
|
19
|
+
},
|
20
|
+
getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
|
21
|
+
// this should be a little more flexible in the future to handle a string & hash
|
22
|
+
var y, x;
|
23
|
+
switch (origin[0]) {
|
24
|
+
case 'top': y = 0; break;
|
25
|
+
case 'middle': y = 0.5; break;
|
26
|
+
case 'bottom': y = 1; break;
|
27
|
+
default: y = origin[0] / original.height;
|
28
|
+
};
|
29
|
+
switch (origin[1]) {
|
30
|
+
case 'left': x = 0; break;
|
31
|
+
case 'center': x = 0.5; break;
|
32
|
+
case 'right': x = 1; break;
|
33
|
+
default: x = origin[1] / original.width;
|
34
|
+
};
|
35
|
+
return {x: x, y: y};
|
36
|
+
},
|
37
|
+
createWrapper: function(el) {
|
38
|
+
if (el.parent().attr('id') == 'fxWrapper')
|
39
|
+
return el;
|
40
|
+
var props = {width: el.outerWidth({margin:true}), height: el.outerHeight({margin:true}), 'float': el.css('float')};
|
41
|
+
el.wrap('<div id="fxWrapper"></div>');
|
42
|
+
var wrapper = el.parent();
|
43
|
+
if (el.css('position') == 'static'){
|
44
|
+
wrapper.css({position: 'relative'});
|
45
|
+
el.css({position: 'relative'});
|
46
|
+
} else {
|
47
|
+
var top = parseInt(el.css('top'), 10); if (top.constructor != Number) top = 'auto';
|
48
|
+
var left = parseInt(el.css('left'), 10); if (left.constructor != Number) left = 'auto';
|
49
|
+
wrapper.css({ position: el.css('position'), top: top, left: left, zIndex: el.css('z-index') }).show();
|
50
|
+
el.css({position: 'relative', top:0, left:0});
|
51
|
+
}
|
52
|
+
wrapper.css(props);
|
53
|
+
return wrapper;
|
54
|
+
},
|
55
|
+
removeWrapper: function(el) {
|
56
|
+
if (el.parent().attr('id') == 'fxWrapper')
|
57
|
+
return el.parent().replaceWith(el);
|
58
|
+
return el;
|
59
|
+
},
|
60
|
+
setTransition: function(el, list, factor, val) {
|
61
|
+
val = val || {};
|
62
|
+
$.each(list,function(i, x){
|
63
|
+
unit = el.cssUnit(x);
|
64
|
+
if (unit[0] > 0) val[x] = unit[0] * factor + unit[1];
|
65
|
+
});
|
66
|
+
return val;
|
67
|
+
},
|
68
|
+
animateClass: function(value, duration, easing, callback) {
|
69
|
+
|
70
|
+
var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
|
71
|
+
var ea = (typeof easing == "object" ? easing : null);
|
72
|
+
|
73
|
+
this.each(function() {
|
74
|
+
|
75
|
+
var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
|
76
|
+
if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
|
77
|
+
if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
|
78
|
+
|
79
|
+
//Let's get a style offset
|
80
|
+
var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
|
81
|
+
if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
|
82
|
+
var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
|
83
|
+
if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
|
84
|
+
|
85
|
+
// The main function to form the object for animation
|
86
|
+
for(var n in newStyle) {
|
87
|
+
if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
|
88
|
+
&& n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
|
89
|
+
&& newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
|
90
|
+
&& (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
|
91
|
+
&& (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
|
92
|
+
) offset[n] = newStyle[n];
|
93
|
+
}
|
94
|
+
|
95
|
+
that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
|
96
|
+
// Change style attribute back to original. For stupid IE, we need to clear the damn object.
|
97
|
+
if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
|
98
|
+
if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
|
99
|
+
if(cb) cb.apply(this, arguments);
|
100
|
+
});
|
101
|
+
|
102
|
+
});
|
103
|
+
}
|
104
|
+
});
|
105
|
+
|
106
|
+
//Extend the methods of jQuery
|
107
|
+
$.fn.extend({
|
108
|
+
//Save old methods
|
109
|
+
_show: $.fn.show,
|
110
|
+
_hide: $.fn.hide,
|
111
|
+
__toggle: $.fn.toggle,
|
112
|
+
_addClass: $.fn.addClass,
|
113
|
+
_removeClass: $.fn.removeClass,
|
114
|
+
_toggleClass: $.fn.toggleClass,
|
115
|
+
// New ec methods
|
116
|
+
effect: function(fx,o,speed,callback) {
|
117
|
+
return $.ec[fx] ? $.ec[fx].call(this, {method: fx, options: o || {}, duration: speed, callback: callback }) : null;
|
118
|
+
},
|
119
|
+
show: function() {
|
120
|
+
if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
|
121
|
+
return this._show.apply(this, arguments);
|
122
|
+
else {
|
123
|
+
var o = arguments[1] || {}; o['mode'] = 'show';
|
124
|
+
return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
|
125
|
+
}
|
126
|
+
},
|
127
|
+
hide: function() {
|
128
|
+
if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
|
129
|
+
return this._hide.apply(this, arguments);
|
130
|
+
else {
|
131
|
+
var o = arguments[1] || {}; o['mode'] = 'hide';
|
132
|
+
return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
|
133
|
+
}
|
134
|
+
},
|
135
|
+
toggle: function(){
|
136
|
+
if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])) || (arguments[0].constructor == Function))
|
137
|
+
return this.__toggle.apply(this, arguments);
|
138
|
+
else {
|
139
|
+
var o = arguments[1] || {}; o['mode'] = 'toggle';
|
140
|
+
return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
|
141
|
+
}
|
142
|
+
},
|
143
|
+
addClass: function(classNames,speed,easing,callback) {
|
144
|
+
return speed ? $.ec.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
|
145
|
+
},
|
146
|
+
removeClass: function(classNames,speed,easing,callback) {
|
147
|
+
return speed ? $.ec.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
|
148
|
+
},
|
149
|
+
toggleClass: function(classNames,speed,easing,callback) {
|
150
|
+
return speed ? $.ec.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames);
|
151
|
+
},
|
152
|
+
morph: function(remove,add,speed,easing,callback) {
|
153
|
+
return $.ec.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
|
154
|
+
},
|
155
|
+
switchClass: function() {
|
156
|
+
this.morph.apply(this, arguments);
|
157
|
+
},
|
158
|
+
// helper functions
|
159
|
+
cssUnit: function(key) {
|
160
|
+
var style = this.css(key), val = [];
|
161
|
+
$.each( ['em','px','%','pt'], function(i, unit){
|
162
|
+
if(style.indexOf(unit) > 0)
|
163
|
+
val = [parseFloat(style), unit];
|
164
|
+
});
|
165
|
+
return val;
|
166
|
+
}
|
167
|
+
});
|
168
|
+
|
169
|
+
/*
|
170
|
+
* jQuery Color Animations
|
171
|
+
* Copyright 2007 John Resig
|
172
|
+
* Released under the MIT and GPL licenses.
|
173
|
+
*/
|
174
|
+
|
175
|
+
// We override the animation for all of these color styles
|
176
|
+
jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
|
177
|
+
jQuery.fx.step[attr] = function(fx){
|
178
|
+
if ( fx.state == 0 ) {
|
179
|
+
fx.start = getColor( fx.elem, attr );
|
180
|
+
fx.end = getRGB( fx.end );
|
181
|
+
}
|
182
|
+
|
183
|
+
fx.elem.style[attr] = "rgb(" + [
|
184
|
+
Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
|
185
|
+
Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
|
186
|
+
Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
|
187
|
+
].join(",") + ")";
|
188
|
+
}
|
189
|
+
});
|
190
|
+
|
191
|
+
// Color Conversion functions from highlightFade
|
192
|
+
// By Blair Mitchelmore
|
193
|
+
// http://jquery.offput.ca/highlightFade/
|
194
|
+
|
195
|
+
// Parse strings looking for color tuples [255,255,255]
|
196
|
+
function getRGB(color) {
|
197
|
+
var result;
|
198
|
+
|
199
|
+
// Check if we're already dealing with an array of colors
|
200
|
+
if ( color && color.constructor == Array && color.length == 3 )
|
201
|
+
return color;
|
202
|
+
|
203
|
+
// Look for rgb(num,num,num)
|
204
|
+
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
|
205
|
+
return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
|
206
|
+
|
207
|
+
// Look for rgb(num%,num%,num%)
|
208
|
+
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
|
209
|
+
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
|
210
|
+
|
211
|
+
// Look for #a0b1c2
|
212
|
+
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
|
213
|
+
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
|
214
|
+
|
215
|
+
// Look for #fff
|
216
|
+
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
|
217
|
+
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
|
218
|
+
|
219
|
+
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
|
220
|
+
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
|
221
|
+
return colors['transparent']
|
222
|
+
|
223
|
+
// Otherwise, we're most likely dealing with a named color
|
224
|
+
return colors[jQuery.trim(color).toLowerCase()];
|
225
|
+
}
|
226
|
+
|
227
|
+
function getColor(elem, attr) {
|
228
|
+
var color;
|
229
|
+
|
230
|
+
do {
|
231
|
+
color = jQuery.curCSS(elem, attr);
|
232
|
+
|
233
|
+
// Keep going until we find an element that has color, or we hit the body
|
234
|
+
if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
|
235
|
+
break;
|
236
|
+
|
237
|
+
attr = "backgroundColor";
|
238
|
+
} while ( elem = elem.parentNode );
|
239
|
+
|
240
|
+
return getRGB(color);
|
241
|
+
};
|
242
|
+
|
243
|
+
// Some named colors to work with
|
244
|
+
// From Interface by Stefan Petre
|
245
|
+
// http://interface.eyecon.ro/
|
246
|
+
|
247
|
+
var colors = {
|
248
|
+
aqua:[0,255,255],
|
249
|
+
azure:[240,255,255],
|
250
|
+
beige:[245,245,220],
|
251
|
+
black:[0,0,0],
|
252
|
+
blue:[0,0,255],
|
253
|
+
brown:[165,42,42],
|
254
|
+
cyan:[0,255,255],
|
255
|
+
darkblue:[0,0,139],
|
256
|
+
darkcyan:[0,139,139],
|
257
|
+
darkgrey:[169,169,169],
|
258
|
+
darkgreen:[0,100,0],
|
259
|
+
darkkhaki:[189,183,107],
|
260
|
+
darkmagenta:[139,0,139],
|
261
|
+
darkolivegreen:[85,107,47],
|
262
|
+
darkorange:[255,140,0],
|
263
|
+
darkorchid:[153,50,204],
|
264
|
+
darkred:[139,0,0],
|
265
|
+
darksalmon:[233,150,122],
|
266
|
+
darkviolet:[148,0,211],
|
267
|
+
fuchsia:[255,0,255],
|
268
|
+
gold:[255,215,0],
|
269
|
+
green:[0,128,0],
|
270
|
+
indigo:[75,0,130],
|
271
|
+
khaki:[240,230,140],
|
272
|
+
lightblue:[173,216,230],
|
273
|
+
lightcyan:[224,255,255],
|
274
|
+
lightgreen:[144,238,144],
|
275
|
+
lightgrey:[211,211,211],
|
276
|
+
lightpink:[255,182,193],
|
277
|
+
lightyellow:[255,255,224],
|
278
|
+
lime:[0,255,0],
|
279
|
+
magenta:[255,0,255],
|
280
|
+
maroon:[128,0,0],
|
281
|
+
navy:[0,0,128],
|
282
|
+
olive:[128,128,0],
|
283
|
+
orange:[255,165,0],
|
284
|
+
pink:[255,192,203],
|
285
|
+
purple:[128,0,128],
|
286
|
+
violet:[128,0,128],
|
287
|
+
red:[255,0,0],
|
288
|
+
silver:[192,192,192],
|
289
|
+
white:[255,255,255],
|
290
|
+
yellow:[255,255,0],
|
291
|
+
transparent: [255,255,255]
|
292
|
+
};
|
293
|
+
|
294
|
+
})(jQuery);
|
295
|
+
|
296
|
+
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
297
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
298
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
299
|
+
*
|
300
|
+
* $LastChangedDate: 2007-12-20 07:43:48 -0700 (Thu, 20 Dec 2007) $
|
301
|
+
* $Rev: 4257 $
|
302
|
+
*
|
303
|
+
* Version: @VERSION
|
304
|
+
*
|
305
|
+
* Requires: jQuery 1.2+
|
306
|
+
*/
|
307
|
+
|
308
|
+
(function($){
|
309
|
+
|
310
|
+
$.dimensions = {
|
311
|
+
version: '@VERSION'
|
312
|
+
};
|
313
|
+
|
314
|
+
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
|
315
|
+
$.each( [ 'Height', 'Width' ], function(i, name){
|
316
|
+
|
317
|
+
// innerHeight and innerWidth
|
318
|
+
$.fn[ 'inner' + name ] = function() {
|
319
|
+
if (!this[0]) return;
|
320
|
+
|
321
|
+
var torl = name == 'Height' ? 'Top' : 'Left', // top or left
|
322
|
+
borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
|
323
|
+
|
324
|
+
return this.is(':visible') ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
|
325
|
+
};
|
326
|
+
|
327
|
+
// outerHeight and outerWidth
|
328
|
+
$.fn[ 'outer' + name ] = function(options) {
|
329
|
+
if (!this[0]) return;
|
330
|
+
|
331
|
+
var torl = name == 'Height' ? 'Top' : 'Left', // top or left
|
332
|
+
borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
|
333
|
+
|
334
|
+
options = $.extend({ margin: false }, options || {});
|
335
|
+
|
336
|
+
var val = this.is(':visible') ?
|
337
|
+
this[0]['offset' + name] :
|
338
|
+
num( this, name.toLowerCase() )
|
339
|
+
+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
|
340
|
+
+ num(this, 'padding' + torl) + num(this, 'padding' + borr);
|
341
|
+
|
342
|
+
return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
|
343
|
+
};
|
344
|
+
});
|
345
|
+
|
346
|
+
// Create scrollLeft and scrollTop methods
|
347
|
+
$.each( ['Left', 'Top'], function(i, name) {
|
348
|
+
$.fn[ 'scroll' + name ] = function(val) {
|
349
|
+
if (!this[0]) return;
|
350
|
+
|
351
|
+
return val != undefined ?
|
352
|
+
|
353
|
+
// Set the scroll offset
|
354
|
+
this.each(function() {
|
355
|
+
this == window || this == document ?
|
356
|
+
window.scrollTo(
|
357
|
+
name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
|
358
|
+
name == 'Top' ? val : $(window)[ 'scrollTop' ]()
|
359
|
+
) :
|
360
|
+
this[ 'scroll' + name ] = val;
|
361
|
+
}) :
|
362
|
+
|
363
|
+
// Return the scroll offset
|
364
|
+
this[0] == window || this[0] == document ?
|
365
|
+
self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
|
366
|
+
$.boxModel && document.documentElement[ 'scroll' + name ] ||
|
367
|
+
document.body[ 'scroll' + name ] :
|
368
|
+
this[0][ 'scroll' + name ];
|
369
|
+
};
|
370
|
+
});
|
371
|
+
|
372
|
+
$.fn.extend({
|
373
|
+
position: function() {
|
374
|
+
var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
|
375
|
+
|
376
|
+
if (elem) {
|
377
|
+
// Get *real* offsetParent
|
378
|
+
offsetParent = this.offsetParent();
|
379
|
+
|
380
|
+
// Get correct offsets
|
381
|
+
offset = this.offset();
|
382
|
+
parentOffset = offsetParent.offset();
|
383
|
+
|
384
|
+
// Subtract element margins
|
385
|
+
offset.top -= num(elem, 'marginTop');
|
386
|
+
offset.left -= num(elem, 'marginLeft');
|
387
|
+
|
388
|
+
// Add offsetParent borders
|
389
|
+
parentOffset.top += num(offsetParent, 'borderTopWidth');
|
390
|
+
parentOffset.left += num(offsetParent, 'borderLeftWidth');
|
391
|
+
|
392
|
+
// Subtract the two offsets
|
393
|
+
results = {
|
394
|
+
top: offset.top - parentOffset.top,
|
395
|
+
left: offset.left - parentOffset.left
|
396
|
+
};
|
397
|
+
}
|
398
|
+
|
399
|
+
return results;
|
400
|
+
},
|
401
|
+
|
402
|
+
offsetParent: function() {
|
403
|
+
var offsetParent = this[0].offsetParent;
|
404
|
+
while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
|
405
|
+
offsetParent = offsetParent.offsetParent;
|
406
|
+
return $(offsetParent);
|
407
|
+
}
|
408
|
+
});
|
409
|
+
|
410
|
+
function num(el, prop) {
|
411
|
+
return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;
|
412
|
+
};
|
413
|
+
|
414
|
+
})(jQuery);
|
415
|
+
|
416
|
+
(function($) {
|
417
|
+
|
418
|
+
$.ec.blind = function(o) {
|
419
|
+
|
420
|
+
return this.queue(function() {
|
421
|
+
|
422
|
+
// Create element
|
423
|
+
var el = $(this), props = ['position'];
|
424
|
+
|
425
|
+
// Set options
|
426
|
+
var mode = $.ec.setMode(el, o.options.mode || 'hide'); // Set Mode
|
427
|
+
var direction = o.options.direction || 'vertical'; // Default direction
|
428
|
+
|
429
|
+
// Adjust
|
430
|
+
$.ec.save(el, props); el.show(); // Save & Show
|
431
|
+
var wrapper = $.ec.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
432
|
+
var ref = (direction == 'vertical') ? 'height' : 'width';
|
433
|
+
var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
|
434
|
+
if(mode == 'show') wrapper.css(ref, 0); // Shift
|
435
|
+
|
436
|
+
// Animation
|
437
|
+
var animation = {};
|
438
|
+
animation[ref] = mode == 'show' ? distance : 0;
|
439
|
+
|
440
|
+
// Animate
|
441
|
+
wrapper.animate(animation, o.duration, o.options.easing, function() {
|
442
|
+
if(mode == 'hide') el.hide(); // Hide
|
443
|
+
$.ec.restore(el, props); $.ec.removeWrapper(el); // Restore
|
444
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
445
|
+
el.dequeue();
|
446
|
+
});
|
447
|
+
|
448
|
+
});
|
449
|
+
|
450
|
+
};
|
451
|
+
|
452
|
+
})(jQuery);
|
453
|
+
|
454
|
+
(function($) {
|
455
|
+
|
456
|
+
$.ec.bounce = function(o) {
|
457
|
+
|
458
|
+
return this.queue(function() {
|
459
|
+
|
460
|
+
// Create element
|
461
|
+
var el = $(this), props = ['position','top','left'];
|
462
|
+
|
463
|
+
// Set options
|
464
|
+
var mode = $.ec.setMode(el, o.options.mode || 'effect'); // Set Mode
|
465
|
+
var direction = o.options.direction || 'up'; // Default direction
|
466
|
+
var distance = o.options.distance || 20; // Default distance
|
467
|
+
var times = o.options.times || 5; // Default # of times
|
468
|
+
var speed = o.duration || 250; // Default speed per bounce
|
469
|
+
if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
|
470
|
+
|
471
|
+
// Adjust
|
472
|
+
$.ec.save(el, props); el.show(); // Save & Show
|
473
|
+
$.ec.createWrapper(el); // Create Wrapper
|
474
|
+
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
475
|
+
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
476
|
+
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
|
477
|
+
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
|
478
|
+
if (mode == 'hide') distance = distance / (times * 2);
|
479
|
+
if (mode != 'hide') times--;
|
480
|
+
|
481
|
+
// Animate
|
482
|
+
if (mode == 'show') { // Show Bounce
|
483
|
+
var animation = {opacity: 1};
|
484
|
+
animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
|
485
|
+
el.animate(animation, speed / 2, o.options.easing);
|
486
|
+
distance = distance / 2;
|
487
|
+
times--;
|
488
|
+
};
|
489
|
+
for (var i = 0; i < times; i++) { // Bounces
|
490
|
+
var animation1 = {}, animation2 = {};
|
491
|
+
animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
492
|
+
animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
|
493
|
+
el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
|
494
|
+
distance = (mode == 'hide') ? distance * 2 : distance / 2;
|
495
|
+
};
|
496
|
+
if (mode == 'hide') { // Last Bounce
|
497
|
+
var animation = {opacity: 0};
|
498
|
+
animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
499
|
+
el.animate(animation, speed / 2, o.options.easing, function(){
|
500
|
+
el.hide(); // Hide
|
501
|
+
$.ec.restore(el, props); $.ec.removeWrapper(el); // Restore
|
502
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
503
|
+
});
|
504
|
+
} else {
|
505
|
+
var animation1 = {}, animation2 = {};
|
506
|
+
animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
507
|
+
animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
|
508
|
+
el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
|
509
|
+
$.ec.restore(el, props); $.ec.removeWrapper(el); // Restore
|
510
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
511
|
+
});
|
512
|
+
};
|
513
|
+
el.queue('fx', function() { el.dequeue(); });
|
514
|
+
el.dequeue();
|
515
|
+
});
|
516
|
+
|
517
|
+
};
|
518
|
+
|
519
|
+
})(jQuery);
|
520
|
+
|
521
|
+
(function($) {
|
522
|
+
|
523
|
+
$.ec.clip = function(o) {
|
524
|
+
|
525
|
+
return this.queue(function() {
|
526
|
+
|
527
|
+
// Create element
|
528
|
+
var el = $(this), props = ['position','top','left','width','height'];
|
529
|
+
|
530
|
+
// Set options
|
531
|
+
var mode = $.ec.setMode(el, o.options.mode || 'hide'); // Set Mode
|
532
|
+
var direction = o.options.direction || 'vertical'; // Default direction
|
533
|
+
|
534
|
+
// Adjust
|
535
|
+
$.ec.save(el, props); el.show(); // Save & Show
|
536
|
+
$.ec.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
537
|
+
var ref = {
|
538
|
+
size: (direction == 'vertical') ? 'height' : 'width',
|
539
|
+
position: (direction == 'vertical') ? 'top' : 'left'
|
540
|
+
};
|
541
|
+
var distance = (direction == 'vertical') ? el.height() : el.width();
|
542
|
+
if(mode == 'show') { el.css(ref.size, 0); el.css(ref.position, distance / 2); } // Shift
|
543
|
+
|
544
|
+
// Animation
|
545
|
+
var animation = {};
|
546
|
+
animation[ref.size] = mode == 'show' ? distance : 0;
|
547
|
+
animation[ref.position] = mode == 'show' ? 0 : distance / 2;
|
548
|
+
|
549
|
+
// Animate
|
550
|
+
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
551
|
+
if(mode == 'hide') el.hide(); // Hide
|
552
|
+
$.ec.restore(el, props); $.ec.removeWrapper(el); // Restore
|
553
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
554
|
+
el.dequeue();
|
555
|
+
}});
|
556
|
+
|
557
|
+
});
|
558
|
+
|
559
|
+
};
|
560
|
+
|
561
|
+
})(jQuery);
|
562
|
+
|
563
|
+
(function($) {
|
564
|
+
|
565
|
+
$.ec.drop = function(o) {
|
566
|
+
|
567
|
+
return this.queue(function() {
|
568
|
+
|
569
|
+
// Create element
|
570
|
+
var el = $(this), props = ['position','top','left','opacity'];
|
571
|
+
|
572
|
+
// Set options
|
573
|
+
var mode = $.ec.setMode(el, o.options.mode || 'hide'); // Set Mode
|
574
|
+
var direction = o.options.direction || 'left'; // Default Direction
|
575
|
+
|
576
|
+
// Adjust
|
577
|
+
$.ec.save(el, props); el.show(); // Save & Show
|
578
|
+
$.ec.createWrapper(el); // Create Wrapper
|
579
|
+
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
580
|
+
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
581
|
+
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
|
582
|
+
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
|
583
|
+
|
584
|
+
// Animation
|
585
|
+
var animation = {opacity: mode == 'show' ? 1 : 0};
|
586
|
+
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
587
|
+
|
588
|
+
// Animate
|
589
|
+
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
590
|
+
if(mode == 'hide') el.hide(); // Hide
|
591
|
+
$.ec.restore(el, props); $.ec.removeWrapper(el); // Restore
|
592
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
593
|
+
el.dequeue();
|
594
|
+
}});
|
595
|
+
|
596
|
+
});
|
597
|
+
|
598
|
+
};
|
599
|
+
|
600
|
+
})(jQuery);
|
601
|
+
|
602
|
+
(function($) {
|
603
|
+
|
604
|
+
$.ec.fade = function(o) {
|
605
|
+
|
606
|
+
return this.queue(function() {
|
607
|
+
|
608
|
+
// Create element
|
609
|
+
var el = $(this), props = ['opacity'];
|
610
|
+
|
611
|
+
// Set options
|
612
|
+
var mode = $.ec.setMode(el, o.options.mode || 'effect'); // Set Mode
|
613
|
+
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
|
614
|
+
var opacity = o.options.opacity || 0; // Default fade opacity
|
615
|
+
|
616
|
+
// Adjust
|
617
|
+
$.ec.save(el, props); el.show(); // Save & Show
|
618
|
+
if(mode == 'show') el.css({opacity: 0}); // Shift
|
619
|
+
|
620
|
+
// Animation
|
621
|
+
var animation = {opacity: mode == 'show' ? 1 : opacity};
|
622
|
+
|
623
|
+
// Animate
|
624
|
+
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
625
|
+
if(mode == 'hide') el.hide(); // Hide
|
626
|
+
if(mode == 'hide') $.ec.restore(el, props); // Restore
|
627
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
628
|
+
el.dequeue();
|
629
|
+
}});
|
630
|
+
|
631
|
+
});
|
632
|
+
|
633
|
+
};
|
634
|
+
|
635
|
+
})(jQuery);
|
636
|
+
|
637
|
+
(function($) {
|
638
|
+
|
639
|
+
$.ec.fold = function(o) {
|
640
|
+
|
641
|
+
return this.queue(function() {
|
642
|
+
|
643
|
+
// Create element
|
644
|
+
var el = $(this), props = ['position'];
|
645
|
+
|
646
|
+
// Set options
|
647
|
+
var mode = $.ec.setMode(el, o.options.mode || 'hide'); // Set Mode
|
648
|
+
var size = o.options.size || 15; // Default fold size
|
649
|
+
|
650
|
+
// Adjust
|
651
|
+
$.ec.save(el, props); el.show(); // Save & Show
|
652
|
+
var wrapper = $.ec.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
653
|
+
var ref = (mode == 'show') ? ['width', 'height'] : ['height', 'width'];
|
654
|
+
var distance = (mode == 'show') ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
|
655
|
+
if(mode == 'show') wrapper.css({height: size, width: 0}); // Shift
|
656
|
+
|
657
|
+
// Animation
|
658
|
+
var animation1 = {}, animation2 = {};
|
659
|
+
animation1[ref[0]] = mode == 'show' ? distance[0] : size;
|
660
|
+
animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
|
661
|
+
|
662
|
+
// Animate
|
663
|
+
wrapper.animate(animation1, o.duration / 2, o.options.easing)
|
664
|
+
.animate(animation2, o.duration / 2, o.options.easing, function() {
|
665
|
+
if(mode == 'hide') el.hide(); // Hide
|
666
|
+
$.ec.restore(el, props); $.ec.removeWrapper(el); // Restore
|
667
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
668
|
+
el.dequeue();
|
669
|
+
});
|
670
|
+
|
671
|
+
});
|
672
|
+
|
673
|
+
};
|
674
|
+
|
675
|
+
})(jQuery);
|
676
|
+
|
677
|
+
(function($) {
|
678
|
+
|
679
|
+
$.ec.highlight = function(o) {
|
680
|
+
|
681
|
+
return this.queue(function() {
|
682
|
+
|
683
|
+
// Create element
|
684
|
+
var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
|
685
|
+
|
686
|
+
// Set options
|
687
|
+
var mode = $.ec.setMode(el, o.options.mode || 'show'); // Set Mode
|
688
|
+
var color = o.options.color || "#ffff99"; // Default highlight color
|
689
|
+
|
690
|
+
// Adjust
|
691
|
+
$.ec.save(el, props); el.show(); // Save & Show
|
692
|
+
el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
|
693
|
+
|
694
|
+
// Animation
|
695
|
+
var animation = {backgroundColor: $.data(this, "ec.storage.backgroundColor")};
|
696
|
+
if (mode == "hide") animation['opacity'] = 0;
|
697
|
+
|
698
|
+
// Animate
|
699
|
+
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
700
|
+
if(mode == "hide") el.hide();
|
701
|
+
$.ec.restore(el, props);
|
702
|
+
if(o.callback) o.callback.apply(this, arguments);
|
703
|
+
el.dequeue();
|
704
|
+
}});
|
705
|
+
|
706
|
+
});
|
707
|
+
|
708
|
+
};
|
709
|
+
|
710
|
+
})(jQuery);
|
711
|
+
|
712
|
+
(function($) {
|
713
|
+
|
714
|
+
$.ec.pulsate = function(o) {
|
715
|
+
|
716
|
+
return this.queue(function() {
|
717
|
+
|
718
|
+
// Create element
|
719
|
+
var el = $(this);
|
720
|
+
|
721
|
+
// Set options
|
722
|
+
var mode = $.ec.setMode(el, o.options.mode || 'show'); // Set Mode
|
723
|
+
var times = o.options.times || 5; // Default # of times
|
724
|
+
|
725
|
+
// Adjust
|
726
|
+
if (mode != 'hide') times--;
|
727
|
+
if (el.is(':hidden')) { // Show fadeIn
|
728
|
+
el.css('opacity', 0);
|
729
|
+
el.show(); // Show
|
730
|
+
el.animate({opacity: 1}, o.duration / 2, o.options.easing);
|
731
|
+
times--;
|
732
|
+
}
|
733
|
+
|
734
|
+
// Animate
|
735
|
+
for (var i = 0; i < times; i++) { // Pulsate
|
736
|
+
el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing);
|
737
|
+
};
|
738
|
+
if (mode == 'hide') { // Last Pulse
|
739
|
+
el.animate({opacity: 0}, o.duration / 2, o.options.easing, function(){
|
740
|
+
el.hide(); // Hide
|
741
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
742
|
+
});
|
743
|
+
} else {
|
744
|
+
el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing, function(){
|
745
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
746
|
+
});
|
747
|
+
};
|
748
|
+
el.queue('fx', function() { el.dequeue(); });
|
749
|
+
el.dequeue();
|
750
|
+
});
|
751
|
+
|
752
|
+
};
|
753
|
+
|
754
|
+
})(jQuery);
|
755
|
+
|
756
|
+
(function($) {
|
757
|
+
|
758
|
+
$.ec.puff = function(o) {
|
759
|
+
|
760
|
+
return this.queue(function() {
|
761
|
+
|
762
|
+
// Create element
|
763
|
+
var el = $(this);
|
764
|
+
|
765
|
+
// Set options
|
766
|
+
var mode = $.ec.setMode(el, o.options.mode || 'hide'); // Set Mode
|
767
|
+
var percent = parseInt(o.options.percent) || 150; // Set default puff percent
|
768
|
+
o.options.fade = true; // It's not a puff if it doesn't fade! :)
|
769
|
+
var original = {height: el.height(), width: el.width()}; // Save original
|
770
|
+
|
771
|
+
// Adjust
|
772
|
+
var factor = percent / 100;
|
773
|
+
el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};
|
774
|
+
|
775
|
+
// Animation
|
776
|
+
o.options.from = el.from;
|
777
|
+
o.options.percent = (mode == 'hide') ? percent : 100;
|
778
|
+
o.options.mode = mode;
|
779
|
+
|
780
|
+
// Animate
|
781
|
+
el.effect('scale', o.options, o.duration, o.callback);
|
782
|
+
el.dequeue();
|
783
|
+
});
|
784
|
+
|
785
|
+
};
|
786
|
+
|
787
|
+
$.ec.scale = function(o) {
|
788
|
+
|
789
|
+
return this.queue(function() {
|
790
|
+
|
791
|
+
// Create element
|
792
|
+
var el = $(this);
|
793
|
+
|
794
|
+
// Set options
|
795
|
+
var mode = $.ec.setMode(el, o.options.mode || 'effect'); // Set Mode
|
796
|
+
var percent = parseInt(o.options.percent) || (parseInt(o.options.percent) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
|
797
|
+
var direction = o.options.direction || 'both'; // Set default axis
|
798
|
+
var origin = o.options.origin; // The origin of the scaling
|
799
|
+
if (mode != 'effect') { // Set default origin and restore for show/hide
|
800
|
+
origin = origin || ['middle','center'];
|
801
|
+
o.options.restore = true;
|
802
|
+
}
|
803
|
+
var original = {height: el.height(), width: el.width()}; // Save original
|
804
|
+
el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
|
805
|
+
|
806
|
+
// Adjust
|
807
|
+
var factor = { // Set scaling factor
|
808
|
+
y: direction != 'horizontal' ? (percent / 100) : 1,
|
809
|
+
x: direction != 'vertical' ? (percent / 100) : 1
|
810
|
+
};
|
811
|
+
el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
|
812
|
+
if (origin) { // Calculate baseline shifts
|
813
|
+
var baseline = $.ec.getBaseline(origin, original);
|
814
|
+
el.from.top = (original.height - el.from.height) * baseline.y;
|
815
|
+
el.from.left = (original.width - el.from.width) * baseline.x;
|
816
|
+
el.to.top = (original.height - el.to.height) * baseline.y;
|
817
|
+
el.to.left = (original.width - el.to.width) * baseline.x;
|
818
|
+
};
|
819
|
+
if (o.options.fade) { // Fade option to support puff
|
820
|
+
if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
|
821
|
+
if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
|
822
|
+
};
|
823
|
+
|
824
|
+
// Animation
|
825
|
+
o.options.from = el.from; o.options.to = el.to;
|
826
|
+
|
827
|
+
// Animate
|
828
|
+
el.effect('size', o.options, o.duration, o.callback);
|
829
|
+
el.dequeue();
|
830
|
+
});
|
831
|
+
|
832
|
+
};
|
833
|
+
|
834
|
+
$.ec.size = function(o) {
|
835
|
+
|
836
|
+
return this.queue(function() {
|
837
|
+
|
838
|
+
// Create element
|
839
|
+
var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
|
840
|
+
var props1 = ['position','overflow','opacity']; // Always restore
|
841
|
+
var props2 = ['width','height','overflow']; // Copy for children
|
842
|
+
var cProps = ['fontSize'];
|
843
|
+
var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
|
844
|
+
var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
|
845
|
+
|
846
|
+
// Set options
|
847
|
+
var mode = $.ec.setMode(el, o.options.mode || 'effect'); // Set Mode
|
848
|
+
var restore = o.options.restore || false; // Default restore
|
849
|
+
var scale = o.options.scale || 'both'; // Default scale mode
|
850
|
+
var original = {height: el.height(), width: el.width()}; // Save original
|
851
|
+
el.from = o.options.from || original; // Default from state
|
852
|
+
el.to = o.options.to || original; // Default to state
|
853
|
+
|
854
|
+
// Adjust
|
855
|
+
var factor = { // Set scaling factor
|
856
|
+
from: {y: el.from.height / original.height, x: el.from.width / original.width},
|
857
|
+
to: {y: el.to.height / original.height, x: el.to.width / original.width}
|
858
|
+
};
|
859
|
+
if (scale == 'box' || scale == 'both') { // Scale the css box
|
860
|
+
if (factor.from.y != factor.to.y) { // Vertical props scaling
|
861
|
+
props = props.concat(vProps);
|
862
|
+
el.from = $.ec.setTransition(el, vProps, factor.from.y, el.from);
|
863
|
+
el.to = $.ec.setTransition(el, vProps, factor.to.y, el.to);
|
864
|
+
};
|
865
|
+
if (factor.from.x != factor.to.x) { // Horizontal props scaling
|
866
|
+
props = props.concat(hProps);
|
867
|
+
el.from = $.ec.setTransition(el, hProps, factor.from.x, el.from);
|
868
|
+
el.to = $.ec.setTransition(el, hProps, factor.to.x, el.to);
|
869
|
+
};
|
870
|
+
};
|
871
|
+
if (scale == 'content' || scale == 'both') { // Scale the content
|
872
|
+
if (factor.from.y != factor.to.y) { // Vertical props scaling
|
873
|
+
props = props.concat(cProps);
|
874
|
+
el.from = $.ec.setTransition(el, cProps, factor.from.y, el.from);
|
875
|
+
el.to = $.ec.setTransition(el, cProps, factor.to.y, el.to);
|
876
|
+
};
|
877
|
+
};
|
878
|
+
$.ec.save(el, restore ? props : props1); el.show(); // Save & Show
|
879
|
+
$.ec.createWrapper(el); // Create Wrapper
|
880
|
+
el.css('overflow','hidden').css(el.from); // Shift
|
881
|
+
|
882
|
+
// Animate
|
883
|
+
if (scale == 'content' || scale == 'both') { // Scale the children
|
884
|
+
vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
|
885
|
+
hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
|
886
|
+
props2 = props.concat(vProps).concat(hProps); // Concat
|
887
|
+
el.find("*[width]").each(function(){
|
888
|
+
child = $(this);
|
889
|
+
if (restore) $.ec.save(child, props2);
|
890
|
+
var c_original = {height: child.height(), width: child.width()}; // Save original
|
891
|
+
child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
|
892
|
+
child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
|
893
|
+
if (factor.from.y != factor.to.y) { // Vertical props scaling
|
894
|
+
child.from = $.ec.setTransition(child, vProps, factor.from.y, child.from);
|
895
|
+
child.to = $.ec.setTransition(child, vProps, factor.to.y, child.to);
|
896
|
+
};
|
897
|
+
if (factor.from.x != factor.to.x) { // Horizontal props scaling
|
898
|
+
child.from = $.ec.setTransition(child, hProps, factor.from.x, child.from);
|
899
|
+
child.to = $.ec.setTransition(child, hProps, factor.to.x, child.to);
|
900
|
+
};
|
901
|
+
child.css(child.from); // Shift children
|
902
|
+
child.animate(child.to, o.duration, o.options.easing, function(){
|
903
|
+
if (restore) $.ec.restore(child, props2); // Restore children
|
904
|
+
}); // Animate children
|
905
|
+
});
|
906
|
+
};
|
907
|
+
|
908
|
+
// Animate
|
909
|
+
el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
910
|
+
if(mode == 'hide') el.hide(); // Hide
|
911
|
+
$.ec.restore(el, restore ? props : props1); $.ec.removeWrapper(el); // Restore
|
912
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
913
|
+
el.dequeue();
|
914
|
+
}});
|
915
|
+
|
916
|
+
});
|
917
|
+
|
918
|
+
};
|
919
|
+
|
920
|
+
})(jQuery);
|
921
|
+
|
922
|
+
(function($) {
|
923
|
+
|
924
|
+
$.ec.shake = function(o) {
|
925
|
+
|
926
|
+
return this.queue(function() {
|
927
|
+
|
928
|
+
// Create element
|
929
|
+
var el = $(this), props = ['position','top','left'];
|
930
|
+
|
931
|
+
// Set options
|
932
|
+
var mode = $.ec.setMode(el, o.options.mode || 'effect'); // Set Mode
|
933
|
+
var direction = o.options.direction || 'left'; // Default direction
|
934
|
+
var distance = o.options.distance || 20; // Default distance
|
935
|
+
var times = o.options.times || 3; // Default # of times
|
936
|
+
var speed = o.duration || o.options.duration || 140; // Default speed per shake
|
937
|
+
|
938
|
+
// Adjust
|
939
|
+
$.ec.save(el, props); el.show(); // Save & Show
|
940
|
+
$.ec.createWrapper(el); // Create Wrapper
|
941
|
+
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
942
|
+
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
943
|
+
|
944
|
+
// Animation
|
945
|
+
var animation = {}, animation1 = {}, animation2 = {};
|
946
|
+
animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
947
|
+
animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
|
948
|
+
animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
|
949
|
+
|
950
|
+
// Animate
|
951
|
+
el.animate(animation, speed, o.options.easing);
|
952
|
+
for (var i = 1; i < times; i++) { // Shakes
|
953
|
+
el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
|
954
|
+
};
|
955
|
+
el.animate(animation1, speed, o.options.easing).
|
956
|
+
animate(animation, speed / 2, o.options.easing, function(){ // Last shake
|
957
|
+
$.ec.restore(el, props); $.ec.removeWrapper(el); // Restore
|
958
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
959
|
+
});
|
960
|
+
el.queue('fx', function() { el.dequeue(); });
|
961
|
+
el.dequeue();
|
962
|
+
});
|
963
|
+
|
964
|
+
};
|
965
|
+
|
966
|
+
})(jQuery);
|
967
|
+
|
968
|
+
(function($) {
|
969
|
+
|
970
|
+
$.ec.slide = function(o) {
|
971
|
+
|
972
|
+
return this.queue(function() {
|
973
|
+
|
974
|
+
// Create element
|
975
|
+
var el = $(this), props = ['position','top','left'];
|
976
|
+
|
977
|
+
// Set options
|
978
|
+
var mode = $.ec.setMode(el, o.options.mode || 'show'); // Set Mode
|
979
|
+
var direction = o.options.direction || 'left'; // Default Direction
|
980
|
+
|
981
|
+
// Adjust
|
982
|
+
$.ec.save(el, props); el.show(); // Save & Show
|
983
|
+
$.ec.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
984
|
+
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
985
|
+
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
986
|
+
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
|
987
|
+
if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
|
988
|
+
|
989
|
+
// Animation
|
990
|
+
var animation = {};
|
991
|
+
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
992
|
+
|
993
|
+
// Animate
|
994
|
+
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
995
|
+
if(mode == 'hide') el.hide(); // Hide
|
996
|
+
$.ec.restore(el, props); $.ec.removeWrapper(el); // Restore
|
997
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
998
|
+
el.dequeue();
|
999
|
+
}});
|
1000
|
+
|
1001
|
+
});
|
1002
|
+
|
1003
|
+
};
|
1004
|
+
|
1005
|
+
})(jQuery);
|
1006
|
+
|
1007
|
+
(function($) {
|
1008
|
+
|
1009
|
+
$.ec.transfer = function(o) {
|
1010
|
+
|
1011
|
+
return this.queue(function() {
|
1012
|
+
|
1013
|
+
// Create element
|
1014
|
+
var el = $(this);
|
1015
|
+
|
1016
|
+
// Set options
|
1017
|
+
var mode = $.ec.setMode(el, o.options.mode || 'effect'); // Set Mode
|
1018
|
+
var target = $(document.getElementById(o.options.to)); // Find Target
|
1019
|
+
var position = el.position();
|
1020
|
+
$('body', document).append('<div id="fxTransfer"></div>');
|
1021
|
+
var transfer = $('#fxTransfer');
|
1022
|
+
|
1023
|
+
// Set target css
|
1024
|
+
transfer.addClass(o.options.className);
|
1025
|
+
transfer.css({
|
1026
|
+
top: position['top'],
|
1027
|
+
left: position['left'],
|
1028
|
+
height: el.outerHeight({margin:true}) - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),
|
1029
|
+
width: el.outerWidth({margin:true}) - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth')),
|
1030
|
+
position: 'absolute'
|
1031
|
+
});
|
1032
|
+
|
1033
|
+
// Animation
|
1034
|
+
position = target.position();
|
1035
|
+
animation = {
|
1036
|
+
top: position['top'],
|
1037
|
+
left: position['left'],
|
1038
|
+
height: target.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),
|
1039
|
+
width: target.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth'))
|
1040
|
+
};
|
1041
|
+
|
1042
|
+
// Animate
|
1043
|
+
transfer.animate(animation, o.duration, o.options.easing, function() {
|
1044
|
+
transfer.remove(); // Remove div
|
1045
|
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
1046
|
+
el.dequeue();
|
1047
|
+
});
|
1048
|
+
|
1049
|
+
});
|
1050
|
+
|
1051
|
+
};
|
1052
|
+
|
1053
|
+
})(jQuery);
|