qwik2md 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/lib/qwik2md/version.rb +1 -1
  3. data/vendor/qwik/lib/qwik/act-christel.rb +1 -1
  4. data/vendor/qwik/lib/qwik/page-get.rb +4 -4
  5. data/vendor/qwik/lib/qwik/util-filename.rb +2 -5
  6. data/vendor/qwik/lib/qwik/util-string.rb +7 -7
  7. data/vendor/qwik/share/super/FrontPage.txt +17 -0
  8. data/vendor/qwik/share/super/QwikWebPlugin.txt +0 -0
  9. data/vendor/qwik/share/super/QwikWebStructure.txt +0 -0
  10. data/vendor/qwik/share/super/RecentList.txt +2 -0
  11. data/vendor/qwik/share/super/SandBox.txt +3 -0
  12. data/vendor/qwik/share/super/TextFormat.txt +186 -0
  13. data/vendor/qwik/share/super/TextFormatSimple.txt +23 -0
  14. data/vendor/qwik/share/super/TitleList.txt +2 -0
  15. data/vendor/qwik/share/super/_AdminMenu.txt +11 -0
  16. data/vendor/qwik/share/super/_BookSearch.txt +3 -0
  17. data/vendor/qwik/share/super/_EditorFooter.txt +9 -0
  18. data/vendor/qwik/share/super/_EditorHelp.txt +9 -0
  19. data/vendor/qwik/share/super/_InterWikiName.txt +17 -0
  20. data/vendor/qwik/share/super/_IsbnLink.txt +8 -0
  21. data/vendor/qwik/share/super/_MemberAdd.txt +4 -0
  22. data/vendor/qwik/share/super/_MemberList.txt +2 -0
  23. data/vendor/qwik/share/super/_MemberListCSV.txt +2 -0
  24. data/vendor/qwik/share/super/_PageAttribute.txt +7 -0
  25. data/vendor/qwik/share/super/_SideMenu.txt +15 -0
  26. data/vendor/qwik/share/super/_SiteConfig.txt +30 -0
  27. data/vendor/qwik/share/super/_SiteFooter.txt +3 -0
  28. data/vendor/qwik/share/super/_SiteLog.txt +0 -0
  29. data/vendor/qwik/share/super/_SiteLogView.txt +2 -0
  30. data/vendor/qwik/share/super/_SiteMember.txt +0 -0
  31. data/vendor/qwik/share/super/_SiteMenu.txt +2 -0
  32. data/vendor/qwik/share/super/_SiteSearch.txt +3 -0
  33. data/vendor/qwik/share/super/_SiteTheme.txt +9 -0
  34. data/vendor/qwik/share/super/_textformat.txt +2 -0
  35. data/vendor/qwik/share/template/Makefile +10 -0
  36. data/vendor/qwik/share/template/edit.html +22 -0
  37. data/vendor/qwik/share/template/edit.rb +40 -0
  38. data/vendor/qwik/share/template/editor.html +23 -0
  39. data/vendor/qwik/share/template/editor.rb +47 -0
  40. data/vendor/qwik/share/template/notice.html +21 -0
  41. data/vendor/qwik/share/template/notice.rb +43 -0
  42. data/vendor/qwik/share/template/plain.html +19 -0
  43. data/vendor/qwik/share/template/plain.rb +43 -0
  44. data/vendor/qwik/share/template/surface.html +22 -0
  45. data/vendor/qwik/share/template/surface.rb +50 -0
  46. data/vendor/qwik/share/template/system.html +30 -0
  47. data/vendor/qwik/share/template/system.rb +46 -0
  48. data/vendor/qwik/share/template/view.html +20 -0
  49. data/vendor/qwik/share/template/view.rb +40 -0
  50. data/vendor/qwik/share/theme/css/Makefile +10 -0
  51. data/vendor/qwik/share/theme/css/base.css +779 -0
  52. data/vendor/qwik/share/theme/css/delete.png +0 -0
  53. data/vendor/qwik/share/theme/css/menu.css +77 -0
  54. data/vendor/qwik/share/theme/css/wema.css +141 -0
  55. data/vendor/qwik/share/theme/i/a.gif +0 -0
  56. data/vendor/qwik/share/theme/i/binary.gif +0 -0
  57. data/vendor/qwik/share/theme/i/broken.gif +0 -0
  58. data/vendor/qwik/share/theme/i/compressed.gif +0 -0
  59. data/vendor/qwik/share/theme/i/external.png +0 -0
  60. data/vendor/qwik/share/theme/i/external_hover.png +0 -0
  61. data/vendor/qwik/share/theme/i/favicon.ico +0 -0
  62. data/vendor/qwik/share/theme/i/favicon.png +0 -0
  63. data/vendor/qwik/share/theme/i/generic.gif +0 -0
  64. data/vendor/qwik/share/theme/i/image2.gif +0 -0
  65. data/vendor/qwik/share/theme/i/login_bg.gif +0 -0
  66. data/vendor/qwik/share/theme/i/login_inputform_bg.gif +0 -0
  67. data/vendor/qwik/share/theme/i/login_inputform_bg_footer.gif +0 -0
  68. data/vendor/qwik/share/theme/i/login_inputform_bg_header.gif +0 -0
  69. data/vendor/qwik/share/theme/i/login_li.gif +0 -0
  70. data/vendor/qwik/share/theme/i/login_qwik_logo.gif +0 -0
  71. data/vendor/qwik/share/theme/i/movie.gif +0 -0
  72. data/vendor/qwik/share/theme/i/new.png +0 -0
  73. data/vendor/qwik/share/theme/i/pdf.gif +0 -0
  74. data/vendor/qwik/share/theme/i/ps.gif +0 -0
  75. data/vendor/qwik/share/theme/i/sound2.gif +0 -0
  76. data/vendor/qwik/share/theme/i/sphere2.gif +0 -0
  77. data/vendor/qwik/share/theme/i/tar.gif +0 -0
  78. data/vendor/qwik/share/theme/i/text.gif +0 -0
  79. data/vendor/qwik/share/theme/js/Makefile +23 -0
  80. data/vendor/qwik/share/theme/js/base.js +176 -0
  81. data/vendor/qwik/share/theme/js/builder.js +101 -0
  82. data/vendor/qwik/share/theme/js/controls.js +750 -0
  83. data/vendor/qwik/share/theme/js/debugwindow-test.html +60 -0
  84. data/vendor/qwik/share/theme/js/debugwindow.html +24 -0
  85. data/vendor/qwik/share/theme/js/debugwindow.js +476 -0
  86. data/vendor/qwik/share/theme/js/dragdrop.js +559 -0
  87. data/vendor/qwik/share/theme/js/effects.js +904 -0
  88. data/vendor/qwik/share/theme/js/event.js +98 -0
  89. data/vendor/qwik/share/theme/js/history.js +110 -0
  90. data/vendor/qwik/share/theme/js/menu.js +27 -0
  91. data/vendor/qwik/share/theme/js/monitor.js +96 -0
  92. data/vendor/qwik/share/theme/js/niftypp.js +272 -0
  93. data/vendor/qwik/share/theme/js/prototype.js +1758 -0
  94. data/vendor/qwik/share/theme/js/scriptaculous.js +48 -0
  95. data/vendor/qwik/share/theme/js/se_hilite_jp.js +234 -0
  96. data/vendor/qwik/share/theme/js/slider.js +275 -0
  97. data/vendor/qwik/share/theme/js/test-all.html +24 -0
  98. data/vendor/qwik/share/theme/js/test-debug.html +56 -0
  99. data/vendor/qwik/share/theme/js/test-wema.html +304 -0
  100. data/vendor/qwik/share/theme/js/test-xp.html +99 -0
  101. data/vendor/qwik/share/theme/js/unittest.js +363 -0
  102. data/vendor/qwik/share/theme/js/watch.js +109 -0
  103. data/vendor/qwik/share/theme/js/wema.js +580 -0
  104. data/vendor/qwik/share/theme/js/wysiwyg.js +143 -0
  105. data/vendor/qwik/share/theme/qwikborder/qwikborder.css +277 -0
  106. data/vendor/qwik/share/theme/qwikborder/qwikborder_ball.png +0 -0
  107. data/vendor/qwik/share/theme/qwikborder/qwikborder_h2.png +0 -0
  108. data/vendor/qwik/share/theme/qwikborder/qwikborder_li.png +0 -0
  109. data/vendor/qwik/share/theme/qwikcyan/qwikcyan.css +216 -0
  110. data/vendor/qwik/share/theme/qwikcyan/qwikcyan_li.png +0 -0
  111. data/vendor/qwik/share/theme/qwikeditor/command.gif +0 -0
  112. data/vendor/qwik/share/theme/qwikeditor/edit_form_bg.jpg +0 -0
  113. data/vendor/qwik/share/theme/qwikeditor/edit_qwik_logo.gif +0 -0
  114. data/vendor/qwik/share/theme/qwikeditor/edit_title_bg.jpg +0 -0
  115. data/vendor/qwik/share/theme/qwikeditor/login_bg.gif +0 -0
  116. data/vendor/qwik/share/theme/qwikeditor/login_qwik_logo.gif +0 -0
  117. data/vendor/qwik/share/theme/qwikeditor/qwikeditor.css +336 -0
  118. data/vendor/qwik/share/theme/qwikeditor/sidebar_bg.gif +0 -0
  119. data/vendor/qwik/share/theme/qwikgreen/qwikgreen.css +306 -0
  120. data/vendor/qwik/share/theme/qwiknotice/qwiknotice.css +246 -0
  121. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_body_bg.gif +0 -0
  122. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_inputform_bg.gif +0 -0
  123. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_inputform_bg_footer.gif +0 -0
  124. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_inputform_bg_header.gif +0 -0
  125. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_li.gif +0 -0
  126. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_qwik_logo.gif +0 -0
  127. data/vendor/qwik/share/theme/qwikplain/command.gif +0 -0
  128. data/vendor/qwik/share/theme/qwikplain/edit_form_bg.jpg +0 -0
  129. data/vendor/qwik/share/theme/qwikplain/edit_qwik_logo.gif +0 -0
  130. data/vendor/qwik/share/theme/qwikplain/edit_title_bg.jpg +0 -0
  131. data/vendor/qwik/share/theme/qwikplain/login_bg.gif +0 -0
  132. data/vendor/qwik/share/theme/qwikplain/login_qwik_logo.gif +0 -0
  133. data/vendor/qwik/share/theme/qwikplain/qwikplain.css +223 -0
  134. data/vendor/qwik/share/theme/qwikplain/sidebar_bg.gif +0 -0
  135. data/vendor/qwik/share/theme/qwikskelton/qwikskelton.css +224 -0
  136. data/vendor/qwik/share/theme/qwiksystem/qwiksystem.css +323 -0
  137. data/vendor/qwik/share/theme/qwiksystem/qwiksystem_bg.png +0 -0
  138. data/vendor/qwik/share/theme/qwiksystem/qwiksystem_header.png +0 -0
  139. data/vendor/qwik/share/theme/qwiksystem/qwiksystem_headerbar.png +0 -0
  140. data/vendor/qwik/share/theme/qwiksystem/qwiksystem_qwikweb.png +0 -0
  141. data/vendor/qwik/share/theme/qwikviridian/qwikviridian.css +413 -0
  142. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_adminmenu_bg.gif +0 -0
  143. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_bg.gif +0 -0
  144. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_bg_shade.gif +0 -0
  145. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_sidebar_a_bg.gif +0 -0
  146. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_siderbar_li_a.gif +0 -0
  147. data/vendor/qwik/share/theme/s5/blue/bluebg.gif +0 -0
  148. data/vendor/qwik/share/theme/s5/blue/bluebottom.gif +0 -0
  149. data/vendor/qwik/share/theme/s5/blue/bluefooter.gif +0 -0
  150. data/vendor/qwik/share/theme/s5/blue/framing.css +25 -0
  151. data/vendor/qwik/share/theme/s5/blue/pretty.css +91 -0
  152. data/vendor/qwik/share/theme/s5/blue/s5-core.css +11 -0
  153. data/vendor/qwik/share/theme/s5/blue/slides.css +3 -0
  154. data/vendor/qwik/share/theme/s5/default/iepngfix.htc +42 -0
  155. data/vendor/qwik/share/theme/s5/default/opera.css +7 -0
  156. data/vendor/qwik/share/theme/s5/default/outline.css +15 -0
  157. data/vendor/qwik/share/theme/s5/default/print.css +24 -0
  158. data/vendor/qwik/share/theme/s5/default/slides.js +558 -0
  159. data/vendor/qwik/share/theme/s5/flower/blume.jpg +0 -0
  160. data/vendor/qwik/share/theme/s5/flower/blumerechts.jpg +0 -0
  161. data/vendor/qwik/share/theme/s5/flower/framing.css +25 -0
  162. data/vendor/qwik/share/theme/s5/flower/pretty.css +83 -0
  163. data/vendor/qwik/share/theme/s5/flower/s5-core.css +11 -0
  164. data/vendor/qwik/share/theme/s5/flower/slides.css +3 -0
  165. data/vendor/qwik/share/theme/s5/i18n/00_head.txt +8 -0
  166. data/vendor/qwik/share/theme/s5/i18n/bg-shade.png +0 -0
  167. data/vendor/qwik/share/theme/s5/i18n/bg-slide.jpg +0 -0
  168. data/vendor/qwik/share/theme/s5/i18n/framing.css +23 -0
  169. data/vendor/qwik/share/theme/s5/i18n/pretty.css +44 -0
  170. data/vendor/qwik/share/theme/s5/i18n/s5-core.css +9 -0
  171. data/vendor/qwik/share/theme/s5/i18n/slides.css +3 -0
  172. data/vendor/qwik/share/theme/s5/pixel/framing.css +25 -0
  173. data/vendor/qwik/share/theme/s5/pixel/pixelbg.gif +0 -0
  174. data/vendor/qwik/share/theme/s5/pixel/pixelheader.jpg +0 -0
  175. data/vendor/qwik/share/theme/s5/pixel/pixelslide0bg.gif +0 -0
  176. data/vendor/qwik/share/theme/s5/pixel/pretty.css +80 -0
  177. data/vendor/qwik/share/theme/s5/pixel/s5-core.css +11 -0
  178. data/vendor/qwik/share/theme/s5/pixel/slides.css +3 -0
  179. data/vendor/qwik/share/theme/s5/qwikblack/framing.css +23 -0
  180. data/vendor/qwik/share/theme/s5/qwikblack/pretty.css +245 -0
  181. data/vendor/qwik/share/theme/s5/qwikblack/s5-core.css +9 -0
  182. data/vendor/qwik/share/theme/s5/qwikblack/slides.css +3 -0
  183. data/vendor/qwik/share/theme/s5/qwikworld/bg-shade.png +0 -0
  184. data/vendor/qwik/share/theme/s5/qwikworld/bg-slide.jpg +0 -0
  185. data/vendor/qwik/share/theme/s5/qwikworld/framing.css +61 -0
  186. data/vendor/qwik/share/theme/s5/qwikworld/pretty.css +250 -0
  187. data/vendor/qwik/share/theme/s5/qwikworld/qwikcyan_li.png +0 -0
  188. data/vendor/qwik/share/theme/s5/qwikworld/s5-core.css +28 -0
  189. data/vendor/qwik/share/theme/s5/qwikworld/slides.css +3 -0
  190. data/vendor/qwik/share/theme/s5/shell/blank.gif +0 -0
  191. data/vendor/qwik/share/theme/s5/shell/bodybg.gif +0 -0
  192. data/vendor/qwik/share/theme/s5/shell/framing.css +23 -0
  193. data/vendor/qwik/share/theme/s5/shell/pretty.css +86 -0
  194. data/vendor/qwik/share/theme/s5/shell/s5-core.css +9 -0
  195. data/vendor/qwik/share/theme/s5/shell/slides.css +3 -0
  196. metadata +190 -1
