corrade-http-templates – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
42 | office | 1 | /*! |
2 | * jQuery UI Effects Fold 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: Fold Effect |
||
11 | //>>group: Effects |
||
12 | //>>description: Folds an element first horizontally and then vertically. |
||
13 | //>>docs: http://api.jqueryui.com/fold-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( "fold", "hide", function( options, done ) { |
||
33 | |||
34 | // Create element |
||
35 | var element = $( this ), |
||
36 | mode = options.mode, |
||
37 | show = mode === "show", |
||
38 | hide = mode === "hide", |
||
39 | size = options.size || 15, |
||
40 | percent = /([0-9]+)%/.exec( size ), |
||
41 | horizFirst = !!options.horizFirst, |
||
42 | ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ], |
||
43 | duration = options.duration / 2, |
||
44 | |||
45 | placeholder = $.effects.createPlaceholder( element ), |
||
46 | |||
47 | start = element.cssClip(), |
||
48 | animation1 = { clip: $.extend( {}, start ) }, |
||
49 | animation2 = { clip: $.extend( {}, start ) }, |
||
50 | |||
51 | distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ], |
||
52 | |||
53 | queuelen = element.queue().length; |
||
54 | |||
55 | if ( percent ) { |
||
56 | size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; |
||
57 | } |
||
58 | animation1.clip[ ref[ 0 ] ] = size; |
||
59 | animation2.clip[ ref[ 0 ] ] = size; |
||
60 | animation2.clip[ ref[ 1 ] ] = 0; |
||
61 | |||
62 | if ( show ) { |
||
63 | element.cssClip( animation2.clip ); |
||
64 | if ( placeholder ) { |
||
65 | placeholder.css( $.effects.clipToBox( animation2 ) ); |
||
66 | } |
||
67 | |||
68 | animation2.clip = start; |
||
69 | } |
||
70 | |||
71 | // Animate |
||
72 | element |
||
73 | .queue( function( next ) { |
||
74 | if ( placeholder ) { |
||
75 | placeholder |
||
76 | .animate( $.effects.clipToBox( animation1 ), duration, options.easing ) |
||
77 | .animate( $.effects.clipToBox( animation2 ), duration, options.easing ); |
||
78 | } |
||
79 | |||
80 | next(); |
||
81 | } ) |
||
82 | .animate( animation1, duration, options.easing ) |
||
83 | .animate( animation2, duration, options.easing ) |
||
84 | .queue( done ); |
||
85 | |||
86 | $.effects.unshift( element, queuelen, 4 ); |
||
87 | } ); |
||
88 | |||
89 | } ) ); |