corrade-http-templates – Blame information for rev 42

Subversion Repositories:
Rev:
Rev Author Line No. Line
42 office 1 /*!
2 * jQuery UI Effects Shake 1.12.1
3 * http://jqueryui.com
4 *
5 * Copyright jQuery Foundation and other contributors
6 * Released under the MIT license.
7 * http://jquery.org/license
8 */
9  
10 //>>label: Shake Effect
11 //>>group: Effects
12 //>>description: Shakes an element horizontally or vertically n times.
13 //>>docs: http://api.jqueryui.com/shake-effect/
14 //>>demos: http://jqueryui.com/effect/
15  
16 ( function( factory ) {
17 if ( typeof define === "function" && define.amd ) {
18  
19 // AMD. Register as an anonymous module.
20 define( [
21 "jquery",
22 "../version",
23 "../effect"
24 ], factory );
25 } else {
26  
27 // Browser globals
28 factory( jQuery );
29 }
30 }( function( $ ) {
31  
32 return $.effects.define( "shake", function( options, done ) {
33  
34 var i = 1,
35 element = $( this ),
36 direction = options.direction || "left",
37 distance = options.distance || 20,
38 times = options.times || 3,
39 anims = times * 2 + 1,
40 speed = Math.round( options.duration / anims ),
41 ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
42 positiveMotion = ( direction === "up" || direction === "left" ),
43 animation = {},
44 animation1 = {},
45 animation2 = {},
46  
47 queuelen = element.queue().length;
48  
49 $.effects.createPlaceholder( element );
50  
51 // Animation
52 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
53 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
54 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
55  
56 // Animate
57 element.animate( animation, speed, options.easing );
58  
59 // Shakes
60 for ( ; i < times; i++ ) {
61 < times; i++ ) { element
62 < times; i++ ) { .animate( animation1, speed, options.easing )
63 < times; i++ ) { .animate( animation2, speed, options.easing );
64 < times; i++ ) { }
65  
66 < times; i++ ) { element
67 < times; i++ ) { .animate( animation1, speed, options.easing )
68 < times; i++ ) { .animate( animation, speed / 2, options.easing )
69 < times; i++ ) { .queue( done );
70  
71 < times; i++ ) { $.effects.unshift( element, queuelen, anims + 1 );
72 < times; i++ ) {} );
73  
74 < times; i++ ) {} ) );