motiro 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +280 -0
- data/README +28 -0
- data/README.en +175 -0
- data/README.pt-br +175 -0
- data/Rakefile +10 -0
- data/app/controllers/account_controller.rb +62 -0
- data/app/controllers/application.rb +72 -0
- data/app/controllers/edition_controller.rb +13 -0
- data/app/controllers/javascript_controller.rb +21 -0
- data/app/controllers/report_controller.rb +79 -0
- data/app/controllers/root_controller.rb +7 -0
- data/app/controllers/wiki_controller.rb +102 -0
- data/app/core/cache_reporter.rb +53 -0
- data/app/core/cache_reporter_fetcher.rb +33 -0
- data/app/core/chief_editor.rb +69 -0
- data/app/core/reporter.rb +105 -0
- data/app/core/reporter_driver.rb +36 -0
- data/app/core/reporter_fetcher.rb +39 -0
- data/app/core/settings.rb +43 -0
- data/app/core/version.rb +1 -0
- data/app/core/wiki_page_not_found.rb +33 -0
- data/app/core/wiki_reporter.rb +83 -0
- data/app/helpers/account_helper.rb +2 -0
- data/app/helpers/application_helper.rb +68 -0
- data/app/helpers/default_page_provider.rb +28 -0
- data/app/helpers/report_helper.rb +2 -0
- data/app/helpers/root_helper.rb +2 -0
- data/app/helpers/wiki_helper.rb +3 -0
- data/app/models/change.rb +96 -0
- data/app/models/diff_table_builder.rb +285 -0
- data/app/models/event.rb +18 -0
- data/app/models/headline.rb +109 -0
- data/app/models/page.rb +114 -0
- data/app/models/page_sweeper.rb +26 -0
- data/app/models/user.rb +85 -0
- data/app/ports/chdir_runner.rb +36 -0
- data/app/ports/reporter_loader.rb +9 -0
- data/app/ports/runner.rb +64 -0
- data/app/reporters/darcs_connection.rb +54 -0
- data/app/reporters/darcs_reporter.rb +104 -0
- data/app/reporters/darcs_settings.rb +9 -0
- data/app/reporters/darcs_temp_repo.rb +40 -0
- data/app/reporters/events_reporter.rb +28 -0
- data/app/reporters/features_reporter.rb +24 -0
- data/app/reporters/subversion_reporter.rb +203 -0
- data/app/reporters/svn_connection.rb +62 -0
- data/app/reporters/svn_settings.rb +40 -0
- data/app/views/account/_authorization.rhtml +54 -0
- data/app/views/account/_availability.rhtml +5 -0
- data/app/views/account/availability.rhtml +1 -0
- data/app/views/account/login.rhtml +22 -0
- data/app/views/account/logout.rhtml +10 -0
- data/app/views/javascript/motiro.rjs +132 -0
- data/app/views/javascript/niftycube.rjs +300 -0
- data/app/views/layouts/_bottom.rhtml +5 -0
- data/app/views/layouts/_header.rhtml +7 -0
- data/app/views/layouts/_top.rhtml +25 -0
- data/app/views/layouts/application.rhtml +3 -0
- data/app/views/layouts/scaffold.rhtml +13 -0
- data/app/views/layouts/wiki_edit.rhtml +26 -0
- data/app/views/report/list.rhtml +32 -0
- data/app/views/report/older.rhtml +26 -0
- data/app/views/report/rss.rxml +29 -0
- data/app/views/report/show.rhtml +20 -0
- data/app/views/root/index.rhtml +33 -0
- data/app/views/wiki/_editbar.rhtml +26 -0
- data/app/views/wiki/_properties_edit.rhtml +5 -0
- data/app/views/wiki/_properties_show.rhtml +5 -0
- data/app/views/wiki/edit.rhtml +56 -0
- data/app/views/wiki/properties_edit.rhtml +1 -0
- data/app/views/wiki/show.rhtml +9 -0
- data/bin/motiro +44 -0
- data/config/boot.rb +19 -0
- data/config/database.yml +14 -0
- data/config/environment.rb +64 -0
- data/config/environments/development.rb +20 -0
- data/config/environments/production.rb +19 -0
- data/config/environments/test.rb +19 -0
- data/config/motiro.yml +43 -0
- data/config/routes.rb +79 -0
- data/db/migrate/005_globalize_migration.rb +11363 -0
- data/db/migrate/006_remove_headline_title.rb +14 -0
- data/db/migrate/007_stretch_rid.rb +11 -0
- data/db/migrate/008_add_page_editors.rb +12 -0
- data/db/migrate/009_add_page_original_author.rb +12 -0
- data/db/migrate/010_remove_empty_string_defaults_from_pages.rb +17 -0
- data/db/migrate/011_add_title_and_kind_to_pages.rb +13 -0
- data/db/migrate/012_page_modification_info.rb +13 -0
- data/db/migrate/013_nullify_initial_page_attributes.rb +21 -0
- data/db/migrate/014_events_are_wiki_pages.rb +13 -0
- data/db/migrate/015_migrate_previous_event_data.rb +23 -0
- data/db/migrate/1_initial_structure.rb +36 -0
- data/db/migrate/2_add_authentication.rb +12 -0
- data/db/migrate/3_drop_articles.rb +26 -0
- data/db/migrate/4_add_page_editing.rb +14 -0
- data/db/motirodb.sqlite.initial +0 -0
- data/db/schema_version +1 -0
- data/db/translation/pt-BR.rb +76 -0
- data/doc/README_FOR_APP +2 -0
- data/installer/rails_installer_defaults.yml +5 -0
- data/lib/import_translations.rb +154 -0
- data/lib/login_system.rb +89 -0
- data/lib/relative_time.rb +48 -0
- data/lib/string_extensions.rb +10 -0
- data/lib/stub_hash.rb +22 -0
- data/lib/tasks/packaging.rake +93 -0
- data/lib/tasks/testing.rake +32 -0
- data/lib/tick_daemon.rb +41 -0
- data/lib/translator.rb +67 -0
- data/lib/wiki_renderer.rb +42 -0
- data/lib/wiki_url_generator.rb +29 -0
- data/log/.keepdir +0 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/calendar.png +0 -0
- data/public/images/rss.png +0 -0
- data/public/javascripts/controls.js +750 -0
- data/public/javascripts/dragdrop.js +584 -0
- data/public/javascripts/effects.js +854 -0
- data/public/javascripts/prototype.js +1785 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/motiro.css +269 -0
- data/public/stylesheets/niftyCorners.css +35 -0
- data/public/stylesheets/scaffold.css +74 -0
- data/script/about +3 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/process/spinner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/script/ticker +29 -0
- data/test/acceptance/account_test.rb +186 -0
- data/test/acceptance/darcs_test.rb +62 -0
- data/test/acceptance/events_test.rb +47 -0
- data/test/acceptance/main_page_test.rb +92 -0
- data/test/acceptance/subversion_test.rb +319 -0
- data/test/acceptance/ts_all_suites.rb +27 -0
- data/test/acceptance/wiki_test.rb +202 -0
- data/test/contract/darcs_test.rb +51 -0
- data/test/contract/remote_darcs_test.rb +61 -0
- data/test/contract/svn_test.rb +53 -0
- data/test/fixtures/changes.yml +25 -0
- data/test/fixtures/headlines.yml +45 -0
- data/test/fixtures/pages.yml +98 -0
- data/test/fixtures/users.yml +31 -0
- data/test/functional/account_controller_test.rb +96 -0
- data/test/functional/report_controller_test.rb +113 -0
- data/test/functional/report_features_test.rb +38 -0
- data/test/functional/report_subversion_test.rb +79 -0
- data/test/functional/root_controller_test.rb +127 -0
- data/test/functional/wiki_controller_test.rb +280 -0
- data/test/lib/acceptance_test_case.rb +43 -0
- data/test/lib/configuration.rb +53 -0
- data/test/lib/darcs_excerpts.rb +181 -0
- data/test/lib/darcs_repo.rb +77 -0
- data/test/lib/live_mode_test.rb +51 -0
- data/test/lib/local_svn.rb +157 -0
- data/test/lib/netutils.rb +42 -0
- data/test/lib/platform_thread.rb +62 -0
- data/test/lib/repoutils.rb +23 -0
- data/test/lib/selenium_extensions.rb +32 -0
- data/test/lib/stubio.rb +37 -0
- data/test/lib/svn_excerpts.rb +288 -0
- data/test/lib/test_configuration.rb +14 -0
- data/test/lib/webserver.rb +71 -0
- data/test/meta/configuration_test.rb +72 -0
- data/test/meta/darcs_repo_test.rb +118 -0
- data/test/meta/local_svn_test.rb +125 -0
- data/test/meta/platform_thread_test.rb +46 -0
- data/test/meta/stubio_test.rb +44 -0
- data/test/mocks/headline.rb +34 -0
- data/test/mocks/svn_reporter.rb +29 -0
- data/test/stubs/svn_settings.rb +19 -0
- data/test/stubs/url_generator.rb +24 -0
- data/test/test_helper.rb +36 -0
- data/test/unit/cache_reporter_fetcher_test.rb +46 -0
- data/test/unit/cache_reporter_test.rb +97 -0
- data/test/unit/caching_test.rb +78 -0
- data/test/unit/change_test.rb +152 -0
- data/test/unit/chdir_runner_test.rb +77 -0
- data/test/unit/chief_editor_test.rb +234 -0
- data/test/unit/darcs_connection_test.rb +109 -0
- data/test/unit/darcs_reporter_test.rb +146 -0
- data/test/unit/darcs_settings_test.rb +37 -0
- data/test/unit/darcs_temp_repo_test.rb +51 -0
- data/test/unit/default_page_provider_test.rb +46 -0
- data/test/unit/diff_table_builder_test.rb +602 -0
- data/test/unit/headline_test.rb +259 -0
- data/test/unit/page_test.rb +145 -0
- data/test/unit/relative_time_test.rb +56 -0
- data/test/unit/reporter_driver_test.rb +85 -0
- data/test/unit/reporter_fetcher_test.rb +31 -0
- data/test/unit/reporter_test.rb +81 -0
- data/test/unit/runner_test.rb +93 -0
- data/test/unit/settings_test.rb +55 -0
- data/test/unit/string_extensions_test.rb +10 -0
- data/test/unit/svn_connection_test.rb +183 -0
- data/test/unit/svn_reporter_interaction_test.rb +38 -0
- data/test/unit/svn_reporter_test.rb +286 -0
- data/test/unit/svn_settings_test.rb +86 -0
- data/test/unit/translator_test.rb +96 -0
- data/test/unit/user_test.rb +125 -0
- data/test/unit/wiki_renderer_test.rb +87 -0
- data/test/unit/wiki_reporter_test.rb +94 -0
- data/test/unit/wiki_url_generator_test.rb +31 -0
- data/vendor/motiro-installer.rb +159 -0
- data/vendor/plugins/globalize/LICENSE +9 -0
- data/vendor/plugins/globalize/README +49 -0
- data/vendor/plugins/globalize/data/country_data.csv +240 -0
- data/vendor/plugins/globalize/data/language_data.csv +188 -0
- data/vendor/plugins/globalize/data/translation_data.csv +3421 -0
- data/vendor/plugins/globalize/generators/globalize/USAGE +10 -0
- data/vendor/plugins/globalize/generators/globalize/globalize_generator.rb +42 -0
- data/vendor/plugins/globalize/generators/globalize/templates/migration.rb.gz +0 -0
- data/vendor/plugins/globalize/generators/globalize/templates/tiny_migration.rb.gz +0 -0
- data/vendor/plugins/globalize/init.rb +30 -0
- data/vendor/plugins/globalize/lib/globalize/localization/core_ext.rb +170 -0
- data/vendor/plugins/globalize/lib/globalize/localization/core_ext_hooks.rb +33 -0
- data/vendor/plugins/globalize/lib/globalize/localization/db_translate.rb +494 -0
- data/vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb +152 -0
- data/vendor/plugins/globalize/lib/globalize/localization/locale.rb +173 -0
- data/vendor/plugins/globalize/lib/globalize/localization/rfc_3066.rb +40 -0
- data/vendor/plugins/globalize/lib/globalize/models/country.rb +24 -0
- data/vendor/plugins/globalize/lib/globalize/models/currency.rb +188 -0
- data/vendor/plugins/globalize/lib/globalize/models/language.rb +84 -0
- data/vendor/plugins/globalize/lib/globalize/models/model_translation.rb +4 -0
- data/vendor/plugins/globalize/lib/globalize/models/translation.rb +9 -0
- data/vendor/plugins/globalize/lib/globalize/models/view_translation.rb +14 -0
- data/vendor/plugins/globalize/lib/globalize/rails/action_mailer.rb +125 -0
- data/vendor/plugins/globalize/lib/globalize/rails/action_view.rb +79 -0
- data/vendor/plugins/globalize/lib/globalize/rails/active_record.rb +129 -0
- data/vendor/plugins/globalize/lib/globalize/rails/active_record_helper.rb +33 -0
- data/vendor/plugins/globalize/populators/pop_dates.rb +81 -0
- data/vendor/plugins/globalize/populators/pop_migration.rb +18 -0
- data/vendor/plugins/globalize/populators/pop_pluralization.rb +26 -0
- data/vendor/plugins/globalize/populators/pop_seps.rb +32 -0
- data/vendor/plugins/globalize/tasks/data.rake +130 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en-US.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.he.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test.rb +54 -0
- data/vendor/plugins/globalize/test/config/database.yml.default +16 -0
- data/vendor/plugins/globalize/test/config/database.yml.example +22 -0
- data/vendor/plugins/globalize/test/core_ext_test.rb +61 -0
- data/vendor/plugins/globalize/test/currency_test.rb +141 -0
- data/vendor/plugins/globalize/test/date_helper_test.rb +634 -0
- data/vendor/plugins/globalize/test/db/schema.rb +90 -0
- data/vendor/plugins/globalize/test/db_translation_test.rb +374 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_categories.yml +7 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_categories_products.yml +7 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_countries.yml +41 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_languages.yml +64 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_manufacturers.yml +5 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_products.yml +29 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_simples.yml +5 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_translations.yml +354 -0
- data/vendor/plugins/globalize/test/locale_test.rb +27 -0
- data/vendor/plugins/globalize/test/mime_responds_test.rb +358 -0
- data/vendor/plugins/globalize/test/model_test.rb +17 -0
- data/vendor/plugins/globalize/test/standard_data_test_helper.rb +33 -0
- data/vendor/plugins/globalize/test/test_helper.rb +19 -0
- data/vendor/plugins/globalize/test/test_standard_data.rb +54 -0
- data/vendor/plugins/globalize/test/validation_test.rb +29 -0
- data/vendor/plugins/globalize/test/view_picking_test.rb +49 -0
- data/vendor/plugins/globalize/test/view_translation_test.rb +237 -0
- data/vendor/plugins/globalize/test/views/layouts/standard.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rxml +1 -0
- data/vendor/plugins/globalize/test/views/test.he-IL.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/test.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/test2.he.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/test2.rhtml +1 -0
- data/vendor/plugins/test_xml/MIT-LICENSE +20 -0
- data/vendor/plugins/test_xml/README +20 -0
- data/vendor/plugins/test_xml/Rakefile +22 -0
- data/vendor/plugins/test_xml/init.rb +7 -0
- data/vendor/plugins/test_xml/lib/xml_assertions.rb +22 -0
- data/vendor/plugins/test_xml/test/test_xml_test.rb +40 -0
- metadata +505 -0
@@ -0,0 +1,854 @@
|
|
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
|
+
var 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.setStyle = function(element, style) {
|
45
|
+
element = $(element);
|
46
|
+
for(k in style) element.style[k.camelize()] = style[k];
|
47
|
+
}
|
48
|
+
|
49
|
+
Element.setContentZoom = function(element, percent) {
|
50
|
+
Element.setStyle(element, {fontSize: (percent/100) + 'em'});
|
51
|
+
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
|
52
|
+
}
|
53
|
+
|
54
|
+
Element.getOpacity = function(element){
|
55
|
+
var opacity;
|
56
|
+
if (opacity = Element.getStyle(element, 'opacity'))
|
57
|
+
return parseFloat(opacity);
|
58
|
+
if (opacity = (Element.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))
|
59
|
+
if(opacity[1]) return parseFloat(opacity[1]) / 100;
|
60
|
+
return 1.0;
|
61
|
+
}
|
62
|
+
|
63
|
+
Element.setOpacity = function(element, value){
|
64
|
+
element= $(element);
|
65
|
+
if (value == 1){
|
66
|
+
Element.setStyle(element, { opacity:
|
67
|
+
(/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ?
|
68
|
+
0.999999 : null });
|
69
|
+
if(/MSIE/.test(navigator.userAgent))
|
70
|
+
Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});
|
71
|
+
} else {
|
72
|
+
if(value < 0.00001) value = 0;
|
73
|
+
Element.setStyle(element, {opacity: value});
|
74
|
+
if(/MSIE/.test(navigator.userAgent))
|
75
|
+
Element.setStyle(element,
|
76
|
+
{ filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
|
77
|
+
'alpha(opacity='+value*100+')' });
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
Element.getInlineOpacity = function(element){
|
82
|
+
return $(element).style.opacity || '';
|
83
|
+
}
|
84
|
+
|
85
|
+
Element.childrenWithClassName = function(element, className) {
|
86
|
+
return $A($(element).getElementsByTagName('*')).select(
|
87
|
+
function(c) { return Element.hasClassName(c, className) });
|
88
|
+
}
|
89
|
+
|
90
|
+
Array.prototype.call = function() {
|
91
|
+
var args = arguments;
|
92
|
+
this.each(function(f){ f.apply(this, args) });
|
93
|
+
}
|
94
|
+
|
95
|
+
/*--------------------------------------------------------------------------*/
|
96
|
+
|
97
|
+
var Effect = {
|
98
|
+
tagifyText: function(element) {
|
99
|
+
var tagifyStyle = 'position:relative';
|
100
|
+
if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1';
|
101
|
+
element = $(element);
|
102
|
+
$A(element.childNodes).each( function(child) {
|
103
|
+
if(child.nodeType==3) {
|
104
|
+
child.nodeValue.toArray().each( function(character) {
|
105
|
+
element.insertBefore(
|
106
|
+
Builder.node('span',{style: tagifyStyle},
|
107
|
+
character == ' ' ? String.fromCharCode(160) : character),
|
108
|
+
child);
|
109
|
+
});
|
110
|
+
Element.remove(child);
|
111
|
+
}
|
112
|
+
});
|
113
|
+
},
|
114
|
+
multiple: function(element, effect) {
|
115
|
+
var elements;
|
116
|
+
if(((typeof element == 'object') ||
|
117
|
+
(typeof element == 'function')) &&
|
118
|
+
(element.length))
|
119
|
+
elements = element;
|
120
|
+
else
|
121
|
+
elements = $(element).childNodes;
|
122
|
+
|
123
|
+
var options = Object.extend({
|
124
|
+
speed: 0.1,
|
125
|
+
delay: 0.0
|
126
|
+
}, arguments[2] || {});
|
127
|
+
var masterDelay = options.delay;
|
128
|
+
|
129
|
+
$A(elements).each( function(element, index) {
|
130
|
+
new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
|
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.state == 'running') {
|
262
|
+
if(this.options.transition) pos = this.options.transition(pos);
|
263
|
+
pos *= (this.options.to-this.options.from);
|
264
|
+
pos += this.options.from;
|
265
|
+
this.position = pos;
|
266
|
+
this.event('beforeUpdate');
|
267
|
+
if(this.update) this.update(pos);
|
268
|
+
this.event('afterUpdate');
|
269
|
+
}
|
270
|
+
},
|
271
|
+
cancel: function() {
|
272
|
+
if(!this.options.sync) Effect.Queue.remove(this);
|
273
|
+
this.state = 'finished';
|
274
|
+
},
|
275
|
+
event: function(eventName) {
|
276
|
+
if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
|
277
|
+
if(this.options[eventName]) this.options[eventName](this);
|
278
|
+
},
|
279
|
+
inspect: function() {
|
280
|
+
return '#<Effect:' + $H(this).inspect() + ',options:' + $H(this.options).inspect() + '>';
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
Effect.Parallel = Class.create();
|
285
|
+
Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
|
286
|
+
initialize: function(effects) {
|
287
|
+
this.effects = effects || [];
|
288
|
+
this.start(arguments[1]);
|
289
|
+
},
|
290
|
+
update: function(position) {
|
291
|
+
this.effects.invoke('render', position);
|
292
|
+
},
|
293
|
+
finish: function(position) {
|
294
|
+
this.effects.each( function(effect) {
|
295
|
+
effect.render(1.0);
|
296
|
+
effect.cancel();
|
297
|
+
effect.event('beforeFinish');
|
298
|
+
if(effect.finish) effect.finish(position);
|
299
|
+
effect.event('afterFinish');
|
300
|
+
});
|
301
|
+
}
|
302
|
+
});
|
303
|
+
|
304
|
+
Effect.Opacity = Class.create();
|
305
|
+
Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
|
306
|
+
initialize: function(element) {
|
307
|
+
this.element = $(element);
|
308
|
+
// make this work on IE on elements without 'layout'
|
309
|
+
if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
|
310
|
+
Element.setStyle(this.element, {zoom: 1});
|
311
|
+
var options = Object.extend({
|
312
|
+
from: Element.getOpacity(this.element) || 0.0,
|
313
|
+
to: 1.0
|
314
|
+
}, arguments[1] || {});
|
315
|
+
this.start(options);
|
316
|
+
},
|
317
|
+
update: function(position) {
|
318
|
+
Element.setOpacity(this.element, position);
|
319
|
+
}
|
320
|
+
});
|
321
|
+
|
322
|
+
Effect.MoveBy = Class.create();
|
323
|
+
Object.extend(Object.extend(Effect.MoveBy.prototype, Effect.Base.prototype), {
|
324
|
+
initialize: function(element, toTop, toLeft) {
|
325
|
+
this.element = $(element);
|
326
|
+
this.toTop = toTop;
|
327
|
+
this.toLeft = toLeft;
|
328
|
+
this.start(arguments[3]);
|
329
|
+
},
|
330
|
+
setup: function() {
|
331
|
+
// Bug in Opera: Opera returns the "real" position of a static element or
|
332
|
+
// relative element that does not have top/left explicitly set.
|
333
|
+
// ==> Always set top and left for position relative elements in your stylesheets
|
334
|
+
// (to 0 if you do not need them)
|
335
|
+
Element.makePositioned(this.element);
|
336
|
+
this.originalTop = parseFloat(Element.getStyle(this.element,'top') || '0');
|
337
|
+
this.originalLeft = parseFloat(Element.getStyle(this.element,'left') || '0');
|
338
|
+
},
|
339
|
+
update: function(position) {
|
340
|
+
Element.setStyle(this.element, {
|
341
|
+
top: this.toTop * position + this.originalTop + 'px',
|
342
|
+
left: this.toLeft * position + this.originalLeft + 'px'
|
343
|
+
});
|
344
|
+
}
|
345
|
+
});
|
346
|
+
|
347
|
+
Effect.Scale = Class.create();
|
348
|
+
Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
|
349
|
+
initialize: function(element, percent) {
|
350
|
+
this.element = $(element)
|
351
|
+
var options = Object.extend({
|
352
|
+
scaleX: true,
|
353
|
+
scaleY: true,
|
354
|
+
scaleContent: true,
|
355
|
+
scaleFromCenter: false,
|
356
|
+
scaleMode: 'box', // 'box' or 'contents' or {} with provided values
|
357
|
+
scaleFrom: 100.0,
|
358
|
+
scaleTo: percent
|
359
|
+
}, arguments[2] || {});
|
360
|
+
this.start(options);
|
361
|
+
},
|
362
|
+
setup: function() {
|
363
|
+
this.restoreAfterFinish = this.options.restoreAfterFinish || false;
|
364
|
+
this.elementPositioning = Element.getStyle(this.element,'position');
|
365
|
+
|
366
|
+
this.originalStyle = {};
|
367
|
+
['top','left','width','height','fontSize'].each( function(k) {
|
368
|
+
this.originalStyle[k] = this.element.style[k];
|
369
|
+
}.bind(this));
|
370
|
+
|
371
|
+
this.originalTop = this.element.offsetTop;
|
372
|
+
this.originalLeft = this.element.offsetLeft;
|
373
|
+
|
374
|
+
var fontSize = Element.getStyle(this.element,'font-size') || '100%';
|
375
|
+
['em','px','%'].each( function(fontSizeType) {
|
376
|
+
if(fontSize.indexOf(fontSizeType)>0) {
|
377
|
+
this.fontSize = parseFloat(fontSize);
|
378
|
+
this.fontSizeType = fontSizeType;
|
379
|
+
}
|
380
|
+
}.bind(this));
|
381
|
+
|
382
|
+
this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
|
383
|
+
|
384
|
+
this.dims = null;
|
385
|
+
if(this.options.scaleMode=='box')
|
386
|
+
this.dims = [this.element.offsetHeight, this.element.offsetWidth];
|
387
|
+
if(/^content/.test(this.options.scaleMode))
|
388
|
+
this.dims = [this.element.scrollHeight, this.element.scrollWidth];
|
389
|
+
if(!this.dims)
|
390
|
+
this.dims = [this.options.scaleMode.originalHeight,
|
391
|
+
this.options.scaleMode.originalWidth];
|
392
|
+
},
|
393
|
+
update: function(position) {
|
394
|
+
var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
|
395
|
+
if(this.options.scaleContent && this.fontSize)
|
396
|
+
Element.setStyle(this.element, {fontSize: this.fontSize * currentScale + this.fontSizeType });
|
397
|
+
this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
|
398
|
+
},
|
399
|
+
finish: function(position) {
|
400
|
+
if (this.restoreAfterFinish) Element.setStyle(this.element, this.originalStyle);
|
401
|
+
},
|
402
|
+
setDimensions: function(height, width) {
|
403
|
+
var d = {};
|
404
|
+
if(this.options.scaleX) d.width = width + 'px';
|
405
|
+
if(this.options.scaleY) d.height = height + 'px';
|
406
|
+
if(this.options.scaleFromCenter) {
|
407
|
+
var topd = (height - this.dims[0])/2;
|
408
|
+
var leftd = (width - this.dims[1])/2;
|
409
|
+
if(this.elementPositioning == 'absolute') {
|
410
|
+
if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
|
411
|
+
if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
|
412
|
+
} else {
|
413
|
+
if(this.options.scaleY) d.top = -topd + 'px';
|
414
|
+
if(this.options.scaleX) d.left = -leftd + 'px';
|
415
|
+
}
|
416
|
+
}
|
417
|
+
Element.setStyle(this.element, d);
|
418
|
+
}
|
419
|
+
});
|
420
|
+
|
421
|
+
Effect.Highlight = Class.create();
|
422
|
+
Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
|
423
|
+
initialize: function(element) {
|
424
|
+
this.element = $(element);
|
425
|
+
var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
|
426
|
+
this.start(options);
|
427
|
+
},
|
428
|
+
setup: function() {
|
429
|
+
// Prevent executing on elements not in the layout flow
|
430
|
+
if(Element.getStyle(this.element, 'display')=='none') { this.cancel(); return; }
|
431
|
+
// Disable background image during the effect
|
432
|
+
this.oldStyle = {
|
433
|
+
backgroundImage: Element.getStyle(this.element, 'background-image') };
|
434
|
+
Element.setStyle(this.element, {backgroundImage: 'none'});
|
435
|
+
if(!this.options.endcolor)
|
436
|
+
this.options.endcolor = Element.getStyle(this.element, 'background-color').parseColor('#ffffff');
|
437
|
+
if(!this.options.restorecolor)
|
438
|
+
this.options.restorecolor = Element.getStyle(this.element, 'background-color');
|
439
|
+
// init color calculations
|
440
|
+
this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
|
441
|
+
this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
|
442
|
+
},
|
443
|
+
update: function(position) {
|
444
|
+
Element.setStyle(this.element,{backgroundColor: $R(0,2).inject('#',function(m,v,i){
|
445
|
+
return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
|
446
|
+
},
|
447
|
+
finish: function() {
|
448
|
+
Element.setStyle(this.element, Object.extend(this.oldStyle, {
|
449
|
+
backgroundColor: this.options.restorecolor
|
450
|
+
}));
|
451
|
+
}
|
452
|
+
});
|
453
|
+
|
454
|
+
Effect.ScrollTo = Class.create();
|
455
|
+
Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
|
456
|
+
initialize: function(element) {
|
457
|
+
this.element = $(element);
|
458
|
+
this.start(arguments[1] || {});
|
459
|
+
},
|
460
|
+
setup: function() {
|
461
|
+
Position.prepare();
|
462
|
+
var offsets = Position.cumulativeOffset(this.element);
|
463
|
+
if(this.options.offset) offsets[1] += this.options.offset;
|
464
|
+
var max = window.innerHeight ?
|
465
|
+
window.height - window.innerHeight :
|
466
|
+
document.body.scrollHeight -
|
467
|
+
(document.documentElement.clientHeight ?
|
468
|
+
document.documentElement.clientHeight : document.body.clientHeight);
|
469
|
+
this.scrollStart = Position.deltaY;
|
470
|
+
this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
|
471
|
+
},
|
472
|
+
update: function(position) {
|
473
|
+
Position.prepare();
|
474
|
+
window.scrollTo(Position.deltaX,
|
475
|
+
this.scrollStart + (position*this.delta));
|
476
|
+
}
|
477
|
+
});
|
478
|
+
|
479
|
+
/* ------------- combination effects ------------- */
|
480
|
+
|
481
|
+
Effect.Fade = function(element) {
|
482
|
+
var oldOpacity = Element.getInlineOpacity(element);
|
483
|
+
var options = Object.extend({
|
484
|
+
from: Element.getOpacity(element) || 1.0,
|
485
|
+
to: 0.0,
|
486
|
+
afterFinishInternal: function(effect) { with(Element) {
|
487
|
+
if(effect.options.to!=0) return;
|
488
|
+
hide(effect.element);
|
489
|
+
setStyle(effect.element, {opacity: oldOpacity}); }}
|
490
|
+
}, arguments[1] || {});
|
491
|
+
return new Effect.Opacity(element,options);
|
492
|
+
}
|
493
|
+
|
494
|
+
Effect.Appear = function(element) {
|
495
|
+
var options = Object.extend({
|
496
|
+
from: (Element.getStyle(element, 'display') == 'none' ? 0.0 : Element.getOpacity(element) || 0.0),
|
497
|
+
to: 1.0,
|
498
|
+
beforeSetup: function(effect) { with(Element) {
|
499
|
+
setOpacity(effect.element, effect.options.from);
|
500
|
+
show(effect.element); }}
|
501
|
+
}, arguments[1] || {});
|
502
|
+
return new Effect.Opacity(element,options);
|
503
|
+
}
|
504
|
+
|
505
|
+
Effect.Puff = function(element) {
|
506
|
+
element = $(element);
|
507
|
+
var oldStyle = { opacity: Element.getInlineOpacity(element), position: Element.getStyle(element, 'position') };
|
508
|
+
return new Effect.Parallel(
|
509
|
+
[ new Effect.Scale(element, 200,
|
510
|
+
{ sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
|
511
|
+
new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
|
512
|
+
Object.extend({ duration: 1.0,
|
513
|
+
beforeSetupInternal: function(effect) { with(Element) {
|
514
|
+
setStyle(effect.effects[0].element, {position: 'absolute'}); }},
|
515
|
+
afterFinishInternal: function(effect) { with(Element) {
|
516
|
+
hide(effect.effects[0].element);
|
517
|
+
setStyle(effect.effects[0].element, oldStyle); }}
|
518
|
+
}, arguments[1] || {})
|
519
|
+
);
|
520
|
+
}
|
521
|
+
|
522
|
+
Effect.BlindUp = function(element) {
|
523
|
+
element = $(element);
|
524
|
+
Element.makeClipping(element);
|
525
|
+
return new Effect.Scale(element, 0,
|
526
|
+
Object.extend({ scaleContent: false,
|
527
|
+
scaleX: false,
|
528
|
+
restoreAfterFinish: true,
|
529
|
+
afterFinishInternal: function(effect) { with(Element) {
|
530
|
+
[hide, undoClipping].call(effect.element); }}
|
531
|
+
}, arguments[1] || {})
|
532
|
+
);
|
533
|
+
}
|
534
|
+
|
535
|
+
Effect.BlindDown = function(element) {
|
536
|
+
element = $(element);
|
537
|
+
var oldHeight = Element.getStyle(element, 'height');
|
538
|
+
var elementDimensions = Element.getDimensions(element);
|
539
|
+
return new Effect.Scale(element, 100,
|
540
|
+
Object.extend({ scaleContent: false,
|
541
|
+
scaleX: false,
|
542
|
+
scaleFrom: 0,
|
543
|
+
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
|
544
|
+
restoreAfterFinish: true,
|
545
|
+
afterSetup: function(effect) { with(Element) {
|
546
|
+
makeClipping(effect.element);
|
547
|
+
setStyle(effect.element, {height: '0px'});
|
548
|
+
show(effect.element);
|
549
|
+
}},
|
550
|
+
afterFinishInternal: function(effect) { with(Element) {
|
551
|
+
undoClipping(effect.element);
|
552
|
+
setStyle(effect.element, {height: oldHeight});
|
553
|
+
}}
|
554
|
+
}, arguments[1] || {})
|
555
|
+
);
|
556
|
+
}
|
557
|
+
|
558
|
+
Effect.SwitchOff = function(element) {
|
559
|
+
element = $(element);
|
560
|
+
var oldOpacity = Element.getInlineOpacity(element);
|
561
|
+
return new Effect.Appear(element, {
|
562
|
+
duration: 0.4,
|
563
|
+
from: 0,
|
564
|
+
transition: Effect.Transitions.flicker,
|
565
|
+
afterFinishInternal: function(effect) {
|
566
|
+
new Effect.Scale(effect.element, 1, {
|
567
|
+
duration: 0.3, scaleFromCenter: true,
|
568
|
+
scaleX: false, scaleContent: false, restoreAfterFinish: true,
|
569
|
+
beforeSetup: function(effect) { with(Element) {
|
570
|
+
[makePositioned,makeClipping].call(effect.element);
|
571
|
+
}},
|
572
|
+
afterFinishInternal: function(effect) { with(Element) {
|
573
|
+
[hide,undoClipping,undoPositioned].call(effect.element);
|
574
|
+
setStyle(effect.element, {opacity: oldOpacity});
|
575
|
+
}}
|
576
|
+
})
|
577
|
+
}
|
578
|
+
});
|
579
|
+
}
|
580
|
+
|
581
|
+
Effect.DropOut = function(element) {
|
582
|
+
element = $(element);
|
583
|
+
var oldStyle = {
|
584
|
+
top: Element.getStyle(element, 'top'),
|
585
|
+
left: Element.getStyle(element, 'left'),
|
586
|
+
opacity: Element.getInlineOpacity(element) };
|
587
|
+
return new Effect.Parallel(
|
588
|
+
[ new Effect.MoveBy(element, 100, 0, { sync: true }),
|
589
|
+
new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
|
590
|
+
Object.extend(
|
591
|
+
{ duration: 0.5,
|
592
|
+
beforeSetup: function(effect) { with(Element) {
|
593
|
+
makePositioned(effect.effects[0].element); }},
|
594
|
+
afterFinishInternal: function(effect) { with(Element) {
|
595
|
+
[hide, undoPositioned].call(effect.effects[0].element);
|
596
|
+
setStyle(effect.effects[0].element, oldStyle); }}
|
597
|
+
}, arguments[1] || {}));
|
598
|
+
}
|
599
|
+
|
600
|
+
Effect.Shake = function(element) {
|
601
|
+
element = $(element);
|
602
|
+
var oldStyle = {
|
603
|
+
top: Element.getStyle(element, 'top'),
|
604
|
+
left: Element.getStyle(element, 'left') };
|
605
|
+
return new Effect.MoveBy(element, 0, 20,
|
606
|
+
{ duration: 0.05, afterFinishInternal: function(effect) {
|
607
|
+
new Effect.MoveBy(effect.element, 0, -40,
|
608
|
+
{ duration: 0.1, afterFinishInternal: function(effect) {
|
609
|
+
new Effect.MoveBy(effect.element, 0, 40,
|
610
|
+
{ duration: 0.1, afterFinishInternal: function(effect) {
|
611
|
+
new Effect.MoveBy(effect.element, 0, -40,
|
612
|
+
{ duration: 0.1, afterFinishInternal: function(effect) {
|
613
|
+
new Effect.MoveBy(effect.element, 0, 40,
|
614
|
+
{ duration: 0.1, afterFinishInternal: function(effect) {
|
615
|
+
new Effect.MoveBy(effect.element, 0, -20,
|
616
|
+
{ duration: 0.05, afterFinishInternal: function(effect) { with(Element) {
|
617
|
+
undoPositioned(effect.element);
|
618
|
+
setStyle(effect.element, oldStyle);
|
619
|
+
}}}) }}) }}) }}) }}) }});
|
620
|
+
}
|
621
|
+
|
622
|
+
Effect.SlideDown = function(element) {
|
623
|
+
element = $(element);
|
624
|
+
Element.cleanWhitespace(element);
|
625
|
+
// SlideDown need to have the content of the element wrapped in a container element with fixed height!
|
626
|
+
var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
|
627
|
+
var elementDimensions = Element.getDimensions(element);
|
628
|
+
return new Effect.Scale(element, 100, Object.extend({
|
629
|
+
scaleContent: false,
|
630
|
+
scaleX: false,
|
631
|
+
scaleFrom: 0,
|
632
|
+
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
|
633
|
+
restoreAfterFinish: true,
|
634
|
+
afterSetup: function(effect) { with(Element) {
|
635
|
+
makePositioned(effect.element);
|
636
|
+
makePositioned(effect.element.firstChild);
|
637
|
+
if(window.opera) setStyle(effect.element, {top: ''});
|
638
|
+
makeClipping(effect.element);
|
639
|
+
setStyle(effect.element, {height: '0px'});
|
640
|
+
show(element); }},
|
641
|
+
afterUpdateInternal: function(effect) { with(Element) {
|
642
|
+
setStyle(effect.element.firstChild, {bottom:
|
643
|
+
(effect.dims[0] - effect.element.clientHeight) + 'px' }); }},
|
644
|
+
afterFinishInternal: function(effect) { with(Element) {
|
645
|
+
undoClipping(effect.element);
|
646
|
+
undoPositioned(effect.element.firstChild);
|
647
|
+
undoPositioned(effect.element);
|
648
|
+
setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }}
|
649
|
+
}, arguments[1] || {})
|
650
|
+
);
|
651
|
+
}
|
652
|
+
|
653
|
+
Effect.SlideUp = function(element) {
|
654
|
+
element = $(element);
|
655
|
+
Element.cleanWhitespace(element);
|
656
|
+
var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
|
657
|
+
return new Effect.Scale(element, 0,
|
658
|
+
Object.extend({ scaleContent: false,
|
659
|
+
scaleX: false,
|
660
|
+
scaleMode: 'box',
|
661
|
+
scaleFrom: 100,
|
662
|
+
restoreAfterFinish: true,
|
663
|
+
beforeStartInternal: function(effect) { with(Element) {
|
664
|
+
makePositioned(effect.element);
|
665
|
+
makePositioned(effect.element.firstChild);
|
666
|
+
if(window.opera) setStyle(effect.element, {top: ''});
|
667
|
+
makeClipping(effect.element);
|
668
|
+
show(element); }},
|
669
|
+
afterUpdateInternal: function(effect) { with(Element) {
|
670
|
+
setStyle(effect.element.firstChild, {bottom:
|
671
|
+
(effect.dims[0] - effect.element.clientHeight) + 'px' }); }},
|
672
|
+
afterFinishInternal: function(effect) { with(Element) {
|
673
|
+
[hide, undoClipping].call(effect.element);
|
674
|
+
undoPositioned(effect.element.firstChild);
|
675
|
+
undoPositioned(effect.element);
|
676
|
+
setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }}
|
677
|
+
}, arguments[1] || {})
|
678
|
+
);
|
679
|
+
}
|
680
|
+
|
681
|
+
// Bug in opera makes the TD containing this element expand for a instance after finish
|
682
|
+
Effect.Squish = function(element) {
|
683
|
+
return new Effect.Scale(element, window.opera ? 1 : 0,
|
684
|
+
{ restoreAfterFinish: true,
|
685
|
+
beforeSetup: function(effect) { with(Element) {
|
686
|
+
makeClipping(effect.element); }},
|
687
|
+
afterFinishInternal: function(effect) { with(Element) {
|
688
|
+
hide(effect.element);
|
689
|
+
undoClipping(effect.element); }}
|
690
|
+
});
|
691
|
+
}
|
692
|
+
|
693
|
+
Effect.Grow = function(element) {
|
694
|
+
element = $(element);
|
695
|
+
var options = Object.extend({
|
696
|
+
direction: 'center',
|
697
|
+
moveTransistion: Effect.Transitions.sinoidal,
|
698
|
+
scaleTransition: Effect.Transitions.sinoidal,
|
699
|
+
opacityTransition: Effect.Transitions.full
|
700
|
+
}, arguments[1] || {});
|
701
|
+
var oldStyle = {
|
702
|
+
top: element.style.top,
|
703
|
+
left: element.style.left,
|
704
|
+
height: element.style.height,
|
705
|
+
width: element.style.width,
|
706
|
+
opacity: Element.getInlineOpacity(element) };
|
707
|
+
|
708
|
+
var dims = Element.getDimensions(element);
|
709
|
+
var initialMoveX, initialMoveY;
|
710
|
+
var moveX, moveY;
|
711
|
+
|
712
|
+
switch (options.direction) {
|
713
|
+
case 'top-left':
|
714
|
+
initialMoveX = initialMoveY = moveX = moveY = 0;
|
715
|
+
break;
|
716
|
+
case 'top-right':
|
717
|
+
initialMoveX = dims.width;
|
718
|
+
initialMoveY = moveY = 0;
|
719
|
+
moveX = -dims.width;
|
720
|
+
break;
|
721
|
+
case 'bottom-left':
|
722
|
+
initialMoveX = moveX = 0;
|
723
|
+
initialMoveY = dims.height;
|
724
|
+
moveY = -dims.height;
|
725
|
+
break;
|
726
|
+
case 'bottom-right':
|
727
|
+
initialMoveX = dims.width;
|
728
|
+
initialMoveY = dims.height;
|
729
|
+
moveX = -dims.width;
|
730
|
+
moveY = -dims.height;
|
731
|
+
break;
|
732
|
+
case 'center':
|
733
|
+
initialMoveX = dims.width / 2;
|
734
|
+
initialMoveY = dims.height / 2;
|
735
|
+
moveX = -dims.width / 2;
|
736
|
+
moveY = -dims.height / 2;
|
737
|
+
break;
|
738
|
+
}
|
739
|
+
|
740
|
+
return new Effect.MoveBy(element, initialMoveY, initialMoveX, {
|
741
|
+
duration: 0.01,
|
742
|
+
beforeSetup: function(effect) { with(Element) {
|
743
|
+
hide(effect.element);
|
744
|
+
makeClipping(effect.element);
|
745
|
+
makePositioned(effect.element);
|
746
|
+
}},
|
747
|
+
afterFinishInternal: function(effect) {
|
748
|
+
new Effect.Parallel(
|
749
|
+
[ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
|
750
|
+
new Effect.MoveBy(effect.element, moveY, moveX, { sync: true, transition: options.moveTransition }),
|
751
|
+
new Effect.Scale(effect.element, 100, {
|
752
|
+
scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
|
753
|
+
sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
|
754
|
+
], Object.extend({
|
755
|
+
beforeSetup: function(effect) { with(Element) {
|
756
|
+
setStyle(effect.effects[0].element, {height: '0px'});
|
757
|
+
show(effect.effects[0].element); }},
|
758
|
+
afterFinishInternal: function(effect) { with(Element) {
|
759
|
+
[undoClipping, undoPositioned].call(effect.effects[0].element);
|
760
|
+
setStyle(effect.effects[0].element, oldStyle); }}
|
761
|
+
}, options)
|
762
|
+
)
|
763
|
+
}
|
764
|
+
});
|
765
|
+
}
|
766
|
+
|
767
|
+
Effect.Shrink = function(element) {
|
768
|
+
element = $(element);
|
769
|
+
var options = Object.extend({
|
770
|
+
direction: 'center',
|
771
|
+
moveTransistion: Effect.Transitions.sinoidal,
|
772
|
+
scaleTransition: Effect.Transitions.sinoidal,
|
773
|
+
opacityTransition: Effect.Transitions.none
|
774
|
+
}, arguments[1] || {});
|
775
|
+
var oldStyle = {
|
776
|
+
top: element.style.top,
|
777
|
+
left: element.style.left,
|
778
|
+
height: element.style.height,
|
779
|
+
width: element.style.width,
|
780
|
+
opacity: Element.getInlineOpacity(element) };
|
781
|
+
|
782
|
+
var dims = Element.getDimensions(element);
|
783
|
+
var moveX, moveY;
|
784
|
+
|
785
|
+
switch (options.direction) {
|
786
|
+
case 'top-left':
|
787
|
+
moveX = moveY = 0;
|
788
|
+
break;
|
789
|
+
case 'top-right':
|
790
|
+
moveX = dims.width;
|
791
|
+
moveY = 0;
|
792
|
+
break;
|
793
|
+
case 'bottom-left':
|
794
|
+
moveX = 0;
|
795
|
+
moveY = dims.height;
|
796
|
+
break;
|
797
|
+
case 'bottom-right':
|
798
|
+
moveX = dims.width;
|
799
|
+
moveY = dims.height;
|
800
|
+
break;
|
801
|
+
case 'center':
|
802
|
+
moveX = dims.width / 2;
|
803
|
+
moveY = dims.height / 2;
|
804
|
+
break;
|
805
|
+
}
|
806
|
+
|
807
|
+
return new Effect.Parallel(
|
808
|
+
[ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
|
809
|
+
new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
|
810
|
+
new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: options.moveTransition })
|
811
|
+
], Object.extend({
|
812
|
+
beforeStartInternal: function(effect) { with(Element) {
|
813
|
+
[makePositioned, makeClipping].call(effect.effects[0].element) }},
|
814
|
+
afterFinishInternal: function(effect) { with(Element) {
|
815
|
+
[hide, undoClipping, undoPositioned].call(effect.effects[0].element);
|
816
|
+
setStyle(effect.effects[0].element, oldStyle); }}
|
817
|
+
}, options)
|
818
|
+
);
|
819
|
+
}
|
820
|
+
|
821
|
+
Effect.Pulsate = function(element) {
|
822
|
+
element = $(element);
|
823
|
+
var options = arguments[1] || {};
|
824
|
+
var oldOpacity = Element.getInlineOpacity(element);
|
825
|
+
var transition = options.transition || Effect.Transitions.sinoidal;
|
826
|
+
var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
|
827
|
+
reverser.bind(transition);
|
828
|
+
return new Effect.Opacity(element,
|
829
|
+
Object.extend(Object.extend({ duration: 3.0, from: 0,
|
830
|
+
afterFinishInternal: function(effect) { Element.setStyle(effect.element, {opacity: oldOpacity}); }
|
831
|
+
}, options), {transition: reverser}));
|
832
|
+
}
|
833
|
+
|
834
|
+
Effect.Fold = function(element) {
|
835
|
+
element = $(element);
|
836
|
+
var oldStyle = {
|
837
|
+
top: element.style.top,
|
838
|
+
left: element.style.left,
|
839
|
+
width: element.style.width,
|
840
|
+
height: element.style.height };
|
841
|
+
Element.makeClipping(element);
|
842
|
+
return new Effect.Scale(element, 5, Object.extend({
|
843
|
+
scaleContent: false,
|
844
|
+
scaleX: false,
|
845
|
+
afterFinishInternal: function(effect) {
|
846
|
+
new Effect.Scale(element, 1, {
|
847
|
+
scaleContent: false,
|
848
|
+
scaleY: false,
|
849
|
+
afterFinishInternal: function(effect) { with(Element) {
|
850
|
+
[hide, undoClipping].call(effect.element);
|
851
|
+
setStyle(effect.element, oldStyle);
|
852
|
+
}} });
|
853
|
+
}}, arguments[1] || {}));
|
854
|
+
}
|