uploader 2.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +55 -57
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/app/helpers/uploader_helper.rb +3 -3
- data/app/views/uploads/_swf_javascript.html.erb +9 -6
- data/app/views/uploads/_swf_upload.html.erb +2 -2
- data/app/views/uploads/_uploadify.html.erb +3 -3
- data/{locales → config/locales}/ar.yml +0 -0
- data/{locales → config/locales}/bg.yml +0 -0
- data/{locales → config/locales}/ca.yml +0 -0
- data/{locales → config/locales}/cs.yml +0 -0
- data/{locales → config/locales}/da.yml +0 -0
- data/{locales → config/locales}/de.yml +0 -0
- data/{locales → config/locales}/el.yml +0 -0
- data/{locales → config/locales}/en.yml +0 -0
- data/{locales → config/locales}/es.yml +0 -0
- data/{locales → config/locales}/et.yml +0 -0
- data/{locales → config/locales}/fa.yml +2 -2
- data/{locales → config/locales}/fi.yml +0 -0
- data/{locales → config/locales}/fr.yml +0 -0
- data/{locales → config/locales}/gl.yml +0 -0
- data/{locales → config/locales}/hi.yml +1 -1
- data/{locales → config/locales}/hr.yml +0 -0
- data/{locales → config/locales}/hu.yml +0 -0
- data/{locales → config/locales}/id.yml +1 -1
- data/{locales → config/locales}/it.yml +0 -0
- data/{locales → config/locales}/iw.yml +0 -0
- data/{locales → config/locales}/ja.yml +0 -0
- data/{locales → config/locales}/ko.yml +2 -2
- data/{locales → config/locales}/lt.yml +0 -0
- data/{locales → config/locales}/lv.yml +0 -0
- data/{locales → config/locales}/mt.yml +0 -0
- data/{locales → config/locales}/nl.yml +0 -0
- data/{locales → config/locales}/no.yml +0 -0
- data/{locales → config/locales}/pl.yml +0 -0
- data/{locales → config/locales}/pt-PT.yml +0 -0
- data/{locales → config/locales}/ro.yml +0 -0
- data/{locales → config/locales}/ru.yml +0 -0
- data/{locales → config/locales}/sk.yml +0 -0
- data/{locales → config/locales}/sl.yml +0 -0
- data/{locales → config/locales}/sq.yml +0 -0
- data/{locales → config/locales}/sr.yml +0 -0
- data/{locales → config/locales}/sv.yml +0 -0
- data/{locales → config/locales}/th.yml +1 -1
- data/{locales → config/locales}/tl.yml +0 -0
- data/{locales → config/locales}/tr.yml +0 -0
- data/{locales → config/locales}/uk.yml +0 -0
- data/{locales → config/locales}/vi.yml +2 -2
- data/{locales → config/locales}/zh-CN.yml +0 -0
- data/{locales → config/locales}/zh-TW.yml +0 -0
- data/{locales → config/locales}/zh.yml +0 -0
- data/config/routes.rb +8 -0
- data/lib/tasks/uploader.rake +22 -0
- data/lib/uploader/config.rb +65 -0
- data/lib/uploader/engine.rb +19 -0
- data/lib/uploader/models/upload.rb +229 -0
- data/lib/uploader.rb +4 -2
- data/test/{rails_root → rails_test}/.gitignore +0 -0
- data/test/{rails_root → rails_test}/.rake_tasks +0 -0
- data/test/rails_test/Gemfile +21 -0
- data/{Gemfile.lock → test/rails_test/Gemfile.lock} +21 -1
- data/test/rails_test/README +256 -0
- data/test/{rails_root → rails_test}/Rakefile +2 -7
- data/test/{rails_root → rails_test}/app/controllers/application_controller.rb +0 -0
- data/test/rails_test/app/controllers/default_controller.rb +18 -0
- data/test/{rails_root → rails_test}/app/controllers/uploads_controller.rb +5 -2
- data/test/{rails_root → rails_test}/app/models/.keep +0 -0
- data/test/rails_test/app/models/upload.rb +38 -0
- data/test/{rails_root → rails_test}/app/models/user.rb +0 -0
- data/test/{rails_root → rails_test}/app/views/default/index.html.erb +11 -1
- data/test/rails_test/app/views/default/uploadify.html.erb +27 -0
- data/test/{rails_root → rails_test}/app/views/layouts/application.html.erb +2 -2
- data/test/{rails_root → rails_test}/config/amazon_s3.yml +0 -0
- data/test/{rails_root → rails_test}/config/application.rb +6 -12
- data/test/rails_test/config/boot.rb +13 -0
- data/test/{rails_root → rails_test}/config/database.yml +3 -11
- data/test/rails_test/config/environment.rb +5 -0
- data/test/rails_test/config/environments/development.rb +26 -0
- data/test/rails_test/config/environments/production.rb +49 -0
- data/test/rails_test/config/environments/test.rb +35 -0
- data/test/{rails_root → rails_test}/config/global_config.yml +0 -0
- data/test/{rails_root → rails_test}/config/initializers/backtrace_silencers.rb +0 -0
- data/test/{rails_root → rails_test}/config/initializers/inflections.rb +2 -2
- data/test/{rails_root → rails_test}/config/initializers/mime_types.rb +0 -0
- data/test/{rails_root → rails_test}/config/initializers/s3_credentials.rb +1 -1
- data/test/{rails_root → rails_test}/config/initializers/secret_token.rb +1 -1
- data/test/rails_test/config/initializers/session_store.rb +8 -0
- data/test/rails_test/config/locales/en.yml +5 -0
- data/test/rails_test/config/routes.rb +13 -0
- data/test/rails_test/config.ru +4 -0
- data/test/{rails_root → rails_test}/db/.keep +0 -0
- data/test/{rails_root → rails_test}/db/migrate/20090517040220_create_uploads.rb +0 -0
- data/test/{rails_root → rails_test}/db/migrate/20090602041838_create_users.rb +0 -0
- data/test/rails_test/db/seeds.rb +7 -0
- data/test/rails_test/doc/README_FOR_APP +2 -0
- data/test/{rails_root → rails_test}/features/step_definitions/webrat_steps.rb +0 -0
- data/test/{rails_root → rails_test}/features/support/env.rb +0 -0
- data/test/{rails_root → rails_test}/lib/daemons/amazonaws.rb +0 -0
- data/test/{rails_root/public/favicon.ico → rails_test/lib/tasks/.gitkeep} +0 -0
- data/test/rails_test/public/404.html +26 -0
- data/test/rails_test/public/422.html +26 -0
- data/test/rails_test/public/500.html +26 -0
- data/test/{rails_root/public/stylesheets/.keep → rails_test/public/favicon.ico} +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/excel.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file.png +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_aac.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_ai.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_avi.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_bin.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_bmp.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_cue.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_divx.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_doc.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_eps.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_flac.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_flv.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_gif.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_html.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_ical.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_indd.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_inx.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_iso.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_jpg.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_mov.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_mp3.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_mpg.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_pdf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_php.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_png.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_pps.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_ppt.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_psd.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_qxd.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_qxp.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_raw.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_rtf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_svg.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_tif.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_txt.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_vcf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_wav.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_wma.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_xls.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_xml.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/mp3.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/pdf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/pdf.png +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/text.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/text.png +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/word.gif +0 -0
- data/test/rails_test/public/images/rails.png +0 -0
- data/test/{rails_root/public/images → rails_test/public/images/swfupload}/SWFUploadButton.png +0 -0
- data/test/{rails_root/public/images → rails_test/public/images/swfupload}/cancelbutton.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/uploadify/cancel.png +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/application.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/controls.js +75 -73
- data/test/{rails_root → rails_test}/public/javascripts/dragdrop.js +171 -169
- data/test/{rails_root → rails_test}/public/javascripts/effects.js +180 -177
- data/test/{rails_root/public/javascripts/jquery/jquery.js → rails_test/public/javascripts/jquery/jquery-1.4.2.min.js} +0 -0
- data/test/{rails_root/public/javascripts/jquery/jquery-ui.js → rails_test/public/javascripts/jquery/jquery-ui-1.8.4.custom.min.js} +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/jquery/jquery.uploadify.min.js +0 -0
- data/test/rails_test/public/javascripts/prototype.js +6001 -0
- data/test/rails_test/public/javascripts/rails.js +175 -0
- data/test/{rails_root → rails_test}/public/javascripts/swf/swfobject.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/fileprogress.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/handlers.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.cookies.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.proxy.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.queue.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.speed.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.swfobject.js +0 -0
- data/test/rails_test/public/robots.txt +5 -0
- data/test/{rails_root/test/functional/.keep → rails_test/public/stylesheets/.gitkeep} +0 -0
- data/test/{rails_root → rails_test}/public/stylesheets/swfupload.css +0 -0
- data/test/{rails_root → rails_test}/public/stylesheets/uploadify.css +0 -0
- data/test/{rails_root → rails_test}/public/swf/expressInstall.swf +0 -0
- data/test/{rails_root → rails_test}/public/swf/swfupload.swf +0 -0
- data/test/{rails_root → rails_test}/public/swf/swfupload_fp9.swf +0 -0
- data/test/{rails_root → rails_test}/public/swf/uploadify.swf +0 -0
- data/test/rails_test/script/rails +6 -0
- data/test/{rails_root → rails_test}/test/factories.rb +1 -1
- data/test/{rails_root → rails_test}/test/fixtures/files/5k.png +0 -0
- data/test/{rails_root → rails_test}/test/fixtures/files/IT'sUPPERCASE!AND WeIRD.JPG +0 -0
- data/test/rails_test/test/fixtures/rails.png +0 -0
- data/test/{rails_root/test → rails_test/test/fixtures}/test.doc +0 -0
- data/test/{rails_root/test → rails_test/test/fixtures}/test.pdf +0 -0
- data/test/rails_test/test/fixtures/test.txt +1 -0
- data/test/{rails_root/test → rails_test/test/fixtures}/test.xls +0 -0
- data/test/{rails_root/test/integration → rails_test/test/functional}/.keep +0 -0
- data/test/{rails_root → rails_test}/test/functional/default_controller_test.rb +0 -0
- data/test/{rails_root → rails_test}/test/functional/uploads_controller_test.rb +0 -0
- data/test/{rails_root/test/mocks/development → rails_test/test/integration}/.keep +0 -0
- data/test/rails_test/test/performance/browsing_test.rb +9 -0
- data/test/{rails_root → rails_test}/test/shoulda_macros/paperclip.rb +0 -0
- data/test/rails_test/test/test_helper.rb +25 -0
- data/test/{rails_root/test/mocks/test → rails_test/test/unit}/.keep +0 -0
- data/test/{rails_root → rails_test}/test/unit/upload_test.rb +9 -18
- data/test/{rails_root/test/unit/.keep → rails_test/vendor/plugins/.gitkeep} +0 -0
- data/uploader.gemspec +225 -255
- metadata +228 -258
- data/Gemfile +0 -13
- data/config/uploader_routes.rb +0 -3
- data/lib/active_record/acts/uploader_upload.rb +0 -279
- data/lib/uploader/initialize_routes.rb +0 -8
- data/lib/uploader/tasks.rb +0 -42
- data/rails/init.rb +0 -38
- data/tasks/rails.rake +0 -2
- data/test/rails_root/Capfile +0 -3
- data/test/rails_root/app/controllers/default_controller.rb +0 -12
- data/test/rails_root/app/models/upload.rb +0 -55
- data/test/rails_root/app/views/default/uploadify.html.erb +0 -17
- data/test/rails_root/config/boot.rb +0 -109
- data/test/rails_root/config/environment.rb +0 -29
- data/test/rails_root/config/environments/development.rb +0 -19
- data/test/rails_root/config/environments/production.rb +0 -1
- data/test/rails_root/config/environments/test.rb +0 -27
- data/test/rails_root/config/initializers/requires.rb +0 -13
- data/test/rails_root/config/initializers/session_store.rb +0 -8
- data/test/rails_root/config/initializers/uploader.rb +0 -11
- data/test/rails_root/config/routes.rb +0 -13
- data/test/rails_root/db/development.sqlite3 +0 -0
- data/test/rails_root/db/schema.rb +0 -47
- data/test/rails_root/db/test.sqlite3 +0 -0
- data/test/rails_root/public/.htaccess +0 -40
- data/test/rails_root/public/404.html +0 -30
- data/test/rails_root/public/422.html +0 -30
- data/test/rails_root/public/500.html +0 -30
- data/test/rails_root/public/dispatch.rb +0 -10
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/images/swfupload/SWFUploadButton.png +0 -0
- data/test/rails_root/public/images/swfupload/cancelbutton.gif +0 -0
- data/test/rails_root/public/javascripts/builder.js +0 -136
- data/test/rails_root/public/javascripts/jquery/jquery.easing.js +0 -1
- data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +0 -9
- data/test/rails_root/public/javascripts/jquery/jquery.form.js +0 -637
- data/test/rails_root/public/javascripts/jquery/jquery.jgrowl.js +0 -2
- data/test/rails_root/public/javascripts/jquery/jquery.tips.js +0 -69
- data/test/rails_root/public/javascripts/jquery/jrails.js +0 -1
- data/test/rails_root/public/javascripts/prototype.js +0 -4225
- data/test/rails_root/public/javascripts/scriptaculous.js +0 -58
- data/test/rails_root/public/javascripts/slider.js +0 -277
- data/test/rails_root/public/javascripts/sound.js +0 -60
- data/test/rails_root/public/robots.txt +0 -1
- data/test/rails_root/script/about +0 -3
- data/test/rails_root/script/breakpointer +0 -3
- data/test/rails_root/script/console +0 -3
- data/test/rails_root/script/create_project.rb +0 -52
- data/test/rails_root/script/cucumber +0 -7
- data/test/rails_root/script/dbconsole +0 -3
- data/test/rails_root/script/destroy +0 -3
- data/test/rails_root/script/generate +0 -3
- data/test/rails_root/script/performance/benchmarker +0 -3
- data/test/rails_root/script/performance/profiler +0 -3
- data/test/rails_root/script/performance/request +0 -3
- data/test/rails_root/script/plugin +0 -3
- data/test/rails_root/script/process/inspector +0 -3
- data/test/rails_root/script/process/reaper +0 -3
- data/test/rails_root/script/process/spawner +0 -3
- data/test/rails_root/script/runner +0 -3
- data/test/rails_root/script/server +0 -3
- data/test/rails_root/test/test_helper.rb +0 -26
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
//
|
|
1
|
+
// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
|
2
|
+
|
|
3
|
+
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
|
2
4
|
// Contributors:
|
|
3
5
|
// Justin Palmer (http://encytemedia.com/)
|
|
4
6
|
// Mark Pilgrim (http://diveintomark.org/)
|
|
5
7
|
// Martin Bialasinki
|
|
6
|
-
//
|
|
8
|
+
//
|
|
7
9
|
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
|
8
|
-
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
|
10
|
+
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
|
9
11
|
|
|
10
|
-
// converts rgb() and #xxx to #xxxxxx format,
|
|
11
|
-
// returns self (or first argument) if not convertable
|
|
12
|
-
String.prototype.parseColor = function() {
|
|
12
|
+
// converts rgb() and #xxx to #xxxxxx format,
|
|
13
|
+
// returns self (or first argument) if not convertable
|
|
14
|
+
String.prototype.parseColor = function() {
|
|
13
15
|
var color = '#';
|
|
14
|
-
if (this.slice(0,4) == 'rgb(') {
|
|
15
|
-
var cols = this.slice(4,this.length-1).split(',');
|
|
16
|
-
var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
|
|
17
|
-
} else {
|
|
18
|
-
if (this.slice(0,1) == '#') {
|
|
19
|
-
if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
|
|
20
|
-
if (this.length==7) color = this.toLowerCase();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return (color.length==7 ? color : (arguments[0] || this));
|
|
16
|
+
if (this.slice(0,4) == 'rgb(') {
|
|
17
|
+
var cols = this.slice(4,this.length-1).split(',');
|
|
18
|
+
var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
|
|
19
|
+
} else {
|
|
20
|
+
if (this.slice(0,1) == '#') {
|
|
21
|
+
if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
|
|
22
|
+
if (this.length==7) color = this.toLowerCase();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return (color.length==7 ? color : (arguments[0] || this));
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
/*--------------------------------------------------------------------------*/
|
|
27
29
|
|
|
28
|
-
Element.collectTextNodes = function(element) {
|
|
30
|
+
Element.collectTextNodes = function(element) {
|
|
29
31
|
return $A($(element).childNodes).collect( function(node) {
|
|
30
|
-
return (node.nodeType==3 ? node.nodeValue :
|
|
32
|
+
return (node.nodeType==3 ? node.nodeValue :
|
|
31
33
|
(node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
|
|
32
34
|
}).flatten().join('');
|
|
33
35
|
};
|
|
34
36
|
|
|
35
|
-
Element.collectTextNodesIgnoreClass = function(element, className) {
|
|
37
|
+
Element.collectTextNodesIgnoreClass = function(element, className) {
|
|
36
38
|
return $A($(element).childNodes).collect( function(node) {
|
|
37
|
-
return (node.nodeType==3 ? node.nodeValue :
|
|
38
|
-
((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
|
|
39
|
+
return (node.nodeType==3 ? node.nodeValue :
|
|
40
|
+
((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
|
|
39
41
|
Element.collectTextNodesIgnoreClass(node, className) : ''));
|
|
40
42
|
}).flatten().join('');
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
Element.setContentZoom = function(element, percent) {
|
|
44
|
-
element = $(element);
|
|
45
|
-
element.setStyle({fontSize: (percent/100) + 'em'});
|
|
46
|
+
element = $(element);
|
|
47
|
+
element.setStyle({fontSize: (percent/100) + 'em'});
|
|
46
48
|
if (Prototype.Browser.WebKit) window.scrollBy(0,0);
|
|
47
49
|
return element;
|
|
48
50
|
};
|
|
@@ -70,28 +72,23 @@ var Effect = {
|
|
|
70
72
|
Transitions: {
|
|
71
73
|
linear: Prototype.K,
|
|
72
74
|
sinoidal: function(pos) {
|
|
73
|
-
return (-Math.cos(pos*Math.PI)/2) +
|
|
75
|
+
return (-Math.cos(pos*Math.PI)/2) + .5;
|
|
74
76
|
},
|
|
75
77
|
reverse: function(pos) {
|
|
76
78
|
return 1-pos;
|
|
77
79
|
},
|
|
78
80
|
flicker: function(pos) {
|
|
79
|
-
var pos = ((-Math.cos(pos*Math.PI)/4) +
|
|
81
|
+
var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
|
|
80
82
|
return pos > 1 ? 1 : pos;
|
|
81
83
|
},
|
|
82
84
|
wobble: function(pos) {
|
|
83
|
-
return (-Math.cos(pos*Math.PI*(9*pos))/2) +
|
|
85
|
+
return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
|
|
84
86
|
},
|
|
85
|
-
pulse: function(pos, pulses) {
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
((pos % (1/pulses)) * pulses).round() == 0 ?
|
|
89
|
-
((pos * pulses * 2) - (pos * pulses * 2).floor()) :
|
|
90
|
-
1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
|
|
91
|
-
);
|
|
87
|
+
pulse: function(pos, pulses) {
|
|
88
|
+
return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
|
|
92
89
|
},
|
|
93
|
-
spring: function(pos) {
|
|
94
|
-
return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
|
|
90
|
+
spring: function(pos) {
|
|
91
|
+
return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
|
|
95
92
|
},
|
|
96
93
|
none: function(pos) {
|
|
97
94
|
return 0;
|
|
@@ -112,14 +109,14 @@ var Effect = {
|
|
|
112
109
|
tagifyText: function(element) {
|
|
113
110
|
var tagifyStyle = 'position:relative';
|
|
114
111
|
if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
|
|
115
|
-
|
|
112
|
+
|
|
116
113
|
element = $(element);
|
|
117
114
|
$A(element.childNodes).each( function(child) {
|
|
118
115
|
if (child.nodeType==3) {
|
|
119
116
|
child.nodeValue.toArray().each( function(character) {
|
|
120
117
|
element.insertBefore(
|
|
121
118
|
new Element('span', {style: tagifyStyle}).update(
|
|
122
|
-
character == ' ' ? String.fromCharCode(160) : character),
|
|
119
|
+
character == ' ' ? String.fromCharCode(160) : character),
|
|
123
120
|
child);
|
|
124
121
|
});
|
|
125
122
|
Element.remove(child);
|
|
@@ -128,13 +125,13 @@ var Effect = {
|
|
|
128
125
|
},
|
|
129
126
|
multiple: function(element, effect) {
|
|
130
127
|
var elements;
|
|
131
|
-
if (((typeof element == 'object') ||
|
|
132
|
-
Object.isFunction(element)) &&
|
|
128
|
+
if (((typeof element == 'object') ||
|
|
129
|
+
Object.isFunction(element)) &&
|
|
133
130
|
(element.length))
|
|
134
131
|
elements = element;
|
|
135
132
|
else
|
|
136
133
|
elements = $(element).childNodes;
|
|
137
|
-
|
|
134
|
+
|
|
138
135
|
var options = Object.extend({
|
|
139
136
|
speed: 0.1,
|
|
140
137
|
delay: 0.0
|
|
@@ -150,14 +147,13 @@ var Effect = {
|
|
|
150
147
|
'blind': ['BlindDown','BlindUp'],
|
|
151
148
|
'appear': ['Appear','Fade']
|
|
152
149
|
},
|
|
153
|
-
toggle: function(element, effect) {
|
|
150
|
+
toggle: function(element, effect, options) {
|
|
154
151
|
element = $(element);
|
|
155
|
-
effect
|
|
156
|
-
|
|
152
|
+
effect = (effect || 'appear').toLowerCase();
|
|
153
|
+
|
|
154
|
+
return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
|
|
157
155
|
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
|
|
158
|
-
},
|
|
159
|
-
Effect[element.visible() ?
|
|
160
|
-
Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
|
|
156
|
+
}, options || {}));
|
|
161
157
|
}
|
|
162
158
|
};
|
|
163
159
|
|
|
@@ -168,20 +164,20 @@ Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
|
|
|
168
164
|
Effect.ScopedQueue = Class.create(Enumerable, {
|
|
169
165
|
initialize: function() {
|
|
170
166
|
this.effects = [];
|
|
171
|
-
this.interval = null;
|
|
167
|
+
this.interval = null;
|
|
172
168
|
},
|
|
173
169
|
_each: function(iterator) {
|
|
174
170
|
this.effects._each(iterator);
|
|
175
171
|
},
|
|
176
172
|
add: function(effect) {
|
|
177
173
|
var timestamp = new Date().getTime();
|
|
178
|
-
|
|
179
|
-
var position = Object.isString(effect.options.queue) ?
|
|
174
|
+
|
|
175
|
+
var position = Object.isString(effect.options.queue) ?
|
|
180
176
|
effect.options.queue : effect.options.queue.position;
|
|
181
|
-
|
|
177
|
+
|
|
182
178
|
switch(position) {
|
|
183
179
|
case 'front':
|
|
184
|
-
// move unstarted effects after this effect
|
|
180
|
+
// move unstarted effects after this effect
|
|
185
181
|
this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
|
|
186
182
|
e.startOn += effect.finishOn;
|
|
187
183
|
e.finishOn += effect.finishOn;
|
|
@@ -195,13 +191,13 @@ Effect.ScopedQueue = Class.create(Enumerable, {
|
|
|
195
191
|
timestamp = this.effects.pluck('finishOn').max() || timestamp;
|
|
196
192
|
break;
|
|
197
193
|
}
|
|
198
|
-
|
|
194
|
+
|
|
199
195
|
effect.startOn += timestamp;
|
|
200
196
|
effect.finishOn += timestamp;
|
|
201
197
|
|
|
202
198
|
if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
|
|
203
199
|
this.effects.push(effect);
|
|
204
|
-
|
|
200
|
+
|
|
205
201
|
if (!this.interval)
|
|
206
202
|
this.interval = setInterval(this.loop.bind(this), 15);
|
|
207
203
|
},
|
|
@@ -214,7 +210,7 @@ Effect.ScopedQueue = Class.create(Enumerable, {
|
|
|
214
210
|
},
|
|
215
211
|
loop: function() {
|
|
216
212
|
var timePos = new Date().getTime();
|
|
217
|
-
for(var i=0, len=this.effects.length;i<len;i++)
|
|
213
|
+
for(var i=0, len=this.effects.length;i<len;i++)
|
|
218
214
|
this.effects[i] && this.effects[i].loop(timePos);
|
|
219
215
|
}
|
|
220
216
|
});
|
|
@@ -223,7 +219,7 @@ Effect.Queues = {
|
|
|
223
219
|
instances: $H(),
|
|
224
220
|
get: function(queueName) {
|
|
225
221
|
if (!Object.isString(queueName)) return queueName;
|
|
226
|
-
|
|
222
|
+
|
|
227
223
|
return this.instances.get(queueName) ||
|
|
228
224
|
this.instances.set(queueName, new Effect.ScopedQueue());
|
|
229
225
|
}
|
|
@@ -233,12 +229,6 @@ Effect.Queue = Effect.Queues.get('global');
|
|
|
233
229
|
Effect.Base = Class.create({
|
|
234
230
|
position: null,
|
|
235
231
|
start: function(options) {
|
|
236
|
-
function codeForEvent(options,eventName){
|
|
237
|
-
return (
|
|
238
|
-
(options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
|
|
239
|
-
(options[eventName] ? 'this.options.'+eventName+'(this);' : '')
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
232
|
if (options && options.transition === false) options.transition = Effect.Transitions.linear;
|
|
243
233
|
this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
|
|
244
234
|
this.currentFrame = 0;
|
|
@@ -248,23 +238,35 @@ Effect.Base = Class.create({
|
|
|
248
238
|
this.fromToDelta = this.options.to-this.options.from;
|
|
249
239
|
this.totalTime = this.finishOn-this.startOn;
|
|
250
240
|
this.totalFrames = this.options.fps*this.options.duration;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
241
|
+
|
|
242
|
+
this.render = (function() {
|
|
243
|
+
function dispatch(effect, eventName) {
|
|
244
|
+
if (effect.options[eventName + 'Internal'])
|
|
245
|
+
effect.options[eventName + 'Internal'](effect);
|
|
246
|
+
if (effect.options[eventName])
|
|
247
|
+
effect.options[eventName](effect);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return function(pos) {
|
|
251
|
+
if (this.state === "idle") {
|
|
252
|
+
this.state = "running";
|
|
253
|
+
dispatch(this, 'beforeSetup');
|
|
254
|
+
if (this.setup) this.setup();
|
|
255
|
+
dispatch(this, 'afterSetup');
|
|
256
|
+
}
|
|
257
|
+
if (this.state === "running") {
|
|
258
|
+
pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
|
|
259
|
+
this.position = pos;
|
|
260
|
+
dispatch(this, 'beforeUpdate');
|
|
261
|
+
if (this.update) this.update(pos);
|
|
262
|
+
dispatch(this, 'afterUpdate');
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
})();
|
|
266
|
+
|
|
265
267
|
this.event('beforeStart');
|
|
266
268
|
if (!this.options.sync)
|
|
267
|
-
Effect.Queues.get(Object.isString(this.options.queue) ?
|
|
269
|
+
Effect.Queues.get(Object.isString(this.options.queue) ?
|
|
268
270
|
'global' : this.options.queue.scope).add(this);
|
|
269
271
|
},
|
|
270
272
|
loop: function(timePos) {
|
|
@@ -273,9 +275,9 @@ Effect.Base = Class.create({
|
|
|
273
275
|
this.render(1.0);
|
|
274
276
|
this.cancel();
|
|
275
277
|
this.event('beforeFinish');
|
|
276
|
-
if (this.finish) this.finish();
|
|
278
|
+
if (this.finish) this.finish();
|
|
277
279
|
this.event('afterFinish');
|
|
278
|
-
return;
|
|
280
|
+
return;
|
|
279
281
|
}
|
|
280
282
|
var pos = (timePos - this.startOn) / this.totalTime,
|
|
281
283
|
frame = (pos * this.totalFrames).round();
|
|
@@ -287,7 +289,7 @@ Effect.Base = Class.create({
|
|
|
287
289
|
},
|
|
288
290
|
cancel: function() {
|
|
289
291
|
if (!this.options.sync)
|
|
290
|
-
Effect.Queues.get(Object.isString(this.options.queue) ?
|
|
292
|
+
Effect.Queues.get(Object.isString(this.options.queue) ?
|
|
291
293
|
'global' : this.options.queue.scope).remove(this);
|
|
292
294
|
this.state = 'finished';
|
|
293
295
|
},
|
|
@@ -325,10 +327,10 @@ Effect.Parallel = Class.create(Effect.Base, {
|
|
|
325
327
|
Effect.Tween = Class.create(Effect.Base, {
|
|
326
328
|
initialize: function(object, from, to) {
|
|
327
329
|
object = Object.isString(object) ? $(object) : object;
|
|
328
|
-
var args = $A(arguments), method = args.last(),
|
|
330
|
+
var args = $A(arguments), method = args.last(),
|
|
329
331
|
options = args.length == 5 ? args[3] : null;
|
|
330
332
|
this.method = Object.isFunction(method) ? method.bind(object) :
|
|
331
|
-
Object.isFunction(object[method]) ? object[method].bind(object) :
|
|
333
|
+
Object.isFunction(object[method]) ? object[method].bind(object) :
|
|
332
334
|
function(value) { object[method] = value };
|
|
333
335
|
this.start(Object.extend({ from: from, to: to }, options || { }));
|
|
334
336
|
},
|
|
@@ -392,7 +394,7 @@ Effect.Move = Class.create(Effect.Base, {
|
|
|
392
394
|
|
|
393
395
|
// for backwards compatibility
|
|
394
396
|
Effect.MoveBy = function(element, toTop, toLeft) {
|
|
395
|
-
return new Effect.Move(element,
|
|
397
|
+
return new Effect.Move(element,
|
|
396
398
|
Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
|
|
397
399
|
};
|
|
398
400
|
|
|
@@ -414,15 +416,15 @@ Effect.Scale = Class.create(Effect.Base, {
|
|
|
414
416
|
setup: function() {
|
|
415
417
|
this.restoreAfterFinish = this.options.restoreAfterFinish || false;
|
|
416
418
|
this.elementPositioning = this.element.getStyle('position');
|
|
417
|
-
|
|
419
|
+
|
|
418
420
|
this.originalStyle = { };
|
|
419
421
|
['top','left','width','height','fontSize'].each( function(k) {
|
|
420
422
|
this.originalStyle[k] = this.element.style[k];
|
|
421
423
|
}.bind(this));
|
|
422
|
-
|
|
424
|
+
|
|
423
425
|
this.originalTop = this.element.offsetTop;
|
|
424
426
|
this.originalLeft = this.element.offsetLeft;
|
|
425
|
-
|
|
427
|
+
|
|
426
428
|
var fontSize = this.element.getStyle('font-size') || '100%';
|
|
427
429
|
['em','px','%','pt'].each( function(fontSizeType) {
|
|
428
430
|
if (fontSize.indexOf(fontSizeType)>0) {
|
|
@@ -430,9 +432,9 @@ Effect.Scale = Class.create(Effect.Base, {
|
|
|
430
432
|
this.fontSizeType = fontSizeType;
|
|
431
433
|
}
|
|
432
434
|
}.bind(this));
|
|
433
|
-
|
|
435
|
+
|
|
434
436
|
this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
|
|
435
|
-
|
|
437
|
+
|
|
436
438
|
this.dims = null;
|
|
437
439
|
if (this.options.scaleMode=='box')
|
|
438
440
|
this.dims = [this.element.offsetHeight, this.element.offsetWidth];
|
|
@@ -507,17 +509,16 @@ Effect.Highlight = Class.create(Effect.Base, {
|
|
|
507
509
|
|
|
508
510
|
Effect.ScrollTo = function(element) {
|
|
509
511
|
var options = arguments[1] || { },
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
|
|
512
|
+
scrollOffsets = document.viewport.getScrollOffsets(),
|
|
513
|
+
elementOffsets = $(element).cumulativeOffset();
|
|
513
514
|
|
|
514
515
|
if (options.offset) elementOffsets[1] += options.offset;
|
|
515
516
|
|
|
516
517
|
return new Effect.Tween(null,
|
|
517
518
|
scrollOffsets.top,
|
|
518
|
-
elementOffsets[1]
|
|
519
|
+
elementOffsets[1],
|
|
519
520
|
options,
|
|
520
|
-
function(p){ scrollTo(scrollOffsets.left, p.round()) }
|
|
521
|
+
function(p){ scrollTo(scrollOffsets.left, p.round()); }
|
|
521
522
|
);
|
|
522
523
|
};
|
|
523
524
|
|
|
@@ -529,9 +530,9 @@ Effect.Fade = function(element) {
|
|
|
529
530
|
var options = Object.extend({
|
|
530
531
|
from: element.getOpacity() || 1.0,
|
|
531
532
|
to: 0.0,
|
|
532
|
-
afterFinishInternal: function(effect) {
|
|
533
|
+
afterFinishInternal: function(effect) {
|
|
533
534
|
if (effect.options.to!=0) return;
|
|
534
|
-
effect.element.hide().setStyle({opacity: oldOpacity});
|
|
535
|
+
effect.element.hide().setStyle({opacity: oldOpacity});
|
|
535
536
|
}
|
|
536
537
|
}, arguments[1] || { });
|
|
537
538
|
return new Effect.Opacity(element,options);
|
|
@@ -547,15 +548,15 @@ Effect.Appear = function(element) {
|
|
|
547
548
|
effect.element.forceRerendering();
|
|
548
549
|
},
|
|
549
550
|
beforeSetup: function(effect) {
|
|
550
|
-
effect.element.setOpacity(effect.options.from).show();
|
|
551
|
+
effect.element.setOpacity(effect.options.from).show();
|
|
551
552
|
}}, arguments[1] || { });
|
|
552
553
|
return new Effect.Opacity(element,options);
|
|
553
554
|
};
|
|
554
555
|
|
|
555
556
|
Effect.Puff = function(element) {
|
|
556
557
|
element = $(element);
|
|
557
|
-
var oldStyle = {
|
|
558
|
-
opacity: element.getInlineOpacity(),
|
|
558
|
+
var oldStyle = {
|
|
559
|
+
opacity: element.getInlineOpacity(),
|
|
559
560
|
position: element.getStyle('position'),
|
|
560
561
|
top: element.style.top,
|
|
561
562
|
left: element.style.left,
|
|
@@ -563,12 +564,12 @@ Effect.Puff = function(element) {
|
|
|
563
564
|
height: element.style.height
|
|
564
565
|
};
|
|
565
566
|
return new Effect.Parallel(
|
|
566
|
-
[ new Effect.Scale(element, 200,
|
|
567
|
-
{ sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
|
|
568
|
-
new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
|
|
569
|
-
Object.extend({ duration: 1.0,
|
|
567
|
+
[ new Effect.Scale(element, 200,
|
|
568
|
+
{ sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
|
|
569
|
+
new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
|
|
570
|
+
Object.extend({ duration: 1.0,
|
|
570
571
|
beforeSetupInternal: function(effect) {
|
|
571
|
-
Position.absolutize(effect.effects[0].element)
|
|
572
|
+
Position.absolutize(effect.effects[0].element);
|
|
572
573
|
},
|
|
573
574
|
afterFinishInternal: function(effect) {
|
|
574
575
|
effect.effects[0].element.hide().setStyle(oldStyle); }
|
|
@@ -580,12 +581,12 @@ Effect.BlindUp = function(element) {
|
|
|
580
581
|
element = $(element);
|
|
581
582
|
element.makeClipping();
|
|
582
583
|
return new Effect.Scale(element, 0,
|
|
583
|
-
Object.extend({ scaleContent: false,
|
|
584
|
-
scaleX: false,
|
|
584
|
+
Object.extend({ scaleContent: false,
|
|
585
|
+
scaleX: false,
|
|
585
586
|
restoreAfterFinish: true,
|
|
586
587
|
afterFinishInternal: function(effect) {
|
|
587
588
|
effect.element.hide().undoClipping();
|
|
588
|
-
}
|
|
589
|
+
}
|
|
589
590
|
}, arguments[1] || { })
|
|
590
591
|
);
|
|
591
592
|
};
|
|
@@ -593,15 +594,15 @@ Effect.BlindUp = function(element) {
|
|
|
593
594
|
Effect.BlindDown = function(element) {
|
|
594
595
|
element = $(element);
|
|
595
596
|
var elementDimensions = element.getDimensions();
|
|
596
|
-
return new Effect.Scale(element, 100, Object.extend({
|
|
597
|
-
scaleContent: false,
|
|
597
|
+
return new Effect.Scale(element, 100, Object.extend({
|
|
598
|
+
scaleContent: false,
|
|
598
599
|
scaleX: false,
|
|
599
600
|
scaleFrom: 0,
|
|
600
601
|
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
|
|
601
602
|
restoreAfterFinish: true,
|
|
602
603
|
afterSetup: function(effect) {
|
|
603
|
-
effect.element.makeClipping().setStyle({height: '0px'}).show();
|
|
604
|
-
},
|
|
604
|
+
effect.element.makeClipping().setStyle({height: '0px'}).show();
|
|
605
|
+
},
|
|
605
606
|
afterFinishInternal: function(effect) {
|
|
606
607
|
effect.element.undoClipping();
|
|
607
608
|
}
|
|
@@ -616,16 +617,16 @@ Effect.SwitchOff = function(element) {
|
|
|
616
617
|
from: 0,
|
|
617
618
|
transition: Effect.Transitions.flicker,
|
|
618
619
|
afterFinishInternal: function(effect) {
|
|
619
|
-
new Effect.Scale(effect.element, 1, {
|
|
620
|
+
new Effect.Scale(effect.element, 1, {
|
|
620
621
|
duration: 0.3, scaleFromCenter: true,
|
|
621
622
|
scaleX: false, scaleContent: false, restoreAfterFinish: true,
|
|
622
|
-
beforeSetup: function(effect) {
|
|
623
|
+
beforeSetup: function(effect) {
|
|
623
624
|
effect.element.makePositioned().makeClipping();
|
|
624
625
|
},
|
|
625
626
|
afterFinishInternal: function(effect) {
|
|
626
627
|
effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
|
|
627
628
|
}
|
|
628
|
-
})
|
|
629
|
+
});
|
|
629
630
|
}
|
|
630
631
|
}, arguments[1] || { }));
|
|
631
632
|
};
|
|
@@ -637,16 +638,16 @@ Effect.DropOut = function(element) {
|
|
|
637
638
|
left: element.getStyle('left'),
|
|
638
639
|
opacity: element.getInlineOpacity() };
|
|
639
640
|
return new Effect.Parallel(
|
|
640
|
-
[ new Effect.Move(element, {x: 0, y: 100, sync: true }),
|
|
641
|
+
[ new Effect.Move(element, {x: 0, y: 100, sync: true }),
|
|
641
642
|
new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
|
|
642
643
|
Object.extend(
|
|
643
644
|
{ duration: 0.5,
|
|
644
645
|
beforeSetup: function(effect) {
|
|
645
|
-
effect.effects[0].element.makePositioned();
|
|
646
|
+
effect.effects[0].element.makePositioned();
|
|
646
647
|
},
|
|
647
648
|
afterFinishInternal: function(effect) {
|
|
648
649
|
effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
|
|
649
|
-
}
|
|
650
|
+
}
|
|
650
651
|
}, arguments[1] || { }));
|
|
651
652
|
};
|
|
652
653
|
|
|
@@ -674,7 +675,7 @@ Effect.Shake = function(element) {
|
|
|
674
675
|
new Effect.Move(effect.element,
|
|
675
676
|
{ x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
|
|
676
677
|
effect.element.undoPositioned().setStyle(oldStyle);
|
|
677
|
-
}}) }}) }}) }}) }}) }});
|
|
678
|
+
}}); }}); }}); }}); }}); }});
|
|
678
679
|
};
|
|
679
680
|
|
|
680
681
|
Effect.SlideDown = function(element) {
|
|
@@ -682,9 +683,9 @@ Effect.SlideDown = function(element) {
|
|
|
682
683
|
// SlideDown need to have the content of the element wrapped in a container element with fixed height!
|
|
683
684
|
var oldInnerBottom = element.down().getStyle('bottom');
|
|
684
685
|
var elementDimensions = element.getDimensions();
|
|
685
|
-
return new Effect.Scale(element, 100, Object.extend({
|
|
686
|
-
scaleContent: false,
|
|
687
|
-
scaleX: false,
|
|
686
|
+
return new Effect.Scale(element, 100, Object.extend({
|
|
687
|
+
scaleContent: false,
|
|
688
|
+
scaleX: false,
|
|
688
689
|
scaleFrom: window.opera ? 0 : 1,
|
|
689
690
|
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
|
|
690
691
|
restoreAfterFinish: true,
|
|
@@ -692,11 +693,11 @@ Effect.SlideDown = function(element) {
|
|
|
692
693
|
effect.element.makePositioned();
|
|
693
694
|
effect.element.down().makePositioned();
|
|
694
695
|
if (window.opera) effect.element.setStyle({top: ''});
|
|
695
|
-
effect.element.makeClipping().setStyle({height: '0px'}).show();
|
|
696
|
+
effect.element.makeClipping().setStyle({height: '0px'}).show();
|
|
696
697
|
},
|
|
697
698
|
afterUpdateInternal: function(effect) {
|
|
698
699
|
effect.element.down().setStyle({bottom:
|
|
699
|
-
(effect.dims[0] - effect.element.clientHeight) + 'px' });
|
|
700
|
+
(effect.dims[0] - effect.element.clientHeight) + 'px' });
|
|
700
701
|
},
|
|
701
702
|
afterFinishInternal: function(effect) {
|
|
702
703
|
effect.element.undoClipping().undoPositioned();
|
|
@@ -710,8 +711,8 @@ Effect.SlideUp = function(element) {
|
|
|
710
711
|
var oldInnerBottom = element.down().getStyle('bottom');
|
|
711
712
|
var elementDimensions = element.getDimensions();
|
|
712
713
|
return new Effect.Scale(element, window.opera ? 0 : 1,
|
|
713
|
-
Object.extend({ scaleContent: false,
|
|
714
|
-
scaleX: false,
|
|
714
|
+
Object.extend({ scaleContent: false,
|
|
715
|
+
scaleX: false,
|
|
715
716
|
scaleMode: 'box',
|
|
716
717
|
scaleFrom: 100,
|
|
717
718
|
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
|
|
@@ -721,7 +722,7 @@ Effect.SlideUp = function(element) {
|
|
|
721
722
|
effect.element.down().makePositioned();
|
|
722
723
|
if (window.opera) effect.element.setStyle({top: ''});
|
|
723
724
|
effect.element.makeClipping().show();
|
|
724
|
-
},
|
|
725
|
+
},
|
|
725
726
|
afterUpdateInternal: function(effect) {
|
|
726
727
|
effect.element.down().setStyle({bottom:
|
|
727
728
|
(effect.dims[0] - effect.element.clientHeight) + 'px' });
|
|
@@ -734,15 +735,15 @@ Effect.SlideUp = function(element) {
|
|
|
734
735
|
);
|
|
735
736
|
};
|
|
736
737
|
|
|
737
|
-
// Bug in opera makes the TD containing this element expand for a instance after finish
|
|
738
|
+
// Bug in opera makes the TD containing this element expand for a instance after finish
|
|
738
739
|
Effect.Squish = function(element) {
|
|
739
|
-
return new Effect.Scale(element, window.opera ? 1 : 0, {
|
|
740
|
+
return new Effect.Scale(element, window.opera ? 1 : 0, {
|
|
740
741
|
restoreAfterFinish: true,
|
|
741
742
|
beforeSetup: function(effect) {
|
|
742
|
-
effect.element.makeClipping();
|
|
743
|
-
},
|
|
743
|
+
effect.element.makeClipping();
|
|
744
|
+
},
|
|
744
745
|
afterFinishInternal: function(effect) {
|
|
745
|
-
effect.element.hide().undoClipping();
|
|
746
|
+
effect.element.hide().undoClipping();
|
|
746
747
|
}
|
|
747
748
|
});
|
|
748
749
|
};
|
|
@@ -762,13 +763,13 @@ Effect.Grow = function(element) {
|
|
|
762
763
|
width: element.style.width,
|
|
763
764
|
opacity: element.getInlineOpacity() };
|
|
764
765
|
|
|
765
|
-
var dims = element.getDimensions();
|
|
766
|
+
var dims = element.getDimensions();
|
|
766
767
|
var initialMoveX, initialMoveY;
|
|
767
768
|
var moveX, moveY;
|
|
768
|
-
|
|
769
|
+
|
|
769
770
|
switch (options.direction) {
|
|
770
771
|
case 'top-left':
|
|
771
|
-
initialMoveX = initialMoveY = moveX = moveY = 0;
|
|
772
|
+
initialMoveX = initialMoveY = moveX = moveY = 0;
|
|
772
773
|
break;
|
|
773
774
|
case 'top-right':
|
|
774
775
|
initialMoveX = dims.width;
|
|
@@ -793,11 +794,11 @@ Effect.Grow = function(element) {
|
|
|
793
794
|
moveY = -dims.height / 2;
|
|
794
795
|
break;
|
|
795
796
|
}
|
|
796
|
-
|
|
797
|
+
|
|
797
798
|
return new Effect.Move(element, {
|
|
798
799
|
x: initialMoveX,
|
|
799
800
|
y: initialMoveY,
|
|
800
|
-
duration: 0.01,
|
|
801
|
+
duration: 0.01,
|
|
801
802
|
beforeSetup: function(effect) {
|
|
802
803
|
effect.element.hide().makeClipping().makePositioned();
|
|
803
804
|
},
|
|
@@ -806,17 +807,17 @@ Effect.Grow = function(element) {
|
|
|
806
807
|
[ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
|
|
807
808
|
new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
|
|
808
809
|
new Effect.Scale(effect.element, 100, {
|
|
809
|
-
scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
|
|
810
|
+
scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
|
|
810
811
|
sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
|
|
811
812
|
], Object.extend({
|
|
812
813
|
beforeSetup: function(effect) {
|
|
813
|
-
effect.effects[0].element.setStyle({height: '0px'}).show();
|
|
814
|
+
effect.effects[0].element.setStyle({height: '0px'}).show();
|
|
814
815
|
},
|
|
815
816
|
afterFinishInternal: function(effect) {
|
|
816
|
-
effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
|
|
817
|
+
effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
|
|
817
818
|
}
|
|
818
819
|
}, options)
|
|
819
|
-
)
|
|
820
|
+
);
|
|
820
821
|
}
|
|
821
822
|
});
|
|
822
823
|
};
|
|
@@ -838,7 +839,7 @@ Effect.Shrink = function(element) {
|
|
|
838
839
|
|
|
839
840
|
var dims = element.getDimensions();
|
|
840
841
|
var moveX, moveY;
|
|
841
|
-
|
|
842
|
+
|
|
842
843
|
switch (options.direction) {
|
|
843
844
|
case 'top-left':
|
|
844
845
|
moveX = moveY = 0;
|
|
@@ -855,19 +856,19 @@ Effect.Shrink = function(element) {
|
|
|
855
856
|
moveX = dims.width;
|
|
856
857
|
moveY = dims.height;
|
|
857
858
|
break;
|
|
858
|
-
case 'center':
|
|
859
|
+
case 'center':
|
|
859
860
|
moveX = dims.width / 2;
|
|
860
861
|
moveY = dims.height / 2;
|
|
861
862
|
break;
|
|
862
863
|
}
|
|
863
|
-
|
|
864
|
+
|
|
864
865
|
return new Effect.Parallel(
|
|
865
866
|
[ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
|
|
866
867
|
new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
|
|
867
868
|
new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
|
|
868
|
-
], Object.extend({
|
|
869
|
+
], Object.extend({
|
|
869
870
|
beforeStartInternal: function(effect) {
|
|
870
|
-
effect.effects[0].element.makePositioned().makeClipping();
|
|
871
|
+
effect.effects[0].element.makePositioned().makeClipping();
|
|
871
872
|
},
|
|
872
873
|
afterFinishInternal: function(effect) {
|
|
873
874
|
effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
|
|
@@ -877,12 +878,14 @@ Effect.Shrink = function(element) {
|
|
|
877
878
|
|
|
878
879
|
Effect.Pulsate = function(element) {
|
|
879
880
|
element = $(element);
|
|
880
|
-
var options = arguments[1] || { }
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
881
|
+
var options = arguments[1] || { },
|
|
882
|
+
oldOpacity = element.getInlineOpacity(),
|
|
883
|
+
transition = options.transition || Effect.Transitions.linear,
|
|
884
|
+
reverser = function(pos){
|
|
885
|
+
return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
|
|
886
|
+
};
|
|
887
|
+
|
|
888
|
+
return new Effect.Opacity(element,
|
|
886
889
|
Object.extend(Object.extend({ duration: 2.0, from: 0,
|
|
887
890
|
afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
|
|
888
891
|
}, options), {transition: reverser}));
|
|
@@ -896,12 +899,12 @@ Effect.Fold = function(element) {
|
|
|
896
899
|
width: element.style.width,
|
|
897
900
|
height: element.style.height };
|
|
898
901
|
element.makeClipping();
|
|
899
|
-
return new Effect.Scale(element, 5, Object.extend({
|
|
902
|
+
return new Effect.Scale(element, 5, Object.extend({
|
|
900
903
|
scaleContent: false,
|
|
901
904
|
scaleX: false,
|
|
902
905
|
afterFinishInternal: function(effect) {
|
|
903
|
-
new Effect.Scale(element, 1, {
|
|
904
|
-
scaleContent: false,
|
|
906
|
+
new Effect.Scale(element, 1, {
|
|
907
|
+
scaleContent: false,
|
|
905
908
|
scaleY: false,
|
|
906
909
|
afterFinishInternal: function(effect) {
|
|
907
910
|
effect.element.hide().undoClipping().setStyle(oldStyle);
|
|
@@ -916,7 +919,7 @@ Effect.Morph = Class.create(Effect.Base, {
|
|
|
916
919
|
var options = Object.extend({
|
|
917
920
|
style: { }
|
|
918
921
|
}, arguments[1] || { });
|
|
919
|
-
|
|
922
|
+
|
|
920
923
|
if (!Object.isString(options.style)) this.style = $H(options.style);
|
|
921
924
|
else {
|
|
922
925
|
if (options.style.include(':'))
|
|
@@ -934,18 +937,18 @@ Effect.Morph = Class.create(Effect.Base, {
|
|
|
934
937
|
effect.transforms.each(function(transform) {
|
|
935
938
|
effect.element.style[transform.style] = '';
|
|
936
939
|
});
|
|
937
|
-
}
|
|
940
|
+
};
|
|
938
941
|
}
|
|
939
942
|
}
|
|
940
943
|
this.start(options);
|
|
941
944
|
},
|
|
942
|
-
|
|
945
|
+
|
|
943
946
|
setup: function(){
|
|
944
947
|
function parseColor(color){
|
|
945
948
|
if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
|
|
946
949
|
color = color.parseColor();
|
|
947
950
|
return $R(0,2).map(function(i){
|
|
948
|
-
return parseInt( color.slice(i*2+1,i*2+3), 16 )
|
|
951
|
+
return parseInt( color.slice(i*2+1,i*2+3), 16 );
|
|
949
952
|
});
|
|
950
953
|
}
|
|
951
954
|
this.transforms = this.style.map(function(pair){
|
|
@@ -965,9 +968,9 @@ Effect.Morph = Class.create(Effect.Base, {
|
|
|
965
968
|
}
|
|
966
969
|
|
|
967
970
|
var originalValue = this.element.getStyle(property);
|
|
968
|
-
return {
|
|
969
|
-
style: property.camelize(),
|
|
970
|
-
originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
|
|
971
|
+
return {
|
|
972
|
+
style: property.camelize(),
|
|
973
|
+
originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
|
|
971
974
|
targetValue: unit=='color' ? parseColor(value) : value,
|
|
972
975
|
unit: unit
|
|
973
976
|
};
|
|
@@ -978,13 +981,13 @@ Effect.Morph = Class.create(Effect.Base, {
|
|
|
978
981
|
transform.unit != 'color' &&
|
|
979
982
|
(isNaN(transform.originalValue) || isNaN(transform.targetValue))
|
|
980
983
|
)
|
|
981
|
-
)
|
|
984
|
+
);
|
|
982
985
|
});
|
|
983
986
|
},
|
|
984
987
|
update: function(position) {
|
|
985
988
|
var style = { }, transform, i = this.transforms.length;
|
|
986
989
|
while(i--)
|
|
987
|
-
style[(transform = this.transforms[i]).style] =
|
|
990
|
+
style[(transform = this.transforms[i]).style] =
|
|
988
991
|
transform.unit=='color' ? '#'+
|
|
989
992
|
(Math.round(transform.originalValue[0]+
|
|
990
993
|
(transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
|
|
@@ -993,7 +996,7 @@ Effect.Morph = Class.create(Effect.Base, {
|
|
|
993
996
|
(Math.round(transform.originalValue[2]+
|
|
994
997
|
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
|
|
995
998
|
(transform.originalValue +
|
|
996
|
-
(transform.targetValue - transform.originalValue) * position).toFixed(3) +
|
|
999
|
+
(transform.targetValue - transform.originalValue) * position).toFixed(3) +
|
|
997
1000
|
(transform.unit === null ? '' : transform.unit);
|
|
998
1001
|
this.element.setStyle(style, true);
|
|
999
1002
|
}
|
|
@@ -1030,7 +1033,7 @@ Effect.Transform = Class.create({
|
|
|
1030
1033
|
});
|
|
1031
1034
|
|
|
1032
1035
|
Element.CSS_PROPERTIES = $w(
|
|
1033
|
-
'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
|
|
1036
|
+
'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
|
|
1034
1037
|
'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
|
|
1035
1038
|
'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
|
|
1036
1039
|
'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
|
|
@@ -1039,7 +1042,7 @@ Element.CSS_PROPERTIES = $w(
|
|
|
1039
1042
|
'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
|
|
1040
1043
|
'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
|
|
1041
1044
|
'right textIndent top width wordSpacing zIndex');
|
|
1042
|
-
|
|
1045
|
+
|
|
1043
1046
|
Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
|
|
1044
1047
|
|
|
1045
1048
|
String.__parseStyleElement = document.createElement('div');
|
|
@@ -1051,11 +1054,11 @@ String.prototype.parseStyle = function(){
|
|
|
1051
1054
|
String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
|
|
1052
1055
|
style = String.__parseStyleElement.childNodes[0].style;
|
|
1053
1056
|
}
|
|
1054
|
-
|
|
1057
|
+
|
|
1055
1058
|
Element.CSS_PROPERTIES.each(function(property){
|
|
1056
|
-
if (style[property]) styleRules.set(property, style[property]);
|
|
1059
|
+
if (style[property]) styleRules.set(property, style[property]);
|
|
1057
1060
|
});
|
|
1058
|
-
|
|
1061
|
+
|
|
1059
1062
|
if (Prototype.Browser.IE && this.include('opacity'))
|
|
1060
1063
|
styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
|
|
1061
1064
|
|
|
@@ -1074,14 +1077,14 @@ if (document.defaultView && document.defaultView.getComputedStyle) {
|
|
|
1074
1077
|
Element.getStyles = function(element) {
|
|
1075
1078
|
element = $(element);
|
|
1076
1079
|
var css = element.currentStyle, styles;
|
|
1077
|
-
styles = Element.CSS_PROPERTIES.inject({ }, function(
|
|
1078
|
-
|
|
1079
|
-
return
|
|
1080
|
+
styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
|
|
1081
|
+
results[property] = css[property];
|
|
1082
|
+
return results;
|
|
1080
1083
|
});
|
|
1081
|
-
if (!styles.opacity) styles.
|
|
1084
|
+
if (!styles.opacity) styles.opacity = element.getOpacity();
|
|
1082
1085
|
return styles;
|
|
1083
1086
|
};
|
|
1084
|
-
}
|
|
1087
|
+
}
|
|
1085
1088
|
|
|
1086
1089
|
Effect.Methods = {
|
|
1087
1090
|
morph: function(element, style) {
|
|
@@ -1090,7 +1093,7 @@ Effect.Methods = {
|
|
|
1090
1093
|
return element;
|
|
1091
1094
|
},
|
|
1092
1095
|
visualEffect: function(element, effect, options) {
|
|
1093
|
-
element = $(element)
|
|
1096
|
+
element = $(element);
|
|
1094
1097
|
var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
|
|
1095
1098
|
new Effect[klass](element, options);
|
|
1096
1099
|
return element;
|
|
@@ -1104,17 +1107,17 @@ Effect.Methods = {
|
|
|
1104
1107
|
|
|
1105
1108
|
$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
|
|
1106
1109
|
'pulsate shake puff squish switchOff dropOut').each(
|
|
1107
|
-
function(effect) {
|
|
1110
|
+
function(effect) {
|
|
1108
1111
|
Effect.Methods[effect] = function(element, options){
|
|
1109
1112
|
element = $(element);
|
|
1110
1113
|
Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
|
|
1111
1114
|
return element;
|
|
1112
|
-
}
|
|
1115
|
+
};
|
|
1113
1116
|
}
|
|
1114
1117
|
);
|
|
1115
1118
|
|
|
1116
|
-
$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
|
|
1119
|
+
$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
|
|
1117
1120
|
function(f) { Effect.Methods[f] = Element[f]; }
|
|
1118
1121
|
);
|
|
1119
1122
|
|
|
1120
|
-
Element.addMethods(Effect.Methods);
|
|
1123
|
+
Element.addMethods(Effect.Methods);
|