spree 0.9.4 → 0.10.0.beta
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/CHANGELOG +185 -0
- data/CONTRIBUTORS +93 -66
- data/LICENSE +1 -1
- data/Rakefile +19 -16
- data/app/controllers/admin/adjustments_controller.rb +32 -0
- data/app/controllers/admin/base_controller.rb +33 -18
- data/app/controllers/admin/checkouts_controller.rb +41 -0
- data/app/controllers/admin/coupons_controller.rb +2 -1
- data/app/controllers/admin/images_controller.rb +28 -19
- data/app/controllers/admin/line_items_controller.rb +55 -0
- data/app/controllers/admin/option_types_controller.rb +7 -4
- data/app/controllers/admin/orders_controller.rb +29 -15
- data/app/controllers/admin/payment_methods_controller.rb +31 -0
- data/app/controllers/admin/payments_controller.rb +99 -0
- data/app/controllers/admin/product_groups_controller.rb +42 -0
- data/app/controllers/admin/product_properties_controller.rb +7 -0
- data/app/controllers/admin/product_scopes_controller.rb +18 -0
- data/app/controllers/admin/products_controller.rb +74 -36
- data/app/controllers/admin/properties_controller.rb +2 -0
- data/app/controllers/admin/prototypes_controller.rb +3 -1
- data/app/controllers/admin/reports_controller.rb +2 -2
- data/app/controllers/admin/return_authorizations_controller.rb +36 -0
- data/app/controllers/admin/shipments_controller.rb +55 -24
- data/app/controllers/admin/shipping_categories_controller.rb +2 -1
- data/app/controllers/admin/shipping_methods_controller.rb +9 -7
- data/app/controllers/admin/shipping_rates_controller.rb +2 -1
- data/app/controllers/admin/states_controller.rb +1 -1
- data/app/controllers/admin/tax_categories_controller.rb +3 -1
- data/app/controllers/admin/tax_rates_controller.rb +12 -8
- data/app/controllers/admin/taxonomies_controller.rb +4 -13
- data/app/controllers/admin/taxons_controller.rb +86 -46
- data/app/controllers/admin/trackers_controller.rb +7 -0
- data/app/controllers/admin/users_controller.rb +29 -19
- data/app/controllers/admin/variants_controller.rb +12 -7
- data/app/controllers/admin/zones_controller.rb +3 -1
- data/app/controllers/application_controller.rb +4 -0
- data/app/controllers/checkouts_controller.rb +195 -131
- data/app/controllers/line_items_controller.rb +11 -6
- data/app/controllers/orders_controller.rb +35 -31
- data/app/controllers/password_resets_controller.rb +6 -1
- data/app/controllers/products_controller.rb +22 -31
- data/app/controllers/spree/base_controller.rb +144 -29
- data/app/controllers/taxons_controller.rb +8 -10
- data/app/controllers/user_sessions_controller.rb +69 -19
- data/app/controllers/users_controller.rb +42 -20
- data/app/helpers/admin/adjustments_helper.rb +2 -0
- data/app/helpers/admin/base_helper.rb +57 -105
- data/app/helpers/admin/checkouts_helper.rb +2 -0
- data/app/helpers/admin/line_items_helper.rb +2 -0
- data/app/helpers/admin/navigation_helper.rb +127 -0
- data/app/helpers/admin/orders_helper.rb +22 -7
- data/app/helpers/admin/payments_helper.rb +7 -0
- data/app/helpers/admin/return_authorizations_helper.rb +2 -0
- data/app/helpers/application_helper.rb +2 -8
- data/app/helpers/checkouts_helper.rb +32 -4
- data/app/helpers/hook_helper.rb +21 -0
- data/app/helpers/products_helper.rb +28 -10
- data/app/helpers/spree/base_helper.rb +43 -43
- data/app/helpers/taxons_helper.rb +3 -3
- data/app/helpers/trackers_helper.rb +2 -0
- data/app/helpers/users_helper.rb +13 -0
- data/app/metal/create_admin_user.rb +1 -1
- data/app/metal/redirect_legacy_product_url.rb +10 -0
- data/app/metal/seo_assist.rb +38 -0
- data/app/models/address.rb +28 -2
- data/app/models/adjustment.rb +57 -18
- data/app/models/app_configuration.rb +8 -3
- data/app/models/billing_integration.rb +23 -0
- data/app/models/calculator.rb +8 -3
- data/app/models/calculator/flat_percent_item_total.rb +6 -5
- data/app/models/calculator/per_item.rb +2 -2
- data/app/models/charge.rb +14 -32
- data/app/models/checkout.rb +118 -26
- data/app/models/coupon.rb +6 -4
- data/app/models/coupon_credit.rb +25 -0
- data/app/models/credit.rb +14 -22
- data/app/models/creditcard.rb +38 -110
- data/app/models/creditcard_txn.rb +7 -4
- data/app/models/inventory_unit.rb +50 -33
- data/app/models/line_item.rb +11 -5
- data/app/models/option_type.rb +2 -1
- data/app/models/order.rb +189 -64
- data/app/models/order_mailer.rb +5 -1
- data/app/models/payment.rb +99 -8
- data/app/models/payment_method.rb +45 -0
- data/app/models/payment_method/check.rb +2 -0
- data/app/models/product.rb +103 -38
- data/app/models/product_group.rb +201 -0
- data/app/models/product_scope.rb +56 -0
- data/app/models/return_authorization.rb +70 -0
- data/app/models/return_authorization_credit.rb +3 -0
- data/app/models/shipment.rb +79 -20
- data/app/models/shipping_charge.rb +23 -0
- data/app/models/shipping_method.rb +17 -8
- data/app/models/state_event.rb +1 -1
- data/app/models/state_monitor.rb +25 -0
- data/app/models/tax_charge.rb +23 -0
- data/app/models/taxon.rb +24 -16
- data/app/models/taxonomy.rb +10 -0
- data/app/models/tracker.rb +5 -0
- data/app/models/transaction.rb +6 -0
- data/app/models/user.rb +32 -6
- data/app/models/user_session.rb +1 -1
- data/app/models/variant.rb +36 -25
- data/app/models/zone.rb +19 -16
- data/bin/spree +3 -5
- data/config/boot.rb +7 -3
- data/config/database.yml +24 -25
- data/config/environment.rb +34 -28
- data/config/environments/staging.rb +13 -8
- data/config/environments/test.rb +2 -6
- data/config/initializers/locales.rb +1 -1
- data/config/initializers/spree.rb +4 -1
- data/config/initializers/touch.rb +9 -0
- data/config/initializers/workarounds_for_ruby19.rb +102 -0
- data/config/locales/cs-CZ.yml +914 -0
- data/config/locales/cs-CZ_rails.yml +202 -0
- data/config/locales/da.yml +305 -5
- data/config/locales/de-CH.yml +305 -5
- data/config/locales/de.yml +479 -179
- data/config/locales/en-AU.yml +914 -0
- data/config/locales/en-AU_rails.yml +202 -0
- data/config/locales/en-GB.yml +306 -6
- data/config/locales/en-US.yml +390 -90
- data/config/locales/en-US_rails.yml +11 -6
- data/config/locales/es.yml +378 -78
- data/config/locales/fi.yml +380 -80
- data/config/locales/fr-FR.yml +489 -189
- data/config/locales/il.yml +306 -6
- data/config/locales/it.yml +306 -6
- data/config/locales/jp.yml +306 -6
- data/config/locales/mx.yml +305 -5
- data/config/locales/nb-NO.yml +305 -5
- data/config/locales/nl-BE.yml +314 -14
- data/config/locales/nl-NL.yml +317 -17
- data/config/locales/nl-NL_rails.yml +45 -45
- data/config/locales/pl.yml +306 -6
- data/config/locales/pt-BR.yml +305 -5
- data/config/locales/pt-PT.yml +305 -5
- data/config/locales/ru-RU.yml +361 -61
- data/config/locales/ru-RU_rails.yml +6 -0
- data/config/locales/th.yml +306 -6
- data/config/locales/vn.yml +914 -0
- data/config/locales/vn_rails.yml +202 -0
- data/config/routes.rb +41 -24
- data/config/spree_permissions.yml +3 -3
- data/db/migrate/20090823005402_spree_zero_nine_zero.rb +452 -0
- data/db/migrate/20090904192342_create_indexes_for_inventory_units.rb +12 -0
- data/db/migrate/20090923100315_add_count_on_hand_to_variants_and_products.rb +30 -0
- data/db/migrate/20091007134354_change_taxons_to_nested_set.rb +40 -0
- data/db/migrate/20091012120519_product_groups_and_scopes.rb +25 -0
- data/db/migrate/20091015110842_add_open_id_authentication_tables.rb +20 -0
- data/db/migrate/20091015153048_add_openid_field_to_users.rb +19 -0
- data/db/migrate/20091016174634_change_preference_value_type.rb +9 -0
- data/db/migrate/20091017175558_create_billing_integrations.rb +16 -0
- data/db/migrate/20091021133257_charge_refactoring.rb +32 -0
- data/db/migrate/20091104151730_add_some_indexes.rb +21 -0
- data/db/migrate/20091126190904_checkout_state_machine.rb +13 -0
- data/db/migrate/20091209153045_state_for_shipments.rb +9 -0
- data/db/migrate/20091209202200_make_state_events_polymorphic.rb +12 -0
- data/db/migrate/20091211203813_ship_address_id_for_checkouts.rb +9 -0
- data/db/migrate/20091212161118_shipping_method_id_for_checkouts.rb +9 -0
- data/db/migrate/20091213222815_creditcard_last_four_digits.rb +19 -0
- data/db/migrate/20091214183826_populate_legacy_shipment_state.rb +19 -0
- data/db/migrate/20100105090147_add_cost_price.rb +9 -0
- data/db/migrate/20100105132138_shipment_id_for_inventory_units.rb +17 -0
- data/db/migrate/20100111205525_cim_fields_for_creditcards.rb +11 -0
- data/db/migrate/20100112151511_create_return_authorizations.rb +16 -0
- data/db/migrate/20100113090919_add_return_authorization_to_inventory_units.rb +9 -0
- data/db/migrate/20100113203104_create_trackers.rb +14 -0
- data/db/migrate/20100121160010_creditcard_id_for_creditcard_txns.rb +9 -0
- data/db/migrate/20100121183934_original_creditcard_txn_id_for_creditcard_txns.rb +9 -0
- data/db/migrate/20100125145351_add_test_mode_to_billing_integration.rb +11 -0
- data/db/migrate/20100126103714_create_products_product_groups.rb +12 -0
- data/db/migrate/20100209025806_create_payment_methods.rb +20 -0
- data/db/migrate/20100209144531_polymorphic_payments.rb +29 -0
- data/db/migrate/20100213103131_change_payments_payment_method_to_belongs_to.rb +11 -0
- data/db/migrate/20100214212536_assign_creditcard_txns_to_payment.rb +16 -0
- data/db/migrate/20100223170312_sti_for_transactions.rb +14 -0
- data/db/migrate/20100223183812_drop_billing_integrations.rb +16 -0
- data/db/migrate/20100224153127_deleted_at_for_payment_methods.rb +13 -0
- data/db/migrate/20100301163454_add_adjustments_index.rb +10 -0
- data/db/migrate/20100306153445_fix_by_popularity.rb +8 -0
- data/db/sample/addresses.yml +21 -18
- data/db/sample/adjustments.yml +8 -10
- data/db/sample/checkouts.yml +11 -5
- data/db/sample/inventory_units.rb +4 -0
- data/db/sample/line_items.yml +26 -11
- data/db/sample/orders.yml +15 -6
- data/db/sample/payment_methods.yml +23 -0
- data/db/sample/payments.rb +25 -0
- data/db/sample/product_groups.yml +9 -0
- data/db/sample/product_scopes.yml +35 -0
- data/db/sample/products.rb +24 -0
- data/db/sample/products.yml +8 -0
- data/db/sample/shipments.yml +4 -3
- data/db/sample/taxons.rb +3 -0
- data/db/sample/taxons.yml +22 -2
- data/db/sample/users.rb +58 -0
- data/db/sample/users.yml +12 -4
- data/db/sample/variants.yml +43 -5
- data/db/schema.rb +87 -47
- data/db/seeds.rb +8 -14
- data/lib/commands/extension.rb +4 -4
- data/lib/custom_fixtures.rb +1 -1
- data/lib/generators/extension/extension_generator.rb +3 -1
- data/lib/generators/extension/templates/RSpecRakefile +18 -1
- data/lib/generators/extension/templates/Rakefile +16 -0
- data/lib/generators/extension/templates/extension.rb +0 -16
- data/lib/generators/extension/templates/extension_hooks.rb +43 -0
- data/lib/generators/extension/templates/seeds.rb +2 -0
- data/lib/generators/extension/templates/tasks.rake +0 -11
- data/lib/generators/extension/templates/test_helper.rb +3 -15
- data/lib/generators/extension_controller/templates/controller.rb +1 -1
- data/lib/generators/extension_controller/templates/functional_test.rb +1 -6
- data/lib/generators/instance/instance_generator.rb +1 -1
- data/lib/generators/instance/templates/instance_rakefile +1 -0
- data/lib/generators/theme/templates/README.markdown +5 -0
- data/lib/generators/theme/theme_generator.rb +56 -0
- data/lib/scopes.rb +68 -0
- data/lib/scopes/dynamic.rb +38 -0
- data/lib/scopes/product.rb +246 -0
- data/lib/scopes/variant.rb +9 -0
- data/lib/spree.rb +5 -3
- data/lib/spree/checkout/action_options.rb +18 -0
- data/lib/spree/checkout/hooks.rb +27 -0
- data/lib/spree/config.rb +13 -2
- data/lib/spree/extension.rb +11 -1
- data/lib/spree/extension_loader.rb +10 -3
- data/lib/spree/extensions.rb +26 -0
- data/lib/spree/file_utilz.rb +3 -1
- data/lib/spree/initializer.rb +15 -17
- data/lib/spree/preferences/mail_settings.rb +1 -1
- data/lib/spree/preferences/model_hooks.rb +6 -1
- data/lib/spree/search.rb +46 -0
- data/lib/spree/search/base.rb +22 -0
- data/lib/spree/support/core_extensions/string.rb +1 -1
- data/lib/spree/theme_support.rb +4 -0
- data/lib/spree/theme_support/hook.rb +51 -0
- data/lib/spree/theme_support/hook_listener.rb +68 -0
- data/lib/spree/theme_support/hook_modifier.rb +35 -0
- data/lib/spree/theme_support/more_patches.rb +117 -0
- data/lib/tasks/database.rake +61 -21
- data/lib/tasks/extensions.rake +105 -9
- data/lib/tasks/rspec.rake +30 -30
- data/lib/tasks/themes.rake +32 -0
- data/lib/tasks/translation.rake +31 -0
- data/lib/tasks/upgrade.rake +1 -1
- data/lib/validation_group.rb +145 -0
- data/public/images/datepicker/backstripes.gif +0 -0
- data/public/images/datepicker/bg_header.jpg +0 -0
- data/public/images/datepicker/bullet1.gif +0 -0
- data/public/images/datepicker/bullet2.gif +0 -0
- data/public/images/datepicker/cal.gif +0 -0
- data/public/images/datepicker/gradient-e5e5e5-ffffff.gif +0 -0
- data/public/images/step-progress/completed-completed.gif +0 -0
- data/public/images/step-progress/completed-current.gif +0 -0
- data/public/images/step-progress/completed-first.gif +0 -0
- data/public/images/step-progress/current-first.gif +0 -0
- data/public/images/step-progress/current-incomplete.gif +0 -0
- data/public/images/step-progress/current-right.gif +0 -0
- data/public/images/step-progress/incomplete-incomplete.gif +0 -0
- data/public/images/step-progress/incomplete-right.gif +0 -0
- data/public/javascripts/additional-methods.js +236 -0
- data/public/javascripts/admin/address_states.js +25 -0
- data/public/javascripts/admin/checkouts/edit.js +79 -0
- data/public/javascripts/admin/orders/edit.js +96 -0
- data/public/javascripts/admin/orders/edit_form.js +17 -0
- data/public/javascripts/admin/payments/new.js +9 -0
- data/public/javascripts/admin/unobtrusive_handlers.js +15 -0
- data/public/javascripts/checkout.js +48 -520
- data/public/javascripts/dashboard.js +143 -0
- data/public/javascripts/datepicker.js +1445 -0
- data/public/javascripts/gateway.js +13 -0
- data/public/javascripts/jqPlot/excanvas.min.js +1 -0
- data/public/javascripts/jqPlot/jquery.jqplot.min.js +14 -0
- data/public/javascripts/jqPlot/plugins/jqplot.canvasAxisLabelRenderer.min.js +14 -0
- data/public/javascripts/jqPlot/plugins/jqplot.canvasAxisTickRenderer.min.js +14 -0
- data/public/javascripts/jqPlot/plugins/jqplot.canvasTextRenderer.min.js +14 -0
- data/public/javascripts/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js +14 -0
- data/public/javascripts/jqPlot/plugins/jqplot.dateAxisRenderer.min.js +14 -0
- data/public/javascripts/jqPlot/plugins/jqplot.highlighter.min.js +14 -0
- data/public/javascripts/jqPlot/plugins/jqplot.pieRenderer.min.js +14 -0
- data/public/javascripts/jquery-and-plugins.js +36 -0
- data/public/javascripts/jquery-ui.js +188 -0
- data/public/javascripts/jquery.autocomplete.min.js +13 -0
- data/public/javascripts/jquery.js +19 -0
- data/public/javascripts/jquery.suggest.js +276 -0
- data/public/javascripts/jquery.template.js +255 -0
- data/public/javascripts/jquery.validate.min.js +4 -4
- data/public/javascripts/jrails.autocomplete.js +274 -0
- data/public/javascripts/jrails.js +1 -0
- data/public/javascripts/jsTree/jquery.tree.js +2058 -0
- data/public/javascripts/jsTree/plugins/jquery.tree.contextmenu.js +129 -0
- data/public/javascripts/jsTree/themes/apple/bg.jpg +0 -0
- data/public/javascripts/jsTree/{source/themes/default/dot.gif → themes/apple/dot_for_ie.gif} +0 -0
- data/public/javascripts/jsTree/themes/apple/icons.png +0 -0
- data/public/javascripts/jsTree/themes/apple/style.css +34 -0
- data/public/javascripts/jsTree/{source/themes/default → themes/apple}/throbber.gif +0 -0
- data/public/javascripts/lang/af.js +40 -0
- data/public/javascripts/lang/ar.js +50 -0
- data/public/javascripts/lang/de.js +40 -0
- data/public/javascripts/lang/du.js +40 -0
- data/public/javascripts/lang/en.js +42 -0
- data/public/javascripts/lang/es.js +41 -0
- data/public/javascripts/lang/fi.js +40 -0
- data/public/javascripts/lang/fr.js +44 -0
- data/public/javascripts/lang/gr.js +40 -0
- data/public/javascripts/lang/he.js +49 -0
- data/public/javascripts/lang/it.js +13 -0
- data/public/javascripts/lang/nl.js +40 -0
- data/public/javascripts/lang/no.js +40 -0
- data/public/javascripts/lang/pt.js +50 -0
- data/public/javascripts/lang/ro.js +40 -0
- data/public/javascripts/lang/ru.js +40 -0
- data/public/javascripts/lang/sp.js +40 -0
- data/public/javascripts/lang/sv.js +41 -0
- data/public/javascripts/lang/ua.js +40 -0
- data/public/javascripts/localization/messages_cn.js +24 -0
- data/public/javascripts/localization/messages_cs.js +23 -0
- data/public/javascripts/localization/messages_da.js +21 -0
- data/public/javascripts/localization/messages_de.js +21 -0
- data/public/javascripts/localization/messages_es.js +24 -0
- data/public/javascripts/localization/messages_fr.js +23 -0
- data/public/javascripts/localization/messages_hu.js +21 -0
- data/public/javascripts/localization/messages_it.js +26 -0
- data/public/javascripts/localization/messages_kk.js +23 -0
- data/public/javascripts/localization/messages_nl.js +23 -0
- data/public/javascripts/localization/messages_no.js +23 -0
- data/public/javascripts/localization/messages_pl.js +23 -0
- data/public/javascripts/localization/messages_ptbr.js +30 -0
- data/public/javascripts/localization/messages_ro.js +24 -0
- data/public/javascripts/localization/messages_ru.js +23 -0
- data/public/javascripts/localization/messages_se.js +23 -0
- data/public/javascripts/localization/messages_sk.js +21 -0
- data/public/javascripts/localization/messages_tr.js +24 -0
- data/public/javascripts/localization/messages_tw.js +24 -0
- data/public/javascripts/localization/messages_ua.js +24 -0
- data/public/javascripts/open_id.js +15 -0
- data/public/javascripts/product.js +49 -0
- data/public/javascripts/spree.js +37 -2
- data/public/javascripts/taxonomy.js +138 -144
- data/public/javascripts/zone.js +0 -8
- data/public/robots.txt +10 -1
- data/public/stylesheets/admin/admin-tables.css +1 -1
- data/public/stylesheets/admin/admin.css +147 -50
- data/public/stylesheets/admin/dashboard.css +143 -0
- data/public/stylesheets/admin/edit-checkouts.css +57 -0
- data/public/stylesheets/admin/edit_checkouts.css +57 -0
- data/public/stylesheets/admin/edit_orders.css +65 -0
- data/public/stylesheets/bundle_admin.css +484 -0
- data/public/stylesheets/bundle_calendar_date_select.css +137 -0
- data/public/stylesheets/bundle_compiled.css +459 -0
- data/public/stylesheets/compiled/screen.css +1 -19
- data/public/stylesheets/datepicker.css +263 -0
- data/public/stylesheets/jquery.autocomplete.css +48 -0
- data/public/stylesheets/screen.css +1181 -0
- data/spec/controllers/products_controller_spec.rb +1 -11
- data/spec/fixtures/gateways.yml +8 -3
- data/spec/models/property_spec.rb +2 -3
- data/spec/models/prototype_spec.rb +1 -1
- data/spec/spec_helper.rb +10 -11
- data/test/factories/address_factory.rb +3 -3
- data/test/factories/adjustments_factory.rb +6 -11
- data/test/factories/checkout_factory.rb +4 -4
- data/test/factories/creditcard_factory.rb +6 -7
- data/test/factories/inventory_unit_factory.rb +1 -0
- data/test/factories/line_item_factory.rb +2 -2
- data/test/factories/order_factory.rb +4 -2
- data/test/factories/payment_factory.rb +26 -0
- data/test/factories/product_factory.rb +2 -1
- data/test/factories/product_group_factory.rb +10 -0
- data/test/factories/role_factory.rb +6 -2
- data/test/factories/user_factory.rb +9 -1
- data/test/factories/variant_factory.rb +3 -2
- data/test/factories/zone_factory.rb +8 -0
- data/test/fixtures/payment_methods.yml +18 -0
- data/test/functional/admin/adjustments_controller_test.rb +165 -0
- data/test/functional/admin/checkouts_controller_test.rb +86 -0
- data/test/functional/admin/configurations_controller_test.rb +41 -0
- data/test/functional/admin/line_items_controller_test.rb +177 -0
- data/test/functional/admin/payments_controller_test.rb +120 -0
- data/test/functional/admin/product_groups_controller_test.rb +41 -0
- data/test/functional/admin/products_controller_test.rb +166 -0
- data/test/functional/admin/reports_controller_test.rb +28 -0
- data/test/functional/admin/return_authorizations_controller_test.rb +8 -0
- data/test/functional/admin/shipments_controller_test.rb +61 -0
- data/test/functional/checkouts_controller_test.rb +110 -62
- data/test/functional/line_items_controller_test.rb +26 -0
- data/test/functional/products_controller_test.rb +0 -1
- data/test/integration/searching_test.rb +175 -0
- data/test/shoulda_macros/should_redirect.rb +15 -0
- data/test/test_helper.rb +51 -7
- data/test/unit/address_test.rb +22 -2
- data/test/unit/adjustment_test.rb +96 -0
- data/test/unit/charge_test.rb +28 -4
- data/test/unit/checkout_test.rb +99 -3
- data/test/unit/credit_test.rb +2 -3
- data/test/unit/creditcard_payment_test.rb +2 -20
- data/test/unit/creditcard_test.rb +104 -16
- data/test/unit/factories_test.rb +1 -1
- data/test/unit/flat_percent_item_total_test.rb +3 -2
- data/test/unit/helpers/admin/adjustments_helper_test.rb +4 -0
- data/test/unit/helpers/admin/credits_helper_test.rb +4 -0
- data/test/unit/helpers/admin/return_authorizations_helper_test.rb +4 -0
- data/test/unit/inventory_unit_test.rb +4 -6
- data/test/unit/line_item_test.rb +1 -1
- data/test/unit/order_mailer_test.rb +48 -0
- data/test/unit/order_state_test.rb +191 -0
- data/test/unit/order_test.rb +91 -11
- data/test/unit/payment_test.rb +54 -0
- data/test/unit/preference_definition_test.rb +192 -0
- data/test/unit/product_group_test.rb +260 -0
- data/test/unit/product_scope_test.rb +62 -0
- data/test/unit/product_test.rb +20 -11
- data/test/unit/return_authorization_test.rb +104 -0
- data/test/unit/shipment_test.rb +175 -0
- data/test/unit/shipping_method_test.rb +4 -4
- data/test/unit/state_event_test.rb +17 -6
- data/test/unit/tax_rate_test.rb +1 -1
- data/test/unit/variant_test.rb +25 -12
- data/vendor/extensions/api/README.markdown +5 -0
- data/vendor/extensions/api/Rakefile +137 -0
- data/vendor/extensions/api/api_extension.rb +75 -0
- data/vendor/extensions/api/api_hooks.rb +3 -0
- data/vendor/extensions/api/app/controllers/api/base_controller.rb +90 -0
- data/vendor/extensions/api/app/controllers/api/inventory_units_controller.rb +12 -0
- data/vendor/extensions/api/app/controllers/api/line_items_controller.rb +16 -0
- data/vendor/extensions/api/app/controllers/api/orders_controller.rb +17 -0
- data/vendor/extensions/api/app/controllers/api/products_controller.rb +10 -0
- data/vendor/extensions/api/app/controllers/api/shipments_controller.rb +35 -0
- data/vendor/extensions/api/app/helpers/api/shipments_helper.rb +2 -0
- data/vendor/extensions/api/app/views/admin/users/_api_fields.html.erb +16 -0
- data/vendor/extensions/api/config/locales/en-US.yml +16 -0
- data/vendor/extensions/api/config/locales/ru-RU.yml +16 -0
- data/vendor/extensions/api/config/routes.rb +15 -0
- data/vendor/extensions/api/db/migrate/20100107141738_add_api_key_to_users.rb +9 -0
- data/vendor/extensions/api/db/seeds.rb +2 -0
- data/vendor/extensions/api/lib/tasks/api_extension_tasks.rake +17 -0
- data/vendor/extensions/api/test/functional/admin/users_controller_test.rb +32 -0
- data/vendor/extensions/api/test/integration/inventory_units_api_test.rb +36 -0
- data/vendor/extensions/api/test/integration/orders_api_test.rb +125 -0
- data/vendor/extensions/api/test/integration/shipments_api_test.rb +117 -0
- data/vendor/extensions/api/test/test_helper.rb +53 -0
- data/vendor/extensions/api/test/unit/user_test.rb +21 -0
- data/vendor/extensions/localization/app/controllers/locale_controller.rb +5 -3
- data/vendor/extensions/localization/localization_extension.rb +1 -1
- data/vendor/extensions/overview_dashboard/README.markdown +3 -0
- data/vendor/extensions/overview_dashboard/Rakefile +137 -0
- data/vendor/extensions/overview_dashboard/app/controllers/admin/overview_controller.rb +142 -0
- data/vendor/extensions/overview_dashboard/app/views/admin/overview/index.html.erb +174 -0
- data/vendor/extensions/overview_dashboard/config/routes.rb +5 -0
- data/vendor/extensions/overview_dashboard/db/seeds.rb +2 -0
- data/vendor/extensions/overview_dashboard/lib/tasks/overview_dashboard_extension_tasks.rake +28 -0
- data/vendor/extensions/overview_dashboard/overview_dashboard_extension.rb +9 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/dashboard.js +143 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/jqPlot/excanvas.min.js +1 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/jqPlot/jquery.jqplot.min.js +14 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/jqPlot/plugins/jqplot.canvasAxisLabelRenderer.min.js +14 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/jqPlot/plugins/jqplot.canvasAxisTickRenderer.min.js +14 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/jqPlot/plugins/jqplot.canvasTextRenderer.min.js +14 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js +14 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/jqPlot/plugins/jqplot.dateAxisRenderer.min.js +14 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/jqPlot/plugins/jqplot.highlighter.min.js +14 -0
- data/vendor/extensions/overview_dashboard/public/javascripts/jqPlot/plugins/jqplot.pieRenderer.min.js +14 -0
- data/vendor/extensions/overview_dashboard/public/stylesheets/admin/dashboard.css +143 -0
- data/vendor/extensions/overview_dashboard/spec/spec.opts +6 -0
- data/vendor/extensions/overview_dashboard/spec/spec_helper.rb +37 -0
- data/vendor/extensions/payment_gateway/app/models/gateway.rb +47 -2
- data/vendor/extensions/payment_gateway/app/models/gateway/authorize_net.rb +8 -0
- data/vendor/extensions/payment_gateway/app/models/gateway/authorize_net_cim.rb +104 -0
- data/vendor/extensions/payment_gateway/app/models/gateway/beanstream.rb +164 -0
- data/vendor/extensions/payment_gateway/app/models/gateway/bogus.rb +80 -0
- data/vendor/extensions/payment_gateway/app/models/gateway/linkpoint.rb +8 -0
- data/vendor/extensions/payment_gateway/app/models/gateway/pay_pal.rb +11 -0
- data/vendor/extensions/payment_gateway/app/models/gateway/protx.rb +9 -0
- data/vendor/extensions/payment_gateway/config/locales/en-US.yml +6 -0
- data/vendor/extensions/payment_gateway/config/locales/ru-RU.yml +6 -0
- data/vendor/extensions/payment_gateway/config/routes.rb +2 -4
- data/vendor/extensions/payment_gateway/db/migrate/20091008091614_move_to_configurable_gateways.rb +55 -0
- data/vendor/extensions/payment_gateway/lib/active_merchant/billing/authorize_net_cim.rb +869 -0
- data/vendor/extensions/payment_gateway/lib/spree/payment_gateway.rb +161 -57
- data/vendor/extensions/payment_gateway/payment_gateway_extension.rb +22 -4
- data/vendor/extensions/payment_gateway/public/javascripts/gateway.js +13 -0
- data/vendor/extensions/payment_gateway/spec/models/creditcard_spec.rb +1 -10
- data/vendor/extensions/payment_gateway/test/mocks/authorize_net_cim_mock.rb +59 -0
- data/vendor/extensions/payment_gateway/test/test_helper.rb +14 -0
- data/vendor/extensions/payment_gateway/test/unit/authorize_net_cim_test.rb +85 -0
- data/vendor/extensions/payment_gateway/test/unit/creditcard_with_authorize_net_cim_test.rb +117 -0
- data/vendor/extensions/theme_default/HOOKS.markdown +88 -0
- data/vendor/extensions/theme_default/README.markdown +3 -0
- data/vendor/extensions/theme_default/Rakefile +120 -0
- data/vendor/extensions/theme_default/app/stylesheets/_buttons.less +75 -0
- data/vendor/extensions/theme_default/app/stylesheets/_cart.less +24 -0
- data/vendor/extensions/theme_default/app/stylesheets/_checkout.less +69 -0
- data/vendor/extensions/theme_default/app/stylesheets/_checkout_progress.less +62 -0
- data/vendor/extensions/theme_default/app/stylesheets/_colors.less +16 -0
- data/vendor/extensions/theme_default/app/stylesheets/_forms.less +50 -0
- data/vendor/extensions/theme_default/app/stylesheets/_layout.less +72 -0
- data/vendor/extensions/theme_default/app/stylesheets/_messages.less +32 -0
- data/vendor/extensions/theme_default/app/stylesheets/_mixins.less +71 -0
- data/vendor/extensions/theme_default/app/stylesheets/_navigation.less +130 -0
- data/vendor/extensions/theme_default/app/stylesheets/_prices.less +18 -0
- data/vendor/extensions/theme_default/app/stylesheets/_product_details.less +56 -0
- data/vendor/extensions/theme_default/app/stylesheets/_product_lists.less +66 -0
- data/vendor/extensions/theme_default/app/stylesheets/_registration.less +24 -0
- data/vendor/extensions/theme_default/app/stylesheets/_reset.less +69 -0
- data/vendor/extensions/theme_default/app/stylesheets/_typography.less +158 -0
- data/vendor/extensions/theme_default/app/stylesheets/screen.css +11 -0
- data/vendor/extensions/theme_default/app/stylesheets/screen.less +13 -0
- data/{app → vendor/extensions/theme_default/app}/views/account/login.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/adjustments/_form.html.erb +21 -0
- data/vendor/extensions/theme_default/app/views/admin/adjustments/edit.html.erb +13 -0
- data/vendor/extensions/theme_default/app/views/admin/adjustments/index.html.erb +36 -0
- data/vendor/extensions/theme_default/app/views/admin/adjustments/new.html.erb +13 -0
- data/vendor/extensions/theme_default/app/views/admin/checkouts/_form.html.erb +16 -0
- data/vendor/extensions/theme_default/app/views/admin/checkouts/edit.html.erb +21 -0
- data/vendor/extensions/theme_default/app/views/admin/checkouts/show.html.erb +120 -0
- data/vendor/extensions/theme_default/app/views/admin/configurations/index.html.erb +74 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/configurations/new.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/coupons/_form.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/coupons/edit.html.erb +6 -0
- data/vendor/extensions/theme_default/app/views/admin/coupons/index.html.erb +40 -0
- data/vendor/extensions/theme_default/app/views/admin/coupons/new.html.erb +7 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/extensions/index.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/general_settings/edit.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/general_settings/show.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/images/_form.html.erb +12 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/images/edit.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/images/index.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/images/new.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/inventory_settings/edit.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/inventory_settings/show.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/inventory_units/adjust.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/mail_settings/edit.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/mail_settings/show.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/option_types/_form.html.erb +33 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/option_types/_option_value.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/option_types/available.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/option_types/edit.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/option_types/index.html.erb +37 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/option_types/new.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/option_types/selected.html.erb +38 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/_add_product.html.erb +24 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/_form.html.erb +70 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/_line_item.html.erb +16 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/edit.html.erb +25 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/history.html.erb +25 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/index.html.erb +96 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/new.html.erb +19 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/show.html.erb +45 -0
- data/vendor/extensions/theme_default/app/views/admin/payment_methods/_form.html.erb +45 -0
- data/vendor/extensions/theme_default/app/views/admin/payment_methods/edit.html.erb +10 -0
- data/vendor/extensions/theme_default/app/views/admin/payment_methods/index.html.erb +36 -0
- data/vendor/extensions/theme_default/app/views/admin/payment_methods/new.html.erb +11 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/_bill_address_form.html.erb +9 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/_card_form.html.erb +49 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/_form.html.erb +15 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/_list.html.erb +24 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/_transaction_list.html.erb +24 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/credit.html.erb +14 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/index.html.erb +27 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/new.html.erb +19 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/show.html.erb +10 -0
- data/{app/views/admin/shared/_order_sub_menu.html.erb → vendor/extensions/theme_default/app/views/admin/payments/source_forms/_check.html.erb} +0 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/source_forms/_gateway.html.erb +43 -0
- data/vendor/{plugins/paperclip/test/fixtures/text.txt → extensions/theme_default/app/views/admin/payments/source_views/_check.html.erb} +0 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/source_views/_gateway.html.erb +35 -0
- data/vendor/extensions/theme_default/app/views/admin/product_groups/_preview.html.erb +34 -0
- data/vendor/extensions/theme_default/app/views/admin/product_groups/_product_scope.html.erb +24 -0
- data/vendor/extensions/theme_default/app/views/admin/product_groups/edit.html.erb +56 -0
- data/vendor/extensions/theme_default/app/views/admin/product_groups/index.html.erb +35 -0
- data/vendor/extensions/theme_default/app/views/admin/product_groups/new.html.erb +12 -0
- data/vendor/extensions/theme_default/app/views/admin/product_groups/show.html.erb +32 -0
- data/vendor/extensions/theme_default/app/views/admin/product_groups/update.js.erb +7 -0
- data/vendor/extensions/theme_default/app/views/admin/product_properties/_product_property.html.erb +17 -0
- data/vendor/extensions/theme_default/app/views/admin/product_properties/index.html.erb +59 -0
- data/vendor/extensions/theme_default/app/views/admin/product_scopes/create.js.erb +3 -0
- data/vendor/extensions/theme_default/app/views/admin/product_scopes/destroy.js.erb +2 -0
- data/vendor/extensions/theme_default/app/views/admin/product_scopes/new.html.erb +1 -0
- data/vendor/extensions/theme_default/app/views/admin/products/_form.html.erb +104 -0
- data/vendor/extensions/theme_default/app/views/admin/products/_option_types.html.erb +40 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/products/_properties_form.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/products/edit.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/products/index.html.erb +85 -0
- data/vendor/extensions/theme_default/app/views/admin/products/new.html.erb +53 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/products/show.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/properties/_form.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/properties/edit.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/properties/filtered.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/properties/index.html.erb +43 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/properties/new.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/prototypes/_form.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/prototypes/available.html.erb +22 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/prototypes/edit.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/prototypes/index.html.erb +40 -0
- data/vendor/extensions/theme_default/app/views/admin/prototypes/new.html.erb +11 -0
- data/vendor/extensions/theme_default/app/views/admin/prototypes/select.rjs +7 -0
- data/vendor/extensions/theme_default/app/views/admin/reports/index.html.erb +19 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/reports/sales_total.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/return_authorizations/_form.html.erb +64 -0
- data/vendor/extensions/theme_default/app/views/admin/return_authorizations/edit.html.erb +27 -0
- data/vendor/extensions/theme_default/app/views/admin/return_authorizations/index.html.erb +43 -0
- data/vendor/extensions/theme_default/app/views/admin/return_authorizations/new.html.erb +13 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_additional_field.html.erb +5 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_address.html.erb +5 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_address_form.html.erb +67 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_calculator_fields.html.erb +16 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_configuration_menu.html.erb +22 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/shared/_edit_resource_links.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/shared/_new_resource_links.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/shared/_order_details.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_order_sub_menu.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_order_tabs.html.erb +52 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_product_sub_menu.html.erb +11 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_product_tabs.html.erb +44 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_report_criteria.html.erb +15 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/shared/_show_resource_links.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/shared/_tabs.html.erb +6 -0
- data/vendor/extensions/theme_default/app/views/admin/shipments/_form.html.erb +76 -0
- data/vendor/extensions/theme_default/app/views/admin/shipments/edit.html.erb +40 -0
- data/vendor/extensions/theme_default/app/views/admin/shipments/index.html.erb +44 -0
- data/vendor/extensions/theme_default/app/views/admin/shipments/new.html.erb +18 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/shipping_categories/_form.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_categories/edit.html.erb +6 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_categories/index.html.erb +29 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_categories/new.html.erb +8 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_methods/_form.html.erb +19 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_methods/edit.html.erb +16 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_methods/index.html.erb +46 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_methods/new.html.erb +17 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/shipping_rates/_form.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_rates/edit.html.erb +6 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_rates/index.html.erb +32 -0
- data/vendor/extensions/theme_default/app/views/admin/shipping_rates/new.html.erb +8 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/states/_form.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/states/_state_list.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/states/edit.html.erb +10 -0
- data/vendor/extensions/theme_default/app/views/admin/states/index.html.erb +25 -0
- data/vendor/extensions/theme_default/app/views/admin/states/new.html.erb +10 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/tax_categories/_form.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/tax_categories/edit.html.erb +10 -0
- data/vendor/extensions/theme_default/app/views/admin/tax_categories/index.html.erb +37 -0
- data/vendor/extensions/theme_default/app/views/admin/tax_categories/new.html.erb +10 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/tax_categories/show.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/tax_rates/_form.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/tax_rates/edit.html.erb +6 -0
- data/vendor/extensions/theme_default/app/views/admin/tax_rates/index.html.erb +34 -0
- data/vendor/extensions/theme_default/app/views/admin/tax_rates/new.html.erb +8 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/tax_settings/edit.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/tax_settings/show.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/_form.html.erb +7 -0
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/_js_head.html.erb +11 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/taxonomies/_list.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/taxonomies/_manage_products.rhtml +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/taxonomies/_success.rhtml +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/taxonomies/_taxon.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/edit.html.erb +49 -0
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/get_children.json.erb +9 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/taxonomies/index.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/taxonomies/new.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/taxons/_form.html.erb +13 -0
- data/vendor/extensions/theme_default/app/views/admin/taxons/_taxon_table.html.erb +28 -0
- data/vendor/extensions/theme_default/app/views/admin/taxons/available.js.erb +36 -0
- data/vendor/extensions/theme_default/app/views/admin/taxons/edit.html.erb +11 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/taxons/remove.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/taxons/select.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/taxons/selected.html.erb +42 -0
- data/vendor/extensions/theme_default/app/views/admin/trackers/_form.html.erb +26 -0
- data/vendor/extensions/theme_default/app/views/admin/trackers/edit.html.erb +8 -0
- data/vendor/extensions/theme_default/app/views/admin/trackers/index.html.erb +41 -0
- data/vendor/extensions/theme_default/app/views/admin/trackers/new.html.erb +9 -0
- data/vendor/extensions/theme_default/app/views/admin/users/_form.html.erb +36 -0
- data/vendor/extensions/theme_default/app/views/admin/users/edit.html.erb +16 -0
- data/vendor/extensions/theme_default/app/views/admin/users/index.html.erb +62 -0
- data/vendor/extensions/theme_default/app/views/admin/users/new.html.erb +16 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/users/show.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/variants/_form.html.erb +38 -0
- data/vendor/extensions/theme_default/app/views/admin/variants/edit.html.erb +13 -0
- data/vendor/extensions/theme_default/app/views/admin/variants/index.html.erb +54 -0
- data/vendor/extensions/theme_default/app/views/admin/variants/new.html.erb +11 -0
- data/vendor/extensions/theme_default/app/views/admin/zones/_country_member.html.erb +5 -0
- data/vendor/extensions/theme_default/app/views/admin/zones/_form.html.erb +29 -0
- data/{app → vendor/extensions/theme_default/app}/views/admin/zones/_member_type.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/admin/zones/_state_member.html.erb +5 -0
- data/vendor/extensions/theme_default/app/views/admin/zones/_zone_member.html.erb +5 -0
- data/vendor/extensions/theme_default/app/views/admin/zones/edit.html.erb +10 -0
- data/vendor/extensions/theme_default/app/views/admin/zones/index.html.erb +40 -0
- data/vendor/extensions/theme_default/app/views/admin/zones/new.html.erb +10 -0
- data/vendor/extensions/theme_default/app/views/checkouts/_address.html.erb +163 -0
- data/vendor/extensions/theme_default/app/views/checkouts/_confirm.html.erb +11 -0
- data/vendor/extensions/theme_default/app/views/checkouts/_delivery.html.erb +33 -0
- data/vendor/extensions/theme_default/app/views/checkouts/_guest_checkout.html.erb +9 -0
- data/vendor/extensions/theme_default/app/views/checkouts/_payment.html.erb +33 -0
- data/vendor/extensions/theme_default/app/views/checkouts/_summary.html.erb +36 -0
- data/vendor/extensions/theme_default/app/views/checkouts/edit.html.erb +20 -0
- data/vendor/extensions/theme_default/app/views/checkouts/payment/_check.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/checkouts/payment/_gateway.html.erb +31 -0
- data/vendor/extensions/theme_default/app/views/checkouts/register.html.erb +13 -0
- data/{app → vendor/extensions/theme_default/app}/views/content/cvv.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/countries/index.js.erb +0 -0
- data/vendor/extensions/theme_default/app/views/layouts/admin.html.erb +77 -0
- data/vendor/extensions/theme_default/app/views/layouts/spree_application.html.erb +48 -0
- data/{app → vendor/extensions/theme_default/app}/views/order_mailer/cancel.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/order_mailer/confirm.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/orders/_form.html.erb +25 -0
- data/vendor/extensions/theme_default/app/views/orders/_line_item.html.erb +43 -0
- data/vendor/extensions/theme_default/app/views/orders/edit.html.erb +29 -0
- data/{app → vendor/extensions/theme_default/app}/views/orders/new.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/orders/show.html.erb +16 -0
- data/vendor/extensions/theme_default/app/views/password_resets/edit.html.erb +12 -0
- data/vendor/extensions/theme_default/app/views/password_resets/new.html.erb +12 -0
- data/vendor/extensions/theme_default/app/views/products/_cart_form.html.erb +54 -0
- data/{app → vendor/extensions/theme_default/app}/views/products/_image.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/products/_properties.html.erb +8 -0
- data/vendor/extensions/theme_default/app/views/products/_taxons.html.erb +16 -0
- data/vendor/extensions/theme_default/app/views/products/_thumbnails.html.erb +40 -0
- data/vendor/extensions/theme_default/app/views/products/index.html.erb +31 -0
- data/vendor/extensions/theme_default/app/views/products/show.html.erb +29 -0
- data/vendor/extensions/theme_default/app/views/shared/_additional_field.html.erb +7 -0
- data/vendor/extensions/theme_default/app/views/shared/_admin_head.html.erb +21 -0
- data/{app → vendor/extensions/theme_default/app}/views/shared/_edit_resource_links.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/shared/_filters.html.erb +52 -0
- data/vendor/extensions/theme_default/app/views/shared/_footer.html.erb +11 -0
- data/vendor/extensions/theme_default/app/views/shared/_google_analytics.html.erb +39 -0
- data/vendor/extensions/theme_default/app/views/shared/_head.html.erb +9 -0
- data/vendor/extensions/theme_default/app/views/shared/_login.html.erb +37 -0
- data/{app → vendor/extensions/theme_default/app}/views/shared/_login_bar.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/shared/_nav_bar.html.erb +5 -0
- data/{app → vendor/extensions/theme_default/app}/views/shared/_new_resource_links.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/shared/_order_details.html.erb +60 -0
- data/vendor/extensions/theme_default/app/views/shared/_products.html.erb +33 -0
- data/vendor/extensions/theme_default/app/views/shared/_search.html.erb +9 -0
- data/{app → vendor/extensions/theme_default/app}/views/shared/_show_resource_links.html.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/shared/_store_menu.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/shared/_taxonomies.html.erb +10 -0
- data/vendor/extensions/theme_default/app/views/shared/_test_hook.html.erb +1 -0
- data/vendor/extensions/theme_default/app/views/shared/_user_form.html.erb +32 -0
- data/{app → vendor/extensions/theme_default/app}/views/states/index.js.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/taxons/_taxon.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/taxons/show.html.erb +17 -0
- data/{app → vendor/extensions/theme_default/app}/views/user_mailer/password_reset_instructions.erb +0 -0
- data/{app → vendor/extensions/theme_default/app}/views/user_sessions/authorization_failure.html.erb +0 -0
- data/vendor/extensions/theme_default/app/views/user_sessions/new.html.erb +8 -0
- data/vendor/extensions/theme_default/app/views/users/_openid_identifier.html.erb +10 -0
- data/vendor/extensions/theme_default/app/views/users/edit.html.erb +9 -0
- data/vendor/extensions/theme_default/app/views/users/new.html.erb +22 -0
- data/vendor/extensions/theme_default/app/views/users/show.html.erb +46 -0
- data/vendor/extensions/theme_default/lib/tasks/theme_default_extension_tasks.rake +28 -0
- data/vendor/extensions/theme_default/public/images/add-to-cart.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/active-tab.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/admin_tab_back.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/admin_tab_selected_back.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/content-back-blue.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/content-back-green.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/content-back.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/flash-error.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/flash-notice.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/green-stripes.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/green-stripes.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/grid_header_back.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/grid_header_back_green.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/header-bg.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/header_bg.jpg +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/menu-current.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/red-stripes.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/red-stripes.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/spree_50.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/subnav-divider.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/subnav.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/bg/tab-back.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/blue/left_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/blue/right_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/drag-handle-green.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/green/left_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/green/right_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/left_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/left_01_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/orange/left_03.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/orange/right_03.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/right_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/buttons/right_01_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/1.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/10.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/2.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/3.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/4.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/5.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/6.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/7.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/8.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/16x16/9.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/1.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/10.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/11.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/2.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/3.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/4.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/5.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/6.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/7.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/8.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/32x32/9.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/accept.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/add.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/add.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/arrow-down.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/cross.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/delete.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/delete.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/drag.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/edit.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/edit.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/email.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/error.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/exclamation.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/feed.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/pdf.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/reorder.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/search.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/send-email.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/stop.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/tick.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/up.gif +0 -0
- data/vendor/extensions/theme_default/public/images/admin/icons/xls.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/tabs/off-left.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/tabs/off-right.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/tabs/on-left.png +0 -0
- data/vendor/extensions/theme_default/public/images/admin/tabs/on-right.png +0 -0
- data/vendor/extensions/theme_default/public/images/ajax_loader.gif +0 -0
- data/vendor/extensions/theme_default/public/images/amex_cid.gif +0 -0
- data/vendor/extensions/theme_default/public/images/bg-button-hover.png +0 -0
- data/vendor/extensions/theme_default/public/images/bg-button-pressed.png +0 -0
- data/vendor/extensions/theme_default/public/images/bg-button.gif +0 -0
- data/vendor/extensions/theme_default/public/images/bg-button.png +0 -0
- data/vendor/extensions/theme_default/public/images/blue/left_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/blue/right_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/body-back.png +0 -0
- data/vendor/extensions/theme_default/public/images/bottom_shine.png +0 -0
- data/vendor/extensions/theme_default/public/images/breadcrumb.gif +0 -0
- data/vendor/extensions/theme_default/public/images/button-dark-hover.png +0 -0
- data/vendor/extensions/theme_default/public/images/button-dark.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/bg-button-hover.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/bg-button-pressed.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/bg-button.gif +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/bg-button.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/blue/left_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/blue/right_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/button-dark-hover.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/button-dark.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/drag-handle-green.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/green/left_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/green/right_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/left_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/left_01_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/orange/left_03.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/orange/right_03.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/right_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/right_01_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/sxsw-ribbon-v1.png +0 -0
- data/vendor/extensions/theme_default/public/images/buttons/top-shine.png +0 -0
- data/vendor/extensions/theme_default/public/images/calendar_date_select/calendar.gif +0 -0
- data/vendor/extensions/theme_default/public/images/cart-empty.png +0 -0
- data/vendor/extensions/theme_default/public/images/cart-empty_x32.png +0 -0
- data/vendor/extensions/theme_default/public/images/cart-full.png +0 -0
- data/vendor/extensions/theme_default/public/images/cart-full_x32.png +0 -0
- data/vendor/extensions/theme_default/public/images/checkout.png +0 -0
- data/vendor/extensions/theme_default/public/images/creditcard.gif +0 -0
- data/vendor/extensions/theme_default/public/images/datepicker/backstripes.gif +0 -0
- data/vendor/extensions/theme_default/public/images/datepicker/bg_header.jpg +0 -0
- data/vendor/extensions/theme_default/public/images/datepicker/bullet1.gif +0 -0
- data/vendor/extensions/theme_default/public/images/datepicker/bullet2.gif +0 -0
- data/vendor/extensions/theme_default/public/images/datepicker/cal.gif +0 -0
- data/vendor/extensions/theme_default/public/images/datepicker/gradient-e5e5e5-ffffff.gif +0 -0
- data/vendor/extensions/theme_default/public/images/discover_cid.gif +0 -0
- data/vendor/extensions/theme_default/public/images/drag-handle-green.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ad.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ae.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/af.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ag.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ai.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/al.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/am.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/an.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ao.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ar.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/as.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/at.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/au.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/aw.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ax.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/az.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ba.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bb.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bd.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/be.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bf.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bg.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bh.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bi.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bj.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bo.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/br.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bs.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bt.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bv.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bw.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/by.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/bz.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ca.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/catalonia.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cc.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cd.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cf.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cg.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ch.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ci.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ck.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cl.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/co.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cs.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cu.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cv.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cx.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cy.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/cz.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/da.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/de.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/de_CH.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/dj.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/dm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/do.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/dz.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ec.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ee.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/eg.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/eh.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/england.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/er.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/es.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/et.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/europeanunion.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/fam.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/fi.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/fj.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/fk.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/fm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/fo.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/fr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ga.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gb.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gd.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ge.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gf.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gh.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gi.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gl.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gp.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gq.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gs.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gt.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gu.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gw.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/gy.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/hk.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/hm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/hn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/hr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ht.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/hu.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/id.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ie.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/il.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/in.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/io.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/iq.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ir.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/is.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/it.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/jm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/jo.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/jp.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ke.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/kg.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/kh.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ki.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/km.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/kn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/kp.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/kr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/kw.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ky.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/kz.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/la.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/lb.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/lc.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/li.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/lk.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/lr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ls.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/lt.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/lu.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/lv.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ly.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ma.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mc.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/md.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/me.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mg.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mh.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mk.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ml.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mo.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mp.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mq.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ms.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mt.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mu.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mv.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mw.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mx.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/my.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/mz.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/na.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/nc.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ne.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/nf.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ng.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ni.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/nl.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/no.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/np.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/nr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/nu.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/nz.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/om.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pa.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pe.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pf.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pg.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ph.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pk.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pl.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ps.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pt.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/pw.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/py.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/qa.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/re.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ro.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/rs.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ru.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/rw.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sa.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sb.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sc.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/scotland.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sd.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/se.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sg.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sh.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/si.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sj.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sk.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sl.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/so.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/st.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sv.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sy.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/sz.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tc.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/td.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tf.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tg.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/th.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tj.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tk.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tl.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/to.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tr.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tt.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tv.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tw.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/tz.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ua.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ug.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/um.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/us.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/uy.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/uz.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/va.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/vc.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ve.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/vg.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/vi.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/vn.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/vu.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/wales.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/wf.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ws.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/ye.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/yt.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/za.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/zm.png +0 -0
- data/vendor/extensions/theme_default/public/images/flags/zw.png +0 -0
- data/vendor/extensions/theme_default/public/images/green/left_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/green/right_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/grid.png +0 -0
- data/vendor/extensions/theme_default/public/images/left_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/left_01_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/master_cid.jpg +0 -0
- data/vendor/extensions/theme_default/public/images/menu-current.png +0 -0
- data/vendor/extensions/theme_default/public/images/menu-hover.png +0 -0
- data/vendor/extensions/theme_default/public/images/noimage/mini.jpg +0 -0
- data/vendor/extensions/theme_default/public/images/noimage/product.jpg +0 -0
- data/vendor/extensions/theme_default/public/images/noimage/small.jpg +0 -0
- data/vendor/extensions/theme_default/public/images/openid-inputicon.gif +0 -0
- data/vendor/extensions/theme_default/public/images/orange/left_03.png +0 -0
- data/vendor/extensions/theme_default/public/images/orange/right_03.png +0 -0
- data/vendor/extensions/theme_default/public/images/progress.gif +0 -0
- data/vendor/extensions/theme_default/public/images/rails.png +0 -0
- data/vendor/extensions/theme_default/public/images/right_01.png +0 -0
- data/vendor/extensions/theme_default/public/images/right_01_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/separator.png +0 -0
- data/vendor/extensions/theme_default/public/images/shadow-top.png +0 -0
- data/vendor/extensions/theme_default/public/images/shadow_top.png +0 -0
- data/vendor/extensions/theme_default/public/images/spinner.gif +0 -0
- data/vendor/extensions/theme_default/public/images/spree.jpg +0 -0
- data/vendor/extensions/theme_default/public/images/spree/progress.gif +0 -0
- data/vendor/extensions/theme_default/public/images/spree/spinner.gif +0 -0
- data/vendor/extensions/theme_default/public/images/spree/spree.jpg +0 -0
- data/vendor/extensions/theme_default/public/images/step-progress/completed-completed.gif +0 -0
- data/vendor/extensions/theme_default/public/images/step-progress/completed-current.gif +0 -0
- data/vendor/extensions/theme_default/public/images/step-progress/completed-first.gif +0 -0
- data/vendor/extensions/theme_default/public/images/step-progress/current-first.gif +0 -0
- data/vendor/extensions/theme_default/public/images/step-progress/current-incomplete.gif +0 -0
- data/vendor/extensions/theme_default/public/images/step-progress/current-right.gif +0 -0
- data/vendor/extensions/theme_default/public/images/step-progress/incomplete-incomplete.gif +0 -0
- data/vendor/extensions/theme_default/public/images/step-progress/incomplete-right.gif +0 -0
- data/vendor/extensions/theme_default/public/images/steps/1.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/1_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/2.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/2_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/3.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/3_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/4.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/4_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/5.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/5_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/6.png +0 -0
- data/vendor/extensions/theme_default/public/images/steps/6_small.png +0 -0
- data/vendor/extensions/theme_default/public/images/sxsw-ribbon-v1.png +0 -0
- data/vendor/extensions/theme_default/public/images/tab_bottom.gif +0 -0
- data/vendor/extensions/theme_default/public/images/top-shine.png +0 -0
- data/vendor/extensions/theme_default/public/images/tree-nav-icons/bullet.gif +0 -0
- data/vendor/extensions/theme_default/public/images/tree-nav-icons/minus.gif +0 -0
- data/vendor/extensions/theme_default/public/images/tree-nav-icons/plus.gif +0 -0
- data/vendor/extensions/theme_default/public/images/tree-nav-icons/treeview-loading.gif +0 -0
- data/vendor/extensions/theme_default/public/images/tree-nav-icons/treeview-sprite.gif +0 -0
- data/vendor/extensions/theme_default/public/images/update.png +0 -0
- data/vendor/extensions/theme_default/public/images/visa_cid.gif +0 -0
- data/vendor/extensions/theme_default/public/images/wrapper-back-2.png +0 -0
- data/vendor/extensions/theme_default/public/images/wrapper-back.png +0 -0
- data/vendor/extensions/theme_default/public/images/yui-menubaritem_submenuindicator.png +0 -0
- data/vendor/extensions/theme_default/public/images/yui-menubaritem_submenuindicator_disabled.png +0 -0
- data/vendor/extensions/theme_default/public/images/yui-menuitem_checkbox.png +0 -0
- data/vendor/extensions/theme_default/public/images/yui-menuitem_checkbox_disabled.png +0 -0
- data/vendor/extensions/theme_default/public/images/yui-menuitem_submenuindicator.png +0 -0
- data/vendor/extensions/theme_default/public/images/yui-menuitem_submenuindicator_disabled.png +0 -0
- data/vendor/extensions/theme_default/public/images/yui-sprite.png +0 -0
- data/vendor/extensions/theme_default/public/javascripts/additional-methods.js +236 -0
- data/vendor/extensions/theme_default/public/javascripts/admin/address_states.js +25 -0
- data/vendor/extensions/theme_default/public/javascripts/admin/checkouts/edit.js +79 -0
- data/vendor/extensions/theme_default/public/javascripts/admin/orders/edit.js +96 -0
- data/vendor/extensions/theme_default/public/javascripts/admin/orders/edit_form.js +17 -0
- data/vendor/extensions/theme_default/public/javascripts/admin/payments/new.js +9 -0
- data/vendor/extensions/theme_default/public/javascripts/admin/unobtrusive_handlers.js +15 -0
- data/vendor/extensions/theme_default/public/javascripts/calculator.js +13 -0
- data/vendor/extensions/theme_default/public/javascripts/checkout.js +65 -0
- data/vendor/extensions/theme_default/public/javascripts/datepicker.js +1445 -0
- data/vendor/extensions/theme_default/public/javascripts/gateway.js +13 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery-1.3.2.min.js +19 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery-and-plugins.js +36 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery-ui.js +188 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.alerts/images/help.gif +0 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.alerts/images/important.gif +0 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.alerts/images/info.gif +0 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.alerts/images/title.gif +0 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.alerts/jquery.alerts.css +57 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.alerts/jquery.alerts.js +235 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.alerts/jquery.alerts.spree.css +30 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.autocomplete.min.js +13 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.js +19 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.suggest.js +276 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.template.js +255 -0
- data/vendor/extensions/theme_default/public/javascripts/jquery.validate.min.js +16 -0
- data/vendor/extensions/theme_default/public/javascripts/jrails.autocomplete.js +274 -0
- data/vendor/extensions/theme_default/public/javascripts/jrails.js +1 -0
- data/vendor/extensions/theme_default/public/javascripts/jsTree/jquery.tree.js +2058 -0
- data/vendor/extensions/theme_default/public/javascripts/jsTree/plugins/jquery.tree.contextmenu.js +129 -0
- data/vendor/extensions/theme_default/public/javascripts/jsTree/themes/apple/bg.jpg +0 -0
- data/{public/javascripts/jsTree/source/themes/spree/dot.gif → vendor/extensions/theme_default/public/javascripts/jsTree/themes/apple/dot_for_ie.gif} +0 -0
- data/vendor/extensions/theme_default/public/javascripts/jsTree/themes/apple/icons.png +0 -0
- data/vendor/extensions/theme_default/public/javascripts/jsTree/themes/apple/style.css +34 -0
- data/{public/javascripts/jsTree/source/themes/spree → vendor/extensions/theme_default/public/javascripts/jsTree/themes/apple}/throbber.gif +0 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/af.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/ar.js +50 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/de.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/du.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/en.js +42 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/es.js +41 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/fi.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/fr.js +44 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/gr.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/he.js +49 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/it.js +13 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/nl.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/no.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/pt.js +50 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/ro.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/ru.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/sp.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/sv.js +41 -0
- data/vendor/extensions/theme_default/public/javascripts/lang/ua.js +40 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_cn.js +24 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_cs.js +23 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_da.js +21 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_de.js +21 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_es.js +24 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_fr.js +23 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_hu.js +21 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_it.js +26 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_kk.js +23 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_nl.js +23 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_no.js +23 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_pl.js +23 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_ptbr.js +30 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_ro.js +24 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_ru.js +23 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_se.js +23 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_sk.js +21 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_tr.js +24 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_tw.js +24 -0
- data/vendor/extensions/theme_default/public/javascripts/localization/messages_ua.js +24 -0
- data/vendor/extensions/theme_default/public/javascripts/nested-attribute.js +25 -0
- data/vendor/extensions/theme_default/public/javascripts/open_id.js +15 -0
- data/vendor/extensions/theme_default/public/javascripts/product.js +49 -0
- data/vendor/extensions/theme_default/public/javascripts/spree.js +53 -0
- data/vendor/extensions/theme_default/public/javascripts/taxonomy.js +196 -0
- data/vendor/extensions/theme_default/public/javascripts/zone.js +40 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/admin-forms.css +159 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/admin-reset.css +67 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/admin-tables.css +31 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/admin-typography.css +117 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/admin.css +556 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/edit_checkouts.css +57 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/edit_orders.css +65 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/grids.css +314 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/reset-fonts-grids-2-6-0.css +7 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/yui-includes.css +14 -0
- data/vendor/extensions/theme_default/public/stylesheets/datepicker.css +263 -0
- data/vendor/extensions/theme_default/public/stylesheets/jquery.autocomplete.css +48 -0
- data/vendor/extensions/theme_default/public/stylesheets/scaffold.css +54 -0
- data/vendor/extensions/theme_default/public/stylesheets/screen.css +1181 -0
- data/vendor/extensions/theme_default/spec/spec.opts +6 -0
- data/vendor/extensions/theme_default/spec/spec_helper.rb +37 -0
- data/vendor/extensions/theme_default/theme_default_extension.rb +39 -0
- data/vendor/extensions/theme_default/theme_default_hooks.rb +2 -0
- data/vendor/plugins/attribute_fu/init.rb +10 -2
- data/vendor/plugins/attribute_fu/javascripts/jquery.template.js +255 -0
- data/vendor/plugins/attribute_fu/lib/attribute_fu/associated_form_helper.rb +12 -19
- data/vendor/plugins/attribute_fu/test/associated_form_helper_test.rb +48 -50
- data/vendor/plugins/awesome_nested_set/MIT-LICENSE +20 -0
- data/vendor/plugins/awesome_nested_set/README.rdoc +79 -0
- data/vendor/plugins/awesome_nested_set/Rakefile +54 -0
- data/vendor/plugins/awesome_nested_set/VERSION +1 -0
- data/vendor/plugins/awesome_nested_set/awesome_nested_set.gemspec +68 -0
- data/vendor/plugins/awesome_nested_set/init.rb +1 -0
- data/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb +592 -0
- data/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/helper.rb +40 -0
- data/vendor/plugins/awesome_nested_set/rails/init.rb +12 -0
- data/vendor/plugins/awesome_nested_set/test/application.rb +1 -0
- data/vendor/plugins/awesome_nested_set/test/awesome_nested_set/helper_test.rb +41 -0
- data/vendor/plugins/awesome_nested_set/test/awesome_nested_set_test.rb +758 -0
- data/vendor/plugins/awesome_nested_set/test/db/database.yml +18 -0
- data/vendor/plugins/awesome_nested_set/test/db/schema.rb +30 -0
- data/vendor/plugins/awesome_nested_set/test/fixtures/categories.yml +34 -0
- data/vendor/plugins/awesome_nested_set/test/fixtures/category.rb +15 -0
- data/vendor/plugins/awesome_nested_set/test/fixtures/departments.yml +3 -0
- data/vendor/plugins/awesome_nested_set/test/fixtures/notes.yml +38 -0
- data/vendor/plugins/awesome_nested_set/test/test_helper.rb +29 -0
- data/vendor/plugins/has_calculator/lib/has_calculator.rb +2 -2
- data/vendor/plugins/jrails/CHANGELOG +43 -0
- data/vendor/plugins/jrails/LICENSE +18 -0
- data/vendor/plugins/jrails/README.rdoc +21 -0
- data/vendor/plugins/jrails/Rakefile +18 -0
- data/vendor/plugins/jrails/VERSION.yml +4 -0
- data/vendor/plugins/jrails/bin/jrails +30 -0
- data/vendor/plugins/jrails/init.rb +1 -0
- data/vendor/plugins/jrails/install.rb +9 -0
- data/vendor/plugins/jrails/javascripts/jquery-ui.js +188 -0
- data/vendor/plugins/jrails/javascripts/jquery.js +19 -0
- data/vendor/plugins/jrails/javascripts/jrails.js +1 -0
- data/vendor/plugins/jrails/javascripts/sources/jrails.js +197 -0
- data/vendor/plugins/jrails/jrails.gemspec +50 -0
- data/vendor/plugins/jrails/lib/jrails.rb +421 -0
- data/vendor/plugins/jrails/rails/init.rb +15 -0
- data/vendor/plugins/jrails/tasks/jrails.rake +25 -0
- data/vendor/plugins/{acts_as_adjacency_list → jrails_auto_complete}/MIT-LICENSE +0 -0
- data/vendor/plugins/jrails_auto_complete/README +23 -0
- data/vendor/plugins/jrails_auto_complete/Rakefile +22 -0
- data/vendor/plugins/jrails_auto_complete/init.rb +2 -0
- data/vendor/plugins/jrails_auto_complete/install.rb +8 -0
- data/vendor/plugins/jrails_auto_complete/javascripts/jquery.suggest.js +276 -0
- data/vendor/plugins/jrails_auto_complete/javascripts/jrails.autocomplete.js +274 -0
- data/vendor/plugins/jrails_auto_complete/lib/form_helpers.rb +22 -0
- data/vendor/plugins/jrails_auto_complete/lib/jrails_auto_complete.rb +20 -0
- data/vendor/plugins/jrails_auto_complete/lib/jrails_auto_complete_macro_helper.rb +103 -0
- data/vendor/plugins/jrails_auto_complete/tasks/jrails_auto_complete_tasks.rake +4 -0
- data/vendor/plugins/jrails_auto_complete/test/jrails_auto_complete_test.rb +8 -0
- data/vendor/plugins/jrails_auto_complete/uninstall.rb +7 -0
- data/vendor/plugins/open_id_authentication/CHANGELOG +35 -0
- data/vendor/plugins/open_id_authentication/README +231 -0
- data/vendor/plugins/open_id_authentication/Rakefile +22 -0
- data/vendor/plugins/open_id_authentication/generators/open_id_authentication_tables/open_id_authentication_tables_generator.rb +11 -0
- data/vendor/plugins/open_id_authentication/generators/open_id_authentication_tables/templates/migration.rb +20 -0
- data/vendor/plugins/open_id_authentication/generators/upgrade_open_id_authentication_tables/templates/migration.rb +26 -0
- data/vendor/plugins/open_id_authentication/generators/upgrade_open_id_authentication_tables/upgrade_open_id_authentication_tables_generator.rb +11 -0
- data/vendor/plugins/open_id_authentication/init.rb +18 -0
- data/vendor/plugins/open_id_authentication/lib/open_id_authentication.rb +240 -0
- data/vendor/plugins/open_id_authentication/lib/open_id_authentication/association.rb +9 -0
- data/vendor/plugins/open_id_authentication/lib/open_id_authentication/db_store.rb +55 -0
- data/vendor/plugins/open_id_authentication/lib/open_id_authentication/nonce.rb +5 -0
- data/vendor/plugins/open_id_authentication/lib/open_id_authentication/request.rb +23 -0
- data/vendor/plugins/open_id_authentication/lib/open_id_authentication/timeout_fixes.rb +20 -0
- data/vendor/plugins/open_id_authentication/tasks/open_id_authentication_tasks.rake +30 -0
- data/vendor/plugins/open_id_authentication/test/normalize_test.rb +32 -0
- data/vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb +46 -0
- data/vendor/plugins/open_id_authentication/test/status_test.rb +14 -0
- data/vendor/plugins/open_id_authentication/test/test_helper.rb +17 -0
- data/vendor/plugins/resource_controller/lib/resource_controller/actions.rb +4 -4
- data/vendor/plugins/resource_controller/lib/resource_controller/controller.rb +17 -17
- data/vendor/plugins/resource_controller/lib/resource_controller/helpers/current_objects.rb +1 -1
- data/vendor/plugins/stump/License.txt +20 -0
- data/vendor/plugins/stump/README.rdoc +118 -0
- data/vendor/plugins/stump/init.rb +6 -0
- data/vendor/plugins/stump/lib/stump.rb +11 -0
- data/vendor/plugins/stump/lib/stump/core_ext/test_case.rb +21 -0
- data/vendor/plugins/stump/lib/stump/metaid.rb +17 -0
- data/vendor/plugins/stump/lib/stump/mock.rb +51 -0
- data/vendor/plugins/stump/lib/stump/mocks.rb +23 -0
- data/vendor/plugins/stump/lib/stump/proxy.rb +103 -0
- data/vendor/plugins/stump/lib/stump/stub.rb +34 -0
- data/vendor/plugins/stump/lib/stump/version.rb +9 -0
- data/vendor/plugins/unobtrusive_date_picker/MIT-LICENSE +19 -0
- data/vendor/plugins/unobtrusive_date_picker/README.rdoc +165 -0
- data/vendor/plugins/unobtrusive_date_picker/Rakefile +18 -0
- data/vendor/plugins/unobtrusive_date_picker/about.yml +7 -0
- data/vendor/plugins/unobtrusive_date_picker/init.rb +8 -0
- data/vendor/plugins/unobtrusive_date_picker/install.rb +14 -0
- data/vendor/plugins/unobtrusive_date_picker/lib/12_hour_time.rb +102 -0
- data/vendor/plugins/unobtrusive_date_picker/lib/unobtrusive_date_picker.rb +409 -0
- data/vendor/plugins/unobtrusive_date_picker/public/images/backstripes.gif +0 -0
- data/vendor/plugins/unobtrusive_date_picker/public/images/bg_header.jpg +0 -0
- data/vendor/plugins/unobtrusive_date_picker/public/images/bullet1.gif +0 -0
- data/vendor/plugins/unobtrusive_date_picker/public/images/bullet2.gif +0 -0
- data/vendor/plugins/unobtrusive_date_picker/public/images/cal.gif +0 -0
- data/vendor/plugins/unobtrusive_date_picker/public/images/gradient-e5e5e5-ffffff.gif +0 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/datepicker.js +1445 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/af.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/ar.js +50 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/de.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/du.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/en.js +42 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/es.js +41 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/fi.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/fr.js +44 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/gr.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/he.js +49 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/it.js +13 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/nl.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/no.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/pt.js +50 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/ro.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/ru.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/sp.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/sv.js +41 -0
- data/vendor/plugins/unobtrusive_date_picker/public/javascripts/lang/ua.js +40 -0
- data/vendor/plugins/unobtrusive_date_picker/public/stylesheets/datepicker.css +263 -0
- data/vendor/plugins/unobtrusive_date_picker/spec/date_picker_tag_spec.rb +122 -0
- data/vendor/plugins/unobtrusive_date_picker/spec/date_picker_text_field_spec.rb +54 -0
- data/vendor/plugins/unobtrusive_date_picker/spec/datepicker_html_class_options_spec.rb +281 -0
- data/vendor/plugins/unobtrusive_date_picker/spec/spec.opts +12 -0
- data/vendor/plugins/unobtrusive_date_picker/spec/spec_helper.rb +52 -0
- data/vendor/plugins/unobtrusive_date_picker/spec/tag_matcher.rb +142 -0
- data/vendor/plugins/unobtrusive_date_picker/spec/unobtrusive_date_picker_spec.rb +129 -0
- data/vendor/plugins/unobtrusive_date_picker/tasks/datepicker_tasks.rake +17 -0
- data/vendor/plugins/unobtrusive_date_picker/uninstall.rb +12 -0
- metadata +1441 -633
- data/app/controllers/admin/creditcard_payments_controller.rb +0 -49
- data/app/controllers/application.rb +0 -94
- data/app/helpers/admin/calculators_helper.rb +0 -2
- data/app/helpers/admin/configurations_helper.rb +0 -2
- data/app/helpers/admin/extensions_helper.rb +0 -2
- data/app/helpers/admin/mail_settings_helper.rb +0 -2
- data/app/helpers/admin/option_values_helper.rb +0 -2
- data/app/helpers/admin/shipping_categories_helper.rb +0 -2
- data/app/helpers/admin/shipping_methods_helper.rb +0 -2
- data/app/helpers/admin/tax_rates_helper.rb +0 -2
- data/app/helpers/admin/taxonomies_helper.rb +0 -3
- data/app/helpers/admin/variants_helper.rb +0 -2
- data/app/models/creditcard_payment.rb +0 -26
- data/app/models/order_observer.rb +0 -15
- data/app/views/admin/configurations/index.html.erb +0 -62
- data/app/views/admin/coupons/edit.html.erb +0 -8
- data/app/views/admin/coupons/index.html.erb +0 -38
- data/app/views/admin/coupons/new.html.erb +0 -9
- data/app/views/admin/creditcard_payments/edit.html.erb +0 -38
- data/app/views/admin/creditcard_payments/new.html.erb +0 -15
- data/app/views/admin/images/_form.html.erb +0 -12
- data/app/views/admin/option_types/_form.html.erb +0 -33
- data/app/views/admin/option_types/index.html.erb +0 -39
- data/app/views/admin/option_types/selected.html.erb +0 -38
- data/app/views/admin/orders/index.html.erb +0 -80
- data/app/views/admin/orders/show.html.erb +0 -70
- data/app/views/admin/overview/index.html.erb +0 -3
- data/app/views/admin/payments/index.html.erb +0 -30
- data/app/views/admin/product_properties/_product_property.html.erb +0 -25
- data/app/views/admin/product_properties/index.html.erb +0 -44
- data/app/views/admin/products/_form.html.erb +0 -92
- data/app/views/admin/products/_option_types.html.erb +0 -42
- data/app/views/admin/products/index.html.erb +0 -74
- data/app/views/admin/products/new.html.erb +0 -53
- data/app/views/admin/properties/index.html.erb +0 -45
- data/app/views/admin/prototypes/available.html.erb +0 -27
- data/app/views/admin/prototypes/index.html.erb +0 -42
- data/app/views/admin/prototypes/new.html.erb +0 -11
- data/app/views/admin/prototypes/select.rjs +0 -7
- data/app/views/admin/reports/index.html.erb +0 -23
- data/app/views/admin/shared/_additional_field.html.erb +0 -5
- data/app/views/admin/shared/_address.html.erb +0 -15
- data/app/views/admin/shared/_calculator_fields.html.erb +0 -15
- data/app/views/admin/shared/_configuration_menu.html.erb +0 -18
- data/app/views/admin/shared/_form_address.html.erb +0 -56
- data/app/views/admin/shared/_order_tabs.html.erb +0 -27
- data/app/views/admin/shared/_product_sub_menu.html.erb +0 -8
- data/app/views/admin/shared/_product_tabs.html.erb +0 -48
- data/app/views/admin/shared/_report_criteria.html.erb +0 -19
- data/app/views/admin/shipments/_details.html.erb +0 -19
- data/app/views/admin/shipments/_form.html.erb +0 -31
- data/app/views/admin/shipments/edit.html.erb +0 -12
- data/app/views/admin/shipments/index.html.erb +0 -22
- data/app/views/admin/shipments/new.html.erb +0 -14
- data/app/views/admin/shipping_categories/edit.html.erb +0 -8
- data/app/views/admin/shipping_categories/index.html.erb +0 -27
- data/app/views/admin/shipping_categories/new.html.erb +0 -10
- data/app/views/admin/shipping_methods/_form.html.erb +0 -12
- data/app/views/admin/shipping_methods/edit.html.erb +0 -8
- data/app/views/admin/shipping_methods/index.html.erb +0 -34
- data/app/views/admin/shipping_methods/new.html.erb +0 -10
- data/app/views/admin/shipping_rates/edit.html.erb +0 -8
- data/app/views/admin/shipping_rates/index.html.erb +0 -30
- data/app/views/admin/shipping_rates/new.html.erb +0 -10
- data/app/views/admin/states/edit.html.erb +0 -12
- data/app/views/admin/states/index.html.erb +0 -25
- data/app/views/admin/states/new.html.erb +0 -12
- data/app/views/admin/tax_categories/edit.html.erb +0 -12
- data/app/views/admin/tax_categories/index.html.erb +0 -37
- data/app/views/admin/tax_categories/new.html.erb +0 -12
- data/app/views/admin/tax_rates/edit.html.erb +0 -8
- data/app/views/admin/tax_rates/index.html.erb +0 -32
- data/app/views/admin/tax_rates/new.html.erb +0 -10
- data/app/views/admin/taxonomies/_form.html.erb +0 -5
- data/app/views/admin/taxonomies/_js_head.html.erb +0 -13
- data/app/views/admin/taxonomies/edit.html.erb +0 -30
- data/app/views/admin/taxons/_taxon_table.html.erb +0 -28
- data/app/views/admin/taxons/available.js.erb +0 -36
- data/app/views/admin/taxons/selected.html.erb +0 -25
- data/app/views/admin/users/_form.html.erb +0 -35
- data/app/views/admin/users/edit.html.erb +0 -9
- data/app/views/admin/users/index.html.erb +0 -48
- data/app/views/admin/users/new.html.erb +0 -11
- data/app/views/admin/variants/_form.html.erb +0 -40
- data/app/views/admin/variants/edit.html.erb +0 -10
- data/app/views/admin/variants/index.html.erb +0 -56
- data/app/views/admin/variants/new.html.erb +0 -8
- data/app/views/admin/zones/_country_member.html.erb +0 -5
- data/app/views/admin/zones/_form.html.erb +0 -29
- data/app/views/admin/zones/_state_member.html.erb +0 -5
- data/app/views/admin/zones/_zone_member.html.erb +0 -5
- data/app/views/admin/zones/edit.html.erb +0 -12
- data/app/views/admin/zones/index.html.erb +0 -40
- data/app/views/admin/zones/new.html.erb +0 -12
- data/app/views/checkouts/_billing.html.erb +0 -66
- data/app/views/checkouts/_confirmation.html.erb +0 -11
- data/app/views/checkouts/_form.html.erb +0 -20
- data/app/views/checkouts/_payment.html.erb +0 -45
- data/app/views/checkouts/_registration.html.erb +0 -60
- data/app/views/checkouts/_shipping.html.erb +0 -68
- data/app/views/checkouts/_shipping_method.html.erb +0 -19
- data/app/views/checkouts/_summary.html.erb +0 -36
- data/app/views/checkouts/edit.html.erb +0 -13
- data/app/views/checkouts/new.html.erb +0 -13
- data/app/views/layouts/admin.html.erb +0 -91
- data/app/views/layouts/application.html.erb +0 -47
- data/app/views/layouts/checkouts.html.erb +0 -17
- data/app/views/line_items/index.html.erb +0 -1
- data/app/views/orders/_form.html.erb +0 -19
- data/app/views/orders/_google_order.html.erb +0 -24
- data/app/views/orders/_line_item.html.erb +0 -23
- data/app/views/orders/edit.html.erb +0 -22
- data/app/views/orders/show.html.erb +0 -19
- data/app/views/password_resets/edit.html.erb +0 -12
- data/app/views/password_resets/new.html.erb +0 -11
- data/app/views/products/_cart_form.html.erb +0 -77
- data/app/views/products/_products.html.erb +0 -14
- data/app/views/products/_properties.html.erb +0 -8
- data/app/views/products/_thumbnails.html.erb +0 -58
- data/app/views/products/index.html.erb +0 -11
- data/app/views/products/show.html.erb +0 -24
- data/app/views/shared/_additional_field.html.erb +0 -7
- data/app/views/shared/_filters.html.erb +0 -52
- data/app/views/shared/_footer.html.erb +0 -21
- data/app/views/shared/_head.html.erb +0 -6
- data/app/views/shared/_login.html.erb +0 -18
- data/app/views/shared/_order_details.html.erb +0 -46
- data/app/views/shared/_order_tabs.html.erb +0 -32
- data/app/views/shared/_product_sub_menu.html.erb +0 -10
- data/app/views/shared/_product_tabs.html.erb +0 -39
- data/app/views/shared/_products.html.erb +0 -22
- data/app/views/shared/_report_criteria.html.erb +0 -33
- data/app/views/shared/_taxonomies.html.erb +0 -10
- data/app/views/taxons/show.html.erb +0 -12
- data/app/views/user_sessions/new.html.erb +0 -6
- data/app/views/users/_form.html.erb +0 -16
- data/app/views/users/edit.html.erb +0 -9
- data/app/views/users/new.html.erb +0 -12
- data/app/views/users/show.html.erb +0 -39
- data/config/environments/demo.rb +0 -22
- data/config/initializers/compass.rb +0 -8
- data/db/migrate/001_create_addresses.rb +0 -20
- data/db/migrate/002_create_cart_items.rb +0 -13
- data/db/migrate/003_create_carts.rb +0 -12
- data/db/migrate/004_create_categories.rb +0 -15
- data/db/migrate/005_create_categories_products.rb +0 -12
- data/db/migrate/006_create_line_items.rb +0 -15
- data/db/migrate/007_create_option_values.rb +0 -15
- data/db/migrate/008_create_orders.rb +0 -23
- data/db/migrate/009_create_products.rb +0 -16
- data/db/migrate/010_create_txns.rb +0 -18
- data/db/migrate/011_create_variants.rb +0 -13
- data/db/migrate/012_create_tax_treatments.rb +0 -24
- data/db/migrate/013_create_countries.rb +0 -11
- data/db/migrate/014_create_states.rb +0 -13
- data/db/migrate/015_create_option_types.rb +0 -13
- data/db/migrate/016_create_product_option_types.rb +0 -14
- data/db/migrate/017_create_option_values_variants.rb +0 -12
- data/db/migrate/018_create_images.rb +0 -20
- data/db/migrate/019_create_credit_cards.rb +0 -20
- data/db/migrate/020_create_order_operations.rb +0 -14
- data/db/migrate/021_create_inventory_units.rb +0 -15
- data/db/migrate/022_create_users.rb +0 -17
- data/db/migrate/023_create_roles.rb +0 -20
- data/db/migrate/024_create_extension_meta.rb +0 -13
- data/db/migrate/025_drop_tax_treatments.rb +0 -11
- data/db/migrate/026_add_user_to_address.rb +0 -9
- data/db/migrate/20080620100001_create_tax_rates.rb +0 -13
- data/db/migrate/20080620113300_create_taxonomies.rb +0 -13
- data/db/migrate/20080620113400_create_taxons.rb +0 -16
- data/db/migrate/20080622173128_drop_extension_meta.rb +0 -13
- data/db/migrate/20080622194800_create_prototypes.rb +0 -13
- data/db/migrate/20080622194830_create_properties.rb +0 -13
- data/db/migrate/20080622195000_create_properties_prototypes.rb +0 -12
- data/db/migrate/20080622195100_create_property_values.rb +0 -14
- data/db/migrate/20080630003326_create_zones.rb +0 -13
- data/db/migrate/20080630150630_create_preferences.rb +0 -19
- data/db/migrate/20080630152702_add_iso_country_information.rb +0 -19
- data/db/migrate/20080630154400_create_countries_zones.rb +0 -12
- data/db/migrate/20080630215310_create_zone_members.rb +0 -13
- data/db/migrate/20080703184654_update_country_rename_name.rb +0 -15
- data/db/migrate/20080704181428_create_app_configurations.rb +0 -12
- data/db/migrate/20080704190355_add_permalink_and_published_to_products.rb +0 -15
- data/db/migrate/20080704192456_update_tax_rates_add_zones_etc.rb +0 -17
- data/db/migrate/20080707002329_create_tax_categories.rb +0 -21
- data/db/migrate/20080708170103_remove_login.rb +0 -9
- data/db/migrate/20080715014028_add_optimistic_locking_to_cart.rb +0 -13
- data/db/migrate/20080716155613_products_taxons.rb +0 -12
- data/db/migrate/20080720190623_rename_txn_table.rb +0 -9
- data/db/migrate/20080729213052_drop_categories.rb +0 -8
- data/db/migrate/20080803010846_remove_prototype_presentation.rb +0 -13
- data/db/migrate/20080807214829_create_product_property.rb +0 -15
- data/db/migrate/20080815173251_remove_cart.rb +0 -10
- data/db/migrate/20080830173354_add_checkout_state_to_order.rb +0 -13
- data/db/migrate/20080901002711_address_refactor.rb +0 -14
- data/db/migrate/20080902001408_create_creditcard_payments.rb +0 -17
- data/db/migrate/20080904150723_refactor_order_state.rb +0 -33
- data/db/migrate/20080904234457_create_state_events.rb +0 -15
- data/db/migrate/20080905012833_add_inventory_state.rb +0 -13
- data/db/migrate/20080906174748_change_inventory_state_type.rb +0 -8
- data/db/migrate/20080909100504_add_state_name_to_address.rb +0 -9
- data/db/migrate/20080915211650_remove_user_address.rb +0 -10
- data/db/migrate/20080918083321_remove_presentation_from_taxonomy.rb +0 -11
- data/db/migrate/20080918140438_rename_app_configuration.rb +0 -16
- data/db/migrate/20081003211336_create_shipping_methods.rb +0 -14
- data/db/migrate/20081003233427_create_shipping_categories.rb +0 -15
- data/db/migrate/20081015001711_create_shipments.rb +0 -14
- data/db/migrate/20081016002224_remove_defunct_order_fields.rb +0 -10
- data/db/migrate/20081016162924_drop_category_id_from_products.rb +0 -9
- data/db/migrate/20081018125019_refactor_images_for_paperclip.rb +0 -40
- data/db/migrate/20081023134446_add_product_dimensions.rb +0 -19
- data/db/migrate/20081120184215_add_permalink_to_taxons.rb +0 -24
- data/db/migrate/20081121192045_additional_paperclip_refactor.rb +0 -37
- data/db/migrate/20081205155619_add_shipped_at_property.rb +0 -17
- data/db/migrate/20081208143817_create_creditcards.rb +0 -20
- data/db/migrate/20081208150007_create_payments_table.rb +0 -42
- data/db/migrate/20081209103127_add_deleted_at_to_products.rb +0 -11
- data/db/migrate/20081212015915_convert_credticard_number_to_text.rb +0 -11
- data/db/migrate/20081219091142_create_indexes.rb +0 -23
- data/db/migrate/20081221201510_create_shipping_addresses.rb +0 -16
- data/db/migrate/20090105152846_add_previous_state_to_events.rb +0 -13
- data/db/migrate/20090204200045_add_order_permalink.rb +0 -13
- data/db/migrate/20090225231119_add_more_needed_keys_items_and_conf.rb +0 -19
- data/db/migrate/20090302221152_give_all_users_user_role.rb +0 -14
- data/db/migrate/20090320113300_authlogic_changes.rb +0 -24
- data/db/migrate/20090324164010_create_option_types_prototypes.rb +0 -12
- data/db/migrate/20090401120636_meta_data_fields_for_products.rb +0 -11
- data/db/migrate/20090401203712_remove_hmp_stuff_in_zones.rb +0 -12
- data/db/migrate/20090401223217_create_eu_vat_zone_again.rb +0 -24
- data/db/migrate/20090402002244_add_user_login.rb +0 -17
- data/db/migrate/20090402161055_add_order_token.rb +0 -13
- data/db/migrate/20090402200317_add_email_to_order.rb +0 -19
- data/db/migrate/20090404192723_add_maestro_fields.rb +0 -12
- data/db/migrate/20090406091357_add_alternative_phone.rb +0 -9
- data/db/migrate/20090406174645_refactor_addresses.rb +0 -53
- data/db/migrate/20090420021303_remove_viewable_id_from_products.rb +0 -10
- data/db/migrate/20090427000000_upgrade_taxons.rb +0 -14
- data/db/migrate/20090525000325_remove_address_orphans.rb +0 -15
- data/db/migrate/20090603153927_create_checkouts.rb +0 -71
- data/db/migrate/20090617181106_change_txn_type_to_int.rb +0 -18
- data/db/migrate/20090618203233_create_charges.rb +0 -61
- data/db/migrate/20090626235303_create_credits.rb +0 -22
- data/db/migrate/20090705101511_add_image_dimensions.rb +0 -12
- data/db/migrate/20090708175306_create_coupons.rb +0 -16
- data/db/migrate/20090708175317_create_discounts.rb +0 -14
- data/db/migrate/20090714094201_add_default_addresses_to_user.rb +0 -11
- data/db/migrate/20090715172345_create_calculators.rb +0 -22
- data/db/migrate/20090731085008_add_charge_source_to_charge.rb +0 -11
- data/db/migrate/20090803072025_create_shipping_rates.rb +0 -12
- data/db/migrate/20090804090559_create_calculators_for_tax_rates.rb +0 -16
- data/db/migrate/20090805131937_drop_credits_and_discounts.rb +0 -9
- data/db/migrate/20090805185015_remove_tax_type.rb +0 -13
- data/db/migrate/20090806063212_rename_charges_to_adjustments.rb +0 -24
- data/db/migrate/20090806160214_rename_base_to_source.rb +0 -11
- data/db/migrate/20090809170304_remove_checkout_shipping_address_and_method.rb +0 -15
- data/db/migrate/20090809193131_add_is_master_to_variants.rb +0 -43
- data/db/migrate/20090809201209_drop_master_price_from_products.rb +0 -13
- data/db/migrate/20090809231957_update_legacy_calculators.rb +0 -9
- data/db/migrate/20090823005402_coupon_starts_at.rb +0 -13
- data/db/migrate/20090828114732_add_queued_mail.rb +0 -12
- data/db/migrate/20090908141056_adjust_percent_calc_settings.rb +0 -9
- data/db/migrate/migrate/20080620100001_create_tax_rates.rb +0 -13
- data/db/migrate/migrate/20080704192456_update_tax_rates_add_zones_etc.rb +0 -17
- data/db/sample/creditcard_txns.yml +0 -7
- data/db/sample/creditcards.yml +0 -10
- data/db/sample/inventory_units.yml +0 -93
- data/db/sample/payments.yml +0 -7
- data/lib/product_scopes.rb +0 -76
- data/lib/spree/setup.rb +0 -148
- data/public/javascripts/application.js +0 -36
- data/public/javascripts/calendar_date_select/calendar_date_select.js +0 -439
- data/public/javascripts/calendar_date_select/format_american.js +0 -34
- data/public/javascripts/calendar_date_select/format_db.js +0 -27
- data/public/javascripts/calendar_date_select/format_euro_24hr.js +0 -7
- data/public/javascripts/calendar_date_select/format_euro_24hr_ymd.js +0 -7
- data/public/javascripts/calendar_date_select/format_finnish.js +0 -24
- data/public/javascripts/calendar_date_select/format_hyphen_ampm.js +0 -36
- data/public/javascripts/calendar_date_select/format_iso_date.js +0 -46
- data/public/javascripts/calendar_date_select/format_italian.js +0 -24
- data/public/javascripts/calendar_date_select/locale/de.js +0 -11
- data/public/javascripts/calendar_date_select/locale/fi.js +0 -10
- data/public/javascripts/calendar_date_select/locale/fr.js +0 -10
- data/public/javascripts/calendar_date_select/locale/pl.js +0 -10
- data/public/javascripts/calendar_date_select/locale/pt.js +0 -11
- data/public/javascripts/calendar_date_select/locale/ru.js +0 -10
- data/public/javascripts/controls.js +0 -963
- data/public/javascripts/dragdrop.js +0 -972
- data/public/javascripts/effects.js +0 -1120
- data/public/javascripts/jsTree/source/_lib.js +0 -126
- data/public/javascripts/jsTree/source/themes/default/context.gif +0 -0
- data/public/javascripts/jsTree/source/themes/default/create.png +0 -0
- data/public/javascripts/jsTree/source/themes/default/f.png +0 -0
- data/public/javascripts/jsTree/source/themes/default/fminus.gif +0 -0
- data/public/javascripts/jsTree/source/themes/default/fminus_rtl.gif +0 -0
- data/public/javascripts/jsTree/source/themes/default/fplus.gif +0 -0
- data/public/javascripts/jsTree/source/themes/default/fplus_rtl.gif +0 -0
- data/public/javascripts/jsTree/source/themes/default/lastli.gif +0 -0
- data/public/javascripts/jsTree/source/themes/default/lastli_rtl.gif +0 -0
- data/public/javascripts/jsTree/source/themes/default/li.gif +0 -0
- data/public/javascripts/jsTree/source/themes/default/remove.png +0 -0
- data/public/javascripts/jsTree/source/themes/default/rename.png +0 -0
- data/public/javascripts/jsTree/source/themes/default/style.css +0 -44
- data/public/javascripts/jsTree/source/themes/marker.gif +0 -0
- data/public/javascripts/jsTree/source/themes/marker_rtl.gif +0 -0
- data/public/javascripts/jsTree/source/themes/plus.gif +0 -0
- data/public/javascripts/jsTree/source/themes/remove.png +0 -0
- data/public/javascripts/jsTree/source/themes/spree/context.gif +0 -0
- data/public/javascripts/jsTree/source/themes/spree/create.png +0 -0
- data/public/javascripts/jsTree/source/themes/spree/f.png +0 -0
- data/public/javascripts/jsTree/source/themes/spree/fminus.gif +0 -0
- data/public/javascripts/jsTree/source/themes/spree/fminus_rtl.gif +0 -0
- data/public/javascripts/jsTree/source/themes/spree/fplus.gif +0 -0
- data/public/javascripts/jsTree/source/themes/spree/fplus_rtl.gif +0 -0
- data/public/javascripts/jsTree/source/themes/spree/lastli.gif +0 -0
- data/public/javascripts/jsTree/source/themes/spree/li.gif +0 -0
- data/public/javascripts/jsTree/source/themes/spree/remove.png +0 -0
- data/public/javascripts/jsTree/source/themes/spree/rename.png +0 -0
- data/public/javascripts/jsTree/source/themes/spree/style.css +0 -39
- data/public/javascripts/jsTree/source/tree_component.css +0 -62
- data/public/javascripts/jsTree/source/tree_component.js +0 -2315
- data/public/javascripts/jsTree/source/tree_component.min.js +0 -14
- data/public/javascripts/prototype.js +0 -4225
- data/public/stylesheets/application.css +0 -7
- data/public/stylesheets/calendar_date_select/blue.css +0 -130
- data/public/stylesheets/calendar_date_select/default.css +0 -135
- data/public/stylesheets/calendar_date_select/plain.css +0 -128
- data/public/stylesheets/calendar_date_select/red.css +0 -135
- data/public/stylesheets/calendar_date_select/silver.css +0 -133
- data/public/stylesheets/sass/_buttons.sass +0 -59
- data/public/stylesheets/sass/_cart.sass +0 -21
- data/public/stylesheets/sass/_checkout.sass +0 -173
- data/public/stylesheets/sass/_colors.sass +0 -11
- data/public/stylesheets/sass/_layout.sass +0 -63
- data/public/stylesheets/sass/_messages.sass +0 -28
- data/public/stylesheets/sass/_mixins.sass +0 -17
- data/public/stylesheets/sass/_navigation.sass +0 -97
- data/public/stylesheets/sass/_prices.sass +0 -13
- data/public/stylesheets/sass/_product_detail.sass +0 -27
- data/public/stylesheets/sass/_product_thumbnail.sass +0 -58
- data/public/stylesheets/sass/_registration.sass +0 -18
- data/public/stylesheets/sass/ie.sass +0 -3
- data/public/stylesheets/sass/print.sass +0 -3
- data/public/stylesheets/sass/screen.sass +0 -22
- data/spec/fixtures/gateway_configurations.yml +0 -3
- data/spec/models/preference_definition_spec.rb +0 -184
- data/spec/preference_factory.rb +0 -58
- data/spec/views/admin/configurations/index.html.erb_spec.rb +0 -37
- data/test/factories/creditcard_payment_factory.rb +0 -11
- data/test/fixtures/gateway_configurations.yml +0 -2
- data/test/fixtures/gateways.yml +0 -4
- data/test/unit/helpers/checkouts_helper_test.rb +0 -26
- data/test/unit/incomplete_checkout_test.rb +0 -68
- data/vendor/extensions/payment_gateway/app/controllers/admin/gateway_configurations_controller.rb +0 -26
- data/vendor/extensions/payment_gateway/app/controllers/admin/gateway_option_values_controller.rb +0 -24
- data/vendor/extensions/payment_gateway/app/controllers/admin/gateways_controller.rb +0 -9
- data/vendor/extensions/payment_gateway/app/models/gateway_configuration.rb +0 -4
- data/vendor/extensions/payment_gateway/app/models/gateway_option.rb +0 -4
- data/vendor/extensions/payment_gateway/app/models/gateway_option_value.rb +0 -4
- data/vendor/extensions/payment_gateway/app/views/admin/gateway_configurations/_form.html.erb +0 -21
- data/vendor/extensions/payment_gateway/app/views/admin/gateway_configurations/edit.html.erb +0 -10
- data/vendor/extensions/payment_gateway/app/views/admin/gateway_option_values/_options.html.erb +0 -28
- data/vendor/extensions/payment_gateway/db/migrate/20080620120002_create_gateway_configurations.rb +0 -12
- data/vendor/extensions/payment_gateway/db/migrate/20080620120003_create_gateways.rb +0 -15
- data/vendor/extensions/payment_gateway/db/migrate/20080620120004_create_gateway_options.rb +0 -15
- data/vendor/extensions/payment_gateway/db/migrate/20080620120005_create_gateway_option_values.rb +0 -14
- data/vendor/extensions/payment_gateway/db/migrate/20080620120006_create_bogus_gateway.rb +0 -14
- data/vendor/extensions/payment_gateway/db/migrate/20080620120007_create_linkpoint_gateway.rb +0 -18
- data/vendor/extensions/payment_gateway/db/migrate/20080703120008_create_paypal_gateway.rb +0 -19
- data/vendor/extensions/payment_gateway/db/migrate/20081119210419_create_authorizenet_gateway.rb +0 -18
- data/vendor/extensions/payment_gateway/db/migrate/20081120144549_remove_authorizenet_test.rb +0 -10
- data/vendor/extensions/payment_gateway/db/migrate/20090218091936_create_protx_gateway.rb +0 -18
- data/vendor/extensions/payment_gateway/db/migrate/20090517173727_add_currency_code_option_to_paypal_gateway.rb +0 -13
- data/vendor/extensions/payment_gateway/lib/gateway_config.rb +0 -7
- data/vendor/extensions/payment_gateway/lib/spree/bogus_gateway.rb +0 -68
- data/vendor/extensions/payment_gateway/lib/spree/gateway/config.rb +0 -22
- data/vendor/extensions/payment_gateway/spec/models/gateway_configuration_spec.rb +0 -11
- data/vendor/extensions/payment_gateway/spec/models/gateway_option_spec.rb +0 -11
- data/vendor/extensions/payment_gateway/spec/models/gateway_option_value_spec.rb +0 -11
- data/vendor/plugins/acts_as_adjacency_list/README +0 -13
- data/vendor/plugins/acts_as_adjacency_list/Rakefile +0 -22
- data/vendor/plugins/acts_as_adjacency_list/init.rb +0 -9
- data/vendor/plugins/acts_as_adjacency_list/install.rb +0 -1
- data/vendor/plugins/acts_as_adjacency_list/lib/active_record/acts/adjacency_list.rb +0 -230
- data/vendor/plugins/acts_as_adjacency_list/tasks/acts_as_adjacency_list_tasks.rake +0 -4
- data/vendor/plugins/acts_as_adjacency_list/test/acts_as_adjacency_list_test.rb +0 -293
- data/vendor/plugins/acts_as_adjacency_list/uninstall.rb +0 -1
- data/vendor/plugins/paperclip/LICENSE +0 -26
- data/vendor/plugins/paperclip/README.rdoc +0 -174
- data/vendor/plugins/paperclip/Rakefile +0 -99
- data/vendor/plugins/paperclip/generators/paperclip/USAGE +0 -5
- data/vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb +0 -27
- data/vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb +0 -19
- data/vendor/plugins/paperclip/init.rb +0 -1
- data/vendor/plugins/paperclip/lib/paperclip.rb +0 -350
- data/vendor/plugins/paperclip/lib/paperclip/attachment.rb +0 -413
- data/vendor/plugins/paperclip/lib/paperclip/callback_compatability.rb +0 -33
- data/vendor/plugins/paperclip/lib/paperclip/geometry.rb +0 -115
- data/vendor/plugins/paperclip/lib/paperclip/interpolations.rb +0 -105
- data/vendor/plugins/paperclip/lib/paperclip/iostream.rb +0 -58
- data/vendor/plugins/paperclip/lib/paperclip/matchers.rb +0 -4
- data/vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb +0 -49
- data/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +0 -66
- data/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_presence_matcher.rb +0 -48
- data/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_size_matcher.rb +0 -83
- data/vendor/plugins/paperclip/lib/paperclip/processor.rb +0 -49
- data/vendor/plugins/paperclip/lib/paperclip/storage.rb +0 -236
- data/vendor/plugins/paperclip/lib/paperclip/thumbnail.rb +0 -70
- data/vendor/plugins/paperclip/lib/paperclip/upfile.rb +0 -48
- data/vendor/plugins/paperclip/paperclip.gemspec +0 -37
- data/vendor/plugins/paperclip/shoulda_macros/paperclip.rb +0 -68
- data/vendor/plugins/paperclip/tasks/paperclip_tasks.rake +0 -79
- data/vendor/plugins/paperclip/test/attachment_test.rb +0 -768
- data/vendor/plugins/paperclip/test/database.yml +0 -4
- data/vendor/plugins/paperclip/test/fixtures/12k.png +0 -0
- data/vendor/plugins/paperclip/test/fixtures/50x50.png +0 -0
- data/vendor/plugins/paperclip/test/fixtures/5k.png +0 -0
- data/vendor/plugins/paperclip/test/fixtures/bad.png +0 -1
- data/vendor/plugins/paperclip/test/fixtures/s3.yml +0 -4
- data/vendor/plugins/paperclip/test/fixtures/twopage.pdf +0 -0
- data/vendor/plugins/paperclip/test/geometry_test.rb +0 -177
- data/vendor/plugins/paperclip/test/helper.rb +0 -100
- data/vendor/plugins/paperclip/test/integration_test.rb +0 -481
- data/vendor/plugins/paperclip/test/interpolations_test.rb +0 -120
- data/vendor/plugins/paperclip/test/iostream_test.rb +0 -71
- data/vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb +0 -21
- data/vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb +0 -30
- data/vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb +0 -21
- data/vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb +0 -50
- data/vendor/plugins/paperclip/test/paperclip_test.rb +0 -291
- data/vendor/plugins/paperclip/test/processor_test.rb +0 -10
- data/vendor/plugins/paperclip/test/storage_test.rb +0 -282
- data/vendor/plugins/paperclip/test/thumbnail_test.rb +0 -177
- data/vendor/plugins/state_machine/CHANGELOG.rdoc +0 -97
- data/vendor/plugins/state_machine/LICENSE +0 -20
- data/vendor/plugins/state_machine/README.rdoc +0 -182
- data/vendor/plugins/state_machine/Rakefile +0 -88
- data/vendor/plugins/state_machine/init.rb +0 -1
- data/vendor/plugins/state_machine/lib/state_machine.rb +0 -129
- data/vendor/plugins/state_machine/lib/state_machine/event.rb +0 -116
- data/vendor/plugins/state_machine/lib/state_machine/machine.rb +0 -412
- data/vendor/plugins/state_machine/lib/state_machine/transition.rb +0 -227
- data/vendor/plugins/state_machine/test/app_root/app/models/auto_shop.rb +0 -34
- data/vendor/plugins/state_machine/test/app_root/app/models/car.rb +0 -19
- data/vendor/plugins/state_machine/test/app_root/app/models/highway.rb +0 -3
- data/vendor/plugins/state_machine/test/app_root/app/models/motorcycle.rb +0 -3
- data/vendor/plugins/state_machine/test/app_root/app/models/switch.rb +0 -23
- data/vendor/plugins/state_machine/test/app_root/app/models/switch_observer.rb +0 -20
- data/vendor/plugins/state_machine/test/app_root/app/models/toggle_switch.rb +0 -2
- data/vendor/plugins/state_machine/test/app_root/app/models/vehicle.rb +0 -78
- data/vendor/plugins/state_machine/test/app_root/config/environment.rb +0 -7
- data/vendor/plugins/state_machine/test/app_root/db/migrate/001_create_switches.rb +0 -12
- data/vendor/plugins/state_machine/test/app_root/db/migrate/002_create_auto_shops.rb +0 -13
- data/vendor/plugins/state_machine/test/app_root/db/migrate/003_create_highways.rb +0 -11
- data/vendor/plugins/state_machine/test/app_root/db/migrate/004_create_vehicles.rb +0 -16
- data/vendor/plugins/state_machine/test/factory.rb +0 -73
- data/vendor/plugins/state_machine/test/functional/state_machine_test.rb +0 -499
- data/vendor/plugins/state_machine/test/test_helper.rb +0 -13
- data/vendor/plugins/state_machine/test/unit/event_test.rb +0 -235
- data/vendor/plugins/state_machine/test/unit/invalid_transition_test.rb +0 -7
- data/vendor/plugins/state_machine/test/unit/machine_test.rb +0 -306
- data/vendor/plugins/state_machine/test/unit/state_machine_test.rb +0 -130
- data/vendor/plugins/state_machine/test/unit/transition_test.rb +0 -633
@@ -1,14 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jsTree 0.9.8
|
3
|
-
* http://jstree.com/
|
4
|
-
*
|
5
|
-
* Copyright (c) 2009 Ivan Bozhanov (vakata.com)
|
6
|
-
*
|
7
|
-
* Dual licensed under the MIT and GPL licenses:
|
8
|
-
* http://www.opensource.org/licenses/mit-license.php
|
9
|
-
* http://www.gnu.org/licenses/gpl.html
|
10
|
-
*
|
11
|
-
* Date: 2009-05-15
|
12
|
-
*
|
13
|
-
*/
|
14
|
-
(function($){$.fn.tree=function(opts){return this.each(function(){var conf=$.extend({},opts);if(tree_component.inst&&tree_component.inst[$(this).attr('id')])tree_component.inst[$(this).attr('id')].destroy();if(conf!==false)new tree_component().init(this,conf)})};$.tree_create=function(){return new tree_component()};$.tree_focused=function(){return tree_component.inst[tree_component.focused]};$.tree_reference=function(id){return tree_component.inst[id]||null};$.tree_rollback=function(data){for(var i in data){if(typeof data[i]=="function")continue;var tmp=tree_component.inst[i];var lock=!tmp.locked;if(lock)tmp.lock(true);if(tmp.inp)tmp.inp.val("").blur();tmp.context.append=false;tmp.container.html(data[i].html).find(".dragged").removeClass("dragged").end().find("div.context").remove();if(data[i].selected){tmp.selected=$("#"+data[i].selected);tmp.selected_arr=[];tmp.container.find("a.clicked").each(function(){tmp.selected_arr.push(tmp.get_node(this))})}if(lock)tmp.lock(false);delete lock;delete tmp}};function tree_component(){if(typeof tree_component.inst=="undefined"){tree_component.cntr=0;tree_component.inst={};tree_component.drag_drop={isdown:false,drag_node:false,drag_help:false,init_x:false,init_y:false,moving:false,origin_tree:false,marker:false,move_type:false,ref_node:false,appended:false,foreign:false,droppable:[],open_time:false,scroll_time:false};tree_component.mousedown=function(event){var tmp=$(event.target);if(tree_component.drag_drop.droppable.length&&tmp.is("."+tree_component.drag_drop.droppable.join(", ."))){tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree tree-default'><ul><li class='last dragged foreign "+event.target.className+"'><a href='#'>"+tmp.text()+"</a></li></ul></div>");tree_component.drag_drop.drag_node=tree_component.drag_drop.drag_help.find("li:eq(0)");tree_component.drag_drop.isdown=true;tree_component.drag_drop.foreign=tmp;tmp.blur();event.preventDefault();event.stopPropagation();return false}event.stopPropagation();return true};tree_component.mouseup=function(event){var tmp=tree_component.drag_drop;if(tmp.open_time)clearTimeout(tmp.open_time);if(tmp.scroll_time)clearTimeout(tmp.scroll_time);if(tmp.foreign===false&&tmp.drag_node&&tmp.drag_node.size()){tmp.drag_help.remove();if(tmp.move_type){var tree1=tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];if(tree1)tree1.moved(tmp.origin_tree.container.find("li.dragged"),tmp.ref_node,tmp.move_type,false,(tmp.origin_tree.settings.rules.drag_copy=="on"||(tmp.origin_tree.settings.rules.drag_copy=="ctrl"&&event.ctrlKey)))}tmp.move_type=false;tmp.ref_node=false}if(tmp.drag_node&&tmp.foreign!==false){tmp.drag_help.remove();if(tmp.move_type){var tree1=tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];if(tree1)tree1.settings.callback.ondrop.call(null,tmp.foreign.get(0),tree1.get_node(tmp.ref_node).get(0),tmp.move_type,tree1)}tmp.foreign=false;tmp.move_type=false;tmp.ref_node=false}tree_component.drag_drop.marker.hide();tmp.drag_help=false;tmp.drag_node=false;tmp.isdown=false;tmp.init_x=false;tmp.init_y=false;tmp.moving=false;tmp.appended=false;$("li.dragged").removeClass("dragged");tmp.origin_tree=false;event.preventDefault();event.stopPropagation();return false};tree_component.mousemove=function(event){var tmp=tree_component.drag_drop;if(tmp.isdown){if(!tmp.moving&&Math.abs(tmp.init_x-event.pageX)<5&&Math.abs(tmp.init_y-event.pageY)<5){event.preventDefault();event.stopPropagation();return false}else tree_component.drag_drop.moving=true;if(tmp.open_time)clearTimeout(tmp.open_time);if(!tmp.appended){if(tmp.foreign!==false)tmp.origin_tree=$.tree_focused();$("body").append(tmp.drag_help);tmp.w=tmp.drag_help.width();tmp.appended=true}tmp.drag_help.css({"left":(event.pageX-(tmp.origin_tree.settings.ui.rtl?tmp.w:-5)),"top":(event.pageY+15)});if(event.target.tagName=="IMG"&&event.target.id=="marker")return false;var et=$(event.target);var cnt=et.is(".tree")?et:et.parents(".tree:eq(0)");if(cnt.size()==0||!tree_component.inst[cnt.attr("id")]){if(tmp.scroll_time)clearTimeout(tmp.scroll_time);if(tmp.drag_help.find("IMG").size()==0){tmp.drag_help.find("li:eq(0)").append("<img style='position:absolute; "+(tmp.origin_tree.settings.ui.rtl?"right":"left")+":4px; top:0px; background:white; padding:2px;' src='"+tmp.origin_tree.settings.ui.theme_path+"remove.png' />")}tmp.move_type=false;tmp.ref_node=false;tree_component.drag_drop.marker.hide();return false}var tree2=tree_component.inst[cnt.attr("id")];tree2.off_height();if(tmp.foreign===false&&tmp.origin_tree.container.get(0)!=tree2.container.get(0)&&(!tmp.origin_tree.settings.rules.multitree||!tree2.settings.rules.multitree)){if(tmp.drag_help.find("IMG").size()==0){tmp.drag_help.find("li:eq(0)").append("<img style='position:absolute; "+(tmp.origin_tree.settings.ui.rtl?"right":"left")+":4px; top:0px; background:white; padding:2px;' src='"+tmp.origin_tree.settings.ui.theme_path+"remove.png' />")}tmp.move_type=false;tmp.ref_node=false;tree_component.drag_drop.marker.hide();return false}if(tmp.scroll_time)clearTimeout(tmp.scroll_time);tmp.scroll_time=setTimeout(function(){tree2.scrollCheck(event.pageX,event.pageY)},50);var mov=false;var st=cnt.scrollTop();if(event.target.tagName=="A"){if(et.is("#jstree-dragged"))return false;if(tree2.get_node(event.target).hasClass("closed")){tmp.open_time=setTimeout(function(){tree2.open_branch(et)},500)}var et_off=et.offset();var goTo={x:(et_off.left-1),y:(event.pageY-et_off.top)};if(cnt.children("ul:eq(0)").hasClass("rtl"))goTo.x+=et.width()-8;var arr=[];if(goTo.y<tree2.li_height/3+1)arr=["before","inside","after"];else if(goTo.y>tree2.li_height*2/3-1)arr=["after","inside","before"];else{if(goTo.y<tree2.li_height/2)arr=["inside","before","after"];else arr=["inside","after","before"]}var ok=false;$.each(arr,function(i,val){if(tree2.checkMove(tmp.origin_tree.container.find("li.dragged"),et,val)){mov=val;ok=true;return false}});if(ok){switch(mov){case"before":goTo.y=et_off.top-2;if(cnt.children("ul:eq(0)").hasClass("rtl")){tree_component.drag_drop.marker.attr("src",tree2.settings.ui.theme_path+"marker_rtl.gif").width(40)}else{tree_component.drag_drop.marker.attr("src",tree2.settings.ui.theme_path+"marker.gif").width(40)}break;case"after":goTo.y=et_off.top-2+tree2.li_height;if(cnt.children("ul:eq(0)").hasClass("rtl")){tree_component.drag_drop.marker.attr("src",tree2.settings.ui.theme_path+"marker_rtl.gif").width(40)}else{tree_component.drag_drop.marker.attr("src",tree2.settings.ui.theme_path+"marker.gif").width(40)}break;case"inside":goTo.x-=2;if(cnt.children("ul:eq(0)").hasClass("rtl")){goTo.x+=36}goTo.y=et_off.top-2+tree2.li_height/2;tree_component.drag_drop.marker.attr("src",tree2.settings.ui.theme_path+"plus.gif").width(11);break}tmp.move_type=mov;tmp.ref_node=$(event.target);tmp.drag_help.find("IMG").remove();tree_component.drag_drop.marker.css({"left":goTo.x,"top":goTo.y}).show()}}if((et.is(".tree")||et.is("ul"))&&et.find("li:eq(0)").size()==0){var et_off=et.offset();tmp.move_type="inside";tmp.ref_node=cnt.children("ul:eq(0)");tmp.drag_help.find("IMG").remove();tree_component.drag_drop.marker.attr("src",tree2.settings.ui.theme_path+"plus.gif").width(11);tree_component.drag_drop.marker.css({"left":et_off.left+(cnt.children("ul:eq(0)").hasClass("rtl")?(cnt.width()-10):10),"top":et_off.top+15}).show()}else if(event.target.tagName!="A"||!ok){if(tmp.drag_help.find("IMG").size()==0){tmp.drag_help.find("li:eq(0)").append("<img style='position:absolute; "+(tmp.origin_tree.settings.ui.rtl?"right":"left")+":4px; top:0px; background:white; padding:2px;' src='"+tmp.origin_tree.settings.ui.theme_path+"remove.png' />")}tmp.move_type=false;tmp.ref_node=false;tree_component.drag_drop.marker.hide()}event.preventDefault();event.stopPropagation();return false}return true}};return{cntr:++tree_component.cntr,settings:{data:{type:"predefined",method:"GET",async:false,async_data:function(NODE,TREE_OBJ){return{id:$(NODE).attr("id")||0}},url:false,json:false,xml:false},selected:false,opened:[],languages:[],path:false,cookies:false,ui:{dots:true,rtl:false,animation:0,hover_mode:true,scroll_spd:4,theme_path:false,theme_name:"default",context:[{id:"create",label:"Create",icon:"create.png",visible:function(NODE,TREE_OBJ){if(NODE.length!=1)return false;return TREE_OBJ.check("creatable",NODE)},action:function(NODE,TREE_OBJ){TREE_OBJ.create(false,TREE_OBJ.get_node(NODE[0]))}},"separator",{id:"rename",label:"Rename",icon:"rename.png",visible:function(NODE,TREE_OBJ){if(NODE.length!=1)return false;return TREE_OBJ.check("renameable",NODE)},action:function(NODE,TREE_OBJ){TREE_OBJ.rename(NODE)}},{id:"delete",label:"Delete",icon:"remove.png",visible:function(NODE,TREE_OBJ){var ok=true;$.each(NODE,function(){if(TREE_OBJ.check("deletable",this)==false)ok=false;return false});return ok},action:function(NODE,TREE_OBJ){$.each(NODE,function(){TREE_OBJ.remove(this)})}}]},rules:{multiple:false,metadata:false,type_attr:"rel",multitree:false,createat:"bottom",use_inline:false,clickable:"all",renameable:"all",deletable:"all",creatable:"all",draggable:"none",dragrules:"all",drag_copy:false,droppable:[],drag_button:"left"},lang:{new_node:"New folder",loading:"Loading ..."},callback:{beforechange:function(NODE,TREE_OBJ){return true},beforeopen:function(NODE,TREE_OBJ){return true},beforeclose:function(NODE,TREE_OBJ){return true},beforemove:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforecreate:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforerename:function(NODE,LANG,TREE_OBJ){return true},beforedelete:function(NODE,TREE_OBJ){return true},onJSONdata:function(DATA,TREE_OBJ){return DATA},onselect:function(NODE,TREE_OBJ){},ondeselect:function(NODE,TREE_OBJ){},onchange:function(NODE,TREE_OBJ){},onrename:function(NODE,LANG,TREE_OBJ,RB){},onmove:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},oncopy:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},oncreate:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},ondelete:function(NODE,TREE_OBJ,RB){},onopen:function(NODE,TREE_OBJ){},onopen_all:function(TREE_OBJ){},onclose:function(NODE,TREE_OBJ){},error:function(TEXT,TREE_OBJ){},ondblclk:function(NODE,TREE_OBJ){TREE_OBJ.toggle_branch.call(TREE_OBJ,NODE);TREE_OBJ.select_branch.call(TREE_OBJ,NODE)},onrgtclk:function(NODE,TREE_OBJ,EV){},onload:function(TREE_OBJ){},onfocus:function(TREE_OBJ){},ondrop:function(NODE,REF_NODE,TYPE,TREE_OBJ){}}},init:function(elem,conf){var _this=this;this.container=$(elem);if(this.container.size==0){alert("Invalid container node!");return}tree_component.inst[this.cntr]=this;if(!this.container.attr("id"))this.container.attr("id","jstree_"+this.cntr);tree_component.inst[this.container.attr("id")]=tree_component.inst[this.cntr];tree_component.focused=this.cntr;var opts=$.extend({},conf);if(opts&&opts.cookies){this.settings.cookies=$.extend({},this.settings.cookies,opts.cookies);delete opts.cookies;if(!this.settings.cookies.opts)this.settings.cookies.opts={}}if(opts&&opts.callback){this.settings.callback=$.extend({},this.settings.callback,opts.callback);delete opts.callback}if(opts&&opts.data){this.settings.data=$.extend({},this.settings.data,opts.data);delete opts.data}if(opts&&opts.ui){this.settings.ui=$.extend({},this.settings.ui,opts.ui);delete opts.ui}if(opts&&opts.rules){this.settings.rules=$.extend({},this.settings.rules,opts.rules);delete opts.rules}if(opts&&opts.lang){this.settings.lang=$.extend({},this.settings.lang,opts.lang);delete opts.lang}this.settings=$.extend({},this.settings,opts);if(this.settings.path==false){this.path="";$("script").each(function(){if(this.src.toString().match(/tree_component.*?js$/)){_this.path=this.src.toString().replace(/tree_component.*?js$/,"")}})}else this.path=this.settings.path;this.current_lang=this.settings.languages&&this.settings.languages.length?this.settings.languages[0]:false;if(this.settings.languages&&this.settings.languages.length){this.sn=get_sheet_num("tree_component.css");if(this.sn===false&&document.styleSheets.length)this.sn=document.styleSheets.length;var st=false;var id=this.container.attr("id")?"#"+this.container.attr("id"):".tree";for(var ln=0;ln<this.settings.languages.length;ln++){st=add_css(id+" ."+this.settings.languages[ln],this.sn);if(st!==false){if(this.settings.languages[ln]==this.current_lang)st.style.display="";else st.style.display="none"}}}if(this.settings.rules.droppable.length){for(var i in this.settings.rules.droppable){if(typeof this.settings.rules.droppable[i]=="function")continue;tree_component.drag_drop.droppable.push(this.settings.rules.droppable[i])}tree_component.drag_drop.droppable=$.unique(tree_component.drag_drop.droppable)}if(this.settings.ui.theme_path===false)this.settings.ui.theme_path=this.path+"themes/";this.theme=this.settings.ui.theme_path;if(_this.settings.ui.theme_name){this.theme+=_this.settings.ui.theme_name+"/";if(_this.settings.ui.theme_name!="themeroller"&&!tree_component.def_style){add_sheet(_this.settings.ui.theme_path+"default/style.css");tree_component.def_style=true}add_sheet(_this.theme+"style.css")}this.container.addClass("tree");if(_this.settings.ui.theme_name!="themeroller")this.container.addClass("tree-default");if(this.settings.ui.theme_name&&this.settings.ui.theme_name!="default")this.container.addClass("tree-"+_this.settings.ui.theme_name);if(this.settings.ui.theme_name=="themeroller")this.container.addClass("ui-widget ui-widget-content");if(this.settings.rules.multiple)this.selected_arr=[];this.offset=false;this.context_menu();this.hovered=false;this.locked=false;if(this.settings.rules.draggable!="none"&&tree_component.drag_drop.marker===false){var _this=this;tree_component.drag_drop.marker=$("<img>").attr({id:"marker",src:_this.settings.ui.theme_path+"marker.gif"}).css({height:"5px",width:"40px",display:"block",position:"absolute",left:"30px",top:"30px",zIndex:"1000"}).hide().appendTo("body")}this.refresh();this.attachEvents();this.focus()},off_height:function(){if(this.offset===false){this.container.css({position:"relative"});this.offset=this.container.offset();var tmp=0;tmp=parseInt($.curCSS(this.container.get(0),"paddingTop",true),10);if(tmp)this.offset.top+=tmp;tmp=parseInt($.curCSS(this.container.get(0),"borderTopWidth",true),10);if(tmp)this.offset.top+=tmp;this.container.css({position:""})}if(!this.li_height){var tmp=this.container.find("ul li.closed, ul li.leaf").eq(0);this.li_height=tmp.height();if(tmp.children("ul:eq(0)").size())this.li_height-=tmp.children("ul:eq(0)").height();if(!this.li_height)this.li_height=18}},context_menu:function(){this.context=false;if(this.settings.ui.context!=false){var str='<div class="tree-context tree-default-context tree-'+this.settings.ui.theme_name+'-context">';for(var i in this.settings.ui.context){if(typeof this.settings.ui.context[i]=="function")continue;if(this.settings.ui.context[i]=="separator"){str+="<span class='separator'> </span>";continue}var icn="";if(this.settings.ui.context[i].icon)icn='background-image:url(\''+(this.settings.ui.context[i].icon.indexOf("/")==-1?this.theme+this.settings.ui.context[i].icon:this.settings.ui.context[i].icon)+'\');';str+='<a rel="'+this.settings.ui.context[i].id+'" href="#" style="'+icn+'">'+this.settings.ui.context[i].label+'</a>'}str+='</div>';this.context=$(str);this.context.hide();this.context.append=false}},refresh:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;this.is_partial_refresh=obj?true:false;this.opened=Array();if(this.settings.cookies&&$.cookie(this.settings.cookies.prefix+'_open')){var str=$.cookie(this.settings.cookies.prefix+'_open');var tmp=str.split(",");$.each(tmp,function(){if(this.replace(/^#/,"").length>0){_this.opened.push("#"+this.replace(/^#/,""))}});this.settings.opened=false}else if(this.settings.opened!=false){$.each(this.settings.opened,function(i,item){if(this.replace(/^#/,"").length>0){_this.opened.push("#"+this.replace(/^#/,""))}});this.settings.opened=false}else{this.container.find("li.open").each(function(i){if(this.id){_this.opened.push("#"+this.id)}})}if(this.selected){this.settings.selected=Array();if(obj){$(obj).find("li:has(a.clicked)").each(function(){$this=$(this);if($this.attr("id"))_this.settings.selected.push("#"+$this.attr("id"))})}else{if(this.selected_arr){$.each(this.selected_arr,function(){if(this.attr("id"))_this.settings.selected.push("#"+this.attr("id"))})}else{if(this.selected.attr("id"))this.settings.selected.push("#"+this.selected.attr("id"))}}}else if(this.settings.cookies&&$.cookie(this.settings.cookies.prefix+'_selected')){this.settings.selected=Array();var str=$.cookie(this.settings.cookies.prefix+'_selected');var tmp=str.split(",");$.each(tmp,function(){if(this.replace(/^#/,"").length>0){_this.settings.selected.push("#"+this.replace(/^#/,""))}})}else if(this.settings.selected!==false){var tmp=Array();if((typeof this.settings.selected).toLowerCase()=="object"){$.each(this.settings.selected,function(){if(this.replace(/^#/,"").length>0)tmp.push("#"+this.replace(/^#/,""))})}else{if(this.settings.selected.replace(/^#/,"").length>0)tmp.push("#"+this.settings.selected.replace(/^#/,""))}this.settings.selected=tmp}if(obj&&this.settings.data.async){this.opened=Array();obj=this.get_node(obj);obj.find("li.open").each(function(i){_this.opened.push("#"+this.id)});if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");if(obj.hasClass("leaf"))obj.removeClass("leaf");obj.children("ul:eq(0)").html("");return this.open_branch(obj,true,function(){_this.reselect.apply(_this)})}if(this.settings.data.type=="xml_flat"||this.settings.data.type=="xml_nested"){this.scrtop=this.container.get(0).scrollTop;var xsl=(this.settings.data.type=="xml_flat")?"flat.xsl":"nested.xsl";if(this.settings.data.xml)this.container.getTransform(this.path+xsl,this.settings.data.xml,{params:{theme_name:_this.settings.ui.theme_name,theme_path:_this.theme},meth:_this.settings.data.method,dat:_this.settings.data.async_data.apply(_this,[obj,_this]),callback:function(){_this.context_menu.apply(_this);_this.reselect.apply(_this)}});else this.container.getTransform(this.path+xsl,this.settings.data.url,{params:{theme_name:_this.settings.ui.theme_name,theme_path:_this.theme},meth:_this.settings.data.method,dat:_this.settings.data.async_data.apply(_this,[obj,_this]),callback:function(){_this.context_menu.apply(_this);_this.reselect.apply(_this)}});return}else if(this.settings.data.type=="json"){if(this.settings.data.json){var str="";if(this.settings.data.json.length){for(var i=0;i<this.settings.data.json.length;i++){str+=this.parseJSON(this.settings.data.json[i])}}else str=this.parseJSON(this.settings.data.json);this.container.html("<ul>"+str+"</ul>");this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");this.container.find("li").not(".open").not(".closed").addClass("leaf");this.context_menu();this.reselect()}else{var _this=this;$.ajax({type:this.settings.data.method,url:this.settings.data.url,data:this.settings.data.async_data(false,this),dataType:"json",success:function(data){data=_this.settings.callback.onJSONdata.call(null,data,_this);var str="";if(data.length){for(var i=0;i<data.length;i++){str+=_this.parseJSON(data[i])}}else str=_this.parseJSON(data);_this.container.html("<ul>"+str+"</ul>");_this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");_this.container.find("li").not(".open").not(".closed").addClass("leaf");_this.context_menu.apply(_this);_this.reselect.apply(_this)},error:function(xhttp,textStatus,errorThrown){_this.error(errorThrown+" "+textStatus)}})}}else{this.container.children("ul:eq(0)");this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");this.container.find("li").not(".open").not(".closed").addClass("leaf");this.reselect()}},parseJSON:function(data){if(!data||!data.data)return"";var str="";str+="<li ";var cls=false;if(data.attributes){for(var i in data.attributes){if(typeof data.attributes[i]=="function")continue;if(i=="class"){str+=" class='"+data.attributes[i]+" ";if(data.state=="closed"||data.state=="open")str+=" "+data.state+" ";str+="' ";cls=true}else str+=" "+i+"='"+data.attributes[i]+"' "}}if(!cls&&(data.state=="closed"||data.state=="open"))str+=" class='"+data.state+"' ";str+=">";if(this.settings.languages.length){for(var i=0;i<this.settings.languages.length;i++){var attr={};attr["href"]="#";attr["style"]="";attr["class"]=this.settings.languages[i];if(data.data[this.settings.languages[i]]&&(typeof data.data[this.settings.languages[i]].attributes).toLowerCase()!="undefined"){for(var j in data.data[this.settings.languages[i]].attributes){if(typeof data.data[this.settings.languages[i]].attributes[j]=="function")continue;if(j=="style"||j=="class")attr[j]+=" "+data.data[this.settings.languages[i]].attributes[j];else attr[j]=data.data[this.settings.languages[i]].attributes[j]}}if(data.data[this.settings.languages[i]]&&data.data[this.settings.languages[i]].icon&&this.settings.theme_name!="themeroller"){var icn=data.data[this.settings.languages[i]].icon.indexOf("/")==-1?this.theme+data.data[this.settings.languages[i]].icon:data.data[this.settings.languages[i]].icon;attr["style"]+=" ; background-image:url('"+icn+"'); "}str+="<a";for(var j in attr){if(typeof attr[j]=="function")continue;str+=' '+j+'="'+attr[j]+'" '}str+=">";if(data.data[this.settings.languages[i]]&&data.data[this.settings.languages[i]].icon&&this.settings.theme_name=="themeroller"){str+="<ins class='ui-icon "+data.data[this.settings.languages[i]].icon+"'> </ins>"}str+=((typeof data.data[this.settings.languages[i]].title).toLowerCase()!="undefined"?data.data[this.settings.languages[i]].title:data.data[this.settings.languages[i]])+"</a>"}}else{var attr={};attr["href"]="#";attr["style"]="";attr["class"]="";if((typeof data.data.attributes).toLowerCase()!="undefined"){for(var i in data.data.attributes){if(typeof data.data.attributes[i]=="function")continue;if(i=="style"||i=="class")attr[i]+=" "+data.data.attributes[i];else attr[i]=data.data.attributes[i]}}if(data.data.icon&&this.settings.ui.theme_name!="themeroller"){var icn=data.data.icon.indexOf("/")==-1?this.theme+data.data.icon:data.data.icon;attr["style"]+=" ; background-image:url('"+icn+"');"}str+="<a";for(var i in attr){if(typeof attr[j]=="function")continue;str+=' '+i+'="'+attr[i]+'" '}str+=">";if(data.data.icon&&this.settings.ui.theme_name=="themeroller"){str+="<ins class='ui-icon "+data.data.icon+"'> </ins>"}str+=((typeof data.data.title).toLowerCase()!="undefined"?data.data.title:data.data)+"</a>"}if(data.children&&data.children.length){str+='<ul>';for(var i=0;i<data.children.length;i++){str+=this.parseJSON(data.children[i])}str+='</ul>'}str+="</li>";return str},getJSON:function(nod,outer_attrib,inner_attrib,force){var _this=this;if(!nod||$(nod).size()==0){nod=this.container.children("ul").children("li")}else nod=$(nod);if(nod.size()>1){var arr=[];nod.each(function(){arr.push(_this.getJSON(this,outer_attrib,inner_attrib,force))});return arr}if(!outer_attrib)outer_attrib=["id","rel","class"];if(!inner_attrib)inner_attrib=[];var obj={attributes:{},data:false};for(var i in outer_attrib){if(typeof outer_attrib[i]=="function")continue;var val=(outer_attrib[i]=="class")?nod.attr(outer_attrib[i]).replace("last","").replace("leaf","").replace("closed","").replace("open",""):nod.attr(outer_attrib[i]);if(typeof val!="undefined"&&val.replace(" ","").length>0)obj.attributes[outer_attrib[i]]=val;delete val}if(this.settings.languages.length){obj.data={};for(var i in this.settings.languages){if(typeof this.settings.languages[i]=="function")continue;var a=nod.children("a."+this.settings.languages[i]);if(force||inner_attrib.length||a.get(0).style.backgroundImage.toString().length){obj.data[this.settings.languages[i]]={};obj.data[this.settings.languages[i]].title=a.text();if(a.get(0).style.backgroundImage.length){obj.data[this.settings.languages[i]].icon=a.get(0).style.backgroundImage.replace("url(","").replace(")","")}if(this.settings.ui.theme_name=="themeroller"&&a.children("ins").size()){var tmp=a.children("ins").attr("class");var cls=false;$.each(tmp.split(" "),function(i,val){if(val.indexOf("ui-icon-")==0){cls=val;return false}});if(cls)obj.data[this.settings.languages[i]].icon=cls}if(inner_attrib.length){obj.data[this.settings.languages[i]].attributes={};for(var j in inner_attrib){if(typeof inner_attrib[j]=="function")continue;var val=a.attr(inner_attrib[j]);if(typeof val!="undefined"&&val.replace(" ","").length>0)obj.data[this.settings.languages[i]].attributes[inner_attrib[j]]=val;delete val}}}else{obj.data[this.settings.languages[i]]=a.text()}}}else{var a=nod.children("a");if(force||inner_attrib.length||a.get(0).style.backgroundImage.toString().length){obj.data={};obj.data.title=a.text();if(a.get(0).style.backgroundImage.length){obj.data.icon=a.get(0).style.backgroundImage.replace("url(","").replace(")","")}if(this.settings.ui.theme_name=="themeroller"&&a.children("ins").size()){var tmp=a.children("ins").attr("class");var cls=false;$.each(tmp.split(" "),function(i,val){if(val.indexOf("ui-icon-")==0){cls=val;return false}});if(cls)obj.data[this.settings.languages[i]].icon=cls}if(inner_attrib.length){obj.data.attributes={};for(var j in inner_attrib){if(typeof inner_attrib[j]=="function")continue;var val=a.attr(inner_attrib[j]);if(typeof val!="undefined"&&val.replace(" ","").length>0)obj.data.attributes[inner_attrib[j]]=val;delete val}}}else{obj.data=a.text()}}if(nod.children("ul").size()>0){obj.children=[];nod.children("ul").children("li").each(function(){obj.children.push(_this.getJSON(this,outer_attrib,inner_attrib,force))})}return obj},getXML:function(tp,nod,outer_attrib,inner_attrib,cb){var _this=this;if(tp!="flat")tp="nested";if(!nod||$(nod).size()==0){nod=this.container.children("ul").children("li")}else nod=$(nod);if(nod.size()>1){var obj='<root>';nod.each(function(){obj+=_this.getXML(tp,this,outer_attrib,inner_attrib,true)});obj+='</root>';return obj}if(!outer_attrib)outer_attrib=["id","rel","class"];if(!inner_attrib)inner_attrib=[];var obj='';if(!cb)obj='<root>';obj+='<item ';if(tp=="flat"){var tmp_id=nod.parents("li:eq(0)").size()?nod.parents("li:eq(0)").attr("id"):0;obj+=' parent_id="'+tmp_id+'" ';delete tmp_id}for(var i in outer_attrib){if(typeof outer_attrib[i]=="function")continue;var val=(outer_attrib[i]=="class")?nod.attr(outer_attrib[i]).replace("last","").replace("leaf","").replace("closed","").replace("open",""):nod.attr(outer_attrib[i]);if(typeof val!="undefined"&&val.replace(" ","").length>0)obj+=' '+outer_attrib[i]+'="'+val+'" ';delete val}obj+='>';obj+='<content>';if(this.settings.languages.length){for(var i in this.settings.languages){if(typeof this.settings.languages[i]=="function")continue;var a=nod.children("a."+this.settings.languages[i]);obj+='<name ';if(inner_attrib.length||a.get(0).style.backgroundImage.toString().length||this.settings.ui.theme_name=="themeroller"){if(a.get(0).style.backgroundImage.length){obj+=' icon="'+a.get(0).style.backgroundImage.replace("url(","").replace(")","")+'" '}if(this.settings.ui.theme_name=="themeroller"&&a.children("ins").size()){var tmp=a.children("ins").attr("class");var cls=false;$.each(tmp.split(" "),function(i,val){if(val.indexOf("ui-icon-")==0){cls=val;return false}});if(cls)obj+=' icon="'+cls+'" '}if(inner_attrib.length){for(var j in inner_attrib){if(typeof inner_attrib[j]=="function")continue;var val=a.attr(inner_attrib[j]);if(typeof val!="undefined"&&val.replace(" ","").length>0)obj+=' '+inner_attrib[j]+'="'+val+'" ';delete val}}}obj+='><![CDATA['+a.text()+']]></name>'}}else{var a=nod.children("a");obj+='<name ';if(inner_attrib.length||a.get(0).style.backgroundImage.toString().length||this.settings.ui.theme_name=="themeroller"){if(a.get(0).style.backgroundImage.length){obj+=' icon="'+a.get(0).style.backgroundImage.replace("url(","").replace(")","")+'" '}if(this.settings.ui.theme_name=="themeroller"&&a.children("ins").size()){var tmp=a.children("ins").attr("class");var cls=false;$.each(tmp.split(" "),function(i,val){if(val.indexOf("ui-icon-")==0){cls=val;return false}});if(cls)obj+=' icon="'+cls+'" '}if(inner_attrib.length){for(var j in inner_attrib){if(typeof inner_attrib[j]=="function")continue;var val=a.attr(inner_attrib[j]);if(typeof val!="undefined"&&val.replace(" ","").length>0)obj+=' '+inner_attrib[j]+'="'+val+'" ';delete val}}}obj+='><![CDATA['+a.text()+']]></name>'}obj+='</content>';if(tp=="flat")obj+='</item>';if(nod.children("ul").size()>0){nod.children("ul").children("li").each(function(){obj+=_this.getXML(tp,this,outer_attrib,inner_attrib,true)})}if(tp=="nested")obj+='</item>';if(!cb)obj+='</root>';return obj},focus:function(){if(this.locked)return false;if(tree_component.focused!=this.cntr){tree_component.focused=this.cntr;this.settings.callback.onfocus.call(null,this)}},show_context:function(obj){this.context.show();var tmp=$(obj).children("a:visible").offset();this.context.css({"left":(tmp.left),"top":(tmp.top+parseInt(obj.children("a:visible").height())+2)})},hide_context:function(){if(this.context.to_remove&&this.context.apply_to)this.context.apply_to.children("a").removeClass("clicked");this.context.apply_to=false;this.context.hide()},attachEvents:function(){var _this=this;this.container.bind("mousedown.jstree",function(event){if(tree_component.drag_drop.isdown){tree_component.drag_drop.move_type=false;event.preventDefault();event.stopPropagation();event.stopImmediatePropagation();return false}}).bind("mouseup.jstree",function(event){setTimeout(function(){_this.focus.apply(_this)},5)}).bind("click.jstree",function(event){return true});$("#"+this.container.attr("id")+" li").live("click",function(event){if(event.target.tagName!="LI")return true;_this.off_height();if(event.pageY-$(event.target).offset().top>_this.li_height)return true;_this.toggle_branch.apply(_this,[event.target]);event.stopPropagation();return false});$("#"+this.container.attr("id")+" li a").live("click.jstree",function(event){if(event.which&&event.which==3)return true;if(_this.locked){event.preventDefault();event.target.blur();return _this.error("LOCKED")}_this.select_branch.apply(_this,[event.target,event.ctrlKey||_this.settings.rules.multiple=="on"]);if(_this.inp){_this.inp.blur()}event.preventDefault();event.target.blur();return false}).live("dblclick.jstree",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();event.target.blur();return _this.error("LOCKED")}_this.settings.callback.ondblclk.call(null,_this.get_node(event.target).get(0),_this);event.preventDefault();event.stopPropagation();event.target.blur()}).live("contextmenu.jstree",function(event){if(_this.locked){event.target.blur();return _this.error("LOCKED")}var val=_this.settings.callback.onrgtclk.call(null,_this.get_node(event.target).get(0),_this,event);if(_this.context){if(_this.context.append==false){$("body").append(_this.context);_this.context.append=true;for(var i in _this.settings.ui.context){if(typeof _this.settings.ui.context[i]=="function")continue;if(_this.settings.ui.context[i]=="separator")continue;(function(){var func=_this.settings.ui.context[i].action;_this.context.children("[rel="+_this.settings.ui.context[i].id+"]").bind("click",function(event){if(!$(this).hasClass("disabled")){func.call(null,_this.context.apply_to||null,_this);_this.hide_context()}event.stopPropagation();event.preventDefault();return false}).bind("mouseup",function(event){this.blur();if($(this).hasClass("disabled")){event.stopPropagation();event.preventDefault();return false}}).bind("mousedown",function(event){event.stopPropagation();event.preventDefault()})})()}}var obj=_this.get_node(event.target);if(_this.inp){_this.inp.blur()}if(obj){if(!obj.children("a:eq(0)").hasClass("clicked")){_this.context.apply_to=obj;_this.context.to_remove=true;_this.context.apply_to.children("a").addClass("clicked");event.target.blur()}else{_this.context.to_remove=false;_this.context.apply_to=(_this.selected_arr&&_this.selected_arr.length>1)?_this.selected_arr:_this.selected}_this.context.children("a").removeClass("disabled").show();var go=false;for(var i in _this.settings.ui.context){if(typeof _this.settings.ui.context[i]=="function")continue;if(_this.settings.ui.context[i]=="separator")continue;var state=_this.settings.ui.context[i].visible.call(null,_this.context.apply_to,_this);if(state===false)_this.context.children("[rel="+_this.settings.ui.context[i].id+"]").addClass("disabled");if(state===-1)_this.context.children("[rel="+_this.settings.ui.context[i].id+"]").hide();else go=true}if(go==true)_this.show_context(obj);event.preventDefault();event.stopPropagation();return false}}return val}).live("mouseover.jstree",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();return _this.error("LOCKED")}if((_this.settings.ui.hover_mode||_this.settings.ui.theme_name=="themeroller")&&_this.hovered!==false&&event.target.tagName=="A"){_this.hovered.children("a").removeClass("hover ui-state-hover");_this.hovered=false}if(_this.settings.ui.theme_name=="themeroller"){_this.hover_branch.apply(_this,[event.target])}});if(_this.settings.ui.theme_name=="themeroller"){$("#"+this.container.attr("id")+" li a").live("mouseout",function(event){if(_this.hovered)_this.hovered.children("a").removeClass("hover ui-state-hover")})}if(this.settings.rules.draggable!="none"){$("#"+this.container.attr("id")+" li a").live("mousedown.jstree",function(event){if(_this.settings.rules.drag_button=="left"&&event.which&&event.which!=1)return true;if(_this.settings.rules.drag_button=="right"&&event.which&&event.which!=3)return true;_this.focus.apply(_this);if(_this.locked)return _this.error("LOCKED");var obj=_this.get_node(event.target);if(_this.settings.rules.multiple!=false&&_this.selected_arr.length>1&&obj.children("a:eq(0)").hasClass("clicked")){var counter=0;for(var i in _this.selected_arr){if(typeof _this.selected_arr[i]=="function")continue;if(_this.check("draggable",_this.selected_arr[i])){_this.selected_arr[i].addClass("dragged");tree_component.drag_drop.origin_tree=_this;counter++}}if(counter>0){if(_this.check("draggable",obj))tree_component.drag_drop.drag_node=obj;else tree_component.drag_drop.drag_node=_this.container.find("li.dragged:eq(0)");tree_component.drag_drop.isdown=true;tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree "+(_this.container.hasClass("tree-default")?" tree-default":"")+(_this.settings.ui.theme_name&&_this.settings.ui.theme_name!="default"?" tree-"+_this.settings.ui.theme_name:"")+"' />").append("<ul class='"+_this.container.children("ul:eq(0)").get(0).className+"' />");var tmp=$(tree_component.drag_drop.drag_node.get(0).cloneNode(true));if(_this.settings.languages.length>0)tmp.find("a").not("."+_this.current_lang).hide();tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last").children("a").html("Multiple selection").end().children("ul").remove()}}else{if(_this.check("draggable",obj)){tree_component.drag_drop.drag_node=obj;tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree "+(_this.container.hasClass("tree-default")?" tree-default":"")+(_this.settings.ui.theme_name&&_this.settings.ui.theme_name!="default"?" tree-"+_this.settings.ui.theme_name:"")+"' />").append("<ul class='"+_this.container.children("ul:eq(0)").get(0).className+"' />");var tmp=$(obj.get(0).cloneNode(true));if(_this.settings.languages.length>0)tmp.find("a").not("."+_this.current_lang).hide();tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last");tree_component.drag_drop.isdown=true;tree_component.drag_drop.foreign=false;tree_component.drag_drop.origin_tree=_this;obj.addClass("dragged")}}tree_component.drag_drop.init_x=event.pageX;tree_component.drag_drop.init_y=event.pageY;obj.blur();event.preventDefault();event.stopPropagation();return false});$(document).bind("mousedown.jstree",tree_component.mousedown).bind("mouseup.jstree",tree_component.mouseup).bind("mousemove.jstree",tree_component.mousemove)}if(_this.context)$(document).bind("mousedown",function(){_this.hide_context()})},checkMove:function(NODES,REF_NODE,TYPE){if(this.locked)return this.error("LOCKED");var _this=this;if(REF_NODE.parents("li.dragged").size()>0||REF_NODE.is(".dragged"))return this.error("MOVE: NODE OVER SELF");if(NODES.size()==1){var NODE=NODES.eq(0);if(tree_component.drag_drop.foreign){if(this.settings.rules.droppable.length==0)return false;if(!NODE.is("."+this.settings.rules.droppable.join(", .")))return false;var ok=false;for(var i in this.settings.rules.droppable){if(typeof this.settings.rules.droppable[i]=="function")continue;if(NODE.is("."+this.settings.rules.droppable[i])){if(this.settings.rules.metadata){$.metadata.setType("attr",this.settings.rules.metadata);NODE.attr(this.settings.rules.metadata,"type: '"+this.settings.rules.droppable[i]+"'")}else{NODE.attr(this.settings.rules.type_attr,this.settings.rules.droppable[i])}ok=true;break}}if(!ok)return false}if(!this.check("dragrules",[NODE,TYPE,REF_NODE.parents("li:eq(0)")]))return this.error("MOVE: AGAINST DRAG RULES")}else{var ok=true;NODES.each(function(i){if(ok==false)return false;var ref=REF_NODE;var mv=TYPE;if(!_this.check.apply(_this,["dragrules",[$(this),mv,ref]]))ok=false});if(ok==false)return this.error("MOVE: AGAINST DRAG RULES")}if(this.settings.rules.use_inline&&this.settings.rules.metadata){var nd=false;if(TYPE=="inside")nd=REF_NODE.parents("li:eq(0)");else nd=REF_NODE.parents("li:eq(1)");if(nd.size()){if(typeof nd.metadata()["valid_children"]!="undefined"){var tmp=nd.metadata()["valid_children"];var ok=true;NODES.each(function(i){if(ok==false)return false;if($.inArray(_this.get_type(this),tmp)==-1)ok=false});if(ok==false)return this.error("MOVE: NOT A VALID CHILD")}if(typeof nd.metadata()["max_children"]!="undefined"){if((nd.children("ul:eq(0)").children("li").not(".dragged").size()+NODES.size())>nd.metadata().max_children)return this.error("MOVE: MAX CHILDREN REACHED")}var incr=0;NODES.each(function(j){var i=1;var t=$(this);while(i<100){t=t.children("ul").children("li");if(t.size()==0)break;i++}incr=Math.max(i,incr)});var ok=true;if((typeof $(nd).metadata().max_depth).toLowerCase()!="undefined"&&$(nd).metadata().max_depth<incr)ok=false;else{nd.parents("li").each(function(i){if(ok==false)return false;if((typeof $(this).metadata().max_depth).toLowerCase()!="undefined"){if((i+incr)>=$(this).metadata().max_depth)ok=false}})}if(ok==false)return this.error("MOVE: MAX_DEPTH REACHED")}}return true},reselect:function(is_callback){var _this=this;if(!is_callback)this.cl_count=0;else this.cl_count--;if(this.opened&&this.opened.length){var opn=false;for(var j=0;this.opened&&j<this.opened.length;j++){if(this.settings.data.async){if(this.get_node(this.opened[j]).size()>0){opn=true;var tmp=this.opened[j];delete this.opened[j];this.open_branch(tmp,true,function(){_this.reselect.apply(_this,[true])});this.cl_count++}}else this.open_branch(this.opened[j],true)}if(this.settings.data.async&&opn)return;delete this.opened}if(this.cl_count>0)return;if(this.settings.ui.rtl)this.container.css("direction","rtl").children("ul:eq(0)").addClass("rtl");else this.container.css("direction","ltr").children("ul:eq(0)").addClass("ltr");if(this.settings.ui.dots==false)this.container.children("ul:eq(0)").addClass("no_dots");if(this.scrtop){this.container.scrollTop(_this.scrtop);delete this.scrtop}if(this.settings.selected!==false){$.each(this.settings.selected,function(i){if(_this.is_partial_refresh)_this.select_branch($(_this.settings.selected[i],_this.container),(_this.settings.rules.multiple!==false));else _this.select_branch($(_this.settings.selected[i],_this.container),(_this.settings.rules.multiple!==false&&i>0))});this.settings.selected=false}if(this.settings.ui.theme_name=="themeroller")this.container.find("a").addClass("ui-state-default");this.settings.callback.onload.call(null,_this)},get_node:function(obj){var obj=$(obj);return obj.is("li")?obj:obj.parents("li:eq(0)")},get_type:function(obj){obj=!obj?this.selected:this.get_node(obj);if(!obj)return;if(this.settings.rules.metadata){$.metadata.setType("attr",this.settings.rules.metadata);var tmp=obj.metadata().type;if(tmp)return tmp}return obj.attr(this.settings.rules.type_attr)},scrollCheck:function(x,y){var _this=this;var cnt=_this.container;var off=_this.container.offset();var st=cnt.scrollTop();var sl=cnt.scrollLeft();var h_cor=(cnt.get(0).scrollWidth>cnt.width())?40:20;if(y-off.top<20)cnt.scrollTop(Math.max((st-_this.settings.ui.scroll_spd),0));if(cnt.height()-(y-off.top)<h_cor)cnt.scrollTop(st+_this.settings.ui.scroll_spd);if(x-off.left<20)cnt.scrollLeft(Math.max((sl-_this.settings.ui.scroll_spd),0));if(cnt.width()-(x-off.left)<40)cnt.scrollLeft(sl+_this.settings.ui.scroll_spd);if(cnt.scrollLeft()!=sl||cnt.scrollTop()!=st){_this.moveType=false;_this.moveRef=false;tree_component.drag_drop.marker.hide()}tree_component.drag_drop.scroll_time=setTimeout(function(){_this.scrollCheck(x,y)},50)},check:function(rule,nodes){if(this.locked)return this.error("LOCKED");if(rule!="dragrules"&&this.settings.rules.use_inline&&this.settings.rules.metadata){$.metadata.setType("attr",this.settings.rules.metadata);if(typeof this.get_node(nodes).metadata()[rule]!="undefined")return this.get_node(nodes).metadata()[rule]}if(!this.settings.rules[rule])return false;if(this.settings.rules[rule]=="none")return false;if(this.settings.rules[rule]=="all")return true;if(rule=="dragrules"){var nds=new Array();nds[0]=this.get_type(nodes[0]);nds[1]=nodes[1];nds[2]=this.get_type(nodes[2]);for(var i=0;i<this.settings.rules.dragrules.length;i++){var r=this.settings.rules.dragrules[i];var n=(r.indexOf("!")===0)?false:true;if(!n)r=r.replace("!","");var tmp=r.split(" ");for(var j=0;j<3;j++){if(tmp[j]==nds[j]||tmp[j]=="*")tmp[j]=true}if(tmp[0]===true&&tmp[1]===true&&tmp[2]===true)return n}return false}else return($.inArray(this.get_type(nodes),this.settings.rules[rule])!=-1)?true:false},hover_branch:function(obj){if(this.locked)return this.error("LOCKED");if(this.settings.ui.hover_mode==false&&this.settings.ui.theme_name!="themeroller")return this.select_branch(obj);var _this=this;var obj=_this.get_node(obj);if(!obj.size())return this.error("HOVER: NOT A VALID NODE");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(this.hovered)this.hovered.children("A").removeClass("hover ui-state-hover");this.hovered=obj;this.hovered.children("a").removeClass("hover ui-state-hover").addClass(this.settings.ui.theme_name=="themeroller"?"hover ui-state-hover":"hover");var off_t=this.hovered.offset().top;var beg_t=this.container.offset().top;var end_t=beg_t+this.container.height();var h_cor=(this.container.get(0).scrollWidth>this.container.width())?40:20;if(off_t+5<beg_t)this.container.scrollTop(this.container.scrollTop()-(beg_t-off_t+5));if(off_t+h_cor>end_t)this.container.scrollTop(this.container.scrollTop()+(off_t+h_cor-end_t))},select_branch:function(obj,multiple){if(this.locked)return this.error("LOCKED");if(!obj&&this.hovered!==false)obj=this.hovered;var _this=this;obj=_this.get_node(obj);if(!obj.size())return this.error("SELECT: NOT A VALID NODE");obj.children("a").removeClass("hover ui-state-hover");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(_this.settings.callback.beforechange.call(null,obj.get(0),_this)===false)return this.error("SELECT: STOPPED BY USER");if(this.settings.rules.multiple!=false&&multiple&&obj.children("a.clicked").size()>0){return this.deselect_branch(obj)}if(this.settings.rules.multiple!=false&&multiple){this.selected_arr.push(obj)}if(this.settings.rules.multiple!=false&&!multiple){for(var i in this.selected_arr){if(typeof this.selected_arr[i]=="function")continue;this.selected_arr[i].children("A").removeClass("clicked ui-state-active");this.settings.callback.ondeselect.call(null,this.selected_arr[i].get(0),_this)}this.selected_arr=[];this.selected_arr.push(obj);if(this.selected&&this.selected.children("A").hasClass("clicked")){this.selected.children("A").removeClass("clicked ui-state-active");this.settings.callback.ondeselect.call(null,this.selected.get(0),_this)}}if(!this.settings.rules.multiple){if(this.selected){this.selected.children("A").removeClass("clicked ui-state-active");this.settings.callback.ondeselect.call(null,this.selected.get(0),_this)}}this.selected=obj;if((this.settings.ui.hover_mode||this.settings.ui.theme_name=="themeroller")&&this.hovered!==false){this.hovered.children("A").removeClass("hover ui-state-hover");this.hovered=obj}this.selected.children("a").removeClass("clicked ui-state-active").addClass(this.settings.ui.theme_name=="themeroller"?"clicked ui-state-active":"clicked").end().parents("li.closed").each(function(){_this.open_branch(this,true)});var off_t=this.selected.offset().top;var beg_t=this.container.offset().top;var end_t=beg_t+this.container.height();var h_cor=(this.container.get(0).scrollWidth>this.container.width())?40:20;if(off_t+5<beg_t)this.container.scrollTop(this.container.scrollTop()-(beg_t-off_t+5));if(off_t+h_cor>end_t)this.container.scrollTop(this.container.scrollTop()+(off_t+h_cor-end_t));this.set_cookie("selected");this.settings.callback.onselect.call(null,this.selected.get(0),_this);this.settings.callback.onchange.call(null,this.selected.get(0),_this)},deselect_branch:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);obj.children("a").removeClass("clicked ui-state-active");this.settings.callback.ondeselect.call(null,obj.get(0),_this);if(this.settings.rules.multiple!=false&&this.selected_arr.length>1){this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this))});if(obj.get(0)==this.selected.get(0)){this.selected=this.selected_arr[0];this.set_cookie("selected")}}else{if(this.settings.rules.multiple!=false)this.selected_arr=[];this.selected=false;this.set_cookie("selected")}if(this.selected)this.settings.callback.onchange.call(null,this.selected.get(0),_this);else this.settings.callback.onchange.call(null,false,_this)},toggle_branch:function(obj){if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(obj.hasClass("closed"))return this.open_branch(obj);if(obj.hasClass("open"))return this.close_branch(obj)},open_branch:function(obj,disable_animation,callback){if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(!obj.size())return this.error("OPEN: NO SUCH NODE");if(obj.hasClass("leaf"))return this.error("OPEN: OPENING LEAF NODE");if(this.settings.data.async&&obj.find("li").size()==0){if(this.settings.callback.beforeopen.call(null,obj.get(0),this)===false)return this.error("OPEN: STOPPED BY USER");var _this=this;obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a class='loading' href='#'>"+(_this.settings.lang.loading||"Loading ...")+"</a></li></ul>");obj.removeClass("closed").addClass("open");if(this.settings.data.type=="xml_flat"||this.settings.data.type=="xml_nested"){var xsl=(this.settings.data.type=="xml_flat")?"flat.xsl":"nested.xsl";obj.children("ul:eq(0)").getTransform(this.path+xsl,this.settings.data.url,{params:{theme_path:_this.theme},meth:this.settings.data.method,dat:this.settings.data.async_data(obj,this),repl:true,callback:function(str,json){if(str.length<15){obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();if(callback)callback.call();return}_this.open_branch.apply(_this,[obj]);if(callback)callback.call()},error:function(){obj.removeClass("open").addClass("closed").children("ul:eq(0)").remove()}})}else{$.ajax({type:this.settings.data.method,url:this.settings.data.url,data:this.settings.data.async_data(obj,this),dataType:"json",success:function(data,textStatus){data=_this.settings.callback.onJSONdata.call(null,data,_this);if(!data||data.length==0){obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();if(callback)callback.call();return}var str="";if(data.length){for(var i=0;i<data.length;i++){str+=_this.parseJSON(data[i])}}else str=_this.parseJSON(data);if(str.length>0){obj.children("ul:eq(0)").replaceWith("<ul>"+str+"</ul>");obj.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");obj.find("li").not(".open").not(".closed").addClass("leaf");_this.open_branch.apply(_this,[obj])}else obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();if(callback)callback.call()},error:function(xhttp,textStatus,errorThrown){obj.removeClass("open").addClass("closed").children("ul:eq(0)").remove();_this.error(errorThrown+" "+textStatus)}})}return true}else{if(!this.settings.data.async){if(this.settings.callback.beforeopen.call(null,obj.get(0),this)===false)return this.error("OPEN: STOPPED BY USER")}if(this.settings.ui.theme_name=="themeroller")obj.find("a").not(".ui-state-default").addClass("ui-state-default");if(parseInt(this.settings.ui.animation)>0&&!disable_animation){obj.children("ul:eq(0)").css("display","none");obj.removeClass("closed").addClass("open");obj.children("ul:eq(0)").slideDown(parseInt(this.settings.ui.animation),function(){$(this).css("display","");if(callback)callback.call()})}else{obj.removeClass("closed").addClass("open");if(callback)callback.call()}this.set_cookie("open");this.settings.callback.onopen.call(null,obj.get(0),this);return true}},close_branch:function(obj,disable_animation){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);if(!obj.size())return this.error("CLOSE: NO SUCH NODE");if(_this.settings.callback.beforeclose.call(null,obj.get(0),_this)===false)return this.error("CLOSE: STOPPED BY USER");if(parseInt(this.settings.ui.animation)>0&&!disable_animation&&obj.children("ul:eq(0)").size()==1){obj.children("ul:eq(0)").slideUp(parseInt(this.settings.ui.animation),function(){if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");_this.set_cookie("open");$(this).css("display","")})}else{if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");this.set_cookie("open")}if(this.selected&&obj.children("ul:eq(0)").find("a.clicked").size()>0){obj.find("li:has(a.clicked)").each(function(){_this.deselect_branch(this)});if(obj.children("a.clicked").size()==0)this.select_branch(obj,(this.settings.rules.multiple!=false&&this.selected_arr.length>0))}this.settings.callback.onclose.call(null,obj.get(0),this)},open_all:function(obj,callback){if(this.locked)return this.error("LOCKED");var _this=this;obj=obj?this.get_node(obj).parent():this.container;var s=obj.find("li.closed").size();if(!callback)this.cl_count=0;else this.cl_count--;if(s>0){this.cl_count+=s;obj.find("li.closed").each(function(){var __this=this;_this.open_branch.apply(_this,[this,true,function(){_this.open_all.apply(_this,[__this,true])}])})}else if(this.cl_count==0)this.settings.callback.onopen_all.call(null,this)},close_all:function(){if(this.locked)return this.error("LOCKED");var _this=this;this.container.find("li.open").each(function(){_this.close_branch(this,true)})},show_lang:function(i){if(this.locked)return this.error("LOCKED");if(this.settings.languages[i]==this.current_lang)return true;var st=false;var id=this.container.attr("id")?"#"+this.container.attr("id"):".tree";st=get_css(id+" ."+this.current_lang,this.sn);if(st!==false)st.style.display="none";st=get_css(id+" ."+this.settings.languages[i],this.sn);if(st!==false)st.style.display="";this.current_lang=this.settings.languages[i];return true},cycle_lang:function(){if(this.locked)return this.error("LOCKED");var i=$.inArray(this.current_lang,this.settings.languages);i++;if(i>this.settings.languages.length-1)i=0;this.show_lang(i)},create:function(obj,ref_node,position){if(this.locked)return this.error("LOCKED");var root=false;if(ref_node==-1){root=true;ref_node=this.container}else ref_node=ref_node?this.get_node(ref_node):this.selected;if(!root&&(!ref_node||!ref_node.size()))return this.error("CREATE: NO NODE SELECTED");var pos=position;var tmp=ref_node;if(position=="before"){position=ref_node.parent().children().index(ref_node);ref_node=ref_node.parents("li:eq(0)")}if(position=="after"){position=ref_node.parent().children().index(ref_node)+1;ref_node=ref_node.parents("li:eq(0)")}if(!root&&ref_node.size()==0){root=true;ref_node=this.container}if(!root){if(!this.check("creatable",ref_node))return this.error("CREATE: CANNOT CREATE IN NODE");if(ref_node.hasClass("closed")){if(this.settings.data.async&&ref_node.children("ul").size()==0){var _this=this;return this.open_branch(ref_node,true,function(){_this.create.apply(_this,[obj,ref_node,position])})}else this.open_branch(ref_node,true)}}var torename=false;if(!obj)obj={};else obj=$.extend(true,{},obj);if(!obj.attributes)obj.attributes={};if(this.settings.rules.metadata){if(!obj.attributes[this.settings.rules.metadata])obj.attributes[this.settings.rules.metadata]='{ "type" : "'+(this.get_type(tmp)||"")+'" }'}else{if(!obj.attributes[this.settings.rules.type_attr])obj.attributes[this.settings.rules.type_attr]=this.get_type(tmp)||""}if(this.settings.languages.length){if(!obj.data){obj.data={};torename=true}for(var i=0;i<this.settings.languages.length;i++){if(!obj.data[this.settings.languages[i]])obj.data[this.settings.languages[i]]=((typeof this.settings.lang.new_node).toLowerCase()!="string"&&this.settings.lang.new_node[i])?this.settings.lang.new_node[i]:this.settings.lang.new_node}}else{if(!obj.data){obj.data=this.settings.lang.new_node;torename=true}}var $li=$(this.parseJSON(obj));if($li.children("ul").size()){if(!$li.is(".open"))$li.addClass("closed")}else $li.addClass("leaf");$li.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");$li.find("li").not(".open").not(".closed").addClass("leaf");if(!root&&this.settings.rules.use_inline&&this.settings.rules.metadata){var t=this.get_type($li)||"";$.metadata.setType("attr",this.settings.rules.metadata);if(typeof ref_node.metadata()["valid_children"]!="undefined"){if($.inArray(t,ref_node.metadata()["valid_children"])==-1)return this.error("CREATE: NODE NOT A VALID CHILD")}if(typeof ref_node.metadata()["max_children"]!="undefined"){if((ref_node.children("ul:eq(0)").children("li").size()+1)>ref_node.metadata().max_children)return this.error("CREATE: MAX_CHILDREN REACHED")}var ok=true;if((typeof $(ref_node).metadata().max_depth).toLowerCase()!="undefined"&&$(ref_node).metadata().max_depth===0)ok=false;else{ref_node.parents("li").each(function(i){if($(this).metadata().max_depth){if((i+1)>=$(this).metadata().max_depth){ok=false;return false}}})}if(!ok)return this.error("CREATE: MAX_DEPTH REACHED")}if((typeof position).toLowerCase()=="undefined"||position=="inside")position=(this.settings.rules.createat=="top")?0:ref_node.children("ul:eq(0)").children("li").size();if(ref_node.children("ul").size()==0||(root==true&&ref_node.children("ul").children("li").size()==0)){if(!root)var a=this.moved($li,ref_node.children("a:eq(0)"),"inside",true);else var a=this.moved($li,this.container.children("ul:eq(0)"),"inside",true)}else if(pos=="before"&&ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",true);else if(pos=="after"&&ref_node.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after",true);else if(ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",true);else var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",true);if(a===false)return this.error("CREATE: ABORTED");if(torename){this.select_branch($li.children("a:eq(0)"));this.rename()}return $li},rename:function(obj){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.selected;var _this=this;if(!obj||!obj.size())return this.error("RENAME: NO NODE SELECTED");if(!this.check("renameable",obj))return this.error("RENAME: NODE NOT RENAMABLE");if(!this.settings.callback.beforerename.call(null,obj.get(0),_this.current_lang,_this))return this.error("RENAME: STOPPED BY USER");obj.parents("li.closed").each(function(){_this.open_branch(this)});if(this.current_lang)obj=obj.find("a."+this.current_lang).get(0);else obj=obj.find("a:first").get(0);last_value=obj.innerHTML;_this.inp=$("<input type='text' autocomplete='off' />");_this.inp.val(last_value.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<")).bind("mousedown",function(event){event.stopPropagation()}).bind("mouseup",function(event){event.stopPropagation()}).bind("click",function(event){event.stopPropagation()}).bind("keyup",function(event){var key=event.keyCode||event.which;if(key==27){this.value=last_value;this.blur();return}if(key==13){this.blur();return}});var rb={};rb[this.container.attr("id")]=this.get_rollback();_this.inp.blur(function(event){if(this.value=="")this.value=last_value;$(obj).text($(obj).parent().find("input").eq(0).attr("value")).get(0).style.display="";$(obj).prevAll("span").remove();_this.settings.callback.onrename.call(null,_this.get_node(obj).get(0),_this.current_lang,_this,rb);_this.inp=false});var spn=$("<span />").addClass(obj.className).append(_this.inp);spn.attr("style",$(obj).attr("style"));obj.style.display="none";$(obj).parent().prepend(spn);_this.inp.get(0).focus();_this.inp.get(0).select()},remove:function(obj){if(this.locked)return this.error("LOCKED");var rb={};rb[this.container.attr("id")]=this.get_rollback();if(obj&&(!this.selected||this.get_node(obj).get(0)!=this.selected.get(0))){obj=this.get_node(obj);if(obj.size()){if(!this.check("deletable",obj))return this.error("DELETE: NODE NOT DELETABLE");if(!this.settings.callback.beforedelete.call(null,obj.get(0),_this))return this.error("DELETE: STOPPED BY USER");$parent=obj.parent();obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();this.set_cookie("open")}this.settings.callback.ondelete.call(null,obj.get(0),this,rb)}}else if(this.selected){if(!this.check("deletable",this.selected))return this.error("DELETE: NODE NOT DELETABLE");if(!this.settings.callback.beforedelete.call(null,this.selected.get(0),_this))return this.error("DELETE: STOPPED BY USER");$parent=this.selected.parent();var obj=this.selected;if(this.settings.rules.multiple==false||this.selected_arr.length==1){var stop=true;var tmp=(this.selected.prev("li:eq(0)").size())?this.selected.prev("li:eq(0)"):this.selected.parents("li:eq(0)")}obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();this.set_cookie("open")}this.settings.callback.ondelete.call(null,obj.get(0),this,rb);if(stop&&tmp)this.select_branch(tmp);if(this.settings.rules.multiple!=false&&!stop){var _this=this;this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this))});if(this.selected_arr.length>0){this.selected=this.selected_arr[0];this.remove()}}}else return this.error("DELETE: NO NODE SELECTED")},next:function(obj,strict){obj=this.get_node(obj);if(!obj.size())return false;if(strict)return(obj.nextAll("li").size()>0)?obj.nextAll("li:eq(0)"):false;if(obj.hasClass("open"))return obj.find("li:eq(0)");else if(obj.nextAll("li").size()>0)return obj.nextAll("li:eq(0)");else return obj.parents("li").next("li").eq(0)},prev:function(obj,strict){obj=this.get_node(obj);if(!obj.size())return false;if(strict)return(obj.prevAll("li").size()>0)?obj.prevAll("li:eq(0)"):false;if(obj.prev("li").size()){var obj=obj.prev("li").eq(0);while(obj.hasClass("open"))obj=obj.children("ul:eq(0)").children("li:last");return obj}else return obj.parents("li:eq(0)").size()?obj.parents("li:eq(0)"):false},parent:function(obj){obj=this.get_node(obj);if(!obj.size())return false;return obj.parents("li:eq(0)").size()?obj.parents("li:eq(0)"):false},children:function(obj){obj=this.get_node(obj);if(!obj.size())return false;return obj.children("ul:eq(0)").children("li")},get_next:function(force){var obj=this.hovered||this.selected;return force?this.select_branch(this.next(obj)):this.hover_branch(this.next(obj))},get_prev:function(force){var obj=this.hovered||this.selected;return force?this.select_branch(this.prev(obj)):this.hover_branch(this.prev(obj))},get_left:function(force,rtl){if(this.settings.ui.rtl&&!rtl)return this.get_right(force,true);var obj=this.hovered||this.selected;if(obj){if(obj.hasClass("open"))this.close_branch(obj);else{return force?this.select_branch(this.parent(obj)):this.hover_branch(this.parent(obj))}}},get_right:function(force,rtl){if(this.settings.ui.rtl&&!rtl)return this.get_left(force,true);var obj=this.hovered||this.selected;if(obj){if(obj.hasClass("closed"))this.open_branch(obj);else{return force?this.select_branch(obj.find("li:eq(0)")):this.hover_branch(obj.find("li:eq(0)"))}}},toggleDots:function(){if(this.settings.ui.dots){this.settings.ui.dots=false;this.container.children("ul:eq(0)").addClass("no_dots")}else{this.settings.ui.dots=true;this.container.children("ul:eq(0)").removeClass("no_dots")}},toggleRTL:function(){if(this.settings.ui.rtl){this.settings.ui.rtl=false;this.container.css("direction","ltr").children("ul:eq(0)").removeClass("rtl").addClass("ltr")}else{this.settings.ui.rtl=true;this.container.css("direction","rtl").children("ul:eq(0)").removeClass("ltr").addClass("rtl")}},set_cookie:function(type){if(this.settings.cookies===false)return false;if(this.settings.cookies[type]===false)return false;switch(type){case"selected":if(this.settings.rules.multiple!=false&&this.selected_arr.length>1){var val=Array();$.each(this.selected_arr,function(){if(this.attr("id")){val.push(this.attr("id"))}});val=val.join(",")}else var val=this.selected?this.selected.attr("id"):false;$.cookie(this.settings.cookies.prefix+'_selected',val,this.settings.cookies.opts);break;case"open":var str="";this.container.find("li.open").each(function(i){if(this.id){str+=this.id+","}});$.cookie(this.settings.cookies.prefix+'_open',str.replace(/,$/ig,""),this.settings.cookies.opts);break}},get_rollback:function(){var rb={};if(this.context.to_remove&&this.context.apply_to)this.context.apply_to.children("a").removeClass("clicked");rb.html=this.container.html();if(this.context.to_remove&&this.context.apply_to)this.context.apply_to.children("a").addClass("clicked");rb.selected=this.selected?this.selected.attr("id"):false;return rb},moved:function(what,where,how,is_new,is_copy,rb){var what=$(what);var $parent=$(what).parents("ul:eq(0)");var $where=$(where);if(!rb){var rb={};rb[this.container.attr("id")]=this.get_rollback();if(!is_new){var tmp=what.size()>1?what.eq(0).parents(".tree:eq(0)"):what.parents(".tree:eq(0)");if(tmp.get(0)!=this.container.get(0)){tmp=tree_component.inst[tmp.attr("id")];rb[tmp.container.attr("id")]=tmp.get_rollback()}delete tmp}}if(how=="inside"&&this.settings.data.async&&this.get_node($where).hasClass("closed")){var _this=this;return this.open_branch(this.get_node($where),true,function(){_this.moved.apply(_this,[what,where,how,is_new,is_copy,rb])})}if(what.size()>1){var _this=this;var tmp=this.moved(what.eq(0),where,how,false,is_copy,rb);what.each(function(i){if(i==0)return;if(tmp){tmp=_this.moved(this,tmp.children("a:eq(0)"),"after",false,is_copy,rb)}});return}if(is_copy){_what=what.clone();_what.each(function(i){this.id=this.id+"_copy";$(this).find("li").each(function(){this.id=this.id+"_copy"});$(this).removeClass("dragged").find("a.clicked").removeClass("clicked ui-state-active").end().find("li.dragged").removeClass("dragged")})}else _what=what;if(is_new){if(!this.settings.callback.beforecreate.call(null,this.get_node(what).get(0),this.get_node(where).get(0),how,this))return false}else{if(!this.settings.callback.beforemove.call(null,this.get_node(what).get(0),this.get_node(where).get(0),how,this))return false}if(!is_new){var tmp=what.parents(".tree:eq(0)");if(tmp.get(0)!=this.container.get(0)){tmp=tree_component.inst[tmp.attr("id")];if(tmp.settings.languages.length){var res=[];if(this.settings.languages.length==0)res.push("."+tmp.current_lang);else{for(var i in this.settings.languages){if(typeof this.settings.languages[i]=="function")continue;for(var j in tmp.settings.languages){if(typeof tmp.settings.languages[j]=="function")continue;if(this.settings.languages[i]==tmp.settings.languages[j])res.push("."+this.settings.languages[i])}}}if(res.length==0)return this.error("MOVE: NO COMMON LANGUAGES");what.find("a").not(res.join(",")).remove()}what.find("a.clicked").removeClass("clicked ui-state-active")}}what=_what;switch(how){case"before":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().before(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"after":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().after(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"inside":if($where.parent().children("ul:first").size()){if(this.settings.rules.createat=="top")$where.parent().children("ul:first").prepend(what.removeClass("last")).children("li:last").addClass("last");else $where.parent().children("ul:first").children(".last").removeClass("last").end().append(what.removeClass("last")).children("li:last").addClass("last")}else{what.addClass("last");$where.parent().append("<ul/>").removeClass("leaf").addClass("closed");$where.parent().children("ul:first").prepend(what)}if($where.parent().hasClass("closed")){this.open_branch($where)}break;default:break}if($parent.find("li").size()==0){var $li=$parent.parent();$li.removeClass("open").removeClass("closed").addClass("leaf");if(!$li.is(".tree"))$li.children("ul").remove();$li.parents("ul:eq(0)").children("li.last").removeClass("last").end().children("li:last").addClass("last");this.set_cookie("open")}else{$parent.children("li.last").removeClass("last");$parent.children("li:last").addClass("last")}if(is_copy)this.settings.callback.oncopy.call(null,this.get_node(what).get(0),this.get_node(where).get(0),how,this,rb);else if(is_new)this.settings.callback.oncreate.call(null,this.get_node(what).get(0),($where.is("ul")?-1:this.get_node(where).get(0)),how,this,rb);else this.settings.callback.onmove.call(null,this.get_node(what).get(0),this.get_node(where).get(0),how,this,rb);return what},error:function(code){this.settings.callback.error.call(null,code,this);return false},lock:function(state){this.locked=state;if(this.locked)this.container.children("ul:eq(0)").addClass("locked");else this.container.children("ul:eq(0)").removeClass("locked")},cut:function(obj){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.container.find("a.clicked").filter(":first-child").parent();if(!obj||!obj.size())return this.error("CUT: NO NODE SELECTED");this.copy_nodes=false;this.cut_nodes=obj},copy:function(obj){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.container.find("a.clicked").filter(":first-child").parent();if(!obj||!obj.size())return this.error("COPY: NO NODE SELECTED");this.copy_nodes=obj;this.cut_nodes=false},paste:function(obj,position){if(this.locked)return this.error("LOCKED");var root=false;if(obj==-1){root=true;obj=this.container}else obj=obj?this.get_node(obj):this.selected;if(!root&&(!obj||!obj.size()))return this.error("PASTE: NO NODE SELECTED");if(!this.copy_nodes&&!this.cut_nodes)return this.error("PASTE: NOTHING TO DO");var _this=this;var pos=position;if(position=="before"){position=obj.parent().children().index(obj);obj=obj.parents("li:eq(0)")}else if(position=="after"){position=obj.parent().children().index(obj)+1;obj=obj.parents("li:eq(0)")}else if((typeof position).toLowerCase()=="undefined"||position=="inside"){position=(this.settings.rules.createat=="top")?0:obj.children("ul:eq(0)").children("li").size()}if(!root&&obj.size()==0){root=true;obj=this.container}if(this.copy_nodes&&this.copy_nodes.size()){var ok=true;if(!ok)return this.error("Invalid paste");if(!root&&!this.checkMove(this.copy_nodes,obj.children("a:eq(0)"),"inside"))return false;if(obj.children("ul").size()==0||(root==true&&obj.children("ul").children("li").size()==0)){if(!root)var a=this.moved(this.copy_nodes,obj.children("a:eq(0)"),"inside",false,true);else var a=this.moved(this.copy_nodes,this.container.children("ul:eq(0)"),"inside",false,true)}else if(pos=="before"&&obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(this.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",false,true);else if(pos=="after"&&obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())var a=this.moved(this.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after",false,true);else if(obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(this.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",false,true);else var a=this.moved(this.copy_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",false,true);this.copy_nodes=false}if(this.cut_nodes&&this.cut_nodes.size()){var ok=true;obj.parents().andSelf().each(function(){if(_this.cut_nodes.index(this)!=-1){ok=false;return false}});if(!ok)return this.error("Invalid paste");if(!root&&!this.checkMove(this.cut_nodes,obj.children("a:eq(0)"),"inside"))return false;if(obj.children("ul").size()==0||(root==true&&obj.children("ul").children("li").size()==0)){if(!root)var a=this.moved(this.cut_nodes,obj.children("a:eq(0)"),"inside");else var a=this.moved(this.cut_nodes,this.container.children("ul:eq(0)"),"inside")}else if(pos=="before"&&obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(this.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before");else if(pos=="after"&&obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())var a=this.moved(this.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after");else if(obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(this.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before");else var a=this.moved(this.cut_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after");this.cut_nodes=false}},search:function(str){var _this=this;if(!str||(this.srch&&str!=this.srch)){this.srch="";this.srch_opn=false;this.container.find("a.search").removeClass("search ui-state-highlight")}this.srch=str;if(!str)return;if(this.settings.data.async){if(!this.srch_opn){var dd=$.extend({"search":str},this.settings.data.async_data(false,this));$.ajax({type:this.settings.data.method,url:this.settings.data.url,data:dd,dataType:"text",success:function(data){_this.srch_opn=$.unique(data.split(","));_this.search.apply(_this,[str])}})}else if(this.srch_opn.length){if(this.srch_opn&&this.srch_opn.length){var opn=false;for(var j=0;j<this.srch_opn.length;j++){if(this.get_node("#"+this.srch_opn[j]).size()>0){opn=true;var tmp="#"+this.srch_opn[j];delete this.srch_opn[j];this.open_branch(tmp,true,function(){_this.search.apply(_this,[str])})}}if(!opn){this.srch_opn=[];_this.search.apply(_this,[str])}}}else{var selector="a";if(this.settings.languages.length)selector+="."+this.current_lang;this.container.find(selector+":contains('"+str+"')").addClass(this.settings.ui.theme_name=="themeroller"?"search ui-state-highlight":"search");this.srch_opn=false}}else{var selector="a";if(this.settings.languages.length)selector+="."+this.current_lang;this.container.find(selector+":contains('"+str+"')").addClass(this.settings.ui.theme_name=="themeroller"?"search ui-state-highlight":"search").parents("li.closed").each(function(){_this.open_branch(this,true)})}},destroy:function(){this.hide_context();this.container.unbind(".jstree");$("#"+this.container.attr("id")).die("click.jstree").die("dblclick.jstree").die("contextmenu.jstree").die("mouseover.jstree").die("mouseout.jstree").die("mousedown.jstree");this.container.removeClass("tree ui-widget ui-widget-content tree-default tree-"+this.settings.ui.theme_name).children("ul").removeClass("no_dots rtl ltr locked").find("li").removeClass("leaf").removeClass("open").removeClass("closed").removeClass("last").children("a").removeClass("clicked hover search ui-state-active ui-state-hover ui-state-highlight ui-state-default");if(this.cntr==tree_component.focused){for(var i in tree_component.inst){if(i!=this.cntr&&i!=this.container.attr("id")){tree_component.inst[i].focus();break}}}tree_component.inst[this.cntr]=false;tree_component.inst[this.container.attr("id")]=false;delete tree_component.inst[this.cntr];delete tree_component.inst[this.container.attr("id")];tree_component.cntr--}}}})(jQuery);
|
@@ -1,4225 +0,0 @@
|
|
1
|
-
/* Prototype JavaScript framework, version 1.6.0.1
|
2
|
-
* (c) 2005-2007 Sam Stephenson
|
3
|
-
*
|
4
|
-
* Prototype is freely distributable under the terms of an MIT-style license.
|
5
|
-
* For details, see the Prototype web site: http://www.prototypejs.org/
|
6
|
-
*
|
7
|
-
*--------------------------------------------------------------------------*/
|
8
|
-
|
9
|
-
var Prototype = {
|
10
|
-
Version: '1.6.0.1',
|
11
|
-
|
12
|
-
Browser: {
|
13
|
-
IE: !!(window.attachEvent && !window.opera),
|
14
|
-
Opera: !!window.opera,
|
15
|
-
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
|
16
|
-
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
|
17
|
-
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
|
18
|
-
},
|
19
|
-
|
20
|
-
BrowserFeatures: {
|
21
|
-
XPath: !!document.evaluate,
|
22
|
-
ElementExtensions: !!window.HTMLElement,
|
23
|
-
SpecificElementExtensions:
|
24
|
-
document.createElement('div').__proto__ &&
|
25
|
-
document.createElement('div').__proto__ !==
|
26
|
-
document.createElement('form').__proto__
|
27
|
-
},
|
28
|
-
|
29
|
-
ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
|
30
|
-
JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
|
31
|
-
|
32
|
-
emptyFunction: function() { },
|
33
|
-
K: function(x) { return x }
|
34
|
-
};
|
35
|
-
|
36
|
-
if (Prototype.Browser.MobileSafari)
|
37
|
-
Prototype.BrowserFeatures.SpecificElementExtensions = false;
|
38
|
-
|
39
|
-
|
40
|
-
/* Based on Alex Arnell's inheritance implementation. */
|
41
|
-
var Class = {
|
42
|
-
create: function() {
|
43
|
-
var parent = null, properties = $A(arguments);
|
44
|
-
if (Object.isFunction(properties[0]))
|
45
|
-
parent = properties.shift();
|
46
|
-
|
47
|
-
function klass() {
|
48
|
-
this.initialize.apply(this, arguments);
|
49
|
-
}
|
50
|
-
|
51
|
-
Object.extend(klass, Class.Methods);
|
52
|
-
klass.superclass = parent;
|
53
|
-
klass.subclasses = [];
|
54
|
-
|
55
|
-
if (parent) {
|
56
|
-
var subclass = function() { };
|
57
|
-
subclass.prototype = parent.prototype;
|
58
|
-
klass.prototype = new subclass;
|
59
|
-
parent.subclasses.push(klass);
|
60
|
-
}
|
61
|
-
|
62
|
-
for (var i = 0; i < properties.length; i++)
|
63
|
-
klass.addMethods(properties[i]);
|
64
|
-
|
65
|
-
if (!klass.prototype.initialize)
|
66
|
-
klass.prototype.initialize = Prototype.emptyFunction;
|
67
|
-
|
68
|
-
klass.prototype.constructor = klass;
|
69
|
-
|
70
|
-
return klass;
|
71
|
-
}
|
72
|
-
};
|
73
|
-
|
74
|
-
Class.Methods = {
|
75
|
-
addMethods: function(source) {
|
76
|
-
var ancestor = this.superclass && this.superclass.prototype;
|
77
|
-
var properties = Object.keys(source);
|
78
|
-
|
79
|
-
if (!Object.keys({ toString: true }).length)
|
80
|
-
properties.push("toString", "valueOf");
|
81
|
-
|
82
|
-
for (var i = 0, length = properties.length; i < length; i++) {
|
83
|
-
var property = properties[i], value = source[property];
|
84
|
-
if (ancestor && Object.isFunction(value) &&
|
85
|
-
value.argumentNames().first() == "$super") {
|
86
|
-
var method = value, value = Object.extend((function(m) {
|
87
|
-
return function() { return ancestor[m].apply(this, arguments) };
|
88
|
-
})(property).wrap(method), {
|
89
|
-
valueOf: function() { return method },
|
90
|
-
toString: function() { return method.toString() }
|
91
|
-
});
|
92
|
-
}
|
93
|
-
this.prototype[property] = value;
|
94
|
-
}
|
95
|
-
|
96
|
-
return this;
|
97
|
-
}
|
98
|
-
};
|
99
|
-
|
100
|
-
var Abstract = { };
|
101
|
-
|
102
|
-
Object.extend = function(destination, source) {
|
103
|
-
for (var property in source)
|
104
|
-
destination[property] = source[property];
|
105
|
-
return destination;
|
106
|
-
};
|
107
|
-
|
108
|
-
Object.extend(Object, {
|
109
|
-
inspect: function(object) {
|
110
|
-
try {
|
111
|
-
if (Object.isUndefined(object)) return 'undefined';
|
112
|
-
if (object === null) return 'null';
|
113
|
-
return object.inspect ? object.inspect() : object.toString();
|
114
|
-
} catch (e) {
|
115
|
-
if (e instanceof RangeError) return '...';
|
116
|
-
throw e;
|
117
|
-
}
|
118
|
-
},
|
119
|
-
|
120
|
-
toJSON: function(object) {
|
121
|
-
var type = typeof object;
|
122
|
-
switch (type) {
|
123
|
-
case 'undefined':
|
124
|
-
case 'function':
|
125
|
-
case 'unknown': return;
|
126
|
-
case 'boolean': return object.toString();
|
127
|
-
}
|
128
|
-
|
129
|
-
if (object === null) return 'null';
|
130
|
-
if (object.toJSON) return object.toJSON();
|
131
|
-
if (Object.isElement(object)) return;
|
132
|
-
|
133
|
-
var results = [];
|
134
|
-
for (var property in object) {
|
135
|
-
var value = Object.toJSON(object[property]);
|
136
|
-
if (!Object.isUndefined(value))
|
137
|
-
results.push(property.toJSON() + ': ' + value);
|
138
|
-
}
|
139
|
-
|
140
|
-
return '{' + results.join(', ') + '}';
|
141
|
-
},
|
142
|
-
|
143
|
-
toQueryString: function(object) {
|
144
|
-
return $H(object).toQueryString();
|
145
|
-
},
|
146
|
-
|
147
|
-
toHTML: function(object) {
|
148
|
-
return object && object.toHTML ? object.toHTML() : String.interpret(object);
|
149
|
-
},
|
150
|
-
|
151
|
-
keys: function(object) {
|
152
|
-
var keys = [];
|
153
|
-
for (var property in object)
|
154
|
-
keys.push(property);
|
155
|
-
return keys;
|
156
|
-
},
|
157
|
-
|
158
|
-
values: function(object) {
|
159
|
-
var values = [];
|
160
|
-
for (var property in object)
|
161
|
-
values.push(object[property]);
|
162
|
-
return values;
|
163
|
-
},
|
164
|
-
|
165
|
-
clone: function(object) {
|
166
|
-
return Object.extend({ }, object);
|
167
|
-
},
|
168
|
-
|
169
|
-
isElement: function(object) {
|
170
|
-
return object && object.nodeType == 1;
|
171
|
-
},
|
172
|
-
|
173
|
-
isArray: function(object) {
|
174
|
-
return object && object.constructor === Array;
|
175
|
-
},
|
176
|
-
|
177
|
-
isHash: function(object) {
|
178
|
-
return object instanceof Hash;
|
179
|
-
},
|
180
|
-
|
181
|
-
isFunction: function(object) {
|
182
|
-
return typeof object == "function";
|
183
|
-
},
|
184
|
-
|
185
|
-
isString: function(object) {
|
186
|
-
return typeof object == "string";
|
187
|
-
},
|
188
|
-
|
189
|
-
isNumber: function(object) {
|
190
|
-
return typeof object == "number";
|
191
|
-
},
|
192
|
-
|
193
|
-
isUndefined: function(object) {
|
194
|
-
return typeof object == "undefined";
|
195
|
-
}
|
196
|
-
});
|
197
|
-
|
198
|
-
Object.extend(Function.prototype, {
|
199
|
-
argumentNames: function() {
|
200
|
-
var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
|
201
|
-
return names.length == 1 && !names[0] ? [] : names;
|
202
|
-
},
|
203
|
-
|
204
|
-
bind: function() {
|
205
|
-
if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
|
206
|
-
var __method = this, args = $A(arguments), object = args.shift();
|
207
|
-
return function() {
|
208
|
-
return __method.apply(object, args.concat($A(arguments)));
|
209
|
-
}
|
210
|
-
},
|
211
|
-
|
212
|
-
bindAsEventListener: function() {
|
213
|
-
var __method = this, args = $A(arguments), object = args.shift();
|
214
|
-
return function(event) {
|
215
|
-
return __method.apply(object, [event || window.event].concat(args));
|
216
|
-
}
|
217
|
-
},
|
218
|
-
|
219
|
-
curry: function() {
|
220
|
-
if (!arguments.length) return this;
|
221
|
-
var __method = this, args = $A(arguments);
|
222
|
-
return function() {
|
223
|
-
return __method.apply(this, args.concat($A(arguments)));
|
224
|
-
}
|
225
|
-
},
|
226
|
-
|
227
|
-
delay: function() {
|
228
|
-
var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
|
229
|
-
return window.setTimeout(function() {
|
230
|
-
return __method.apply(__method, args);
|
231
|
-
}, timeout);
|
232
|
-
},
|
233
|
-
|
234
|
-
wrap: function(wrapper) {
|
235
|
-
var __method = this;
|
236
|
-
return function() {
|
237
|
-
return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
|
238
|
-
}
|
239
|
-
},
|
240
|
-
|
241
|
-
methodize: function() {
|
242
|
-
if (this._methodized) return this._methodized;
|
243
|
-
var __method = this;
|
244
|
-
return this._methodized = function() {
|
245
|
-
return __method.apply(null, [this].concat($A(arguments)));
|
246
|
-
};
|
247
|
-
}
|
248
|
-
});
|
249
|
-
|
250
|
-
Function.prototype.defer = Function.prototype.delay.curry(0.01);
|
251
|
-
|
252
|
-
Date.prototype.toJSON = function() {
|
253
|
-
return '"' + this.getUTCFullYear() + '-' +
|
254
|
-
(this.getUTCMonth() + 1).toPaddedString(2) + '-' +
|
255
|
-
this.getUTCDate().toPaddedString(2) + 'T' +
|
256
|
-
this.getUTCHours().toPaddedString(2) + ':' +
|
257
|
-
this.getUTCMinutes().toPaddedString(2) + ':' +
|
258
|
-
this.getUTCSeconds().toPaddedString(2) + 'Z"';
|
259
|
-
};
|
260
|
-
|
261
|
-
var Try = {
|
262
|
-
these: function() {
|
263
|
-
var returnValue;
|
264
|
-
|
265
|
-
for (var i = 0, length = arguments.length; i < length; i++) {
|
266
|
-
var lambda = arguments[i];
|
267
|
-
try {
|
268
|
-
returnValue = lambda();
|
269
|
-
break;
|
270
|
-
} catch (e) { }
|
271
|
-
}
|
272
|
-
|
273
|
-
return returnValue;
|
274
|
-
}
|
275
|
-
};
|
276
|
-
|
277
|
-
RegExp.prototype.match = RegExp.prototype.test;
|
278
|
-
|
279
|
-
RegExp.escape = function(str) {
|
280
|
-
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
281
|
-
};
|
282
|
-
|
283
|
-
/*--------------------------------------------------------------------------*/
|
284
|
-
|
285
|
-
var PeriodicalExecuter = Class.create({
|
286
|
-
initialize: function(callback, frequency) {
|
287
|
-
this.callback = callback;
|
288
|
-
this.frequency = frequency;
|
289
|
-
this.currentlyExecuting = false;
|
290
|
-
|
291
|
-
this.registerCallback();
|
292
|
-
},
|
293
|
-
|
294
|
-
registerCallback: function() {
|
295
|
-
this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
|
296
|
-
},
|
297
|
-
|
298
|
-
execute: function() {
|
299
|
-
this.callback(this);
|
300
|
-
},
|
301
|
-
|
302
|
-
stop: function() {
|
303
|
-
if (!this.timer) return;
|
304
|
-
clearInterval(this.timer);
|
305
|
-
this.timer = null;
|
306
|
-
},
|
307
|
-
|
308
|
-
onTimerEvent: function() {
|
309
|
-
if (!this.currentlyExecuting) {
|
310
|
-
try {
|
311
|
-
this.currentlyExecuting = true;
|
312
|
-
this.execute();
|
313
|
-
} finally {
|
314
|
-
this.currentlyExecuting = false;
|
315
|
-
}
|
316
|
-
}
|
317
|
-
}
|
318
|
-
});
|
319
|
-
Object.extend(String, {
|
320
|
-
interpret: function(value) {
|
321
|
-
return value == null ? '' : String(value);
|
322
|
-
},
|
323
|
-
specialChar: {
|
324
|
-
'\b': '\\b',
|
325
|
-
'\t': '\\t',
|
326
|
-
'\n': '\\n',
|
327
|
-
'\f': '\\f',
|
328
|
-
'\r': '\\r',
|
329
|
-
'\\': '\\\\'
|
330
|
-
}
|
331
|
-
});
|
332
|
-
|
333
|
-
Object.extend(String.prototype, {
|
334
|
-
gsub: function(pattern, replacement) {
|
335
|
-
var result = '', source = this, match;
|
336
|
-
replacement = arguments.callee.prepareReplacement(replacement);
|
337
|
-
|
338
|
-
while (source.length > 0) {
|
339
|
-
if (match = source.match(pattern)) {
|
340
|
-
result += source.slice(0, match.index);
|
341
|
-
result += String.interpret(replacement(match));
|
342
|
-
source = source.slice(match.index + match[0].length);
|
343
|
-
} else {
|
344
|
-
result += source, source = '';
|
345
|
-
}
|
346
|
-
}
|
347
|
-
return result;
|
348
|
-
},
|
349
|
-
|
350
|
-
sub: function(pattern, replacement, count) {
|
351
|
-
replacement = this.gsub.prepareReplacement(replacement);
|
352
|
-
count = Object.isUndefined(count) ? 1 : count;
|
353
|
-
|
354
|
-
return this.gsub(pattern, function(match) {
|
355
|
-
if (--count < 0) return match[0];
|
356
|
-
return replacement(match);
|
357
|
-
});
|
358
|
-
},
|
359
|
-
|
360
|
-
scan: function(pattern, iterator) {
|
361
|
-
this.gsub(pattern, iterator);
|
362
|
-
return String(this);
|
363
|
-
},
|
364
|
-
|
365
|
-
truncate: function(length, truncation) {
|
366
|
-
length = length || 30;
|
367
|
-
truncation = Object.isUndefined(truncation) ? '...' : truncation;
|
368
|
-
return this.length > length ?
|
369
|
-
this.slice(0, length - truncation.length) + truncation : String(this);
|
370
|
-
},
|
371
|
-
|
372
|
-
strip: function() {
|
373
|
-
return this.replace(/^\s+/, '').replace(/\s+$/, '');
|
374
|
-
},
|
375
|
-
|
376
|
-
stripTags: function() {
|
377
|
-
return this.replace(/<\/?[^>]+>/gi, '');
|
378
|
-
},
|
379
|
-
|
380
|
-
stripScripts: function() {
|
381
|
-
return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
|
382
|
-
},
|
383
|
-
|
384
|
-
extractScripts: function() {
|
385
|
-
var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
|
386
|
-
var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
|
387
|
-
return (this.match(matchAll) || []).map(function(scriptTag) {
|
388
|
-
return (scriptTag.match(matchOne) || ['', ''])[1];
|
389
|
-
});
|
390
|
-
},
|
391
|
-
|
392
|
-
evalScripts: function() {
|
393
|
-
return this.extractScripts().map(function(script) { return eval(script) });
|
394
|
-
},
|
395
|
-
|
396
|
-
escapeHTML: function() {
|
397
|
-
var self = arguments.callee;
|
398
|
-
self.text.data = this;
|
399
|
-
return self.div.innerHTML;
|
400
|
-
},
|
401
|
-
|
402
|
-
unescapeHTML: function() {
|
403
|
-
var div = new Element('div');
|
404
|
-
div.innerHTML = this.stripTags();
|
405
|
-
return div.childNodes[0] ? (div.childNodes.length > 1 ?
|
406
|
-
$A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
|
407
|
-
div.childNodes[0].nodeValue) : '';
|
408
|
-
},
|
409
|
-
|
410
|
-
toQueryParams: function(separator) {
|
411
|
-
var match = this.strip().match(/([^?#]*)(#.*)?$/);
|
412
|
-
if (!match) return { };
|
413
|
-
|
414
|
-
return match[1].split(separator || '&').inject({ }, function(hash, pair) {
|
415
|
-
if ((pair = pair.split('='))[0]) {
|
416
|
-
var key = decodeURIComponent(pair.shift());
|
417
|
-
var value = pair.length > 1 ? pair.join('=') : pair[0];
|
418
|
-
if (value != undefined) value = decodeURIComponent(value);
|
419
|
-
|
420
|
-
if (key in hash) {
|
421
|
-
if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
|
422
|
-
hash[key].push(value);
|
423
|
-
}
|
424
|
-
else hash[key] = value;
|
425
|
-
}
|
426
|
-
return hash;
|
427
|
-
});
|
428
|
-
},
|
429
|
-
|
430
|
-
toArray: function() {
|
431
|
-
return this.split('');
|
432
|
-
},
|
433
|
-
|
434
|
-
succ: function() {
|
435
|
-
return this.slice(0, this.length - 1) +
|
436
|
-
String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
|
437
|
-
},
|
438
|
-
|
439
|
-
times: function(count) {
|
440
|
-
return count < 1 ? '' : new Array(count + 1).join(this);
|
441
|
-
},
|
442
|
-
|
443
|
-
camelize: function() {
|
444
|
-
var parts = this.split('-'), len = parts.length;
|
445
|
-
if (len == 1) return parts[0];
|
446
|
-
|
447
|
-
var camelized = this.charAt(0) == '-'
|
448
|
-
? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
|
449
|
-
: parts[0];
|
450
|
-
|
451
|
-
for (var i = 1; i < len; i++)
|
452
|
-
camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
|
453
|
-
|
454
|
-
return camelized;
|
455
|
-
},
|
456
|
-
|
457
|
-
capitalize: function() {
|
458
|
-
return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
|
459
|
-
},
|
460
|
-
|
461
|
-
underscore: function() {
|
462
|
-
return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
|
463
|
-
},
|
464
|
-
|
465
|
-
dasherize: function() {
|
466
|
-
return this.gsub(/_/,'-');
|
467
|
-
},
|
468
|
-
|
469
|
-
inspect: function(useDoubleQuotes) {
|
470
|
-
var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
|
471
|
-
var character = String.specialChar[match[0]];
|
472
|
-
return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
|
473
|
-
});
|
474
|
-
if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
|
475
|
-
return "'" + escapedString.replace(/'/g, '\\\'') + "'";
|
476
|
-
},
|
477
|
-
|
478
|
-
toJSON: function() {
|
479
|
-
return this.inspect(true);
|
480
|
-
},
|
481
|
-
|
482
|
-
unfilterJSON: function(filter) {
|
483
|
-
return this.sub(filter || Prototype.JSONFilter, '#{1}');
|
484
|
-
},
|
485
|
-
|
486
|
-
isJSON: function() {
|
487
|
-
var str = this;
|
488
|
-
if (str.blank()) return false;
|
489
|
-
str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
|
490
|
-
return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
|
491
|
-
},
|
492
|
-
|
493
|
-
evalJSON: function(sanitize) {
|
494
|
-
var json = this.unfilterJSON();
|
495
|
-
try {
|
496
|
-
if (!sanitize || json.isJSON()) return eval('(' + json + ')');
|
497
|
-
} catch (e) { }
|
498
|
-
throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
|
499
|
-
},
|
500
|
-
|
501
|
-
include: function(pattern) {
|
502
|
-
return this.indexOf(pattern) > -1;
|
503
|
-
},
|
504
|
-
|
505
|
-
startsWith: function(pattern) {
|
506
|
-
return this.indexOf(pattern) === 0;
|
507
|
-
},
|
508
|
-
|
509
|
-
endsWith: function(pattern) {
|
510
|
-
var d = this.length - pattern.length;
|
511
|
-
return d >= 0 && this.lastIndexOf(pattern) === d;
|
512
|
-
},
|
513
|
-
|
514
|
-
empty: function() {
|
515
|
-
return this == '';
|
516
|
-
},
|
517
|
-
|
518
|
-
blank: function() {
|
519
|
-
return /^\s*$/.test(this);
|
520
|
-
},
|
521
|
-
|
522
|
-
interpolate: function(object, pattern) {
|
523
|
-
return new Template(this, pattern).evaluate(object);
|
524
|
-
}
|
525
|
-
});
|
526
|
-
|
527
|
-
if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
|
528
|
-
escapeHTML: function() {
|
529
|
-
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
530
|
-
},
|
531
|
-
unescapeHTML: function() {
|
532
|
-
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
533
|
-
}
|
534
|
-
});
|
535
|
-
|
536
|
-
String.prototype.gsub.prepareReplacement = function(replacement) {
|
537
|
-
if (Object.isFunction(replacement)) return replacement;
|
538
|
-
var template = new Template(replacement);
|
539
|
-
return function(match) { return template.evaluate(match) };
|
540
|
-
};
|
541
|
-
|
542
|
-
String.prototype.parseQuery = String.prototype.toQueryParams;
|
543
|
-
|
544
|
-
Object.extend(String.prototype.escapeHTML, {
|
545
|
-
div: document.createElement('div'),
|
546
|
-
text: document.createTextNode('')
|
547
|
-
});
|
548
|
-
|
549
|
-
with (String.prototype.escapeHTML) div.appendChild(text);
|
550
|
-
|
551
|
-
var Template = Class.create({
|
552
|
-
initialize: function(template, pattern) {
|
553
|
-
this.template = template.toString();
|
554
|
-
this.pattern = pattern || Template.Pattern;
|
555
|
-
},
|
556
|
-
|
557
|
-
evaluate: function(object) {
|
558
|
-
if (Object.isFunction(object.toTemplateReplacements))
|
559
|
-
object = object.toTemplateReplacements();
|
560
|
-
|
561
|
-
return this.template.gsub(this.pattern, function(match) {
|
562
|
-
if (object == null) return '';
|
563
|
-
|
564
|
-
var before = match[1] || '';
|
565
|
-
if (before == '\\') return match[2];
|
566
|
-
|
567
|
-
var ctx = object, expr = match[3];
|
568
|
-
var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
|
569
|
-
match = pattern.exec(expr);
|
570
|
-
if (match == null) return before;
|
571
|
-
|
572
|
-
while (match != null) {
|
573
|
-
var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
|
574
|
-
ctx = ctx[comp];
|
575
|
-
if (null == ctx || '' == match[3]) break;
|
576
|
-
expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
|
577
|
-
match = pattern.exec(expr);
|
578
|
-
}
|
579
|
-
|
580
|
-
return before + String.interpret(ctx);
|
581
|
-
}.bind(this));
|
582
|
-
}
|
583
|
-
});
|
584
|
-
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
|
585
|
-
|
586
|
-
var $break = { };
|
587
|
-
|
588
|
-
var Enumerable = {
|
589
|
-
each: function(iterator, context) {
|
590
|
-
var index = 0;
|
591
|
-
iterator = iterator.bind(context);
|
592
|
-
try {
|
593
|
-
this._each(function(value) {
|
594
|
-
iterator(value, index++);
|
595
|
-
});
|
596
|
-
} catch (e) {
|
597
|
-
if (e != $break) throw e;
|
598
|
-
}
|
599
|
-
return this;
|
600
|
-
},
|
601
|
-
|
602
|
-
eachSlice: function(number, iterator, context) {
|
603
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
604
|
-
var index = -number, slices = [], array = this.toArray();
|
605
|
-
while ((index += number) < array.length)
|
606
|
-
slices.push(array.slice(index, index+number));
|
607
|
-
return slices.collect(iterator, context);
|
608
|
-
},
|
609
|
-
|
610
|
-
all: function(iterator, context) {
|
611
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
612
|
-
var result = true;
|
613
|
-
this.each(function(value, index) {
|
614
|
-
result = result && !!iterator(value, index);
|
615
|
-
if (!result) throw $break;
|
616
|
-
});
|
617
|
-
return result;
|
618
|
-
},
|
619
|
-
|
620
|
-
any: function(iterator, context) {
|
621
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
622
|
-
var result = false;
|
623
|
-
this.each(function(value, index) {
|
624
|
-
if (result = !!iterator(value, index))
|
625
|
-
throw $break;
|
626
|
-
});
|
627
|
-
return result;
|
628
|
-
},
|
629
|
-
|
630
|
-
collect: function(iterator, context) {
|
631
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
632
|
-
var results = [];
|
633
|
-
this.each(function(value, index) {
|
634
|
-
results.push(iterator(value, index));
|
635
|
-
});
|
636
|
-
return results;
|
637
|
-
},
|
638
|
-
|
639
|
-
detect: function(iterator, context) {
|
640
|
-
iterator = iterator.bind(context);
|
641
|
-
var result;
|
642
|
-
this.each(function(value, index) {
|
643
|
-
if (iterator(value, index)) {
|
644
|
-
result = value;
|
645
|
-
throw $break;
|
646
|
-
}
|
647
|
-
});
|
648
|
-
return result;
|
649
|
-
},
|
650
|
-
|
651
|
-
findAll: function(iterator, context) {
|
652
|
-
iterator = iterator.bind(context);
|
653
|
-
var results = [];
|
654
|
-
this.each(function(value, index) {
|
655
|
-
if (iterator(value, index))
|
656
|
-
results.push(value);
|
657
|
-
});
|
658
|
-
return results;
|
659
|
-
},
|
660
|
-
|
661
|
-
grep: function(filter, iterator, context) {
|
662
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
663
|
-
var results = [];
|
664
|
-
|
665
|
-
if (Object.isString(filter))
|
666
|
-
filter = new RegExp(filter);
|
667
|
-
|
668
|
-
this.each(function(value, index) {
|
669
|
-
if (filter.match(value))
|
670
|
-
results.push(iterator(value, index));
|
671
|
-
});
|
672
|
-
return results;
|
673
|
-
},
|
674
|
-
|
675
|
-
include: function(object) {
|
676
|
-
if (Object.isFunction(this.indexOf))
|
677
|
-
if (this.indexOf(object) != -1) return true;
|
678
|
-
|
679
|
-
var found = false;
|
680
|
-
this.each(function(value) {
|
681
|
-
if (value == object) {
|
682
|
-
found = true;
|
683
|
-
throw $break;
|
684
|
-
}
|
685
|
-
});
|
686
|
-
return found;
|
687
|
-
},
|
688
|
-
|
689
|
-
inGroupsOf: function(number, fillWith) {
|
690
|
-
fillWith = Object.isUndefined(fillWith) ? null : fillWith;
|
691
|
-
return this.eachSlice(number, function(slice) {
|
692
|
-
while(slice.length < number) slice.push(fillWith);
|
693
|
-
return slice;
|
694
|
-
});
|
695
|
-
},
|
696
|
-
|
697
|
-
inject: function(memo, iterator, context) {
|
698
|
-
iterator = iterator.bind(context);
|
699
|
-
this.each(function(value, index) {
|
700
|
-
memo = iterator(memo, value, index);
|
701
|
-
});
|
702
|
-
return memo;
|
703
|
-
},
|
704
|
-
|
705
|
-
invoke: function(method) {
|
706
|
-
var args = $A(arguments).slice(1);
|
707
|
-
return this.map(function(value) {
|
708
|
-
return value[method].apply(value, args);
|
709
|
-
});
|
710
|
-
},
|
711
|
-
|
712
|
-
max: function(iterator, context) {
|
713
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
714
|
-
var result;
|
715
|
-
this.each(function(value, index) {
|
716
|
-
value = iterator(value, index);
|
717
|
-
if (result == null || value >= result)
|
718
|
-
result = value;
|
719
|
-
});
|
720
|
-
return result;
|
721
|
-
},
|
722
|
-
|
723
|
-
min: function(iterator, context) {
|
724
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
725
|
-
var result;
|
726
|
-
this.each(function(value, index) {
|
727
|
-
value = iterator(value, index);
|
728
|
-
if (result == null || value < result)
|
729
|
-
result = value;
|
730
|
-
});
|
731
|
-
return result;
|
732
|
-
},
|
733
|
-
|
734
|
-
partition: function(iterator, context) {
|
735
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
736
|
-
var trues = [], falses = [];
|
737
|
-
this.each(function(value, index) {
|
738
|
-
(iterator(value, index) ?
|
739
|
-
trues : falses).push(value);
|
740
|
-
});
|
741
|
-
return [trues, falses];
|
742
|
-
},
|
743
|
-
|
744
|
-
pluck: function(property) {
|
745
|
-
var results = [];
|
746
|
-
this.each(function(value) {
|
747
|
-
results.push(value[property]);
|
748
|
-
});
|
749
|
-
return results;
|
750
|
-
},
|
751
|
-
|
752
|
-
reject: function(iterator, context) {
|
753
|
-
iterator = iterator.bind(context);
|
754
|
-
var results = [];
|
755
|
-
this.each(function(value, index) {
|
756
|
-
if (!iterator(value, index))
|
757
|
-
results.push(value);
|
758
|
-
});
|
759
|
-
return results;
|
760
|
-
},
|
761
|
-
|
762
|
-
sortBy: function(iterator, context) {
|
763
|
-
iterator = iterator.bind(context);
|
764
|
-
return this.map(function(value, index) {
|
765
|
-
return {value: value, criteria: iterator(value, index)};
|
766
|
-
}).sort(function(left, right) {
|
767
|
-
var a = left.criteria, b = right.criteria;
|
768
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
769
|
-
}).pluck('value');
|
770
|
-
},
|
771
|
-
|
772
|
-
toArray: function() {
|
773
|
-
return this.map();
|
774
|
-
},
|
775
|
-
|
776
|
-
zip: function() {
|
777
|
-
var iterator = Prototype.K, args = $A(arguments);
|
778
|
-
if (Object.isFunction(args.last()))
|
779
|
-
iterator = args.pop();
|
780
|
-
|
781
|
-
var collections = [this].concat(args).map($A);
|
782
|
-
return this.map(function(value, index) {
|
783
|
-
return iterator(collections.pluck(index));
|
784
|
-
});
|
785
|
-
},
|
786
|
-
|
787
|
-
size: function() {
|
788
|
-
return this.toArray().length;
|
789
|
-
},
|
790
|
-
|
791
|
-
inspect: function() {
|
792
|
-
return '#<Enumerable:' + this.toArray().inspect() + '>';
|
793
|
-
}
|
794
|
-
};
|
795
|
-
|
796
|
-
Object.extend(Enumerable, {
|
797
|
-
map: Enumerable.collect,
|
798
|
-
find: Enumerable.detect,
|
799
|
-
select: Enumerable.findAll,
|
800
|
-
filter: Enumerable.findAll,
|
801
|
-
member: Enumerable.include,
|
802
|
-
entries: Enumerable.toArray,
|
803
|
-
every: Enumerable.all,
|
804
|
-
some: Enumerable.any
|
805
|
-
});
|
806
|
-
function $A(iterable) {
|
807
|
-
if (!iterable) return [];
|
808
|
-
if (iterable.toArray) return iterable.toArray();
|
809
|
-
var length = iterable.length, results = new Array(length);
|
810
|
-
while (length--) results[length] = iterable[length];
|
811
|
-
return results;
|
812
|
-
}
|
813
|
-
|
814
|
-
if (Prototype.Browser.WebKit) {
|
815
|
-
function $A(iterable) {
|
816
|
-
if (!iterable) return [];
|
817
|
-
if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
|
818
|
-
iterable.toArray) return iterable.toArray();
|
819
|
-
var length = iterable.length, results = new Array(length);
|
820
|
-
while (length--) results[length] = iterable[length];
|
821
|
-
return results;
|
822
|
-
}
|
823
|
-
}
|
824
|
-
|
825
|
-
Array.from = $A;
|
826
|
-
|
827
|
-
Object.extend(Array.prototype, Enumerable);
|
828
|
-
|
829
|
-
if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
|
830
|
-
|
831
|
-
Object.extend(Array.prototype, {
|
832
|
-
_each: function(iterator) {
|
833
|
-
for (var i = 0, length = this.length; i < length; i++)
|
834
|
-
iterator(this[i]);
|
835
|
-
},
|
836
|
-
|
837
|
-
clear: function() {
|
838
|
-
this.length = 0;
|
839
|
-
return this;
|
840
|
-
},
|
841
|
-
|
842
|
-
first: function() {
|
843
|
-
return this[0];
|
844
|
-
},
|
845
|
-
|
846
|
-
last: function() {
|
847
|
-
return this[this.length - 1];
|
848
|
-
},
|
849
|
-
|
850
|
-
compact: function() {
|
851
|
-
return this.select(function(value) {
|
852
|
-
return value != null;
|
853
|
-
});
|
854
|
-
},
|
855
|
-
|
856
|
-
flatten: function() {
|
857
|
-
return this.inject([], function(array, value) {
|
858
|
-
return array.concat(Object.isArray(value) ?
|
859
|
-
value.flatten() : [value]);
|
860
|
-
});
|
861
|
-
},
|
862
|
-
|
863
|
-
without: function() {
|
864
|
-
var values = $A(arguments);
|
865
|
-
return this.select(function(value) {
|
866
|
-
return !values.include(value);
|
867
|
-
});
|
868
|
-
},
|
869
|
-
|
870
|
-
reverse: function(inline) {
|
871
|
-
return (inline !== false ? this : this.toArray())._reverse();
|
872
|
-
},
|
873
|
-
|
874
|
-
reduce: function() {
|
875
|
-
return this.length > 1 ? this : this[0];
|
876
|
-
},
|
877
|
-
|
878
|
-
uniq: function(sorted) {
|
879
|
-
return this.inject([], function(array, value, index) {
|
880
|
-
if (0 == index || (sorted ? array.last() != value : !array.include(value)))
|
881
|
-
array.push(value);
|
882
|
-
return array;
|
883
|
-
});
|
884
|
-
},
|
885
|
-
|
886
|
-
intersect: function(array) {
|
887
|
-
return this.uniq().findAll(function(item) {
|
888
|
-
return array.detect(function(value) { return item === value });
|
889
|
-
});
|
890
|
-
},
|
891
|
-
|
892
|
-
clone: function() {
|
893
|
-
return [].concat(this);
|
894
|
-
},
|
895
|
-
|
896
|
-
size: function() {
|
897
|
-
return this.length;
|
898
|
-
},
|
899
|
-
|
900
|
-
inspect: function() {
|
901
|
-
return '[' + this.map(Object.inspect).join(', ') + ']';
|
902
|
-
},
|
903
|
-
|
904
|
-
toJSON: function() {
|
905
|
-
var results = [];
|
906
|
-
this.each(function(object) {
|
907
|
-
var value = Object.toJSON(object);
|
908
|
-
if (!Object.isUndefined(value)) results.push(value);
|
909
|
-
});
|
910
|
-
return '[' + results.join(', ') + ']';
|
911
|
-
}
|
912
|
-
});
|
913
|
-
|
914
|
-
// use native browser JS 1.6 implementation if available
|
915
|
-
if (Object.isFunction(Array.prototype.forEach))
|
916
|
-
Array.prototype._each = Array.prototype.forEach;
|
917
|
-
|
918
|
-
if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
|
919
|
-
i || (i = 0);
|
920
|
-
var length = this.length;
|
921
|
-
if (i < 0) i = length + i;
|
922
|
-
for (; i < length; i++)
|
923
|
-
if (this[i] === item) return i;
|
924
|
-
return -1;
|
925
|
-
};
|
926
|
-
|
927
|
-
if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
|
928
|
-
i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
|
929
|
-
var n = this.slice(0, i).reverse().indexOf(item);
|
930
|
-
return (n < 0) ? n : i - n - 1;
|
931
|
-
};
|
932
|
-
|
933
|
-
Array.prototype.toArray = Array.prototype.clone;
|
934
|
-
|
935
|
-
function $w(string) {
|
936
|
-
if (!Object.isString(string)) return [];
|
937
|
-
string = string.strip();
|
938
|
-
return string ? string.split(/\s+/) : [];
|
939
|
-
}
|
940
|
-
|
941
|
-
if (Prototype.Browser.Opera){
|
942
|
-
Array.prototype.concat = function() {
|
943
|
-
var array = [];
|
944
|
-
for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
|
945
|
-
for (var i = 0, length = arguments.length; i < length; i++) {
|
946
|
-
if (Object.isArray(arguments[i])) {
|
947
|
-
for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
|
948
|
-
array.push(arguments[i][j]);
|
949
|
-
} else {
|
950
|
-
array.push(arguments[i]);
|
951
|
-
}
|
952
|
-
}
|
953
|
-
return array;
|
954
|
-
};
|
955
|
-
}
|
956
|
-
Object.extend(Number.prototype, {
|
957
|
-
toColorPart: function() {
|
958
|
-
return this.toPaddedString(2, 16);
|
959
|
-
},
|
960
|
-
|
961
|
-
succ: function() {
|
962
|
-
return this + 1;
|
963
|
-
},
|
964
|
-
|
965
|
-
times: function(iterator) {
|
966
|
-
$R(0, this, true).each(iterator);
|
967
|
-
return this;
|
968
|
-
},
|
969
|
-
|
970
|
-
toPaddedString: function(length, radix) {
|
971
|
-
var string = this.toString(radix || 10);
|
972
|
-
return '0'.times(length - string.length) + string;
|
973
|
-
},
|
974
|
-
|
975
|
-
toJSON: function() {
|
976
|
-
return isFinite(this) ? this.toString() : 'null';
|
977
|
-
}
|
978
|
-
});
|
979
|
-
|
980
|
-
$w('abs round ceil floor').each(function(method){
|
981
|
-
Number.prototype[method] = Math[method].methodize();
|
982
|
-
});
|
983
|
-
function $H(object) {
|
984
|
-
return new Hash(object);
|
985
|
-
};
|
986
|
-
|
987
|
-
var Hash = Class.create(Enumerable, (function() {
|
988
|
-
|
989
|
-
function toQueryPair(key, value) {
|
990
|
-
if (Object.isUndefined(value)) return key;
|
991
|
-
return key + '=' + encodeURIComponent(String.interpret(value));
|
992
|
-
}
|
993
|
-
|
994
|
-
return {
|
995
|
-
initialize: function(object) {
|
996
|
-
this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
|
997
|
-
},
|
998
|
-
|
999
|
-
_each: function(iterator) {
|
1000
|
-
for (var key in this._object) {
|
1001
|
-
var value = this._object[key], pair = [key, value];
|
1002
|
-
pair.key = key;
|
1003
|
-
pair.value = value;
|
1004
|
-
iterator(pair);
|
1005
|
-
}
|
1006
|
-
},
|
1007
|
-
|
1008
|
-
set: function(key, value) {
|
1009
|
-
return this._object[key] = value;
|
1010
|
-
},
|
1011
|
-
|
1012
|
-
get: function(key) {
|
1013
|
-
return this._object[key];
|
1014
|
-
},
|
1015
|
-
|
1016
|
-
unset: function(key) {
|
1017
|
-
var value = this._object[key];
|
1018
|
-
delete this._object[key];
|
1019
|
-
return value;
|
1020
|
-
},
|
1021
|
-
|
1022
|
-
toObject: function() {
|
1023
|
-
return Object.clone(this._object);
|
1024
|
-
},
|
1025
|
-
|
1026
|
-
keys: function() {
|
1027
|
-
return this.pluck('key');
|
1028
|
-
},
|
1029
|
-
|
1030
|
-
values: function() {
|
1031
|
-
return this.pluck('value');
|
1032
|
-
},
|
1033
|
-
|
1034
|
-
index: function(value) {
|
1035
|
-
var match = this.detect(function(pair) {
|
1036
|
-
return pair.value === value;
|
1037
|
-
});
|
1038
|
-
return match && match.key;
|
1039
|
-
},
|
1040
|
-
|
1041
|
-
merge: function(object) {
|
1042
|
-
return this.clone().update(object);
|
1043
|
-
},
|
1044
|
-
|
1045
|
-
update: function(object) {
|
1046
|
-
return new Hash(object).inject(this, function(result, pair) {
|
1047
|
-
result.set(pair.key, pair.value);
|
1048
|
-
return result;
|
1049
|
-
});
|
1050
|
-
},
|
1051
|
-
|
1052
|
-
toQueryString: function() {
|
1053
|
-
return this.map(function(pair) {
|
1054
|
-
var key = encodeURIComponent(pair.key), values = pair.value;
|
1055
|
-
|
1056
|
-
if (values && typeof values == 'object') {
|
1057
|
-
if (Object.isArray(values))
|
1058
|
-
return values.map(toQueryPair.curry(key)).join('&');
|
1059
|
-
}
|
1060
|
-
return toQueryPair(key, values);
|
1061
|
-
}).join('&');
|
1062
|
-
},
|
1063
|
-
|
1064
|
-
inspect: function() {
|
1065
|
-
return '#<Hash:{' + this.map(function(pair) {
|
1066
|
-
return pair.map(Object.inspect).join(': ');
|
1067
|
-
}).join(', ') + '}>';
|
1068
|
-
},
|
1069
|
-
|
1070
|
-
toJSON: function() {
|
1071
|
-
return Object.toJSON(this.toObject());
|
1072
|
-
},
|
1073
|
-
|
1074
|
-
clone: function() {
|
1075
|
-
return new Hash(this);
|
1076
|
-
}
|
1077
|
-
}
|
1078
|
-
})());
|
1079
|
-
|
1080
|
-
Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
|
1081
|
-
Hash.from = $H;
|
1082
|
-
var ObjectRange = Class.create(Enumerable, {
|
1083
|
-
initialize: function(start, end, exclusive) {
|
1084
|
-
this.start = start;
|
1085
|
-
this.end = end;
|
1086
|
-
this.exclusive = exclusive;
|
1087
|
-
},
|
1088
|
-
|
1089
|
-
_each: function(iterator) {
|
1090
|
-
var value = this.start;
|
1091
|
-
while (this.include(value)) {
|
1092
|
-
iterator(value);
|
1093
|
-
value = value.succ();
|
1094
|
-
}
|
1095
|
-
},
|
1096
|
-
|
1097
|
-
include: function(value) {
|
1098
|
-
if (value < this.start)
|
1099
|
-
return false;
|
1100
|
-
if (this.exclusive)
|
1101
|
-
return value < this.end;
|
1102
|
-
return value <= this.end;
|
1103
|
-
}
|
1104
|
-
});
|
1105
|
-
|
1106
|
-
var $R = function(start, end, exclusive) {
|
1107
|
-
return new ObjectRange(start, end, exclusive);
|
1108
|
-
};
|
1109
|
-
|
1110
|
-
var Ajax = {
|
1111
|
-
getTransport: function() {
|
1112
|
-
return Try.these(
|
1113
|
-
function() {return new XMLHttpRequest()},
|
1114
|
-
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
|
1115
|
-
function() {return new ActiveXObject('Microsoft.XMLHTTP')}
|
1116
|
-
) || false;
|
1117
|
-
},
|
1118
|
-
|
1119
|
-
activeRequestCount: 0
|
1120
|
-
};
|
1121
|
-
|
1122
|
-
Ajax.Responders = {
|
1123
|
-
responders: [],
|
1124
|
-
|
1125
|
-
_each: function(iterator) {
|
1126
|
-
this.responders._each(iterator);
|
1127
|
-
},
|
1128
|
-
|
1129
|
-
register: function(responder) {
|
1130
|
-
if (!this.include(responder))
|
1131
|
-
this.responders.push(responder);
|
1132
|
-
},
|
1133
|
-
|
1134
|
-
unregister: function(responder) {
|
1135
|
-
this.responders = this.responders.without(responder);
|
1136
|
-
},
|
1137
|
-
|
1138
|
-
dispatch: function(callback, request, transport, json) {
|
1139
|
-
this.each(function(responder) {
|
1140
|
-
if (Object.isFunction(responder[callback])) {
|
1141
|
-
try {
|
1142
|
-
responder[callback].apply(responder, [request, transport, json]);
|
1143
|
-
} catch (e) { }
|
1144
|
-
}
|
1145
|
-
});
|
1146
|
-
}
|
1147
|
-
};
|
1148
|
-
|
1149
|
-
Object.extend(Ajax.Responders, Enumerable);
|
1150
|
-
|
1151
|
-
Ajax.Responders.register({
|
1152
|
-
onCreate: function() { Ajax.activeRequestCount++ },
|
1153
|
-
onComplete: function() { Ajax.activeRequestCount-- }
|
1154
|
-
});
|
1155
|
-
|
1156
|
-
Ajax.Base = Class.create({
|
1157
|
-
initialize: function(options) {
|
1158
|
-
this.options = {
|
1159
|
-
method: 'post',
|
1160
|
-
asynchronous: true,
|
1161
|
-
contentType: 'application/x-www-form-urlencoded',
|
1162
|
-
encoding: 'UTF-8',
|
1163
|
-
parameters: '',
|
1164
|
-
evalJSON: true,
|
1165
|
-
evalJS: true
|
1166
|
-
};
|
1167
|
-
Object.extend(this.options, options || { });
|
1168
|
-
|
1169
|
-
this.options.method = this.options.method.toLowerCase();
|
1170
|
-
|
1171
|
-
if (Object.isString(this.options.parameters))
|
1172
|
-
this.options.parameters = this.options.parameters.toQueryParams();
|
1173
|
-
else if (Object.isHash(this.options.parameters))
|
1174
|
-
this.options.parameters = this.options.parameters.toObject();
|
1175
|
-
}
|
1176
|
-
});
|
1177
|
-
|
1178
|
-
Ajax.Request = Class.create(Ajax.Base, {
|
1179
|
-
_complete: false,
|
1180
|
-
|
1181
|
-
initialize: function($super, url, options) {
|
1182
|
-
$super(options);
|
1183
|
-
this.transport = Ajax.getTransport();
|
1184
|
-
this.request(url);
|
1185
|
-
},
|
1186
|
-
|
1187
|
-
request: function(url) {
|
1188
|
-
this.url = url;
|
1189
|
-
this.method = this.options.method;
|
1190
|
-
var params = Object.clone(this.options.parameters);
|
1191
|
-
|
1192
|
-
if (!['get', 'post'].include(this.method)) {
|
1193
|
-
// simulate other verbs over post
|
1194
|
-
params['_method'] = this.method;
|
1195
|
-
this.method = 'post';
|
1196
|
-
}
|
1197
|
-
|
1198
|
-
this.parameters = params;
|
1199
|
-
|
1200
|
-
if (params = Object.toQueryString(params)) {
|
1201
|
-
// when GET, append parameters to URL
|
1202
|
-
if (this.method == 'get')
|
1203
|
-
this.url += (this.url.include('?') ? '&' : '?') + params;
|
1204
|
-
else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
|
1205
|
-
params += '&_=';
|
1206
|
-
}
|
1207
|
-
|
1208
|
-
try {
|
1209
|
-
var response = new Ajax.Response(this);
|
1210
|
-
if (this.options.onCreate) this.options.onCreate(response);
|
1211
|
-
Ajax.Responders.dispatch('onCreate', this, response);
|
1212
|
-
|
1213
|
-
this.transport.open(this.method.toUpperCase(), this.url,
|
1214
|
-
this.options.asynchronous);
|
1215
|
-
|
1216
|
-
if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
|
1217
|
-
|
1218
|
-
this.transport.onreadystatechange = this.onStateChange.bind(this);
|
1219
|
-
this.setRequestHeaders();
|
1220
|
-
|
1221
|
-
this.body = this.method == 'post' ? (this.options.postBody || params) : null;
|
1222
|
-
this.transport.send(this.body);
|
1223
|
-
|
1224
|
-
/* Force Firefox to handle ready state 4 for synchronous requests */
|
1225
|
-
if (!this.options.asynchronous && this.transport.overrideMimeType)
|
1226
|
-
this.onStateChange();
|
1227
|
-
|
1228
|
-
}
|
1229
|
-
catch (e) {
|
1230
|
-
this.dispatchException(e);
|
1231
|
-
}
|
1232
|
-
},
|
1233
|
-
|
1234
|
-
onStateChange: function() {
|
1235
|
-
var readyState = this.transport.readyState;
|
1236
|
-
if (readyState > 1 && !((readyState == 4) && this._complete))
|
1237
|
-
this.respondToReadyState(this.transport.readyState);
|
1238
|
-
},
|
1239
|
-
|
1240
|
-
setRequestHeaders: function() {
|
1241
|
-
var headers = {
|
1242
|
-
'X-Requested-With': 'XMLHttpRequest',
|
1243
|
-
'X-Prototype-Version': Prototype.Version,
|
1244
|
-
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
|
1245
|
-
};
|
1246
|
-
|
1247
|
-
if (this.method == 'post') {
|
1248
|
-
headers['Content-type'] = this.options.contentType +
|
1249
|
-
(this.options.encoding ? '; charset=' + this.options.encoding : '');
|
1250
|
-
|
1251
|
-
/* Force "Connection: close" for older Mozilla browsers to work
|
1252
|
-
* around a bug where XMLHttpRequest sends an incorrect
|
1253
|
-
* Content-length header. See Mozilla Bugzilla #246651.
|
1254
|
-
*/
|
1255
|
-
if (this.transport.overrideMimeType &&
|
1256
|
-
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
|
1257
|
-
headers['Connection'] = 'close';
|
1258
|
-
}
|
1259
|
-
|
1260
|
-
// user-defined headers
|
1261
|
-
if (typeof this.options.requestHeaders == 'object') {
|
1262
|
-
var extras = this.options.requestHeaders;
|
1263
|
-
|
1264
|
-
if (Object.isFunction(extras.push))
|
1265
|
-
for (var i = 0, length = extras.length; i < length; i += 2)
|
1266
|
-
headers[extras[i]] = extras[i+1];
|
1267
|
-
else
|
1268
|
-
$H(extras).each(function(pair) { headers[pair.key] = pair.value });
|
1269
|
-
}
|
1270
|
-
|
1271
|
-
for (var name in headers)
|
1272
|
-
this.transport.setRequestHeader(name, headers[name]);
|
1273
|
-
},
|
1274
|
-
|
1275
|
-
success: function() {
|
1276
|
-
var status = this.getStatus();
|
1277
|
-
return !status || (status >= 200 && status < 300);
|
1278
|
-
},
|
1279
|
-
|
1280
|
-
getStatus: function() {
|
1281
|
-
try {
|
1282
|
-
return this.transport.status || 0;
|
1283
|
-
} catch (e) { return 0 }
|
1284
|
-
},
|
1285
|
-
|
1286
|
-
respondToReadyState: function(readyState) {
|
1287
|
-
var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
|
1288
|
-
|
1289
|
-
if (state == 'Complete') {
|
1290
|
-
try {
|
1291
|
-
this._complete = true;
|
1292
|
-
(this.options['on' + response.status]
|
1293
|
-
|| this.options['on' + (this.success() ? 'Success' : 'Failure')]
|
1294
|
-
|| Prototype.emptyFunction)(response, response.headerJSON);
|
1295
|
-
} catch (e) {
|
1296
|
-
this.dispatchException(e);
|
1297
|
-
}
|
1298
|
-
|
1299
|
-
var contentType = response.getHeader('Content-type');
|
1300
|
-
if (this.options.evalJS == 'force'
|
1301
|
-
|| (this.options.evalJS && contentType
|
1302
|
-
&& contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
|
1303
|
-
this.evalResponse();
|
1304
|
-
}
|
1305
|
-
|
1306
|
-
try {
|
1307
|
-
(this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
|
1308
|
-
Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
|
1309
|
-
} catch (e) {
|
1310
|
-
this.dispatchException(e);
|
1311
|
-
}
|
1312
|
-
|
1313
|
-
if (state == 'Complete') {
|
1314
|
-
// avoid memory leak in MSIE: clean up
|
1315
|
-
this.transport.onreadystatechange = Prototype.emptyFunction;
|
1316
|
-
}
|
1317
|
-
},
|
1318
|
-
|
1319
|
-
getHeader: function(name) {
|
1320
|
-
try {
|
1321
|
-
return this.transport.getResponseHeader(name);
|
1322
|
-
} catch (e) { return null }
|
1323
|
-
},
|
1324
|
-
|
1325
|
-
evalResponse: function() {
|
1326
|
-
try {
|
1327
|
-
return eval((this.transport.responseText || '').unfilterJSON());
|
1328
|
-
} catch (e) {
|
1329
|
-
this.dispatchException(e);
|
1330
|
-
}
|
1331
|
-
},
|
1332
|
-
|
1333
|
-
dispatchException: function(exception) {
|
1334
|
-
(this.options.onException || Prototype.emptyFunction)(this, exception);
|
1335
|
-
Ajax.Responders.dispatch('onException', this, exception);
|
1336
|
-
}
|
1337
|
-
});
|
1338
|
-
|
1339
|
-
Ajax.Request.Events =
|
1340
|
-
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
|
1341
|
-
|
1342
|
-
Ajax.Response = Class.create({
|
1343
|
-
initialize: function(request){
|
1344
|
-
this.request = request;
|
1345
|
-
var transport = this.transport = request.transport,
|
1346
|
-
readyState = this.readyState = transport.readyState;
|
1347
|
-
|
1348
|
-
if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
|
1349
|
-
this.status = this.getStatus();
|
1350
|
-
this.statusText = this.getStatusText();
|
1351
|
-
this.responseText = String.interpret(transport.responseText);
|
1352
|
-
this.headerJSON = this._getHeaderJSON();
|
1353
|
-
}
|
1354
|
-
|
1355
|
-
if(readyState == 4) {
|
1356
|
-
var xml = transport.responseXML;
|
1357
|
-
this.responseXML = Object.isUndefined(xml) ? null : xml;
|
1358
|
-
this.responseJSON = this._getResponseJSON();
|
1359
|
-
}
|
1360
|
-
},
|
1361
|
-
|
1362
|
-
status: 0,
|
1363
|
-
statusText: '',
|
1364
|
-
|
1365
|
-
getStatus: Ajax.Request.prototype.getStatus,
|
1366
|
-
|
1367
|
-
getStatusText: function() {
|
1368
|
-
try {
|
1369
|
-
return this.transport.statusText || '';
|
1370
|
-
} catch (e) { return '' }
|
1371
|
-
},
|
1372
|
-
|
1373
|
-
getHeader: Ajax.Request.prototype.getHeader,
|
1374
|
-
|
1375
|
-
getAllHeaders: function() {
|
1376
|
-
try {
|
1377
|
-
return this.getAllResponseHeaders();
|
1378
|
-
} catch (e) { return null }
|
1379
|
-
},
|
1380
|
-
|
1381
|
-
getResponseHeader: function(name) {
|
1382
|
-
return this.transport.getResponseHeader(name);
|
1383
|
-
},
|
1384
|
-
|
1385
|
-
getAllResponseHeaders: function() {
|
1386
|
-
return this.transport.getAllResponseHeaders();
|
1387
|
-
},
|
1388
|
-
|
1389
|
-
_getHeaderJSON: function() {
|
1390
|
-
var json = this.getHeader('X-JSON');
|
1391
|
-
if (!json) return null;
|
1392
|
-
json = decodeURIComponent(escape(json));
|
1393
|
-
try {
|
1394
|
-
return json.evalJSON(this.request.options.sanitizeJSON);
|
1395
|
-
} catch (e) {
|
1396
|
-
this.request.dispatchException(e);
|
1397
|
-
}
|
1398
|
-
},
|
1399
|
-
|
1400
|
-
_getResponseJSON: function() {
|
1401
|
-
var options = this.request.options;
|
1402
|
-
if (!options.evalJSON || (options.evalJSON != 'force' &&
|
1403
|
-
!(this.getHeader('Content-type') || '').include('application/json')) ||
|
1404
|
-
this.responseText.blank())
|
1405
|
-
return null;
|
1406
|
-
try {
|
1407
|
-
return this.responseText.evalJSON(options.sanitizeJSON);
|
1408
|
-
} catch (e) {
|
1409
|
-
this.request.dispatchException(e);
|
1410
|
-
}
|
1411
|
-
}
|
1412
|
-
});
|
1413
|
-
|
1414
|
-
Ajax.Updater = Class.create(Ajax.Request, {
|
1415
|
-
initialize: function($super, container, url, options) {
|
1416
|
-
this.container = {
|
1417
|
-
success: (container.success || container),
|
1418
|
-
failure: (container.failure || (container.success ? null : container))
|
1419
|
-
};
|
1420
|
-
|
1421
|
-
options = Object.clone(options);
|
1422
|
-
var onComplete = options.onComplete;
|
1423
|
-
options.onComplete = (function(response, json) {
|
1424
|
-
this.updateContent(response.responseText);
|
1425
|
-
if (Object.isFunction(onComplete)) onComplete(response, json);
|
1426
|
-
}).bind(this);
|
1427
|
-
|
1428
|
-
$super(url, options);
|
1429
|
-
},
|
1430
|
-
|
1431
|
-
updateContent: function(responseText) {
|
1432
|
-
var receiver = this.container[this.success() ? 'success' : 'failure'],
|
1433
|
-
options = this.options;
|
1434
|
-
|
1435
|
-
if (!options.evalScripts) responseText = responseText.stripScripts();
|
1436
|
-
|
1437
|
-
if (receiver = $(receiver)) {
|
1438
|
-
if (options.insertion) {
|
1439
|
-
if (Object.isString(options.insertion)) {
|
1440
|
-
var insertion = { }; insertion[options.insertion] = responseText;
|
1441
|
-
receiver.insert(insertion);
|
1442
|
-
}
|
1443
|
-
else options.insertion(receiver, responseText);
|
1444
|
-
}
|
1445
|
-
else receiver.update(responseText);
|
1446
|
-
}
|
1447
|
-
}
|
1448
|
-
});
|
1449
|
-
|
1450
|
-
Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
|
1451
|
-
initialize: function($super, container, url, options) {
|
1452
|
-
$super(options);
|
1453
|
-
this.onComplete = this.options.onComplete;
|
1454
|
-
|
1455
|
-
this.frequency = (this.options.frequency || 2);
|
1456
|
-
this.decay = (this.options.decay || 1);
|
1457
|
-
|
1458
|
-
this.updater = { };
|
1459
|
-
this.container = container;
|
1460
|
-
this.url = url;
|
1461
|
-
|
1462
|
-
this.start();
|
1463
|
-
},
|
1464
|
-
|
1465
|
-
start: function() {
|
1466
|
-
this.options.onComplete = this.updateComplete.bind(this);
|
1467
|
-
this.onTimerEvent();
|
1468
|
-
},
|
1469
|
-
|
1470
|
-
stop: function() {
|
1471
|
-
this.updater.options.onComplete = undefined;
|
1472
|
-
clearTimeout(this.timer);
|
1473
|
-
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
|
1474
|
-
},
|
1475
|
-
|
1476
|
-
updateComplete: function(response) {
|
1477
|
-
if (this.options.decay) {
|
1478
|
-
this.decay = (response.responseText == this.lastText ?
|
1479
|
-
this.decay * this.options.decay : 1);
|
1480
|
-
|
1481
|
-
this.lastText = response.responseText;
|
1482
|
-
}
|
1483
|
-
this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
|
1484
|
-
},
|
1485
|
-
|
1486
|
-
onTimerEvent: function() {
|
1487
|
-
this.updater = new Ajax.Updater(this.container, this.url, this.options);
|
1488
|
-
}
|
1489
|
-
});
|
1490
|
-
function $(element) {
|
1491
|
-
if (arguments.length > 1) {
|
1492
|
-
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
|
1493
|
-
elements.push($(arguments[i]));
|
1494
|
-
return elements;
|
1495
|
-
}
|
1496
|
-
if (Object.isString(element))
|
1497
|
-
element = document.getElementById(element);
|
1498
|
-
return Element.extend(element);
|
1499
|
-
}
|
1500
|
-
|
1501
|
-
if (Prototype.BrowserFeatures.XPath) {
|
1502
|
-
document._getElementsByXPath = function(expression, parentElement) {
|
1503
|
-
var results = [];
|
1504
|
-
var query = document.evaluate(expression, $(parentElement) || document,
|
1505
|
-
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
|
1506
|
-
for (var i = 0, length = query.snapshotLength; i < length; i++)
|
1507
|
-
results.push(Element.extend(query.snapshotItem(i)));
|
1508
|
-
return results;
|
1509
|
-
};
|
1510
|
-
}
|
1511
|
-
|
1512
|
-
/*--------------------------------------------------------------------------*/
|
1513
|
-
|
1514
|
-
if (!window.Node) var Node = { };
|
1515
|
-
|
1516
|
-
if (!Node.ELEMENT_NODE) {
|
1517
|
-
// DOM level 2 ECMAScript Language Binding
|
1518
|
-
Object.extend(Node, {
|
1519
|
-
ELEMENT_NODE: 1,
|
1520
|
-
ATTRIBUTE_NODE: 2,
|
1521
|
-
TEXT_NODE: 3,
|
1522
|
-
CDATA_SECTION_NODE: 4,
|
1523
|
-
ENTITY_REFERENCE_NODE: 5,
|
1524
|
-
ENTITY_NODE: 6,
|
1525
|
-
PROCESSING_INSTRUCTION_NODE: 7,
|
1526
|
-
COMMENT_NODE: 8,
|
1527
|
-
DOCUMENT_NODE: 9,
|
1528
|
-
DOCUMENT_TYPE_NODE: 10,
|
1529
|
-
DOCUMENT_FRAGMENT_NODE: 11,
|
1530
|
-
NOTATION_NODE: 12
|
1531
|
-
});
|
1532
|
-
}
|
1533
|
-
|
1534
|
-
(function() {
|
1535
|
-
var element = this.Element;
|
1536
|
-
this.Element = function(tagName, attributes) {
|
1537
|
-
attributes = attributes || { };
|
1538
|
-
tagName = tagName.toLowerCase();
|
1539
|
-
var cache = Element.cache;
|
1540
|
-
if (Prototype.Browser.IE && attributes.name) {
|
1541
|
-
tagName = '<' + tagName + ' name="' + attributes.name + '">';
|
1542
|
-
delete attributes.name;
|
1543
|
-
return Element.writeAttribute(document.createElement(tagName), attributes);
|
1544
|
-
}
|
1545
|
-
if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
|
1546
|
-
return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
|
1547
|
-
};
|
1548
|
-
Object.extend(this.Element, element || { });
|
1549
|
-
}).call(window);
|
1550
|
-
|
1551
|
-
Element.cache = { };
|
1552
|
-
|
1553
|
-
Element.Methods = {
|
1554
|
-
visible: function(element) {
|
1555
|
-
return $(element).style.display != 'none';
|
1556
|
-
},
|
1557
|
-
|
1558
|
-
toggle: function(element) {
|
1559
|
-
element = $(element);
|
1560
|
-
Element[Element.visible(element) ? 'hide' : 'show'](element);
|
1561
|
-
return element;
|
1562
|
-
},
|
1563
|
-
|
1564
|
-
hide: function(element) {
|
1565
|
-
$(element).style.display = 'none';
|
1566
|
-
return element;
|
1567
|
-
},
|
1568
|
-
|
1569
|
-
show: function(element) {
|
1570
|
-
$(element).style.display = '';
|
1571
|
-
return element;
|
1572
|
-
},
|
1573
|
-
|
1574
|
-
remove: function(element) {
|
1575
|
-
element = $(element);
|
1576
|
-
element.parentNode.removeChild(element);
|
1577
|
-
return element;
|
1578
|
-
},
|
1579
|
-
|
1580
|
-
update: function(element, content) {
|
1581
|
-
element = $(element);
|
1582
|
-
if (content && content.toElement) content = content.toElement();
|
1583
|
-
if (Object.isElement(content)) return element.update().insert(content);
|
1584
|
-
content = Object.toHTML(content);
|
1585
|
-
element.innerHTML = content.stripScripts();
|
1586
|
-
content.evalScripts.bind(content).defer();
|
1587
|
-
return element;
|
1588
|
-
},
|
1589
|
-
|
1590
|
-
replace: function(element, content) {
|
1591
|
-
element = $(element);
|
1592
|
-
if (content && content.toElement) content = content.toElement();
|
1593
|
-
else if (!Object.isElement(content)) {
|
1594
|
-
content = Object.toHTML(content);
|
1595
|
-
var range = element.ownerDocument.createRange();
|
1596
|
-
range.selectNode(element);
|
1597
|
-
content.evalScripts.bind(content).defer();
|
1598
|
-
content = range.createContextualFragment(content.stripScripts());
|
1599
|
-
}
|
1600
|
-
element.parentNode.replaceChild(content, element);
|
1601
|
-
return element;
|
1602
|
-
},
|
1603
|
-
|
1604
|
-
insert: function(element, insertions) {
|
1605
|
-
element = $(element);
|
1606
|
-
|
1607
|
-
if (Object.isString(insertions) || Object.isNumber(insertions) ||
|
1608
|
-
Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
|
1609
|
-
insertions = {bottom:insertions};
|
1610
|
-
|
1611
|
-
var content, t, range;
|
1612
|
-
|
1613
|
-
for (position in insertions) {
|
1614
|
-
content = insertions[position];
|
1615
|
-
position = position.toLowerCase();
|
1616
|
-
t = Element._insertionTranslations[position];
|
1617
|
-
|
1618
|
-
if (content && content.toElement) content = content.toElement();
|
1619
|
-
if (Object.isElement(content)) {
|
1620
|
-
t.insert(element, content);
|
1621
|
-
continue;
|
1622
|
-
}
|
1623
|
-
|
1624
|
-
content = Object.toHTML(content);
|
1625
|
-
|
1626
|
-
range = element.ownerDocument.createRange();
|
1627
|
-
t.initializeRange(element, range);
|
1628
|
-
t.insert(element, range.createContextualFragment(content.stripScripts()));
|
1629
|
-
|
1630
|
-
content.evalScripts.bind(content).defer();
|
1631
|
-
}
|
1632
|
-
|
1633
|
-
return element;
|
1634
|
-
},
|
1635
|
-
|
1636
|
-
wrap: function(element, wrapper, attributes) {
|
1637
|
-
element = $(element);
|
1638
|
-
if (Object.isElement(wrapper))
|
1639
|
-
$(wrapper).writeAttribute(attributes || { });
|
1640
|
-
else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
|
1641
|
-
else wrapper = new Element('div', wrapper);
|
1642
|
-
if (element.parentNode)
|
1643
|
-
element.parentNode.replaceChild(wrapper, element);
|
1644
|
-
wrapper.appendChild(element);
|
1645
|
-
return wrapper;
|
1646
|
-
},
|
1647
|
-
|
1648
|
-
inspect: function(element) {
|
1649
|
-
element = $(element);
|
1650
|
-
var result = '<' + element.tagName.toLowerCase();
|
1651
|
-
$H({'id': 'id', 'className': 'class'}).each(function(pair) {
|
1652
|
-
var property = pair.first(), attribute = pair.last();
|
1653
|
-
var value = (element[property] || '').toString();
|
1654
|
-
if (value) result += ' ' + attribute + '=' + value.inspect(true);
|
1655
|
-
});
|
1656
|
-
return result + '>';
|
1657
|
-
},
|
1658
|
-
|
1659
|
-
recursivelyCollect: function(element, property) {
|
1660
|
-
element = $(element);
|
1661
|
-
var elements = [];
|
1662
|
-
while (element = element[property])
|
1663
|
-
if (element.nodeType == 1)
|
1664
|
-
elements.push(Element.extend(element));
|
1665
|
-
return elements;
|
1666
|
-
},
|
1667
|
-
|
1668
|
-
ancestors: function(element) {
|
1669
|
-
return $(element).recursivelyCollect('parentNode');
|
1670
|
-
},
|
1671
|
-
|
1672
|
-
descendants: function(element) {
|
1673
|
-
return $(element).getElementsBySelector("*");
|
1674
|
-
},
|
1675
|
-
|
1676
|
-
firstDescendant: function(element) {
|
1677
|
-
element = $(element).firstChild;
|
1678
|
-
while (element && element.nodeType != 1) element = element.nextSibling;
|
1679
|
-
return $(element);
|
1680
|
-
},
|
1681
|
-
|
1682
|
-
immediateDescendants: function(element) {
|
1683
|
-
if (!(element = $(element).firstChild)) return [];
|
1684
|
-
while (element && element.nodeType != 1) element = element.nextSibling;
|
1685
|
-
if (element) return [element].concat($(element).nextSiblings());
|
1686
|
-
return [];
|
1687
|
-
},
|
1688
|
-
|
1689
|
-
previousSiblings: function(element) {
|
1690
|
-
return $(element).recursivelyCollect('previousSibling');
|
1691
|
-
},
|
1692
|
-
|
1693
|
-
nextSiblings: function(element) {
|
1694
|
-
return $(element).recursivelyCollect('nextSibling');
|
1695
|
-
},
|
1696
|
-
|
1697
|
-
siblings: function(element) {
|
1698
|
-
element = $(element);
|
1699
|
-
return element.previousSiblings().reverse().concat(element.nextSiblings());
|
1700
|
-
},
|
1701
|
-
|
1702
|
-
match: function(element, selector) {
|
1703
|
-
if (Object.isString(selector))
|
1704
|
-
selector = new Selector(selector);
|
1705
|
-
return selector.match($(element));
|
1706
|
-
},
|
1707
|
-
|
1708
|
-
up: function(element, expression, index) {
|
1709
|
-
element = $(element);
|
1710
|
-
if (arguments.length == 1) return $(element.parentNode);
|
1711
|
-
var ancestors = element.ancestors();
|
1712
|
-
return expression ? Selector.findElement(ancestors, expression, index) :
|
1713
|
-
ancestors[index || 0];
|
1714
|
-
},
|
1715
|
-
|
1716
|
-
down: function(element, expression, index) {
|
1717
|
-
element = $(element);
|
1718
|
-
if (arguments.length == 1) return element.firstDescendant();
|
1719
|
-
var descendants = element.descendants();
|
1720
|
-
return expression ? Selector.findElement(descendants, expression, index) :
|
1721
|
-
descendants[index || 0];
|
1722
|
-
},
|
1723
|
-
|
1724
|
-
previous: function(element, expression, index) {
|
1725
|
-
element = $(element);
|
1726
|
-
if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
|
1727
|
-
var previousSiblings = element.previousSiblings();
|
1728
|
-
return expression ? Selector.findElement(previousSiblings, expression, index) :
|
1729
|
-
previousSiblings[index || 0];
|
1730
|
-
},
|
1731
|
-
|
1732
|
-
next: function(element, expression, index) {
|
1733
|
-
element = $(element);
|
1734
|
-
if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
|
1735
|
-
var nextSiblings = element.nextSiblings();
|
1736
|
-
return expression ? Selector.findElement(nextSiblings, expression, index) :
|
1737
|
-
nextSiblings[index || 0];
|
1738
|
-
},
|
1739
|
-
|
1740
|
-
select: function() {
|
1741
|
-
var args = $A(arguments), element = $(args.shift());
|
1742
|
-
return Selector.findChildElements(element, args);
|
1743
|
-
},
|
1744
|
-
|
1745
|
-
adjacent: function() {
|
1746
|
-
var args = $A(arguments), element = $(args.shift());
|
1747
|
-
return Selector.findChildElements(element.parentNode, args).without(element);
|
1748
|
-
},
|
1749
|
-
|
1750
|
-
identify: function(element) {
|
1751
|
-
element = $(element);
|
1752
|
-
var id = element.readAttribute('id'), self = arguments.callee;
|
1753
|
-
if (id) return id;
|
1754
|
-
do { id = 'anonymous_element_' + self.counter++ } while ($(id));
|
1755
|
-
element.writeAttribute('id', id);
|
1756
|
-
return id;
|
1757
|
-
},
|
1758
|
-
|
1759
|
-
readAttribute: function(element, name) {
|
1760
|
-
element = $(element);
|
1761
|
-
if (Prototype.Browser.IE) {
|
1762
|
-
var t = Element._attributeTranslations.read;
|
1763
|
-
if (t.values[name]) return t.values[name](element, name);
|
1764
|
-
if (t.names[name]) name = t.names[name];
|
1765
|
-
if (name.include(':')) {
|
1766
|
-
return (!element.attributes || !element.attributes[name]) ? null :
|
1767
|
-
element.attributes[name].value;
|
1768
|
-
}
|
1769
|
-
}
|
1770
|
-
return element.getAttribute(name);
|
1771
|
-
},
|
1772
|
-
|
1773
|
-
writeAttribute: function(element, name, value) {
|
1774
|
-
element = $(element);
|
1775
|
-
var attributes = { }, t = Element._attributeTranslations.write;
|
1776
|
-
|
1777
|
-
if (typeof name == 'object') attributes = name;
|
1778
|
-
else attributes[name] = Object.isUndefined(value) ? true : value;
|
1779
|
-
|
1780
|
-
for (var attr in attributes) {
|
1781
|
-
name = t.names[attr] || attr;
|
1782
|
-
value = attributes[attr];
|
1783
|
-
if (t.values[attr]) name = t.values[attr](element, value);
|
1784
|
-
if (value === false || value === null)
|
1785
|
-
element.removeAttribute(name);
|
1786
|
-
else if (value === true)
|
1787
|
-
element.setAttribute(name, name);
|
1788
|
-
else element.setAttribute(name, value);
|
1789
|
-
}
|
1790
|
-
return element;
|
1791
|
-
},
|
1792
|
-
|
1793
|
-
getHeight: function(element) {
|
1794
|
-
return $(element).getDimensions().height;
|
1795
|
-
},
|
1796
|
-
|
1797
|
-
getWidth: function(element) {
|
1798
|
-
return $(element).getDimensions().width;
|
1799
|
-
},
|
1800
|
-
|
1801
|
-
classNames: function(element) {
|
1802
|
-
return new Element.ClassNames(element);
|
1803
|
-
},
|
1804
|
-
|
1805
|
-
hasClassName: function(element, className) {
|
1806
|
-
if (!(element = $(element))) return;
|
1807
|
-
var elementClassName = element.className;
|
1808
|
-
return (elementClassName.length > 0 && (elementClassName == className ||
|
1809
|
-
new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
|
1810
|
-
},
|
1811
|
-
|
1812
|
-
addClassName: function(element, className) {
|
1813
|
-
if (!(element = $(element))) return;
|
1814
|
-
if (!element.hasClassName(className))
|
1815
|
-
element.className += (element.className ? ' ' : '') + className;
|
1816
|
-
return element;
|
1817
|
-
},
|
1818
|
-
|
1819
|
-
removeClassName: function(element, className) {
|
1820
|
-
if (!(element = $(element))) return;
|
1821
|
-
element.className = element.className.replace(
|
1822
|
-
new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
|
1823
|
-
return element;
|
1824
|
-
},
|
1825
|
-
|
1826
|
-
toggleClassName: function(element, className) {
|
1827
|
-
if (!(element = $(element))) return;
|
1828
|
-
return element[element.hasClassName(className) ?
|
1829
|
-
'removeClassName' : 'addClassName'](className);
|
1830
|
-
},
|
1831
|
-
|
1832
|
-
// removes whitespace-only text node children
|
1833
|
-
cleanWhitespace: function(element) {
|
1834
|
-
element = $(element);
|
1835
|
-
var node = element.firstChild;
|
1836
|
-
while (node) {
|
1837
|
-
var nextNode = node.nextSibling;
|
1838
|
-
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
|
1839
|
-
element.removeChild(node);
|
1840
|
-
node = nextNode;
|
1841
|
-
}
|
1842
|
-
return element;
|
1843
|
-
},
|
1844
|
-
|
1845
|
-
empty: function(element) {
|
1846
|
-
return $(element).innerHTML.blank();
|
1847
|
-
},
|
1848
|
-
|
1849
|
-
descendantOf: function(element, ancestor) {
|
1850
|
-
element = $(element), ancestor = $(ancestor);
|
1851
|
-
var originalAncestor = ancestor;
|
1852
|
-
|
1853
|
-
if (element.compareDocumentPosition)
|
1854
|
-
return (element.compareDocumentPosition(ancestor) & 8) === 8;
|
1855
|
-
|
1856
|
-
if (element.sourceIndex && !Prototype.Browser.Opera) {
|
1857
|
-
var e = element.sourceIndex, a = ancestor.sourceIndex,
|
1858
|
-
nextAncestor = ancestor.nextSibling;
|
1859
|
-
if (!nextAncestor) {
|
1860
|
-
do { ancestor = ancestor.parentNode; }
|
1861
|
-
while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
|
1862
|
-
}
|
1863
|
-
if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex);
|
1864
|
-
}
|
1865
|
-
|
1866
|
-
while (element = element.parentNode)
|
1867
|
-
if (element == originalAncestor) return true;
|
1868
|
-
return false;
|
1869
|
-
},
|
1870
|
-
|
1871
|
-
scrollTo: function(element) {
|
1872
|
-
element = $(element);
|
1873
|
-
var pos = element.cumulativeOffset();
|
1874
|
-
window.scrollTo(pos[0], pos[1]);
|
1875
|
-
return element;
|
1876
|
-
},
|
1877
|
-
|
1878
|
-
getStyle: function(element, style) {
|
1879
|
-
element = $(element);
|
1880
|
-
style = style == 'float' ? 'cssFloat' : style.camelize();
|
1881
|
-
var value = element.style[style];
|
1882
|
-
if (!value) {
|
1883
|
-
var css = document.defaultView.getComputedStyle(element, null);
|
1884
|
-
value = css ? css[style] : null;
|
1885
|
-
}
|
1886
|
-
if (style == 'opacity') return value ? parseFloat(value) : 1.0;
|
1887
|
-
return value == 'auto' ? null : value;
|
1888
|
-
},
|
1889
|
-
|
1890
|
-
getOpacity: function(element) {
|
1891
|
-
return $(element).getStyle('opacity');
|
1892
|
-
},
|
1893
|
-
|
1894
|
-
setStyle: function(element, styles) {
|
1895
|
-
element = $(element);
|
1896
|
-
var elementStyle = element.style, match;
|
1897
|
-
if (Object.isString(styles)) {
|
1898
|
-
element.style.cssText += ';' + styles;
|
1899
|
-
return styles.include('opacity') ?
|
1900
|
-
element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
|
1901
|
-
}
|
1902
|
-
for (var property in styles)
|
1903
|
-
if (property == 'opacity') element.setOpacity(styles[property]);
|
1904
|
-
else
|
1905
|
-
elementStyle[(property == 'float' || property == 'cssFloat') ?
|
1906
|
-
(Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
|
1907
|
-
property] = styles[property];
|
1908
|
-
|
1909
|
-
return element;
|
1910
|
-
},
|
1911
|
-
|
1912
|
-
setOpacity: function(element, value) {
|
1913
|
-
element = $(element);
|
1914
|
-
element.style.opacity = (value == 1 || value === '') ? '' :
|
1915
|
-
(value < 0.00001) ? 0 : value;
|
1916
|
-
return element;
|
1917
|
-
},
|
1918
|
-
|
1919
|
-
getDimensions: function(element) {
|
1920
|
-
element = $(element);
|
1921
|
-
var display = $(element).getStyle('display');
|
1922
|
-
if (display != 'none' && display != null) // Safari bug
|
1923
|
-
return {width: element.offsetWidth, height: element.offsetHeight};
|
1924
|
-
|
1925
|
-
// All *Width and *Height properties give 0 on elements with display none,
|
1926
|
-
// so enable the element temporarily
|
1927
|
-
var els = element.style;
|
1928
|
-
var originalVisibility = els.visibility;
|
1929
|
-
var originalPosition = els.position;
|
1930
|
-
var originalDisplay = els.display;
|
1931
|
-
els.visibility = 'hidden';
|
1932
|
-
els.position = 'absolute';
|
1933
|
-
els.display = 'block';
|
1934
|
-
var originalWidth = element.clientWidth;
|
1935
|
-
var originalHeight = element.clientHeight;
|
1936
|
-
els.display = originalDisplay;
|
1937
|
-
els.position = originalPosition;
|
1938
|
-
els.visibility = originalVisibility;
|
1939
|
-
return {width: originalWidth, height: originalHeight};
|
1940
|
-
},
|
1941
|
-
|
1942
|
-
makePositioned: function(element) {
|
1943
|
-
element = $(element);
|
1944
|
-
var pos = Element.getStyle(element, 'position');
|
1945
|
-
if (pos == 'static' || !pos) {
|
1946
|
-
element._madePositioned = true;
|
1947
|
-
element.style.position = 'relative';
|
1948
|
-
// Opera returns the offset relative to the positioning context, when an
|
1949
|
-
// element is position relative but top and left have not been defined
|
1950
|
-
if (window.opera) {
|
1951
|
-
element.style.top = 0;
|
1952
|
-
element.style.left = 0;
|
1953
|
-
}
|
1954
|
-
}
|
1955
|
-
return element;
|
1956
|
-
},
|
1957
|
-
|
1958
|
-
undoPositioned: function(element) {
|
1959
|
-
element = $(element);
|
1960
|
-
if (element._madePositioned) {
|
1961
|
-
element._madePositioned = undefined;
|
1962
|
-
element.style.position =
|
1963
|
-
element.style.top =
|
1964
|
-
element.style.left =
|
1965
|
-
element.style.bottom =
|
1966
|
-
element.style.right = '';
|
1967
|
-
}
|
1968
|
-
return element;
|
1969
|
-
},
|
1970
|
-
|
1971
|
-
makeClipping: function(element) {
|
1972
|
-
element = $(element);
|
1973
|
-
if (element._overflow) return element;
|
1974
|
-
element._overflow = Element.getStyle(element, 'overflow') || 'auto';
|
1975
|
-
if (element._overflow !== 'hidden')
|
1976
|
-
element.style.overflow = 'hidden';
|
1977
|
-
return element;
|
1978
|
-
},
|
1979
|
-
|
1980
|
-
undoClipping: function(element) {
|
1981
|
-
element = $(element);
|
1982
|
-
if (!element._overflow) return element;
|
1983
|
-
element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
|
1984
|
-
element._overflow = null;
|
1985
|
-
return element;
|
1986
|
-
},
|
1987
|
-
|
1988
|
-
cumulativeOffset: function(element) {
|
1989
|
-
var valueT = 0, valueL = 0;
|
1990
|
-
do {
|
1991
|
-
valueT += element.offsetTop || 0;
|
1992
|
-
valueL += element.offsetLeft || 0;
|
1993
|
-
element = element.offsetParent;
|
1994
|
-
} while (element);
|
1995
|
-
return Element._returnOffset(valueL, valueT);
|
1996
|
-
},
|
1997
|
-
|
1998
|
-
positionedOffset: function(element) {
|
1999
|
-
var valueT = 0, valueL = 0;
|
2000
|
-
do {
|
2001
|
-
valueT += element.offsetTop || 0;
|
2002
|
-
valueL += element.offsetLeft || 0;
|
2003
|
-
element = element.offsetParent;
|
2004
|
-
if (element) {
|
2005
|
-
if (element.tagName == 'BODY') break;
|
2006
|
-
var p = Element.getStyle(element, 'position');
|
2007
|
-
if (p == 'relative' || p == 'absolute') break;
|
2008
|
-
}
|
2009
|
-
} while (element);
|
2010
|
-
return Element._returnOffset(valueL, valueT);
|
2011
|
-
},
|
2012
|
-
|
2013
|
-
absolutize: function(element) {
|
2014
|
-
element = $(element);
|
2015
|
-
if (element.getStyle('position') == 'absolute') return;
|
2016
|
-
// Position.prepare(); // To be done manually by Scripty when it needs it.
|
2017
|
-
|
2018
|
-
var offsets = element.positionedOffset();
|
2019
|
-
var top = offsets[1];
|
2020
|
-
var left = offsets[0];
|
2021
|
-
var width = element.clientWidth;
|
2022
|
-
var height = element.clientHeight;
|
2023
|
-
|
2024
|
-
element._originalLeft = left - parseFloat(element.style.left || 0);
|
2025
|
-
element._originalTop = top - parseFloat(element.style.top || 0);
|
2026
|
-
element._originalWidth = element.style.width;
|
2027
|
-
element._originalHeight = element.style.height;
|
2028
|
-
|
2029
|
-
element.style.position = 'absolute';
|
2030
|
-
element.style.top = top + 'px';
|
2031
|
-
element.style.left = left + 'px';
|
2032
|
-
element.style.width = width + 'px';
|
2033
|
-
element.style.height = height + 'px';
|
2034
|
-
return element;
|
2035
|
-
},
|
2036
|
-
|
2037
|
-
relativize: function(element) {
|
2038
|
-
element = $(element);
|
2039
|
-
if (element.getStyle('position') == 'relative') return;
|
2040
|
-
// Position.prepare(); // To be done manually by Scripty when it needs it.
|
2041
|
-
|
2042
|
-
element.style.position = 'relative';
|
2043
|
-
var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
|
2044
|
-
var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
|
2045
|
-
|
2046
|
-
element.style.top = top + 'px';
|
2047
|
-
element.style.left = left + 'px';
|
2048
|
-
element.style.height = element._originalHeight;
|
2049
|
-
element.style.width = element._originalWidth;
|
2050
|
-
return element;
|
2051
|
-
},
|
2052
|
-
|
2053
|
-
cumulativeScrollOffset: function(element) {
|
2054
|
-
var valueT = 0, valueL = 0;
|
2055
|
-
do {
|
2056
|
-
valueT += element.scrollTop || 0;
|
2057
|
-
valueL += element.scrollLeft || 0;
|
2058
|
-
element = element.parentNode;
|
2059
|
-
} while (element);
|
2060
|
-
return Element._returnOffset(valueL, valueT);
|
2061
|
-
},
|
2062
|
-
|
2063
|
-
getOffsetParent: function(element) {
|
2064
|
-
if (element.offsetParent) return $(element.offsetParent);
|
2065
|
-
if (element == document.body) return $(element);
|
2066
|
-
|
2067
|
-
while ((element = element.parentNode) && element != document.body)
|
2068
|
-
if (Element.getStyle(element, 'position') != 'static')
|
2069
|
-
return $(element);
|
2070
|
-
|
2071
|
-
return $(document.body);
|
2072
|
-
},
|
2073
|
-
|
2074
|
-
viewportOffset: function(forElement) {
|
2075
|
-
var valueT = 0, valueL = 0;
|
2076
|
-
|
2077
|
-
var element = forElement;
|
2078
|
-
do {
|
2079
|
-
valueT += element.offsetTop || 0;
|
2080
|
-
valueL += element.offsetLeft || 0;
|
2081
|
-
|
2082
|
-
// Safari fix
|
2083
|
-
if (element.offsetParent == document.body &&
|
2084
|
-
Element.getStyle(element, 'position') == 'absolute') break;
|
2085
|
-
|
2086
|
-
} while (element = element.offsetParent);
|
2087
|
-
|
2088
|
-
element = forElement;
|
2089
|
-
do {
|
2090
|
-
if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
|
2091
|
-
valueT -= element.scrollTop || 0;
|
2092
|
-
valueL -= element.scrollLeft || 0;
|
2093
|
-
}
|
2094
|
-
} while (element = element.parentNode);
|
2095
|
-
|
2096
|
-
return Element._returnOffset(valueL, valueT);
|
2097
|
-
},
|
2098
|
-
|
2099
|
-
clonePosition: function(element, source) {
|
2100
|
-
var options = Object.extend({
|
2101
|
-
setLeft: true,
|
2102
|
-
setTop: true,
|
2103
|
-
setWidth: true,
|
2104
|
-
setHeight: true,
|
2105
|
-
offsetTop: 0,
|
2106
|
-
offsetLeft: 0
|
2107
|
-
}, arguments[2] || { });
|
2108
|
-
|
2109
|
-
// find page position of source
|
2110
|
-
source = $(source);
|
2111
|
-
var p = source.viewportOffset();
|
2112
|
-
|
2113
|
-
// find coordinate system to use
|
2114
|
-
element = $(element);
|
2115
|
-
var delta = [0, 0];
|
2116
|
-
var parent = null;
|
2117
|
-
// delta [0,0] will do fine with position: fixed elements,
|
2118
|
-
// position:absolute needs offsetParent deltas
|
2119
|
-
if (Element.getStyle(element, 'position') == 'absolute') {
|
2120
|
-
parent = element.getOffsetParent();
|
2121
|
-
delta = parent.viewportOffset();
|
2122
|
-
}
|
2123
|
-
|
2124
|
-
// correct by body offsets (fixes Safari)
|
2125
|
-
if (parent == document.body) {
|
2126
|
-
delta[0] -= document.body.offsetLeft;
|
2127
|
-
delta[1] -= document.body.offsetTop;
|
2128
|
-
}
|
2129
|
-
|
2130
|
-
// set position
|
2131
|
-
if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
|
2132
|
-
if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
|
2133
|
-
if (options.setWidth) element.style.width = source.offsetWidth + 'px';
|
2134
|
-
if (options.setHeight) element.style.height = source.offsetHeight + 'px';
|
2135
|
-
return element;
|
2136
|
-
}
|
2137
|
-
};
|
2138
|
-
|
2139
|
-
Element.Methods.identify.counter = 1;
|
2140
|
-
|
2141
|
-
Object.extend(Element.Methods, {
|
2142
|
-
getElementsBySelector: Element.Methods.select,
|
2143
|
-
childElements: Element.Methods.immediateDescendants
|
2144
|
-
});
|
2145
|
-
|
2146
|
-
Element._attributeTranslations = {
|
2147
|
-
write: {
|
2148
|
-
names: {
|
2149
|
-
className: 'class',
|
2150
|
-
htmlFor: 'for'
|
2151
|
-
},
|
2152
|
-
values: { }
|
2153
|
-
}
|
2154
|
-
};
|
2155
|
-
|
2156
|
-
|
2157
|
-
if (!document.createRange || Prototype.Browser.Opera) {
|
2158
|
-
Element.Methods.insert = function(element, insertions) {
|
2159
|
-
element = $(element);
|
2160
|
-
|
2161
|
-
if (Object.isString(insertions) || Object.isNumber(insertions) ||
|
2162
|
-
Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
|
2163
|
-
insertions = { bottom: insertions };
|
2164
|
-
|
2165
|
-
var t = Element._insertionTranslations, content, position, pos, tagName;
|
2166
|
-
|
2167
|
-
for (position in insertions) {
|
2168
|
-
content = insertions[position];
|
2169
|
-
position = position.toLowerCase();
|
2170
|
-
pos = t[position];
|
2171
|
-
|
2172
|
-
if (content && content.toElement) content = content.toElement();
|
2173
|
-
if (Object.isElement(content)) {
|
2174
|
-
pos.insert(element, content);
|
2175
|
-
continue;
|
2176
|
-
}
|
2177
|
-
|
2178
|
-
content = Object.toHTML(content);
|
2179
|
-
tagName = ((position == 'before' || position == 'after')
|
2180
|
-
? element.parentNode : element).tagName.toUpperCase();
|
2181
|
-
|
2182
|
-
if (t.tags[tagName]) {
|
2183
|
-
var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
|
2184
|
-
if (position == 'top' || position == 'after') fragments.reverse();
|
2185
|
-
fragments.each(pos.insert.curry(element));
|
2186
|
-
}
|
2187
|
-
else element.insertAdjacentHTML(pos.adjacency, content.stripScripts());
|
2188
|
-
|
2189
|
-
content.evalScripts.bind(content).defer();
|
2190
|
-
}
|
2191
|
-
|
2192
|
-
return element;
|
2193
|
-
};
|
2194
|
-
}
|
2195
|
-
|
2196
|
-
if (Prototype.Browser.Opera) {
|
2197
|
-
Element.Methods.getStyle = Element.Methods.getStyle.wrap(
|
2198
|
-
function(proceed, element, style) {
|
2199
|
-
switch (style) {
|
2200
|
-
case 'left': case 'top': case 'right': case 'bottom':
|
2201
|
-
if (proceed(element, 'position') === 'static') return null;
|
2202
|
-
case 'height': case 'width':
|
2203
|
-
// returns '0px' for hidden elements; we want it to return null
|
2204
|
-
if (!Element.visible(element)) return null;
|
2205
|
-
|
2206
|
-
// returns the border-box dimensions rather than the content-box
|
2207
|
-
// dimensions, so we subtract padding and borders from the value
|
2208
|
-
var dim = parseInt(proceed(element, style), 10);
|
2209
|
-
|
2210
|
-
if (dim !== element['offset' + style.capitalize()])
|
2211
|
-
return dim + 'px';
|
2212
|
-
|
2213
|
-
var properties;
|
2214
|
-
if (style === 'height') {
|
2215
|
-
properties = ['border-top-width', 'padding-top',
|
2216
|
-
'padding-bottom', 'border-bottom-width'];
|
2217
|
-
}
|
2218
|
-
else {
|
2219
|
-
properties = ['border-left-width', 'padding-left',
|
2220
|
-
'padding-right', 'border-right-width'];
|
2221
|
-
}
|
2222
|
-
return properties.inject(dim, function(memo, property) {
|
2223
|
-
var val = proceed(element, property);
|
2224
|
-
return val === null ? memo : memo - parseInt(val, 10);
|
2225
|
-
}) + 'px';
|
2226
|
-
default: return proceed(element, style);
|
2227
|
-
}
|
2228
|
-
}
|
2229
|
-
);
|
2230
|
-
|
2231
|
-
Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
|
2232
|
-
function(proceed, element, attribute) {
|
2233
|
-
if (attribute === 'title') return element.title;
|
2234
|
-
return proceed(element, attribute);
|
2235
|
-
}
|
2236
|
-
);
|
2237
|
-
}
|
2238
|
-
|
2239
|
-
else if (Prototype.Browser.IE) {
|
2240
|
-
$w('positionedOffset getOffsetParent viewportOffset').each(function(method) {
|
2241
|
-
Element.Methods[method] = Element.Methods[method].wrap(
|
2242
|
-
function(proceed, element) {
|
2243
|
-
element = $(element);
|
2244
|
-
var position = element.getStyle('position');
|
2245
|
-
if (position != 'static') return proceed(element);
|
2246
|
-
element.setStyle({ position: 'relative' });
|
2247
|
-
var value = proceed(element);
|
2248
|
-
element.setStyle({ position: position });
|
2249
|
-
return value;
|
2250
|
-
}
|
2251
|
-
);
|
2252
|
-
});
|
2253
|
-
|
2254
|
-
Element.Methods.getStyle = function(element, style) {
|
2255
|
-
element = $(element);
|
2256
|
-
style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
|
2257
|
-
var value = element.style[style];
|
2258
|
-
if (!value && element.currentStyle) value = element.currentStyle[style];
|
2259
|
-
|
2260
|
-
if (style == 'opacity') {
|
2261
|
-
if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
|
2262
|
-
if (value[1]) return parseFloat(value[1]) / 100;
|
2263
|
-
return 1.0;
|
2264
|
-
}
|
2265
|
-
|
2266
|
-
if (value == 'auto') {
|
2267
|
-
if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
|
2268
|
-
return element['offset' + style.capitalize()] + 'px';
|
2269
|
-
return null;
|
2270
|
-
}
|
2271
|
-
return value;
|
2272
|
-
};
|
2273
|
-
|
2274
|
-
Element.Methods.setOpacity = function(element, value) {
|
2275
|
-
function stripAlpha(filter){
|
2276
|
-
return filter.replace(/alpha\([^\)]*\)/gi,'');
|
2277
|
-
}
|
2278
|
-
element = $(element);
|
2279
|
-
var currentStyle = element.currentStyle;
|
2280
|
-
if ((currentStyle && !currentStyle.hasLayout) ||
|
2281
|
-
(!currentStyle && element.style.zoom == 'normal'))
|
2282
|
-
element.style.zoom = 1;
|
2283
|
-
|
2284
|
-
var filter = element.getStyle('filter'), style = element.style;
|
2285
|
-
if (value == 1 || value === '') {
|
2286
|
-
(filter = stripAlpha(filter)) ?
|
2287
|
-
style.filter = filter : style.removeAttribute('filter');
|
2288
|
-
return element;
|
2289
|
-
} else if (value < 0.00001) value = 0;
|
2290
|
-
style.filter = stripAlpha(filter) +
|
2291
|
-
'alpha(opacity=' + (value * 100) + ')';
|
2292
|
-
return element;
|
2293
|
-
};
|
2294
|
-
|
2295
|
-
Element._attributeTranslations = {
|
2296
|
-
read: {
|
2297
|
-
names: {
|
2298
|
-
'class': 'className',
|
2299
|
-
'for': 'htmlFor'
|
2300
|
-
},
|
2301
|
-
values: {
|
2302
|
-
_getAttr: function(element, attribute) {
|
2303
|
-
return element.getAttribute(attribute, 2);
|
2304
|
-
},
|
2305
|
-
_getAttrNode: function(element, attribute) {
|
2306
|
-
var node = element.getAttributeNode(attribute);
|
2307
|
-
return node ? node.value : "";
|
2308
|
-
},
|
2309
|
-
_getEv: function(element, attribute) {
|
2310
|
-
attribute = element.getAttribute(attribute);
|
2311
|
-
return attribute ? attribute.toString().slice(23, -2) : null;
|
2312
|
-
},
|
2313
|
-
_flag: function(element, attribute) {
|
2314
|
-
return $(element).hasAttribute(attribute) ? attribute : null;
|
2315
|
-
},
|
2316
|
-
style: function(element) {
|
2317
|
-
return element.style.cssText.toLowerCase();
|
2318
|
-
},
|
2319
|
-
title: function(element) {
|
2320
|
-
return element.title;
|
2321
|
-
}
|
2322
|
-
}
|
2323
|
-
}
|
2324
|
-
};
|
2325
|
-
|
2326
|
-
Element._attributeTranslations.write = {
|
2327
|
-
names: Object.clone(Element._attributeTranslations.read.names),
|
2328
|
-
values: {
|
2329
|
-
checked: function(element, value) {
|
2330
|
-
element.checked = !!value;
|
2331
|
-
},
|
2332
|
-
|
2333
|
-
style: function(element, value) {
|
2334
|
-
element.style.cssText = value ? value : '';
|
2335
|
-
}
|
2336
|
-
}
|
2337
|
-
};
|
2338
|
-
|
2339
|
-
Element._attributeTranslations.has = {};
|
2340
|
-
|
2341
|
-
$w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
|
2342
|
-
'encType maxLength readOnly longDesc').each(function(attr) {
|
2343
|
-
Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
|
2344
|
-
Element._attributeTranslations.has[attr.toLowerCase()] = attr;
|
2345
|
-
});
|
2346
|
-
|
2347
|
-
(function(v) {
|
2348
|
-
Object.extend(v, {
|
2349
|
-
href: v._getAttr,
|
2350
|
-
src: v._getAttr,
|
2351
|
-
type: v._getAttr,
|
2352
|
-
action: v._getAttrNode,
|
2353
|
-
disabled: v._flag,
|
2354
|
-
checked: v._flag,
|
2355
|
-
readonly: v._flag,
|
2356
|
-
multiple: v._flag,
|
2357
|
-
onload: v._getEv,
|
2358
|
-
onunload: v._getEv,
|
2359
|
-
onclick: v._getEv,
|
2360
|
-
ondblclick: v._getEv,
|
2361
|
-
onmousedown: v._getEv,
|
2362
|
-
onmouseup: v._getEv,
|
2363
|
-
onmouseover: v._getEv,
|
2364
|
-
onmousemove: v._getEv,
|
2365
|
-
onmouseout: v._getEv,
|
2366
|
-
onfocus: v._getEv,
|
2367
|
-
onblur: v._getEv,
|
2368
|
-
onkeypress: v._getEv,
|
2369
|
-
onkeydown: v._getEv,
|
2370
|
-
onkeyup: v._getEv,
|
2371
|
-
onsubmit: v._getEv,
|
2372
|
-
onreset: v._getEv,
|
2373
|
-
onselect: v._getEv,
|
2374
|
-
onchange: v._getEv
|
2375
|
-
});
|
2376
|
-
})(Element._attributeTranslations.read.values);
|
2377
|
-
}
|
2378
|
-
|
2379
|
-
else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
|
2380
|
-
Element.Methods.setOpacity = function(element, value) {
|
2381
|
-
element = $(element);
|
2382
|
-
element.style.opacity = (value == 1) ? 0.999999 :
|
2383
|
-
(value === '') ? '' : (value < 0.00001) ? 0 : value;
|
2384
|
-
return element;
|
2385
|
-
};
|
2386
|
-
}
|
2387
|
-
|
2388
|
-
else if (Prototype.Browser.WebKit) {
|
2389
|
-
Element.Methods.setOpacity = function(element, value) {
|
2390
|
-
element = $(element);
|
2391
|
-
element.style.opacity = (value == 1 || value === '') ? '' :
|
2392
|
-
(value < 0.00001) ? 0 : value;
|
2393
|
-
|
2394
|
-
if (value == 1)
|
2395
|
-
if(element.tagName == 'IMG' && element.width) {
|
2396
|
-
element.width++; element.width--;
|
2397
|
-
} else try {
|
2398
|
-
var n = document.createTextNode(' ');
|
2399
|
-
element.appendChild(n);
|
2400
|
-
element.removeChild(n);
|
2401
|
-
} catch (e) { }
|
2402
|
-
|
2403
|
-
return element;
|
2404
|
-
};
|
2405
|
-
|
2406
|
-
// Safari returns margins on body which is incorrect if the child is absolutely
|
2407
|
-
// positioned. For performance reasons, redefine Element#cumulativeOffset for
|
2408
|
-
// KHTML/WebKit only.
|
2409
|
-
Element.Methods.cumulativeOffset = function(element) {
|
2410
|
-
var valueT = 0, valueL = 0;
|
2411
|
-
do {
|
2412
|
-
valueT += element.offsetTop || 0;
|
2413
|
-
valueL += element.offsetLeft || 0;
|
2414
|
-
if (element.offsetParent == document.body)
|
2415
|
-
if (Element.getStyle(element, 'position') == 'absolute') break;
|
2416
|
-
|
2417
|
-
element = element.offsetParent;
|
2418
|
-
} while (element);
|
2419
|
-
|
2420
|
-
return Element._returnOffset(valueL, valueT);
|
2421
|
-
};
|
2422
|
-
}
|
2423
|
-
|
2424
|
-
if (Prototype.Browser.IE || Prototype.Browser.Opera) {
|
2425
|
-
// IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
|
2426
|
-
Element.Methods.update = function(element, content) {
|
2427
|
-
element = $(element);
|
2428
|
-
|
2429
|
-
if (content && content.toElement) content = content.toElement();
|
2430
|
-
if (Object.isElement(content)) return element.update().insert(content);
|
2431
|
-
|
2432
|
-
content = Object.toHTML(content);
|
2433
|
-
var tagName = element.tagName.toUpperCase();
|
2434
|
-
|
2435
|
-
if (tagName in Element._insertionTranslations.tags) {
|
2436
|
-
$A(element.childNodes).each(function(node) { element.removeChild(node) });
|
2437
|
-
Element._getContentFromAnonymousElement(tagName, content.stripScripts())
|
2438
|
-
.each(function(node) { element.appendChild(node) });
|
2439
|
-
}
|
2440
|
-
else element.innerHTML = content.stripScripts();
|
2441
|
-
|
2442
|
-
content.evalScripts.bind(content).defer();
|
2443
|
-
return element;
|
2444
|
-
};
|
2445
|
-
}
|
2446
|
-
|
2447
|
-
if (document.createElement('div').outerHTML) {
|
2448
|
-
Element.Methods.replace = function(element, content) {
|
2449
|
-
element = $(element);
|
2450
|
-
|
2451
|
-
if (content && content.toElement) content = content.toElement();
|
2452
|
-
if (Object.isElement(content)) {
|
2453
|
-
element.parentNode.replaceChild(content, element);
|
2454
|
-
return element;
|
2455
|
-
}
|
2456
|
-
|
2457
|
-
content = Object.toHTML(content);
|
2458
|
-
var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
|
2459
|
-
|
2460
|
-
if (Element._insertionTranslations.tags[tagName]) {
|
2461
|
-
var nextSibling = element.next();
|
2462
|
-
var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
|
2463
|
-
parent.removeChild(element);
|
2464
|
-
if (nextSibling)
|
2465
|
-
fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
|
2466
|
-
else
|
2467
|
-
fragments.each(function(node) { parent.appendChild(node) });
|
2468
|
-
}
|
2469
|
-
else element.outerHTML = content.stripScripts();
|
2470
|
-
|
2471
|
-
content.evalScripts.bind(content).defer();
|
2472
|
-
return element;
|
2473
|
-
};
|
2474
|
-
}
|
2475
|
-
|
2476
|
-
Element._returnOffset = function(l, t) {
|
2477
|
-
var result = [l, t];
|
2478
|
-
result.left = l;
|
2479
|
-
result.top = t;
|
2480
|
-
return result;
|
2481
|
-
};
|
2482
|
-
|
2483
|
-
Element._getContentFromAnonymousElement = function(tagName, html) {
|
2484
|
-
var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
|
2485
|
-
div.innerHTML = t[0] + html + t[1];
|
2486
|
-
t[2].times(function() { div = div.firstChild });
|
2487
|
-
return $A(div.childNodes);
|
2488
|
-
};
|
2489
|
-
|
2490
|
-
Element._insertionTranslations = {
|
2491
|
-
before: {
|
2492
|
-
adjacency: 'beforeBegin',
|
2493
|
-
insert: function(element, node) {
|
2494
|
-
element.parentNode.insertBefore(node, element);
|
2495
|
-
},
|
2496
|
-
initializeRange: function(element, range) {
|
2497
|
-
range.setStartBefore(element);
|
2498
|
-
}
|
2499
|
-
},
|
2500
|
-
top: {
|
2501
|
-
adjacency: 'afterBegin',
|
2502
|
-
insert: function(element, node) {
|
2503
|
-
element.insertBefore(node, element.firstChild);
|
2504
|
-
},
|
2505
|
-
initializeRange: function(element, range) {
|
2506
|
-
range.selectNodeContents(element);
|
2507
|
-
range.collapse(true);
|
2508
|
-
}
|
2509
|
-
},
|
2510
|
-
bottom: {
|
2511
|
-
adjacency: 'beforeEnd',
|
2512
|
-
insert: function(element, node) {
|
2513
|
-
element.appendChild(node);
|
2514
|
-
}
|
2515
|
-
},
|
2516
|
-
after: {
|
2517
|
-
adjacency: 'afterEnd',
|
2518
|
-
insert: function(element, node) {
|
2519
|
-
element.parentNode.insertBefore(node, element.nextSibling);
|
2520
|
-
},
|
2521
|
-
initializeRange: function(element, range) {
|
2522
|
-
range.setStartAfter(element);
|
2523
|
-
}
|
2524
|
-
},
|
2525
|
-
tags: {
|
2526
|
-
TABLE: ['<table>', '</table>', 1],
|
2527
|
-
TBODY: ['<table><tbody>', '</tbody></table>', 2],
|
2528
|
-
TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
|
2529
|
-
TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
|
2530
|
-
SELECT: ['<select>', '</select>', 1]
|
2531
|
-
}
|
2532
|
-
};
|
2533
|
-
|
2534
|
-
(function() {
|
2535
|
-
this.bottom.initializeRange = this.top.initializeRange;
|
2536
|
-
Object.extend(this.tags, {
|
2537
|
-
THEAD: this.tags.TBODY,
|
2538
|
-
TFOOT: this.tags.TBODY,
|
2539
|
-
TH: this.tags.TD
|
2540
|
-
});
|
2541
|
-
}).call(Element._insertionTranslations);
|
2542
|
-
|
2543
|
-
Element.Methods.Simulated = {
|
2544
|
-
hasAttribute: function(element, attribute) {
|
2545
|
-
attribute = Element._attributeTranslations.has[attribute] || attribute;
|
2546
|
-
var node = $(element).getAttributeNode(attribute);
|
2547
|
-
return node && node.specified;
|
2548
|
-
}
|
2549
|
-
};
|
2550
|
-
|
2551
|
-
Element.Methods.ByTag = { };
|
2552
|
-
|
2553
|
-
Object.extend(Element, Element.Methods);
|
2554
|
-
|
2555
|
-
if (!Prototype.BrowserFeatures.ElementExtensions &&
|
2556
|
-
document.createElement('div').__proto__) {
|
2557
|
-
window.HTMLElement = { };
|
2558
|
-
window.HTMLElement.prototype = document.createElement('div').__proto__;
|
2559
|
-
Prototype.BrowserFeatures.ElementExtensions = true;
|
2560
|
-
}
|
2561
|
-
|
2562
|
-
Element.extend = (function() {
|
2563
|
-
if (Prototype.BrowserFeatures.SpecificElementExtensions)
|
2564
|
-
return Prototype.K;
|
2565
|
-
|
2566
|
-
var Methods = { }, ByTag = Element.Methods.ByTag;
|
2567
|
-
|
2568
|
-
var extend = Object.extend(function(element) {
|
2569
|
-
if (!element || element._extendedByPrototype ||
|
2570
|
-
element.nodeType != 1 || element == window) return element;
|
2571
|
-
|
2572
|
-
var methods = Object.clone(Methods),
|
2573
|
-
tagName = element.tagName, property, value;
|
2574
|
-
|
2575
|
-
// extend methods for specific tags
|
2576
|
-
if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
|
2577
|
-
|
2578
|
-
for (property in methods) {
|
2579
|
-
value = methods[property];
|
2580
|
-
if (Object.isFunction(value) && !(property in element))
|
2581
|
-
element[property] = value.methodize();
|
2582
|
-
}
|
2583
|
-
|
2584
|
-
element._extendedByPrototype = Prototype.emptyFunction;
|
2585
|
-
return element;
|
2586
|
-
|
2587
|
-
}, {
|
2588
|
-
refresh: function() {
|
2589
|
-
// extend methods for all tags (Safari doesn't need this)
|
2590
|
-
if (!Prototype.BrowserFeatures.ElementExtensions) {
|
2591
|
-
Object.extend(Methods, Element.Methods);
|
2592
|
-
Object.extend(Methods, Element.Methods.Simulated);
|
2593
|
-
}
|
2594
|
-
}
|
2595
|
-
});
|
2596
|
-
|
2597
|
-
extend.refresh();
|
2598
|
-
return extend;
|
2599
|
-
})();
|
2600
|
-
|
2601
|
-
Element.hasAttribute = function(element, attribute) {
|
2602
|
-
if (element.hasAttribute) return element.hasAttribute(attribute);
|
2603
|
-
return Element.Methods.Simulated.hasAttribute(element, attribute);
|
2604
|
-
};
|
2605
|
-
|
2606
|
-
Element.addMethods = function(methods) {
|
2607
|
-
var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
|
2608
|
-
|
2609
|
-
if (!methods) {
|
2610
|
-
Object.extend(Form, Form.Methods);
|
2611
|
-
Object.extend(Form.Element, Form.Element.Methods);
|
2612
|
-
Object.extend(Element.Methods.ByTag, {
|
2613
|
-
"FORM": Object.clone(Form.Methods),
|
2614
|
-
"INPUT": Object.clone(Form.Element.Methods),
|
2615
|
-
"SELECT": Object.clone(Form.Element.Methods),
|
2616
|
-
"TEXTAREA": Object.clone(Form.Element.Methods)
|
2617
|
-
});
|
2618
|
-
}
|
2619
|
-
|
2620
|
-
if (arguments.length == 2) {
|
2621
|
-
var tagName = methods;
|
2622
|
-
methods = arguments[1];
|
2623
|
-
}
|
2624
|
-
|
2625
|
-
if (!tagName) Object.extend(Element.Methods, methods || { });
|
2626
|
-
else {
|
2627
|
-
if (Object.isArray(tagName)) tagName.each(extend);
|
2628
|
-
else extend(tagName);
|
2629
|
-
}
|
2630
|
-
|
2631
|
-
function extend(tagName) {
|
2632
|
-
tagName = tagName.toUpperCase();
|
2633
|
-
if (!Element.Methods.ByTag[tagName])
|
2634
|
-
Element.Methods.ByTag[tagName] = { };
|
2635
|
-
Object.extend(Element.Methods.ByTag[tagName], methods);
|
2636
|
-
}
|
2637
|
-
|
2638
|
-
function copy(methods, destination, onlyIfAbsent) {
|
2639
|
-
onlyIfAbsent = onlyIfAbsent || false;
|
2640
|
-
for (var property in methods) {
|
2641
|
-
var value = methods[property];
|
2642
|
-
if (!Object.isFunction(value)) continue;
|
2643
|
-
if (!onlyIfAbsent || !(property in destination))
|
2644
|
-
destination[property] = value.methodize();
|
2645
|
-
}
|
2646
|
-
}
|
2647
|
-
|
2648
|
-
function findDOMClass(tagName) {
|
2649
|
-
var klass;
|
2650
|
-
var trans = {
|
2651
|
-
"OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
|
2652
|
-
"FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
|
2653
|
-
"DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
|
2654
|
-
"H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
|
2655
|
-
"INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
|
2656
|
-
"TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
|
2657
|
-
"TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
|
2658
|
-
"TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
|
2659
|
-
"FrameSet", "IFRAME": "IFrame"
|
2660
|
-
};
|
2661
|
-
if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
|
2662
|
-
if (window[klass]) return window[klass];
|
2663
|
-
klass = 'HTML' + tagName + 'Element';
|
2664
|
-
if (window[klass]) return window[klass];
|
2665
|
-
klass = 'HTML' + tagName.capitalize() + 'Element';
|
2666
|
-
if (window[klass]) return window[klass];
|
2667
|
-
|
2668
|
-
window[klass] = { };
|
2669
|
-
window[klass].prototype = document.createElement(tagName).__proto__;
|
2670
|
-
return window[klass];
|
2671
|
-
}
|
2672
|
-
|
2673
|
-
if (F.ElementExtensions) {
|
2674
|
-
copy(Element.Methods, HTMLElement.prototype);
|
2675
|
-
copy(Element.Methods.Simulated, HTMLElement.prototype, true);
|
2676
|
-
}
|
2677
|
-
|
2678
|
-
if (F.SpecificElementExtensions) {
|
2679
|
-
for (var tag in Element.Methods.ByTag) {
|
2680
|
-
var klass = findDOMClass(tag);
|
2681
|
-
if (Object.isUndefined(klass)) continue;
|
2682
|
-
copy(T[tag], klass.prototype);
|
2683
|
-
}
|
2684
|
-
}
|
2685
|
-
|
2686
|
-
Object.extend(Element, Element.Methods);
|
2687
|
-
delete Element.ByTag;
|
2688
|
-
|
2689
|
-
if (Element.extend.refresh) Element.extend.refresh();
|
2690
|
-
Element.cache = { };
|
2691
|
-
};
|
2692
|
-
|
2693
|
-
document.viewport = {
|
2694
|
-
getDimensions: function() {
|
2695
|
-
var dimensions = { };
|
2696
|
-
var B = Prototype.Browser;
|
2697
|
-
$w('width height').each(function(d) {
|
2698
|
-
var D = d.capitalize();
|
2699
|
-
dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] :
|
2700
|
-
(B.Opera) ? document.body['client' + D] : document.documentElement['client' + D];
|
2701
|
-
});
|
2702
|
-
return dimensions;
|
2703
|
-
},
|
2704
|
-
|
2705
|
-
getWidth: function() {
|
2706
|
-
return this.getDimensions().width;
|
2707
|
-
},
|
2708
|
-
|
2709
|
-
getHeight: function() {
|
2710
|
-
return this.getDimensions().height;
|
2711
|
-
},
|
2712
|
-
|
2713
|
-
getScrollOffsets: function() {
|
2714
|
-
return Element._returnOffset(
|
2715
|
-
window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
|
2716
|
-
window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
|
2717
|
-
}
|
2718
|
-
};
|
2719
|
-
/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
|
2720
|
-
* part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
|
2721
|
-
* license. Please see http://www.yui-ext.com/ for more information. */
|
2722
|
-
|
2723
|
-
var Selector = Class.create({
|
2724
|
-
initialize: function(expression) {
|
2725
|
-
this.expression = expression.strip();
|
2726
|
-
this.compileMatcher();
|
2727
|
-
},
|
2728
|
-
|
2729
|
-
shouldUseXPath: function() {
|
2730
|
-
if (!Prototype.BrowserFeatures.XPath) return false;
|
2731
|
-
|
2732
|
-
var e = this.expression;
|
2733
|
-
|
2734
|
-
// Safari 3 chokes on :*-of-type and :empty
|
2735
|
-
if (Prototype.Browser.WebKit &&
|
2736
|
-
(e.include("-of-type") || e.include(":empty")))
|
2737
|
-
return false;
|
2738
|
-
|
2739
|
-
// XPath can't do namespaced attributes, nor can it read
|
2740
|
-
// the "checked" property from DOM nodes
|
2741
|
-
if ((/(\[[\w-]*?:|:checked)/).test(this.expression))
|
2742
|
-
return false;
|
2743
|
-
|
2744
|
-
return true;
|
2745
|
-
},
|
2746
|
-
|
2747
|
-
compileMatcher: function() {
|
2748
|
-
if (this.shouldUseXPath())
|
2749
|
-
return this.compileXPathMatcher();
|
2750
|
-
|
2751
|
-
var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
|
2752
|
-
c = Selector.criteria, le, p, m;
|
2753
|
-
|
2754
|
-
if (Selector._cache[e]) {
|
2755
|
-
this.matcher = Selector._cache[e];
|
2756
|
-
return;
|
2757
|
-
}
|
2758
|
-
|
2759
|
-
this.matcher = ["this.matcher = function(root) {",
|
2760
|
-
"var r = root, h = Selector.handlers, c = false, n;"];
|
2761
|
-
|
2762
|
-
while (e && le != e && (/\S/).test(e)) {
|
2763
|
-
le = e;
|
2764
|
-
for (var i in ps) {
|
2765
|
-
p = ps[i];
|
2766
|
-
if (m = e.match(p)) {
|
2767
|
-
this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
|
2768
|
-
new Template(c[i]).evaluate(m));
|
2769
|
-
e = e.replace(m[0], '');
|
2770
|
-
break;
|
2771
|
-
}
|
2772
|
-
}
|
2773
|
-
}
|
2774
|
-
|
2775
|
-
this.matcher.push("return h.unique(n);\n}");
|
2776
|
-
eval(this.matcher.join('\n'));
|
2777
|
-
Selector._cache[this.expression] = this.matcher;
|
2778
|
-
},
|
2779
|
-
|
2780
|
-
compileXPathMatcher: function() {
|
2781
|
-
var e = this.expression, ps = Selector.patterns,
|
2782
|
-
x = Selector.xpath, le, m;
|
2783
|
-
|
2784
|
-
if (Selector._cache[e]) {
|
2785
|
-
this.xpath = Selector._cache[e]; return;
|
2786
|
-
}
|
2787
|
-
|
2788
|
-
this.matcher = ['.//*'];
|
2789
|
-
while (e && le != e && (/\S/).test(e)) {
|
2790
|
-
le = e;
|
2791
|
-
for (var i in ps) {
|
2792
|
-
if (m = e.match(ps[i])) {
|
2793
|
-
this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
|
2794
|
-
new Template(x[i]).evaluate(m));
|
2795
|
-
e = e.replace(m[0], '');
|
2796
|
-
break;
|
2797
|
-
}
|
2798
|
-
}
|
2799
|
-
}
|
2800
|
-
|
2801
|
-
this.xpath = this.matcher.join('');
|
2802
|
-
Selector._cache[this.expression] = this.xpath;
|
2803
|
-
},
|
2804
|
-
|
2805
|
-
findElements: function(root) {
|
2806
|
-
root = root || document;
|
2807
|
-
if (this.xpath) return document._getElementsByXPath(this.xpath, root);
|
2808
|
-
return this.matcher(root);
|
2809
|
-
},
|
2810
|
-
|
2811
|
-
match: function(element) {
|
2812
|
-
this.tokens = [];
|
2813
|
-
|
2814
|
-
var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
|
2815
|
-
var le, p, m;
|
2816
|
-
|
2817
|
-
while (e && le !== e && (/\S/).test(e)) {
|
2818
|
-
le = e;
|
2819
|
-
for (var i in ps) {
|
2820
|
-
p = ps[i];
|
2821
|
-
if (m = e.match(p)) {
|
2822
|
-
// use the Selector.assertions methods unless the selector
|
2823
|
-
// is too complex.
|
2824
|
-
if (as[i]) {
|
2825
|
-
this.tokens.push([i, Object.clone(m)]);
|
2826
|
-
e = e.replace(m[0], '');
|
2827
|
-
} else {
|
2828
|
-
// reluctantly do a document-wide search
|
2829
|
-
// and look for a match in the array
|
2830
|
-
return this.findElements(document).include(element);
|
2831
|
-
}
|
2832
|
-
}
|
2833
|
-
}
|
2834
|
-
}
|
2835
|
-
|
2836
|
-
var match = true, name, matches;
|
2837
|
-
for (var i = 0, token; token = this.tokens[i]; i++) {
|
2838
|
-
name = token[0], matches = token[1];
|
2839
|
-
if (!Selector.assertions[name](element, matches)) {
|
2840
|
-
match = false; break;
|
2841
|
-
}
|
2842
|
-
}
|
2843
|
-
|
2844
|
-
return match;
|
2845
|
-
},
|
2846
|
-
|
2847
|
-
toString: function() {
|
2848
|
-
return this.expression;
|
2849
|
-
},
|
2850
|
-
|
2851
|
-
inspect: function() {
|
2852
|
-
return "#<Selector:" + this.expression.inspect() + ">";
|
2853
|
-
}
|
2854
|
-
});
|
2855
|
-
|
2856
|
-
Object.extend(Selector, {
|
2857
|
-
_cache: { },
|
2858
|
-
|
2859
|
-
xpath: {
|
2860
|
-
descendant: "//*",
|
2861
|
-
child: "/*",
|
2862
|
-
adjacent: "/following-sibling::*[1]",
|
2863
|
-
laterSibling: '/following-sibling::*',
|
2864
|
-
tagName: function(m) {
|
2865
|
-
if (m[1] == '*') return '';
|
2866
|
-
return "[local-name()='" + m[1].toLowerCase() +
|
2867
|
-
"' or local-name()='" + m[1].toUpperCase() + "']";
|
2868
|
-
},
|
2869
|
-
className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
|
2870
|
-
id: "[@id='#{1}']",
|
2871
|
-
attrPresence: function(m) {
|
2872
|
-
m[1] = m[1].toLowerCase();
|
2873
|
-
return new Template("[@#{1}]").evaluate(m);
|
2874
|
-
},
|
2875
|
-
attr: function(m) {
|
2876
|
-
m[1] = m[1].toLowerCase();
|
2877
|
-
m[3] = m[5] || m[6];
|
2878
|
-
return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
|
2879
|
-
},
|
2880
|
-
pseudo: function(m) {
|
2881
|
-
var h = Selector.xpath.pseudos[m[1]];
|
2882
|
-
if (!h) return '';
|
2883
|
-
if (Object.isFunction(h)) return h(m);
|
2884
|
-
return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
|
2885
|
-
},
|
2886
|
-
operators: {
|
2887
|
-
'=': "[@#{1}='#{3}']",
|
2888
|
-
'!=': "[@#{1}!='#{3}']",
|
2889
|
-
'^=': "[starts-with(@#{1}, '#{3}')]",
|
2890
|
-
'$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
|
2891
|
-
'*=': "[contains(@#{1}, '#{3}')]",
|
2892
|
-
'~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
|
2893
|
-
'|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
|
2894
|
-
},
|
2895
|
-
pseudos: {
|
2896
|
-
'first-child': '[not(preceding-sibling::*)]',
|
2897
|
-
'last-child': '[not(following-sibling::*)]',
|
2898
|
-
'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
|
2899
|
-
'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
|
2900
|
-
'checked': "[@checked]",
|
2901
|
-
'disabled': "[@disabled]",
|
2902
|
-
'enabled': "[not(@disabled)]",
|
2903
|
-
'not': function(m) {
|
2904
|
-
var e = m[6], p = Selector.patterns,
|
2905
|
-
x = Selector.xpath, le, v;
|
2906
|
-
|
2907
|
-
var exclusion = [];
|
2908
|
-
while (e && le != e && (/\S/).test(e)) {
|
2909
|
-
le = e;
|
2910
|
-
for (var i in p) {
|
2911
|
-
if (m = e.match(p[i])) {
|
2912
|
-
v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
|
2913
|
-
exclusion.push("(" + v.substring(1, v.length - 1) + ")");
|
2914
|
-
e = e.replace(m[0], '');
|
2915
|
-
break;
|
2916
|
-
}
|
2917
|
-
}
|
2918
|
-
}
|
2919
|
-
return "[not(" + exclusion.join(" and ") + ")]";
|
2920
|
-
},
|
2921
|
-
'nth-child': function(m) {
|
2922
|
-
return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
|
2923
|
-
},
|
2924
|
-
'nth-last-child': function(m) {
|
2925
|
-
return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
|
2926
|
-
},
|
2927
|
-
'nth-of-type': function(m) {
|
2928
|
-
return Selector.xpath.pseudos.nth("position() ", m);
|
2929
|
-
},
|
2930
|
-
'nth-last-of-type': function(m) {
|
2931
|
-
return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
|
2932
|
-
},
|
2933
|
-
'first-of-type': function(m) {
|
2934
|
-
m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
|
2935
|
-
},
|
2936
|
-
'last-of-type': function(m) {
|
2937
|
-
m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
|
2938
|
-
},
|
2939
|
-
'only-of-type': function(m) {
|
2940
|
-
var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
|
2941
|
-
},
|
2942
|
-
nth: function(fragment, m) {
|
2943
|
-
var mm, formula = m[6], predicate;
|
2944
|
-
if (formula == 'even') formula = '2n+0';
|
2945
|
-
if (formula == 'odd') formula = '2n+1';
|
2946
|
-
if (mm = formula.match(/^(\d+)$/)) // digit only
|
2947
|
-
return '[' + fragment + "= " + mm[1] + ']';
|
2948
|
-
if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
|
2949
|
-
if (mm[1] == "-") mm[1] = -1;
|
2950
|
-
var a = mm[1] ? Number(mm[1]) : 1;
|
2951
|
-
var b = mm[2] ? Number(mm[2]) : 0;
|
2952
|
-
predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
|
2953
|
-
"((#{fragment} - #{b}) div #{a} >= 0)]";
|
2954
|
-
return new Template(predicate).evaluate({
|
2955
|
-
fragment: fragment, a: a, b: b });
|
2956
|
-
}
|
2957
|
-
}
|
2958
|
-
}
|
2959
|
-
},
|
2960
|
-
|
2961
|
-
criteria: {
|
2962
|
-
tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
|
2963
|
-
className: 'n = h.className(n, r, "#{1}", c); c = false;',
|
2964
|
-
id: 'n = h.id(n, r, "#{1}", c); c = false;',
|
2965
|
-
attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
|
2966
|
-
attr: function(m) {
|
2967
|
-
m[3] = (m[5] || m[6]);
|
2968
|
-
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
|
2969
|
-
},
|
2970
|
-
pseudo: function(m) {
|
2971
|
-
if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
|
2972
|
-
return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
|
2973
|
-
},
|
2974
|
-
descendant: 'c = "descendant";',
|
2975
|
-
child: 'c = "child";',
|
2976
|
-
adjacent: 'c = "adjacent";',
|
2977
|
-
laterSibling: 'c = "laterSibling";'
|
2978
|
-
},
|
2979
|
-
|
2980
|
-
patterns: {
|
2981
|
-
// combinators must be listed first
|
2982
|
-
// (and descendant needs to be last combinator)
|
2983
|
-
laterSibling: /^\s*~\s*/,
|
2984
|
-
child: /^\s*>\s*/,
|
2985
|
-
adjacent: /^\s*\+\s*/,
|
2986
|
-
descendant: /^\s/,
|
2987
|
-
|
2988
|
-
// selectors follow
|
2989
|
-
tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
|
2990
|
-
id: /^#([\w\-\*]+)(\b|$)/,
|
2991
|
-
className: /^\.([\w\-\*]+)(\b|$)/,
|
2992
|
-
pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,
|
2993
|
-
attrPresence: /^\[([\w]+)\]/,
|
2994
|
-
attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
|
2995
|
-
},
|
2996
|
-
|
2997
|
-
// for Selector.match and Element#match
|
2998
|
-
assertions: {
|
2999
|
-
tagName: function(element, matches) {
|
3000
|
-
return matches[1].toUpperCase() == element.tagName.toUpperCase();
|
3001
|
-
},
|
3002
|
-
|
3003
|
-
className: function(element, matches) {
|
3004
|
-
return Element.hasClassName(element, matches[1]);
|
3005
|
-
},
|
3006
|
-
|
3007
|
-
id: function(element, matches) {
|
3008
|
-
return element.id === matches[1];
|
3009
|
-
},
|
3010
|
-
|
3011
|
-
attrPresence: function(element, matches) {
|
3012
|
-
return Element.hasAttribute(element, matches[1]);
|
3013
|
-
},
|
3014
|
-
|
3015
|
-
attr: function(element, matches) {
|
3016
|
-
var nodeValue = Element.readAttribute(element, matches[1]);
|
3017
|
-
return Selector.operators[matches[2]](nodeValue, matches[3]);
|
3018
|
-
}
|
3019
|
-
},
|
3020
|
-
|
3021
|
-
handlers: {
|
3022
|
-
// UTILITY FUNCTIONS
|
3023
|
-
// joins two collections
|
3024
|
-
concat: function(a, b) {
|
3025
|
-
for (var i = 0, node; node = b[i]; i++)
|
3026
|
-
a.push(node);
|
3027
|
-
return a;
|
3028
|
-
},
|
3029
|
-
|
3030
|
-
// marks an array of nodes for counting
|
3031
|
-
mark: function(nodes) {
|
3032
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3033
|
-
node._counted = true;
|
3034
|
-
return nodes;
|
3035
|
-
},
|
3036
|
-
|
3037
|
-
unmark: function(nodes) {
|
3038
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3039
|
-
node._counted = undefined;
|
3040
|
-
return nodes;
|
3041
|
-
},
|
3042
|
-
|
3043
|
-
// mark each child node with its position (for nth calls)
|
3044
|
-
// "ofType" flag indicates whether we're indexing for nth-of-type
|
3045
|
-
// rather than nth-child
|
3046
|
-
index: function(parentNode, reverse, ofType) {
|
3047
|
-
parentNode._counted = true;
|
3048
|
-
if (reverse) {
|
3049
|
-
for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
|
3050
|
-
var node = nodes[i];
|
3051
|
-
if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
|
3052
|
-
}
|
3053
|
-
} else {
|
3054
|
-
for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
|
3055
|
-
if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
|
3056
|
-
}
|
3057
|
-
},
|
3058
|
-
|
3059
|
-
// filters out duplicates and extends all nodes
|
3060
|
-
unique: function(nodes) {
|
3061
|
-
if (nodes.length == 0) return nodes;
|
3062
|
-
var results = [], n;
|
3063
|
-
for (var i = 0, l = nodes.length; i < l; i++)
|
3064
|
-
if (!(n = nodes[i])._counted) {
|
3065
|
-
n._counted = true;
|
3066
|
-
results.push(Element.extend(n));
|
3067
|
-
}
|
3068
|
-
return Selector.handlers.unmark(results);
|
3069
|
-
},
|
3070
|
-
|
3071
|
-
// COMBINATOR FUNCTIONS
|
3072
|
-
descendant: function(nodes) {
|
3073
|
-
var h = Selector.handlers;
|
3074
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3075
|
-
h.concat(results, node.getElementsByTagName('*'));
|
3076
|
-
return results;
|
3077
|
-
},
|
3078
|
-
|
3079
|
-
child: function(nodes) {
|
3080
|
-
var h = Selector.handlers;
|
3081
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3082
|
-
for (var j = 0, child; child = node.childNodes[j]; j++)
|
3083
|
-
if (child.nodeType == 1 && child.tagName != '!') results.push(child);
|
3084
|
-
}
|
3085
|
-
return results;
|
3086
|
-
},
|
3087
|
-
|
3088
|
-
adjacent: function(nodes) {
|
3089
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3090
|
-
var next = this.nextElementSibling(node);
|
3091
|
-
if (next) results.push(next);
|
3092
|
-
}
|
3093
|
-
return results;
|
3094
|
-
},
|
3095
|
-
|
3096
|
-
laterSibling: function(nodes) {
|
3097
|
-
var h = Selector.handlers;
|
3098
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3099
|
-
h.concat(results, Element.nextSiblings(node));
|
3100
|
-
return results;
|
3101
|
-
},
|
3102
|
-
|
3103
|
-
nextElementSibling: function(node) {
|
3104
|
-
while (node = node.nextSibling)
|
3105
|
-
if (node.nodeType == 1) return node;
|
3106
|
-
return null;
|
3107
|
-
},
|
3108
|
-
|
3109
|
-
previousElementSibling: function(node) {
|
3110
|
-
while (node = node.previousSibling)
|
3111
|
-
if (node.nodeType == 1) return node;
|
3112
|
-
return null;
|
3113
|
-
},
|
3114
|
-
|
3115
|
-
// TOKEN FUNCTIONS
|
3116
|
-
tagName: function(nodes, root, tagName, combinator) {
|
3117
|
-
tagName = tagName.toUpperCase();
|
3118
|
-
var results = [], h = Selector.handlers;
|
3119
|
-
if (nodes) {
|
3120
|
-
if (combinator) {
|
3121
|
-
// fastlane for ordinary descendant combinators
|
3122
|
-
if (combinator == "descendant") {
|
3123
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3124
|
-
h.concat(results, node.getElementsByTagName(tagName));
|
3125
|
-
return results;
|
3126
|
-
} else nodes = this[combinator](nodes);
|
3127
|
-
if (tagName == "*") return nodes;
|
3128
|
-
}
|
3129
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3130
|
-
if (node.tagName.toUpperCase() == tagName) results.push(node);
|
3131
|
-
return results;
|
3132
|
-
} else return root.getElementsByTagName(tagName);
|
3133
|
-
},
|
3134
|
-
|
3135
|
-
id: function(nodes, root, id, combinator) {
|
3136
|
-
var targetNode = $(id), h = Selector.handlers;
|
3137
|
-
if (!targetNode) return [];
|
3138
|
-
if (!nodes && root == document) return [targetNode];
|
3139
|
-
if (nodes) {
|
3140
|
-
if (combinator) {
|
3141
|
-
if (combinator == 'child') {
|
3142
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3143
|
-
if (targetNode.parentNode == node) return [targetNode];
|
3144
|
-
} else if (combinator == 'descendant') {
|
3145
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3146
|
-
if (Element.descendantOf(targetNode, node)) return [targetNode];
|
3147
|
-
} else if (combinator == 'adjacent') {
|
3148
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3149
|
-
if (Selector.handlers.previousElementSibling(targetNode) == node)
|
3150
|
-
return [targetNode];
|
3151
|
-
} else nodes = h[combinator](nodes);
|
3152
|
-
}
|
3153
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3154
|
-
if (node == targetNode) return [targetNode];
|
3155
|
-
return [];
|
3156
|
-
}
|
3157
|
-
return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
|
3158
|
-
},
|
3159
|
-
|
3160
|
-
className: function(nodes, root, className, combinator) {
|
3161
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
3162
|
-
return Selector.handlers.byClassName(nodes, root, className);
|
3163
|
-
},
|
3164
|
-
|
3165
|
-
byClassName: function(nodes, root, className) {
|
3166
|
-
if (!nodes) nodes = Selector.handlers.descendant([root]);
|
3167
|
-
var needle = ' ' + className + ' ';
|
3168
|
-
for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
|
3169
|
-
nodeClassName = node.className;
|
3170
|
-
if (nodeClassName.length == 0) continue;
|
3171
|
-
if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
|
3172
|
-
results.push(node);
|
3173
|
-
}
|
3174
|
-
return results;
|
3175
|
-
},
|
3176
|
-
|
3177
|
-
attrPresence: function(nodes, root, attr) {
|
3178
|
-
if (!nodes) nodes = root.getElementsByTagName("*");
|
3179
|
-
var results = [];
|
3180
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3181
|
-
if (Element.hasAttribute(node, attr)) results.push(node);
|
3182
|
-
return results;
|
3183
|
-
},
|
3184
|
-
|
3185
|
-
attr: function(nodes, root, attr, value, operator) {
|
3186
|
-
if (!nodes) nodes = root.getElementsByTagName("*");
|
3187
|
-
var handler = Selector.operators[operator], results = [];
|
3188
|
-
for (var i = 0, node; node = nodes[i]; i++) {
|
3189
|
-
var nodeValue = Element.readAttribute(node, attr);
|
3190
|
-
if (nodeValue === null) continue;
|
3191
|
-
if (handler(nodeValue, value)) results.push(node);
|
3192
|
-
}
|
3193
|
-
return results;
|
3194
|
-
},
|
3195
|
-
|
3196
|
-
pseudo: function(nodes, name, value, root, combinator) {
|
3197
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
3198
|
-
if (!nodes) nodes = root.getElementsByTagName("*");
|
3199
|
-
return Selector.pseudos[name](nodes, value, root);
|
3200
|
-
}
|
3201
|
-
},
|
3202
|
-
|
3203
|
-
pseudos: {
|
3204
|
-
'first-child': function(nodes, value, root) {
|
3205
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3206
|
-
if (Selector.handlers.previousElementSibling(node)) continue;
|
3207
|
-
results.push(node);
|
3208
|
-
}
|
3209
|
-
return results;
|
3210
|
-
},
|
3211
|
-
'last-child': function(nodes, value, root) {
|
3212
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3213
|
-
if (Selector.handlers.nextElementSibling(node)) continue;
|
3214
|
-
results.push(node);
|
3215
|
-
}
|
3216
|
-
return results;
|
3217
|
-
},
|
3218
|
-
'only-child': function(nodes, value, root) {
|
3219
|
-
var h = Selector.handlers;
|
3220
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3221
|
-
if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
|
3222
|
-
results.push(node);
|
3223
|
-
return results;
|
3224
|
-
},
|
3225
|
-
'nth-child': function(nodes, formula, root) {
|
3226
|
-
return Selector.pseudos.nth(nodes, formula, root);
|
3227
|
-
},
|
3228
|
-
'nth-last-child': function(nodes, formula, root) {
|
3229
|
-
return Selector.pseudos.nth(nodes, formula, root, true);
|
3230
|
-
},
|
3231
|
-
'nth-of-type': function(nodes, formula, root) {
|
3232
|
-
return Selector.pseudos.nth(nodes, formula, root, false, true);
|
3233
|
-
},
|
3234
|
-
'nth-last-of-type': function(nodes, formula, root) {
|
3235
|
-
return Selector.pseudos.nth(nodes, formula, root, true, true);
|
3236
|
-
},
|
3237
|
-
'first-of-type': function(nodes, formula, root) {
|
3238
|
-
return Selector.pseudos.nth(nodes, "1", root, false, true);
|
3239
|
-
},
|
3240
|
-
'last-of-type': function(nodes, formula, root) {
|
3241
|
-
return Selector.pseudos.nth(nodes, "1", root, true, true);
|
3242
|
-
},
|
3243
|
-
'only-of-type': function(nodes, formula, root) {
|
3244
|
-
var p = Selector.pseudos;
|
3245
|
-
return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
|
3246
|
-
},
|
3247
|
-
|
3248
|
-
// handles the an+b logic
|
3249
|
-
getIndices: function(a, b, total) {
|
3250
|
-
if (a == 0) return b > 0 ? [b] : [];
|
3251
|
-
return $R(1, total).inject([], function(memo, i) {
|
3252
|
-
if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
|
3253
|
-
return memo;
|
3254
|
-
});
|
3255
|
-
},
|
3256
|
-
|
3257
|
-
// handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
|
3258
|
-
nth: function(nodes, formula, root, reverse, ofType) {
|
3259
|
-
if (nodes.length == 0) return [];
|
3260
|
-
if (formula == 'even') formula = '2n+0';
|
3261
|
-
if (formula == 'odd') formula = '2n+1';
|
3262
|
-
var h = Selector.handlers, results = [], indexed = [], m;
|
3263
|
-
h.mark(nodes);
|
3264
|
-
for (var i = 0, node; node = nodes[i]; i++) {
|
3265
|
-
if (!node.parentNode._counted) {
|
3266
|
-
h.index(node.parentNode, reverse, ofType);
|
3267
|
-
indexed.push(node.parentNode);
|
3268
|
-
}
|
3269
|
-
}
|
3270
|
-
if (formula.match(/^\d+$/)) { // just a number
|
3271
|
-
formula = Number(formula);
|
3272
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3273
|
-
if (node.nodeIndex == formula) results.push(node);
|
3274
|
-
} else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
|
3275
|
-
if (m[1] == "-") m[1] = -1;
|
3276
|
-
var a = m[1] ? Number(m[1]) : 1;
|
3277
|
-
var b = m[2] ? Number(m[2]) : 0;
|
3278
|
-
var indices = Selector.pseudos.getIndices(a, b, nodes.length);
|
3279
|
-
for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
|
3280
|
-
for (var j = 0; j < l; j++)
|
3281
|
-
if (node.nodeIndex == indices[j]) results.push(node);
|
3282
|
-
}
|
3283
|
-
}
|
3284
|
-
h.unmark(nodes);
|
3285
|
-
h.unmark(indexed);
|
3286
|
-
return results;
|
3287
|
-
},
|
3288
|
-
|
3289
|
-
'empty': function(nodes, value, root) {
|
3290
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3291
|
-
// IE treats comments as element nodes
|
3292
|
-
if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
|
3293
|
-
results.push(node);
|
3294
|
-
}
|
3295
|
-
return results;
|
3296
|
-
},
|
3297
|
-
|
3298
|
-
'not': function(nodes, selector, root) {
|
3299
|
-
var h = Selector.handlers, selectorType, m;
|
3300
|
-
var exclusions = new Selector(selector).findElements(root);
|
3301
|
-
h.mark(exclusions);
|
3302
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3303
|
-
if (!node._counted) results.push(node);
|
3304
|
-
h.unmark(exclusions);
|
3305
|
-
return results;
|
3306
|
-
},
|
3307
|
-
|
3308
|
-
'enabled': function(nodes, value, root) {
|
3309
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3310
|
-
if (!node.disabled) results.push(node);
|
3311
|
-
return results;
|
3312
|
-
},
|
3313
|
-
|
3314
|
-
'disabled': function(nodes, value, root) {
|
3315
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3316
|
-
if (node.disabled) results.push(node);
|
3317
|
-
return results;
|
3318
|
-
},
|
3319
|
-
|
3320
|
-
'checked': function(nodes, value, root) {
|
3321
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3322
|
-
if (node.checked) results.push(node);
|
3323
|
-
return results;
|
3324
|
-
}
|
3325
|
-
},
|
3326
|
-
|
3327
|
-
operators: {
|
3328
|
-
'=': function(nv, v) { return nv == v; },
|
3329
|
-
'!=': function(nv, v) { return nv != v; },
|
3330
|
-
'^=': function(nv, v) { return nv.startsWith(v); },
|
3331
|
-
'$=': function(nv, v) { return nv.endsWith(v); },
|
3332
|
-
'*=': function(nv, v) { return nv.include(v); },
|
3333
|
-
'~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
|
3334
|
-
'|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
|
3335
|
-
},
|
3336
|
-
|
3337
|
-
matchElements: function(elements, expression) {
|
3338
|
-
var matches = new Selector(expression).findElements(), h = Selector.handlers;
|
3339
|
-
h.mark(matches);
|
3340
|
-
for (var i = 0, results = [], element; element = elements[i]; i++)
|
3341
|
-
if (element._counted) results.push(element);
|
3342
|
-
h.unmark(matches);
|
3343
|
-
return results;
|
3344
|
-
},
|
3345
|
-
|
3346
|
-
findElement: function(elements, expression, index) {
|
3347
|
-
if (Object.isNumber(expression)) {
|
3348
|
-
index = expression; expression = false;
|
3349
|
-
}
|
3350
|
-
return Selector.matchElements(elements, expression || '*')[index || 0];
|
3351
|
-
},
|
3352
|
-
|
3353
|
-
findChildElements: function(element, expressions) {
|
3354
|
-
var exprs = expressions.join(',');
|
3355
|
-
expressions = [];
|
3356
|
-
exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
|
3357
|
-
expressions.push(m[1].strip());
|
3358
|
-
});
|
3359
|
-
var results = [], h = Selector.handlers;
|
3360
|
-
for (var i = 0, l = expressions.length, selector; i < l; i++) {
|
3361
|
-
selector = new Selector(expressions[i].strip());
|
3362
|
-
h.concat(results, selector.findElements(element));
|
3363
|
-
}
|
3364
|
-
return (l > 1) ? h.unique(results) : results;
|
3365
|
-
}
|
3366
|
-
});
|
3367
|
-
|
3368
|
-
if (Prototype.Browser.IE) {
|
3369
|
-
// IE returns comment nodes on getElementsByTagName("*").
|
3370
|
-
// Filter them out.
|
3371
|
-
Selector.handlers.concat = function(a, b) {
|
3372
|
-
for (var i = 0, node; node = b[i]; i++)
|
3373
|
-
if (node.tagName !== "!") a.push(node);
|
3374
|
-
return a;
|
3375
|
-
};
|
3376
|
-
}
|
3377
|
-
|
3378
|
-
function $$() {
|
3379
|
-
return Selector.findChildElements(document, $A(arguments));
|
3380
|
-
}
|
3381
|
-
var Form = {
|
3382
|
-
reset: function(form) {
|
3383
|
-
$(form).reset();
|
3384
|
-
return form;
|
3385
|
-
},
|
3386
|
-
|
3387
|
-
serializeElements: function(elements, options) {
|
3388
|
-
if (typeof options != 'object') options = { hash: !!options };
|
3389
|
-
else if (Object.isUndefined(options.hash)) options.hash = true;
|
3390
|
-
var key, value, submitted = false, submit = options.submit;
|
3391
|
-
|
3392
|
-
var data = elements.inject({ }, function(result, element) {
|
3393
|
-
if (!element.disabled && element.name) {
|
3394
|
-
key = element.name; value = $(element).getValue();
|
3395
|
-
if (value != null && (element.type != 'submit' || (!submitted &&
|
3396
|
-
submit !== false && (!submit || key == submit) && (submitted = true)))) {
|
3397
|
-
if (key in result) {
|
3398
|
-
// a key is already present; construct an array of values
|
3399
|
-
if (!Object.isArray(result[key])) result[key] = [result[key]];
|
3400
|
-
result[key].push(value);
|
3401
|
-
}
|
3402
|
-
else result[key] = value;
|
3403
|
-
}
|
3404
|
-
}
|
3405
|
-
return result;
|
3406
|
-
});
|
3407
|
-
|
3408
|
-
return options.hash ? data : Object.toQueryString(data);
|
3409
|
-
}
|
3410
|
-
};
|
3411
|
-
|
3412
|
-
Form.Methods = {
|
3413
|
-
serialize: function(form, options) {
|
3414
|
-
return Form.serializeElements(Form.getElements(form), options);
|
3415
|
-
},
|
3416
|
-
|
3417
|
-
getElements: function(form) {
|
3418
|
-
return $A($(form).getElementsByTagName('*')).inject([],
|
3419
|
-
function(elements, child) {
|
3420
|
-
if (Form.Element.Serializers[child.tagName.toLowerCase()])
|
3421
|
-
elements.push(Element.extend(child));
|
3422
|
-
return elements;
|
3423
|
-
}
|
3424
|
-
);
|
3425
|
-
},
|
3426
|
-
|
3427
|
-
getInputs: function(form, typeName, name) {
|
3428
|
-
form = $(form);
|
3429
|
-
var inputs = form.getElementsByTagName('input');
|
3430
|
-
|
3431
|
-
if (!typeName && !name) return $A(inputs).map(Element.extend);
|
3432
|
-
|
3433
|
-
for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
|
3434
|
-
var input = inputs[i];
|
3435
|
-
if ((typeName && input.type != typeName) || (name && input.name != name))
|
3436
|
-
continue;
|
3437
|
-
matchingInputs.push(Element.extend(input));
|
3438
|
-
}
|
3439
|
-
|
3440
|
-
return matchingInputs;
|
3441
|
-
},
|
3442
|
-
|
3443
|
-
disable: function(form) {
|
3444
|
-
form = $(form);
|
3445
|
-
Form.getElements(form).invoke('disable');
|
3446
|
-
return form;
|
3447
|
-
},
|
3448
|
-
|
3449
|
-
enable: function(form) {
|
3450
|
-
form = $(form);
|
3451
|
-
Form.getElements(form).invoke('enable');
|
3452
|
-
return form;
|
3453
|
-
},
|
3454
|
-
|
3455
|
-
findFirstElement: function(form) {
|
3456
|
-
var elements = $(form).getElements().findAll(function(element) {
|
3457
|
-
return 'hidden' != element.type && !element.disabled;
|
3458
|
-
});
|
3459
|
-
var firstByIndex = elements.findAll(function(element) {
|
3460
|
-
return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
|
3461
|
-
}).sortBy(function(element) { return element.tabIndex }).first();
|
3462
|
-
|
3463
|
-
return firstByIndex ? firstByIndex : elements.find(function(element) {
|
3464
|
-
return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
|
3465
|
-
});
|
3466
|
-
},
|
3467
|
-
|
3468
|
-
focusFirstElement: function(form) {
|
3469
|
-
form = $(form);
|
3470
|
-
form.findFirstElement().activate();
|
3471
|
-
return form;
|
3472
|
-
},
|
3473
|
-
|
3474
|
-
request: function(form, options) {
|
3475
|
-
form = $(form), options = Object.clone(options || { });
|
3476
|
-
|
3477
|
-
var params = options.parameters, action = form.readAttribute('action') || '';
|
3478
|
-
if (action.blank()) action = window.location.href;
|
3479
|
-
options.parameters = form.serialize(true);
|
3480
|
-
|
3481
|
-
if (params) {
|
3482
|
-
if (Object.isString(params)) params = params.toQueryParams();
|
3483
|
-
Object.extend(options.parameters, params);
|
3484
|
-
}
|
3485
|
-
|
3486
|
-
if (form.hasAttribute('method') && !options.method)
|
3487
|
-
options.method = form.method;
|
3488
|
-
|
3489
|
-
return new Ajax.Request(action, options);
|
3490
|
-
}
|
3491
|
-
};
|
3492
|
-
|
3493
|
-
/*--------------------------------------------------------------------------*/
|
3494
|
-
|
3495
|
-
Form.Element = {
|
3496
|
-
focus: function(element) {
|
3497
|
-
$(element).focus();
|
3498
|
-
return element;
|
3499
|
-
},
|
3500
|
-
|
3501
|
-
select: function(element) {
|
3502
|
-
$(element).select();
|
3503
|
-
return element;
|
3504
|
-
}
|
3505
|
-
};
|
3506
|
-
|
3507
|
-
Form.Element.Methods = {
|
3508
|
-
serialize: function(element) {
|
3509
|
-
element = $(element);
|
3510
|
-
if (!element.disabled && element.name) {
|
3511
|
-
var value = element.getValue();
|
3512
|
-
if (value != undefined) {
|
3513
|
-
var pair = { };
|
3514
|
-
pair[element.name] = value;
|
3515
|
-
return Object.toQueryString(pair);
|
3516
|
-
}
|
3517
|
-
}
|
3518
|
-
return '';
|
3519
|
-
},
|
3520
|
-
|
3521
|
-
getValue: function(element) {
|
3522
|
-
element = $(element);
|
3523
|
-
var method = element.tagName.toLowerCase();
|
3524
|
-
return Form.Element.Serializers[method](element);
|
3525
|
-
},
|
3526
|
-
|
3527
|
-
setValue: function(element, value) {
|
3528
|
-
element = $(element);
|
3529
|
-
var method = element.tagName.toLowerCase();
|
3530
|
-
Form.Element.Serializers[method](element, value);
|
3531
|
-
return element;
|
3532
|
-
},
|
3533
|
-
|
3534
|
-
clear: function(element) {
|
3535
|
-
$(element).value = '';
|
3536
|
-
return element;
|
3537
|
-
},
|
3538
|
-
|
3539
|
-
present: function(element) {
|
3540
|
-
return $(element).value != '';
|
3541
|
-
},
|
3542
|
-
|
3543
|
-
activate: function(element) {
|
3544
|
-
element = $(element);
|
3545
|
-
try {
|
3546
|
-
element.focus();
|
3547
|
-
if (element.select && (element.tagName.toLowerCase() != 'input' ||
|
3548
|
-
!['button', 'reset', 'submit'].include(element.type)))
|
3549
|
-
element.select();
|
3550
|
-
} catch (e) { }
|
3551
|
-
return element;
|
3552
|
-
},
|
3553
|
-
|
3554
|
-
disable: function(element) {
|
3555
|
-
element = $(element);
|
3556
|
-
element.blur();
|
3557
|
-
element.disabled = true;
|
3558
|
-
return element;
|
3559
|
-
},
|
3560
|
-
|
3561
|
-
enable: function(element) {
|
3562
|
-
element = $(element);
|
3563
|
-
element.disabled = false;
|
3564
|
-
return element;
|
3565
|
-
}
|
3566
|
-
};
|
3567
|
-
|
3568
|
-
/*--------------------------------------------------------------------------*/
|
3569
|
-
|
3570
|
-
var Field = Form.Element;
|
3571
|
-
var $F = Form.Element.Methods.getValue;
|
3572
|
-
|
3573
|
-
/*--------------------------------------------------------------------------*/
|
3574
|
-
|
3575
|
-
Form.Element.Serializers = {
|
3576
|
-
input: function(element, value) {
|
3577
|
-
switch (element.type.toLowerCase()) {
|
3578
|
-
case 'checkbox':
|
3579
|
-
case 'radio':
|
3580
|
-
return Form.Element.Serializers.inputSelector(element, value);
|
3581
|
-
default:
|
3582
|
-
return Form.Element.Serializers.textarea(element, value);
|
3583
|
-
}
|
3584
|
-
},
|
3585
|
-
|
3586
|
-
inputSelector: function(element, value) {
|
3587
|
-
if (Object.isUndefined(value)) return element.checked ? element.value : null;
|
3588
|
-
else element.checked = !!value;
|
3589
|
-
},
|
3590
|
-
|
3591
|
-
textarea: function(element, value) {
|
3592
|
-
if (Object.isUndefined(value)) return element.value;
|
3593
|
-
else element.value = value;
|
3594
|
-
},
|
3595
|
-
|
3596
|
-
select: function(element, index) {
|
3597
|
-
if (Object.isUndefined(index))
|
3598
|
-
return this[element.type == 'select-one' ?
|
3599
|
-
'selectOne' : 'selectMany'](element);
|
3600
|
-
else {
|
3601
|
-
var opt, value, single = !Object.isArray(index);
|
3602
|
-
for (var i = 0, length = element.length; i < length; i++) {
|
3603
|
-
opt = element.options[i];
|
3604
|
-
value = this.optionValue(opt);
|
3605
|
-
if (single) {
|
3606
|
-
if (value == index) {
|
3607
|
-
opt.selected = true;
|
3608
|
-
return;
|
3609
|
-
}
|
3610
|
-
}
|
3611
|
-
else opt.selected = index.include(value);
|
3612
|
-
}
|
3613
|
-
}
|
3614
|
-
},
|
3615
|
-
|
3616
|
-
selectOne: function(element) {
|
3617
|
-
var index = element.selectedIndex;
|
3618
|
-
return index >= 0 ? this.optionValue(element.options[index]) : null;
|
3619
|
-
},
|
3620
|
-
|
3621
|
-
selectMany: function(element) {
|
3622
|
-
var values, length = element.length;
|
3623
|
-
if (!length) return null;
|
3624
|
-
|
3625
|
-
for (var i = 0, values = []; i < length; i++) {
|
3626
|
-
var opt = element.options[i];
|
3627
|
-
if (opt.selected) values.push(this.optionValue(opt));
|
3628
|
-
}
|
3629
|
-
return values;
|
3630
|
-
},
|
3631
|
-
|
3632
|
-
optionValue: function(opt) {
|
3633
|
-
// extend element because hasAttribute may not be native
|
3634
|
-
return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
|
3635
|
-
}
|
3636
|
-
};
|
3637
|
-
|
3638
|
-
/*--------------------------------------------------------------------------*/
|
3639
|
-
|
3640
|
-
Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
|
3641
|
-
initialize: function($super, element, frequency, callback) {
|
3642
|
-
$super(callback, frequency);
|
3643
|
-
this.element = $(element);
|
3644
|
-
this.lastValue = this.getValue();
|
3645
|
-
},
|
3646
|
-
|
3647
|
-
execute: function() {
|
3648
|
-
var value = this.getValue();
|
3649
|
-
if (Object.isString(this.lastValue) && Object.isString(value) ?
|
3650
|
-
this.lastValue != value : String(this.lastValue) != String(value)) {
|
3651
|
-
this.callback(this.element, value);
|
3652
|
-
this.lastValue = value;
|
3653
|
-
}
|
3654
|
-
}
|
3655
|
-
});
|
3656
|
-
|
3657
|
-
Form.Element.Observer = Class.create(Abstract.TimedObserver, {
|
3658
|
-
getValue: function() {
|
3659
|
-
return Form.Element.getValue(this.element);
|
3660
|
-
}
|
3661
|
-
});
|
3662
|
-
|
3663
|
-
Form.Observer = Class.create(Abstract.TimedObserver, {
|
3664
|
-
getValue: function() {
|
3665
|
-
return Form.serialize(this.element);
|
3666
|
-
}
|
3667
|
-
});
|
3668
|
-
|
3669
|
-
/*--------------------------------------------------------------------------*/
|
3670
|
-
|
3671
|
-
Abstract.EventObserver = Class.create({
|
3672
|
-
initialize: function(element, callback) {
|
3673
|
-
this.element = $(element);
|
3674
|
-
this.callback = callback;
|
3675
|
-
|
3676
|
-
this.lastValue = this.getValue();
|
3677
|
-
if (this.element.tagName.toLowerCase() == 'form')
|
3678
|
-
this.registerFormCallbacks();
|
3679
|
-
else
|
3680
|
-
this.registerCallback(this.element);
|
3681
|
-
},
|
3682
|
-
|
3683
|
-
onElementEvent: function() {
|
3684
|
-
var value = this.getValue();
|
3685
|
-
if (this.lastValue != value) {
|
3686
|
-
this.callback(this.element, value);
|
3687
|
-
this.lastValue = value;
|
3688
|
-
}
|
3689
|
-
},
|
3690
|
-
|
3691
|
-
registerFormCallbacks: function() {
|
3692
|
-
Form.getElements(this.element).each(this.registerCallback, this);
|
3693
|
-
},
|
3694
|
-
|
3695
|
-
registerCallback: function(element) {
|
3696
|
-
if (element.type) {
|
3697
|
-
switch (element.type.toLowerCase()) {
|
3698
|
-
case 'checkbox':
|
3699
|
-
case 'radio':
|
3700
|
-
Event.observe(element, 'click', this.onElementEvent.bind(this));
|
3701
|
-
break;
|
3702
|
-
default:
|
3703
|
-
Event.observe(element, 'change', this.onElementEvent.bind(this));
|
3704
|
-
break;
|
3705
|
-
}
|
3706
|
-
}
|
3707
|
-
}
|
3708
|
-
});
|
3709
|
-
|
3710
|
-
Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
|
3711
|
-
getValue: function() {
|
3712
|
-
return Form.Element.getValue(this.element);
|
3713
|
-
}
|
3714
|
-
});
|
3715
|
-
|
3716
|
-
Form.EventObserver = Class.create(Abstract.EventObserver, {
|
3717
|
-
getValue: function() {
|
3718
|
-
return Form.serialize(this.element);
|
3719
|
-
}
|
3720
|
-
});
|
3721
|
-
if (!window.Event) var Event = { };
|
3722
|
-
|
3723
|
-
Object.extend(Event, {
|
3724
|
-
KEY_BACKSPACE: 8,
|
3725
|
-
KEY_TAB: 9,
|
3726
|
-
KEY_RETURN: 13,
|
3727
|
-
KEY_ESC: 27,
|
3728
|
-
KEY_LEFT: 37,
|
3729
|
-
KEY_UP: 38,
|
3730
|
-
KEY_RIGHT: 39,
|
3731
|
-
KEY_DOWN: 40,
|
3732
|
-
KEY_DELETE: 46,
|
3733
|
-
KEY_HOME: 36,
|
3734
|
-
KEY_END: 35,
|
3735
|
-
KEY_PAGEUP: 33,
|
3736
|
-
KEY_PAGEDOWN: 34,
|
3737
|
-
KEY_INSERT: 45,
|
3738
|
-
|
3739
|
-
cache: { },
|
3740
|
-
|
3741
|
-
relatedTarget: function(event) {
|
3742
|
-
var element;
|
3743
|
-
switch(event.type) {
|
3744
|
-
case 'mouseover': element = event.fromElement; break;
|
3745
|
-
case 'mouseout': element = event.toElement; break;
|
3746
|
-
default: return null;
|
3747
|
-
}
|
3748
|
-
return Element.extend(element);
|
3749
|
-
}
|
3750
|
-
});
|
3751
|
-
|
3752
|
-
Event.Methods = (function() {
|
3753
|
-
var isButton;
|
3754
|
-
|
3755
|
-
if (Prototype.Browser.IE) {
|
3756
|
-
var buttonMap = { 0: 1, 1: 4, 2: 2 };
|
3757
|
-
isButton = function(event, code) {
|
3758
|
-
return event.button == buttonMap[code];
|
3759
|
-
};
|
3760
|
-
|
3761
|
-
} else if (Prototype.Browser.WebKit) {
|
3762
|
-
isButton = function(event, code) {
|
3763
|
-
switch (code) {
|
3764
|
-
case 0: return event.which == 1 && !event.metaKey;
|
3765
|
-
case 1: return event.which == 1 && event.metaKey;
|
3766
|
-
default: return false;
|
3767
|
-
}
|
3768
|
-
};
|
3769
|
-
|
3770
|
-
} else {
|
3771
|
-
isButton = function(event, code) {
|
3772
|
-
return event.which ? (event.which === code + 1) : (event.button === code);
|
3773
|
-
};
|
3774
|
-
}
|
3775
|
-
|
3776
|
-
return {
|
3777
|
-
isLeftClick: function(event) { return isButton(event, 0) },
|
3778
|
-
isMiddleClick: function(event) { return isButton(event, 1) },
|
3779
|
-
isRightClick: function(event) { return isButton(event, 2) },
|
3780
|
-
|
3781
|
-
element: function(event) {
|
3782
|
-
var node = Event.extend(event).target;
|
3783
|
-
return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
|
3784
|
-
},
|
3785
|
-
|
3786
|
-
findElement: function(event, expression) {
|
3787
|
-
var element = Event.element(event);
|
3788
|
-
if (!expression) return element;
|
3789
|
-
var elements = [element].concat(element.ancestors());
|
3790
|
-
return Selector.findElement(elements, expression, 0);
|
3791
|
-
},
|
3792
|
-
|
3793
|
-
pointer: function(event) {
|
3794
|
-
return {
|
3795
|
-
x: event.pageX || (event.clientX +
|
3796
|
-
(document.documentElement.scrollLeft || document.body.scrollLeft)),
|
3797
|
-
y: event.pageY || (event.clientY +
|
3798
|
-
(document.documentElement.scrollTop || document.body.scrollTop))
|
3799
|
-
};
|
3800
|
-
},
|
3801
|
-
|
3802
|
-
pointerX: function(event) { return Event.pointer(event).x },
|
3803
|
-
pointerY: function(event) { return Event.pointer(event).y },
|
3804
|
-
|
3805
|
-
stop: function(event) {
|
3806
|
-
Event.extend(event);
|
3807
|
-
event.preventDefault();
|
3808
|
-
event.stopPropagation();
|
3809
|
-
event.stopped = true;
|
3810
|
-
}
|
3811
|
-
};
|
3812
|
-
})();
|
3813
|
-
|
3814
|
-
Event.extend = (function() {
|
3815
|
-
var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
|
3816
|
-
m[name] = Event.Methods[name].methodize();
|
3817
|
-
return m;
|
3818
|
-
});
|
3819
|
-
|
3820
|
-
if (Prototype.Browser.IE) {
|
3821
|
-
Object.extend(methods, {
|
3822
|
-
stopPropagation: function() { this.cancelBubble = true },
|
3823
|
-
preventDefault: function() { this.returnValue = false },
|
3824
|
-
inspect: function() { return "[object Event]" }
|
3825
|
-
});
|
3826
|
-
|
3827
|
-
return function(event) {
|
3828
|
-
if (!event) return false;
|
3829
|
-
if (event._extendedByPrototype) return event;
|
3830
|
-
|
3831
|
-
event._extendedByPrototype = Prototype.emptyFunction;
|
3832
|
-
var pointer = Event.pointer(event);
|
3833
|
-
Object.extend(event, {
|
3834
|
-
target: event.srcElement,
|
3835
|
-
relatedTarget: Event.relatedTarget(event),
|
3836
|
-
pageX: pointer.x,
|
3837
|
-
pageY: pointer.y
|
3838
|
-
});
|
3839
|
-
return Object.extend(event, methods);
|
3840
|
-
};
|
3841
|
-
|
3842
|
-
} else {
|
3843
|
-
Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__;
|
3844
|
-
Object.extend(Event.prototype, methods);
|
3845
|
-
return Prototype.K;
|
3846
|
-
}
|
3847
|
-
})();
|
3848
|
-
|
3849
|
-
Object.extend(Event, (function() {
|
3850
|
-
var cache = Event.cache;
|
3851
|
-
|
3852
|
-
function getEventID(element) {
|
3853
|
-
if (element._eventID) return element._eventID;
|
3854
|
-
arguments.callee.id = arguments.callee.id || 1;
|
3855
|
-
return element._eventID = ++arguments.callee.id;
|
3856
|
-
}
|
3857
|
-
|
3858
|
-
function getDOMEventName(eventName) {
|
3859
|
-
if (eventName && eventName.include(':')) return "dataavailable";
|
3860
|
-
return eventName;
|
3861
|
-
}
|
3862
|
-
|
3863
|
-
function getCacheForID(id) {
|
3864
|
-
return cache[id] = cache[id] || { };
|
3865
|
-
}
|
3866
|
-
|
3867
|
-
function getWrappersForEventName(id, eventName) {
|
3868
|
-
var c = getCacheForID(id);
|
3869
|
-
return c[eventName] = c[eventName] || [];
|
3870
|
-
}
|
3871
|
-
|
3872
|
-
function createWrapper(element, eventName, handler) {
|
3873
|
-
var id = getEventID(element);
|
3874
|
-
var c = getWrappersForEventName(id, eventName);
|
3875
|
-
if (c.pluck("handler").include(handler)) return false;
|
3876
|
-
|
3877
|
-
var wrapper = function(event) {
|
3878
|
-
if (!Event || !Event.extend ||
|
3879
|
-
(event.eventName && event.eventName != eventName))
|
3880
|
-
return false;
|
3881
|
-
|
3882
|
-
Event.extend(event);
|
3883
|
-
handler.call(element, event)
|
3884
|
-
};
|
3885
|
-
|
3886
|
-
wrapper.handler = handler;
|
3887
|
-
c.push(wrapper);
|
3888
|
-
return wrapper;
|
3889
|
-
}
|
3890
|
-
|
3891
|
-
function findWrapper(id, eventName, handler) {
|
3892
|
-
var c = getWrappersForEventName(id, eventName);
|
3893
|
-
return c.find(function(wrapper) { return wrapper.handler == handler });
|
3894
|
-
}
|
3895
|
-
|
3896
|
-
function destroyWrapper(id, eventName, handler) {
|
3897
|
-
var c = getCacheForID(id);
|
3898
|
-
if (!c[eventName]) return false;
|
3899
|
-
c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
|
3900
|
-
}
|
3901
|
-
|
3902
|
-
function destroyCache() {
|
3903
|
-
for (var id in cache)
|
3904
|
-
for (var eventName in cache[id])
|
3905
|
-
cache[id][eventName] = null;
|
3906
|
-
}
|
3907
|
-
|
3908
|
-
if (window.attachEvent) {
|
3909
|
-
window.attachEvent("onunload", destroyCache);
|
3910
|
-
}
|
3911
|
-
|
3912
|
-
return {
|
3913
|
-
observe: function(element, eventName, handler) {
|
3914
|
-
element = $(element);
|
3915
|
-
var name = getDOMEventName(eventName);
|
3916
|
-
|
3917
|
-
var wrapper = createWrapper(element, eventName, handler);
|
3918
|
-
if (!wrapper) return element;
|
3919
|
-
|
3920
|
-
if (element.addEventListener) {
|
3921
|
-
element.addEventListener(name, wrapper, false);
|
3922
|
-
} else {
|
3923
|
-
element.attachEvent("on" + name, wrapper);
|
3924
|
-
}
|
3925
|
-
|
3926
|
-
return element;
|
3927
|
-
},
|
3928
|
-
|
3929
|
-
stopObserving: function(element, eventName, handler) {
|
3930
|
-
element = $(element);
|
3931
|
-
var id = getEventID(element), name = getDOMEventName(eventName);
|
3932
|
-
|
3933
|
-
if (!handler && eventName) {
|
3934
|
-
getWrappersForEventName(id, eventName).each(function(wrapper) {
|
3935
|
-
element.stopObserving(eventName, wrapper.handler);
|
3936
|
-
});
|
3937
|
-
return element;
|
3938
|
-
|
3939
|
-
} else if (!eventName) {
|
3940
|
-
Object.keys(getCacheForID(id)).each(function(eventName) {
|
3941
|
-
element.stopObserving(eventName);
|
3942
|
-
});
|
3943
|
-
return element;
|
3944
|
-
}
|
3945
|
-
|
3946
|
-
var wrapper = findWrapper(id, eventName, handler);
|
3947
|
-
if (!wrapper) return element;
|
3948
|
-
|
3949
|
-
if (element.removeEventListener) {
|
3950
|
-
element.removeEventListener(name, wrapper, false);
|
3951
|
-
} else {
|
3952
|
-
element.detachEvent("on" + name, wrapper);
|
3953
|
-
}
|
3954
|
-
|
3955
|
-
destroyWrapper(id, eventName, handler);
|
3956
|
-
|
3957
|
-
return element;
|
3958
|
-
},
|
3959
|
-
|
3960
|
-
fire: function(element, eventName, memo) {
|
3961
|
-
element = $(element);
|
3962
|
-
if (element == document && document.createEvent && !element.dispatchEvent)
|
3963
|
-
element = document.documentElement;
|
3964
|
-
|
3965
|
-
if (document.createEvent) {
|
3966
|
-
var event = document.createEvent("HTMLEvents");
|
3967
|
-
event.initEvent("dataavailable", true, true);
|
3968
|
-
} else {
|
3969
|
-
var event = document.createEventObject();
|
3970
|
-
event.eventType = "ondataavailable";
|
3971
|
-
}
|
3972
|
-
|
3973
|
-
event.eventName = eventName;
|
3974
|
-
event.memo = memo || { };
|
3975
|
-
|
3976
|
-
if (document.createEvent) {
|
3977
|
-
element.dispatchEvent(event);
|
3978
|
-
} else {
|
3979
|
-
element.fireEvent(event.eventType, event);
|
3980
|
-
}
|
3981
|
-
|
3982
|
-
return Event.extend(event);
|
3983
|
-
}
|
3984
|
-
};
|
3985
|
-
})());
|
3986
|
-
|
3987
|
-
Object.extend(Event, Event.Methods);
|
3988
|
-
|
3989
|
-
Element.addMethods({
|
3990
|
-
fire: Event.fire,
|
3991
|
-
observe: Event.observe,
|
3992
|
-
stopObserving: Event.stopObserving
|
3993
|
-
});
|
3994
|
-
|
3995
|
-
Object.extend(document, {
|
3996
|
-
fire: Element.Methods.fire.methodize(),
|
3997
|
-
observe: Element.Methods.observe.methodize(),
|
3998
|
-
stopObserving: Element.Methods.stopObserving.methodize()
|
3999
|
-
});
|
4000
|
-
|
4001
|
-
(function() {
|
4002
|
-
/* Support for the DOMContentLoaded event is based on work by Dan Webb,
|
4003
|
-
Matthias Miller, Dean Edwards and John Resig. */
|
4004
|
-
|
4005
|
-
var timer, fired = false;
|
4006
|
-
|
4007
|
-
function fireContentLoadedEvent() {
|
4008
|
-
if (fired) return;
|
4009
|
-
if (timer) window.clearInterval(timer);
|
4010
|
-
document.fire("dom:loaded");
|
4011
|
-
fired = true;
|
4012
|
-
}
|
4013
|
-
|
4014
|
-
if (document.addEventListener) {
|
4015
|
-
if (Prototype.Browser.WebKit) {
|
4016
|
-
timer = window.setInterval(function() {
|
4017
|
-
if (/loaded|complete/.test(document.readyState))
|
4018
|
-
fireContentLoadedEvent();
|
4019
|
-
}, 0);
|
4020
|
-
|
4021
|
-
Event.observe(window, "load", fireContentLoadedEvent);
|
4022
|
-
|
4023
|
-
} else {
|
4024
|
-
document.addEventListener("DOMContentLoaded",
|
4025
|
-
fireContentLoadedEvent, false);
|
4026
|
-
}
|
4027
|
-
|
4028
|
-
} else {
|
4029
|
-
document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
|
4030
|
-
$("__onDOMContentLoaded").onreadystatechange = function() {
|
4031
|
-
if (this.readyState == "complete") {
|
4032
|
-
this.onreadystatechange = null;
|
4033
|
-
fireContentLoadedEvent();
|
4034
|
-
}
|
4035
|
-
};
|
4036
|
-
}
|
4037
|
-
})();
|
4038
|
-
/*------------------------------- DEPRECATED -------------------------------*/
|
4039
|
-
|
4040
|
-
Hash.toQueryString = Object.toQueryString;
|
4041
|
-
|
4042
|
-
var Toggle = { display: Element.toggle };
|
4043
|
-
|
4044
|
-
Element.Methods.childOf = Element.Methods.descendantOf;
|
4045
|
-
|
4046
|
-
var Insertion = {
|
4047
|
-
Before: function(element, content) {
|
4048
|
-
return Element.insert(element, {before:content});
|
4049
|
-
},
|
4050
|
-
|
4051
|
-
Top: function(element, content) {
|
4052
|
-
return Element.insert(element, {top:content});
|
4053
|
-
},
|
4054
|
-
|
4055
|
-
Bottom: function(element, content) {
|
4056
|
-
return Element.insert(element, {bottom:content});
|
4057
|
-
},
|
4058
|
-
|
4059
|
-
After: function(element, content) {
|
4060
|
-
return Element.insert(element, {after:content});
|
4061
|
-
}
|
4062
|
-
};
|
4063
|
-
|
4064
|
-
var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
|
4065
|
-
|
4066
|
-
// This should be moved to script.aculo.us; notice the deprecated methods
|
4067
|
-
// further below, that map to the newer Element methods.
|
4068
|
-
var Position = {
|
4069
|
-
// set to true if needed, warning: firefox performance problems
|
4070
|
-
// NOT neeeded for page scrolling, only if draggable contained in
|
4071
|
-
// scrollable elements
|
4072
|
-
includeScrollOffsets: false,
|
4073
|
-
|
4074
|
-
// must be called before calling withinIncludingScrolloffset, every time the
|
4075
|
-
// page is scrolled
|
4076
|
-
prepare: function() {
|
4077
|
-
this.deltaX = window.pageXOffset
|
4078
|
-
|| document.documentElement.scrollLeft
|
4079
|
-
|| document.body.scrollLeft
|
4080
|
-
|| 0;
|
4081
|
-
this.deltaY = window.pageYOffset
|
4082
|
-
|| document.documentElement.scrollTop
|
4083
|
-
|| document.body.scrollTop
|
4084
|
-
|| 0;
|
4085
|
-
},
|
4086
|
-
|
4087
|
-
// caches x/y coordinate pair to use with overlap
|
4088
|
-
within: function(element, x, y) {
|
4089
|
-
if (this.includeScrollOffsets)
|
4090
|
-
return this.withinIncludingScrolloffsets(element, x, y);
|
4091
|
-
this.xcomp = x;
|
4092
|
-
this.ycomp = y;
|
4093
|
-
this.offset = Element.cumulativeOffset(element);
|
4094
|
-
|
4095
|
-
return (y >= this.offset[1] &&
|
4096
|
-
y < this.offset[1] + element.offsetHeight &&
|
4097
|
-
x >= this.offset[0] &&
|
4098
|
-
x < this.offset[0] + element.offsetWidth);
|
4099
|
-
},
|
4100
|
-
|
4101
|
-
withinIncludingScrolloffsets: function(element, x, y) {
|
4102
|
-
var offsetcache = Element.cumulativeScrollOffset(element);
|
4103
|
-
|
4104
|
-
this.xcomp = x + offsetcache[0] - this.deltaX;
|
4105
|
-
this.ycomp = y + offsetcache[1] - this.deltaY;
|
4106
|
-
this.offset = Element.cumulativeOffset(element);
|
4107
|
-
|
4108
|
-
return (this.ycomp >= this.offset[1] &&
|
4109
|
-
this.ycomp < this.offset[1] + element.offsetHeight &&
|
4110
|
-
this.xcomp >= this.offset[0] &&
|
4111
|
-
this.xcomp < this.offset[0] + element.offsetWidth);
|
4112
|
-
},
|
4113
|
-
|
4114
|
-
// within must be called directly before
|
4115
|
-
overlap: function(mode, element) {
|
4116
|
-
if (!mode) return 0;
|
4117
|
-
if (mode == 'vertical')
|
4118
|
-
return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
|
4119
|
-
element.offsetHeight;
|
4120
|
-
if (mode == 'horizontal')
|
4121
|
-
return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
|
4122
|
-
element.offsetWidth;
|
4123
|
-
},
|
4124
|
-
|
4125
|
-
// Deprecation layer -- use newer Element methods now (1.5.2).
|
4126
|
-
|
4127
|
-
cumulativeOffset: Element.Methods.cumulativeOffset,
|
4128
|
-
|
4129
|
-
positionedOffset: Element.Methods.positionedOffset,
|
4130
|
-
|
4131
|
-
absolutize: function(element) {
|
4132
|
-
Position.prepare();
|
4133
|
-
return Element.absolutize(element);
|
4134
|
-
},
|
4135
|
-
|
4136
|
-
relativize: function(element) {
|
4137
|
-
Position.prepare();
|
4138
|
-
return Element.relativize(element);
|
4139
|
-
},
|
4140
|
-
|
4141
|
-
realOffset: Element.Methods.cumulativeScrollOffset,
|
4142
|
-
|
4143
|
-
offsetParent: Element.Methods.getOffsetParent,
|
4144
|
-
|
4145
|
-
page: Element.Methods.viewportOffset,
|
4146
|
-
|
4147
|
-
clone: function(source, target, options) {
|
4148
|
-
options = options || { };
|
4149
|
-
return Element.clonePosition(target, source, options);
|
4150
|
-
}
|
4151
|
-
};
|
4152
|
-
|
4153
|
-
/*--------------------------------------------------------------------------*/
|
4154
|
-
|
4155
|
-
if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
|
4156
|
-
function iter(name) {
|
4157
|
-
return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
|
4158
|
-
}
|
4159
|
-
|
4160
|
-
instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
|
4161
|
-
function(element, className) {
|
4162
|
-
className = className.toString().strip();
|
4163
|
-
var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
|
4164
|
-
return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
|
4165
|
-
} : function(element, className) {
|
4166
|
-
className = className.toString().strip();
|
4167
|
-
var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
|
4168
|
-
if (!classNames && !className) return elements;
|
4169
|
-
|
4170
|
-
var nodes = $(element).getElementsByTagName('*');
|
4171
|
-
className = ' ' + className + ' ';
|
4172
|
-
|
4173
|
-
for (var i = 0, child, cn; child = nodes[i]; i++) {
|
4174
|
-
if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
|
4175
|
-
(classNames && classNames.all(function(name) {
|
4176
|
-
return !name.toString().blank() && cn.include(' ' + name + ' ');
|
4177
|
-
}))))
|
4178
|
-
elements.push(Element.extend(child));
|
4179
|
-
}
|
4180
|
-
return elements;
|
4181
|
-
};
|
4182
|
-
|
4183
|
-
return function(className, parentElement) {
|
4184
|
-
return $(parentElement || document.body).getElementsByClassName(className);
|
4185
|
-
};
|
4186
|
-
}(Element.Methods);
|
4187
|
-
|
4188
|
-
/*--------------------------------------------------------------------------*/
|
4189
|
-
|
4190
|
-
Element.ClassNames = Class.create();
|
4191
|
-
Element.ClassNames.prototype = {
|
4192
|
-
initialize: function(element) {
|
4193
|
-
this.element = $(element);
|
4194
|
-
},
|
4195
|
-
|
4196
|
-
_each: function(iterator) {
|
4197
|
-
this.element.className.split(/\s+/).select(function(name) {
|
4198
|
-
return name.length > 0;
|
4199
|
-
})._each(iterator);
|
4200
|
-
},
|
4201
|
-
|
4202
|
-
set: function(className) {
|
4203
|
-
this.element.className = className;
|
4204
|
-
},
|
4205
|
-
|
4206
|
-
add: function(classNameToAdd) {
|
4207
|
-
if (this.include(classNameToAdd)) return;
|
4208
|
-
this.set($A(this).concat(classNameToAdd).join(' '));
|
4209
|
-
},
|
4210
|
-
|
4211
|
-
remove: function(classNameToRemove) {
|
4212
|
-
if (!this.include(classNameToRemove)) return;
|
4213
|
-
this.set($A(this).without(classNameToRemove).join(' '));
|
4214
|
-
},
|
4215
|
-
|
4216
|
-
toString: function() {
|
4217
|
-
return $A(this).join(' ');
|
4218
|
-
}
|
4219
|
-
};
|
4220
|
-
|
4221
|
-
Object.extend(Element.ClassNames.prototype, Enumerable);
|
4222
|
-
|
4223
|
-
/*--------------------------------------------------------------------------*/
|
4224
|
-
|
4225
|
-
Element.addMethods();
|