gluttonberg-core 2.6.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +29 -3
- data/Rakefile +32 -15
- data/app/assets/images/chosen-sprite-2x.png +0 -0
- data/app/assets/images/chosen-sprite.png +0 -0
- data/app/assets/images/{library/gb_sort_by_asc.png → gb_sort_by_asc.png} +0 -0
- data/app/assets/images/{library/gb_sort_by_desc.png → gb_sort_by_desc.png} +0 -0
- data/app/assets/javascripts/chosen-jquery-min.js +2 -0
- data/app/assets/javascripts/gb_360player.js +676 -0
- data/app/assets/javascripts/gb_application.js +708 -463
- data/app/assets/javascripts/gb_html5.js +9 -0
- data/app/assets/javascripts/gb_jeditable.js +356 -356
- data/app/assets/javascripts/gb_jquery-nestable.js +490 -0
- data/app/assets/javascripts/gb_utils.js +1808 -0
- data/app/assets/javascripts/gluttonberg.js +26 -0
- data/app/assets/javascripts/jcrop/css/gb_jquery-Jcrop.css +163 -31
- data/app/assets/javascripts/jcrop/js/jquery-Jcrop-min.js +19 -243
- data/app/assets/javascripts/jquery-1-10-1.js +6 -0
- data/app/assets/javascripts/jquery-ui-1-10-3.custom-min.js +6 -0
- data/app/assets/javascripts/jquery-validate.js +652 -718
- data/app/assets/javascripts/rails.js +372 -106
- data/app/assets/javascripts/redactormin.js +7348 -0
- data/app/assets/stylesheets/chosen.css +430 -0
- data/app/assets/stylesheets/gb_360player.css +2 -10
- data/app/assets/stylesheets/gb_admin-override.sass +466 -22
- data/app/assets/stylesheets/gb_bootstrap.css +7 -1
- data/app/assets/stylesheets/gluttonberg.css +17 -0
- data/app/assets/stylesheets/redactor.css +864 -0
- data/app/assets/stylesheets/user-styles.sass +0 -3
- data/app/controllers/gluttonberg/admin/asset_library/assets_ajax_controller.rb +65 -0
- data/app/controllers/gluttonberg/admin/asset_library/assets_bulk_controller.rb +47 -0
- data/app/controllers/gluttonberg/admin/asset_library/assets_controller.rb +43 -266
- data/app/controllers/gluttonberg/admin/asset_library/base_controller.rb +29 -0
- data/app/controllers/gluttonberg/admin/asset_library/collections_controller.rb +11 -37
- data/app/controllers/gluttonberg/admin/base_controller.rb +117 -178
- data/app/controllers/gluttonberg/admin/content/auto_save_controller.rb +63 -0
- data/app/controllers/gluttonberg/admin/content/flag_controller.rb +6 -6
- data/app/controllers/gluttonberg/admin/content/galleries_controller.rb +29 -37
- data/app/controllers/gluttonberg/admin/content/page_localizations_controller.rb +82 -49
- data/app/controllers/gluttonberg/admin/content/pages_controller.rb +59 -32
- data/app/controllers/gluttonberg/admin/main_controller.rb +77 -7
- data/app/controllers/gluttonberg/admin/membership/base_controller.rb +2 -1
- data/app/controllers/gluttonberg/admin/membership/groups_controller.rb +27 -33
- data/app/controllers/gluttonberg/admin/membership/main_controller.rb +3 -2
- data/app/controllers/gluttonberg/admin/membership/members_controller.rb +37 -42
- data/app/controllers/gluttonberg/admin/password_resets_controller.rb +16 -28
- data/app/controllers/gluttonberg/admin/settings/configurations_controller.rb +101 -0
- data/app/controllers/gluttonberg/admin/settings/embeds_controller.rb +79 -0
- data/app/controllers/gluttonberg/admin/settings/locales_controller.rb +22 -28
- data/app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb +31 -36
- data/app/controllers/gluttonberg/admin/settings/users_controller.rb +45 -40
- data/app/controllers/gluttonberg/base_controller.rb +95 -0
- data/app/controllers/gluttonberg/public/base_controller.rb +104 -157
- data/app/controllers/gluttonberg/public/flag_controller.rb +2 -7
- data/app/controllers/gluttonberg/public/gallery_controller.rb +1 -0
- data/app/controllers/gluttonberg/public/member_password_resets_controller.rb +5 -17
- data/app/controllers/gluttonberg/public/members_controller.rb +5 -15
- data/app/controllers/gluttonberg/public/pages_controller.rb +25 -14
- data/app/controllers/gluttonberg/public/public_assets_controller.rb +4 -2
- data/app/helpers/gluttonberg/admin.rb +86 -368
- data/app/helpers/gluttonberg/admin/assets.rb +84 -0
- data/app/helpers/gluttonberg/admin/form.rb +159 -0
- data/app/helpers/gluttonberg/admin/messages.rb +32 -0
- data/app/helpers/gluttonberg/admin/versioning.rb +196 -0
- data/app/helpers/gluttonberg/application_helper.rb +34 -7
- data/app/helpers/gluttonberg/asset_library.rb +29 -254
- data/app/helpers/gluttonberg/content_helpers.rb +17 -69
- data/app/helpers/gluttonberg/deprecated.rb +24 -0
- data/app/helpers/gluttonberg/public.rb +51 -244
- data/app/helpers/gluttonberg/public/assets.rb +31 -0
- data/app/helpers/gluttonberg/public/cms_stylesheets.rb +35 -0
- data/app/helpers/gluttonberg/public/html_truncate.rb +74 -0
- data/app/helpers/gluttonberg/public/meta_tags.rb +27 -0
- data/app/helpers/gluttonberg/public/nav_tree.rb +99 -0
- data/app/helpers/gluttonberg/public/page_info.rb +168 -0
- data/app/mailer/gluttonberg/base_notifier.rb +25 -0
- data/app/mailer/member_notifier.rb +8 -20
- data/app/mailer/notifier.rb +14 -39
- data/app/models/ability.rb +48 -34
- data/app/models/flag.rb +7 -7
- data/app/models/gluttonberg/asset.rb +115 -166
- data/app/models/gluttonberg/asset_bulk_import.rb +70 -0
- data/app/models/gluttonberg/asset_category.rb +75 -29
- data/app/models/gluttonberg/asset_collection.rb +65 -12
- data/app/models/gluttonberg/asset_mime_type.rb +5 -0
- data/app/models/gluttonberg/asset_thumbnail.rb +6 -1
- data/app/models/gluttonberg/asset_type.rb +49 -38
- data/app/models/gluttonberg/audio_asset_attribute.rb +7 -3
- data/app/models/gluttonberg/authorization.rb +10 -0
- data/app/models/gluttonberg/auto_save.rb +32 -0
- data/app/models/gluttonberg/collapsed_page.rb +13 -0
- data/app/models/gluttonberg/embed.rb +13 -0
- data/app/models/gluttonberg/feed.rb +14 -5
- data/app/models/gluttonberg/gallery.rb +35 -9
- data/app/models/gluttonberg/gallery_image.rb +9 -2
- data/app/models/gluttonberg/group.rb +18 -2
- data/app/models/gluttonberg/html_content.rb +5 -1
- data/app/models/gluttonberg/image_content.rb +5 -1
- data/app/models/gluttonberg/locale.rb +28 -9
- data/app/models/gluttonberg/member.rb +48 -197
- data/app/models/gluttonberg/page.rb +78 -288
- data/app/models/gluttonberg/page_localization.rb +63 -66
- data/app/models/gluttonberg/plain_text_content.rb +6 -0
- data/app/models/gluttonberg/repeater.rb +30 -0
- data/app/models/gluttonberg/search.rb +96 -72
- data/app/models/gluttonberg/select_content.rb +12 -0
- data/app/models/gluttonberg/setting.rb +79 -29
- data/app/models/gluttonberg/sitemap.rb +1 -0
- data/app/models/gluttonberg/stylesheet.rb +12 -6
- data/app/models/gluttonberg/textarea_content.rb +14 -0
- data/app/models/gluttonberg/version.rb +9 -0
- data/app/models/user.rb +137 -13
- data/app/observers/gluttonberg/locale_observer.rb +33 -22
- data/app/observers/gluttonberg/page_localization_observer.rb +22 -12
- data/app/observers/gluttonberg/page_observer.rb +50 -35
- data/app/views/{gluttonberg/public/exceptions → exceptions}/access_denied.html.haml +0 -0
- data/app/views/{gluttonberg/public/exceptions → exceptions}/not_found.html.haml +0 -0
- data/app/views/gluttonberg/admin/asset_library/assets/_browser_root.html.haml +17 -12
- data/app/views/gluttonberg/admin/asset_library/assets/_form.html.haml +5 -7
- data/app/views/gluttonberg/admin/asset_library/assets/browser.html.haml +5 -5
- data/app/views/gluttonberg/admin/asset_library/assets/show.html.haml +13 -7
- data/app/views/gluttonberg/admin/asset_library/assets/show.json.rabl +3 -0
- data/app/views/gluttonberg/admin/asset_library/{assets → assets_ajax}/browser_collection.json.haml +0 -0
- data/app/views/gluttonberg/admin/asset_library/{assets → assets_bulk}/add_assets_in_bulk.html.haml +6 -20
- data/app/views/gluttonberg/admin/asset_library/{assets → assets_bulk}/create_assets_in_bulk.html.haml +0 -0
- data/app/views/gluttonberg/admin/asset_library/collections/_form.html.haml +8 -5
- data/app/views/gluttonberg/admin/asset_library/shared/_asset_browser.html.haml +34 -0
- data/app/views/gluttonberg/admin/asset_library/shared/_asset_panels.html.haml +15 -11
- data/app/views/gluttonberg/admin/content/editors/_html_content.html.haml +2 -2
- data/app/views/gluttonberg/admin/content/editors/_select_content.html.haml +7 -0
- data/app/views/gluttonberg/admin/content/editors/_textarea_content.html.haml +6 -0
- data/app/views/gluttonberg/admin/content/flag/index.html.haml +48 -39
- data/app/views/gluttonberg/admin/content/galleries/_form.html.haml +46 -9
- data/app/views/gluttonberg/admin/content/galleries/_image_repeater.html.haml +30 -0
- data/app/views/gluttonberg/admin/content/galleries/edit.html.haml +1 -12
- data/app/views/gluttonberg/admin/content/galleries/index.html.haml +18 -9
- data/app/views/gluttonberg/admin/content/galleries/new.html.haml +1 -1
- data/app/views/gluttonberg/admin/content/main/_sidebar.html.haml +28 -16
- data/app/views/gluttonberg/admin/content/page_localizations/_form.html.haml +11 -20
- data/app/views/gluttonberg/admin/content/page_localizations/edit.html.haml +7 -0
- data/app/views/gluttonberg/admin/content/pages/_form.html.haml +11 -4
- data/app/views/gluttonberg/admin/content/pages/_page_settings.html.haml +4 -7
- data/app/views/gluttonberg/admin/content/pages/_row.html.haml +38 -30
- data/app/views/gluttonberg/admin/content/pages/index.html.haml +23 -15
- data/app/views/gluttonberg/admin/content/pages/pages_list_for_tinymce.html.haml +14 -3
- data/app/views/gluttonberg/admin/content/pages/show.html.haml +1 -1
- data/app/views/gluttonberg/admin/main/index.html.haml +13 -12
- data/app/views/gluttonberg/admin/main/waiting_for_approval.html.haml +33 -0
- data/app/views/gluttonberg/admin/membership/groups/index.html.haml +5 -5
- data/app/views/gluttonberg/admin/membership/members/_form.html.haml +3 -1
- data/app/views/gluttonberg/admin/membership/members/edit.html.haml +1 -0
- data/app/views/gluttonberg/admin/membership/members/index.html.haml +1 -1
- data/app/views/gluttonberg/admin/password_resets/edit.html.haml +36 -16
- data/app/views/gluttonberg/admin/password_resets/new.html.haml +19 -11
- data/app/views/gluttonberg/admin/settings/configurations/_form.html.haml +28 -0
- data/app/views/gluttonberg/admin/settings/configurations/_settings_table.html.haml +42 -0
- data/app/views/gluttonberg/admin/settings/{generic_settings → configurations}/_value_tag.html.haml +0 -0
- data/app/views/gluttonberg/admin/settings/configurations/edit.html.haml +4 -0
- data/app/views/gluttonberg/admin/settings/configurations/index.html.haml +31 -0
- data/app/views/gluttonberg/admin/settings/{generic_settings → configurations}/new.html.haml +2 -2
- data/app/views/gluttonberg/admin/settings/embeds/_form.html.haml +19 -0
- data/app/views/gluttonberg/admin/settings/embeds/edit.html.haml +12 -0
- data/app/views/gluttonberg/admin/settings/embeds/index.html.haml +36 -0
- data/app/views/gluttonberg/admin/settings/embeds/list_for_redactor.html.haml +29 -0
- data/app/views/gluttonberg/admin/settings/embeds/new.html.haml +12 -0
- data/app/views/gluttonberg/admin/settings/locales/edit.html.haml +9 -1
- data/app/views/gluttonberg/admin/settings/locales/index.html.haml +2 -1
- data/app/views/gluttonberg/admin/settings/locales/new.html.haml +10 -1
- data/app/views/gluttonberg/admin/settings/main/_sidebar.html.haml +9 -7
- data/app/views/gluttonberg/admin/settings/stylesheets/_form.html.haml +11 -9
- data/app/views/gluttonberg/admin/settings/stylesheets/edit.html.haml +11 -2
- data/app/views/gluttonberg/admin/settings/stylesheets/index.html.haml +45 -36
- data/app/views/gluttonberg/admin/settings/stylesheets/new.html.haml +11 -2
- data/app/views/gluttonberg/admin/settings/users/_form.html.haml +29 -18
- data/app/views/gluttonberg/admin/settings/users/index.html.haml +1 -1
- data/app/views/gluttonberg/admin/shared/_asset_panel.html.haml +19 -4
- data/app/views/gluttonberg/admin/shared/_auto_save_version.html.haml +12 -0
- data/app/views/gluttonberg/admin/shared/_datetime_field.html.haml +19 -0
- data/app/views/gluttonberg/admin/shared/_previous_version_warning.html.haml +5 -0
- data/app/views/gluttonberg/admin/shared/_version_alerts.html.haml +34 -0
- data/app/views/gluttonberg/admin/shared/_version_dashboard_notifications.html.haml +11 -0
- data/app/views/gluttonberg/admin/shared/_version_listing.html.haml +23 -0
- data/app/views/gluttonberg/admin/shared/delete.html.haml +21 -48
- data/app/views/gluttonberg/admin/shared/generic.html.haml +20 -19
- data/app/views/gluttonberg/admin/user_sessions/new.html.haml +14 -9
- data/app/views/gluttonberg/public/member_password_resets/edit.html.haml +2 -0
- data/app/views/gluttonberg/public/member_password_resets/new.html.haml +3 -0
- data/app/views/gluttonberg/public/members/_form.html.haml +3 -0
- data/app/views/gluttonberg/public/members/edit.html.haml +7 -9
- data/app/views/gluttonberg/public/members/show.html.haml +1 -3
- data/app/views/gluttonberg/public/pages/restrict_site_access.html.haml +3 -4
- data/app/views/gluttonberg/public/shared/_gallery_images_lis.html.haml +9 -0
- data/app/views/layouts/_flash_messages.html.haml +5 -3
- data/app/views/layouts/bare.html.haml +8 -17
- data/app/views/layouts/gluttonberg.html.haml +37 -44
- data/app/views/notifier/version_declined.html.haml +21 -0
- data/config/locales/en_au.yml +1 -1
- data/config/locales/en_gb.yml +2 -1
- data/config/routes.rb +70 -85
- data/db/migrate/20130801050257_create_repeater.rb +14 -0
- data/lib/audio_job.rb +11 -9
- data/lib/engine.rb +115 -72
- data/lib/generators/gluttonberg/resource/resource_generator.rb +51 -41
- data/lib/generators/gluttonberg/resource/templates/admin_controller.rb +16 -11
- data/lib/generators/gluttonberg/resource/templates/backend_view_edit.html.haml +7 -2
- data/lib/generators/gluttonberg/resource/templates/backend_view_form.html.haml +3 -14
- data/lib/generators/gluttonberg/resource/templates/backend_view_import.html.haml +10 -7
- data/lib/generators/gluttonberg/resource/templates/backend_view_index.html.haml +6 -5
- data/lib/generators/gluttonberg/resource/templates/backend_view_show.html.haml +2 -2
- data/lib/generators/gluttonberg/resource/templates/migration.rb +12 -1
- data/lib/generators/gluttonberg/resource/templates/model.rb +18 -1
- data/lib/generators/gluttonberg/resource/templates/public_view_index.html.haml +27 -10
- data/lib/generators/gluttonberg/resource/templates/public_view_show.html.haml +10 -4
- data/lib/gluttonberg.rb +68 -37
- data/lib/gluttonberg/can_flag.rb +64 -76
- data/lib/gluttonberg/components.rb +47 -24
- data/lib/gluttonberg/content.rb +15 -0
- data/lib/gluttonberg/content/block.rb +99 -85
- data/lib/gluttonberg/content/block_localization.rb +11 -8
- data/lib/gluttonberg/content/clean_html.rb +12 -15
- data/lib/gluttonberg/content/default_template_file.rb +44 -0
- data/lib/gluttonberg/content/despamilator/filter/naughty_words.rb +4 -2
- data/lib/gluttonberg/content/home_page_info.rb +39 -0
- data/lib/gluttonberg/content/import_export_csv.rb +243 -130
- data/lib/gluttonberg/content/localization.rb +137 -148
- data/lib/gluttonberg/content/page_children.rb +36 -0
- data/lib/gluttonberg/content/page_components.rb +23 -0
- data/lib/gluttonberg/content/page_description_info.rb +55 -0
- data/lib/gluttonberg/content/page_duplicate.rb +68 -0
- data/lib/gluttonberg/content/page_finder.rb +63 -0
- data/lib/gluttonberg/content/page_localization_slug.rb +89 -0
- data/lib/gluttonberg/content/page_repairer.rb +117 -0
- data/lib/gluttonberg/content/publishable.rb +77 -71
- data/lib/gluttonberg/content/slug_management.rb +74 -26
- data/lib/gluttonberg/content/validations.rb +58 -0
- data/lib/gluttonberg/content/versioning.rb +40 -22
- data/lib/gluttonberg/drag_tree.rb +0 -1
- data/lib/gluttonberg/drag_tree/action_controller.rb +49 -37
- data/lib/gluttonberg/drag_tree/action_view.rb +0 -6
- data/lib/gluttonberg/drag_tree/active_record.rb +49 -49
- data/lib/gluttonberg/extensions.rb +1 -0
- data/lib/gluttonberg/extensions/string.rb +20 -0
- data/lib/gluttonberg/gb_file.rb +30 -0
- data/lib/gluttonberg/helpers/form_builder.rb +91 -38
- data/lib/gluttonberg/library.rb +9 -90
- data/lib/gluttonberg/library/attachment_mixin.rb +88 -98
- data/lib/gluttonberg/library/config/image_sizes.rb +22 -19
- data/lib/gluttonberg/library/default_asset_types.rb +104 -0
- data/lib/gluttonberg/library/processor/audio.rb +32 -16
- data/lib/gluttonberg/library/processor/image.rb +78 -69
- data/lib/gluttonberg/library/quick_magick/image.rb +72 -319
- data/lib/gluttonberg/library/quick_magick/image/draw.rb +133 -0
- data/lib/gluttonberg/library/quick_magick/image/operators_and_settings.rb +78 -0
- data/lib/gluttonberg/library/quick_magick/image/serialization.rb +79 -0
- data/lib/gluttonberg/library/quick_magick/image_list.rb +0 -1
- data/lib/gluttonberg/library/storage/filesystem.rb +45 -46
- data/lib/gluttonberg/library/storage/s3.rb +123 -119
- data/lib/gluttonberg/membership.rb +9 -0
- data/lib/gluttonberg/membership/export.rb +82 -0
- data/lib/gluttonberg/membership/import.rb +179 -0
- data/lib/gluttonberg/middleware/honeypot.rb +1 -2
- data/lib/gluttonberg/middleware/locales.rb +69 -18
- data/lib/gluttonberg/middleware/rewriter.rb +57 -16
- data/lib/gluttonberg/mixin_manager.rb +19 -0
- data/lib/gluttonberg/page_description.rb +82 -112
- data/lib/gluttonberg/random_string_generator.rb +31 -0
- data/lib/gluttonberg/record_history.rb +5 -7
- data/lib/gluttonberg/tasks/asset.rake +19 -8
- data/lib/gluttonberg/tasks/gluttonberg.rake +167 -13
- data/lib/gluttonberg/templates.rb +1 -3
- data/lib/gluttonberg/version.rb +1 -1
- data/lib/photo_job.rb +16 -0
- data/spec/controllers/auto_save_controller_spec.rb +57 -0
- data/spec/controllers/record_history_spec.rb +75 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/admin/staff_profiles_controller.rb +56 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/staff_profile.rb +20 -0
- data/spec/dummy/app/models/vendor_mixin.rb +14 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +18 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/gluttonberg_advance_settings.rb +73 -0
- data/spec/dummy/config/initializers/gluttonberg_basic_settings.rb +65 -0
- data/spec/dummy/config/initializers/gluttonberg_menu_settings.rb +1 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/{lib/generators/gluttonberg/installer/templates → spec/dummy/config}/page_descriptions.rb +103 -65
- data/spec/dummy/config/routes.rb +10 -0
- data/spec/dummy/db/20130625060411_create_staff_profile.rb +35 -0
- data/spec/dummy/db/schema.rb +474 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/tmp/cache/041/891/setting_library_number_of_recent_assets +0 -0
- data/spec/dummy/tmp/cache/08E/741/setting_comment_number_of_emails_allowed +0 -0
- data/spec/dummy/tmp/cache/580/D10/setting_title +0 -0
- data/spec/dummy/tmp/cache/62E/160/setting_fb_icon +0 -0
- data/spec/dummy/tmp/cache/6D6/FB0/setting_keywords +0 -0
- data/spec/dummy/tmp/cache/6D8/B60/setting_s3_key_id +0 -0
- data/spec/dummy/tmp/cache/6E1/A40/setting_s3_bucket +0 -0
- data/spec/dummy/tmp/cache/779/DF0/setting_from_email +0 -0
- data/spec/dummy/tmp/cache/7C5/450/setting_title_site1 +0 -0
- data/spec/dummy/tmp/cache/7C6/460/setting_title_site2 +0 -0
- data/spec/dummy/tmp/cache/802/000/setting_description +0 -0
- data/spec/dummy/tmp/cache/836/DD0/setting_backend_logo +0 -0
- data/spec/dummy/tmp/cache/862/FA0/setting_audio_assets +1 -0
- data/spec/dummy/tmp/cache/867/4E0/setting_video_assets +0 -0
- data/spec/dummy/tmp/cache/867/710/setting_enable_WYSIWYG +0 -0
- data/spec/dummy/tmp/cache/873/9E0/setting_fb_icon_site1 +0 -0
- data/spec/dummy/tmp/cache/874/9F0/setting_fb_icon_site2 +0 -0
- data/spec/dummy/tmp/cache/87D/A10/setting_s3_access_key +0 -0
- data/spec/dummy/tmp/cache/8AC/280/setting_s3_server_url +0 -0
- data/spec/dummy/tmp/cache/91B/730/setting_keywords_site1 +0 -0
- data/spec/dummy/tmp/cache/91C/740/setting_keywords_site2 +0 -0
- data/spec/dummy/tmp/cache/933/980/setting_auto_save_time +0 -0
- data/spec/dummy/tmp/cache/9BE/290/setting_from_email_site1 +0 -0
- data/spec/dummy/tmp/cache/9BF/2A0/setting_from_email_site2 +0 -0
- data/spec/dummy/tmp/cache/A02/5E0/setting_google_analytics +0 -0
- data/spec/dummy/tmp/cache/A47/800/setting_description_site1 +0 -0
- data/spec/dummy/tmp/cache/A48/810/setting_description_site2 +0 -0
- data/spec/dummy/tmp/cache/A69/B60/setting_comment_blacklist +0 -0
- data/spec/dummy/tmp/cache/B5C/D40/setting_number_of_revisions +0 -0
- data/spec/dummy/tmp/cache/BB3/350/setting_restrict_site_access +0 -0
- data/spec/dummy/tmp/cache/BB7/620/setting_comment_notification +0 -0
- data/spec/dummy/tmp/cache/BFB/140/setting_comment_email_as_spam +0 -0
- data/spec/dummy/tmp/cache/C47/DE0/setting_google_analytics_site1 +0 -0
- data/spec/dummy/tmp/cache/C48/DF0/setting_google_analytics_site2 +0 -0
- data/spec/dummy/tmp/cache/D3E/E20/setting_number_of_per_page_items +0 -0
- data/spec/dummy/tmp/cache/DF8/DB0/setting_restrict_site_access_site1 +0 -0
- data/spec/dummy/tmp/cache/DF9/DC0/setting_restrict_site_access_site2 +0 -0
- data/spec/dummy/tmp/cache/DFC/200/setting_comment_notification_site1 +0 -0
- data/spec/dummy/tmp/cache/DFD/210/setting_comment_notification_site2 +0 -0
- data/spec/dummy/tmp/cache/FD9/200/setting_comment_number_of_urls_allowed +0 -0
- data/spec/fixtures/assets/assets_import.zip +0 -0
- data/spec/fixtures/assets/audio.mp3 +0 -0
- data/spec/fixtures/assets/c3-add-interactive.mov +0 -0
- data/spec/fixtures/assets/gb_banner.jpg +0 -0
- data/spec/fixtures/assets/gb_logo.png +0 -0
- data/spec/fixtures/assets/high_res_photo.jpg +0 -0
- data/spec/fixtures/assets/untitled +0 -0
- data/spec/fixtures/members.csv +5 -0
- data/spec/fixtures/staff_profiles.csv +4 -0
- data/spec/helpers/public/assets_spec.rb +73 -0
- data/spec/helpers/public/content_helpers_spec.rb +71 -0
- data/spec/helpers/public/html_truncate_spec.rb +37 -0
- data/spec/helpers/public/meta_tags_spec.rb +29 -0
- data/spec/helpers/public/page_info_spec.rb +233 -0
- data/spec/helpers/public_spec.rb +114 -0
- data/spec/lib/content/import_export_csv_spec.rb +177 -0
- data/spec/lib/content/localization_spec.rb +107 -0
- data/spec/lib/content/page_finder_spec.rb +71 -0
- data/spec/lib/content/page_repairer_spec.rb +151 -0
- data/spec/lib/content/publishable_spec.rb +54 -0
- data/spec/lib/content/validations_spec.rb +88 -0
- data/spec/lib/drag_tree/action_controller_spec.rb +137 -0
- data/spec/lib/drag_tree/active_record_spec.rb +86 -0
- data/spec/lib/library/s3_rspec.rb +78 -0
- data/spec/lib/membership/export_spec.rb +89 -0
- data/spec/lib/membership/import_spec.rb +68 -0
- data/spec/lib/middleware/locales_spec.rb +192 -0
- data/spec/lib/middleware/rewriter_spec.rb +186 -0
- data/spec/lib/page_description_spec.rb +68 -0
- data/spec/mailers/member_notifier_spec.rb +140 -0
- data/spec/mailers/notifier_spec.rb +86 -0
- data/spec/models/asset_bulk_import_spec.rb +43 -0
- data/spec/models/asset_category_spec.rb +77 -0
- data/spec/models/asset_collection_spec.rb +72 -0
- data/spec/models/asset_spec.rb +278 -0
- data/spec/models/asset_type_spec.rb +109 -0
- data/spec/models/member_spec.rb +128 -0
- data/spec/models/page_localization_spec.rb +81 -0
- data/spec/models/page_spec.rb +221 -0
- data/spec/models/setting_spec.rb +49 -0
- data/spec/models/user_spec.rb +385 -0
- data/spec/observers/locale_observer_spec.rb +79 -0
- data/spec/observers/page_localization_observer_spec.rb +87 -0
- data/spec/observers/page_observer_spec.rb +130 -0
- data/spec/spec_helper.rb +90 -0
- metadata +508 -331
- data/app/assets/images/gb_360-button-pause-light.gif +0 -0
- data/app/assets/images/gb_360-button-pause-light.png +0 -0
- data/app/assets/images/gb_360-button-pause.gif +0 -0
- data/app/assets/images/gb_360-button-pause.png +0 -0
- data/app/assets/images/gb_360-button-play-light.gif +0 -0
- data/app/assets/images/gb_360-button-play-light.png +0 -0
- data/app/assets/images/gb_360-button-play.gif +0 -0
- data/app/assets/images/gb_360-button-play.png +0 -0
- data/app/assets/images/gb_360-button-vis-pause-light.gif +0 -0
- data/app/assets/images/gb_360-button-vis-pause-light.png +0 -0
- data/app/assets/images/gb_360-button-vis-pause.gif +0 -0
- data/app/assets/images/gb_360-button-vis-pause.png +0 -0
- data/app/assets/images/gb_360-button-vis-play-light.gif +0 -0
- data/app/assets/images/gb_360-button-vis-play-light.png +0 -0
- data/app/assets/images/gb_360-button-vis-play.gif +0 -0
- data/app/assets/images/gb_360-button-vis-play.png +0 -0
- data/app/assets/images/gb_button_bkg_grey.gif +0 -0
- data/app/assets/images/gb_icon_content_2.png +0 -0
- data/app/assets/images/gb_icon_dash.png +0 -0
- data/app/assets/images/gb_icon_library_2.png +0 -0
- data/app/assets/images/gb_page_content_fillin.gif +0 -0
- data/app/assets/images/gb_spinner_for_dialouge.gif +0 -0
- data/app/assets/images/gb_sub_nav_back_bkg.gif +0 -0
- data/app/assets/images/gb_subnav_bkg.gif +0 -0
- data/app/assets/images/gb_table_head_bkg.gif +0 -0
- data/app/assets/images/gb_wrapper_bkg.png +0 -0
- data/app/assets/images/gb_wysiwyg.png +0 -0
- data/app/assets/images/help/gb_help.jpg +0 -0
- data/app/assets/images/icons/gb_collapsed.png +0 -0
- data/app/assets/images/icons/gb_expanded.png +0 -0
- data/app/assets/images/library/gb_back.gif +0 -0
- data/app/assets/images/library/gb_dialog_overlay.png +0 -0
- data/app/assets/images/library/gb_inactive_tab.jpg +0 -0
- data/app/assets/images/library/gb_search_icon.gif +0 -0
- data/app/assets/images/library/gb_wysiwyg_pic.png +0 -0
- data/app/assets/javascripts/gb_ajaxfileupload.js +0 -205
- data/app/assets/javascripts/gb_berniecode-animator.js +0 -674
- data/app/assets/javascripts/gb_bootstrap-datepicker.js +0 -501
- data/app/assets/javascripts/gb_expander.js +0 -81
- data/app/assets/javascripts/gb_jquery-dragTree.js +0 -525
- data/app/assets/javascripts/gb_jquery-tagarea.js +0 -404
- data/app/assets/javascripts/gb_login.js +0 -33
- data/app/assets/javascripts/gb_tags.js +0 -177
- data/app/assets/javascripts/jquery-1-7-1.js +0 -9267
- data/app/assets/javascripts/jquery-dimensions-min.js +0 -12
- data/app/assets/javascripts/jquery-ui-1-8-23-custom-min.js +0 -85
- data/app/assets/javascripts/tiny_mce/jquery.tinymce.js +0 -1
- data/app/assets/javascripts/tiny_mce/langs/en.js +0 -223
- data/app/assets/javascripts/tiny_mce/plugins/advhr/css/advhr.css +0 -5
- data/app/assets/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/advhr/js/rule.js +0 -43
- data/app/assets/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +0 -7
- data/app/assets/javascripts/tiny_mce/plugins/advhr/rule.htm +0 -58
- data/app/assets/javascripts/tiny_mce/plugins/advlink/css/advlink.css +0 -8
- data/app/assets/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +0 -61
- data/app/assets/javascripts/tiny_mce/plugins/advlink/js/advlink.js +0 -564
- data/app/assets/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +0 -54
- data/app/assets/javascripts/tiny_mce/plugins/advlink/link.htm +0 -355
- data/app/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +0 -109
- data/app/assets/javascripts/tiny_mce/plugins/gb_assets/editor_plugin.js +0 -47
- data/app/assets/javascripts/tiny_mce/plugins/gb_assets/editor_plugin_src.js +0 -43
- data/app/assets/javascripts/tiny_mce/plugins/gb_assets/emotions.htm +0 -41
- data/app/assets/javascripts/tiny_mce/plugins/gb_assets/js/emotions.js +0 -22
- data/app/assets/javascripts/tiny_mce/plugins/gb_assets/langs/en_dlg.js +0 -20
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -90
- data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/template.htm +0 -387
- data/app/assets/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/lists/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/paste/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/paste/js/pastetext.js +0 -36
- data/app/assets/javascripts/tiny_mce/plugins/paste/js/pasteword.js +0 -51
- data/app/assets/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +0 -5
- data/app/assets/javascripts/tiny_mce/plugins/paste/pastetext.htm +0 -27
- data/app/assets/javascripts/tiny_mce/plugins/paste/pasteword.htm +0 -21
- data/app/assets/javascripts/tiny_mce/plugins/preview/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +0 -73
- data/app/assets/javascripts/tiny_mce/plugins/preview/preview.html +0 -18
- data/app/assets/javascripts/tiny_mce/plugins/style/css/props.css +0 -13
- data/app/assets/javascripts/tiny_mce/plugins/style/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/style/js/props.js +0 -635
- data/app/assets/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +0 -70
- data/app/assets/javascripts/tiny_mce/plugins/style/props.htm +0 -838
- data/app/assets/javascripts/tiny_mce/plugins/table/cell.htm +0 -180
- data/app/assets/javascripts/tiny_mce/plugins/table/css/cell.css +0 -17
- data/app/assets/javascripts/tiny_mce/plugins/table/css/row.css +0 -25
- data/app/assets/javascripts/tiny_mce/plugins/table/css/table.css +0 -13
- data/app/assets/javascripts/tiny_mce/plugins/table/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/plugins/table/js/cell.js +0 -319
- data/app/assets/javascripts/tiny_mce/plugins/table/js/merge_cells.js +0 -27
- data/app/assets/javascripts/tiny_mce/plugins/table/js/row.js +0 -237
- data/app/assets/javascripts/tiny_mce/plugins/table/js/table.js +0 -450
- data/app/assets/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +0 -75
- data/app/assets/javascripts/tiny_mce/plugins/table/merge_cells.htm +0 -32
- data/app/assets/javascripts/tiny_mce/plugins/table/row.htm +0 -158
- data/app/assets/javascripts/tiny_mce/plugins/table/table.htm +0 -188
- data/app/assets/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +0 -1
- data/app/assets/javascripts/tiny_mce/themes/advanced/anchor.htm +0 -26
- data/app/assets/javascripts/tiny_mce/themes/advanced/editor_template.js +0 -1
- data/app/assets/javascripts/tiny_mce/themes/advanced/editor_template_src.js +0 -1358
- data/app/assets/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/app/assets/javascripts/tiny_mce/themes/advanced/img/trans.gif +0 -0
- data/app/assets/javascripts/tiny_mce/themes/advanced/js/anchor.js +0 -42
- data/app/assets/javascripts/tiny_mce/themes/advanced/js/link.js +0 -153
- data/app/assets/javascripts/tiny_mce/themes/advanced/js/source_editor.js +0 -56
- data/app/assets/javascripts/tiny_mce/themes/advanced/langs/en.js +0 -68
- data/app/assets/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +0 -54
- data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/content.css +0 -47
- data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +0 -117
- data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +0 -227
- data/app/assets/javascripts/tiny_mce/themes/advanced/source_editor.htm +0 -25
- data/app/assets/javascripts/tiny_mce/tiny_mce.js +0 -1
- data/app/assets/javascripts/tiny_mce/tiny_mce_popup.js +0 -5
- data/app/assets/javascripts/tiny_mce/utils/editable_selects.js +0 -70
- data/app/assets/javascripts/tiny_mce/utils/form_utils.js +0 -210
- data/app/assets/javascripts/tiny_mce/utils/mctabs.js +0 -162
- data/app/assets/javascripts/tiny_mce/utils/validate.js +0 -252
- data/app/controllers/gluttonberg/admin/content/articles_controller.rb +0 -139
- data/app/controllers/gluttonberg/admin/content/blogs_controller.rb +0 -101
- data/app/controllers/gluttonberg/admin/content/comments_controller.rb +0 -130
- data/app/controllers/gluttonberg/admin/content/main_controller.rb +0 -13
- data/app/controllers/gluttonberg/admin/help_controller.rb +0 -15
- data/app/controllers/gluttonberg/admin/settings/generic_settings_controller.rb +0 -90
- data/app/controllers/gluttonberg/admin/settings/main_controller.rb +0 -11
- data/app/controllers/gluttonberg/public/articles_controller.rb +0 -79
- data/app/controllers/gluttonberg/public/blogs_controller.rb +0 -44
- data/app/controllers/gluttonberg/public/comments_controller.rb +0 -46
- data/app/models/gluttonberg/article.rb +0 -73
- data/app/models/gluttonberg/article_localization.rb +0 -21
- data/app/models/gluttonberg/blog.rb +0 -19
- data/app/models/gluttonberg/comment.rb +0 -142
- data/app/models/gluttonberg/comment_subscription.rb +0 -28
- data/app/models/gluttonberg/help.rb +0 -48
- data/app/views/gluttonberg/admin/content/articles/_form.html.haml +0 -115
- data/app/views/gluttonberg/admin/content/articles/edit.html.haml +0 -11
- data/app/views/gluttonberg/admin/content/articles/index.html.haml +0 -71
- data/app/views/gluttonberg/admin/content/articles/new.html.haml +0 -11
- data/app/views/gluttonberg/admin/content/blogs/_form.html.haml +0 -56
- data/app/views/gluttonberg/admin/content/blogs/edit.html.haml +0 -3
- data/app/views/gluttonberg/admin/content/blogs/index.html.haml +0 -35
- data/app/views/gluttonberg/admin/content/blogs/new.html.haml +0 -10
- data/app/views/gluttonberg/admin/content/comments/index.html.haml +0 -66
- data/app/views/gluttonberg/admin/content/galleries/_images_list.html.haml +0 -21
- data/app/views/gluttonberg/admin/content/galleries/add_image.html.haml +0 -1
- data/app/views/gluttonberg/admin/content/main/index.html.haml +0 -20
- data/app/views/gluttonberg/admin/content/pages/edit_home.html.haml +0 -11
- data/app/views/gluttonberg/admin/exceptions/internal_server_error.html.haml +0 -11
- data/app/views/gluttonberg/admin/exceptions/not_acceptable.html.haml +0 -9
- data/app/views/gluttonberg/admin/membership/main/index.html.haml +0 -11
- data/app/views/gluttonberg/admin/settings/generic_settings/_form.html.haml +0 -26
- data/app/views/gluttonberg/admin/settings/generic_settings/edit.html.haml +0 -4
- data/app/views/gluttonberg/admin/settings/generic_settings/index.html.haml +0 -58
- data/app/views/gluttonberg/admin/settings/main/index.html.haml +0 -18
- data/app/views/gluttonberg/public/articles/index.rss.builder +0 -21
- data/app/views/gluttonberg/public/blogs/show.rss.builder +0 -21
- data/app/views/gluttonberg/public/exceptions/internal_server_error.html.haml +0 -11
- data/app/views/gluttonberg/public/exceptions/not_acceptable.html.haml +0 -9
- data/app/views/help/gluttonberg/admin/AssetLibrary/assets/add_assets_in_bulk.html.haml +0 -41
- data/app/views/help/gluttonberg/admin/AssetLibrary/assets/edit.html.haml +0 -61
- data/app/views/help/gluttonberg/admin/AssetLibrary/assets/index.html.haml +0 -16
- data/app/views/help/gluttonberg/admin/AssetLibrary/assets/new.html.haml +0 -57
- data/app/views/help/gluttonberg/admin/AssetLibrary/collections/edit.html.haml +0 -15
- data/app/views/help/gluttonberg/admin/AssetLibrary/collections/index.html.haml +0 -41
- data/app/views/help/gluttonberg/admin/AssetLibrary/collections/new.html.haml +0 -15
- data/app/views/help/gluttonberg/admin/AssetLibrary/main/index.html.haml +0 -34
- data/app/views/help/gluttonberg/admin/content/page_localizations/edit.html.haml +0 -89
- data/app/views/help/gluttonberg/admin/content/pages/_page_description_help.html.haml +0 -14
- data/app/views/help/gluttonberg/admin/content/pages/edit.html.haml +0 -62
- data/app/views/help/gluttonberg/admin/content/pages/index.html.haml +0 -111
- data/app/views/help/gluttonberg/admin/content/pages/new.html.haml +0 -61
- data/app/views/help/gluttonberg/admin/settings/dialects/edit.html.haml +0 -47
- data/app/views/help/gluttonberg/admin/settings/dialects/index.html.haml +0 -50
- data/app/views/help/gluttonberg/admin/settings/dialects/new.html.haml +0 -47
- data/app/views/help/gluttonberg/admin/settings/generic_settings/index.html.haml +0 -74
- data/app/views/help/gluttonberg/admin/settings/locales/edit.html.haml +0 -71
- data/app/views/help/gluttonberg/admin/settings/locales/index.html.haml +0 -57
- data/app/views/help/gluttonberg/admin/settings/locales/new.html.haml +0 -71
- data/app/views/help/gluttonberg/admin/settings/users/edit.html.haml +0 -63
- data/app/views/help/gluttonberg/admin/settings/users/index.html.haml +0 -60
- data/app/views/help/gluttonberg/admin/settings/users/new.html.haml +0 -69
- data/app/views/notifier/comment_notification.html.haml +0 -17
- data/app/views/notifier/comment_notification_for_admin.html.haml +0 -19
- data/db/migrate/20121106025800_add_artist_and_link_to_assets.rb +0 -6
- data/lib/acts_as_versioned.rb +0 -496
- data/lib/generators/gluttonberg/blog/blog_generator.rb +0 -46
- data/lib/generators/gluttonberg/blog/templates/articles_index.html.haml +0 -18
- data/lib/generators/gluttonberg/blog/templates/articles_show.html.haml +0 -63
- data/lib/generators/gluttonberg/blog/templates/articles_tag.html.haml +0 -24
- data/lib/generators/gluttonberg/blog/templates/blog_migration.rb +0 -90
- data/lib/generators/gluttonberg/blog/templates/blogs_index.html.haml +0 -15
- data/lib/generators/gluttonberg/blog/templates/blogs_show.html.haml +0 -25
- data/lib/generators/gluttonberg/installer/USAGE +0 -1
- data/lib/generators/gluttonberg/installer/installer_generator.rb +0 -106
- data/lib/generators/gluttonberg/installer/templates/delayed_job_script +0 -5
- data/lib/generators/gluttonberg/installer/templates/gluttonberg_migration.rb +0 -368
- data/lib/generators/gluttonberg/installer/templates/public.html.haml +0 -24
- data/lib/generators/gluttonberg/installer/templates/sitemap.rb +0 -70
- data/lib/gluttonberg/authorizable.rb +0 -51
- data/lib/gluttonberg/helpers.rb +0 -20
- data/lib/rails/railties/tasks.rake +0 -3
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,205 +0,0 @@
|
|
1
|
-
|
2
|
-
jQuery.extend({
|
3
|
-
|
4
|
-
|
5
|
-
createUploadIframe: function(id, uri)
|
6
|
-
{
|
7
|
-
//create frame
|
8
|
-
var frameId = 'jUploadFrame' + id;
|
9
|
-
var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
|
10
|
-
if(window.ActiveXObject)
|
11
|
-
{
|
12
|
-
if(typeof uri== 'boolean'){
|
13
|
-
iframeHtml += ' src="' + 'javascript:false' + '"';
|
14
|
-
|
15
|
-
}
|
16
|
-
else if(typeof uri== 'string'){
|
17
|
-
iframeHtml += ' src="' + uri + '"';
|
18
|
-
|
19
|
-
}
|
20
|
-
}
|
21
|
-
iframeHtml += ' />';
|
22
|
-
jQuery(iframeHtml).appendTo(document.body);
|
23
|
-
|
24
|
-
return jQuery('#' + frameId).get(0);
|
25
|
-
},
|
26
|
-
createUploadForm: function(id, fileElementId, data)
|
27
|
-
{
|
28
|
-
//create form
|
29
|
-
var formId = 'jUploadForm' + id;
|
30
|
-
var fileId = 'jUploadFile' + id;
|
31
|
-
var form = jQuery('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');
|
32
|
-
if(data)
|
33
|
-
{
|
34
|
-
for(var i in data)
|
35
|
-
{
|
36
|
-
jQuery('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
var oldElement = jQuery('#' + fileElementId);
|
40
|
-
var newElement = jQuery(oldElement).clone();
|
41
|
-
jQuery(oldElement).attr('id', fileId);
|
42
|
-
jQuery(oldElement).before(newElement);
|
43
|
-
jQuery(oldElement).appendTo(form);
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
//set attributes
|
48
|
-
jQuery(form).css('position', 'absolute');
|
49
|
-
jQuery(form).css('top', '-1200px');
|
50
|
-
jQuery(form).css('left', '-1200px');
|
51
|
-
jQuery(form).appendTo('body');
|
52
|
-
return form;
|
53
|
-
},
|
54
|
-
|
55
|
-
ajaxFileUpload: function(s) {
|
56
|
-
// TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
|
57
|
-
s = jQuery.extend({}, jQuery.ajaxSettings, s);
|
58
|
-
var id = new Date().getTime()
|
59
|
-
var form = jQuery.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data));
|
60
|
-
var io = jQuery.createUploadIframe(id, s.secureuri);
|
61
|
-
var frameId = 'jUploadFrame' + id;
|
62
|
-
var formId = 'jUploadForm' + id;
|
63
|
-
// Watch for a new set of requests
|
64
|
-
if ( s.global && ! jQuery.active++ )
|
65
|
-
{
|
66
|
-
jQuery.event.trigger( "ajaxStart" );
|
67
|
-
}
|
68
|
-
var requestDone = false;
|
69
|
-
// Create the request object
|
70
|
-
var xml = {}
|
71
|
-
if ( s.global )
|
72
|
-
jQuery.event.trigger("ajaxSend", [xml, s]);
|
73
|
-
// Wait for a response to come back
|
74
|
-
var uploadCallback = function(isTimeout)
|
75
|
-
{
|
76
|
-
var io = document.getElementById(frameId);
|
77
|
-
try
|
78
|
-
{
|
79
|
-
if(io.contentWindow)
|
80
|
-
{
|
81
|
-
xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
|
82
|
-
xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
|
83
|
-
|
84
|
-
}else if(io.contentDocument)
|
85
|
-
{
|
86
|
-
xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
|
87
|
-
xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
|
88
|
-
}
|
89
|
-
}catch(e)
|
90
|
-
{
|
91
|
-
jQuery.handleError(s, xml, null, e);
|
92
|
-
}
|
93
|
-
if ( xml || isTimeout == "timeout")
|
94
|
-
{
|
95
|
-
requestDone = true;
|
96
|
-
var status;
|
97
|
-
try {
|
98
|
-
status = isTimeout != "timeout" ? "success" : "error";
|
99
|
-
// Make sure that the request was successful or notmodified
|
100
|
-
if ( status != "error" )
|
101
|
-
{
|
102
|
-
// process the data (runs the xml through httpData regardless of callback)
|
103
|
-
var data = jQuery.uploadHttpData( xml, s.dataType );
|
104
|
-
// If a local callback was specified, fire it and pass it the data
|
105
|
-
if ( s.success )
|
106
|
-
s.success( data, status );
|
107
|
-
|
108
|
-
// Fire the global callback
|
109
|
-
if( s.global )
|
110
|
-
jQuery.event.trigger( "ajaxSuccess", [xml, s] );
|
111
|
-
} else
|
112
|
-
jQuery.handleError(s, xml, status);
|
113
|
-
} catch(e)
|
114
|
-
{
|
115
|
-
status = "error";
|
116
|
-
jQuery.handleError(s, xml, status, e);
|
117
|
-
}
|
118
|
-
|
119
|
-
// The request was completed
|
120
|
-
if( s.global )
|
121
|
-
jQuery.event.trigger( "ajaxComplete", [xml, s] );
|
122
|
-
|
123
|
-
// Handle the global AJAX counter
|
124
|
-
if ( s.global && ! --jQuery.active )
|
125
|
-
jQuery.event.trigger( "ajaxStop" );
|
126
|
-
|
127
|
-
// Process result
|
128
|
-
if ( s.complete )
|
129
|
-
s.complete(xml, status);
|
130
|
-
|
131
|
-
jQuery(io).unbind()
|
132
|
-
|
133
|
-
setTimeout(function()
|
134
|
-
{ try
|
135
|
-
{
|
136
|
-
jQuery(io).remove();
|
137
|
-
jQuery(form).remove();
|
138
|
-
|
139
|
-
} catch(e)
|
140
|
-
{
|
141
|
-
jQuery.handleError(s, xml, null, e);
|
142
|
-
}
|
143
|
-
|
144
|
-
}, 100)
|
145
|
-
|
146
|
-
xml = null
|
147
|
-
|
148
|
-
}
|
149
|
-
}
|
150
|
-
// Timeout checker
|
151
|
-
if ( s.timeout > 0 )
|
152
|
-
{
|
153
|
-
setTimeout(function(){
|
154
|
-
// Check to see if the request is still happening
|
155
|
-
if( !requestDone ) uploadCallback( "timeout" );
|
156
|
-
}, s.timeout);
|
157
|
-
}
|
158
|
-
try
|
159
|
-
{
|
160
|
-
|
161
|
-
var form = jQuery('#' + formId);
|
162
|
-
jQuery(form).attr('action', s.url);
|
163
|
-
jQuery(form).attr('method', 'POST');
|
164
|
-
jQuery(form).attr('target', frameId);
|
165
|
-
if(form.encoding)
|
166
|
-
{
|
167
|
-
jQuery(form).attr('encoding', 'multipart/form-data');
|
168
|
-
}
|
169
|
-
else
|
170
|
-
{
|
171
|
-
jQuery(form).attr('enctype', 'multipart/form-data');
|
172
|
-
}
|
173
|
-
jQuery(form).submit();
|
174
|
-
|
175
|
-
} catch(e)
|
176
|
-
{
|
177
|
-
jQuery.handleError(s, xml, null, e);
|
178
|
-
}
|
179
|
-
|
180
|
-
jQuery('#' + frameId).load(uploadCallback );
|
181
|
-
return {abort: function () {}};
|
182
|
-
|
183
|
-
},
|
184
|
-
|
185
|
-
uploadHttpData: function( r, type ) {
|
186
|
-
var data = !type;
|
187
|
-
data = type == "xml" || data ? r.responseXML : r.responseText;
|
188
|
-
// If the type is "script", eval it in global context
|
189
|
-
if ( type == "script" )
|
190
|
-
jQuery.globalEval( data );
|
191
|
-
// Get the JavaScript object, if JSON is used.
|
192
|
-
if ( type == "json" ){
|
193
|
-
data = data.replace('<pre style="word-wrap: break-word; white-space: pre-wrap;">' , "");
|
194
|
-
data = data.replace("</pre>" , "");
|
195
|
-
//eval( "data = " + data );
|
196
|
-
data = jQuery.parseJSON(data);
|
197
|
-
}
|
198
|
-
// evaluate scripts within html
|
199
|
-
if ( type == "html" )
|
200
|
-
jQuery("<div>").html(data).evalScripts();
|
201
|
-
|
202
|
-
return data;
|
203
|
-
}
|
204
|
-
})
|
205
|
-
|
@@ -1,674 +0,0 @@
|
|
1
|
-
/** @license
|
2
|
-
Animator.js 1.1.9
|
3
|
-
|
4
|
-
This library is released under the BSD license:
|
5
|
-
|
6
|
-
Copyright (c) 2006, Bernard Sumption. All rights reserved.
|
7
|
-
|
8
|
-
Redistribution and use in source and binary forms, with or without
|
9
|
-
modification, are permitted provided that the following conditions are met:
|
10
|
-
|
11
|
-
Redistributions of source code must retain the above copyright notice, this
|
12
|
-
list of conditions and the following disclaimer. Redistributions in binary
|
13
|
-
form must reproduce the above copyright notice, this list of conditions and
|
14
|
-
the following disclaimer in the documentation and/or other materials
|
15
|
-
provided with the distribution. Neither the name BernieCode nor
|
16
|
-
the names of its contributors may be used to endorse or promote products
|
17
|
-
derived from this software without specific prior written permission.
|
18
|
-
|
19
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
23
|
-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
25
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
27
|
-
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
28
|
-
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
29
|
-
DAMAGE.
|
30
|
-
|
31
|
-
*/
|
32
|
-
|
33
|
-
// http://www.berniecode.com/writing/animator.html
|
34
|
-
|
35
|
-
// Applies a sequence of numbers between 0 and 1 to a number of subjects
|
36
|
-
// construct - see setOptions for parameters
|
37
|
-
function Animator(options) {
|
38
|
-
this.setOptions(options);
|
39
|
-
var _this = this;
|
40
|
-
this.timerDelegate = function(){_this.onTimerEvent()};
|
41
|
-
this.subjects = [];
|
42
|
-
this.subjectScopes = [];
|
43
|
-
this.target = 0;
|
44
|
-
this.state = 0;
|
45
|
-
this.lastTime = null;
|
46
|
-
};
|
47
|
-
Animator.prototype = {
|
48
|
-
// apply defaults
|
49
|
-
setOptions: function(options) {
|
50
|
-
this.options = Animator.applyDefaults({
|
51
|
-
interval: 20, // time between animation frames
|
52
|
-
duration: 400, // length of animation
|
53
|
-
onComplete: function(){},
|
54
|
-
onStep: function(){},
|
55
|
-
transition: Animator.tx.easeInOut
|
56
|
-
}, options);
|
57
|
-
},
|
58
|
-
// animate from the current state to provided value
|
59
|
-
seekTo: function(to) {
|
60
|
-
this.seekFromTo(this.state, to);
|
61
|
-
},
|
62
|
-
// animate from the current state to provided value
|
63
|
-
seekFromTo: function(from, to) {
|
64
|
-
this.target = Math.max(0, Math.min(1, to));
|
65
|
-
this.state = Math.max(0, Math.min(1, from));
|
66
|
-
this.lastTime = new Date().getTime();
|
67
|
-
if (!this.intervalId) {
|
68
|
-
this.intervalId = window.setInterval(this.timerDelegate, this.options.interval);
|
69
|
-
}
|
70
|
-
},
|
71
|
-
// animate from the current state to provided value
|
72
|
-
jumpTo: function(to) {
|
73
|
-
this.target = this.state = Math.max(0, Math.min(1, to));
|
74
|
-
this.propagate();
|
75
|
-
},
|
76
|
-
// seek to the opposite of the current target
|
77
|
-
toggle: function() {
|
78
|
-
this.seekTo(1 - this.target);
|
79
|
-
},
|
80
|
-
// add a function or an object with a method setState(state) that will be called with a number
|
81
|
-
// between 0 and 1 on each frame of the animation
|
82
|
-
addSubject: function(subject,scope) {
|
83
|
-
this.subjects[this.subjects.length] = subject;
|
84
|
-
this.subjectScopes[this.subjectScopes.length] = scope;
|
85
|
-
return this;
|
86
|
-
},
|
87
|
-
// remove all subjects
|
88
|
-
clearSubjects: function() {
|
89
|
-
this.subjects = [];
|
90
|
-
this.subjectScopes = [];
|
91
|
-
},
|
92
|
-
// forward the current state to the animation subjects
|
93
|
-
propagate: function() {
|
94
|
-
var value = this.options.transition(this.state);
|
95
|
-
for (var i=0; i<this.subjects.length; i++) {
|
96
|
-
if (this.subjects[i].setState) {
|
97
|
-
this.subjects[i].setState(value);
|
98
|
-
} else {
|
99
|
-
this.subjects[i].apply(this.subjectScopes[i],[value]);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
},
|
103
|
-
// called once per frame to update the current state
|
104
|
-
onTimerEvent: function() {
|
105
|
-
var now = new Date().getTime();
|
106
|
-
var timePassed = now - this.lastTime;
|
107
|
-
this.lastTime = now;
|
108
|
-
var movement = (timePassed / this.options.duration) * (this.state < this.target ? 1 : -1);
|
109
|
-
if (Math.abs(movement) >= Math.abs(this.state - this.target)) {
|
110
|
-
this.state = this.target;
|
111
|
-
} else {
|
112
|
-
this.state += movement;
|
113
|
-
}
|
114
|
-
|
115
|
-
try {
|
116
|
-
this.propagate();
|
117
|
-
} finally {
|
118
|
-
this.options.onStep.call(this);
|
119
|
-
if (this.target == this.state) {
|
120
|
-
window.clearInterval(this.intervalId);
|
121
|
-
this.intervalId = null;
|
122
|
-
this.options.onComplete.call(this);
|
123
|
-
}
|
124
|
-
}
|
125
|
-
},
|
126
|
-
// shortcuts
|
127
|
-
play: function() {this.seekFromTo(0, 1)},
|
128
|
-
reverse: function() {this.seekFromTo(1, 0)},
|
129
|
-
// return a string describing this Animator, for debugging
|
130
|
-
inspect: function() {
|
131
|
-
var str = "#<Animator:\n";
|
132
|
-
for (var i=0; i<this.subjects.length; i++) {
|
133
|
-
str += this.subjects[i].inspect();
|
134
|
-
}
|
135
|
-
str += ">";
|
136
|
-
return str;
|
137
|
-
}
|
138
|
-
}
|
139
|
-
// merge the properties of two objects
|
140
|
-
Animator.applyDefaults = function(defaults, prefs) {
|
141
|
-
prefs = prefs || {};
|
142
|
-
var prop, result = {};
|
143
|
-
for (prop in defaults) result[prop] = prefs[prop] !== undefined ? prefs[prop] : defaults[prop];
|
144
|
-
return result;
|
145
|
-
}
|
146
|
-
// make an array from any object
|
147
|
-
Animator.makeArray = function(o) {
|
148
|
-
if (o == null) return [];
|
149
|
-
if (!o.length) return [o];
|
150
|
-
var result = [];
|
151
|
-
for (var i=0; i<o.length; i++) result[i] = o[i];
|
152
|
-
return result;
|
153
|
-
}
|
154
|
-
// convert a dash-delimited-property to a camelCaseProperty (c/o Prototype, thanks Sam!)
|
155
|
-
Animator.camelize = function(string) {
|
156
|
-
var oStringList = string.split('-');
|
157
|
-
if (oStringList.length == 1) return oStringList[0];
|
158
|
-
|
159
|
-
var camelizedString = string.indexOf('-') == 0
|
160
|
-
? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
|
161
|
-
: oStringList[0];
|
162
|
-
|
163
|
-
for (var i = 1, len = oStringList.length; i < len; i++) {
|
164
|
-
var s = oStringList[i];
|
165
|
-
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
|
166
|
-
}
|
167
|
-
return camelizedString;
|
168
|
-
}
|
169
|
-
// syntactic sugar for creating CSSStyleSubjects
|
170
|
-
Animator.apply = function(el, style, options) {
|
171
|
-
if (style instanceof Array) {
|
172
|
-
return new Animator(options).addSubject(new CSSStyleSubject(el, style[0], style[1]));
|
173
|
-
}
|
174
|
-
return new Animator(options).addSubject(new CSSStyleSubject(el, style));
|
175
|
-
}
|
176
|
-
// make a transition function that gradually accelerates. pass a=1 for smooth
|
177
|
-
// gravitational acceleration, higher values for an exaggerated effect
|
178
|
-
Animator.makeEaseIn = function(a) {
|
179
|
-
return function(state) {
|
180
|
-
return Math.pow(state, a*2);
|
181
|
-
}
|
182
|
-
}
|
183
|
-
// as makeEaseIn but for deceleration
|
184
|
-
Animator.makeEaseOut = function(a) {
|
185
|
-
return function(state) {
|
186
|
-
return 1 - Math.pow(1 - state, a*2);
|
187
|
-
}
|
188
|
-
}
|
189
|
-
// make a transition function that, like an object with momentum being attracted to a point,
|
190
|
-
// goes past the target then returns
|
191
|
-
Animator.makeElastic = function(bounces) {
|
192
|
-
return function(state) {
|
193
|
-
state = Animator.tx.easeInOut(state);
|
194
|
-
return ((1-Math.cos(state * Math.PI * bounces)) * (1 - state)) + state;
|
195
|
-
}
|
196
|
-
}
|
197
|
-
// make an Attack Decay Sustain Release envelope that starts and finishes on the same level
|
198
|
-
//
|
199
|
-
Animator.makeADSR = function(attackEnd, decayEnd, sustainEnd, sustainLevel) {
|
200
|
-
if (sustainLevel == null) sustainLevel = 0.5;
|
201
|
-
return function(state) {
|
202
|
-
if (state < attackEnd) {
|
203
|
-
return state / attackEnd;
|
204
|
-
}
|
205
|
-
if (state < decayEnd) {
|
206
|
-
return 1 - ((state - attackEnd) / (decayEnd - attackEnd) * (1 - sustainLevel));
|
207
|
-
}
|
208
|
-
if (state < sustainEnd) {
|
209
|
-
return sustainLevel;
|
210
|
-
}
|
211
|
-
return sustainLevel * (1 - ((state - sustainEnd) / (1 - sustainEnd)));
|
212
|
-
}
|
213
|
-
}
|
214
|
-
// make a transition function that, like a ball falling to floor, reaches the target and/
|
215
|
-
// bounces back again
|
216
|
-
Animator.makeBounce = function(bounces) {
|
217
|
-
var fn = Animator.makeElastic(bounces);
|
218
|
-
return function(state) {
|
219
|
-
state = fn(state);
|
220
|
-
return state <= 1 ? state : 2-state;
|
221
|
-
}
|
222
|
-
}
|
223
|
-
|
224
|
-
// pre-made transition functions to use with the 'transition' option
|
225
|
-
Animator.tx = {
|
226
|
-
easeInOut: function(pos){
|
227
|
-
return ((-Math.cos(pos*Math.PI)/2) + 0.5);
|
228
|
-
},
|
229
|
-
linear: function(x) {
|
230
|
-
return x;
|
231
|
-
},
|
232
|
-
easeIn: Animator.makeEaseIn(1.5),
|
233
|
-
easeOut: Animator.makeEaseOut(1.5),
|
234
|
-
strongEaseIn: Animator.makeEaseIn(2.5),
|
235
|
-
strongEaseOut: Animator.makeEaseOut(2.5),
|
236
|
-
elastic: Animator.makeElastic(1),
|
237
|
-
veryElastic: Animator.makeElastic(3),
|
238
|
-
bouncy: Animator.makeBounce(1),
|
239
|
-
veryBouncy: Animator.makeBounce(3)
|
240
|
-
}
|
241
|
-
|
242
|
-
// animates a pixel-based style property between two integer values
|
243
|
-
function NumericalStyleSubject(els, property, from, to, units) {
|
244
|
-
this.els = Animator.makeArray(els);
|
245
|
-
if (property == 'opacity' && window.ActiveXObject) {
|
246
|
-
this.property = 'filter';
|
247
|
-
} else {
|
248
|
-
this.property = Animator.camelize(property);
|
249
|
-
}
|
250
|
-
this.from = parseFloat(from);
|
251
|
-
this.to = parseFloat(to);
|
252
|
-
this.units = units != null ? units : 'px';
|
253
|
-
}
|
254
|
-
NumericalStyleSubject.prototype = {
|
255
|
-
setState: function(state) {
|
256
|
-
var style = this.getStyle(state);
|
257
|
-
var visibility = (this.property == 'opacity' && state == 0) ? 'hidden' : '';
|
258
|
-
var j=0;
|
259
|
-
for (var i=0; i<this.els.length; i++) {
|
260
|
-
try {
|
261
|
-
this.els[i].style[this.property] = style;
|
262
|
-
} catch (e) {
|
263
|
-
// ignore fontWeight - intermediate numerical values cause exeptions in firefox
|
264
|
-
if (this.property != 'fontWeight') throw e;
|
265
|
-
}
|
266
|
-
if (j++ > 20) return;
|
267
|
-
}
|
268
|
-
},
|
269
|
-
getStyle: function(state) {
|
270
|
-
state = this.from + ((this.to - this.from) * state);
|
271
|
-
if (this.property == 'filter') return "alpha(opacity=" + Math.round(state*100) + ")";
|
272
|
-
if (this.property == 'opacity') return state;
|
273
|
-
return Math.round(state) + this.units;
|
274
|
-
},
|
275
|
-
inspect: function() {
|
276
|
-
return "\t" + this.property + "(" + this.from + this.units + " to " + this.to + this.units + ")\n";
|
277
|
-
}
|
278
|
-
}
|
279
|
-
|
280
|
-
// animates a colour based style property between two hex values
|
281
|
-
function ColorStyleSubject(els, property, from, to) {
|
282
|
-
this.els = Animator.makeArray(els);
|
283
|
-
this.property = Animator.camelize(property);
|
284
|
-
this.to = this.expandColor(to);
|
285
|
-
this.from = this.expandColor(from);
|
286
|
-
this.origFrom = from;
|
287
|
-
this.origTo = to;
|
288
|
-
}
|
289
|
-
|
290
|
-
ColorStyleSubject.prototype = {
|
291
|
-
// parse "#FFFF00" to [256, 256, 0]
|
292
|
-
expandColor: function(color) {
|
293
|
-
var hexColor, red, green, blue;
|
294
|
-
hexColor = ColorStyleSubject.parseColor(color);
|
295
|
-
if (hexColor) {
|
296
|
-
red = parseInt(hexColor.slice(1, 3), 16);
|
297
|
-
green = parseInt(hexColor.slice(3, 5), 16);
|
298
|
-
blue = parseInt(hexColor.slice(5, 7), 16);
|
299
|
-
return [red,green,blue]
|
300
|
-
}
|
301
|
-
if (window.DEBUG) {
|
302
|
-
alert("Invalid colour: '" + color + "'");
|
303
|
-
}
|
304
|
-
},
|
305
|
-
getValueForState: function(color, state) {
|
306
|
-
return Math.round(this.from[color] + ((this.to[color] - this.from[color]) * state));
|
307
|
-
},
|
308
|
-
setState: function(state) {
|
309
|
-
var color = '#'
|
310
|
-
+ ColorStyleSubject.toColorPart(this.getValueForState(0, state))
|
311
|
-
+ ColorStyleSubject.toColorPart(this.getValueForState(1, state))
|
312
|
-
+ ColorStyleSubject.toColorPart(this.getValueForState(2, state));
|
313
|
-
for (var i=0; i<this.els.length; i++) {
|
314
|
-
this.els[i].style[this.property] = color;
|
315
|
-
}
|
316
|
-
},
|
317
|
-
inspect: function() {
|
318
|
-
return "\t" + this.property + "(" + this.origFrom + " to " + this.origTo + ")\n";
|
319
|
-
}
|
320
|
-
}
|
321
|
-
|
322
|
-
// return a properly formatted 6-digit hex colour spec, or false
|
323
|
-
ColorStyleSubject.parseColor = function(string) {
|
324
|
-
var color = '#', match;
|
325
|
-
if(match = ColorStyleSubject.parseColor.rgbRe.exec(string)) {
|
326
|
-
var part;
|
327
|
-
for (var i=1; i<=3; i++) {
|
328
|
-
part = Math.max(0, Math.min(255, parseInt(match[i])));
|
329
|
-
color += ColorStyleSubject.toColorPart(part);
|
330
|
-
}
|
331
|
-
return color;
|
332
|
-
}
|
333
|
-
if (match = ColorStyleSubject.parseColor.hexRe.exec(string)) {
|
334
|
-
if(match[1].length == 3) {
|
335
|
-
for (var i=0; i<3; i++) {
|
336
|
-
color += match[1].charAt(i) + match[1].charAt(i);
|
337
|
-
}
|
338
|
-
return color;
|
339
|
-
}
|
340
|
-
return '#' + match[1];
|
341
|
-
}
|
342
|
-
return false;
|
343
|
-
}
|
344
|
-
// convert a number to a 2 digit hex string
|
345
|
-
ColorStyleSubject.toColorPart = function(number) {
|
346
|
-
if (number > 255) number = 255;
|
347
|
-
var digits = number.toString(16);
|
348
|
-
if (number < 16) return '0' + digits;
|
349
|
-
return digits;
|
350
|
-
}
|
351
|
-
ColorStyleSubject.parseColor.rgbRe = /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i;
|
352
|
-
ColorStyleSubject.parseColor.hexRe = /^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
353
|
-
|
354
|
-
// Animates discrete styles, i.e. ones that do not scale but have discrete values
|
355
|
-
// that can't be interpolated
|
356
|
-
function DiscreteStyleSubject(els, property, from, to, threshold) {
|
357
|
-
this.els = Animator.makeArray(els);
|
358
|
-
this.property = Animator.camelize(property);
|
359
|
-
this.from = from;
|
360
|
-
this.to = to;
|
361
|
-
this.threshold = threshold || 0.5;
|
362
|
-
}
|
363
|
-
|
364
|
-
DiscreteStyleSubject.prototype = {
|
365
|
-
setState: function(state) {
|
366
|
-
var j=0;
|
367
|
-
for (var i=0; i<this.els.length; i++) {
|
368
|
-
this.els[i].style[this.property] = state <= this.threshold ? this.from : this.to;
|
369
|
-
}
|
370
|
-
},
|
371
|
-
inspect: function() {
|
372
|
-
return "\t" + this.property + "(" + this.from + " to " + this.to + " @ " + this.threshold + ")\n";
|
373
|
-
}
|
374
|
-
}
|
375
|
-
|
376
|
-
// animates between two styles defined using CSS.
|
377
|
-
// if style1 and style2 are present, animate between them, if only style1
|
378
|
-
// is present, animate between the element's current style and style1
|
379
|
-
function CSSStyleSubject(els, style1, style2) {
|
380
|
-
els = Animator.makeArray(els);
|
381
|
-
this.subjects = [];
|
382
|
-
if (els.length == 0) return;
|
383
|
-
var prop, toStyle, fromStyle;
|
384
|
-
if (style2) {
|
385
|
-
fromStyle = this.parseStyle(style1, els[0]);
|
386
|
-
toStyle = this.parseStyle(style2, els[0]);
|
387
|
-
} else {
|
388
|
-
toStyle = this.parseStyle(style1, els[0]);
|
389
|
-
fromStyle = {};
|
390
|
-
for (prop in toStyle) {
|
391
|
-
fromStyle[prop] = CSSStyleSubject.getStyle(els[0], prop);
|
392
|
-
}
|
393
|
-
}
|
394
|
-
// remove unchanging properties
|
395
|
-
var prop;
|
396
|
-
for (prop in fromStyle) {
|
397
|
-
if (fromStyle[prop] == toStyle[prop]) {
|
398
|
-
delete fromStyle[prop];
|
399
|
-
delete toStyle[prop];
|
400
|
-
}
|
401
|
-
}
|
402
|
-
// discover the type (numerical or colour) of each style
|
403
|
-
var prop, units, match, type, from, to;
|
404
|
-
for (prop in fromStyle) {
|
405
|
-
var fromProp = String(fromStyle[prop]);
|
406
|
-
var toProp = String(toStyle[prop]);
|
407
|
-
if (toStyle[prop] == null) {
|
408
|
-
if (window.DEBUG) alert("No to style provided for '" + prop + '"');
|
409
|
-
continue;
|
410
|
-
}
|
411
|
-
|
412
|
-
if (from = ColorStyleSubject.parseColor(fromProp)) {
|
413
|
-
to = ColorStyleSubject.parseColor(toProp);
|
414
|
-
type = ColorStyleSubject;
|
415
|
-
} else if (fromProp.match(CSSStyleSubject.numericalRe)
|
416
|
-
&& toProp.match(CSSStyleSubject.numericalRe)) {
|
417
|
-
from = parseFloat(fromProp);
|
418
|
-
to = parseFloat(toProp);
|
419
|
-
type = NumericalStyleSubject;
|
420
|
-
match = CSSStyleSubject.numericalRe.exec(fromProp);
|
421
|
-
var reResult = CSSStyleSubject.numericalRe.exec(toProp);
|
422
|
-
if (match[1] != null) {
|
423
|
-
units = match[1];
|
424
|
-
} else if (reResult[1] != null) {
|
425
|
-
units = reResult[1];
|
426
|
-
} else {
|
427
|
-
units = reResult;
|
428
|
-
}
|
429
|
-
} else if (fromProp.match(CSSStyleSubject.discreteRe)
|
430
|
-
&& toProp.match(CSSStyleSubject.discreteRe)) {
|
431
|
-
from = fromProp;
|
432
|
-
to = toProp;
|
433
|
-
type = DiscreteStyleSubject;
|
434
|
-
units = 0; // hack - how to get an animator option down to here
|
435
|
-
} else {
|
436
|
-
if (window.DEBUG) {
|
437
|
-
alert("Unrecognised format for value of "
|
438
|
-
+ prop + ": '" + fromStyle[prop] + "'");
|
439
|
-
}
|
440
|
-
continue;
|
441
|
-
}
|
442
|
-
this.subjects[this.subjects.length] = new type(els, prop, from, to, units);
|
443
|
-
}
|
444
|
-
}
|
445
|
-
|
446
|
-
CSSStyleSubject.prototype = {
|
447
|
-
// parses "width: 400px; color: #FFBB2E" to {width: "400px", color: "#FFBB2E"}
|
448
|
-
parseStyle: function(style, el) {
|
449
|
-
var rtn = {};
|
450
|
-
// if style is a rule set
|
451
|
-
if (style.indexOf(":") != -1) {
|
452
|
-
var styles = style.split(";");
|
453
|
-
for (var i=0; i<styles.length; i++) {
|
454
|
-
var parts = CSSStyleSubject.ruleRe.exec(styles[i]);
|
455
|
-
if (parts) {
|
456
|
-
rtn[parts[1]] = parts[2];
|
457
|
-
}
|
458
|
-
}
|
459
|
-
}
|
460
|
-
// else assume style is a class name
|
461
|
-
else {
|
462
|
-
var prop, value, oldClass;
|
463
|
-
oldClass = el.className;
|
464
|
-
el.className = style;
|
465
|
-
for (var i=0; i<CSSStyleSubject.cssProperties.length; i++) {
|
466
|
-
prop = CSSStyleSubject.cssProperties[i];
|
467
|
-
value = CSSStyleSubject.getStyle(el, prop);
|
468
|
-
if (value != null) {
|
469
|
-
rtn[prop] = value;
|
470
|
-
}
|
471
|
-
}
|
472
|
-
el.className = oldClass;
|
473
|
-
}
|
474
|
-
return rtn;
|
475
|
-
|
476
|
-
},
|
477
|
-
setState: function(state) {
|
478
|
-
for (var i=0; i<this.subjects.length; i++) {
|
479
|
-
this.subjects[i].setState(state);
|
480
|
-
}
|
481
|
-
},
|
482
|
-
inspect: function() {
|
483
|
-
var str = "";
|
484
|
-
for (var i=0; i<this.subjects.length; i++) {
|
485
|
-
str += this.subjects[i].inspect();
|
486
|
-
}
|
487
|
-
return str;
|
488
|
-
}
|
489
|
-
}
|
490
|
-
// get the current value of a css property,
|
491
|
-
CSSStyleSubject.getStyle = function(el, property){
|
492
|
-
var style;
|
493
|
-
if(document.defaultView && document.defaultView.getComputedStyle){
|
494
|
-
style = document.defaultView.getComputedStyle(el, "").getPropertyValue(property);
|
495
|
-
if (style) {
|
496
|
-
return style;
|
497
|
-
}
|
498
|
-
}
|
499
|
-
property = Animator.camelize(property);
|
500
|
-
if(el.currentStyle){
|
501
|
-
style = el.currentStyle[property];
|
502
|
-
}
|
503
|
-
return style || el.style[property]
|
504
|
-
}
|
505
|
-
|
506
|
-
|
507
|
-
CSSStyleSubject.ruleRe = /^\s*([a-zA-Z\-]+)\s*:\s*(\S(.+\S)?)\s*$/;
|
508
|
-
CSSStyleSubject.numericalRe = /^-?\d+(?:\.\d+)?(%|[a-zA-Z]{2})?$/;
|
509
|
-
CSSStyleSubject.discreteRe = /^\w+$/;
|
510
|
-
|
511
|
-
// required because the style object of elements isn't enumerable in Safari
|
512
|
-
/*
|
513
|
-
CSSStyleSubject.cssProperties = ['background-color','border','border-color','border-spacing',
|
514
|
-
'border-style','border-top','border-right','border-bottom','border-left','border-top-color',
|
515
|
-
'border-right-color','border-bottom-color','border-left-color','border-top-width','border-right-width',
|
516
|
-
'border-bottom-width','border-left-width','border-width','bottom','color','font-size','font-size-adjust',
|
517
|
-
'font-stretch','font-style','height','left','letter-spacing','line-height','margin','margin-top',
|
518
|
-
'margin-right','margin-bottom','margin-left','marker-offset','max-height','max-width','min-height',
|
519
|
-
'min-width','orphans','outline','outline-color','outline-style','outline-width','overflow','padding',
|
520
|
-
'padding-top','padding-right','padding-bottom','padding-left','quotes','right','size','text-indent',
|
521
|
-
'top','width','word-spacing','z-index','opacity','outline-offset'];*/
|
522
|
-
|
523
|
-
|
524
|
-
CSSStyleSubject.cssProperties = ['azimuth','background','background-attachment','background-color','background-image','background-position','background-repeat','border-collapse','border-color','border-spacing','border-style','border-top','border-top-color','border-right-color','border-bottom-color','border-left-color','border-top-style','border-right-style','border-bottom-style','border-left-style','border-top-width','border-right-width','border-bottom-width','border-left-width','border-width','bottom','clear','clip','color','content','cursor','direction','display','elevation','empty-cells','css-float','font','font-family','font-size','font-size-adjust','font-stretch','font-style','font-variant','font-weight','height','left','letter-spacing','line-height','list-style','list-style-image','list-style-position','list-style-type','margin','margin-top','margin-right','margin-bottom','margin-left','max-height','max-width','min-height','min-width','orphans','outline','outline-color','outline-style','outline-width','overflow','padding','padding-top','padding-right','padding-bottom','padding-left','pause','position','right','size','table-layout','text-align','text-decoration','text-indent','text-shadow','text-transform','top','vertical-align','visibility','white-space','width','word-spacing','z-index','opacity','outline-offset','overflow-x','overflow-y'];
|
525
|
-
|
526
|
-
|
527
|
-
// chains several Animator objects together
|
528
|
-
function AnimatorChain(animators, options) {
|
529
|
-
this.animators = animators;
|
530
|
-
this.setOptions(options);
|
531
|
-
for (var i=0; i<this.animators.length; i++) {
|
532
|
-
this.listenTo(this.animators[i]);
|
533
|
-
}
|
534
|
-
this.forwards = false;
|
535
|
-
this.current = 0;
|
536
|
-
}
|
537
|
-
|
538
|
-
AnimatorChain.prototype = {
|
539
|
-
// apply defaults
|
540
|
-
setOptions: function(options) {
|
541
|
-
this.options = Animator.applyDefaults({
|
542
|
-
// by default, each call to AnimatorChain.play() calls jumpTo(0) of each animator
|
543
|
-
// before playing, which can cause flickering if you have multiple animators all
|
544
|
-
// targeting the same element. Set this to false to avoid this.
|
545
|
-
resetOnPlay: true
|
546
|
-
}, options);
|
547
|
-
},
|
548
|
-
// play each animator in turn
|
549
|
-
play: function() {
|
550
|
-
this.forwards = true;
|
551
|
-
this.current = -1;
|
552
|
-
if (this.options.resetOnPlay) {
|
553
|
-
for (var i=0; i<this.animators.length; i++) {
|
554
|
-
this.animators[i].jumpTo(0);
|
555
|
-
}
|
556
|
-
}
|
557
|
-
this.advance();
|
558
|
-
},
|
559
|
-
// play all animators backwards
|
560
|
-
reverse: function() {
|
561
|
-
this.forwards = false;
|
562
|
-
this.current = this.animators.length;
|
563
|
-
if (this.options.resetOnPlay) {
|
564
|
-
for (var i=0; i<this.animators.length; i++) {
|
565
|
-
this.animators[i].jumpTo(1);
|
566
|
-
}
|
567
|
-
}
|
568
|
-
this.advance();
|
569
|
-
},
|
570
|
-
// if we have just play()'d, then call reverse(), and vice versa
|
571
|
-
toggle: function() {
|
572
|
-
if (this.forwards) {
|
573
|
-
this.seekTo(0);
|
574
|
-
} else {
|
575
|
-
this.seekTo(1);
|
576
|
-
}
|
577
|
-
},
|
578
|
-
// internal: install an event listener on an animator's onComplete option
|
579
|
-
// to trigger the next animator
|
580
|
-
listenTo: function(animator) {
|
581
|
-
var oldOnComplete = animator.options.onComplete;
|
582
|
-
var _this = this;
|
583
|
-
animator.options.onComplete = function() {
|
584
|
-
if (oldOnComplete) oldOnComplete.call(animator);
|
585
|
-
_this.advance();
|
586
|
-
}
|
587
|
-
},
|
588
|
-
// play the next animator
|
589
|
-
advance: function() {
|
590
|
-
if (this.forwards) {
|
591
|
-
if (this.animators[this.current + 1] == null) return;
|
592
|
-
this.current++;
|
593
|
-
this.animators[this.current].play();
|
594
|
-
} else {
|
595
|
-
if (this.animators[this.current - 1] == null) return;
|
596
|
-
this.current--;
|
597
|
-
this.animators[this.current].reverse();
|
598
|
-
}
|
599
|
-
},
|
600
|
-
// this function is provided for drop-in compatibility with Animator objects,
|
601
|
-
// but only accepts 0 and 1 as target values
|
602
|
-
seekTo: function(target) {
|
603
|
-
if (target <= 0) {
|
604
|
-
this.forwards = false;
|
605
|
-
this.animators[this.current].seekTo(0);
|
606
|
-
} else {
|
607
|
-
this.forwards = true;
|
608
|
-
this.animators[this.current].seekTo(1);
|
609
|
-
}
|
610
|
-
}
|
611
|
-
}
|
612
|
-
|
613
|
-
// an Accordion is a class that creates and controls a number of Animators. An array of elements is passed in,
|
614
|
-
// and for each element an Animator and a activator button is created. When an Animator's activator button is
|
615
|
-
// clicked, the Animator and all before it seek to 0, and all Animators after it seek to 1. This can be used to
|
616
|
-
// create the classic Accordion effect, hence the name.
|
617
|
-
// see setOptions for arguments
|
618
|
-
function Accordion(options) {
|
619
|
-
this.setOptions(options);
|
620
|
-
var selected = this.options.initialSection, current;
|
621
|
-
if (this.options.rememberance) {
|
622
|
-
current = document.location.hash.substring(1);
|
623
|
-
}
|
624
|
-
this.rememberanceTexts = [];
|
625
|
-
this.ans = [];
|
626
|
-
var _this = this;
|
627
|
-
for (var i=0; i<this.options.sections.length; i++) {
|
628
|
-
var el = this.options.sections[i];
|
629
|
-
var an = new Animator(this.options.animatorOptions);
|
630
|
-
var from = this.options.from + (this.options.shift * i);
|
631
|
-
var to = this.options.to + (this.options.shift * i);
|
632
|
-
an.addSubject(new NumericalStyleSubject(el, this.options.property, from, to, this.options.units));
|
633
|
-
an.jumpTo(0);
|
634
|
-
var activator = this.options.getActivator(el);
|
635
|
-
activator.index = i;
|
636
|
-
activator.onclick = function(){_this.show(this.index)};
|
637
|
-
this.ans[this.ans.length] = an;
|
638
|
-
this.rememberanceTexts[i] = activator.innerHTML.replace(/\s/g, "");
|
639
|
-
if (this.rememberanceTexts[i] === current) {
|
640
|
-
selected = i;
|
641
|
-
}
|
642
|
-
}
|
643
|
-
this.show(selected);
|
644
|
-
}
|
645
|
-
|
646
|
-
Accordion.prototype = {
|
647
|
-
// apply defaults
|
648
|
-
setOptions: function(options) {
|
649
|
-
this.options = Object.extend({
|
650
|
-
// REQUIRED: an array of elements to use as the accordion sections
|
651
|
-
sections: null,
|
652
|
-
// a function that locates an activator button element given a section element.
|
653
|
-
// by default it takes a button id from the section's "activator" attibute
|
654
|
-
getActivator: function(el) {return document.getElementById(el.getAttribute("activator"))},
|
655
|
-
// shifts each animator's range, for example with options {from:0,to:100,shift:20}
|
656
|
-
// the animators' ranges will be 0-100, 20-120, 40-140 etc.
|
657
|
-
shift: 0,
|
658
|
-
// the first page to show
|
659
|
-
initialSection: 0,
|
660
|
-
// if set to true, document.location.hash will be used to preserve the open section across page reloads
|
661
|
-
rememberance: true,
|
662
|
-
// constructor arguments to the Animator objects
|
663
|
-
animatorOptions: {}
|
664
|
-
}, options || {});
|
665
|
-
},
|
666
|
-
show: function(section) {
|
667
|
-
for (var i=0; i<this.ans.length; i++) {
|
668
|
-
this.ans[i].seekTo(i > section ? 1 : 0);
|
669
|
-
}
|
670
|
-
if (this.options.rememberance) {
|
671
|
-
document.location.hash = this.rememberanceTexts[section];
|
672
|
-
}
|
673
|
-
}
|
674
|
-
}
|