bio 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bioruby +14 -122
- data/bin/br_biofetch.rb +2 -2
- data/bin/br_bioflat.rb +2 -2
- data/bin/br_biogetseq.rb +2 -2
- data/bin/br_pmfetch.rb +3 -3
- data/doc/Changes-0.7.rd +77 -0
- data/doc/KEGG_API.rd +523 -232
- data/doc/KEGG_API.rd.ja +529 -207
- data/doc/Tutorial.rd +48 -11
- data/lib/bio.rb +59 -6
- data/lib/bio/alignment.rb +713 -103
- data/lib/bio/appl/bl2seq/report.rb +2 -18
- data/lib/bio/appl/blast.rb +108 -91
- data/lib/bio/appl/blast/format0.rb +33 -18
- data/lib/bio/appl/blast/format8.rb +6 -20
- data/lib/bio/appl/blast/report.rb +293 -429
- data/lib/bio/appl/blast/rexml.rb +8 -22
- data/lib/bio/appl/blast/wublast.rb +21 -12
- data/lib/bio/appl/blast/xmlparser.rb +180 -183
- data/lib/bio/appl/blat/report.rb +127 -30
- data/lib/bio/appl/clustalw.rb +87 -59
- data/lib/bio/appl/clustalw/report.rb +20 -22
- data/lib/bio/appl/emboss.rb +113 -20
- data/lib/bio/appl/fasta.rb +173 -198
- data/lib/bio/appl/fasta/format10.rb +244 -347
- data/lib/bio/appl/gcg/msf.rb +212 -0
- data/lib/bio/appl/gcg/seq.rb +195 -0
- data/lib/bio/appl/genscan/report.rb +5 -23
- data/lib/bio/appl/hmmer.rb +8 -45
- data/lib/bio/appl/hmmer/report.rb +2 -20
- data/lib/bio/appl/iprscan/report.rb +374 -0
- data/lib/bio/appl/mafft.rb +87 -50
- data/lib/bio/appl/mafft/report.rb +151 -44
- data/lib/bio/appl/muscle.rb +52 -0
- data/lib/bio/appl/phylip/alignment.rb +129 -0
- data/lib/bio/appl/phylip/distance_matrix.rb +96 -0
- data/lib/bio/appl/probcons.rb +41 -0
- data/lib/bio/appl/psort.rb +89 -96
- data/lib/bio/appl/psort/report.rb +6 -22
- data/lib/bio/appl/pts1.rb +263 -0
- data/lib/bio/appl/sim4.rb +26 -36
- data/lib/bio/appl/sim4/report.rb +2 -18
- data/lib/bio/appl/sosui/report.rb +5 -20
- data/lib/bio/appl/spidey/report.rb +2 -2
- data/lib/bio/appl/targetp/report.rb +4 -20
- data/lib/bio/appl/tcoffee.rb +55 -0
- data/lib/bio/appl/tmhmm/report.rb +4 -20
- data/lib/bio/command.rb +235 -64
- data/lib/bio/data/aa.rb +21 -26
- data/lib/bio/data/codontable.rb +2 -20
- data/lib/bio/data/na.rb +19 -4
- data/lib/bio/db.rb +27 -12
- data/lib/bio/db/aaindex.rb +2 -20
- data/lib/bio/db/embl/common.rb +4 -21
- data/lib/bio/db/embl/embl.rb +33 -85
- data/lib/bio/db/embl/sptr.rb +612 -302
- data/lib/bio/db/embl/swissprot.rb +10 -29
- data/lib/bio/db/embl/trembl.rb +10 -29
- data/lib/bio/db/embl/uniprot.rb +10 -29
- data/lib/bio/db/fantom.rb +15 -20
- data/lib/bio/db/fasta.rb +3 -3
- data/lib/bio/db/genbank/common.rb +37 -46
- data/lib/bio/db/genbank/ddbj.rb +6 -18
- data/lib/bio/db/genbank/genbank.rb +47 -186
- data/lib/bio/db/genbank/genpept.rb +4 -17
- data/lib/bio/db/genbank/refseq.rb +4 -17
- data/lib/bio/db/gff.rb +103 -35
- data/lib/bio/db/go.rb +4 -20
- data/lib/bio/db/kegg/brite.rb +26 -36
- data/lib/bio/db/kegg/compound.rb +81 -85
- data/lib/bio/db/kegg/drug.rb +98 -0
- data/lib/bio/db/kegg/enzyme.rb +133 -110
- data/lib/bio/db/kegg/expression.rb +2 -20
- data/lib/bio/db/kegg/genes.rb +208 -238
- data/lib/bio/db/kegg/genome.rb +164 -285
- data/lib/bio/db/kegg/glycan.rb +114 -157
- data/lib/bio/db/kegg/keggtab.rb +242 -303
- data/lib/bio/db/kegg/kgml.rb +117 -160
- data/lib/bio/db/kegg/orthology.rb +112 -0
- data/lib/bio/db/kegg/reaction.rb +54 -69
- data/lib/bio/db/kegg/taxonomy.rb +331 -0
- data/lib/bio/db/lasergene.rb +209 -0
- data/lib/bio/db/litdb.rb +3 -27
- data/lib/bio/db/medline.rb +228 -249
- data/lib/bio/db/nbrf.rb +3 -3
- data/lib/bio/db/newick.rb +510 -0
- data/lib/bio/db/nexus.rb +1854 -0
- data/lib/bio/db/pdb.rb +5 -17
- data/lib/bio/db/pdb/atom.rb +2 -18
- data/lib/bio/db/pdb/chain.rb +2 -18
- data/lib/bio/db/pdb/chemicalcomponent.rb +2 -18
- data/lib/bio/db/pdb/model.rb +2 -18
- data/lib/bio/db/pdb/pdb.rb +73 -34
- data/lib/bio/db/pdb/residue.rb +4 -20
- data/lib/bio/db/pdb/utils.rb +2 -18
- data/lib/bio/db/prosite.rb +403 -422
- data/lib/bio/db/rebase.rb +84 -40
- data/lib/bio/db/soft.rb +404 -0
- data/lib/bio/db/transfac.rb +5 -17
- data/lib/bio/feature.rb +106 -52
- data/lib/bio/io/das.rb +32 -42
- data/lib/bio/io/dbget.rb +2 -20
- data/lib/bio/io/ddbjxml.rb +77 -138
- data/lib/bio/io/ebisoap.rb +158 -0
- data/lib/bio/io/ensembl.rb +229 -0
- data/lib/bio/io/fastacmd.rb +89 -82
- data/lib/bio/io/fetch.rb +163 -96
- data/lib/bio/io/flatfile.rb +170 -73
- data/lib/bio/io/flatfile/bdb.rb +3 -16
- data/lib/bio/io/flatfile/index.rb +2 -2
- data/lib/bio/io/flatfile/indexer.rb +3 -2
- data/lib/bio/io/higet.rb +12 -31
- data/lib/bio/io/keggapi.rb +210 -269
- data/lib/bio/io/ncbisoap.rb +155 -0
- data/lib/bio/io/pubmed.rb +169 -147
- data/lib/bio/io/registry.rb +4 -20
- data/lib/bio/io/soapwsdl.rb +43 -38
- data/lib/bio/io/sql.rb +242 -305
- data/lib/bio/location.rb +407 -285
- data/lib/bio/map.rb +410 -0
- data/lib/bio/pathway.rb +558 -695
- data/lib/bio/reference.rb +272 -75
- data/lib/bio/sequence.rb +255 -13
- data/lib/bio/sequence/aa.rb +71 -10
- data/lib/bio/sequence/common.rb +187 -33
- data/lib/bio/sequence/compat.rb +59 -4
- data/lib/bio/sequence/format.rb +54 -7
- data/lib/bio/sequence/generic.rb +3 -3
- data/lib/bio/sequence/na.rb +328 -26
- data/lib/bio/shell.rb +11 -4
- data/lib/bio/shell/core.rb +221 -160
- data/lib/bio/shell/demo.rb +18 -15
- data/lib/bio/shell/interface.rb +14 -12
- data/lib/bio/shell/irb.rb +95 -0
- data/lib/bio/shell/object.rb +45 -26
- data/lib/bio/shell/plugin/blast.rb +42 -0
- data/lib/bio/shell/plugin/codon.rb +22 -14
- data/lib/bio/shell/plugin/das.rb +58 -0
- data/lib/bio/shell/plugin/emboss.rb +2 -2
- data/lib/bio/shell/plugin/entry.rb +22 -11
- data/lib/bio/shell/plugin/flatfile.rb +2 -2
- data/lib/bio/shell/plugin/keggapi.rb +13 -6
- data/lib/bio/shell/plugin/midi.rb +4 -4
- data/lib/bio/shell/plugin/obda.rb +2 -2
- data/lib/bio/shell/plugin/psort.rb +56 -0
- data/lib/bio/shell/plugin/seq.rb +35 -8
- data/lib/bio/shell/plugin/soap.rb +87 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/bioruby_generator.rb +29 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_classes.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_log.rhtml +27 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_methods.rhtml +11 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_modules.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_variables.rhtml +7 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-console.png +0 -0
- data/lib/bio/shell/rails/{public/images/icon.png → vendor/plugins/generators/bioruby/templates/bioruby-gem.png} +0 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby.css +369 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby.rhtml +47 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby_controller.rb +144 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby_helper.rb +47 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/commands.rhtml +8 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/history.rhtml +10 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/index.rhtml +22 -0
- data/lib/bio/shell/script.rb +25 -0
- data/lib/bio/shell/setup.rb +109 -0
- data/lib/bio/shell/web.rb +70 -58
- data/lib/bio/tree.rb +850 -0
- data/lib/bio/util/color_scheme.rb +84 -107
- data/lib/bio/util/color_scheme/buried.rb +5 -24
- data/lib/bio/util/color_scheme/helix.rb +5 -24
- data/lib/bio/util/color_scheme/hydropathy.rb +5 -24
- data/lib/bio/util/color_scheme/nucleotide.rb +5 -24
- data/lib/bio/util/color_scheme/strand.rb +5 -24
- data/lib/bio/util/color_scheme/taylor.rb +5 -24
- data/lib/bio/util/color_scheme/turn.rb +5 -24
- data/lib/bio/util/color_scheme/zappo.rb +5 -24
- data/lib/bio/util/contingency_table.rb +70 -43
- data/lib/bio/util/restriction_enzyme.rb +228 -0
- data/lib/bio/util/restriction_enzyme/analysis.rb +249 -0
- data/lib/bio/util/restriction_enzyme/analysis_basic.rb +217 -0
- data/lib/bio/util/restriction_enzyme/cut_symbol.rb +107 -0
- data/lib/bio/util/restriction_enzyme/double_stranded.rb +321 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +130 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +103 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +38 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +76 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +107 -0
- data/lib/bio/util/restriction_enzyme/enzymes.yaml +7061 -0
- data/lib/bio/util/restriction_enzyme/range/cut_range.rb +24 -0
- data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +47 -0
- data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +67 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +257 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +242 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +51 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +41 -0
- data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +77 -0
- data/lib/bio/util/restriction_enzyme/single_strand.rb +199 -0
- data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +135 -0
- data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +23 -0
- data/lib/bio/util/restriction_enzyme/string_formatting.rb +111 -0
- data/lib/bio/util/sirna.rb +4 -22
- data/sample/color_scheme_na.rb +4 -12
- data/sample/enzymes.rb +78 -0
- data/sample/goslim.rb +5 -13
- data/sample/psortplot_html.rb +4 -12
- data/test/data/blast/2.2.15.blastp.m7 +876 -0
- data/test/data/embl/AB090716.embl.rel89 +63 -0
- data/test/data/fasta/example1.txt +75 -0
- data/test/data/fasta/example2.txt +21 -0
- data/test/data/iprscan/merged.raw +32 -0
- data/test/data/iprscan/merged.txt +74 -0
- data/test/data/soft/GDS100_partial.soft +92 -0
- data/test/data/soft/GSE3457_family_partial.soft +874 -0
- data/test/functional/bio/io/test_ensembl.rb +103 -0
- data/test/functional/bio/io/test_soapwsdl.rb +5 -17
- data/test/unit/bio/appl/bl2seq/test_report.rb +2 -2
- data/test/unit/bio/appl/blast/test_report.rb +3 -16
- data/test/unit/bio/appl/blast/test_xmlparser.rb +4 -16
- data/test/unit/bio/appl/genscan/test_report.rb +3 -16
- data/test/unit/bio/appl/hmmer/test_report.rb +3 -16
- data/test/unit/bio/appl/iprscan/test_report.rb +338 -0
- data/test/unit/bio/appl/mafft/test_report.rb +63 -0
- data/test/unit/bio/appl/sosui/test_report.rb +3 -16
- data/test/unit/bio/appl/targetp/test_report.rb +3 -16
- data/test/unit/bio/appl/test_blast.rb +3 -16
- data/test/unit/bio/appl/test_fasta.rb +4 -16
- data/test/unit/bio/appl/test_pts1.rb +140 -0
- data/test/unit/bio/appl/tmhmm/test_report.rb +3 -16
- data/test/unit/bio/data/test_aa.rb +4 -17
- data/test/unit/bio/data/test_codontable.rb +3 -16
- data/test/unit/bio/data/test_na.rb +3 -3
- data/test/unit/bio/db/embl/test_common.rb +3 -16
- data/test/unit/bio/db/embl/test_embl.rb +3 -16
- data/test/unit/bio/db/embl/test_embl_rel89.rb +219 -0
- data/test/unit/bio/db/embl/test_sptr.rb +1548 -41
- data/test/unit/bio/db/embl/test_uniprot.rb +3 -16
- data/test/unit/bio/db/kegg/test_genes.rb +3 -16
- data/test/unit/bio/db/pdb/test_pdb.rb +7 -24
- data/test/unit/bio/db/test_aaindex.rb +2 -2
- data/test/unit/bio/db/test_fasta.rb +3 -16
- data/test/unit/bio/db/test_gff.rb +3 -16
- data/test/unit/bio/db/test_lasergene.rb +95 -0
- data/test/unit/bio/db/test_newick.rb +56 -0
- data/test/unit/bio/db/test_nexus.rb +360 -0
- data/test/unit/bio/db/test_prosite.rb +5 -18
- data/test/unit/bio/db/test_rebase.rb +11 -25
- data/test/unit/bio/db/test_soft.rb +138 -0
- data/test/unit/bio/io/test_ddbjxml.rb +5 -17
- data/test/unit/bio/io/test_ensembl.rb +109 -0
- data/test/unit/bio/io/test_fastacmd.rb +3 -16
- data/test/unit/bio/io/test_flatfile.rb +237 -0
- data/test/unit/bio/io/test_soapwsdl.rb +4 -17
- data/test/unit/bio/sequence/test_aa.rb +3 -3
- data/test/unit/bio/sequence/test_common.rb +3 -16
- data/test/unit/bio/sequence/test_compat.rb +3 -16
- data/test/unit/bio/sequence/test_na.rb +29 -3
- data/test/unit/bio/shell/plugin/test_seq.rb +8 -8
- data/test/unit/bio/test_alignment.rb +16 -27
- data/test/unit/bio/test_command.rb +242 -25
- data/test/unit/bio/test_db.rb +3 -16
- data/test/unit/bio/test_feature.rb +4 -16
- data/test/unit/bio/test_location.rb +4 -16
- data/test/unit/bio/test_map.rb +230 -0
- data/test/unit/bio/test_pathway.rb +4 -16
- data/test/unit/bio/test_reference.rb +2 -2
- data/test/unit/bio/test_sequence.rb +7 -19
- data/test/unit/bio/test_shell.rb +3 -16
- data/test/unit/bio/test_tree.rb +593 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +299 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +103 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +240 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +100 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +75 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +73 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +53 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +104 -0
- data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +83 -0
- data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +246 -0
- data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +44 -0
- data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +115 -0
- data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +147 -0
- data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +147 -0
- data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +60 -0
- data/test/unit/bio/util/test_color_scheme.rb +6 -18
- data/test/unit/bio/util/test_contingency_table.rb +6 -18
- data/test/unit/bio/util/test_restriction_enzyme.rb +42 -0
- data/test/unit/bio/util/test_sirna.rb +3 -16
- metadata +228 -169
- data/doc/BioRuby.rd.ja +0 -225
- data/doc/Design.rd.ja +0 -341
- data/doc/TODO.rd.ja +0 -138
- data/lib/bio/appl/fasta/format6.rb +0 -37
- data/lib/bio/db/kegg/cell.rb +0 -88
- data/lib/bio/db/kegg/ko.rb +0 -178
- data/lib/bio/shell/rails/Rakefile +0 -10
- data/lib/bio/shell/rails/app/controllers/application.rb +0 -4
- data/lib/bio/shell/rails/app/controllers/shell_controller.rb +0 -94
- data/lib/bio/shell/rails/app/helpers/application_helper.rb +0 -3
- data/lib/bio/shell/rails/app/models/shell_connection.rb +0 -30
- data/lib/bio/shell/rails/app/views/layouts/shell.rhtml +0 -37
- data/lib/bio/shell/rails/app/views/shell/history.rhtml +0 -5
- data/lib/bio/shell/rails/app/views/shell/index.rhtml +0 -2
- data/lib/bio/shell/rails/app/views/shell/show.rhtml +0 -13
- data/lib/bio/shell/rails/config/boot.rb +0 -19
- data/lib/bio/shell/rails/config/database.yml +0 -85
- data/lib/bio/shell/rails/config/environment.rb +0 -53
- data/lib/bio/shell/rails/config/environments/development.rb +0 -19
- data/lib/bio/shell/rails/config/environments/production.rb +0 -19
- data/lib/bio/shell/rails/config/environments/test.rb +0 -19
- data/lib/bio/shell/rails/config/routes.rb +0 -19
- data/lib/bio/shell/rails/doc/README_FOR_APP +0 -2
- data/lib/bio/shell/rails/public/404.html +0 -8
- data/lib/bio/shell/rails/public/500.html +0 -8
- data/lib/bio/shell/rails/public/dispatch.cgi +0 -10
- data/lib/bio/shell/rails/public/dispatch.fcgi +0 -24
- data/lib/bio/shell/rails/public/dispatch.rb +0 -10
- data/lib/bio/shell/rails/public/favicon.ico +0 -0
- data/lib/bio/shell/rails/public/images/rails.png +0 -0
- data/lib/bio/shell/rails/public/index.html +0 -277
- data/lib/bio/shell/rails/public/javascripts/controls.js +0 -750
- data/lib/bio/shell/rails/public/javascripts/dragdrop.js +0 -584
- data/lib/bio/shell/rails/public/javascripts/effects.js +0 -854
- data/lib/bio/shell/rails/public/javascripts/prototype.js +0 -1785
- data/lib/bio/shell/rails/public/robots.txt +0 -1
- data/lib/bio/shell/rails/public/stylesheets/main.css +0 -187
- data/lib/bio/shell/rails/script/about +0 -3
- data/lib/bio/shell/rails/script/breakpointer +0 -3
- data/lib/bio/shell/rails/script/console +0 -3
- data/lib/bio/shell/rails/script/destroy +0 -3
- data/lib/bio/shell/rails/script/generate +0 -3
- data/lib/bio/shell/rails/script/performance/benchmarker +0 -3
- data/lib/bio/shell/rails/script/performance/profiler +0 -3
- data/lib/bio/shell/rails/script/plugin +0 -3
- data/lib/bio/shell/rails/script/process/reaper +0 -3
- data/lib/bio/shell/rails/script/process/spawner +0 -3
- data/lib/bio/shell/rails/script/process/spinner +0 -3
- data/lib/bio/shell/rails/script/runner +0 -3
- data/lib/bio/shell/rails/script/server +0 -42
- data/lib/bio/shell/rails/test/test_helper.rb +0 -28
@@ -1,854 +0,0 @@
|
|
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
|
-
}
|