stuff_to_do_plugin 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. data/COPYRIGHT.txt +18 -0
  2. data/CREDITS.txt +6 -0
  3. data/GPL.txt +339 -0
  4. data/README.rdoc +61 -0
  5. data/Rakefile +38 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/stuff_to_do_controller.rb +161 -0
  8. data/app/helpers/stuff_to_do_helper.rb +88 -0
  9. data/app/models/stuff_to_do.rb +208 -0
  10. data/app/models/stuff_to_do_filter.rb +32 -0
  11. data/app/models/stuff_to_do_mailer.rb +16 -0
  12. data/app/views/settings/_stuff_to_do_settings.html.erb +27 -0
  13. data/app/views/stuff_to_do/_issue.html.erb +16 -0
  14. data/app/views/stuff_to_do/_item.html.erb +5 -0
  15. data/app/views/stuff_to_do/_left_panes.html.erb +51 -0
  16. data/app/views/stuff_to_do/_panes.html.erb +11 -0
  17. data/app/views/stuff_to_do/_project.html.erb +6 -0
  18. data/app/views/stuff_to_do/_right_panes.html.erb +25 -0
  19. data/app/views/stuff_to_do/_time_grid.html.erb +113 -0
  20. data/app/views/stuff_to_do/_time_grid_form.html.erb +32 -0
  21. data/app/views/stuff_to_do/index.html.erb +44 -0
  22. data/app/views/stuff_to_do_mailer/recommended_below_threshold.erb +3 -0
  23. data/app/views/stuff_to_do_mailer/recommended_below_threshold.text.html.rhtml +1 -0
  24. data/assets/images/b.png +0 -0
  25. data/assets/images/bl.png +0 -0
  26. data/assets/images/br.png +0 -0
  27. data/assets/images/closelabel.gif +0 -0
  28. data/assets/images/loading.gif +0 -0
  29. data/assets/images/tl.png +0 -0
  30. data/assets/images/tr.png +0 -0
  31. data/assets/javascripts/facebox.js +319 -0
  32. data/assets/javascripts/jquery-1.2.6.min.js +32 -0
  33. data/assets/javascripts/jquery-ui.js +2839 -0
  34. data/assets/javascripts/jquery.contextMenu.js +212 -0
  35. data/assets/javascripts/semantic.cache +15 -0
  36. data/assets/javascripts/stuff-to-do.js +270 -0
  37. data/assets/javascripts/ui/build.xml +24 -0
  38. data/assets/javascripts/ui/effects.blind.js +49 -0
  39. data/assets/javascripts/ui/effects.bounce.js +78 -0
  40. data/assets/javascripts/ui/effects.clip.js +54 -0
  41. data/assets/javascripts/ui/effects.core.js +510 -0
  42. data/assets/javascripts/ui/effects.drop.js +50 -0
  43. data/assets/javascripts/ui/effects.explode.js +79 -0
  44. data/assets/javascripts/ui/effects.fold.js +55 -0
  45. data/assets/javascripts/ui/effects.highlight.js +48 -0
  46. data/assets/javascripts/ui/effects.pulsate.js +55 -0
  47. data/assets/javascripts/ui/effects.scale.js +180 -0
  48. data/assets/javascripts/ui/effects.shake.js +57 -0
  49. data/assets/javascripts/ui/effects.slide.js +50 -0
  50. data/assets/javascripts/ui/effects.transfer.js +59 -0
  51. data/assets/javascripts/ui/i18n/ui.datepicker-ar.js +26 -0
  52. data/assets/javascripts/ui/i18n/ui.datepicker-bg.js +25 -0
  53. data/assets/javascripts/ui/i18n/ui.datepicker-ca.js +25 -0
  54. data/assets/javascripts/ui/i18n/ui.datepicker-cs.js +25 -0
  55. data/assets/javascripts/ui/i18n/ui.datepicker-da.js +25 -0
  56. data/assets/javascripts/ui/i18n/ui.datepicker-de.js +25 -0
  57. data/assets/javascripts/ui/i18n/ui.datepicker-eo.js +25 -0
  58. data/assets/javascripts/ui/i18n/ui.datepicker-es.js +25 -0
  59. data/assets/javascripts/ui/i18n/ui.datepicker-fa.js +25 -0
  60. data/assets/javascripts/ui/i18n/ui.datepicker-fi.js +25 -0
  61. data/assets/javascripts/ui/i18n/ui.datepicker-fr.js +25 -0
  62. data/assets/javascripts/ui/i18n/ui.datepicker-he.js +25 -0
  63. data/assets/javascripts/ui/i18n/ui.datepicker-hr.js +25 -0
  64. data/assets/javascripts/ui/i18n/ui.datepicker-hu.js +25 -0
  65. data/assets/javascripts/ui/i18n/ui.datepicker-hy.js +25 -0
  66. data/assets/javascripts/ui/i18n/ui.datepicker-id.js +25 -0
  67. data/assets/javascripts/ui/i18n/ui.datepicker-is.js +25 -0
  68. data/assets/javascripts/ui/i18n/ui.datepicker-it.js +25 -0
  69. data/assets/javascripts/ui/i18n/ui.datepicker-ja.js +26 -0
  70. data/assets/javascripts/ui/i18n/ui.datepicker-ko.js +25 -0
  71. data/assets/javascripts/ui/i18n/ui.datepicker-lt.js +25 -0
  72. data/assets/javascripts/ui/i18n/ui.datepicker-lv.js +25 -0
  73. data/assets/javascripts/ui/i18n/ui.datepicker-nl.js +25 -0
  74. data/assets/javascripts/ui/i18n/ui.datepicker-no.js +25 -0
  75. data/assets/javascripts/ui/i18n/ui.datepicker-pl.js +25 -0
  76. data/assets/javascripts/ui/i18n/ui.datepicker-pt-BR.js +25 -0
  77. data/assets/javascripts/ui/i18n/ui.datepicker-ro.js +25 -0
  78. data/assets/javascripts/ui/i18n/ui.datepicker-ru.js +25 -0
  79. data/assets/javascripts/ui/i18n/ui.datepicker-sk.js +25 -0
  80. data/assets/javascripts/ui/i18n/ui.datepicker-sl.js +26 -0
  81. data/assets/javascripts/ui/i18n/ui.datepicker-sq.js +25 -0
  82. data/assets/javascripts/ui/i18n/ui.datepicker-sv.js +25 -0
  83. data/assets/javascripts/ui/i18n/ui.datepicker-th.js +25 -0
  84. data/assets/javascripts/ui/i18n/ui.datepicker-tr.js +25 -0
  85. data/assets/javascripts/ui/i18n/ui.datepicker-uk.js +25 -0
  86. data/assets/javascripts/ui/i18n/ui.datepicker-zh-CN.js +25 -0
  87. data/assets/javascripts/ui/i18n/ui.datepicker-zh-TW.js +25 -0
  88. data/assets/javascripts/ui/svn.log +11 -0
  89. data/assets/javascripts/ui/ui.accordion.js +400 -0
  90. data/assets/javascripts/ui/ui.core.js +533 -0
  91. data/assets/javascripts/ui/ui.datepicker.js +1754 -0
  92. data/assets/javascripts/ui/ui.dialog.js +630 -0
  93. data/assets/javascripts/ui/ui.draggable.js +696 -0
  94. data/assets/javascripts/ui/ui.droppable.js +314 -0
  95. data/assets/javascripts/ui/ui.progressbar.js +114 -0
  96. data/assets/javascripts/ui/ui.resizable.js +805 -0
  97. data/assets/javascripts/ui/ui.selectable.js +266 -0
  98. data/assets/javascripts/ui/ui.slider.js +552 -0
  99. data/assets/javascripts/ui/ui.sortable.js +1012 -0
  100. data/assets/javascripts/ui/ui.tabs.js +572 -0
  101. data/assets/stylesheets/stuff_to_do.css +216 -0
  102. data/config/locales/bg.yml +18 -0
  103. data/config/locales/ca-fr.yml +18 -0
  104. data/config/locales/cs.yml +16 -0
  105. data/config/locales/da.yml +16 -0
  106. data/config/locales/de.yml +18 -0
  107. data/config/locales/en.yml +24 -0
  108. data/config/locales/es.yml +19 -0
  109. data/config/locales/fr.yml +17 -0
  110. data/config/locales/hu.yml +16 -0
  111. data/config/locales/it.yml +16 -0
  112. data/config/locales/ja.yml +18 -0
  113. data/config/locales/ko.yml +18 -0
  114. data/config/locales/lt.yml +18 -0
  115. data/config/locales/nl.yml +20 -0
  116. data/config/locales/pt-BR.yml +18 -0
  117. data/config/locales/ru.yml +19 -0
  118. data/config/locales/sv.yml +19 -0
  119. data/config/locales/tr.yml +18 -0
  120. data/config/routes.rb +3 -0
  121. data/init.rb +54 -0
  122. data/lang/bg.yml +17 -0
  123. data/lang/ca-fr.yml +17 -0
  124. data/lang/cs.yml +15 -0
  125. data/lang/da.yml +15 -0
  126. data/lang/de.yml +17 -0
  127. data/lang/en.yml +21 -0
  128. data/lang/es.yml +18 -0
  129. data/lang/fr.yml +16 -0
  130. data/lang/hu.yml +15 -0
  131. data/lang/it.yml +15 -0
  132. data/lang/ja.yml +17 -0
  133. data/lang/ko.yml +17 -0
  134. data/lang/lt.yml +17 -0
  135. data/lang/pt-br.yml +17 -0
  136. data/lang/ru.yml +15 -0
  137. data/lang/sv.yml +18 -0
  138. data/lang/tr.yml +17 -0
  139. data/lib/redmine_stuff_to_do/stuff_to_do_compatibility.rb +15 -0
  140. data/lib/stuff_to_do_array_patch.rb +8 -0
  141. data/lib/stuff_to_do_issue_patch.rb +57 -0
  142. data/lib/stuff_to_do_project_patch.rb +31 -0
  143. data/lib/stuff_to_do_user_patch.rb +10 -0
  144. data/rails/init.rb +1 -0
  145. data/spec/controllers/stuff_to_do_controller_add_to_time_grid_spec.rb +58 -0
  146. data/spec/controllers/stuff_to_do_controller_index_spec.rb +155 -0
  147. data/spec/controllers/stuff_to_do_controller_remove_from_time_grid_spec.rb +56 -0
  148. data/spec/controllers/stuff_to_do_controller_reorder_spec.rb +179 -0
  149. data/spec/controllers/stuff_to_do_controller_save_time_entries_spec.rb +56 -0
  150. data/spec/controllers/stuff_to_do_private_methods_spec.rb +82 -0
  151. data/spec/lib/stuff_to_do_issue_patch_spec.rb +60 -0
  152. data/spec/lib/stuff_to_do_project_patch_spec.rb +50 -0
  153. data/spec/lib/stuff_to_do_user_patch_spec.rb +8 -0
  154. data/spec/models/stuff_to_do_filter_spec.rb +3 -0
  155. data/spec/models/stuff_to_do_mailer_spec.rb +42 -0
  156. data/spec/models/stuff_to_do_spec.rb +426 -0
  157. data/spec/sanity_spec.rb +7 -0
  158. data/spec/spec_helper.rb +130 -0
  159. metadata +211 -0