@@ -0,0 +1,904 @@
1
+ // Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
2
+ // Contributors:
3
+ // Justin Palmer (http://encytemedia.com/)
4
+ // Mark Pilgrim (http://diveintomark.org/)
5
+ // Martin Bialasinki
6
+ //
7
+ // See scriptaculous.js for full license.
8
+
9
+ /* ------------- element ext -------------- */
10
+
11
+ // converts rgb() and #xxx to #xxxxxx format,
12
+ // returns self (or first argument) if not convertable
13
+ String.prototype.parseColor = function() {
14
+ color = "#";
15
+ if(this.slice(0,4) == "rgb(") {
16
+ var cols = this.slice(4,this.length-1).split(',');
17
+ var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
18
+ } else {
19
+ if(this.slice(0,1) == '#') {
20
+ if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
21
+ if(this.length==7) color = this.toLowerCase();
22
+ }
23
+ }
24
+ return(color.length==7 ? color : (arguments[0] || this));
25
+ }
26
+
27
+ Element.collectTextNodesIgnoreClass = function(element, ignoreclass) {
28
+ var children = $(element).childNodes;
29
+ var text = "";
30
+ var classtest = new RegExp("^([^ ]+ )*" + ignoreclass+ "( [^ ]+)*$","i");
31
+
32
+ for (var i = 0; i < children.length; i++) {
33
+ if(children[i].nodeType==3) {
34
+ text+=children[i].nodeValue;
35
+ } else {
36
+ if((!children[i].className.match(classtest)) && children[i].hasChildNodes())
37
+ text += Element.collectTextNodesIgnoreClass(children[i], ignoreclass);
38
+ }
39
+ }
40
+
41
+ return text;
42
+ }
43
+
44
+ Element.setContentZoom = function(element, percent) {
45
+ element = $(element);
46
+ element.style.fontSize = (percent/100) + "em";
47
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
48
+ }
49
+
50
+ Element.getOpacity = function(element){
51
+ var opacity;
52
+ if (opacity = Element.getStyle(element, "opacity"))
53
+ return parseFloat(opacity);
54
+ if (opacity = (Element.getStyle(element, "filter") || '').match(/alpha\(opacity=(.*)\)/))
55
+ if(opacity[1]) return parseFloat(opacity[1]) / 100;
56
+ return 1.0;
57
+ }
58
+
59
+ Element.setOpacity = function(element, value){
60
+ element= $(element);
61
+ var els = element.style;
62
+ if (value == 1){
63
+ els.opacity = '0.999999';
64
+ if(/MSIE/.test(navigator.userAgent))
65
+ els.filter = Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'');
66
+ } else {
67
+ if(value < 0.00001) value = 0;
68
+ els.opacity = value;
69
+ if(/MSIE/.test(navigator.userAgent))
70
+ els.filter = Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
71
+ "alpha(opacity="+value*100+")";
72
+ }
73
+ }
74
+
75
+ Element.getInlineOpacity = function(element){
76
+ element= $(element);
77
+ var op;
78
+ op = element.style.opacity;
79
+ if (typeof op != "undefined" && op != "") return op;
80
+ return "";
81
+ }
82
+
83
+ Element.setInlineOpacity = function(element, value){
84
+ element= $(element);
85
+ var els = element.style;
86
+ els.opacity = value;
87
+ }
88
+
89
+ Element.childrenWithClassName = function(element, className) {
90
+ return $A($(element).getElementsByTagName('*')).select(
91
+ function(c) { return Element.hasClassName(c, className) });
92
+ }
93
+
94
+ /*--------------------------------------------------------------------------*/
95
+
96
+ var Effect = {
97
+ tagifyText: function(element) {
98
+ var tagifyStyle = "position:relative";
99
+ if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ";zoom:1";
100
+ element = $(element);
101
+ $A(element.childNodes).each( function(child) {
102
+ if(child.nodeType==3) {
103
+ child.nodeValue.toArray().each( function(character) {
104
+ element.insertBefore(
105
+ Builder.node('span',{style: tagifyStyle},
106
+ character == " " ? String.fromCharCode(160) : character),
107
+ child);
108
+ });
109
+ Element.remove(child);
110
+ }
111
+ });
112
+ },
113
+ multiple: function(element, effect) {
114
+ var elements;
115
+ if(((typeof element == 'object') ||
116
+ (typeof element == 'function')) &&
117
+ (element.length))
118
+ elements = element;
119
+ else
120
+ elements = $(element).childNodes;
121
+
122
+ var options = Object.extend({
123
+ speed: 0.1,
124
+ delay: 0.0
125
+ }, arguments[2] || {});
126
+ var speed = options.speed;
127
+ var delay = options.delay;
128
+
129
+ $A(elements).each( function(element, index) {
130
+ new effect(element, Object.extend(options, { delay: delay + index * speed }));
131
+ });
132
+ }
133
+ };
134
+
135
+ var Effect2 = Effect; // deprecated
136
+
137
+ /* ------------- transitions ------------- */
138
+
139
+ Effect.Transitions = {}
140
+
141
+ Effect.Transitions.linear = function(pos) {
142
+ return pos;
143
+ }
144
+ Effect.Transitions.sinoidal = function(pos) {
145
+ return (-Math.cos(pos*Math.PI)/2) + 0.5;
146
+ }
147
+ Effect.Transitions.reverse = function(pos) {
148
+ return 1-pos;
149
+ }
150
+ Effect.Transitions.flicker = function(pos) {
151
+ return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
152
+ }
153
+ Effect.Transitions.wobble = function(pos) {
154
+ return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
155
+ }
156
+ Effect.Transitions.pulse = function(pos) {
157
+ return (Math.floor(pos*10) % 2 == 0 ?
158
+ (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10)));
159
+ }
160
+ Effect.Transitions.none = function(pos) {
161
+ return 0;
162
+ }
163
+ Effect.Transitions.full = function(pos) {
164
+ return 1;
165
+ }
166
+
167
+ /* ------------- core effects ------------- */
168
+
169
+ Effect.Queue = {
170
+ effects: [],
171
+ _each: function(iterator) {
172
+ this.effects._each(iterator);
173
+ },
174
+ interval: null,
175
+ add: function(effect) {
176
+ var timestamp = new Date().getTime();
177
+
178
+ switch(effect.options.queue) {
179
+ case 'front':
180
+ // move unstarted effects after this effect
181
+ this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
182
+ e.startOn += effect.finishOn;
183
+ e.finishOn += effect.finishOn;
184
+ });
185
+ break;
186
+ case 'end':
187
+ // start effect after last queued effect has finished
188
+ timestamp = this.effects.pluck('finishOn').max() || timestamp;
189
+ break;
190
+ }
191
+
192
+ effect.startOn += timestamp;
193
+ effect.finishOn += timestamp;
194
+ this.effects.push(effect);
195
+ if(!this.interval)
196
+ this.interval = setInterval(this.loop.bind(this), 40);
197
+ },
198
+ remove: function(effect) {
199
+ this.effects = this.effects.reject(function(e) { return e==effect });
200
+ if(this.effects.length == 0) {
201
+ clearInterval(this.interval);
202
+ this.interval = null;
203
+ }
204
+ },
205
+ loop: function() {
206
+ var timePos = new Date().getTime();
207
+ this.effects.invoke('loop', timePos);
208
+ }
209
+ }
210
+ Object.extend(Effect.Queue, Enumerable);
211
+
212
+ Effect.Base = function() {};
213
+ Effect.Base.prototype = {
214
+ position: null,
215
+ setOptions: function(options) {
216
+ this.options = Object.extend({
217
+ transition: Effect.Transitions.sinoidal,
218
+ duration: 1.0, // seconds
219
+ fps: 25.0, // max. 25fps due to Effect.Queue implementation
220
+ sync: false, // true for combining
221
+ from: 0.0,
222
+ to: 1.0,
223
+ delay: 0.0,
224
+ queue: 'parallel'
225
+ }, options || {});
226
+ },
227
+ start: function(options) {
228
+ this.setOptions(options || {});
229
+ this.currentFrame = 0;
230
+ this.state = 'idle';
231
+ this.startOn = this.options.delay*1000;
232
+ this.finishOn = this.startOn + (this.options.duration*1000);
233
+ this.event('beforeStart');
234
+ if(!this.options.sync) Effect.Queue.add(this);
235
+ },
236
+ loop: function(timePos) {
237
+ if(timePos >= this.startOn) {
238
+ if(timePos >= this.finishOn) {
239
+ this.render(1.0);
240
+ this.cancel();
241
+ this.event('beforeFinish');
242
+ if(this.finish) this.finish();
243
+ this.event('afterFinish');
244
+ return;
245
+ }
246
+ var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
247
+ var frame = Math.round(pos * this.options.fps * this.options.duration);
248
+ if(frame > this.currentFrame) {
249
+ this.render(pos);
250
+ this.currentFrame = frame;
251
+ }
252
+ }
253
+ },
254
+ render: function(pos) {
255
+ if(this.state == 'idle') {
256
+ this.state = 'running';
257
+ this.event('beforeSetup');
258
+ if(this.setup) this.setup();
259
+ this.event('afterSetup');
260
+ }
261
+ if(this.options.transition) pos = this.options.transition(pos);
262
+ pos *= (this.options.to-this.options.from);
263
+ pos += this.options.from;
264
+ this.position = pos;
265
+ this.event('beforeUpdate');
266
+ if(this.update) this.update(pos);
267
+ this.event('afterUpdate');
268
+ },
269
+ cancel: function() {
270
+ if(!this.options.sync) Effect.Queue.remove(this);
271
+ this.state = 'finished';
272
+ },
273
+ event: function(eventName) {
274
+ if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
275
+ if(this.options[eventName]) this.options[eventName](this);
276
+ }
277
+ }
278
+
279
+ Effect.Parallel = Class.create();
280
+ Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
281
+ initialize: function(effects) {
282
+ this.effects = effects || [];
283
+ this.start(arguments[1]);
284
+ },
285
+ update: function(position) {
286
+ this.effects.invoke('render', position);
287
+ },
288
+ finish: function(position) {
289
+ this.effects.each( function(effect) {
290
+ effect.render(1.0);
291
+ effect.cancel();
292
+ effect.event('beforeFinish');
293
+ if(effect.finish) effect.finish(position);
294
+ effect.event('afterFinish');
295
+ });
296
+ }
297
+ });
298
+
299
+ Effect.Opacity = Class.create();
300
+ Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
301
+ initialize: function(element) {
302
+ this.element = $(element);
303
+ // make this work on IE on elements without 'layout'
304
+ if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
305
+ this.element.style.zoom = 1;
306
+ var options = Object.extend({
307
+ from: Element.getOpacity(this.element) || 0.0,
308
+ to: 1.0
309
+ }, arguments[1] || {});
310
+ this.start(options);
311
+ },
312
+ update: function(position) {
313
+ Element.setOpacity(this.element, position);
314
+ }
315
+ });
316
+
317
+ Effect.MoveBy = Class.create();
318
+ Object.extend(Object.extend(Effect.MoveBy.prototype, Effect.Base.prototype), {
319
+ initialize: function(element, toTop, toLeft) {
320
+ this.element = $(element);
321
+ this.toTop = toTop;
322
+ this.toLeft = toLeft;
323
+ this.start(arguments[3]);
324
+ },
325
+ setup: function() {
326
+ // Bug in Opera: Opera returns the "real" position of a static element or
327
+ // relative element that does not have top/left explicitly set.
328
+ // ==> Always set top and left for position relative elements in your stylesheets
329
+ // (to 0 if you do not need them)
330
+
331
+ Element.makePositioned(this.element);
332
+ this.originalTop = parseFloat(Element.getStyle(this.element,'top') || '0');
333
+ this.originalLeft = parseFloat(Element.getStyle(this.element,'left') || '0');
334
+ },
335
+ update: function(position) {
336
+ var topd = this.toTop * position + this.originalTop;
337
+ var leftd = this.toLeft * position + this.originalLeft;
338
+ this.setPosition(topd, leftd);
339
+ },
340
+ setPosition: function(topd, leftd) {
341
+ this.element.style.top = topd + "px";
342
+ this.element.style.left = leftd + "px";
343
+ }
344
+ });
345
+
346
+ Effect.Scale = Class.create();
347
+ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
348
+ initialize: function(element, percent) {
349
+ this.element = $(element)
350
+ var options = Object.extend({
351
+ scaleX: true,
352
+ scaleY: true,
353
+ scaleContent: true,
354
+ scaleFromCenter: false,
355
+ scaleMode: 'box', // 'box' or 'contents' or {} with provided values
356
+ scaleFrom: 100.0,
357
+ scaleTo: percent
358
+ }, arguments[2] || {});
359
+ this.start(options);
360
+ },
361
+ setup: function() {
362
+ var effect = this;
363
+
364
+ this.restoreAfterFinish = this.options.restoreAfterFinish || false;
365
+ this.elementPositioning = Element.getStyle(this.element,'position');
366
+
367
+ effect.originalStyle = {};
368
+ ['top','left','width','height','fontSize'].each( function(k) {
369
+ effect.originalStyle[k] = effect.element.style[k];
370
+ });
371
+
372
+ this.originalTop = this.element.offsetTop;
373
+ this.originalLeft = this.element.offsetLeft;
374
+
375
+ var fontSize = Element.getStyle(this.element,'font-size') || "100%";
376
+ ['em','px','%'].each( function(fontSizeType) {
377
+ if(fontSize.indexOf(fontSizeType)>0) {
378
+ effect.fontSize = parseFloat(fontSize);
379
+ effect.fontSizeType = fontSizeType;
380
+ }
381
+ });
382
+
383
+ this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
384
+
385
+ this.dims = null;
386
+ if(this.options.scaleMode=='box')
387
+ this.dims = [this.element.clientHeight, this.element.clientWidth];
388
+ if(/^content/.test(this.options.scaleMode))
389
+ this.dims = [this.element.scrollHeight, this.element.scrollWidth];
390
+ if(!this.dims)
391
+ this.dims = [this.options.scaleMode.originalHeight,
392
+ this.options.scaleMode.originalWidth];
393
+ },
394
+ update: function(position) {
395
+ var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
396
+ if(this.options.scaleContent && this.fontSize)
397
+ this.element.style.fontSize = this.fontSize*currentScale + this.fontSizeType;
398
+ this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
399
+ },
400
+ finish: function(position) {
401
+ if (this.restoreAfterFinish) {
402
+ var effect = this;
403
+ ['top','left','width','height','fontSize'].each( function(k) {
404
+ effect.element.style[k] = effect.originalStyle[k];
405
+ });
406
+ }
407
+ },
408
+ setDimensions: function(height, width) {
409
+ var els = this.element.style;
410
+ if(this.options.scaleX) els.width = width + 'px';
411
+ if(this.options.scaleY) els.height = height + 'px';
412
+ if(this.options.scaleFromCenter) {
413
+ var topd = (height - this.dims[0])/2;
414
+ var leftd = (width - this.dims[1])/2;
415
+ if(this.elementPositioning == 'absolute') {
416
+ if(this.options.scaleY) els.top = this.originalTop-topd + "px";
417
+ if(this.options.scaleX) els.left = this.originalLeft-leftd + "px";
418
+ } else {
419
+ if(this.options.scaleY) els.top = -topd + "px";
420
+ if(this.options.scaleX) els.left = -leftd + "px";
421
+ }
422
+ }
423
+ }
424
+ });
425
+
426
+ Effect.Highlight = Class.create();
427
+ Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
428
+ initialize: function(element) {
429
+ this.element = $(element);
430
+ var options = Object.extend({
431
+ startcolor: "#ffff99"
432
+ }, arguments[1] || {});
433
+ this.start(options);
434
+ },
435
+ setup: function() {
436
+ // Prevent executing on elements not in the layout flow
437
+ if(this.element.style.display=='none') { this.cancel(); return; }
438
+ // Disable background image during the effect
439
+ this.oldBgImage = this.element.style.backgroundImage;
440
+ this.element.style.backgroundImage = "none";
441
+ if(!this.options.endcolor)
442
+ this.options.endcolor = Element.getStyle(this.element, 'background-color').parseColor('#ffffff');
443
+ if (typeof this.options.restorecolor == "undefined")
444
+ this.options.restorecolor = this.element.style.backgroundColor;
445
+ // init color calculations
446
+ this.colors_base = [
447
+ parseInt(this.options.startcolor.slice(1,3),16),
448
+ parseInt(this.options.startcolor.slice(3,5),16),
449
+ parseInt(this.options.startcolor.slice(5),16) ];
450
+ this.colors_delta = [
451
+ parseInt(this.options.endcolor.slice(1,3),16)-this.colors_base[0],
452
+ parseInt(this.options.endcolor.slice(3,5),16)-this.colors_base[1],
453
+ parseInt(this.options.endcolor.slice(5),16)-this.colors_base[2]];
454
+ },
455
+ update: function(position) {
456
+ var effect = this; var colors = $R(0,2).map( function(i){
457
+ return Math.round(effect.colors_base[i]+(effect.colors_delta[i]*position))
458
+ });
459
+ this.element.style.backgroundColor = "#" +
460
+ colors[0].toColorPart() + colors[1].toColorPart() + colors[2].toColorPart();
461
+ },
462
+ finish: function() {
463
+ this.element.style.backgroundColor = this.options.restorecolor;
464
+ this.element.style.backgroundImage = this.oldBgImage;
465
+ }
466
+ });
467
+
468
+ Effect.ScrollTo = Class.create();
469
+ Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
470
+ initialize: function(element) {
471
+ this.element = $(element);
472
+ this.start(arguments[1] || {});
473
+ },
474
+ setup: function() {
475
+ Position.prepare();
476
+ var offsets = Position.cumulativeOffset(this.element);
477
+ var max = window.innerHeight ?
478
+ window.height - window.innerHeight :
479
+ document.body.scrollHeight -
480
+ (document.documentElement.clientHeight ?
481
+ document.documentElement.clientHeight : document.body.clientHeight);
482
+ this.scrollStart = Position.deltaY;
483
+ this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
484
+ },
485
+ update: function(position) {
486
+ Position.prepare();
487
+ window.scrollTo(Position.deltaX,
488
+ this.scrollStart + (position*this.delta));
489
+ }
490
+ });
491
+
492
+ /* ------------- combination effects ------------- */
493
+
494
+ Effect.Fade = function(element) {
495
+ var oldOpacity = Element.getInlineOpacity(element);
496
+ var options = Object.extend({
497
+ from: Element.getOpacity(element) || 1.0,
498
+ to: 0.0,
499
+ afterFinishInternal: function(effect)
500
+ { if (effect.options.to == 0) {
501
+ Element.hide(effect.element);
502
+ Element.setInlineOpacity(effect.element, oldOpacity);
503
+ }
504
+ }
505
+ }, arguments[1] || {});
506
+ return new Effect.Opacity(element,options);
507
+ }
508
+
509
+ Effect.Appear = function(element) {
510
+ var options = Object.extend({
511
+ from: (Element.getStyle(element, "display") == "none" ? 0.0 : Element.getOpacity(element) || 0.0),
512
+ to: 1.0,
513
+ beforeSetup: function(effect)
514
+ { Element.setOpacity(effect.element, effect.options.from);
515
+ Element.show(effect.element); }
516
+ }, arguments[1] || {});
517
+ return new Effect.Opacity(element,options);
518
+ }
519
+
520
+ Effect.Puff = function(element) {
521
+ element = $(element);
522
+ var oldOpacity = Element.getInlineOpacity(element);
523
+ var oldPosition = element.style.position;
524
+ return new Effect.Parallel(
525
+ [ new Effect.Scale(element, 200,
526
+ { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
527
+ new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
528
+ Object.extend({ duration: 1.0,
529
+ beforeSetupInternal: function(effect)
530
+ { effect.effects[0].element.style.position = 'absolute'; },
531
+ afterFinishInternal: function(effect)
532
+ { Element.hide(effect.effects[0].element);
533
+ effect.effects[0].element.style.position = oldPosition;
534
+ Element.setInlineOpacity(effect.effects[0].element, oldOpacity); }
535
+ }, arguments[1] || {})
536
+ );
537
+ }
538
+
539
+ Effect.BlindUp = function(element) {
540
+ element = $(element);
541
+ Element.makeClipping(element);
542
+ return new Effect.Scale(element, 0,
543
+ Object.extend({ scaleContent: false,
544
+ scaleX: false,
545
+ restoreAfterFinish: true,
546
+ afterFinishInternal: function(effect)
547
+ {
548
+ Element.hide(effect.element);
549
+ Element.undoClipping(effect.element);
550
+ }
551
+ }, arguments[1] || {})
552
+ );
553
+ }
554
+
555
+ Effect.BlindDown = function(element) {
556
+ element = $(element);
557
+ var oldHeight = element.style.height;
558
+ var elementDimensions = Element.getDimensions(element);
559
+ return new Effect.Scale(element, 100,
560
+ Object.extend({ scaleContent: false,
561
+ scaleX: false,
562
+ scaleFrom: 0,
563
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
564
+ restoreAfterFinish: true,
565
+ afterSetup: function(effect) {
566
+ Element.makeClipping(effect.element);
567
+ effect.element.style.height = "0px";
568
+ Element.show(effect.element);
569
+ },
570
+ afterFinishInternal: function(effect) {
571
+ Element.undoClipping(effect.element);
572
+ effect.element.style.height = oldHeight;
573
+ }
574
+ }, arguments[1] || {})
575
+ );
576
+ }
577
+
578
+ Effect.SwitchOff = function(element) {
579
+ element = $(element);
580
+ var oldOpacity = Element.getInlineOpacity(element);
581
+ return new Effect.Appear(element, {
582
+ duration: 0.4,
583
+ from: 0,
584
+ transition: Effect.Transitions.flicker,
585
+ afterFinishInternal: function(effect) {
586
+ new Effect.Scale(effect.element, 1, {
587
+ duration: 0.3, scaleFromCenter: true,
588
+ scaleX: false, scaleContent: false, restoreAfterFinish: true,
589
+ beforeSetup: function(effect) {
590
+ Element.makePositioned(effect.element);
591
+ Element.makeClipping(effect.element);
592
+ },
593
+ afterFinishInternal: function(effect) {
594
+ Element.hide(effect.element);
595
+ Element.undoClipping(effect.element);
596
+ Element.undoPositioned(effect.element);
597
+ Element.setInlineOpacity(effect.element, oldOpacity);
598
+ }
599
+ })
600
+ }
601
+ });
602
+ }
603
+
604
+ Effect.DropOut = function(element) {
605
+ element = $(element);
606
+ var oldTop = element.style.top;
607
+ var oldLeft = element.style.left;
608
+ var oldOpacity = Element.getInlineOpacity(element);
609
+ return new Effect.Parallel(
610
+ [ new Effect.MoveBy(element, 100, 0, { sync: true }),
611
+ new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
612
+ Object.extend(
613
+ { duration: 0.5,
614
+ beforeSetup: function(effect) {
615
+ Element.makePositioned(effect.effects[0].element); },
616
+ afterFinishInternal: function(effect) {
617
+ Element.hide(effect.effects[0].element);
618
+ Element.undoPositioned(effect.effects[0].element);
619
+ effect.effects[0].element.style.left = oldLeft;
620
+ effect.effects[0].element.style.top = oldTop;
621
+ Element.setInlineOpacity(effect.effects[0].element, oldOpacity); }
622
+ }, arguments[1] || {}));
623
+ }
624
+
625
+ Effect.Shake = function(element) {
626
+ element = $(element);
627
+ var oldTop = element.style.top;
628
+ var oldLeft = element.style.left;
629
+ return new Effect.MoveBy(element, 0, 20,
630
+ { duration: 0.05, afterFinishInternal: function(effect) {
631
+ new Effect.MoveBy(effect.element, 0, -40,
632
+ { duration: 0.1, afterFinishInternal: function(effect) {
633
+ new Effect.MoveBy(effect.element, 0, 40,
634
+ { duration: 0.1, afterFinishInternal: function(effect) {
635
+ new Effect.MoveBy(effect.element, 0, -40,
636
+ { duration: 0.1, afterFinishInternal: function(effect) {
637
+ new Effect.MoveBy(effect.element, 0, 40,
638
+ { duration: 0.1, afterFinishInternal: function(effect) {
639
+ new Effect.MoveBy(effect.element, 0, -20,
640
+ { duration: 0.05, afterFinishInternal: function(effect) {
641
+ Element.undoPositioned(effect.element);
642
+ effect.element.style.left = oldLeft;
643
+ effect.element.style.top = oldTop;
644
+ }}) }}) }}) }}) }}) }});
645
+ }
646
+
647
+ Effect.SlideDown = function(element) {
648
+ element = $(element);
649
+ Element.cleanWhitespace(element);
650
+ // SlideDown need to have the content of the element wrapped in a container element with fixed height!
651
+ var oldInnerBottom = element.firstChild.style.bottom;
652
+ var elementDimensions = Element.getDimensions(element);
653
+ return new Effect.Scale(element, 100,
654
+ Object.extend({ scaleContent: false,
655
+ scaleX: false,
656
+ scaleFrom: 0,
657
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
658
+ restoreAfterFinish: true,
659
+ afterSetup: function(effect) {
660
+ Element.makePositioned(effect.element.firstChild);
661
+ if (window.opera) effect.element.firstChild.style.top = "";
662
+ Element.makeClipping(effect.element);
663
+ element.style.height = '0';
664
+ Element.show(element);
665
+ },
666
+ afterUpdateInternal: function(effect) {
667
+ effect.element.firstChild.style.bottom =
668
+ (effect.dims[0] - effect.element.clientHeight) + 'px'; },
669
+ afterFinishInternal: function(effect) {
670
+ Element.undoClipping(effect.element);
671
+ Element.undoPositioned(effect.element.firstChild);
672
+ effect.element.firstChild.style.bottom = oldInnerBottom; }
673
+ }, arguments[1] || {})
674
+ );
675
+ }
676
+
677
+ Effect.SlideUp = function(element) {
678
+ element = $(element);
679
+ Element.cleanWhitespace(element);
680
+ var oldInnerBottom = element.firstChild.style.bottom;
681
+ return new Effect.Scale(element, 0,
682
+ Object.extend({ scaleContent: false,
683
+ scaleX: false,
684
+ scaleMode: 'box',
685
+ scaleFrom: 100,
686
+ restoreAfterFinish: true,
687
+ beforeStartInternal: function(effect) {
688
+ Element.makePositioned(effect.element.firstChild);
689
+ if (window.opera) effect.element.firstChild.style.top = "";
690
+ Element.makeClipping(effect.element);
691
+ Element.show(element);
692
+ },
693
+ afterUpdateInternal: function(effect) {
694
+ effect.element.firstChild.style.bottom =
695
+ (effect.dims[0] - effect.element.clientHeight) + 'px'; },
696
+ afterFinishInternal: function(effect) {
697
+ Element.hide(effect.element);
698
+ Element.undoClipping(effect.element);
699
+ Element.undoPositioned(effect.element.firstChild);
700
+ effect.element.firstChild.style.bottom = oldInnerBottom; }
701
+ }, arguments[1] || {})
702
+ );
703
+ }
704
+
705
+ Effect.Squish = function(element) {
706
+ // Bug in opera makes the TD containing this element expand for a instance after finish
707
+ return new Effect.Scale(element, window.opera ? 1 : 0,
708
+ { restoreAfterFinish: true,
709
+ beforeSetup: function(effect) {
710
+ Element.makeClipping(effect.element); },
711
+ afterFinishInternal: function(effect) {
712
+ Element.hide(effect.element);
713
+ Element.undoClipping(effect.element); }
714
+ });
715
+ }
716
+
717
+ Effect.Grow = function(element) {
718
+ element = $(element);
719
+ var options = arguments[1] || {};
720
+
721
+ var elementDimensions = Element.getDimensions(element);
722
+ var originalWidth = elementDimensions.width;
723
+ var originalHeight = elementDimensions.height;
724
+ var oldTop = element.style.top;
725
+ var oldLeft = element.style.left;
726
+ var oldHeight = element.style.height;
727
+ var oldWidth = element.style.width;
728
+ var oldOpacity = Element.getInlineOpacity(element);
729
+
730
+ var direction = options.direction || 'center';
731
+ var moveTransition = options.moveTransition || Effect.Transitions.sinoidal;
732
+ var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal;
733
+ var opacityTransition = options.opacityTransition || Effect.Transitions.full;
734
+
735
+ var initialMoveX, initialMoveY;
736
+ var moveX, moveY;
737
+
738
+ switch (direction) {
739
+ case 'top-left':
740
+ initialMoveX = initialMoveY = moveX = moveY = 0;
741
+ break;
742
+ case 'top-right':
743
+ initialMoveX = originalWidth;
744
+ initialMoveY = moveY = 0;
745
+ moveX = -originalWidth;
746
+ break;
747
+ case 'bottom-left':
748
+ initialMoveX = moveX = 0;
749
+ initialMoveY = originalHeight;
750
+ moveY = -originalHeight;
751
+ break;
752
+ case 'bottom-right':
753
+ initialMoveX = originalWidth;
754
+ initialMoveY = originalHeight;
755
+ moveX = -originalWidth;
756
+ moveY = -originalHeight;
757
+ break;
758
+ case 'center':
759
+ initialMoveX = originalWidth / 2;
760
+ initialMoveY = originalHeight / 2;
761
+ moveX = -originalWidth / 2;
762
+ moveY = -originalHeight / 2;
763
+ break;
764
+ }
765
+
766
+ return new Effect.MoveBy(element, initialMoveY, initialMoveX, {
767
+ duration: 0.01,
768
+ beforeSetup: function(effect) {
769
+ Element.hide(effect.element);
770
+ Element.makeClipping(effect.element);
771
+ Element.makePositioned(effect.element);
772
+ },
773
+ afterFinishInternal: function(effect) {
774
+ new Effect.Parallel(
775
+ [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: opacityTransition }),
776
+ new Effect.MoveBy(effect.element, moveY, moveX, { sync: true, transition: moveTransition }),
777
+ new Effect.Scale(effect.element, 100, {
778
+ scaleMode: { originalHeight: originalHeight, originalWidth: originalWidth },
779
+ sync: true, scaleFrom: window.opera ? 1 : 0, transition: scaleTransition, restoreAfterFinish: true})
780
+ ], Object.extend({
781
+ beforeSetup: function(effect) {
782
+ effect.effects[0].element.style.height = 0;
783
+ Element.show(effect.effects[0].element);
784
+ },
785
+ afterFinishInternal: function(effect) {
786
+ var el = effect.effects[0].element;
787
+ var els = el.style;
788
+ Element.undoClipping(el);
789
+ Element.undoPositioned(el);
790
+ els.top = oldTop;
791
+ els.left = oldLeft;
792
+ els.height = oldHeight;
793
+ els.width = originalWidth + 'px';
794
+ Element.setInlineOpacity(el, oldOpacity);
795
+ }
796
+ }, options)
797
+ )
798
+ }
799
+ });
800
+ }
801
+
802
+ Effect.Shrink = function(element) {
803
+ element = $(element);
804
+ var options = arguments[1] || {};
805
+
806
+ var originalWidth = element.clientWidth;
807
+ var originalHeight = element.clientHeight;
808
+ var oldTop = element.style.top;
809
+ var oldLeft = element.style.left;
810
+ var oldHeight = element.style.height;
811
+ var oldWidth = element.style.width;
812
+ var oldOpacity = Element.getInlineOpacity(element);
813
+
814
+ var direction = options.direction || 'center';
815
+ var moveTransition = options.moveTransition || Effect.Transitions.sinoidal;
816
+ var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal;
817
+ var opacityTransition = options.opacityTransition || Effect.Transitions.none;
818
+
819
+ var moveX, moveY;
820
+
821
+ switch (direction) {
822
+ case 'top-left':
823
+ moveX = moveY = 0;
824
+ break;
825
+ case 'top-right':
826
+ moveX = originalWidth;
827
+ moveY = 0;
828
+ break;
829
+ case 'bottom-left':
830
+ moveX = 0;
831
+ moveY = originalHeight;
832
+ break;
833
+ case 'bottom-right':
834
+ moveX = originalWidth;
835
+ moveY = originalHeight;
836
+ break;
837
+ case 'center':
838
+ moveX = originalWidth / 2;
839
+ moveY = originalHeight / 2;
840
+ break;
841
+ }
842
+
843
+ return new Effect.Parallel(
844
+ [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: opacityTransition }),
845
+ new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: scaleTransition, restoreAfterFinish: true}),
846
+ new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: moveTransition })
847
+ ], Object.extend({
848
+ beforeStartInternal: function(effect) {
849
+ Element.makePositioned(effect.effects[0].element);
850
+ Element.makeClipping(effect.effects[0].element);
851
+ },
852
+ afterFinishInternal: function(effect) {
853
+ var el = effect.effects[0].element;
854
+ var els = el.style;
855
+ Element.hide(el);
856
+ Element.undoClipping(el);
857
+ Element.undoPositioned(el);
858
+ els.top = oldTop;
859
+ els.left = oldLeft;
860
+ els.height = oldHeight;
861
+ els.width = oldWidth;
862
+ Element.setInlineOpacity(el, oldOpacity);
863
+ }
864
+ }, options)
865
+ );
866
+ }
867
+
868
+ Effect.Pulsate = function(element) {
869
+ element = $(element);
870
+ var options = arguments[1] || {};
871
+ var oldOpacity = Element.getInlineOpacity(element);
872
+ var transition = options.transition || Effect.Transitions.sinoidal;
873
+ var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
874
+ reverser.bind(transition);
875
+ return new Effect.Opacity(element,
876
+ Object.extend(Object.extend({ duration: 3.0, from: 0,
877
+ afterFinishInternal: function(effect) { Element.setInlineOpacity(effect.element, oldOpacity); }
878
+ }, options), {transition: reverser}));
879
+ }
880
+
881
+ Effect.Fold = function(element) {
882
+ element = $(element);
883
+ var originalTop = element.style.top;
884
+ var originalLeft = element.style.left;
885
+ var originalWidth = element.style.width;
886
+ var originalHeight = element.style.height;
887
+ Element.makeClipping(element);
888
+ return new Effect.Scale(element, 5, Object.extend({
889
+ scaleContent: false,
890
+ scaleX: false,
891
+ afterFinishInternal: function(effect) {
892
+ new Effect.Scale(element, 1, {
893
+ scaleContent: false,
894
+ scaleY: false,
895
+ afterFinishInternal: function(effect) {
896
+ Element.hide(effect.element);
897
+ Element.undoClipping(effect.element);
898
+ effect.element.style.top = originalTop;
899
+ effect.element.style.left = originalLeft;
900
+ effect.element.style.width = originalWidth;
901
+ effect.element.style.height = originalHeight;
902
+ } });
903
+ }}, arguments[1] || {}));
904
+ }