@@ -0,0 +1,50 @@
1
+ /*
2
+ * jQuery UI Effects Drop @VERSION
3
+ *
4
+ * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Effects/Drop
9
+ *
10
+ * Depends:
11
+ * effects.core.js
12
+ */
13
+ (function($) {
14
+
15
+ $.effects.drop = function(o) {
16
+
17
+ return this.queue(function() {
18
+
19
+ // Create element
20
+ var el = $(this), props = ['position','top','left','opacity'];
21
+
22
+ // Set options
23
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
24
+ var direction = o.options.direction || 'left'; // Default Direction
25
+
26
+ // Adjust
27
+ $.effects.save(el, props); el.show(); // Save & Show
28
+ $.effects.createWrapper(el); // Create Wrapper
29
+ var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
30
+ var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
31
+ var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
32
+ if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
33
+
34
+ // Animation
35
+ var animation = {opacity: mode == 'show' ? 1 : 0};
36
+ animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
37
+
38
+ // Animate
39
+ el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
40
+ if(mode == 'hide') el.hide(); // Hide
41
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
42
+ if(o.callback) o.callback.apply(this, arguments); // Callback
43
+ el.dequeue();
44
+ }});
45
+
46
+ });
47
+
48
+ };
49
+
50
+ })(jQuery);
@@ -0,0 +1,79 @@
1
+ /*
2
+ * jQuery UI Effects Explode @VERSION
3
+ *
4
+ * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Effects/Explode
9
+ *
10
+ * Depends:
11
+ * effects.core.js
12
+ */
13
+ (function($) {
14
+
15
+ $.effects.explode = function(o) {
16
+
17
+ return this.queue(function() {
18
+
19
+ var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
20
+ var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
21
+
22
+ o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
23
+ var el = $(this).show().css('visibility', 'hidden');
24
+ var offset = el.offset();
25
+
26
+ //Substract the margins - not fixing the problem yet.
27
+ offset.top -= parseInt(el.css("marginTop")) || 0;
28
+ offset.left -= parseInt(el.css("marginLeft")) || 0;
29
+
30
+ var width = el.outerWidth(true);
31
+ var height = el.outerHeight(true);
32
+
33
+ for(var i=0;i<rows;i++) { // =
34
+ for(var j=0;j<cells;j++) { // ||
35
+ el
36
+ .clone()
37
+ .appendTo('body')
38
+ .wrap('<div></div>')
39
+ .css({
40
+ position: 'absolute',
41
+ visibility: 'visible',
42
+ left: -j*(width/cells),
43
+ top: -i*(height/rows)
44
+ })
45
+ .parent()
46
+ .addClass('effects-explode')
47
+ .css({
48
+ position: 'absolute',
49
+ overflow: 'hidden',
50
+ width: width/cells,
51
+ height: height/rows,
52
+ left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
53
+ top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
54
+ opacity: o.options.mode == 'show' ? 0 : 1
55
+ }).animate({
56
+ left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
57
+ top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
58
+ opacity: o.options.mode == 'show' ? 1 : 0
59
+ }, o.duration || 500);
60
+ }
61
+ }
62
+
63
+ // Set a timeout, to call the callback approx. when the other animations have finished
64
+ setTimeout(function() {
65
+
66
+ o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
67
+ if(o.callback) o.callback.apply(el[0]); // Callback
68
+ el.dequeue();
69
+
70
+ $('.effects-explode').remove();
71
+
72
+ }, o.duration || 500);
73
+
74
+
75
+ });
76
+
77
+ };
78
+
79
+ })(jQuery);
@@ -0,0 +1,55 @@
1
+ /*
2
+ * jQuery UI Effects Fold @VERSION
3
+ *
4
+ * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Effects/Fold
9
+ *
10
+ * Depends:
11
+ * effects.core.js
12
+ */
13
+ (function($) {
14
+
15
+ $.effects.fold = function(o) {
16
+
17
+ return this.queue(function() {
18
+
19
+ // Create element
20
+ var el = $(this), props = ['position','top','left'];
21
+
22
+ // Set options
23
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
24
+ var size = o.options.size || 15; // Default fold size
25
+ var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
26
+
27
+ // Adjust
28
+ $.effects.save(el, props); el.show(); // Save & Show
29
+ var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
30
+ var widthFirst = ((mode == 'show') != horizFirst);
31
+ var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
32
+ var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
33
+ var percent = /([0-9]+)%/.exec(size);
34
+ if(percent) size = parseInt(percent[1]) / 100 * distance[mode == 'hide' ? 0 : 1];
35
+ if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
36
+
37
+ // Animation
38
+ var animation1 = {}, animation2 = {};
39
+ animation1[ref[0]] = mode == 'show' ? distance[0] : size;
40
+ animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
41
+
42
+ // Animate
43
+ wrapper.animate(animation1, o.duration / 2, o.options.easing)
44
+ .animate(animation2, o.duration / 2, o.options.easing, function() {
45
+ if(mode == 'hide') el.hide(); // Hide
46
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
47
+ if(o.callback) o.callback.apply(el[0], arguments); // Callback
48
+ el.dequeue();
49
+ });
50
+
51
+ });
52
+
53
+ };
54
+
55
+ })(jQuery);
@@ -0,0 +1,48 @@
1
+ /*
2
+ * jQuery UI Effects Highlight @VERSION
3
+ *
4
+ * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Effects/Highlight
9
+ *
10
+ * Depends:
11
+ * effects.core.js
12
+ */
13
+ (function($) {
14
+
15
+ $.effects.highlight = function(o) {
16
+
17
+ return this.queue(function() {
18
+
19
+ // Create element
20
+ var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
21
+
22
+ // Set options
23
+ var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
24
+ var color = o.options.color || "#ffff99"; // Default highlight color
25
+ var oldColor = el.css("backgroundColor");
26
+
27
+ // Adjust
28
+ $.effects.save(el, props); el.show(); // Save & Show
29
+ el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
30
+
31
+ // Animation
32
+ var animation = {backgroundColor: oldColor };
33
+ if (mode == "hide") animation['opacity'] = 0;
34
+
35
+ // Animate
36
+ el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
37
+ if(mode == "hide") el.hide();
38
+ $.effects.restore(el, props);
39
+ if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter');
40
+ if(o.callback) o.callback.apply(this, arguments);
41
+ el.dequeue();
42
+ }});
43
+
44
+ });
45
+
46
+ };
47
+
48
+ })(jQuery);
@@ -0,0 +1,55 @@
1
+ /*
2
+ * jQuery UI Effects Pulsate @VERSION
3
+ *
4
+ * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Effects/Pulsate
9
+ *
10
+ * Depends:
11
+ * effects.core.js
12
+ */
13
+ (function($) {
14
+
15
+ $.effects.pulsate = function(o) {
16
+
17
+ return this.queue(function() {
18
+
19
+ // Create element
20
+ var el = $(this);
21
+
22
+ // Set options
23
+ var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
24
+ var times = o.options.times || 5; // Default # of times
25
+
26
+ // Adjust
27
+ if (mode == 'hide') times--;
28
+ if (el.is(':hidden')) { // Show fadeIn
29
+ el.css('opacity', 0);
30
+ el.show(); // Show
31
+ el.animate({opacity: 1}, o.duration / 2, o.options.easing);
32
+ times = times-2;
33
+ }
34
+
35
+ // Animate
36
+ for (var i = 0; i < times; i++) { // Pulsate
37
+ el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing);
38
+ };
39
+ if (mode == 'hide') { // Last Pulse
40
+ el.animate({opacity: 0}, o.duration / 2, o.options.easing, function(){
41
+ el.hide(); // Hide
42
+ if(o.callback) o.callback.apply(this, arguments); // Callback
43
+ });
44
+ } else {
45
+ el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing, function(){
46
+ if(o.callback) o.callback.apply(this, arguments); // Callback
47
+ });
48
+ };
49
+ el.queue('fx', function() { el.dequeue(); });
50
+ el.dequeue();
51
+ });
52
+
53
+ };
54
+
55
+ })(jQuery);
@@ -0,0 +1,180 @@
1
+ /*
2
+ * jQuery UI Effects Scale @VERSION
3
+ *
4
+ * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Effects/Scale
9
+ *
10
+ * Depends:
11
+ * effects.core.js
12
+ */
13
+ (function($) {
14
+
15
+ $.effects.puff = function(o) {
16
+
17
+ return this.queue(function() {
18
+
19
+ // Create element
20
+ var el = $(this);
21
+
22
+ // Set options
23
+ var options = $.extend(true, {}, o.options);
24
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
25
+ var percent = parseInt(o.options.percent) || 150; // Set default puff percent
26
+ options.fade = true; // It's not a puff if it doesn't fade! :)
27
+ var original = {height: el.height(), width: el.width()}; // Save original
28
+
29
+ // Adjust
30
+ var factor = percent / 100;
31
+ el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};
32
+
33
+ // Animation
34
+ options.from = el.from;
35
+ options.percent = (mode == 'hide') ? percent : 100;
36
+ options.mode = mode;
37
+
38
+ // Animate
39
+ el.effect('scale', options, o.duration, o.callback);
40
+ el.dequeue();
41
+ });
42
+
43
+ };
44
+
45
+ $.effects.scale = function(o) {
46
+
47
+ return this.queue(function() {
48
+
49
+ // Create element
50
+ var el = $(this);
51
+
52
+ // Set options
53
+ var options = $.extend(true, {}, o.options);
54
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
55
+ var percent = parseInt(o.options.percent) || (parseInt(o.options.percent) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
56
+ var direction = o.options.direction || 'both'; // Set default axis
57
+ var origin = o.options.origin; // The origin of the scaling
58
+ if (mode != 'effect') { // Set default origin and restore for show/hide
59
+ options.origin = origin || ['middle','center'];
60
+ options.restore = true;
61
+ }
62
+ var original = {height: el.height(), width: el.width()}; // Save original
63
+ el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
64
+
65
+ // Adjust
66
+ var factor = { // Set scaling factor
67
+ y: direction != 'horizontal' ? (percent / 100) : 1,
68
+ x: direction != 'vertical' ? (percent / 100) : 1
69
+ };
70
+ el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
71
+
72
+ if (o.options.fade) { // Fade option to support puff
73
+ if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
74
+ if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
75
+ };
76
+
77
+ // Animation
78
+ options.from = el.from; options.to = el.to; options.mode = mode;
79
+
80
+ // Animate
81
+ el.effect('size', options, o.duration, o.callback);
82
+ el.dequeue();
83
+ });
84
+
85
+ };
86
+
87
+ $.effects.size = function(o) {
88
+
89
+ return this.queue(function() {
90
+
91
+ // Create element
92
+ var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
93
+ var props1 = ['position','top','left','overflow','opacity']; // Always restore
94
+ var props2 = ['width','height','overflow']; // Copy for children
95
+ var cProps = ['fontSize'];
96
+ var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
97
+ var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
98
+
99
+ // Set options
100
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
101
+ var restore = o.options.restore || false; // Default restore
102
+ var scale = o.options.scale || 'both'; // Default scale mode
103
+ var origin = o.options.origin; // The origin of the sizing
104
+ var original = {height: el.height(), width: el.width()}; // Save original
105
+ el.from = o.options.from || original; // Default from state
106
+ el.to = o.options.to || original; // Default to state
107
+ // Adjust
108
+ if (origin) { // Calculate baseline shifts
109
+ var baseline = $.effects.getBaseline(origin, original);
110
+ el.from.top = (original.height - el.from.height) * baseline.y;
111
+ el.from.left = (original.width - el.from.width) * baseline.x;
112
+ el.to.top = (original.height - el.to.height) * baseline.y;
113
+ el.to.left = (original.width - el.to.width) * baseline.x;
114
+ };
115
+ var factor = { // Set scaling factor
116
+ from: {y: el.from.height / original.height, x: el.from.width / original.width},
117
+ to: {y: el.to.height / original.height, x: el.to.width / original.width}
118
+ };
119
+ if (scale == 'box' || scale == 'both') { // Scale the css box
120
+ if (factor.from.y != factor.to.y) { // Vertical props scaling
121
+ props = props.concat(vProps);
122
+ el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
123
+ el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
124
+ };
125
+ if (factor.from.x != factor.to.x) { // Horizontal props scaling
126
+ props = props.concat(hProps);
127
+ el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
128
+ el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
129
+ };
130
+ };
131
+ if (scale == 'content' || scale == 'both') { // Scale the content
132
+ if (factor.from.y != factor.to.y) { // Vertical props scaling
133
+ props = props.concat(cProps);
134
+ el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
135
+ el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
136
+ };
137
+ };
138
+ $.effects.save(el, restore ? props : props1); el.show(); // Save & Show
139
+ $.effects.createWrapper(el); // Create Wrapper
140
+ el.css('overflow','hidden').css(el.from); // Shift
141
+
142
+ // Animate
143
+ if (scale == 'content' || scale == 'both') { // Scale the children
144
+ vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
145
+ hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
146
+ props2 = props.concat(vProps).concat(hProps); // Concat
147
+ el.find("*[width]").each(function(){
148
+ child = $(this);
149
+ if (restore) $.effects.save(child, props2);
150
+ var c_original = {height: child.height(), width: child.width()}; // Save original
151
+ child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
152
+ child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
153
+ if (factor.from.y != factor.to.y) { // Vertical props scaling
154
+ child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
155
+ child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
156
+ };
157
+ if (factor.from.x != factor.to.x) { // Horizontal props scaling
158
+ child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
159
+ child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
160
+ };
161
+ child.css(child.from); // Shift children
162
+ child.animate(child.to, o.duration, o.options.easing, function(){
163
+ if (restore) $.effects.restore(child, props2); // Restore children
164
+ }); // Animate children
165
+ });
166
+ };
167
+
168
+ // Animate
169
+ el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
170
+ if(mode == 'hide') el.hide(); // Hide
171
+ $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
172
+ if(o.callback) o.callback.apply(this, arguments); // Callback
173
+ el.dequeue();
174
+ }});
175
+
176
+ });
177
+
178
+ };
179
+
180
+ })(jQuery);