sproutcore 0.9.23 → 1.0.1003
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Buildfile +125 -0
- data/History.txt +5 -569
- data/README.txt +99 -64
- data/Rakefile +236 -6
- data/Todo.txt +1 -0
- data/VERSION.yml +5 -0
- data/bin/sc-build +9 -210
- data/bin/sc-build-number +13 -0
- data/bin/sc-docs +14 -0
- data/bin/sc-gen +9 -23
- data/bin/sc-init +9 -34
- data/bin/sc-manifest +13 -0
- data/bin/sc-server +9 -82
- data/bin/sproutcore +10 -24
- data/buildtasks/build.rake +82 -0
- data/buildtasks/entry.rake +62 -0
- data/buildtasks/manifest.rake +565 -0
- data/buildtasks/render.rake +21 -0
- data/buildtasks/target.rake +61 -0
- data/design/Technical Notes.graffle/QuickLook/Preview.pdf +0 -0
- data/design/Technical Notes.graffle/QuickLook/Thumbnail.tiff +0 -0
- data/design/Technical Notes.graffle/data.plist +5534 -0
- data/design/Technical Notes.graffle/image8.png +0 -0
- data/doc_templates/jsdoc/publish.js +170 -0
- data/doc_templates/jsdoc/static/default.css +162 -0
- data/{jsdoc/templates/sproutcore → doc_templates/jsdoc}/static/header.html +0 -0
- data/doc_templates/jsdoc/static/index.html +19 -0
- data/doc_templates/sproutcore/publish.js +345 -0
- data/doc_templates/sproutcore/static/default.css +258 -0
- data/doc_templates/sproutcore/static/header.html +2 -0
- data/doc_templates/sproutcore/static/index.html +19 -0
- data/frameworks/sproutcore/Buildfile +88 -0
- data/frameworks/sproutcore/HISTORY +10 -10
- data/frameworks/sproutcore/README +8 -1
- data/frameworks/sproutcore/apps/docs/core.js +27 -0
- data/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/QuickLook/Preview.pdf +0 -0
- data/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/QuickLook/Thumbnail.tiff +0 -0
- data/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/data.plist +14378 -0
- data/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image10.png +0 -0
- data/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image11.png +0 -0
- data/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image13.png +0 -0
- data/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image14.png +0 -0
- data/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image8.png +0 -0
- data/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image9.tiff +0 -0
- data/frameworks/sproutcore/apps/docs/english.lproj/loading.rhtml +9 -0
- data/frameworks/sproutcore/apps/docs/english.lproj/main_page.js +22 -0
- data/frameworks/sproutcore/apps/docs/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/apps/docs/main.js +30 -0
- data/frameworks/sproutcore/apps/tests/controllers/detail.js +25 -0
- data/frameworks/sproutcore/apps/tests/controllers/source.js +29 -0
- data/frameworks/sproutcore/apps/tests/controllers/target.js +26 -0
- data/frameworks/sproutcore/apps/tests/controllers/targets.js +86 -0
- data/frameworks/sproutcore/apps/tests/controllers/tests.js +33 -0
- data/frameworks/sproutcore/apps/tests/core.js +133 -0
- data/frameworks/sproutcore/apps/tests/english.lproj/loading.rhtml +9 -0
- data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +39 -0
- data/frameworks/sproutcore/apps/tests/english.lproj/main_page.js +232 -0
- data/frameworks/sproutcore/apps/tests/english.lproj/strings.js +26 -0
- data/frameworks/sproutcore/apps/tests/main.js +28 -0
- data/frameworks/sproutcore/apps/tests/states/no_targets.js +26 -0
- data/frameworks/sproutcore/apps/tests/states/ready.js +56 -0
- data/frameworks/sproutcore/apps/tests/states/ready_detail.js +41 -0
- data/frameworks/sproutcore/apps/tests/states/ready_empty.js +48 -0
- data/frameworks/sproutcore/apps/tests/states/ready_list.js +41 -0
- data/frameworks/sproutcore/apps/tests/states/ready_loading.js +44 -0
- data/frameworks/sproutcore/apps/tests/states/ready_no_tests.js +31 -0
- data/frameworks/sproutcore/apps/tests/states/start.js +39 -0
- data/frameworks/sproutcore/apps/tests/tests/controllers/detail.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/controllers/source.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/controllers/target.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/controllers/targets.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/controllers/tests.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/models/target.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/models/test.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/views/offset_checkbox.js +15 -0
- data/frameworks/sproutcore/apps/tests/views/offset_checkbox.js +26 -0
- data/frameworks/sproutcore/apps/welcome/controllers/targets.js +49 -0
- data/frameworks/sproutcore/apps/welcome/core.js +30 -0
- data/frameworks/sproutcore/apps/welcome/english.lproj/loading.rhtml +10 -0
- data/frameworks/sproutcore/apps/welcome/english.lproj/main_page.css +7 -0
- data/frameworks/sproutcore/apps/welcome/english.lproj/main_page.js +77 -0
- data/frameworks/sproutcore/apps/welcome/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/apps/welcome/main.js +19 -0
- data/frameworks/sproutcore/apps/welcome/tests/controllers/targets.js +15 -0
- data/frameworks/sproutcore/design/CollectionView State Charts.graffle +4848 -0
- data/frameworks/sproutcore/design/Design Charts.graffle +18232 -0
- data/frameworks/sproutcore/design/Record State Table.numbers +0 -0
- data/frameworks/sproutcore/design/SproutCore Datastore Design.graffle/QuickLook/Preview.pdf +0 -0
- data/frameworks/sproutcore/design/SproutCore Datastore Design.graffle/QuickLook/Thumbnail.tiff +0 -0
- data/frameworks/sproutcore/design/SproutCore Datastore Design.graffle/data.plist +19588 -0
- data/frameworks/sproutcore/design/SproutCore Datastore Design.graffle/image8.png +0 -0
- data/frameworks/sproutcore/design/SproutCore Design Template.graffle/QuickLook/Preview.pdf +0 -0
- data/frameworks/sproutcore/design/SproutCore Design Template.graffle/QuickLook/Thumbnail.tiff +0 -0
- data/frameworks/sproutcore/design/SproutCore Design Template.graffle/data.plist +1452 -0
- data/frameworks/sproutcore/design/SproutCore Design Template.graffle/image8.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/QuickLook/Preview.pdf +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/QuickLook/Thumbnail.tiff +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/data.plist +24187 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image10.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image11.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image13.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image15.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image16.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image17.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image18.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image19.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image22.tiff +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image23.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image24.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image25.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image30.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image31.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image8.png +0 -0
- data/frameworks/sproutcore/design/TestRunner Design.graffle/image9.png +0 -0
- data/frameworks/sproutcore/frameworks/core_tools/core.js +20 -0
- data/frameworks/sproutcore/frameworks/core_tools/data_source.js +99 -0
- data/frameworks/sproutcore/frameworks/core_tools/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/frameworks/core_tools/fixtures/target.js +87 -0
- data/frameworks/sproutcore/frameworks/core_tools/fixtures/test.js +44 -0
- data/frameworks/sproutcore/frameworks/core_tools/models/target.js +108 -0
- data/frameworks/sproutcore/frameworks/core_tools/models/test.js +48 -0
- data/frameworks/sproutcore/frameworks/datastore/core.js +8 -0
- data/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +180 -0
- data/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +340 -0
- data/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +393 -0
- data/frameworks/sproutcore/frameworks/datastore/debug/json.js +71 -0
- data/frameworks/sproutcore/frameworks/datastore/debug/standard_setup.js +96 -0
- data/frameworks/sproutcore/frameworks/datastore/fixtures/author_fixtures.js +2503 -0
- data/frameworks/sproutcore/frameworks/datastore/fixtures/sample.js +17 -0
- data/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +100 -0
- data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +152 -0
- data/frameworks/sproutcore/frameworks/datastore/models/record.js +898 -0
- data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +462 -0
- data/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +158 -0
- data/frameworks/sproutcore/frameworks/datastore/system/many_array.js +411 -0
- data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +499 -0
- data/frameworks/sproutcore/frameworks/datastore/system/query.js +1488 -0
- data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +568 -0
- data/frameworks/sproutcore/frameworks/datastore/system/store.js +2407 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +117 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/integration/contact_model.js +131 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js +119 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/integration/mail_model.js +91 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/integration/test_runner_model.js +56 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +384 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +55 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/destroy.js +81 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +245 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/readAttribute.js +53 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js +48 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/storeDidChangeProperties.js +169 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +51 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +97 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +178 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +216 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/many_array/core_methods.js +204 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +149 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChanges.js +171 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +154 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/dataHashDidChange.js +113 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/discardChanges.js +99 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readDataHash.js +180 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readEditableDataHash.js +126 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/removeDataHash.js +163 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +166 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +219 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/compare.js +131 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/contains.js +131 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/containsRecordTypes.js +81 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/copy.js +30 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +185 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation_of_records.js +92 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/expandedRecordTypes.js +64 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/parse.js +202 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/queryWithScope.js +57 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js +43 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_comparisons.js +66 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_query_extensions.js +67 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +177 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +134 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js +54 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +133 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +211 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +136 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +72 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +78 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +254 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +106 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/find.js +530 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +21 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushChanges.js +61 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/readDataHash.js +74 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/readEditableDataHash.js +74 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +73 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/removeDataHash.js +144 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/retrieveRecord.js +184 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/writeDataHash.js +125 -0
- data/frameworks/sproutcore/frameworks/datejs/core.js +865 -0
- data/frameworks/sproutcore/frameworks/datejs/english.lproj/en-US.js +186 -0
- data/frameworks/sproutcore/frameworks/datejs/extras.js +332 -0
- data/frameworks/sproutcore/frameworks/datejs/license.js +25 -0
- data/frameworks/sproutcore/frameworks/datejs/parser.js +1116 -0
- data/frameworks/sproutcore/frameworks/datejs/spanish.lproj/es-CO.js +186 -0
- data/frameworks/sproutcore/frameworks/datejs/sugarpak.js +475 -0
- data/frameworks/sproutcore/frameworks/datejs/time.js +269 -0
- data/frameworks/sproutcore/frameworks/datejs/validators/datejs.js +34 -0
- data/frameworks/sproutcore/frameworks/debug/core.js +99 -0
- data/frameworks/sproutcore/frameworks/designer/coders/design.js +29 -0
- data/frameworks/sproutcore/frameworks/designer/coders/localization.js +27 -0
- data/frameworks/sproutcore/frameworks/designer/coders/object.js +347 -0
- data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +102 -0
- data/frameworks/sproutcore/frameworks/designer/css/css_rule.js +22 -0
- data/frameworks/sproutcore/frameworks/designer/css/css_style.js +29 -0
- data/frameworks/sproutcore/frameworks/designer/css/css_style_sheet.js +201 -0
- data/frameworks/sproutcore/frameworks/designer/ext/page.js +86 -0
- data/frameworks/sproutcore/frameworks/designer/ext/view.js +38 -0
- data/frameworks/sproutcore/frameworks/designer/views/controls/button.js +17 -0
- data/frameworks/sproutcore/frameworks/designer/views/designer.js +569 -0
- data/frameworks/sproutcore/frameworks/designer/views/label.js +16 -0
- data/frameworks/sproutcore/frameworks/designer/views/mixins/button.js +11 -0
- data/frameworks/sproutcore/frameworks/designer/views/tab.js +16 -0
- data/frameworks/sproutcore/frameworks/desktop/core.js +6 -0
- data/frameworks/sproutcore/frameworks/desktop/debug/drag.js +41 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +56 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/a_sample_image.jpg +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/apple-logo1.jpeg +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/iframe.html +23 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +78 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +6 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +943 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_222222.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_454545.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_888888.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_ffffff.png +0 -0
- data/frameworks/sproutcore/{english.lproj/images/shared-icons.png → frameworks/desktop/english.lproj/images/icons/shared.png} +0 -0
- data/{clients/sc_test_runner → frameworks/sproutcore/frameworks/desktop}/english.lproj/images/indicator.gif +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/panels/sprite-x.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/panels/sprite-y.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/000000.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/ffffff.png +0 -0
- data/frameworks/sproutcore/{english.lproj → frameworks/desktop/english.lproj}/images/sticky-note.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +209 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +113 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +5 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +95 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +39 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +31 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +10 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/scroller.css +26 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +141 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +19 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +62 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/split.css +70 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/split_divider.css +9 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +14 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +12 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/toolbar.css +6 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/border.js +53 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +22 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +61 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +292 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +247 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +408 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/drop_down.js +665 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +680 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/modal.js +68 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/palette.js +63 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +184 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +403 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +46 -0
- data/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +39 -0
- data/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +81 -0
- data/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +175 -0
- data/frameworks/sproutcore/frameworks/desktop/protocols/responder.js +290 -0
- data/frameworks/sproutcore/frameworks/desktop/system/drag.js +869 -0
- data/frameworks/sproutcore/frameworks/desktop/system/key_bindings.js +40 -0
- data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +647 -0
- data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +187 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/datetime_recordattribute.js +73 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/integration/dialog.js +43 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +152 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/dropDown/methods.js +161 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/dropDown/ui.js +199 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +55 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +59 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/ui.js +35 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +40 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +84 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +38 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +45 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +163 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +144 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +99 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/content.js +249 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +82 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +199 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/displayProperties.js +31 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +288 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/layerIdFor.js +65 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/length.js +88 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +174 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/nowShowing.js +121 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/reload.js +177 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +240 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +191 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +197 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selection.js +141 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/ui_diagram.js +182 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +64 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/grid/ui.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/render.js +92 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowDelegate.js +183 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +133 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowOffsetForContentIndex.js +131 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_outline.js +56 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +167 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_simple.js +127 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +284 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js +44 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/methods.js +128 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +240 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +113 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +200 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +142 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +169 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +72 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/ui.js +71 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +95 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +222 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +132 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +110 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/separator.js +37 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/ui.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +60 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/split/ui.js +52 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +231 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +54 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +88 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/web/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/web/ui.js +110 -0
- data/frameworks/sproutcore/frameworks/desktop/views/button.js +375 -0
- data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +126 -0
- data/frameworks/sproutcore/frameworks/desktop/views/collection.js +2775 -0
- data/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +60 -0
- data/frameworks/sproutcore/frameworks/desktop/views/form.js +594 -0
- data/frameworks/sproutcore/frameworks/desktop/views/grid.js +201 -0
- data/frameworks/sproutcore/frameworks/desktop/views/list.js +549 -0
- data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +657 -0
- data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +608 -0
- data/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +20 -0
- data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +68 -0
- data/frameworks/sproutcore/frameworks/desktop/views/progress.js +233 -0
- data/frameworks/sproutcore/frameworks/desktop/views/radio.js +357 -0
- data/frameworks/sproutcore/frameworks/desktop/views/scene.js +204 -0
- data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +689 -0
- data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +227 -0
- data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +587 -0
- data/frameworks/sproutcore/frameworks/desktop/views/select_field.js +311 -0
- data/frameworks/sproutcore/frameworks/desktop/views/separator.js +37 -0
- data/frameworks/sproutcore/frameworks/desktop/views/slider.js +261 -0
- data/frameworks/sproutcore/frameworks/desktop/views/source_list.js +47 -0
- data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +169 -0
- data/frameworks/sproutcore/frameworks/desktop/views/split.js +684 -0
- data/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +55 -0
- data/frameworks/sproutcore/frameworks/desktop/views/stacked.js +101 -0
- data/frameworks/sproutcore/frameworks/desktop/views/tab.js +191 -0
- data/frameworks/sproutcore/frameworks/desktop/views/thumb.js +49 -0
- data/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +49 -0
- data/frameworks/sproutcore/frameworks/desktop/views/web.js +87 -0
- data/frameworks/sproutcore/frameworks/foundation/TESTING +46 -0
- data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +504 -0
- data/frameworks/sproutcore/frameworks/foundation/controllers/controller.js +44 -0
- data/frameworks/sproutcore/frameworks/foundation/controllers/object.js +322 -0
- data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +105 -0
- data/frameworks/sproutcore/frameworks/foundation/core.js +144 -0
- data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +194 -0
- data/frameworks/sproutcore/{english.lproj → frameworks/foundation/english.lproj}/blank.gif +0 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +81 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +33 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +438 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/debug/control-test-pane.css +9 -0
- data/frameworks/sproutcore/{english.lproj → frameworks/foundation/english.lproj}/images/sproutcore-logo.png +0 -0
- data/{clients/sc_test_runner/english.lproj/controls.css → frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css} +0 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +31 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/static_layout.css +5 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +133 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/view.css +51 -0
- data/frameworks/sproutcore/frameworks/foundation/ext/object.js +83 -0
- data/frameworks/sproutcore/frameworks/foundation/ext/run_loop.js +161 -0
- data/frameworks/sproutcore/frameworks/foundation/fixtures/file_exists.json +1 -0
- data/frameworks/sproutcore/frameworks/foundation/license.js +19 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +355 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +179 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +91 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/control.js +386 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/editable.js +150 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +491 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +233 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +148 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +334 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/tree_item_content.js +160 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/validatable.js +189 -0
- data/frameworks/sproutcore/frameworks/foundation/panes/main.js +51 -0
- data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +661 -0
- data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +887 -0
- data/frameworks/sproutcore/frameworks/foundation/protocols/inline_editor_delegate.js +84 -0
- data/frameworks/sproutcore/frameworks/foundation/system/application.js +36 -0
- data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +502 -0
- data/frameworks/sproutcore/frameworks/foundation/system/browser.js +64 -0
- data/frameworks/sproutcore/frameworks/foundation/system/builder.js +210 -0
- data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +267 -0
- data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +2028 -0
- data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +129 -0
- data/frameworks/sproutcore/frameworks/foundation/system/datetime.js +915 -0
- data/frameworks/sproutcore/frameworks/foundation/system/event.js +849 -0
- data/frameworks/sproutcore/frameworks/foundation/system/image_cache.js +432 -0
- data/frameworks/sproutcore/frameworks/foundation/system/json.js +440 -0
- data/frameworks/sproutcore/frameworks/foundation/system/locale.js +288 -0
- data/frameworks/sproutcore/frameworks/foundation/system/page.js +106 -0
- data/frameworks/sproutcore/frameworks/foundation/system/ready.js +195 -0
- data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +905 -0
- data/frameworks/sproutcore/frameworks/foundation/system/request.js +386 -0
- data/frameworks/sproutcore/frameworks/foundation/system/responder.js +120 -0
- data/frameworks/sproutcore/frameworks/foundation/system/responder_context.js +243 -0
- data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +391 -0
- data/frameworks/sproutcore/frameworks/foundation/system/routes.js +525 -0
- data/frameworks/sproutcore/frameworks/foundation/system/text_selection.js +103 -0
- data/frameworks/sproutcore/frameworks/foundation/system/time.js +478 -0
- data/frameworks/sproutcore/frameworks/foundation/system/timer.js +549 -0
- data/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +233 -0
- data/frameworks/sproutcore/frameworks/foundation/system/utils.js +482 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +182 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +193 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +64 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/single_case.js +136 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/empty_case.js +82 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/multiple_case.js +111 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/single_case.js +193 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/single_enumerable_case.js +179 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/tree/outline_case.js +108 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/ui.js +113 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/integration/creating_views.js +113 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/content.js +195 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/displayProperties.js +89 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/keyEquivalents.js +56 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/content.js +168 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/displayProperties.js +89 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +128 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +17 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/flat_case.js +325 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +718 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/outline_case.js +484 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +42 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +1323 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_dimensions.js +387 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_selector.js +405 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js +49 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/within.js +66 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +252 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/json.js +14 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +128 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js +47 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js +44 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/end.js +119 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/get.js +51 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js +50 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_basic.js +28 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_className.js +179 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_style.js +100 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/init.js +55 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/join.js +28 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/push_text.js +74 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +45 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/update.js +205 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +127 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeKeyPane.js +124 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeMainPane.js +68 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/root_responder.js +101 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +238 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/routes.js +33 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js +38 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invokeLater.js +201 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +71 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +67 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/schedule.js +170 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/user_defaults.js +24 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/utils/normalizeURL.js +18 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/utils/range.js +62 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +35 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js +23 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +47 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/password.js +13 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/validator.js +20 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +83 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +52 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +148 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/main_pane.js +31 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +113 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/firstResponder.js +148 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/keyPane.js +133 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/sendEvent.js +165 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +76 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +446 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +133 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/convertFrames.js +246 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/createChildViews.js +122 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/createLayer.js +97 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +85 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +52 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/init.js +50 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +200 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js +51 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisibleInWindow.js +116 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layer.js +150 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutChildViews.js +162 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutDidChange.js +127 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +328 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/parentViewDidChange.js +67 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/prepareContext.js +166 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/removeChild.js +189 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/render.js +83 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/replaceChild.js +29 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayer.js +146 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayerLocation.js +194 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/viewDidResize.js +223 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +125 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/date.js +52 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/email.js +45 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js +33 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/number.js +82 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/password.js +86 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +314 -0
- data/frameworks/sproutcore/frameworks/foundation/views/container.js +136 -0
- data/frameworks/sproutcore/frameworks/foundation/views/field.js +347 -0
- data/frameworks/sproutcore/frameworks/foundation/views/image.js +178 -0
- data/frameworks/sproutcore/frameworks/foundation/views/label.js +285 -0
- data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +662 -0
- data/frameworks/sproutcore/frameworks/foundation/views/view.js +2521 -0
- data/frameworks/sproutcore/frameworks/mini/license.js +28 -0
- data/frameworks/sproutcore/frameworks/mobile/english.lproj/core.css +12 -0
- data/frameworks/sproutcore/frameworks/mobile/lib/index.rhtml +126 -0
- data/frameworks/sproutcore/frameworks/mobile/system/root_responder.js +109 -0
- data/frameworks/sproutcore/frameworks/mobile/tests/views/button/ui.js +9 -0
- data/frameworks/sproutcore/frameworks/mobile/views/button.js +190 -0
- data/frameworks/sproutcore/frameworks/runtime/README +12 -0
- data/frameworks/sproutcore/frameworks/runtime/core.js +950 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +238 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js +33 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/insertAt.js +121 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/objectAt.js +34 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js +50 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js +46 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/rangeObserver.js +371 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeAt.js +100 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js +49 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +94 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js +50 -0
- data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js +47 -0
- data/frameworks/sproutcore/frameworks/runtime/license.js +28 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/array.js +613 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js +45 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +64 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/delegate_support.js +110 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1238 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +110 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1315 -0
- data/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +141 -0
- data/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +173 -0
- data/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +172 -0
- data/frameworks/sproutcore/frameworks/runtime/protocols/observable_protocol.js +40 -0
- data/frameworks/sproutcore/frameworks/runtime/protocols/sparse_array_delegate.js +131 -0
- data/frameworks/sproutcore/frameworks/runtime/system/binding.js +943 -0
- data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +106 -0
- data/frameworks/sproutcore/frameworks/runtime/system/error.js +157 -0
- data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +1193 -0
- data/frameworks/sproutcore/frameworks/runtime/system/object.js +834 -0
- data/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +271 -0
- data/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +245 -0
- data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +669 -0
- data/frameworks/sproutcore/frameworks/runtime/system/set.js +425 -0
- data/frameworks/sproutcore/frameworks/runtime/system/sparse_array.js +379 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +56 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +23 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/clone.js +84 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +44 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/console.js +16 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +147 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/inspect.js +27 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +25 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +38 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/keys.js +20 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +30 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +19 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +37 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +57 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/comparable.js +44 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable.js +611 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +587 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +132 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +79 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +80 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue/isObservingSuspended.js +55 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +265 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +52 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +195 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/addEach.js +49 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/clone.js +43 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/contains.js +74 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/create.js +42 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js +38 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js +38 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/intersects.js +74 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js +40 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js +40 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js +36 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +189 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/removeEach.js +49 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/without.js +89 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/object/base.js +148 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +339 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +59 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/destroy.js +75 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/objectPropertyDidChange.js +117 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/rangeDidChange.js +110 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/update.js +65 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/run_loop.js +120 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/add.js +92 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +17 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +85 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/isEqual.js +60 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +87 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/set.js +292 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +175 -0
- data/frameworks/sproutcore/frameworks/testing/core.js +196 -0
- data/frameworks/sproutcore/frameworks/testing/english.lproj/additions.css +8 -0
- data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +128 -0
- data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +131 -0
- data/frameworks/sproutcore/frameworks/testing/extras.js +17 -0
- data/frameworks/sproutcore/frameworks/testing/jquery.js +3559 -0
- data/frameworks/sproutcore/frameworks/testing/qunit.js +827 -0
- data/frameworks/sproutcore/frameworks/testing/system/dump.js +205 -0
- data/frameworks/sproutcore/frameworks/testing/system/equiv.js +201 -0
- data/frameworks/sproutcore/frameworks/testing/system/plan.js +695 -0
- data/frameworks/sproutcore/frameworks/testing/system/runner.js +209 -0
- data/frameworks/sproutcore/frameworks/testing/system/suite.js +228 -0
- data/frameworks/sproutcore/frameworks/testing/utils.js +62 -0
- data/frameworks/sproutcore/lib/index.rhtml +81 -33
- data/frameworks/sproutcore/license.js +28 -28
- data/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +69 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/button.css +41 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/core.css +8 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/backButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/blueButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/cancel.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/grayButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/leftButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrow.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrowSel.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listGroup.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/loading.gif +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/pinstripes.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/rightButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/selection.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/thumb.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggle.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggleOn.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolbar.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/whiteButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/Data +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Preview.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Thumbnail.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/Data +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Preview.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Thumbnail.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/10.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/100.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/102.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/110.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/120.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/127.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/18.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/19.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/2.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/24.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/26.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/27.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/28.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/29.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/30.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/31.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/33.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/37.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/41.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/16/99.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/10.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/100.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/102.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/110.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/120.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/127.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/18.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/19.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/2.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/24.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/26.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/27.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/28.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/29.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/30.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/31.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/33.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/37.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/41.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/24/99.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/10.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/100.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/102.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/110.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/120.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/127.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/18.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/19.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/2.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/24.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/26.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/27.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/28.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/29.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/30.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/31.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/33.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/37.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/41.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/32/99.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/48/10.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/48/18.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/48/19.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/icons/48/2.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/Data +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Preview.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Thumbnail.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/Data +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Preview.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Thumbnail.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x-2.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-sprite.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-ysprite.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/shared-icons.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/sproutcore-logo.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/sticky-note.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +327 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +93 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +126 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/core.css +76 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +57 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/images/sc-theme-ysprite.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-toolbar-view.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/label.css +11 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +30 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu_item_view.css +3 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/pane.css +8 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/background-fat.jpg +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/background-thin.jpg +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/bottom-edge.png +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/bottom-left-corner.png +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/bottom-right-corner.png +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/left-edge.png +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/overlay.png +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/right-edge.png +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/top-edge.png +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/top-left-corner.png +0 -0
- data/frameworks/sproutcore/{english.lproj → themes/standard_theme/english.lproj}/panels/top-right-corner.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +26 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +149 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +279 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/slider.css +94 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +27 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/tab.css +19 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +20 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/toolbar.css +7 -0
- data/gen/Buildfile +16 -0
- data/gen/app/Buildfile +36 -0
- data/gen/app/README +1 -0
- data/gen/app/USAGE +13 -0
- data/gen/app/templates/apps/@target_name@/core.js +27 -0
- data/gen/app/templates/apps/@target_name@/main.js +30 -0
- data/gen/app/templates/apps/@target_name@/resources/loading.rhtml +9 -0
- data/gen/app/templates/apps/@target_name@/resources/main_page.js +24 -0
- data/gen/controller/Buildfile +18 -0
- data/gen/controller/README +1 -0
- data/gen/controller/USAGE +13 -0
- data/gen/controller/templates/controllers/@filename@.js +18 -0
- data/gen/controller/templates/tests/controllers/@filename@.js +15 -0
- data/gen/design/Buildfile +23 -0
- data/gen/design/README +1 -0
- data/gen/design/USAGE +10 -0
- data/gen/design/templates/resources/@filename@.js +16 -0
- data/gen/framework/Buildfile +36 -0
- data/gen/framework/README +1 -0
- data/gen/framework/USAGE +13 -0
- data/gen/framework/templates/frameworks/@target_name@/core.js +21 -0
- data/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +15 -0
- data/gen/language/Buildfile +26 -0
- data/gen/language/README +1 -0
- data/gen/language/USAGE +13 -0
- data/gen/language/templates/@filename@/strings.js +14 -0
- data/gen/model/Buildfile +16 -0
- data/gen/model/README +1 -0
- data/gen/model/USAGE +15 -0
- data/gen/model/templates/fixtures/@filename@.js +35 -0
- data/gen/model/templates/models/@filename@.js +19 -0
- data/gen/model/templates/tests/models/@filename@.js +15 -0
- data/gen/page/Buildfile +36 -0
- data/gen/page/README +1 -0
- data/gen/page/USAGE +15 -0
- data/gen/page/templates/pages/@target_name@/Buildfile +16 -0
- data/gen/page/templates/pages/@target_name@/core.js +22 -0
- data/gen/page/templates/pages/@target_name@/en.lproj/strings.js +14 -0
- data/gen/page/templates/pages/@target_name@/resources/body.css +1 -0
- data/gen/page/templates/pages/@target_name@/resources/body.rhtml +7 -0
- data/gen/project/Buildfile +45 -0
- data/gen/project/INIT +3 -0
- data/gen/project/README +1 -0
- data/gen/project/USAGE +2 -0
- data/gen/project/templates/@filename@/Buildfile +7 -0
- data/gen/project/templates/@filename@/README +7 -0
- data/gen/test/Buildfile +25 -0
- data/gen/test/README +1 -0
- data/gen/test/USAGE +12 -0
- data/gen/test/templates/tests/@filename@.js +15 -0
- data/gen/theme/Buildfile +36 -0
- data/gen/theme/README +1 -0
- data/gen/theme/USAGE +13 -0
- data/gen/theme/templates/themes/@target_name@/resources/theme_styles.css +11 -0
- data/gen/view/Buildfile +18 -0
- data/gen/view/README +1 -0
- data/gen/view/USAGE +13 -0
- data/gen/view/templates/tests/views/@filename@.js +15 -0
- data/gen/view/templates/views/@filename@.js +18 -0
- data/lib/sproutcore/builders/base.rb +91 -0
- data/lib/sproutcore/builders/bundle.rb +63 -0
- data/lib/sproutcore/builders/combine.rb +37 -0
- data/lib/sproutcore/builders/html.rb +205 -0
- data/lib/sproutcore/builders/javascript.rb +62 -0
- data/lib/sproutcore/builders/minify.rb +133 -0
- data/lib/sproutcore/builders/sass.rb +55 -0
- data/lib/sproutcore/builders/strings.rb +44 -0
- data/lib/sproutcore/builders/stylesheet.rb +40 -0
- data/lib/sproutcore/builders/test.rb +59 -0
- data/lib/sproutcore/builders/test_index.rb +26 -0
- data/lib/sproutcore/buildfile/build_task.rb +33 -0
- data/lib/sproutcore/buildfile/buildfile_dsl.rb +162 -0
- data/lib/sproutcore/buildfile/cloneable.rb +34 -0
- data/lib/sproutcore/buildfile/early_time.rb +30 -0
- data/lib/sproutcore/buildfile/invocation_chain.rb +64 -0
- data/lib/sproutcore/buildfile/namespace.rb +33 -0
- data/lib/sproutcore/buildfile/string_ext.rb +198 -0
- data/lib/sproutcore/buildfile/task.rb +304 -0
- data/lib/sproutcore/buildfile/task_arguments.rb +86 -0
- data/lib/sproutcore/buildfile/task_manager.rb +193 -0
- data/lib/sproutcore/buildfile.rb +484 -0
- data/lib/sproutcore/deprecated/view_helper.rb +662 -0
- data/lib/sproutcore/helpers/capture_helper.rb +9 -1
- data/lib/sproutcore/helpers/cssmin.rb +202 -0
- data/lib/sproutcore/helpers/dom_id_helper.rb +8 -1
- data/lib/sproutcore/helpers/entry_sorter.rb +139 -0
- data/lib/sproutcore/helpers/packed_optimizer.rb +102 -0
- data/lib/sproutcore/helpers/static_helper.rb +223 -41
- data/lib/sproutcore/helpers/tag_helper.rb +73 -1
- data/lib/sproutcore/helpers/text_helper.rb +24 -57
- data/lib/sproutcore/models/generator.rb +493 -0
- data/lib/sproutcore/models/hash_struct.rb +109 -0
- data/lib/sproutcore/models/manifest.rb +376 -0
- data/lib/sproutcore/models/manifest_entry.rb +252 -0
- data/lib/sproutcore/models/project.rb +267 -0
- data/lib/sproutcore/models/target.rb +664 -0
- data/lib/sproutcore/rack/builder.rb +331 -0
- data/lib/sproutcore/rack/dev.rb +51 -0
- data/lib/sproutcore/rack/docs.rb +24 -0
- data/lib/sproutcore/rack/filesystem.rb +265 -0
- data/lib/sproutcore/rack/proxy.rb +100 -0
- data/lib/sproutcore/rack/service.rb +155 -0
- data/lib/sproutcore/rack/test_runner.rb +24 -0
- data/lib/sproutcore/render_engines/erubis.rb +55 -0
- data/lib/sproutcore/render_engines/haml.rb +39 -0
- data/lib/sproutcore/tools/build.rb +80 -0
- data/lib/sproutcore/tools/build_number.rb +23 -0
- data/lib/sproutcore/tools/docs.rb +53 -0
- data/lib/sproutcore/tools/gen.rb +99 -0
- data/lib/sproutcore/tools/init.rb +40 -0
- data/lib/sproutcore/tools/manifest.rb +85 -0
- data/lib/sproutcore/tools/server.rb +48 -0
- data/lib/sproutcore/tools.rb +341 -0
- data/lib/sproutcore.rb +141 -18
- data/lib/thor/CHANGELOG.rdoc +52 -0
- data/lib/thor/LICENSE +20 -0
- data/lib/thor/README.markdown +76 -0
- data/lib/thor/Rakefile +6 -0
- data/lib/thor/Thorfile +45 -0
- data/lib/thor/bin/rake2thor +83 -0
- data/lib/thor/bin/thor +7 -0
- data/lib/thor/lib/thor/error.rb +3 -0
- data/lib/thor/lib/thor/options.rb +267 -0
- data/lib/thor/lib/thor/ordered_hash.rb +64 -0
- data/lib/thor/lib/thor/runner.rb +305 -0
- data/lib/thor/lib/thor/task.rb +83 -0
- data/lib/thor/lib/thor/task_hash.rb +22 -0
- data/lib/thor/lib/thor/tasks/package.rb +18 -0
- data/lib/thor/lib/thor/tasks.rb +77 -0
- data/lib/thor/lib/thor/util.rb +75 -0
- data/lib/thor/lib/thor.rb +170 -0
- data/lib/thor/script/destroy +14 -0
- data/lib/thor/script/generate +14 -0
- data/lib/thor/spec/fixtures/task.thor +10 -0
- data/lib/thor/spec/options_spec.rb +271 -0
- data/lib/thor/spec/ordered_hash_spec.rb +84 -0
- data/lib/thor/spec/spec.opts +1 -0
- data/lib/thor/spec/spec_helper.rb +30 -0
- data/lib/thor/spec/task_spec.rb +11 -0
- data/lib/thor/spec/tasks_spec.rb +28 -0
- data/lib/thor/spec/thor_runner_spec.rb +194 -0
- data/lib/thor/spec/thor_spec.rb +206 -0
- data/lib/thor/spec/util_spec.rb +99 -0
- data/lib/thor/task.thor +15 -0
- data/lib/thor/thor.gemspec +29 -0
- data/spec/buildtasks/build/copy_spec.rb +60 -0
- data/spec/buildtasks/build/spec_helper.rb +36 -0
- data/spec/buildtasks/manifest/catalog_spec.rb +48 -0
- data/spec/buildtasks/manifest/hide_buildfiles_spec.rb +126 -0
- data/spec/buildtasks/manifest/localize_spec.rb +97 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/bundle_spec.rb +254 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +246 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/css_spec.rb +87 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/html_spec.rb +175 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/javascript_spec.rb +65 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb +70 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +152 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/sass_spec.rb +98 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/strings_spec.rb +64 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/tests_spec.rb +163 -0
- data/spec/buildtasks/manifest/prepare_spec.rb +43 -0
- data/spec/buildtasks/manifest/spec_helper.rb +35 -0
- data/spec/buildtasks/target_spec.rb +270 -0
- data/spec/fixtures/builder_tests/Buildfile +20 -0
- data/spec/fixtures/builder_tests/apps/bundle_test/bundle.js +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/a.js +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/b.js +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/c.js +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/a.css +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/b.css +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/c.css +1 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/bar1_sample.rhtml +2 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/erb_sample.html.erb +1 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/icons/image.png +0 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/image.jpg +0 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/rhtml_sample.rhtml +1 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/strings.js +4 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/style.css +0 -0
- data/spec/fixtures/builder_tests/apps/html_test/french.lproj/french-icons/fr.png +0 -0
- data/spec/fixtures/builder_tests/apps/html_test/french.lproj/strings.js +4 -0
- data/spec/fixtures/builder_tests/apps/html_test/lib/layout_template.rhtml +1 -0
- data/spec/fixtures/builder_tests/apps/html_test/scripts.js +0 -0
- data/spec/fixtures/builder_tests/apps/javascript_test/sc_static.js +15 -0
- data/spec/fixtures/builder_tests/apps/javascript_test/sc_super.js +4 -0
- data/spec/fixtures/builder_tests/apps/javascript_test/strings.js +7 -0
- data/spec/fixtures/builder_tests/apps/sass_test/sample.sass +3 -0
- data/spec/fixtures/builder_tests/apps/strings_test/lproj/strings.js +8 -0
- data/spec/fixtures/builder_tests/apps/stylesheet_test/build_directives.css +9 -0
- data/spec/fixtures/builder_tests/apps/stylesheet_test/sc_static.css +12 -0
- data/spec/fixtures/builder_tests/apps/test_test/lib/alt_layout.rhtml +1 -0
- data/spec/fixtures/builder_tests/apps/test_test/lib/test_layout.rhtml +3 -0
- data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test.js +1 -0
- data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test2.js +1 -0
- data/spec/fixtures/builder_tests/apps/test_test/tests/rhtml_test.rhtml +4 -0
- data/spec/fixtures/builder_tests/frameworks/debug/core.js +0 -0
- data/spec/fixtures/builder_tests/frameworks/debug/english.lproj/dummy.css +0 -0
- data/spec/fixtures/builder_tests/frameworks/dynamic_req_target_1/dynamic_req_js_1.js +0 -0
- data/spec/fixtures/builder_tests/frameworks/dynamic_req_target_1/english.lproj/dynamic_req_style_1.css +0 -0
- data/spec/fixtures/builder_tests/frameworks/qunit/core.js +0 -0
- data/spec/fixtures/builder_tests/frameworks/qunit/english.lproj/dummy.css +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/req_style_1.css +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/strings.js +4 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/test.rhtml +1 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_1/req_js_1.js +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/req_style_2.css +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/test.rhtml +1 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/javascript.js +1 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/lib/alt_layout.rhtml +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/req_js_2.js +0 -0
- data/spec/fixtures/builder_tests/themes/sample_theme/Buildfile +1 -0
- data/spec/fixtures/buildfiles/basic/Buildfile +16 -0
- data/spec/fixtures/buildfiles/basic/task_module.rake +6 -0
- data/spec/fixtures/buildfiles/installed/Buildfile +7 -0
- data/spec/fixtures/buildfiles/installed/Buildfile2 +5 -0
- data/spec/fixtures/buildfiles/project_test/Buildfile +4 -0
- data/spec/fixtures/buildfiles/project_test/not_project/Buildfile +2 -0
- data/spec/fixtures/buildfiles/project_test/not_project/child/PLACEHOLDER +0 -0
- data/spec/fixtures/entry_for_project/Buildfile +1 -0
- data/spec/fixtures/entry_for_project/apps/test_app/entry.txt +0 -0
- data/spec/fixtures/entry_for_project/apps/test_app/frameworks/nested/PLACEHOLDER +0 -0
- data/spec/fixtures/entry_for_project/frameworks/shared/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/Buildfile +8 -0
- data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/custom_foos/Buildfile +5 -0
- data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/custom_foos/foos/not_foo1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/nested/Buildfile +8 -0
- data/spec/fixtures/find_targets/nested/apps/app1/Buildfile +1 -0
- data/spec/fixtures/find_targets/nested/apps/app1/apps/nested_app/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/clients/client1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/frameworks/framework1/frameworks/framework1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/frameworks/framework2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/themes/theme1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/themes/theme2/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/caps_long_names/English.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/caps_long_names/FreNCH.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/caps_long_names/UnknOWN.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/english.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/french.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/german.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/italian.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/japanese.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/spanish.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/unknown.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/no_names/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/de.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/en-CA.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/en-GB.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/en-US.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/en.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/es.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/foo.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/fr.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/it.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/ja.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/1.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/B.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/a/a.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/a/b.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/a.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/b/a.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/c.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/core.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/B.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/a.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/b.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/b/a.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/c.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/lproj/strings.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/utils.js +1 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/a.js +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/b.js +3 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/c.js +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/a.css +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/b.css +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/c.css +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/d.js +1 -0
- data/spec/fixtures/real_world/Buildfile +12 -0
- data/spec/fixtures/real_world/apps/account/README +1 -0
- data/spec/fixtures/real_world/apps/calendar/README +1 -0
- data/spec/fixtures/real_world/apps/contacts/README_BEFORE_EDITING +1 -0
- data/spec/fixtures/real_world/apps/files/README +1 -0
- data/spec/fixtures/real_world/apps/mail/README +1 -0
- data/spec/fixtures/real_world/apps/mobile_photos/README +1 -0
- data/spec/fixtures/real_world/apps/photos/README +1 -0
- data/spec/fixtures/real_world/apps/uploader/README +1 -0
- data/spec/fixtures/real_world/frameworks/core_files/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/core_photos/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/shared/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/Buildfile +26 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/README +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/apps/docs/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/apps/test_runner/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/core.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/debug/debug-resource.html +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/debug/sample_debug.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/demo2.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/debug/sample_debug-loc.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.css +4 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.html +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo2.sass +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.haml +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.html.erb +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.rhtml +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/fixtures/sample_fixtures-loc.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/has_require.css +4 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_require.css +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_sc_resource.rhtml +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/protocols/sample-loc.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.css +6 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.rhtml +3 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/strings.js +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/tests/sample-loc.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample-json-fixture.json +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample_fixtures.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/application/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/costello/core.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/data_store/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/debug/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/desktop/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/empty_theme/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/foundation/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/mobile/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/qunit/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/uploader/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/french-resource.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/strings.js +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/german-resource.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/strings.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/has_require.js +4 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/lib/index.html +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/no_require.js +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/protocols/sample.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/resources/boo.png +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/sc_resource.js +6 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample1.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample2.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.rhtml +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/themes/standard_theme/README +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/views/view.js +1 -0
- data/spec/fixtures/real_world/generators/sample_custom/Buildfile +0 -0
- data/spec/fixtures/recursive_project/Buildfile +8 -0
- data/spec/fixtures/recursive_project/frameworks/sproutcore/frameworks/costello/PLACEHOLDER +0 -0
- data/spec/lib/builders/bundle_spec.rb +294 -0
- data/spec/lib/builders/combine_spec.rb +67 -0
- data/spec/lib/builders/html_spec.rb +579 -0
- data/spec/lib/builders/javascript_spec.rb +81 -0
- data/spec/lib/builders/sass_spec.rb +43 -0
- data/spec/lib/builders/spec_helper.rb +30 -0
- data/spec/lib/builders/strings_spec.rb +52 -0
- data/spec/lib/builders/stylesheet_spec.rb +63 -0
- data/spec/lib/builders/test_index_spec.rb +44 -0
- data/spec/lib/builders/test_spec.rb +136 -0
- data/spec/lib/buildfile/config_for_spec.rb +81 -0
- data/spec/lib/buildfile/define_spec.rb +59 -0
- data/spec/lib/buildfile/dup_spec.rb +65 -0
- data/spec/lib/buildfile/invoke_spec.rb +130 -0
- data/spec/lib/buildfile/load_spec.rb +49 -0
- data/spec/lib/buildfile/task/dup_spec.rb +55 -0
- data/spec/lib/buildfile/task_defined_spec.rb +17 -0
- data/spec/lib/buildfile_commands/build_task_spec.rb +19 -0
- data/spec/lib/buildfile_commands/config_spec.rb +97 -0
- data/spec/lib/buildfile_commands/import_spec.rb +17 -0
- data/spec/lib/buildfile_commands/namespace_spec.rb +18 -0
- data/spec/lib/buildfile_commands/proxies_spec.rb +38 -0
- data/spec/lib/buildfile_commands/replace_task_spec.rb +29 -0
- data/spec/lib/buildfile_commands/task_spec.rb +36 -0
- data/spec/lib/helpers/packing_optimizer/optimize_spec.rb +26 -0
- data/spec/lib/models/hash_struct/deep_clone_spec.rb +27 -0
- data/spec/lib/models/hash_struct/has_options_spec.rb +32 -0
- data/spec/lib/models/hash_struct/hash_spec.rb +64 -0
- data/spec/lib/models/hash_struct/merge_spec.rb +26 -0
- data/spec/lib/models/hash_struct/method_missing.rb +41 -0
- data/spec/lib/models/manifest/add_entry_spec.rb +36 -0
- data/spec/lib/models/manifest/add_transform_spec.rb +91 -0
- data/spec/lib/models/manifest/build_spec.rb +78 -0
- data/spec/lib/models/manifest/entry_for_spec.rb +94 -0
- data/spec/lib/models/manifest/find_entry.rb +97 -0
- data/spec/lib/models/manifest/prepare_spec.rb +62 -0
- data/spec/lib/models/manifest_entry/cacheable_url_spec.rb +31 -0
- data/spec/lib/models/manifest_entry/prepare_spec.rb +54 -0
- data/spec/lib/models/project/add_target_spec.rb +44 -0
- data/spec/lib/models/project/buildfile_spec.rb +35 -0
- data/spec/lib/models/project/find_targets_for_spec.rb +78 -0
- data/spec/lib/models/project/load_nearest_project_spec.rb +23 -0
- data/spec/lib/models/project/target_for_spec.rb +33 -0
- data/spec/lib/models/project/targets_spec.rb +62 -0
- data/spec/lib/models/target/compute_build_number_spec.rb +125 -0
- data/spec/lib/models/target/config_spec.rb +30 -0
- data/spec/lib/models/target/expand_required_targets_spec.rb +48 -0
- data/spec/lib/models/target/installed_languages_spec.rb +47 -0
- data/spec/lib/models/target/lproj_for_spec.rb +38 -0
- data/spec/lib/models/target/manifest_for_spec.rb +42 -0
- data/spec/lib/models/target/parent_target_spec.rb +21 -0
- data/spec/lib/models/target/prepare_spec.rb +53 -0
- data/spec/lib/models/target/required_targets_spec.rb +119 -0
- data/spec/lib/models/target/target_for_spec.rb +56 -0
- data/spec/lib/tools/build_number_spec.rb +28 -0
- data/spec/lib/tools/gen_spec.rb +207 -0
- data/spec/lib/tools/tools_spec.rb +78 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +137 -6
- data/sproutcore-abbot.gemspec +1582 -0
- data/vendor/github_gem_lint.rb +22 -0
- data/{jsdoc → vendor/jsdoc}/README.txt +0 -0
- data/vendor/jsdoc/app/frame/Chain.js +102 -0
- data/vendor/jsdoc/app/frame/Dumper.js +144 -0
- data/vendor/jsdoc/app/frame/Hash.js +47 -0
- data/vendor/jsdoc/app/frame/Link.js +142 -0
- data/vendor/jsdoc/app/frame/Namespace.js +10 -0
- data/vendor/jsdoc/app/frame/Opt.js +134 -0
- data/vendor/jsdoc/app/frame/Reflection.js +26 -0
- data/vendor/jsdoc/app/frame/String.js +93 -0
- data/vendor/jsdoc/app/frame/Testrun.js +129 -0
- data/vendor/jsdoc/app/frame.js +33 -0
- data/vendor/jsdoc/app/handlers/FOODOC.js +26 -0
- data/{jsdoc → vendor/jsdoc}/app/handlers/XMLDOC/DomReader.js +0 -0
- data/{jsdoc → vendor/jsdoc}/app/handlers/XMLDOC/XMLDoc.js +0 -0
- data/{jsdoc → vendor/jsdoc}/app/handlers/XMLDOC/XMLParse.js +0 -0
- data/vendor/jsdoc/app/handlers/XMLDOC.js +26 -0
- data/vendor/jsdoc/app/lib/JSDOC/DocComment.js +200 -0
- data/vendor/jsdoc/app/lib/JSDOC/DocTag.js +294 -0
- data/vendor/jsdoc/app/lib/JSDOC/JsDoc.js +162 -0
- data/vendor/jsdoc/app/lib/JSDOC/JsPlate.js +100 -0
- data/vendor/jsdoc/app/lib/JSDOC/Lang.js +144 -0
- data/vendor/jsdoc/app/lib/JSDOC/Parser.js +109 -0
- data/vendor/jsdoc/app/lib/JSDOC/PluginManager.js +33 -0
- data/vendor/jsdoc/app/lib/JSDOC/Symbol.js +681 -0
- data/vendor/jsdoc/app/lib/JSDOC/SymbolSet.js +226 -0
- data/vendor/jsdoc/app/lib/JSDOC/TextStream.js +41 -0
- data/vendor/jsdoc/app/lib/JSDOC/Token.js +18 -0
- data/vendor/jsdoc/app/lib/JSDOC/TokenReader.js +332 -0
- data/vendor/jsdoc/app/lib/JSDOC/TokenStream.js +133 -0
- data/vendor/jsdoc/app/lib/JSDOC/Util.js +32 -0
- data/vendor/jsdoc/app/lib/JSDOC/Walker.js +453 -0
- data/vendor/jsdoc/app/lib/JSDOC.js +98 -0
- data/vendor/jsdoc/app/main.js +74 -0
- data/vendor/jsdoc/app/plugins/commentSrcJson.js +19 -0
- data/vendor/jsdoc/app/plugins/frameworkPrototype.js +16 -0
- data/vendor/jsdoc/app/plugins/functionCall.js +10 -0
- data/vendor/jsdoc/app/plugins/publishSrcHilite.js +62 -0
- data/{jsdoc → vendor/jsdoc}/app/plugins/sproutcoreTags.js +0 -0
- data/vendor/jsdoc/app/plugins/symbolLink.js +9 -0
- data/vendor/jsdoc/app/plugins/tagParamConfig.js +31 -0
- data/vendor/jsdoc/app/plugins/tagSynonyms.js +43 -0
- data/vendor/jsdoc/app/run.js +346 -0
- data/vendor/jsdoc/app/t/TestDoc.js +144 -0
- data/{jsdoc → vendor/jsdoc/app}/t/runner.js +0 -0
- data/{jsdoc → vendor/jsdoc/app}/test/addon.js +0 -0
- data/{jsdoc → vendor/jsdoc/app}/test/anon_inner.js +0 -0
- data/vendor/jsdoc/app/test/augments.js +31 -0
- data/vendor/jsdoc/app/test/augments2.js +26 -0
- data/vendor/jsdoc/app/test/borrows.js +41 -0
- data/vendor/jsdoc/app/test/borrows2.js +23 -0
- data/{jsdoc → vendor/jsdoc/app}/test/config.js +0 -0
- data/vendor/jsdoc/app/test/constructs.js +18 -0
- data/{jsdoc → vendor/jsdoc/app}/test/encoding.js +0 -0
- data/{jsdoc → vendor/jsdoc/app}/test/encoding_other.js +0 -0
- data/vendor/jsdoc/app/test/functions_anon.js +39 -0
- data/vendor/jsdoc/app/test/functions_nested.js +33 -0
- data/vendor/jsdoc/app/test/global.js +13 -0
- data/vendor/jsdoc/app/test/globals.js +25 -0
- data/vendor/jsdoc/app/test/ignore.js +10 -0
- data/{jsdoc → vendor/jsdoc/app}/test/inner.js +0 -0
- data/vendor/jsdoc/app/test/jsdoc_test.js +477 -0
- data/vendor/jsdoc/app/test/lend.js +33 -0
- data/vendor/jsdoc/app/test/memberof.js +20 -0
- data/vendor/jsdoc/app/test/memberof_constructor.js +15 -0
- data/vendor/jsdoc/app/test/name.js +19 -0
- data/vendor/jsdoc/app/test/namespace_nested.js +23 -0
- data/{jsdoc → vendor/jsdoc/app}/test/nocode.js +0 -0
- data/vendor/jsdoc/app/test/oblit_anon.js +20 -0
- data/vendor/jsdoc/app/test/overview.js +20 -0
- data/vendor/jsdoc/app/test/param_inline.js +37 -0
- data/{jsdoc → vendor/jsdoc/app}/test/params_optional.js +0 -0
- data/vendor/jsdoc/app/test/prototype.js +17 -0
- data/{jsdoc → vendor/jsdoc/app}/test/prototype_nested.js +0 -0
- data/vendor/jsdoc/app/test/prototype_oblit.js +13 -0
- data/vendor/jsdoc/app/test/prototype_oblit_constructor.js +24 -0
- data/vendor/jsdoc/app/test/public.js +10 -0
- data/{jsdoc → vendor/jsdoc/app}/test/shared.js +0 -0
- data/{jsdoc → vendor/jsdoc/app}/test/shared2.js +0 -0
- data/vendor/jsdoc/app/test/shortcuts.js +22 -0
- data/vendor/jsdoc/app/test/static_this.js +13 -0
- data/vendor/jsdoc/app/test/synonyms.js +23 -0
- data/{jsdoc → vendor/jsdoc/app}/test/tosource.js +0 -0
- data/vendor/jsdoc/app/test/variable_redefine.js +14 -0
- data/vendor/jsdoc/app/test.js +304 -0
- data/{jsdoc → vendor/jsdoc}/changes.txt +0 -0
- data/{jsdoc → vendor/jsdoc}/conf/sample.conf +0 -0
- data/{jsdoc → vendor/jsdoc}/java/build.xml +0 -0
- data/{jsdoc → vendor/jsdoc}/java/build_1.4.xml +0 -0
- data/{jsdoc → vendor/jsdoc}/java/classes/js.jar +0 -0
- data/{jsdoc → vendor/jsdoc}/java/src/JsDebugRun.java +0 -0
- data/{jsdoc → vendor/jsdoc}/java/src/JsRun.java +0 -0
- data/{jsdoc → vendor/jsdoc}/jsdebug.jar +0 -0
- data/{jsdoc → vendor/jsdoc}/jsrun.jar +0 -0
- data/{jsdoc → vendor/jsdoc}/t/TestDoc.js +0 -0
- data/vendor/jsdoc/t/runner.js +13 -0
- data/vendor/jsdoc/test/addon.js +24 -0
- data/vendor/jsdoc/test/anon_inner.js +14 -0
- data/{jsdoc → vendor/jsdoc}/test/augments.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/augments2.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/borrows.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/borrows2.js +0 -0
- data/vendor/jsdoc/test/config.js +22 -0
- data/{jsdoc → vendor/jsdoc}/test/constructs.js +0 -0
- data/vendor/jsdoc/test/encoding.js +10 -0
- data/vendor/jsdoc/test/encoding_other.js +12 -0
- data/{jsdoc → vendor/jsdoc}/test/functions_anon.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/functions_nested.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/global.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/globals.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/ignore.js +0 -0
- data/vendor/jsdoc/test/inner.js +16 -0
- data/{jsdoc → vendor/jsdoc}/test/jsdoc_test.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/lend.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/memberof.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/memberof_constructor.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/name.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/namespace_nested.js +0 -0
- data/vendor/jsdoc/test/nocode.js +13 -0
- data/{jsdoc → vendor/jsdoc}/test/oblit_anon.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/overview.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/param_inline.js +0 -0
- data/vendor/jsdoc/test/params_optional.js +8 -0
- data/{jsdoc → vendor/jsdoc}/test/prototype.js +0 -0
- data/vendor/jsdoc/test/prototype_nested.js +9 -0
- data/{jsdoc → vendor/jsdoc}/test/prototype_oblit.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/prototype_oblit_constructor.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/public.js +0 -0
- data/vendor/jsdoc/test/shared.js +42 -0
- data/vendor/jsdoc/test/shared2.js +2 -0
- data/{jsdoc → vendor/jsdoc}/test/shortcuts.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/static_this.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test/synonyms.js +0 -0
- data/vendor/jsdoc/test/tosource.js +23 -0
- data/{jsdoc → vendor/jsdoc}/test/variable_redefine.js +0 -0
- data/{jsdoc → vendor/jsdoc}/test.js +0 -0
- data/{yui_compressor → vendor/yui-compressor}/yuicompressor-2.4.2.jar +0 -0
- metadata +1537 -431
- data/License.txt +0 -20
- data/Manifest.txt +0 -415
- data/app_generators/sproutcore/USAGE +0 -4
- data/app_generators/sproutcore/sproutcore_generator.rb +0 -68
- data/app_generators/sproutcore/templates/README +0 -80
- data/app_generators/sproutcore/templates/sc-config +0 -93
- data/bin/sc-ide +0 -278
- data/bin/sc-install +0 -101
- data/bin/sc-remove +0 -99
- data/bin/sc-update +0 -99
- data/clients/sc_docs/HISTORY +0 -3
- data/clients/sc_docs/README +0 -6
- data/clients/sc_docs/controllers/docs.js +0 -150
- data/clients/sc_docs/core.js +0 -19
- data/clients/sc_docs/english.lproj/body.css +0 -112
- data/clients/sc_docs/english.lproj/body.rhtml +0 -58
- data/clients/sc_docs/english.lproj/no_docs.rhtml +0 -8
- data/clients/sc_docs/english.lproj/strings.js +0 -14
- data/clients/sc_docs/english.lproj/tabs.rhtml +0 -16
- data/clients/sc_docs/fixtures/doc.js +0 -11
- data/clients/sc_docs/main.js +0 -26
- data/clients/sc_docs/models/doc.js +0 -15
- data/clients/sc_docs/tests/controllers/docs.rhtml +0 -20
- data/clients/sc_docs/tests/models/doc.rhtml +0 -20
- data/clients/sc_docs/tests/views/doc_frame.rhtml +0 -20
- data/clients/sc_docs/tests/views/doc_label_view.rhtml +0 -20
- data/clients/sc_docs/views/doc_frame.js +0 -33
- data/clients/sc_docs/views/doc_label.js +0 -20
- data/clients/sc_test_runner/HISTORY +0 -3
- data/clients/sc_test_runner/README +0 -4
- data/clients/sc_test_runner/controllers/runner.js +0 -203
- data/clients/sc_test_runner/core.js +0 -19
- data/clients/sc_test_runner/english.lproj/body.css +0 -91
- data/clients/sc_test_runner/english.lproj/body.rhtml +0 -76
- data/clients/sc_test_runner/english.lproj/icons/small/next.png +0 -0
- data/clients/sc_test_runner/english.lproj/icons/small/reset.png +0 -0
- data/clients/sc_test_runner/english.lproj/images/gradients.png +0 -0
- data/clients/sc_test_runner/english.lproj/images/toolbar.png +0 -0
- data/clients/sc_test_runner/english.lproj/no_tests.rhtml +0 -5
- data/clients/sc_test_runner/english.lproj/strings.js +0 -14
- data/clients/sc_test_runner/fixtures/test.js +0 -12
- data/clients/sc_test_runner/main.js +0 -21
- data/clients/sc_test_runner/models/test.js +0 -27
- data/clients/sc_test_runner/views/runner_frame.js +0 -74
- data/clients/sc_test_runner/views/test_label.js +0 -20
- data/config/hoe.rb +0 -72
- data/config/requirements.rb +0 -17
- data/frameworks/prototype/HISTORY +0 -3
- data/frameworks/prototype/README +0 -2
- data/frameworks/prototype/prototype.js +0 -4223
- data/frameworks/sproutcore/controllers/array.js +0 -409
- data/frameworks/sproutcore/controllers/collection.js +0 -203
- data/frameworks/sproutcore/controllers/controller.js +0 -323
- data/frameworks/sproutcore/controllers/object.js +0 -401
- data/frameworks/sproutcore/core.js +0 -636
- data/frameworks/sproutcore/debug/trace.js +0 -81
- data/frameworks/sproutcore/debug/unittest.js +0 -626
- data/frameworks/sproutcore/drag/drag.js +0 -788
- data/frameworks/sproutcore/drag/drag_data_source.js +0 -40
- data/frameworks/sproutcore/drag/drag_source.js +0 -75
- data/frameworks/sproutcore/drag/drop_target.js +0 -160
- data/frameworks/sproutcore/english.lproj/buttons.css +0 -694
- data/frameworks/sproutcore/english.lproj/core.css +0 -145
- data/frameworks/sproutcore/english.lproj/detect-browser +0 -44
- data/frameworks/sproutcore/english.lproj/icons.css +0 -227
- data/frameworks/sproutcore/english.lproj/images/indicator.gif +0 -0
- data/frameworks/sproutcore/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/english.lproj/menu.css +0 -122
- data/frameworks/sproutcore/english.lproj/panes.css +0 -136
- data/frameworks/sproutcore/english.lproj/picker.css +0 -22
- data/frameworks/sproutcore/english.lproj/splitview.css +0 -83
- data/frameworks/sproutcore/english.lproj/strings.js +0 -20
- data/frameworks/sproutcore/english.lproj/tab.css +0 -23
- data/frameworks/sproutcore/english.lproj/tests.css +0 -67
- data/frameworks/sproutcore/english.lproj/theme.css +0 -502
- data/frameworks/sproutcore/foundation/animator.js +0 -679
- data/frameworks/sproutcore/foundation/application.js +0 -228
- data/frameworks/sproutcore/foundation/benchmark.js +0 -244
- data/frameworks/sproutcore/foundation/binding.js +0 -385
- data/frameworks/sproutcore/foundation/date.js +0 -357
- data/frameworks/sproutcore/foundation/enumerator.js +0 -105
- data/frameworks/sproutcore/foundation/error.js +0 -84
- data/frameworks/sproutcore/foundation/input_manager.js +0 -165
- data/frameworks/sproutcore/foundation/json.js +0 -296
- data/frameworks/sproutcore/foundation/mock.js +0 -42
- data/frameworks/sproutcore/foundation/node_descriptor.js +0 -71
- data/frameworks/sproutcore/foundation/object.js +0 -875
- data/frameworks/sproutcore/foundation/page.js +0 -67
- data/frameworks/sproutcore/foundation/path_module.js +0 -431
- data/frameworks/sproutcore/foundation/responder.js +0 -313
- data/frameworks/sproutcore/foundation/routes.js +0 -375
- data/frameworks/sproutcore/foundation/run_loop.js +0 -322
- data/frameworks/sproutcore/foundation/set.js +0 -222
- data/frameworks/sproutcore/foundation/string.js +0 -319
- data/frameworks/sproutcore/foundation/timer.js +0 -405
- data/frameworks/sproutcore/foundation/undo_manager.js +0 -186
- data/frameworks/sproutcore/foundation/utils.js +0 -320
- data/frameworks/sproutcore/globals/panels.js +0 -182
- data/frameworks/sproutcore/globals/popups.js +0 -61
- data/frameworks/sproutcore/globals/window.js +0 -498
- data/frameworks/sproutcore/lib/button_views.rb +0 -330
- data/frameworks/sproutcore/lib/collection_view.rb +0 -83
- data/frameworks/sproutcore/lib/core_views.rb +0 -326
- data/frameworks/sproutcore/lib/form_views.rb +0 -253
- data/frameworks/sproutcore/lib/menu_views.rb +0 -93
- data/frameworks/sproutcore/mixins/array.js +0 -265
- data/frameworks/sproutcore/mixins/collection_view_delegate.js +0 -201
- data/frameworks/sproutcore/mixins/control.js +0 -265
- data/frameworks/sproutcore/mixins/delegate_support.js +0 -66
- data/frameworks/sproutcore/mixins/editable.js +0 -144
- data/frameworks/sproutcore/mixins/enumerable.js +0 -1002
- data/frameworks/sproutcore/mixins/inline_editor_delegate.js +0 -82
- data/frameworks/sproutcore/mixins/observable.js +0 -1060
- data/frameworks/sproutcore/mixins/scrollable.js +0 -246
- data/frameworks/sproutcore/mixins/selection_support.js +0 -160
- data/frameworks/sproutcore/mixins/validatable.js +0 -152
- data/frameworks/sproutcore/models/collection.js +0 -421
- data/frameworks/sproutcore/models/record.js +0 -811
- data/frameworks/sproutcore/models/store.js +0 -352
- data/frameworks/sproutcore/panes/dialog.js +0 -16
- data/frameworks/sproutcore/panes/manager.js +0 -164
- data/frameworks/sproutcore/panes/menu.js +0 -45
- data/frameworks/sproutcore/panes/overlay.js +0 -235
- data/frameworks/sproutcore/panes/pane.js +0 -117
- data/frameworks/sproutcore/panes/panel.js +0 -19
- data/frameworks/sproutcore/panes/picker.js +0 -46
- data/frameworks/sproutcore/server/rails_server.js +0 -79
- data/frameworks/sproutcore/server/rest_server.js +0 -177
- data/frameworks/sproutcore/server/server.js +0 -629
- data/frameworks/sproutcore/tests/controllers/array.rhtml +0 -126
- data/frameworks/sproutcore/tests/controllers/controller.rhtml +0 -273
- data/frameworks/sproutcore/tests/controllers/object.rhtml +0 -353
- data/frameworks/sproutcore/tests/core/guidFor.rhtml +0 -114
- data/frameworks/sproutcore/tests/foundation/application.rhtml +0 -125
- data/frameworks/sproutcore/tests/foundation/array.rhtml +0 -220
- data/frameworks/sproutcore/tests/foundation/object.rhtml +0 -69
- data/frameworks/sproutcore/tests/foundation/set.rhtml +0 -254
- data/frameworks/sproutcore/tests/foundation/timer/invalidate.rhtml +0 -33
- data/frameworks/sproutcore/tests/foundation/timer/invokeLater.rhtml +0 -145
- data/frameworks/sproutcore/tests/foundation/timer/isPaused.rhtml +0 -70
- data/frameworks/sproutcore/tests/foundation/timer/schedule.rhtml +0 -145
- data/frameworks/sproutcore/tests/globals/window.rhtml +0 -45
- data/frameworks/sproutcore/tests/mixins/enumerable.rhtml +0 -421
- data/frameworks/sproutcore/tests/mixins/observable.rhtml +0 -127
- data/frameworks/sproutcore/tests/models/collection.rhtml +0 -160
- data/frameworks/sproutcore/tests/models/model.rhtml +0 -373
- data/frameworks/sproutcore/tests/panes/pane.rhtml +0 -88
- data/frameworks/sproutcore/tests/views/checkbox.rhtml +0 -21
- data/frameworks/sproutcore/tests/views/collection/base.rhtml +0 -211
- data/frameworks/sproutcore/tests/views/collection/incremental_rendering.rhtml +0 -260
- data/frameworks/sproutcore/tests/views/collection/source_list_rendering.rhtml +0 -232
- data/frameworks/sproutcore/tests/views/image_cell.rhtml +0 -19
- data/frameworks/sproutcore/tests/views/label_item.rhtml +0 -19
- data/frameworks/sproutcore/tests/views/list.rhtml +0 -20
- data/frameworks/sproutcore/tests/views/list_item.rhtml +0 -20
- data/frameworks/sproutcore/tests/views/popup_button.rhtml +0 -116
- data/frameworks/sproutcore/tests/views/slider.rhtml +0 -20
- data/frameworks/sproutcore/tests/views/text_cell.rhtml +0 -19
- data/frameworks/sproutcore/tests/views/text_field.rhtml +0 -37
- data/frameworks/sproutcore/tests/views/view/clippingFrame.rhtml +0 -401
- data/frameworks/sproutcore/tests/views/view/frame.rhtml +0 -357
- data/frameworks/sproutcore/tests/views/view/innerFrame.rhtml +0 -366
- data/frameworks/sproutcore/tests/views/view/isVisibleInWindow.rhtml +0 -148
- data/frameworks/sproutcore/tests/views/view/scrollFrame.rhtml +0 -467
- data/frameworks/sproutcore/validators/credit_card.js +0 -112
- data/frameworks/sproutcore/validators/date.js +0 -50
- data/frameworks/sproutcore/validators/email.js +0 -47
- data/frameworks/sproutcore/validators/not_empty.js +0 -34
- data/frameworks/sproutcore/validators/number.js +0 -69
- data/frameworks/sproutcore/validators/password.js +0 -89
- data/frameworks/sproutcore/validators/validator.js +0 -314
- data/frameworks/sproutcore/views/button/button.js +0 -478
- data/frameworks/sproutcore/views/button/checkbox.js +0 -29
- data/frameworks/sproutcore/views/button/disclosure.js +0 -42
- data/frameworks/sproutcore/views/button/radio.js +0 -29
- data/frameworks/sproutcore/views/collection/collection.js +0 -2764
- data/frameworks/sproutcore/views/collection/grid.js +0 -251
- data/frameworks/sproutcore/views/collection/image_cell.js +0 -125
- data/frameworks/sproutcore/views/collection/list.js +0 -162
- data/frameworks/sproutcore/views/collection/source_list.js +0 -458
- data/frameworks/sproutcore/views/collection/table.js +0 -118
- data/frameworks/sproutcore/views/container.js +0 -67
- data/frameworks/sproutcore/views/error_explanation.js +0 -58
- data/frameworks/sproutcore/views/field/checkbox_field.js +0 -40
- data/frameworks/sproutcore/views/field/field.js +0 -218
- data/frameworks/sproutcore/views/field/radio_field.js +0 -122
- data/frameworks/sproutcore/views/field/select_field.js +0 -307
- data/frameworks/sproutcore/views/field/text_field.js +0 -251
- data/frameworks/sproutcore/views/field/textarea_field.js +0 -32
- data/frameworks/sproutcore/views/filter_button.js +0 -29
- data/frameworks/sproutcore/views/form.js +0 -597
- data/frameworks/sproutcore/views/image.js +0 -255
- data/frameworks/sproutcore/views/inline_text_field.js +0 -427
- data/frameworks/sproutcore/views/label.js +0 -243
- data/frameworks/sproutcore/views/list_item.js +0 -516
- data/frameworks/sproutcore/views/menu_item.js +0 -97
- data/frameworks/sproutcore/views/pagination.js +0 -62
- data/frameworks/sproutcore/views/popup_button.js +0 -90
- data/frameworks/sproutcore/views/popup_menu.js +0 -139
- data/frameworks/sproutcore/views/progress.js +0 -125
- data/frameworks/sproutcore/views/radio_group.js +0 -48
- data/frameworks/sproutcore/views/scroll.js +0 -74
- data/frameworks/sproutcore/views/segmented.js +0 -105
- data/frameworks/sproutcore/views/slider.js +0 -134
- data/frameworks/sproutcore/views/source_list_group.js +0 -130
- data/frameworks/sproutcore/views/spinner.js +0 -11
- data/frameworks/sproutcore/views/split.js +0 -312
- data/frameworks/sproutcore/views/split_divider.js +0 -112
- data/frameworks/sproutcore/views/tab.js +0 -128
- data/frameworks/sproutcore/views/toolbar.js +0 -29
- data/frameworks/sproutcore/views/view.js +0 -2301
- data/jsdoc/app/frame/Chain.js +0 -102
- data/jsdoc/app/frame/Dumper.js +0 -144
- data/jsdoc/app/frame/Hash.js +0 -47
- data/jsdoc/app/frame/Link.js +0 -142
- data/jsdoc/app/frame/Namespace.js +0 -10
- data/jsdoc/app/frame/Opt.js +0 -134
- data/jsdoc/app/frame/Reflection.js +0 -26
- data/jsdoc/app/frame/String.js +0 -93
- data/jsdoc/app/frame/Testrun.js +0 -129
- data/jsdoc/app/frame.js +0 -33
- data/jsdoc/app/handlers/FOODOC.js +0 -26
- data/jsdoc/app/handlers/XMLDOC.js +0 -26
- data/jsdoc/app/lib/JSDOC/DocComment.js +0 -200
- data/jsdoc/app/lib/JSDOC/DocTag.js +0 -294
- data/jsdoc/app/lib/JSDOC/JsDoc.js +0 -180
- data/jsdoc/app/lib/JSDOC/JsPlate.js +0 -100
- data/jsdoc/app/lib/JSDOC/Lang.js +0 -144
- data/jsdoc/app/lib/JSDOC/Parser.js +0 -109
- data/jsdoc/app/lib/JSDOC/PluginManager.js +0 -33
- data/jsdoc/app/lib/JSDOC/Symbol.js +0 -600
- data/jsdoc/app/lib/JSDOC/SymbolSet.js +0 -220
- data/jsdoc/app/lib/JSDOC/TextStream.js +0 -41
- data/jsdoc/app/lib/JSDOC/Token.js +0 -18
- data/jsdoc/app/lib/JSDOC/TokenReader.js +0 -323
- data/jsdoc/app/lib/JSDOC/TokenStream.js +0 -133
- data/jsdoc/app/lib/JSDOC/Util.js +0 -32
- data/jsdoc/app/lib/JSDOC/Walker.js +0 -416
- data/jsdoc/app/lib/JSDOC.js +0 -97
- data/jsdoc/app/main.js +0 -74
- data/jsdoc/app/plugins/commentSrcJson.js +0 -19
- data/jsdoc/app/plugins/frameworkPrototype.js +0 -16
- data/jsdoc/app/plugins/functionCall.js +0 -10
- data/jsdoc/app/plugins/publishSrcHilite.js +0 -62
- data/jsdoc/app/plugins/symbolLink.js +0 -9
- data/jsdoc/app/plugins/tagParamConfig.js +0 -31
- data/jsdoc/app/plugins/tagSynonyms.js +0 -43
- data/jsdoc/app/run.js +0 -346
- data/jsdoc/templates/sproutcore/allclasses.tmpl +0 -17
- data/jsdoc/templates/sproutcore/allfiles.tmpl +0 -56
- data/jsdoc/templates/sproutcore/class.tmpl +0 -423
- data/jsdoc/templates/sproutcore/index.tmpl +0 -55
- data/jsdoc/templates/sproutcore/publish.js +0 -333
- data/jsdoc/templates/sproutcore/static/default.css +0 -191
- data/jsdoc/templates/sproutcore/static/index.html +0 -19
- data/jsdoc/templates/sproutcore/symbol.tmpl +0 -35
- data/lib/sproutcore/build_tools/html_builder.rb +0 -163
- data/lib/sproutcore/build_tools/resource_builder.rb +0 -256
- data/lib/sproutcore/build_tools/test_template.rhtml +0 -12
- data/lib/sproutcore/build_tools.rb +0 -44
- data/lib/sproutcore/bundle.rb +0 -802
- data/lib/sproutcore/bundle_installer.rb +0 -270
- data/lib/sproutcore/bundle_manifest.rb +0 -574
- data/lib/sproutcore/cssmin.rb +0 -195
- data/lib/sproutcore/generator_helper.rb +0 -185
- data/lib/sproutcore/helpers.rb +0 -3
- data/lib/sproutcore/jsdoc.rb +0 -45
- data/lib/sproutcore/jsmin.rb +0 -247
- data/lib/sproutcore/library.rb +0 -479
- data/lib/sproutcore/merb/bundle_controller.rb +0 -297
- data/lib/sproutcore/merb/router.rb +0 -50
- data/lib/sproutcore/merb.rb +0 -22
- data/lib/sproutcore/renderers/erubis.rb +0 -43
- data/lib/sproutcore/renderers/haml.rb +0 -28
- data/lib/sproutcore/renderers/sass.rb +0 -42
- data/lib/sproutcore/version.rb +0 -9
- data/lib/sproutcore/view_helpers.rb +0 -656
- data/sc-config +0 -16
- data/sc_generators/client/README +0 -3
- data/sc_generators/client/USAGE +0 -11
- data/sc_generators/client/client_generator.rb +0 -45
- data/sc_generators/client/templates/core.js +0 -16
- data/sc_generators/client/templates/english.lproj/body.css +0 -147
- data/sc_generators/client/templates/english.lproj/body.rhtml +0 -18
- data/sc_generators/client/templates/english.lproj/strings.js +0 -13
- data/sc_generators/client/templates/main.js +0 -35
- data/sc_generators/controller/USAGE +0 -15
- data/sc_generators/controller/controller_generator.rb +0 -51
- data/sc_generators/controller/templates/controller.js +0 -21
- data/sc_generators/controller/templates/test.rhtml +0 -22
- data/sc_generators/framework/README +0 -6
- data/sc_generators/framework/USAGE +0 -11
- data/sc_generators/framework/framework_generator.rb +0 -53
- data/sc_generators/framework/templates/core.js +0 -20
- data/sc_generators/framework/templates/english.lproj/strings.js +0 -13
- data/sc_generators/language/USAGE +0 -13
- data/sc_generators/language/language_generator.rb +0 -47
- data/sc_generators/language/templates/strings.js +0 -13
- data/sc_generators/model/USAGE +0 -23
- data/sc_generators/model/model_generator.rb +0 -55
- data/sc_generators/model/templates/fixture.js +0 -43
- data/sc_generators/model/templates/model.js +0 -20
- data/sc_generators/model/templates/test.rhtml +0 -21
- data/sc_generators/test/USAGE +0 -15
- data/sc_generators/test/templates/test.rhtml +0 -21
- data/sc_generators/test/test_generator.rb +0 -47
- data/sc_generators/view/USAGE +0 -15
- data/sc_generators/view/templates/test.rhtml +0 -21
- data/sc_generators/view/templates/view.js +0 -20
- data/sc_generators/view/view_generator.rb +0 -51
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -74
- data/setup.rb +0 -1585
- data/spec/sproutcore_spec.rb +0 -11
- data/tasks/deployment.rake +0 -47
- data/tasks/environment.rake +0 -7
- data/tasks/rspec.rake +0 -21
- data/tasks/website.rake +0 -17
|
@@ -1,4223 +0,0 @@
|
|
|
1
|
-
/* @license
|
|
2
|
-
* Prototype JavaScript framework, version 1.6.0
|
|
3
|
-
* (c) 2005-2008 Sam Stephenson
|
|
4
|
-
*
|
|
5
|
-
* Prototype is freely distributable under the terms of an MIT-style license.
|
|
6
|
-
* For details, see the Prototype web site: http://www.prototypejs.org/
|
|
7
|
-
*
|
|
8
|
-
*---------------------------------------------------------------------------
|
|
9
|
-
@license */
|
|
10
|
-
|
|
11
|
-
var Prototype = {
|
|
12
|
-
Version: '1.6.0.2',
|
|
13
|
-
|
|
14
|
-
Browser: {
|
|
15
|
-
IE: !!(window.attachEvent && !window.opera),
|
|
16
|
-
Opera: !!window.opera,
|
|
17
|
-
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
|
|
18
|
-
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
|
|
19
|
-
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
BrowserFeatures: {
|
|
23
|
-
XPath: !!document.evaluate,
|
|
24
|
-
ElementExtensions: !!window.HTMLElement,
|
|
25
|
-
SpecificElementExtensions:
|
|
26
|
-
document.createElement('div').__proto__ &&
|
|
27
|
-
document.createElement('div').__proto__ !==
|
|
28
|
-
document.createElement('form').__proto__
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
|
|
32
|
-
JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
|
|
33
|
-
|
|
34
|
-
emptyFunction: function() { },
|
|
35
|
-
K: function(x) { return x; }
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
if (Prototype.Browser.MobileSafari)
|
|
39
|
-
Prototype.BrowserFeatures.SpecificElementExtensions = false;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/* Based on Alex Arnell's inheritance implementation. */
|
|
43
|
-
var Class = {
|
|
44
|
-
create: function() {
|
|
45
|
-
var parent = null, properties = $A(arguments);
|
|
46
|
-
if (Object.isFunction(properties[0]))
|
|
47
|
-
parent = properties.shift();
|
|
48
|
-
|
|
49
|
-
function klass() {
|
|
50
|
-
this.initialize.apply(this, arguments);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
Object.extend(klass, Class.Methods);
|
|
54
|
-
klass.superclass = parent;
|
|
55
|
-
klass.subclasses = [];
|
|
56
|
-
|
|
57
|
-
if (parent) {
|
|
58
|
-
var subclass = function() { };
|
|
59
|
-
subclass.prototype = parent.prototype;
|
|
60
|
-
klass.prototype = new subclass;
|
|
61
|
-
parent.subclasses.push(klass);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
for (var i = 0; i < properties.length; i++)
|
|
65
|
-
klass.addMethods(properties[i]);
|
|
66
|
-
|
|
67
|
-
if (!klass.prototype.initialize)
|
|
68
|
-
klass.prototype.initialize = Prototype.emptyFunction;
|
|
69
|
-
|
|
70
|
-
klass.prototype.constructor = klass;
|
|
71
|
-
|
|
72
|
-
return klass;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
Class.Methods = {
|
|
77
|
-
addMethods: function(source) {
|
|
78
|
-
var ancestor = this.superclass && this.superclass.prototype;
|
|
79
|
-
var properties = Object.keys(source);
|
|
80
|
-
|
|
81
|
-
if (!Object.keys({ toString: true }).length)
|
|
82
|
-
properties.push("toString", "valueOf");
|
|
83
|
-
|
|
84
|
-
for (var i = 0, length = properties.length; i < length; i++) {
|
|
85
|
-
var property = properties[i], value = source[property];
|
|
86
|
-
if (ancestor && Object.isFunction(value) &&
|
|
87
|
-
value.argumentNames().first() == "$super") {
|
|
88
|
-
var method = value, value = Object.extend((function(m) {
|
|
89
|
-
return function() { return ancestor[m].apply(this, arguments); };
|
|
90
|
-
})(property).wrap(method), {
|
|
91
|
-
valueOf: function() { return method; },
|
|
92
|
-
toString: function() { return method.toString(); }
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
this.prototype[property] = value;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return this;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
var Abstract = { };
|
|
103
|
-
|
|
104
|
-
Object.extend = function(destination, source) {
|
|
105
|
-
for (var property in source)
|
|
106
|
-
destination[property] = source[property];
|
|
107
|
-
return destination;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
Object.extend(Object, {
|
|
111
|
-
inspect: function(object) {
|
|
112
|
-
try {
|
|
113
|
-
if (Object.isUndefined(object)) return 'undefined';
|
|
114
|
-
if (object === null) return 'null';
|
|
115
|
-
return object.inspect ? object.inspect() : String(object);
|
|
116
|
-
} catch (e) {
|
|
117
|
-
if (e instanceof RangeError) return '...';
|
|
118
|
-
throw e;
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
toJSON: function(object) {
|
|
123
|
-
var type = typeof object;
|
|
124
|
-
switch (type) {
|
|
125
|
-
case 'undefined':
|
|
126
|
-
case 'function':
|
|
127
|
-
case 'unknown': return;
|
|
128
|
-
case 'boolean': return object.toString();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (object === null) return 'null';
|
|
132
|
-
if (object.toJSON) return object.toJSON();
|
|
133
|
-
if (Object.isElement(object)) return;
|
|
134
|
-
|
|
135
|
-
var results = [];
|
|
136
|
-
for (var property in object) {
|
|
137
|
-
var value = Object.toJSON(object[property]);
|
|
138
|
-
if (!Object.isUndefined(value))
|
|
139
|
-
results.push(property.toJSON() + ': ' + value);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return '{' + results.join(', ') + '}';
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
toQueryString: function(object) {
|
|
146
|
-
return $H(object).toQueryString();
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
toHTML: function(object) {
|
|
150
|
-
return object && object.toHTML ? object.toHTML() : String.interpret(object);
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
keys: function(object) {
|
|
154
|
-
var keys = [];
|
|
155
|
-
for (var property in object)
|
|
156
|
-
keys.push(property);
|
|
157
|
-
return keys;
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
values: function(object) {
|
|
161
|
-
var values = [];
|
|
162
|
-
for (var property in object)
|
|
163
|
-
values.push(object[property]);
|
|
164
|
-
return values;
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
clone: function(object) {
|
|
168
|
-
return Object.extend({ }, object);
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
isElement: function(object) {
|
|
172
|
-
return object && object.nodeType == 1;
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
isArray: function(object) {
|
|
176
|
-
return object != null && typeof object == "object" &&
|
|
177
|
-
'splice' in object && 'join' in object;
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
isHash: function(object) {
|
|
181
|
-
return object instanceof Hash;
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
isFunction: function(object) {
|
|
185
|
-
return typeof object == "function";
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
isString: function(object) {
|
|
189
|
-
return typeof object == "string";
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
isNumber: function(object) {
|
|
193
|
-
return typeof object == "number";
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
isUndefined: function(object) {
|
|
197
|
-
return typeof object == "undefined";
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
Object.extend(Function.prototype, {
|
|
202
|
-
argumentNames: function() {
|
|
203
|
-
var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
|
|
204
|
-
return names.length == 1 && !names[0] ? [] : names;
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
bind: function() {
|
|
208
|
-
if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
|
|
209
|
-
var __method = this, args = $A(arguments), object = args.shift();
|
|
210
|
-
return function() {
|
|
211
|
-
return __method.apply(object, args.concat($A(arguments)));
|
|
212
|
-
} ;
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
bindAsEventListener: function() {
|
|
216
|
-
var __method = this, args = $A(arguments), object = args.shift();
|
|
217
|
-
return function(event) {
|
|
218
|
-
return __method.apply(object, [event || window.event].concat(args));
|
|
219
|
-
} ;
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
curry: function() {
|
|
223
|
-
if (!arguments.length) return this;
|
|
224
|
-
var __method = this, args = $A(arguments);
|
|
225
|
-
return function() {
|
|
226
|
-
return __method.apply(this, args.concat($A(arguments)));
|
|
227
|
-
} ;
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
delay: function() {
|
|
231
|
-
var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
|
|
232
|
-
return window.setTimeout(function() {
|
|
233
|
-
return __method.apply(__method, args);
|
|
234
|
-
}, timeout);
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
wrap: function(wrapper) {
|
|
238
|
-
var __method = this;
|
|
239
|
-
return function() {
|
|
240
|
-
return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
|
|
241
|
-
} ;
|
|
242
|
-
},
|
|
243
|
-
|
|
244
|
-
methodize: function() {
|
|
245
|
-
if (this._methodized) return this._methodized;
|
|
246
|
-
var __method = this;
|
|
247
|
-
return this._methodized = function() {
|
|
248
|
-
return __method.apply(null, [this].concat($A(arguments)));
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
Function.prototype.defer = Function.prototype.delay.curry(0.01);
|
|
254
|
-
|
|
255
|
-
Date.prototype.toJSON = function() {
|
|
256
|
-
return '"' + this.getUTCFullYear() + '-' +
|
|
257
|
-
(this.getUTCMonth() + 1).toPaddedString(2) + '-' +
|
|
258
|
-
this.getUTCDate().toPaddedString(2) + 'T' +
|
|
259
|
-
this.getUTCHours().toPaddedString(2) + ':' +
|
|
260
|
-
this.getUTCMinutes().toPaddedString(2) + ':' +
|
|
261
|
-
this.getUTCSeconds().toPaddedString(2) + 'Z"';
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
var Try = {
|
|
265
|
-
these: function() {
|
|
266
|
-
var returnValue;
|
|
267
|
-
|
|
268
|
-
for (var i = 0, length = arguments.length; i < length; i++) {
|
|
269
|
-
var lambda = arguments[i];
|
|
270
|
-
try {
|
|
271
|
-
returnValue = lambda();
|
|
272
|
-
break;
|
|
273
|
-
} catch (e) { }
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return returnValue;
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
RegExp.prototype.match = RegExp.prototype.test;
|
|
281
|
-
|
|
282
|
-
RegExp.escape = function(str) {
|
|
283
|
-
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
/*--------------------------------------------------------------------------*/
|
|
287
|
-
|
|
288
|
-
var PeriodicalExecuter = Class.create({
|
|
289
|
-
initialize: function(callback, frequency) {
|
|
290
|
-
this.callback = callback;
|
|
291
|
-
this.frequency = frequency;
|
|
292
|
-
this.currentlyExecuting = false;
|
|
293
|
-
|
|
294
|
-
this.registerCallback();
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
registerCallback: function() {
|
|
298
|
-
this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
execute: function() {
|
|
302
|
-
this.callback(this);
|
|
303
|
-
},
|
|
304
|
-
|
|
305
|
-
stop: function() {
|
|
306
|
-
if (!this.timer) return;
|
|
307
|
-
clearInterval(this.timer);
|
|
308
|
-
this.timer = null;
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
onTimerEvent: function() {
|
|
312
|
-
if (!this.currentlyExecuting) {
|
|
313
|
-
try {
|
|
314
|
-
this.currentlyExecuting = true;
|
|
315
|
-
this.execute();
|
|
316
|
-
} finally {
|
|
317
|
-
this.currentlyExecuting = false;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
Object.extend(String, {
|
|
323
|
-
interpret: function(value) {
|
|
324
|
-
return value == null ? '' : String(value);
|
|
325
|
-
},
|
|
326
|
-
specialChar: {
|
|
327
|
-
'\b': '\\b',
|
|
328
|
-
'\t': '\\t',
|
|
329
|
-
'\n': '\\n',
|
|
330
|
-
'\f': '\\f',
|
|
331
|
-
'\r': '\\r',
|
|
332
|
-
'\\': '\\\\'
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
Object.extend(String.prototype, {
|
|
337
|
-
gsub: function(pattern, replacement) {
|
|
338
|
-
var result = '', source = this, match;
|
|
339
|
-
replacement = arguments.callee.prepareReplacement(replacement);
|
|
340
|
-
|
|
341
|
-
while (source.length > 0) {
|
|
342
|
-
if (match = source.match(pattern)) {
|
|
343
|
-
result += source.slice(0, match.index);
|
|
344
|
-
result += String.interpret(replacement(match));
|
|
345
|
-
source = source.slice(match.index + match[0].length);
|
|
346
|
-
} else {
|
|
347
|
-
result += source; source = '';
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return result;
|
|
351
|
-
},
|
|
352
|
-
|
|
353
|
-
sub: function(pattern, replacement, count) {
|
|
354
|
-
replacement = this.gsub.prepareReplacement(replacement);
|
|
355
|
-
count = Object.isUndefined(count) ? 1 : count;
|
|
356
|
-
|
|
357
|
-
return this.gsub(pattern, function(match) {
|
|
358
|
-
if (--count < 0) return match[0];
|
|
359
|
-
return replacement(match);
|
|
360
|
-
});
|
|
361
|
-
},
|
|
362
|
-
|
|
363
|
-
scan: function(pattern, iterator) {
|
|
364
|
-
this.gsub(pattern, iterator);
|
|
365
|
-
return String(this);
|
|
366
|
-
},
|
|
367
|
-
|
|
368
|
-
truncate: function(length, truncation) {
|
|
369
|
-
length = length || 30;
|
|
370
|
-
truncation = Object.isUndefined(truncation) ? '...' : truncation;
|
|
371
|
-
return this.length > length ?
|
|
372
|
-
this.slice(0, length - truncation.length) + truncation : String(this);
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
strip: function() {
|
|
376
|
-
return this.replace(/^\s+/, '').replace(/\s+$/, '');
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
stripTags: function() {
|
|
380
|
-
return this.replace(/<\/?[^>]+>/gi, '');
|
|
381
|
-
},
|
|
382
|
-
|
|
383
|
-
stripScripts: function() {
|
|
384
|
-
return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
extractScripts: function() {
|
|
388
|
-
var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
|
|
389
|
-
var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
|
|
390
|
-
return (this.match(matchAll) || []).map(function(scriptTag) {
|
|
391
|
-
return (scriptTag.match(matchOne) || ['', ''])[1];
|
|
392
|
-
});
|
|
393
|
-
},
|
|
394
|
-
|
|
395
|
-
evalScripts: function() {
|
|
396
|
-
return this.extractScripts().map(function(script) { return eval(script); });
|
|
397
|
-
},
|
|
398
|
-
|
|
399
|
-
escapeHTML: function() {
|
|
400
|
-
var self = arguments.callee;
|
|
401
|
-
self.text.data = this;
|
|
402
|
-
return self.div.innerHTML;
|
|
403
|
-
},
|
|
404
|
-
|
|
405
|
-
unescapeHTML: function() {
|
|
406
|
-
var div = new Element('div');
|
|
407
|
-
div.innerHTML = this.stripTags();
|
|
408
|
-
return div.childNodes[0] ? (div.childNodes.length > 1 ?
|
|
409
|
-
$A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue; }) :
|
|
410
|
-
div.childNodes[0].nodeValue) : '';
|
|
411
|
-
},
|
|
412
|
-
|
|
413
|
-
toQueryParams: function(separator) {
|
|
414
|
-
var match = this.strip().match(/([^?#]*)(#.*)?$/);
|
|
415
|
-
if (!match) return { };
|
|
416
|
-
|
|
417
|
-
return match[1].split(separator || '&').inject({ }, function(hash, pair) {
|
|
418
|
-
if ((pair = pair.split('='))[0]) {
|
|
419
|
-
var key = decodeURIComponent(pair.shift());
|
|
420
|
-
var value = pair.length > 1 ? pair.join('=') : pair[0];
|
|
421
|
-
if (value != undefined) value = decodeURIComponent(value);
|
|
422
|
-
|
|
423
|
-
if (key in hash) {
|
|
424
|
-
if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
|
|
425
|
-
hash[key].push(value);
|
|
426
|
-
}
|
|
427
|
-
else hash[key] = value;
|
|
428
|
-
}
|
|
429
|
-
return hash;
|
|
430
|
-
});
|
|
431
|
-
},
|
|
432
|
-
|
|
433
|
-
toArray: function() {
|
|
434
|
-
return this.split('');
|
|
435
|
-
},
|
|
436
|
-
|
|
437
|
-
succ: function() {
|
|
438
|
-
return this.slice(0, this.length - 1) +
|
|
439
|
-
String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
|
|
440
|
-
},
|
|
441
|
-
|
|
442
|
-
times: function(count) {
|
|
443
|
-
return count < 1 ? '' : new Array(count + 1).join(this);
|
|
444
|
-
},
|
|
445
|
-
|
|
446
|
-
camelize: function() {
|
|
447
|
-
var parts = this.split('-'), len = parts.length;
|
|
448
|
-
if (len == 1) return parts[0];
|
|
449
|
-
|
|
450
|
-
var camelized = this.charAt(0) == '-'
|
|
451
|
-
? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
|
|
452
|
-
: parts[0];
|
|
453
|
-
|
|
454
|
-
for (var i = 1; i < len; i++)
|
|
455
|
-
camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
|
|
456
|
-
|
|
457
|
-
return camelized;
|
|
458
|
-
},
|
|
459
|
-
|
|
460
|
-
capitalize: function() {
|
|
461
|
-
return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
|
|
462
|
-
},
|
|
463
|
-
|
|
464
|
-
underscore: function() {
|
|
465
|
-
return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
|
|
466
|
-
},
|
|
467
|
-
|
|
468
|
-
dasherize: function() {
|
|
469
|
-
return this.gsub(/_/,'-');
|
|
470
|
-
},
|
|
471
|
-
|
|
472
|
-
inspect: function(useDoubleQuotes) {
|
|
473
|
-
var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
|
|
474
|
-
var character = String.specialChar[match[0]];
|
|
475
|
-
return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
|
|
476
|
-
});
|
|
477
|
-
if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
|
|
478
|
-
return "'" + escapedString.replace(/'/g, '\\\'') + "'";
|
|
479
|
-
},
|
|
480
|
-
|
|
481
|
-
toJSON: function() {
|
|
482
|
-
return this.inspect(true);
|
|
483
|
-
},
|
|
484
|
-
|
|
485
|
-
unfilterJSON: function(filter) {
|
|
486
|
-
return this.sub(filter || Prototype.JSONFilter, '#{1}');
|
|
487
|
-
},
|
|
488
|
-
|
|
489
|
-
isJSON: function() {
|
|
490
|
-
var str = this;
|
|
491
|
-
if (str.blank()) return false;
|
|
492
|
-
str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
|
|
493
|
-
return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
|
|
494
|
-
},
|
|
495
|
-
|
|
496
|
-
evalJSON: function(sanitize) {
|
|
497
|
-
var json = this.unfilterJSON();
|
|
498
|
-
try {
|
|
499
|
-
if (!sanitize || json.isJSON()) return eval('(' + json + ')');
|
|
500
|
-
} catch (e) { }
|
|
501
|
-
throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
|
|
502
|
-
},
|
|
503
|
-
|
|
504
|
-
include: function(pattern) {
|
|
505
|
-
return this.indexOf(pattern) > -1;
|
|
506
|
-
},
|
|
507
|
-
|
|
508
|
-
startsWith: function(pattern) {
|
|
509
|
-
return this.indexOf(pattern) === 0;
|
|
510
|
-
},
|
|
511
|
-
|
|
512
|
-
endsWith: function(pattern) {
|
|
513
|
-
var d = this.length - pattern.length;
|
|
514
|
-
return d >= 0 && this.lastIndexOf(pattern) === d;
|
|
515
|
-
},
|
|
516
|
-
|
|
517
|
-
empty: function() {
|
|
518
|
-
return this == '';
|
|
519
|
-
},
|
|
520
|
-
|
|
521
|
-
blank: function() {
|
|
522
|
-
return (/^\s*$/).test(this);
|
|
523
|
-
},
|
|
524
|
-
|
|
525
|
-
interpolate: function(object, pattern) {
|
|
526
|
-
return new Template(this, pattern).evaluate(object);
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
|
|
530
|
-
if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
|
|
531
|
-
escapeHTML: function() {
|
|
532
|
-
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
|
533
|
-
},
|
|
534
|
-
unescapeHTML: function() {
|
|
535
|
-
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
String.prototype.gsub.prepareReplacement = function(replacement) {
|
|
540
|
-
if (Object.isFunction(replacement)) return replacement;
|
|
541
|
-
var template = new Template(replacement);
|
|
542
|
-
return function(match) { return template.evaluate(match); };
|
|
543
|
-
};
|
|
544
|
-
|
|
545
|
-
String.prototype.parseQuery = String.prototype.toQueryParams;
|
|
546
|
-
|
|
547
|
-
Object.extend(String.prototype.escapeHTML, {
|
|
548
|
-
div: document.createElement('div'),
|
|
549
|
-
text: document.createTextNode('')
|
|
550
|
-
});
|
|
551
|
-
|
|
552
|
-
with (String.prototype.escapeHTML) div.appendChild(text);
|
|
553
|
-
|
|
554
|
-
var Template = Class.create({
|
|
555
|
-
initialize: function(template, pattern) {
|
|
556
|
-
this.template = template.toString();
|
|
557
|
-
this.pattern = pattern || Template.Pattern;
|
|
558
|
-
},
|
|
559
|
-
|
|
560
|
-
evaluate: function(object) {
|
|
561
|
-
if (Object.isFunction(object.toTemplateReplacements))
|
|
562
|
-
object = object.toTemplateReplacements();
|
|
563
|
-
|
|
564
|
-
return this.template.gsub(this.pattern, function(match) {
|
|
565
|
-
if (object == null) return '';
|
|
566
|
-
|
|
567
|
-
var before = match[1] || '';
|
|
568
|
-
if (before == '\\') return match[2];
|
|
569
|
-
|
|
570
|
-
var ctx = object, expr = match[3];
|
|
571
|
-
var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
|
|
572
|
-
match = pattern.exec(expr);
|
|
573
|
-
if (match == null) return before;
|
|
574
|
-
|
|
575
|
-
while (match != null) {
|
|
576
|
-
var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
|
|
577
|
-
ctx = ctx[comp];
|
|
578
|
-
if (null == ctx || '' == match[3]) break;
|
|
579
|
-
expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
|
|
580
|
-
match = pattern.exec(expr);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
return before + String.interpret(ctx);
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
|
|
588
|
-
|
|
589
|
-
var $break = { };
|
|
590
|
-
|
|
591
|
-
var Enumerable = {
|
|
592
|
-
each: function(iterator, context) {
|
|
593
|
-
var index = 0;
|
|
594
|
-
iterator = iterator.bind(context);
|
|
595
|
-
try {
|
|
596
|
-
this._each(function(value) {
|
|
597
|
-
iterator(value, index++);
|
|
598
|
-
});
|
|
599
|
-
} catch (e) {
|
|
600
|
-
if (e != $break) throw e;
|
|
601
|
-
}
|
|
602
|
-
return this;
|
|
603
|
-
},
|
|
604
|
-
|
|
605
|
-
eachSlice: function(number, iterator, context) {
|
|
606
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
|
607
|
-
var index = -number, slices = [], array = this.toArray();
|
|
608
|
-
while ((index += number) < array.length)
|
|
609
|
-
slices.push(array.slice(index, index+number));
|
|
610
|
-
return slices.collect(iterator, context);
|
|
611
|
-
},
|
|
612
|
-
|
|
613
|
-
all: function(iterator, context) {
|
|
614
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
|
615
|
-
var result = true;
|
|
616
|
-
this.each(function(value, index) {
|
|
617
|
-
result = result && !!iterator(value, index);
|
|
618
|
-
if (!result) throw $break;
|
|
619
|
-
});
|
|
620
|
-
return result;
|
|
621
|
-
},
|
|
622
|
-
|
|
623
|
-
any: function(iterator, context) {
|
|
624
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
|
625
|
-
var result = false;
|
|
626
|
-
this.each(function(value, index) {
|
|
627
|
-
if (result = !!iterator(value, index))
|
|
628
|
-
throw $break;
|
|
629
|
-
});
|
|
630
|
-
return result;
|
|
631
|
-
},
|
|
632
|
-
|
|
633
|
-
collect: function(iterator, context) {
|
|
634
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
|
635
|
-
var results = [];
|
|
636
|
-
this.each(function(value, index) {
|
|
637
|
-
results.push(iterator(value, index));
|
|
638
|
-
});
|
|
639
|
-
return results;
|
|
640
|
-
},
|
|
641
|
-
|
|
642
|
-
detect: function(iterator, context) {
|
|
643
|
-
iterator = iterator.bind(context);
|
|
644
|
-
var result;
|
|
645
|
-
this.each(function(value, index) {
|
|
646
|
-
if (iterator(value, index)) {
|
|
647
|
-
result = value;
|
|
648
|
-
throw $break;
|
|
649
|
-
}
|
|
650
|
-
});
|
|
651
|
-
return result;
|
|
652
|
-
},
|
|
653
|
-
|
|
654
|
-
findAll: function(iterator, context) {
|
|
655
|
-
iterator = iterator.bind(context);
|
|
656
|
-
var results = [];
|
|
657
|
-
this.each(function(value, index) {
|
|
658
|
-
if (iterator(value, index))
|
|
659
|
-
results.push(value);
|
|
660
|
-
});
|
|
661
|
-
return results;
|
|
662
|
-
},
|
|
663
|
-
|
|
664
|
-
grep: function(filter, iterator, context) {
|
|
665
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
|
666
|
-
var results = [];
|
|
667
|
-
|
|
668
|
-
if (Object.isString(filter))
|
|
669
|
-
filter = new RegExp(filter);
|
|
670
|
-
|
|
671
|
-
this.each(function(value, index) {
|
|
672
|
-
if (filter.match(value))
|
|
673
|
-
results.push(iterator(value, index));
|
|
674
|
-
});
|
|
675
|
-
return results;
|
|
676
|
-
},
|
|
677
|
-
|
|
678
|
-
include: function(object) {
|
|
679
|
-
if (Object.isFunction(this.indexOf))
|
|
680
|
-
if (this.indexOf(object) != -1) return true;
|
|
681
|
-
|
|
682
|
-
var found = false;
|
|
683
|
-
this.each(function(value) {
|
|
684
|
-
if (value == object) {
|
|
685
|
-
found = true;
|
|
686
|
-
throw $break;
|
|
687
|
-
}
|
|
688
|
-
});
|
|
689
|
-
return found;
|
|
690
|
-
},
|
|
691
|
-
|
|
692
|
-
inGroupsOf: function(number, fillWith) {
|
|
693
|
-
fillWith = Object.isUndefined(fillWith) ? null : fillWith;
|
|
694
|
-
return this.eachSlice(number, function(slice) {
|
|
695
|
-
while(slice.length < number) slice.push(fillWith);
|
|
696
|
-
return slice;
|
|
697
|
-
});
|
|
698
|
-
},
|
|
699
|
-
|
|
700
|
-
inject: function(memo, iterator, context) {
|
|
701
|
-
iterator = iterator.bind(context);
|
|
702
|
-
this.each(function(value, index) {
|
|
703
|
-
memo = iterator(memo, value, index);
|
|
704
|
-
});
|
|
705
|
-
return memo;
|
|
706
|
-
},
|
|
707
|
-
|
|
708
|
-
invoke: function(method) {
|
|
709
|
-
var args = $A(arguments).slice(1);
|
|
710
|
-
return this.map(function(value) {
|
|
711
|
-
return value[method].apply(value, args);
|
|
712
|
-
});
|
|
713
|
-
},
|
|
714
|
-
|
|
715
|
-
max: function(iterator, context) {
|
|
716
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
|
717
|
-
var result;
|
|
718
|
-
this.each(function(value, index) {
|
|
719
|
-
value = iterator(value, index);
|
|
720
|
-
if (result == null || value >= result)
|
|
721
|
-
result = value;
|
|
722
|
-
});
|
|
723
|
-
return result;
|
|
724
|
-
},
|
|
725
|
-
|
|
726
|
-
min: function(iterator, context) {
|
|
727
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
|
728
|
-
var result;
|
|
729
|
-
this.each(function(value, index) {
|
|
730
|
-
value = iterator(value, index);
|
|
731
|
-
if (result == null || value < result)
|
|
732
|
-
result = value;
|
|
733
|
-
});
|
|
734
|
-
return result;
|
|
735
|
-
},
|
|
736
|
-
|
|
737
|
-
partition: function(iterator, context) {
|
|
738
|
-
iterator = iterator ? iterator.bind(context) : Prototype.K;
|
|
739
|
-
var trues = [], falses = [];
|
|
740
|
-
this.each(function(value, index) {
|
|
741
|
-
(iterator(value, index) ?
|
|
742
|
-
trues : falses).push(value);
|
|
743
|
-
});
|
|
744
|
-
return [trues, falses];
|
|
745
|
-
},
|
|
746
|
-
|
|
747
|
-
pluck: function(property) {
|
|
748
|
-
var results = [];
|
|
749
|
-
this.each(function(value) {
|
|
750
|
-
results.push(value[property]);
|
|
751
|
-
});
|
|
752
|
-
return results;
|
|
753
|
-
},
|
|
754
|
-
|
|
755
|
-
reject: function(iterator, context) {
|
|
756
|
-
iterator = iterator.bind(context);
|
|
757
|
-
var results = [];
|
|
758
|
-
this.each(function(value, index) {
|
|
759
|
-
if (!iterator(value, index))
|
|
760
|
-
results.push(value);
|
|
761
|
-
});
|
|
762
|
-
return results;
|
|
763
|
-
},
|
|
764
|
-
|
|
765
|
-
sortBy: function(iterator, context) {
|
|
766
|
-
iterator = iterator.bind(context);
|
|
767
|
-
return this.map(function(value, index) {
|
|
768
|
-
return {value: value, criteria: iterator(value, index)};
|
|
769
|
-
}).sort(function(left, right) {
|
|
770
|
-
var a = left.criteria, b = right.criteria;
|
|
771
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
772
|
-
}).pluck('value');
|
|
773
|
-
},
|
|
774
|
-
|
|
775
|
-
toArray: function() {
|
|
776
|
-
return this.map();
|
|
777
|
-
},
|
|
778
|
-
|
|
779
|
-
zip: function() {
|
|
780
|
-
var iterator = Prototype.K, args = $A(arguments);
|
|
781
|
-
if (Object.isFunction(args.last()))
|
|
782
|
-
iterator = args.pop();
|
|
783
|
-
|
|
784
|
-
var collections = [this].concat(args).map($A);
|
|
785
|
-
return this.map(function(value, index) {
|
|
786
|
-
return iterator(collections.pluck(index));
|
|
787
|
-
});
|
|
788
|
-
},
|
|
789
|
-
|
|
790
|
-
size: function() {
|
|
791
|
-
return this.toArray().length;
|
|
792
|
-
},
|
|
793
|
-
|
|
794
|
-
inspect: function() {
|
|
795
|
-
return '#<Enumerable:' + this.toArray().inspect() + '>';
|
|
796
|
-
}
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
Object.extend(Enumerable, {
|
|
800
|
-
map: Enumerable.collect,
|
|
801
|
-
find: Enumerable.detect,
|
|
802
|
-
select: Enumerable.findAll,
|
|
803
|
-
filter: Enumerable.findAll,
|
|
804
|
-
member: Enumerable.include,
|
|
805
|
-
entries: Enumerable.toArray,
|
|
806
|
-
every: Enumerable.all,
|
|
807
|
-
some: Enumerable.any
|
|
808
|
-
});
|
|
809
|
-
function $A(iterable) {
|
|
810
|
-
if (!iterable) return [];
|
|
811
|
-
if (iterable.toArray) return iterable.toArray();
|
|
812
|
-
var length = iterable.length || 0, results = new Array(length);
|
|
813
|
-
while (length--) results[length] = iterable[length];
|
|
814
|
-
return results;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
if (Prototype.Browser.WebKit) {
|
|
818
|
-
$A = function(iterable) {
|
|
819
|
-
if (!iterable) return [];
|
|
820
|
-
if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
|
|
821
|
-
iterable.toArray) return iterable.toArray();
|
|
822
|
-
var length = iterable.length || 0, results = new Array(length);
|
|
823
|
-
while (length--) results[length] = iterable[length];
|
|
824
|
-
return results;
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
Array.from = $A;
|
|
829
|
-
|
|
830
|
-
Object.extend(Array.prototype, Enumerable);
|
|
831
|
-
|
|
832
|
-
if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
|
|
833
|
-
|
|
834
|
-
Object.extend(Array.prototype, {
|
|
835
|
-
_each: function(iterator) {
|
|
836
|
-
for (var i = 0, length = this.length; i < length; i++)
|
|
837
|
-
iterator(this[i]);
|
|
838
|
-
},
|
|
839
|
-
|
|
840
|
-
clear: function() {
|
|
841
|
-
this.length = 0;
|
|
842
|
-
return this;
|
|
843
|
-
},
|
|
844
|
-
|
|
845
|
-
first: function() {
|
|
846
|
-
return this[0];
|
|
847
|
-
},
|
|
848
|
-
|
|
849
|
-
last: function() {
|
|
850
|
-
return this[this.length - 1];
|
|
851
|
-
},
|
|
852
|
-
|
|
853
|
-
compact: function() {
|
|
854
|
-
return this.select(function(value) {
|
|
855
|
-
return value != null;
|
|
856
|
-
});
|
|
857
|
-
},
|
|
858
|
-
|
|
859
|
-
flatten: function() {
|
|
860
|
-
return this.inject([], function(array, value) {
|
|
861
|
-
return array.concat(Object.isArray(value) ?
|
|
862
|
-
value.flatten() : [value]);
|
|
863
|
-
});
|
|
864
|
-
},
|
|
865
|
-
|
|
866
|
-
without: function() {
|
|
867
|
-
var values = $A(arguments);
|
|
868
|
-
return this.select(function(value) {
|
|
869
|
-
return !values.include(value);
|
|
870
|
-
});
|
|
871
|
-
},
|
|
872
|
-
|
|
873
|
-
reverse: function(inline) {
|
|
874
|
-
return (inline !== false ? this : this.toArray())._reverse();
|
|
875
|
-
},
|
|
876
|
-
|
|
877
|
-
reduce: function() {
|
|
878
|
-
return this.length > 1 ? this : this[0];
|
|
879
|
-
},
|
|
880
|
-
|
|
881
|
-
uniq: function(sorted) {
|
|
882
|
-
return this.inject([], function(array, value, index) {
|
|
883
|
-
if (0 == index || (sorted ? array.last() != value : !array.include(value)))
|
|
884
|
-
array.push(value);
|
|
885
|
-
return array;
|
|
886
|
-
});
|
|
887
|
-
},
|
|
888
|
-
|
|
889
|
-
intersect: function(array) {
|
|
890
|
-
return this.uniq().findAll(function(item) {
|
|
891
|
-
return array.detect(function(value) { return item === value; });
|
|
892
|
-
});
|
|
893
|
-
},
|
|
894
|
-
|
|
895
|
-
clone: function() {
|
|
896
|
-
return [].concat(this);
|
|
897
|
-
},
|
|
898
|
-
|
|
899
|
-
size: function() {
|
|
900
|
-
return this.length;
|
|
901
|
-
},
|
|
902
|
-
|
|
903
|
-
inspect: function() {
|
|
904
|
-
return '[' + this.map(Object.inspect).join(', ') + ']';
|
|
905
|
-
},
|
|
906
|
-
|
|
907
|
-
toJSON: function() {
|
|
908
|
-
var results = [];
|
|
909
|
-
this.each(function(object) {
|
|
910
|
-
var value = Object.toJSON(object);
|
|
911
|
-
if (!Object.isUndefined(value)) results.push(value);
|
|
912
|
-
});
|
|
913
|
-
return '[' + results.join(', ') + ']';
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
|
|
917
|
-
// use native browser JS 1.6 implementation if available
|
|
918
|
-
if (Object.isFunction(Array.prototype.forEach))
|
|
919
|
-
Array.prototype._each = Array.prototype.forEach;
|
|
920
|
-
|
|
921
|
-
if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
|
|
922
|
-
i || (i = 0);
|
|
923
|
-
var length = this.length;
|
|
924
|
-
if (i < 0) i = length + i;
|
|
925
|
-
for (; i < length; i++)
|
|
926
|
-
if (this[i] === item) return i;
|
|
927
|
-
return -1;
|
|
928
|
-
};
|
|
929
|
-
|
|
930
|
-
if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
|
|
931
|
-
i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
|
|
932
|
-
var n = this.slice(0, i).reverse().indexOf(item);
|
|
933
|
-
return (n < 0) ? n : i - n - 1;
|
|
934
|
-
};
|
|
935
|
-
|
|
936
|
-
Array.prototype.toArray = Array.prototype.clone;
|
|
937
|
-
|
|
938
|
-
function $w(string) {
|
|
939
|
-
if (!Object.isString(string)) return [];
|
|
940
|
-
string = string.strip();
|
|
941
|
-
return string ? string.split(/\s+/) : [];
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
if (Prototype.Browser.Opera){
|
|
945
|
-
Array.prototype.concat = function() {
|
|
946
|
-
var array = [];
|
|
947
|
-
for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
|
|
948
|
-
for (var i = 0, length = arguments.length; i < length; i++) {
|
|
949
|
-
if (Object.isArray(arguments[i])) {
|
|
950
|
-
for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
|
|
951
|
-
array.push(arguments[i][j]);
|
|
952
|
-
} else {
|
|
953
|
-
array.push(arguments[i]);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
return array;
|
|
957
|
-
};
|
|
958
|
-
}
|
|
959
|
-
Object.extend(Number.prototype, {
|
|
960
|
-
toColorPart: function() {
|
|
961
|
-
return this.toPaddedString(2, 16);
|
|
962
|
-
},
|
|
963
|
-
|
|
964
|
-
succ: function() {
|
|
965
|
-
return this + 1;
|
|
966
|
-
},
|
|
967
|
-
|
|
968
|
-
times: function(iterator) {
|
|
969
|
-
$R(0, this, true).each(iterator);
|
|
970
|
-
return this;
|
|
971
|
-
},
|
|
972
|
-
|
|
973
|
-
toPaddedString: function(length, radix) {
|
|
974
|
-
var string = this.toString(radix || 10);
|
|
975
|
-
return '0'.times(length - string.length) + string;
|
|
976
|
-
},
|
|
977
|
-
|
|
978
|
-
toJSON: function() {
|
|
979
|
-
return isFinite(this) ? this.toString() : 'null';
|
|
980
|
-
}
|
|
981
|
-
});
|
|
982
|
-
|
|
983
|
-
$w('abs round ceil floor').each(function(method){
|
|
984
|
-
Number.prototype[method] = Math[method].methodize();
|
|
985
|
-
});
|
|
986
|
-
function $H(object) {
|
|
987
|
-
return new Hash(object);
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
var Hash = Class.create(Enumerable, (function() {
|
|
991
|
-
|
|
992
|
-
function toQueryPair(key, value) {
|
|
993
|
-
if (Object.isUndefined(value)) return key;
|
|
994
|
-
return key + '=' + encodeURIComponent(String.interpret(value));
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
return {
|
|
998
|
-
initialize: function(object) {
|
|
999
|
-
this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
|
|
1000
|
-
},
|
|
1001
|
-
|
|
1002
|
-
_each: function(iterator) {
|
|
1003
|
-
for (var key in this._object) {
|
|
1004
|
-
var value = this._object[key], pair = [key, value];
|
|
1005
|
-
pair.key = key;
|
|
1006
|
-
pair.value = value;
|
|
1007
|
-
iterator(pair);
|
|
1008
|
-
}
|
|
1009
|
-
},
|
|
1010
|
-
|
|
1011
|
-
set: function(key, value) {
|
|
1012
|
-
return this._object[key] = value;
|
|
1013
|
-
},
|
|
1014
|
-
|
|
1015
|
-
get: function(key) {
|
|
1016
|
-
return this._object[key];
|
|
1017
|
-
},
|
|
1018
|
-
|
|
1019
|
-
unset: function(key) {
|
|
1020
|
-
var value = this._object[key];
|
|
1021
|
-
delete this._object[key];
|
|
1022
|
-
return value;
|
|
1023
|
-
},
|
|
1024
|
-
|
|
1025
|
-
toObject: function() {
|
|
1026
|
-
return Object.clone(this._object);
|
|
1027
|
-
},
|
|
1028
|
-
|
|
1029
|
-
keys: function() {
|
|
1030
|
-
return this.pluck('key');
|
|
1031
|
-
},
|
|
1032
|
-
|
|
1033
|
-
values: function() {
|
|
1034
|
-
return this.pluck('value');
|
|
1035
|
-
},
|
|
1036
|
-
|
|
1037
|
-
index: function(value) {
|
|
1038
|
-
var match = this.detect(function(pair) {
|
|
1039
|
-
return pair.value === value;
|
|
1040
|
-
});
|
|
1041
|
-
return match && match.key;
|
|
1042
|
-
},
|
|
1043
|
-
|
|
1044
|
-
merge: function(object) {
|
|
1045
|
-
return this.clone().update(object);
|
|
1046
|
-
},
|
|
1047
|
-
|
|
1048
|
-
update: function(object) {
|
|
1049
|
-
return new Hash(object).inject(this, function(result, pair) {
|
|
1050
|
-
result.set(pair.key, pair.value);
|
|
1051
|
-
return result;
|
|
1052
|
-
});
|
|
1053
|
-
},
|
|
1054
|
-
|
|
1055
|
-
toQueryString: function() {
|
|
1056
|
-
return this.map(function(pair) {
|
|
1057
|
-
var key = encodeURIComponent(pair.key), values = pair.value;
|
|
1058
|
-
|
|
1059
|
-
if (values && typeof values == 'object') {
|
|
1060
|
-
if (Object.isArray(values))
|
|
1061
|
-
return values.map(toQueryPair.curry(key)).join('&');
|
|
1062
|
-
}
|
|
1063
|
-
return toQueryPair(key, values);
|
|
1064
|
-
}).join('&');
|
|
1065
|
-
},
|
|
1066
|
-
|
|
1067
|
-
inspect: function() {
|
|
1068
|
-
return '#<Hash:{' + this.map(function(pair) {
|
|
1069
|
-
return pair.map(Object.inspect).join(': ');
|
|
1070
|
-
}).join(', ') + '}>';
|
|
1071
|
-
},
|
|
1072
|
-
|
|
1073
|
-
toJSON: function() {
|
|
1074
|
-
return Object.toJSON(this.toObject());
|
|
1075
|
-
},
|
|
1076
|
-
|
|
1077
|
-
clone: function() {
|
|
1078
|
-
return new Hash(this);
|
|
1079
|
-
}
|
|
1080
|
-
};
|
|
1081
|
-
})());
|
|
1082
|
-
|
|
1083
|
-
Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
|
|
1084
|
-
Hash.from = $H;
|
|
1085
|
-
var ObjectRange = Class.create(Enumerable, {
|
|
1086
|
-
initialize: function(start, end, exclusive) {
|
|
1087
|
-
this.start = start;
|
|
1088
|
-
this.end = end;
|
|
1089
|
-
this.exclusive = exclusive;
|
|
1090
|
-
},
|
|
1091
|
-
|
|
1092
|
-
_each: function(iterator) {
|
|
1093
|
-
var value = this.start;
|
|
1094
|
-
while (this.include(value)) {
|
|
1095
|
-
iterator(value);
|
|
1096
|
-
value = value.succ();
|
|
1097
|
-
}
|
|
1098
|
-
},
|
|
1099
|
-
|
|
1100
|
-
include: function(value) {
|
|
1101
|
-
if (value < this.start)
|
|
1102
|
-
return false;
|
|
1103
|
-
if (this.exclusive)
|
|
1104
|
-
return value < this.end;
|
|
1105
|
-
return value <= this.end;
|
|
1106
|
-
}
|
|
1107
|
-
});
|
|
1108
|
-
|
|
1109
|
-
var $R = function(start, end, exclusive) {
|
|
1110
|
-
return new ObjectRange(start, end, exclusive);
|
|
1111
|
-
};
|
|
1112
|
-
|
|
1113
|
-
var Ajax = {
|
|
1114
|
-
getTransport: function() {
|
|
1115
|
-
return Try.these(
|
|
1116
|
-
function() {return new XMLHttpRequest();},
|
|
1117
|
-
function() {return new ActiveXObject('Msxml2.XMLHTTP');},
|
|
1118
|
-
function() {return new ActiveXObject('Microsoft.XMLHTTP');}
|
|
1119
|
-
) || false;
|
|
1120
|
-
},
|
|
1121
|
-
|
|
1122
|
-
activeRequestCount: 0
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
|
-
Ajax.Responders = {
|
|
1126
|
-
responders: [],
|
|
1127
|
-
|
|
1128
|
-
_each: function(iterator) {
|
|
1129
|
-
this.responders._each(iterator);
|
|
1130
|
-
},
|
|
1131
|
-
|
|
1132
|
-
register: function(responder) {
|
|
1133
|
-
if (!this.include(responder))
|
|
1134
|
-
this.responders.push(responder);
|
|
1135
|
-
},
|
|
1136
|
-
|
|
1137
|
-
unregister: function(responder) {
|
|
1138
|
-
this.responders = this.responders.without(responder);
|
|
1139
|
-
},
|
|
1140
|
-
|
|
1141
|
-
dispatch: function(callback, request, transport, json) {
|
|
1142
|
-
this.each(function(responder) {
|
|
1143
|
-
if (Object.isFunction(responder[callback])) {
|
|
1144
|
-
try {
|
|
1145
|
-
responder[callback].apply(responder, [request, transport, json]);
|
|
1146
|
-
} catch (e) { }
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
};
|
|
1151
|
-
|
|
1152
|
-
Object.extend(Ajax.Responders, Enumerable);
|
|
1153
|
-
|
|
1154
|
-
Ajax.Responders.register({
|
|
1155
|
-
onCreate: function() { Ajax.activeRequestCount++; },
|
|
1156
|
-
onComplete: function() { Ajax.activeRequestCount--; }
|
|
1157
|
-
});
|
|
1158
|
-
|
|
1159
|
-
Ajax.Base = Class.create({
|
|
1160
|
-
initialize: function(options) {
|
|
1161
|
-
this.options = {
|
|
1162
|
-
method: 'post',
|
|
1163
|
-
asynchronous: true,
|
|
1164
|
-
contentType: 'application/x-www-form-urlencoded',
|
|
1165
|
-
encoding: 'UTF-8',
|
|
1166
|
-
parameters: '',
|
|
1167
|
-
evalJSON: true,
|
|
1168
|
-
evalJS: true
|
|
1169
|
-
};
|
|
1170
|
-
Object.extend(this.options, options || { });
|
|
1171
|
-
|
|
1172
|
-
this.options.method = this.options.method.toLowerCase();
|
|
1173
|
-
|
|
1174
|
-
if (Object.isString(this.options.parameters))
|
|
1175
|
-
this.options.parameters = this.options.parameters.toQueryParams();
|
|
1176
|
-
else if (Object.isHash(this.options.parameters))
|
|
1177
|
-
this.options.parameters = this.options.parameters.toObject();
|
|
1178
|
-
}
|
|
1179
|
-
});
|
|
1180
|
-
|
|
1181
|
-
Ajax.Request = Class.create(Ajax.Base, {
|
|
1182
|
-
_complete: false,
|
|
1183
|
-
|
|
1184
|
-
initialize: function($super, url, options) {
|
|
1185
|
-
$super(options);
|
|
1186
|
-
this.transport = Ajax.getTransport();
|
|
1187
|
-
this.request(url);
|
|
1188
|
-
},
|
|
1189
|
-
|
|
1190
|
-
request: function(url) {
|
|
1191
|
-
this.url = url;
|
|
1192
|
-
this.method = this.options.method;
|
|
1193
|
-
var params = Object.clone(this.options.parameters);
|
|
1194
|
-
|
|
1195
|
-
if (this.options.emulateUncommonMethods && !['get', 'post'].include(this.method)) {
|
|
1196
|
-
// simulate other verbs over post
|
|
1197
|
-
params['_method'] = this.method;
|
|
1198
|
-
this.method = 'post';
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
this.parameters = params;
|
|
1202
|
-
|
|
1203
|
-
if (params = Object.toQueryString(params)) {
|
|
1204
|
-
// when GET, append parameters to URL
|
|
1205
|
-
if (this.method == 'get')
|
|
1206
|
-
this.url += (this.url.include('?') ? '&' : '?') + params;
|
|
1207
|
-
else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
|
|
1208
|
-
params += '&_=';
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
try {
|
|
1212
|
-
var response = new Ajax.Response(this);
|
|
1213
|
-
if (this.options.onCreate) this.options.onCreate(response);
|
|
1214
|
-
Ajax.Responders.dispatch('onCreate', this, response);
|
|
1215
|
-
|
|
1216
|
-
this.transport.open(this.method.toUpperCase(), this.url,
|
|
1217
|
-
this.options.asynchronous);
|
|
1218
|
-
|
|
1219
|
-
if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
|
|
1220
|
-
|
|
1221
|
-
this.transport.onreadystatechange = this.onStateChange.bind(this);
|
|
1222
|
-
this.setRequestHeaders();
|
|
1223
|
-
|
|
1224
|
-
this.body = this.method != 'get' ? (this.options.postBody || params) : null;
|
|
1225
|
-
this.transport.send(this.body);
|
|
1226
|
-
|
|
1227
|
-
/* Force Firefox to handle ready state 4 for synchronous requests */
|
|
1228
|
-
if (!this.options.asynchronous && this.transport.overrideMimeType)
|
|
1229
|
-
this.onStateChange();
|
|
1230
|
-
|
|
1231
|
-
}
|
|
1232
|
-
catch (e) {
|
|
1233
|
-
this.dispatchException(e);
|
|
1234
|
-
}
|
|
1235
|
-
},
|
|
1236
|
-
|
|
1237
|
-
onStateChange: function() {
|
|
1238
|
-
var readyState = this.transport.readyState;
|
|
1239
|
-
if (readyState > 1 && !((readyState == 4) && this._complete))
|
|
1240
|
-
this.respondToReadyState(this.transport.readyState);
|
|
1241
|
-
},
|
|
1242
|
-
|
|
1243
|
-
setRequestHeaders: function() {
|
|
1244
|
-
var headers = {
|
|
1245
|
-
'X-Requested-With': 'XMLHttpRequest',
|
|
1246
|
-
'X-Prototype-Version': Prototype.Version,
|
|
1247
|
-
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
|
|
1248
|
-
};
|
|
1249
|
-
|
|
1250
|
-
if (this.method == 'post') {
|
|
1251
|
-
headers['Content-type'] = this.options.contentType +
|
|
1252
|
-
(this.options.encoding ? '; charset=' + this.options.encoding : '');
|
|
1253
|
-
|
|
1254
|
-
/* Force "Connection: close" for older Mozilla browsers to work
|
|
1255
|
-
* around a bug where XMLHttpRequest sends an incorrect
|
|
1256
|
-
* Content-length header. See Mozilla Bugzilla #246651.
|
|
1257
|
-
*/
|
|
1258
|
-
if (this.transport.overrideMimeType &&
|
|
1259
|
-
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
|
|
1260
|
-
headers['Connection'] = 'close';
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
// user-defined headers
|
|
1264
|
-
if (typeof this.options.requestHeaders == 'object') {
|
|
1265
|
-
var extras = this.options.requestHeaders;
|
|
1266
|
-
|
|
1267
|
-
if (Object.isFunction(extras.push))
|
|
1268
|
-
for (var i = 0, length = extras.length; i < length; i += 2)
|
|
1269
|
-
headers[extras[i]] = extras[i+1];
|
|
1270
|
-
else
|
|
1271
|
-
$H(extras).each(function(pair) { headers[pair.key] = pair.value; });
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
for (var name in headers)
|
|
1275
|
-
this.transport.setRequestHeader(name, headers[name]);
|
|
1276
|
-
},
|
|
1277
|
-
|
|
1278
|
-
success: function() {
|
|
1279
|
-
var status = this.getStatus();
|
|
1280
|
-
return !status || (status >= 200 && status < 300);
|
|
1281
|
-
},
|
|
1282
|
-
|
|
1283
|
-
getStatus: function() {
|
|
1284
|
-
try {
|
|
1285
|
-
return this.transport.status || 0;
|
|
1286
|
-
} catch (e) { return 0; }
|
|
1287
|
-
},
|
|
1288
|
-
|
|
1289
|
-
respondToReadyState: function(readyState) {
|
|
1290
|
-
var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
|
|
1291
|
-
|
|
1292
|
-
if (state == 'Complete') {
|
|
1293
|
-
try {
|
|
1294
|
-
this._complete = true;
|
|
1295
|
-
(this.options['on' + response.status]
|
|
1296
|
-
|| this.options['on' + (this.success() ? 'Success' : 'Failure')]
|
|
1297
|
-
|| Prototype.emptyFunction)(response, response.headerJSON);
|
|
1298
|
-
} catch (e) {
|
|
1299
|
-
this.dispatchException(e);
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
var contentType = response.getHeader('Content-type');
|
|
1303
|
-
if (this.options.evalJS == 'force'
|
|
1304
|
-
|| (this.options.evalJS && this.isSameOrigin() && contentType
|
|
1305
|
-
&& contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
|
|
1306
|
-
this.evalResponse();
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
try {
|
|
1310
|
-
(this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
|
|
1311
|
-
Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
|
|
1312
|
-
} catch (e) {
|
|
1313
|
-
this.dispatchException(e);
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
if (state == 'Complete') {
|
|
1317
|
-
// avoid memory leak in MSIE: clean up
|
|
1318
|
-
this.transport.onreadystatechange = Prototype.emptyFunction;
|
|
1319
|
-
}
|
|
1320
|
-
},
|
|
1321
|
-
|
|
1322
|
-
isSameOrigin: function() {
|
|
1323
|
-
var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
|
|
1324
|
-
return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
|
|
1325
|
-
protocol: location.protocol,
|
|
1326
|
-
domain: document.domain,
|
|
1327
|
-
port: location.port ? ':' + location.port : ''
|
|
1328
|
-
}));
|
|
1329
|
-
},
|
|
1330
|
-
|
|
1331
|
-
getHeader: function(name) {
|
|
1332
|
-
try {
|
|
1333
|
-
return this.transport.getResponseHeader(name) || null;
|
|
1334
|
-
} catch (e) { return null; }
|
|
1335
|
-
},
|
|
1336
|
-
|
|
1337
|
-
evalResponse: function() {
|
|
1338
|
-
try {
|
|
1339
|
-
return eval((this.transport.responseText || '').unfilterJSON());
|
|
1340
|
-
} catch (e) {
|
|
1341
|
-
this.dispatchException(e);
|
|
1342
|
-
}
|
|
1343
|
-
},
|
|
1344
|
-
|
|
1345
|
-
dispatchException: function(exception) {
|
|
1346
|
-
(this.options.onException || Prototype.emptyFunction)(this, exception);
|
|
1347
|
-
Ajax.Responders.dispatch('onException', this, exception);
|
|
1348
|
-
}
|
|
1349
|
-
});
|
|
1350
|
-
|
|
1351
|
-
Ajax.Request.Events =
|
|
1352
|
-
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
|
|
1353
|
-
|
|
1354
|
-
Ajax.Response = Class.create({
|
|
1355
|
-
initialize: function(request){
|
|
1356
|
-
this.request = request;
|
|
1357
|
-
var transport = this.transport = request.transport,
|
|
1358
|
-
readyState = this.readyState = transport.readyState;
|
|
1359
|
-
|
|
1360
|
-
if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
|
|
1361
|
-
this.status = this.getStatus();
|
|
1362
|
-
this.statusText = this.getStatusText();
|
|
1363
|
-
this.responseText = String.interpret(transport.responseText);
|
|
1364
|
-
this.headerJSON = this._getHeaderJSON();
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
if(readyState == 4) {
|
|
1368
|
-
var xml = transport.responseXML;
|
|
1369
|
-
this.responseXML = Object.isUndefined(xml) ? null : xml;
|
|
1370
|
-
this.responseJSON = this._getResponseJSON();
|
|
1371
|
-
}
|
|
1372
|
-
},
|
|
1373
|
-
|
|
1374
|
-
status: 0,
|
|
1375
|
-
statusText: '',
|
|
1376
|
-
|
|
1377
|
-
getStatus: Ajax.Request.prototype.getStatus,
|
|
1378
|
-
|
|
1379
|
-
getStatusText: function() {
|
|
1380
|
-
try {
|
|
1381
|
-
return this.transport.statusText || '';
|
|
1382
|
-
} catch (e) { return ''; }
|
|
1383
|
-
},
|
|
1384
|
-
|
|
1385
|
-
getHeader: Ajax.Request.prototype.getHeader,
|
|
1386
|
-
|
|
1387
|
-
getAllHeaders: function() {
|
|
1388
|
-
try {
|
|
1389
|
-
return this.getAllResponseHeaders();
|
|
1390
|
-
} catch (e) { return null; }
|
|
1391
|
-
},
|
|
1392
|
-
|
|
1393
|
-
getResponseHeader: function(name) {
|
|
1394
|
-
return this.transport.getResponseHeader(name);
|
|
1395
|
-
},
|
|
1396
|
-
|
|
1397
|
-
getAllResponseHeaders: function() {
|
|
1398
|
-
return this.transport.getAllResponseHeaders();
|
|
1399
|
-
},
|
|
1400
|
-
|
|
1401
|
-
_getHeaderJSON: function() {
|
|
1402
|
-
var json = this.getHeader('X-JSON');
|
|
1403
|
-
if (!json) return null;
|
|
1404
|
-
json = decodeURIComponent(escape(json));
|
|
1405
|
-
try {
|
|
1406
|
-
return json.evalJSON(this.request.options.sanitizeJSON ||
|
|
1407
|
-
!this.request.isSameOrigin());
|
|
1408
|
-
} catch (e) {
|
|
1409
|
-
this.request.dispatchException(e);
|
|
1410
|
-
}
|
|
1411
|
-
},
|
|
1412
|
-
|
|
1413
|
-
_getResponseJSON: function() {
|
|
1414
|
-
var options = this.request.options;
|
|
1415
|
-
if (!options.evalJSON || (options.evalJSON != 'force' &&
|
|
1416
|
-
!(this.getHeader('Content-type') || '').include('application/json')) ||
|
|
1417
|
-
this.responseText.blank())
|
|
1418
|
-
return null;
|
|
1419
|
-
try {
|
|
1420
|
-
return this.responseText.evalJSON(options.sanitizeJSON ||
|
|
1421
|
-
!this.request.isSameOrigin());
|
|
1422
|
-
} catch (e) {
|
|
1423
|
-
this.request.dispatchException(e);
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
});
|
|
1427
|
-
|
|
1428
|
-
Ajax.Updater = Class.create(Ajax.Request, {
|
|
1429
|
-
initialize: function($super, container, url, options) {
|
|
1430
|
-
this.container = {
|
|
1431
|
-
success: (container.success || container),
|
|
1432
|
-
failure: (container.failure || (container.success ? null : container))
|
|
1433
|
-
};
|
|
1434
|
-
|
|
1435
|
-
options = Object.clone(options);
|
|
1436
|
-
var onComplete = options.onComplete;
|
|
1437
|
-
options.onComplete = (function(response, json) {
|
|
1438
|
-
this.updateContent(response.responseText);
|
|
1439
|
-
if (Object.isFunction(onComplete)) onComplete(response, json);
|
|
1440
|
-
}).bind(this);
|
|
1441
|
-
|
|
1442
|
-
$super(url, options);
|
|
1443
|
-
},
|
|
1444
|
-
|
|
1445
|
-
updateContent: function(responseText) {
|
|
1446
|
-
var receiver = this.container[this.success() ? 'success' : 'failure'],
|
|
1447
|
-
options = this.options;
|
|
1448
|
-
|
|
1449
|
-
if (!options.evalScripts) responseText = responseText.stripScripts();
|
|
1450
|
-
|
|
1451
|
-
if (receiver = $(receiver)) {
|
|
1452
|
-
if (options.insertion) {
|
|
1453
|
-
if (Object.isString(options.insertion)) {
|
|
1454
|
-
var insertion = { }; insertion[options.insertion] = responseText;
|
|
1455
|
-
receiver.insert(insertion);
|
|
1456
|
-
}
|
|
1457
|
-
else options.insertion(receiver, responseText);
|
|
1458
|
-
}
|
|
1459
|
-
else receiver.update(responseText);
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
});
|
|
1463
|
-
|
|
1464
|
-
Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
|
|
1465
|
-
initialize: function($super, container, url, options) {
|
|
1466
|
-
$super(options);
|
|
1467
|
-
this.onComplete = this.options.onComplete;
|
|
1468
|
-
|
|
1469
|
-
this.frequency = (this.options.frequency || 2);
|
|
1470
|
-
this.decay = (this.options.decay || 1);
|
|
1471
|
-
|
|
1472
|
-
this.updater = { };
|
|
1473
|
-
this.container = container;
|
|
1474
|
-
this.url = url;
|
|
1475
|
-
|
|
1476
|
-
this.start();
|
|
1477
|
-
},
|
|
1478
|
-
|
|
1479
|
-
start: function() {
|
|
1480
|
-
this.options.onComplete = this.updateComplete.bind(this);
|
|
1481
|
-
this.onTimerEvent();
|
|
1482
|
-
},
|
|
1483
|
-
|
|
1484
|
-
stop: function() {
|
|
1485
|
-
this.updater.options.onComplete = undefined;
|
|
1486
|
-
clearTimeout(this.timer);
|
|
1487
|
-
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
|
|
1488
|
-
},
|
|
1489
|
-
|
|
1490
|
-
updateComplete: function(response) {
|
|
1491
|
-
if (this.options.decay) {
|
|
1492
|
-
this.decay = (response.responseText == this.lastText ?
|
|
1493
|
-
this.decay * this.options.decay : 1);
|
|
1494
|
-
|
|
1495
|
-
this.lastText = response.responseText;
|
|
1496
|
-
}
|
|
1497
|
-
this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
|
|
1498
|
-
},
|
|
1499
|
-
|
|
1500
|
-
onTimerEvent: function() {
|
|
1501
|
-
this.updater = new Ajax.Updater(this.container, this.url, this.options);
|
|
1502
|
-
}
|
|
1503
|
-
});
|
|
1504
|
-
function $(element) {
|
|
1505
|
-
if (arguments.length > 1) {
|
|
1506
|
-
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
|
|
1507
|
-
elements.push($(arguments[i]));
|
|
1508
|
-
return elements;
|
|
1509
|
-
}
|
|
1510
|
-
if (Object.isString(element))
|
|
1511
|
-
element = document.getElementById(element);
|
|
1512
|
-
return Element.extend(element);
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
if (Prototype.BrowserFeatures.XPath) {
|
|
1516
|
-
document._getElementsByXPath = function(expression, parentElement) {
|
|
1517
|
-
var results = [];
|
|
1518
|
-
var query = document.evaluate(expression, $(parentElement) || document,
|
|
1519
|
-
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
|
|
1520
|
-
for (var i = 0, length = query.snapshotLength; i < length; i++)
|
|
1521
|
-
results.push(Element.extend(query.snapshotItem(i)));
|
|
1522
|
-
return results;
|
|
1523
|
-
};
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
/*--------------------------------------------------------------------------*/
|
|
1527
|
-
|
|
1528
|
-
if (!window.Node) var Node = { };
|
|
1529
|
-
|
|
1530
|
-
if (!Node.ELEMENT_NODE) {
|
|
1531
|
-
// DOM level 2 ECMAScript Language Binding
|
|
1532
|
-
Object.extend(Node, {
|
|
1533
|
-
ELEMENT_NODE: 1,
|
|
1534
|
-
ATTRIBUTE_NODE: 2,
|
|
1535
|
-
TEXT_NODE: 3,
|
|
1536
|
-
CDATA_SECTION_NODE: 4,
|
|
1537
|
-
ENTITY_REFERENCE_NODE: 5,
|
|
1538
|
-
ENTITY_NODE: 6,
|
|
1539
|
-
PROCESSING_INSTRUCTION_NODE: 7,
|
|
1540
|
-
COMMENT_NODE: 8,
|
|
1541
|
-
DOCUMENT_NODE: 9,
|
|
1542
|
-
DOCUMENT_TYPE_NODE: 10,
|
|
1543
|
-
DOCUMENT_FRAGMENT_NODE: 11,
|
|
1544
|
-
NOTATION_NODE: 12
|
|
1545
|
-
});
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
(function() {
|
|
1549
|
-
var element = this.Element;
|
|
1550
|
-
this.Element = function(tagName, attributes) {
|
|
1551
|
-
attributes = attributes || { };
|
|
1552
|
-
tagName = tagName.toLowerCase();
|
|
1553
|
-
var cache = Element.cache;
|
|
1554
|
-
if (Prototype.Browser.IE && attributes.name) {
|
|
1555
|
-
tagName = '<' + tagName + ' name="' + attributes.name + '">';
|
|
1556
|
-
delete attributes.name;
|
|
1557
|
-
return Element.writeAttribute(document.createElement(tagName), attributes);
|
|
1558
|
-
}
|
|
1559
|
-
if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
|
|
1560
|
-
return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
|
|
1561
|
-
};
|
|
1562
|
-
Object.extend(this.Element, element || { });
|
|
1563
|
-
}).call(window);
|
|
1564
|
-
|
|
1565
|
-
Element.cache = { };
|
|
1566
|
-
|
|
1567
|
-
Element.Methods = {
|
|
1568
|
-
visible: function(element) {
|
|
1569
|
-
return $(element).style.display != 'none';
|
|
1570
|
-
},
|
|
1571
|
-
|
|
1572
|
-
toggle: function(element) {
|
|
1573
|
-
element = $(element);
|
|
1574
|
-
Element[Element.visible(element) ? 'hide' : 'show'](element);
|
|
1575
|
-
return element;
|
|
1576
|
-
},
|
|
1577
|
-
|
|
1578
|
-
hide: function(element) {
|
|
1579
|
-
$(element).style.display = 'none';
|
|
1580
|
-
return element;
|
|
1581
|
-
},
|
|
1582
|
-
|
|
1583
|
-
show: function(element) {
|
|
1584
|
-
$(element).style.display = '';
|
|
1585
|
-
return element;
|
|
1586
|
-
},
|
|
1587
|
-
|
|
1588
|
-
remove: function(element) {
|
|
1589
|
-
element = $(element);
|
|
1590
|
-
element.parentNode.removeChild(element);
|
|
1591
|
-
return element;
|
|
1592
|
-
},
|
|
1593
|
-
|
|
1594
|
-
update: function(element, content) {
|
|
1595
|
-
element = $(element);
|
|
1596
|
-
if (content && content.toElement) content = content.toElement();
|
|
1597
|
-
if (Object.isElement(content)) return element.update().insert(content);
|
|
1598
|
-
content = Object.toHTML(content);
|
|
1599
|
-
element.innerHTML = content.stripScripts();
|
|
1600
|
-
content.evalScripts.bind(content).defer();
|
|
1601
|
-
return element;
|
|
1602
|
-
},
|
|
1603
|
-
|
|
1604
|
-
replace: function(element, content) {
|
|
1605
|
-
element = $(element);
|
|
1606
|
-
if (content && content.toElement) content = content.toElement();
|
|
1607
|
-
else if (!Object.isElement(content)) {
|
|
1608
|
-
content = Object.toHTML(content);
|
|
1609
|
-
var range = element.ownerDocument.createRange();
|
|
1610
|
-
range.selectNode(element);
|
|
1611
|
-
content.evalScripts.bind(content).defer();
|
|
1612
|
-
content = range.createContextualFragment(content.stripScripts());
|
|
1613
|
-
}
|
|
1614
|
-
element.parentNode.replaceChild(content, element);
|
|
1615
|
-
return element;
|
|
1616
|
-
},
|
|
1617
|
-
|
|
1618
|
-
insert: function(element, insertions) {
|
|
1619
|
-
element = $(element);
|
|
1620
|
-
|
|
1621
|
-
if (Object.isString(insertions) || Object.isNumber(insertions) ||
|
|
1622
|
-
Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
|
|
1623
|
-
insertions = {bottom:insertions};
|
|
1624
|
-
|
|
1625
|
-
var content, insert, tagName, childNodes;
|
|
1626
|
-
|
|
1627
|
-
for (var position in insertions) {
|
|
1628
|
-
content = insertions[position];
|
|
1629
|
-
position = position.toLowerCase();
|
|
1630
|
-
insert = Element._insertionTranslations[position];
|
|
1631
|
-
|
|
1632
|
-
if (content && content.toElement) content = content.toElement();
|
|
1633
|
-
if (Object.isElement(content)) {
|
|
1634
|
-
insert(element, content);
|
|
1635
|
-
continue;
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
content = Object.toHTML(content);
|
|
1639
|
-
|
|
1640
|
-
tagName = ((position == 'before' || position == 'after')
|
|
1641
|
-
? element.parentNode : element).tagName.toUpperCase();
|
|
1642
|
-
|
|
1643
|
-
childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
|
|
1644
|
-
|
|
1645
|
-
if (position == 'top' || position == 'after') childNodes.reverse();
|
|
1646
|
-
childNodes.each(insert.curry(element));
|
|
1647
|
-
|
|
1648
|
-
content.evalScripts.bind(content).defer();
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
return element;
|
|
1652
|
-
},
|
|
1653
|
-
|
|
1654
|
-
wrap: function(element, wrapper, attributes) {
|
|
1655
|
-
element = $(element);
|
|
1656
|
-
if (Object.isElement(wrapper))
|
|
1657
|
-
$(wrapper).writeAttribute(attributes || { });
|
|
1658
|
-
else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
|
|
1659
|
-
else wrapper = new Element('div', wrapper);
|
|
1660
|
-
if (element.parentNode)
|
|
1661
|
-
element.parentNode.replaceChild(wrapper, element);
|
|
1662
|
-
wrapper.appendChild(element);
|
|
1663
|
-
return wrapper;
|
|
1664
|
-
},
|
|
1665
|
-
|
|
1666
|
-
inspect: function(element) {
|
|
1667
|
-
element = $(element);
|
|
1668
|
-
var result = '<' + element.tagName.toLowerCase();
|
|
1669
|
-
$H({'id': 'id', 'className': 'class'}).each(function(pair) {
|
|
1670
|
-
var property = pair.first(), attribute = pair.last();
|
|
1671
|
-
var value = (element[property] || '').toString();
|
|
1672
|
-
if (value) result += ' ' + attribute + '=' + value.inspect(true);
|
|
1673
|
-
});
|
|
1674
|
-
return result + '>';
|
|
1675
|
-
},
|
|
1676
|
-
|
|
1677
|
-
recursivelyCollect: function(element, property) {
|
|
1678
|
-
element = $(element);
|
|
1679
|
-
var elements = [];
|
|
1680
|
-
while (element = element[property])
|
|
1681
|
-
if (element.nodeType == 1)
|
|
1682
|
-
elements.push(Element.extend(element));
|
|
1683
|
-
return elements;
|
|
1684
|
-
},
|
|
1685
|
-
|
|
1686
|
-
ancestors: function(element) {
|
|
1687
|
-
return $(element).recursivelyCollect('parentNode');
|
|
1688
|
-
},
|
|
1689
|
-
|
|
1690
|
-
descendants: function(element) {
|
|
1691
|
-
return $(element).select("*");
|
|
1692
|
-
},
|
|
1693
|
-
|
|
1694
|
-
firstDescendant: function(element) {
|
|
1695
|
-
element = $(element).firstChild;
|
|
1696
|
-
while (element && element.nodeType != 1) element = element.nextSibling;
|
|
1697
|
-
return $(element);
|
|
1698
|
-
},
|
|
1699
|
-
|
|
1700
|
-
immediateDescendants: function(element) {
|
|
1701
|
-
if (!(element = $(element).firstChild)) return [];
|
|
1702
|
-
while (element && element.nodeType != 1) element = element.nextSibling;
|
|
1703
|
-
if (element) return [element].concat($(element).nextSiblings());
|
|
1704
|
-
return [];
|
|
1705
|
-
},
|
|
1706
|
-
|
|
1707
|
-
previousSiblings: function(element) {
|
|
1708
|
-
return $(element).recursivelyCollect('previousSibling');
|
|
1709
|
-
},
|
|
1710
|
-
|
|
1711
|
-
nextSiblings: function(element) {
|
|
1712
|
-
return $(element).recursivelyCollect('nextSibling');
|
|
1713
|
-
},
|
|
1714
|
-
|
|
1715
|
-
siblings: function(element) {
|
|
1716
|
-
element = $(element);
|
|
1717
|
-
return element.previousSiblings().reverse().concat(element.nextSiblings());
|
|
1718
|
-
},
|
|
1719
|
-
|
|
1720
|
-
match: function(element, selector) {
|
|
1721
|
-
if (Object.isString(selector))
|
|
1722
|
-
selector = new Selector(selector);
|
|
1723
|
-
return selector.match($(element));
|
|
1724
|
-
},
|
|
1725
|
-
|
|
1726
|
-
up: function(element, expression, index) {
|
|
1727
|
-
element = $(element);
|
|
1728
|
-
if (arguments.length == 1) return $(element.parentNode);
|
|
1729
|
-
var ancestors = element.ancestors();
|
|
1730
|
-
return Object.isNumber(expression) ? ancestors[expression] :
|
|
1731
|
-
Selector.findElement(ancestors, expression, index);
|
|
1732
|
-
},
|
|
1733
|
-
|
|
1734
|
-
down: function(element, expression, index) {
|
|
1735
|
-
element = $(element);
|
|
1736
|
-
if (arguments.length == 1) return element.firstDescendant();
|
|
1737
|
-
return Object.isNumber(expression) ? element.descendants()[expression] :
|
|
1738
|
-
element.select(expression)[index || 0];
|
|
1739
|
-
},
|
|
1740
|
-
|
|
1741
|
-
previous: function(element, expression, index) {
|
|
1742
|
-
element = $(element);
|
|
1743
|
-
if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
|
|
1744
|
-
var previousSiblings = element.previousSiblings();
|
|
1745
|
-
return Object.isNumber(expression) ? previousSiblings[expression] :
|
|
1746
|
-
Selector.findElement(previousSiblings, expression, index);
|
|
1747
|
-
},
|
|
1748
|
-
|
|
1749
|
-
next: function(element, expression, index) {
|
|
1750
|
-
element = $(element);
|
|
1751
|
-
if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
|
|
1752
|
-
var nextSiblings = element.nextSiblings();
|
|
1753
|
-
return Object.isNumber(expression) ? nextSiblings[expression] :
|
|
1754
|
-
Selector.findElement(nextSiblings, expression, index);
|
|
1755
|
-
},
|
|
1756
|
-
|
|
1757
|
-
select: function() {
|
|
1758
|
-
var args = $A(arguments), element = $(args.shift());
|
|
1759
|
-
return Selector.findChildElements(element, args);
|
|
1760
|
-
},
|
|
1761
|
-
|
|
1762
|
-
adjacent: function() {
|
|
1763
|
-
var args = $A(arguments), element = $(args.shift());
|
|
1764
|
-
return Selector.findChildElements(element.parentNode, args).without(element);
|
|
1765
|
-
},
|
|
1766
|
-
|
|
1767
|
-
identify: function(element) {
|
|
1768
|
-
element = $(element);
|
|
1769
|
-
var id = element.readAttribute('id'), self = arguments.callee;
|
|
1770
|
-
if (id) return id;
|
|
1771
|
-
do { id = 'anonymous_element_' + self.counter++; } while ($(id));
|
|
1772
|
-
element.writeAttribute('id', id);
|
|
1773
|
-
return id;
|
|
1774
|
-
},
|
|
1775
|
-
|
|
1776
|
-
readAttribute: function(element, name) {
|
|
1777
|
-
element = $(element);
|
|
1778
|
-
if (Prototype.Browser.IE) {
|
|
1779
|
-
var t = Element._attributeTranslations.read;
|
|
1780
|
-
if (t.values[name]) return t.values[name](element, name);
|
|
1781
|
-
if (t.names[name]) name = t.names[name];
|
|
1782
|
-
if (name.include(':')) {
|
|
1783
|
-
return (!element.attributes || !element.attributes[name]) ? null :
|
|
1784
|
-
element.attributes[name].value;
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
return element.getAttribute(name);
|
|
1788
|
-
},
|
|
1789
|
-
|
|
1790
|
-
writeAttribute: function(element, name, value) {
|
|
1791
|
-
element = $(element);
|
|
1792
|
-
var attributes = { }, t = Element._attributeTranslations.write;
|
|
1793
|
-
|
|
1794
|
-
if (typeof name == 'object') attributes = name;
|
|
1795
|
-
else attributes[name] = Object.isUndefined(value) ? true : value;
|
|
1796
|
-
|
|
1797
|
-
for (var attr in attributes) {
|
|
1798
|
-
name = t.names[attr] || attr;
|
|
1799
|
-
value = attributes[attr];
|
|
1800
|
-
if (t.values[attr]) name = t.values[attr](element, value);
|
|
1801
|
-
if (value === false || value === null)
|
|
1802
|
-
element.removeAttribute(name);
|
|
1803
|
-
else if (value === true)
|
|
1804
|
-
element.setAttribute(name, name);
|
|
1805
|
-
else element.setAttribute(name, value);
|
|
1806
|
-
}
|
|
1807
|
-
return element;
|
|
1808
|
-
},
|
|
1809
|
-
|
|
1810
|
-
getHeight: function(element) {
|
|
1811
|
-
return $(element).getDimensions().height;
|
|
1812
|
-
},
|
|
1813
|
-
|
|
1814
|
-
getWidth: function(element) {
|
|
1815
|
-
return $(element).getDimensions().width;
|
|
1816
|
-
},
|
|
1817
|
-
|
|
1818
|
-
classNames: function(element) {
|
|
1819
|
-
return new Element.ClassNames(element);
|
|
1820
|
-
},
|
|
1821
|
-
|
|
1822
|
-
hasClassName: function(element, className) {
|
|
1823
|
-
if (!(element = $(element))) return;
|
|
1824
|
-
var elementClassName = element.className;
|
|
1825
|
-
return (elementClassName.length > 0 && (elementClassName == className ||
|
|
1826
|
-
new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
|
|
1827
|
-
},
|
|
1828
|
-
|
|
1829
|
-
addClassName: function(element, className) {
|
|
1830
|
-
if (!(element = $(element))) return;
|
|
1831
|
-
if (!element.hasClassName(className))
|
|
1832
|
-
element.className += (element.className ? ' ' : '') + className;
|
|
1833
|
-
return element;
|
|
1834
|
-
},
|
|
1835
|
-
|
|
1836
|
-
removeClassName: function(element, className) {
|
|
1837
|
-
if (!(element = $(element))) return;
|
|
1838
|
-
element.className = element.className.replace(
|
|
1839
|
-
new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
|
|
1840
|
-
return element;
|
|
1841
|
-
},
|
|
1842
|
-
|
|
1843
|
-
toggleClassName: function(element, className) {
|
|
1844
|
-
if (!(element = $(element))) return;
|
|
1845
|
-
return element[element.hasClassName(className) ?
|
|
1846
|
-
'removeClassName' : 'addClassName'](className);
|
|
1847
|
-
},
|
|
1848
|
-
|
|
1849
|
-
// removes whitespace-only text node children
|
|
1850
|
-
cleanWhitespace: function(element) {
|
|
1851
|
-
element = $(element);
|
|
1852
|
-
var node = element.firstChild;
|
|
1853
|
-
while (node) {
|
|
1854
|
-
var nextNode = node.nextSibling;
|
|
1855
|
-
if (node.nodeType == 3 && !(/\S/).test(node.nodeValue))
|
|
1856
|
-
element.removeChild(node);
|
|
1857
|
-
node = nextNode;
|
|
1858
|
-
}
|
|
1859
|
-
return element;
|
|
1860
|
-
},
|
|
1861
|
-
|
|
1862
|
-
empty: function(element) {
|
|
1863
|
-
return $(element).innerHTML.blank();
|
|
1864
|
-
},
|
|
1865
|
-
|
|
1866
|
-
descendantOf: function(element, ancestor) {
|
|
1867
|
-
element = $(element); ancestor = $(ancestor);
|
|
1868
|
-
var originalAncestor = ancestor;
|
|
1869
|
-
|
|
1870
|
-
if (element.compareDocumentPosition)
|
|
1871
|
-
return (element.compareDocumentPosition(ancestor) & 8) === 8;
|
|
1872
|
-
|
|
1873
|
-
if (element.sourceIndex && !Prototype.Browser.Opera) {
|
|
1874
|
-
var e = element.sourceIndex, a = ancestor.sourceIndex,
|
|
1875
|
-
nextAncestor = ancestor.nextSibling;
|
|
1876
|
-
if (!nextAncestor) {
|
|
1877
|
-
do { ancestor = ancestor.parentNode; }
|
|
1878
|
-
while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
|
|
1879
|
-
}
|
|
1880
|
-
if (nextAncestor && nextAncestor.sourceIndex)
|
|
1881
|
-
return (e > a && e < nextAncestor.sourceIndex);
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
while (element = element.parentNode)
|
|
1885
|
-
if (element == originalAncestor) return true;
|
|
1886
|
-
return false;
|
|
1887
|
-
},
|
|
1888
|
-
|
|
1889
|
-
scrollTo: function(element) {
|
|
1890
|
-
element = $(element);
|
|
1891
|
-
var pos = element.cumulativeOffset();
|
|
1892
|
-
window.scrollTo(pos[0], pos[1]);
|
|
1893
|
-
return element;
|
|
1894
|
-
},
|
|
1895
|
-
|
|
1896
|
-
getStyle: function(element, style) {
|
|
1897
|
-
element = $(element);
|
|
1898
|
-
style = style == 'float' ? 'cssFloat' : style.camelize();
|
|
1899
|
-
var value = element.style[style];
|
|
1900
|
-
if (!value) {
|
|
1901
|
-
var css = document.defaultView.getComputedStyle(element, null);
|
|
1902
|
-
value = css ? css[style] : null;
|
|
1903
|
-
}
|
|
1904
|
-
if (style == 'opacity') return value ? parseFloat(value) : 1.0;
|
|
1905
|
-
return value == 'auto' ? null : value;
|
|
1906
|
-
},
|
|
1907
|
-
|
|
1908
|
-
getOpacity: function(element) {
|
|
1909
|
-
return $(element).getStyle('opacity');
|
|
1910
|
-
},
|
|
1911
|
-
|
|
1912
|
-
setStyle: function(element, styles) {
|
|
1913
|
-
element = $(element);
|
|
1914
|
-
var elementStyle = element.style, match;
|
|
1915
|
-
if (Object.isString(styles)) {
|
|
1916
|
-
element.style.cssText += ';' + styles;
|
|
1917
|
-
return styles.include('opacity') ?
|
|
1918
|
-
element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
|
|
1919
|
-
}
|
|
1920
|
-
for (var property in styles)
|
|
1921
|
-
if (property == 'opacity') element.setOpacity(styles[property]);
|
|
1922
|
-
else
|
|
1923
|
-
elementStyle[(property == 'float' || property == 'cssFloat') ?
|
|
1924
|
-
(Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
|
|
1925
|
-
property] = styles[property];
|
|
1926
|
-
|
|
1927
|
-
return element;
|
|
1928
|
-
},
|
|
1929
|
-
|
|
1930
|
-
setOpacity: function(element, value) {
|
|
1931
|
-
element = $(element);
|
|
1932
|
-
element.style.opacity = (value == 1 || value === '') ? '' :
|
|
1933
|
-
(value < 0.00001) ? 0 : value;
|
|
1934
|
-
return element;
|
|
1935
|
-
},
|
|
1936
|
-
|
|
1937
|
-
getDimensions: function(element) {
|
|
1938
|
-
element = $(element);
|
|
1939
|
-
var display = $(element).getStyle('display');
|
|
1940
|
-
if (display != 'none' && display != null) // Safari bug
|
|
1941
|
-
return {width: element.offsetWidth, height: element.offsetHeight};
|
|
1942
|
-
|
|
1943
|
-
// All *Width and *Height properties give 0 on elements with display none,
|
|
1944
|
-
// so enable the element temporarily
|
|
1945
|
-
var els = element.style;
|
|
1946
|
-
var originalVisibility = els.visibility;
|
|
1947
|
-
var originalPosition = els.position;
|
|
1948
|
-
var originalDisplay = els.display;
|
|
1949
|
-
els.visibility = 'hidden';
|
|
1950
|
-
els.position = 'absolute';
|
|
1951
|
-
els.display = 'block';
|
|
1952
|
-
var originalWidth = element.clientWidth;
|
|
1953
|
-
var originalHeight = element.clientHeight;
|
|
1954
|
-
els.display = originalDisplay;
|
|
1955
|
-
els.position = originalPosition;
|
|
1956
|
-
els.visibility = originalVisibility;
|
|
1957
|
-
return {width: originalWidth, height: originalHeight};
|
|
1958
|
-
},
|
|
1959
|
-
|
|
1960
|
-
makePositioned: function(element) {
|
|
1961
|
-
element = $(element);
|
|
1962
|
-
var pos = Element.getStyle(element, 'position');
|
|
1963
|
-
if (pos == 'static' || !pos) {
|
|
1964
|
-
element._madePositioned = true;
|
|
1965
|
-
element.style.position = 'relative';
|
|
1966
|
-
// Opera returns the offset relative to the positioning context, when an
|
|
1967
|
-
// element is position relative but top and left have not been defined
|
|
1968
|
-
if (window.opera) {
|
|
1969
|
-
element.style.top = 0;
|
|
1970
|
-
element.style.left = 0;
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
return element;
|
|
1974
|
-
},
|
|
1975
|
-
|
|
1976
|
-
undoPositioned: function(element) {
|
|
1977
|
-
element = $(element);
|
|
1978
|
-
if (element._madePositioned) {
|
|
1979
|
-
element._madePositioned = undefined;
|
|
1980
|
-
element.style.position =
|
|
1981
|
-
element.style.top =
|
|
1982
|
-
element.style.left =
|
|
1983
|
-
element.style.bottom =
|
|
1984
|
-
element.style.right = '';
|
|
1985
|
-
}
|
|
1986
|
-
return element;
|
|
1987
|
-
},
|
|
1988
|
-
|
|
1989
|
-
makeClipping: function(element) {
|
|
1990
|
-
element = $(element);
|
|
1991
|
-
if (element._overflow) return element;
|
|
1992
|
-
element._overflow = Element.getStyle(element, 'overflow') || 'auto';
|
|
1993
|
-
if (element._overflow !== 'hidden')
|
|
1994
|
-
element.style.overflow = 'hidden';
|
|
1995
|
-
return element;
|
|
1996
|
-
},
|
|
1997
|
-
|
|
1998
|
-
undoClipping: function(element) {
|
|
1999
|
-
element = $(element);
|
|
2000
|
-
if (!element._overflow) return element;
|
|
2001
|
-
element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
|
|
2002
|
-
element._overflow = null;
|
|
2003
|
-
return element;
|
|
2004
|
-
},
|
|
2005
|
-
|
|
2006
|
-
cumulativeOffset: function(element) {
|
|
2007
|
-
var valueT = 0, valueL = 0;
|
|
2008
|
-
do {
|
|
2009
|
-
valueT += element.offsetTop || 0;
|
|
2010
|
-
valueL += element.offsetLeft || 0;
|
|
2011
|
-
element = element.offsetParent;
|
|
2012
|
-
} while (element);
|
|
2013
|
-
return Element._returnOffset(valueL, valueT);
|
|
2014
|
-
},
|
|
2015
|
-
|
|
2016
|
-
positionedOffset: function(element) {
|
|
2017
|
-
var valueT = 0, valueL = 0;
|
|
2018
|
-
do {
|
|
2019
|
-
valueT += element.offsetTop || 0;
|
|
2020
|
-
valueL += element.offsetLeft || 0;
|
|
2021
|
-
element = element.offsetParent;
|
|
2022
|
-
if (element) {
|
|
2023
|
-
if (element.tagName == 'BODY') break;
|
|
2024
|
-
var p = Element.getStyle(element, 'position');
|
|
2025
|
-
if (p !== 'static') break;
|
|
2026
|
-
}
|
|
2027
|
-
} while (element);
|
|
2028
|
-
return Element._returnOffset(valueL, valueT);
|
|
2029
|
-
},
|
|
2030
|
-
|
|
2031
|
-
absolutize: function(element) {
|
|
2032
|
-
element = $(element);
|
|
2033
|
-
if (element.getStyle('position') == 'absolute') return;
|
|
2034
|
-
// Position.prepare(); // To be done manually by Scripty when it needs it.
|
|
2035
|
-
|
|
2036
|
-
var offsets = element.positionedOffset();
|
|
2037
|
-
var top = offsets[1];
|
|
2038
|
-
var left = offsets[0];
|
|
2039
|
-
var width = element.clientWidth;
|
|
2040
|
-
var height = element.clientHeight;
|
|
2041
|
-
|
|
2042
|
-
element._originalLeft = left - parseFloat(element.style.left || 0);
|
|
2043
|
-
element._originalTop = top - parseFloat(element.style.top || 0);
|
|
2044
|
-
element._originalWidth = element.style.width;
|
|
2045
|
-
element._originalHeight = element.style.height;
|
|
2046
|
-
|
|
2047
|
-
element.style.position = 'absolute';
|
|
2048
|
-
element.style.top = top + 'px';
|
|
2049
|
-
element.style.left = left + 'px';
|
|
2050
|
-
element.style.width = width + 'px';
|
|
2051
|
-
element.style.height = height + 'px';
|
|
2052
|
-
return element;
|
|
2053
|
-
},
|
|
2054
|
-
|
|
2055
|
-
relativize: function(element) {
|
|
2056
|
-
element = $(element);
|
|
2057
|
-
if (element.getStyle('position') == 'relative') return;
|
|
2058
|
-
// Position.prepare(); // To be done manually by Scripty when it needs it.
|
|
2059
|
-
|
|
2060
|
-
element.style.position = 'relative';
|
|
2061
|
-
var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
|
|
2062
|
-
var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
|
|
2063
|
-
|
|
2064
|
-
element.style.top = top + 'px';
|
|
2065
|
-
element.style.left = left + 'px';
|
|
2066
|
-
element.style.height = element._originalHeight;
|
|
2067
|
-
element.style.width = element._originalWidth;
|
|
2068
|
-
return element;
|
|
2069
|
-
},
|
|
2070
|
-
|
|
2071
|
-
cumulativeScrollOffset: function(element) {
|
|
2072
|
-
var valueT = 0, valueL = 0;
|
|
2073
|
-
do {
|
|
2074
|
-
valueT += element.scrollTop || 0;
|
|
2075
|
-
valueL += element.scrollLeft || 0;
|
|
2076
|
-
element = element.parentNode;
|
|
2077
|
-
} while (element);
|
|
2078
|
-
return Element._returnOffset(valueL, valueT);
|
|
2079
|
-
},
|
|
2080
|
-
|
|
2081
|
-
getOffsetParent: function(element) {
|
|
2082
|
-
if (element.offsetParent) return $(element.offsetParent);
|
|
2083
|
-
if (element == document.body) return $(element);
|
|
2084
|
-
|
|
2085
|
-
while ((element = element.parentNode) && element != document.body)
|
|
2086
|
-
if (Element.getStyle(element, 'position') != 'static')
|
|
2087
|
-
return $(element);
|
|
2088
|
-
|
|
2089
|
-
return $(document.body);
|
|
2090
|
-
},
|
|
2091
|
-
|
|
2092
|
-
viewportOffset: function(forElement) {
|
|
2093
|
-
var valueT = 0, valueL = 0;
|
|
2094
|
-
|
|
2095
|
-
var element = forElement;
|
|
2096
|
-
do {
|
|
2097
|
-
valueT += element.offsetTop || 0;
|
|
2098
|
-
valueL += element.offsetLeft || 0;
|
|
2099
|
-
|
|
2100
|
-
// Safari fix
|
|
2101
|
-
if (element.offsetParent == document.body &&
|
|
2102
|
-
Element.getStyle(element, 'position') == 'absolute') break;
|
|
2103
|
-
|
|
2104
|
-
} while (element = element.offsetParent);
|
|
2105
|
-
|
|
2106
|
-
element = forElement;
|
|
2107
|
-
do {
|
|
2108
|
-
if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
|
|
2109
|
-
valueT -= element.scrollTop || 0;
|
|
2110
|
-
valueL -= element.scrollLeft || 0;
|
|
2111
|
-
}
|
|
2112
|
-
} while (element = element.parentNode);
|
|
2113
|
-
|
|
2114
|
-
return Element._returnOffset(valueL, valueT);
|
|
2115
|
-
},
|
|
2116
|
-
|
|
2117
|
-
clonePosition: function(element, source) {
|
|
2118
|
-
var options = Object.extend({
|
|
2119
|
-
setLeft: true,
|
|
2120
|
-
setTop: true,
|
|
2121
|
-
setWidth: true,
|
|
2122
|
-
setHeight: true,
|
|
2123
|
-
offsetTop: 0,
|
|
2124
|
-
offsetLeft: 0
|
|
2125
|
-
}, arguments[2] || { });
|
|
2126
|
-
|
|
2127
|
-
// find page position of source
|
|
2128
|
-
source = $(source);
|
|
2129
|
-
var p = source.viewportOffset();
|
|
2130
|
-
|
|
2131
|
-
// find coordinate system to use
|
|
2132
|
-
element = $(element);
|
|
2133
|
-
var delta = [0, 0];
|
|
2134
|
-
var parent = null;
|
|
2135
|
-
// delta [0,0] will do fine with position: fixed elements,
|
|
2136
|
-
// position:absolute needs offsetParent deltas
|
|
2137
|
-
if (Element.getStyle(element, 'position') == 'absolute') {
|
|
2138
|
-
parent = element.getOffsetParent();
|
|
2139
|
-
delta = parent.viewportOffset();
|
|
2140
|
-
}
|
|
2141
|
-
|
|
2142
|
-
// correct by body offsets (fixes Safari)
|
|
2143
|
-
if (parent == document.body) {
|
|
2144
|
-
delta[0] -= document.body.offsetLeft;
|
|
2145
|
-
delta[1] -= document.body.offsetTop;
|
|
2146
|
-
}
|
|
2147
|
-
|
|
2148
|
-
// set position
|
|
2149
|
-
if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
|
|
2150
|
-
if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
|
|
2151
|
-
if (options.setWidth) element.style.width = source.offsetWidth + 'px';
|
|
2152
|
-
if (options.setHeight) element.style.height = source.offsetHeight + 'px';
|
|
2153
|
-
return element;
|
|
2154
|
-
}
|
|
2155
|
-
};
|
|
2156
|
-
|
|
2157
|
-
Element.Methods.identify.counter = 1;
|
|
2158
|
-
|
|
2159
|
-
Object.extend(Element.Methods, {
|
|
2160
|
-
getElementsBySelector: Element.Methods.select,
|
|
2161
|
-
childElements: Element.Methods.immediateDescendants
|
|
2162
|
-
});
|
|
2163
|
-
|
|
2164
|
-
Element._attributeTranslations = {
|
|
2165
|
-
write: {
|
|
2166
|
-
names: {
|
|
2167
|
-
className: 'class',
|
|
2168
|
-
htmlFor: 'for'
|
|
2169
|
-
},
|
|
2170
|
-
values: { }
|
|
2171
|
-
}
|
|
2172
|
-
};
|
|
2173
|
-
|
|
2174
|
-
if (Prototype.Browser.Opera) {
|
|
2175
|
-
Element.Methods.getStyle = Element.Methods.getStyle.wrap(
|
|
2176
|
-
function(proceed, element, style) {
|
|
2177
|
-
switch (style) {
|
|
2178
|
-
case 'left': case 'top': case 'right': case 'bottom':
|
|
2179
|
-
if (proceed(element, 'position') === 'static') return null;
|
|
2180
|
-
case 'height': case 'width':
|
|
2181
|
-
// returns '0px' for hidden elements; we want it to return null
|
|
2182
|
-
if (!Element.visible(element)) return null;
|
|
2183
|
-
|
|
2184
|
-
// returns the border-box dimensions rather than the content-box
|
|
2185
|
-
// dimensions, so we subtract padding and borders from the value
|
|
2186
|
-
var dim = parseInt(proceed(element, style), 10);
|
|
2187
|
-
|
|
2188
|
-
if (dim !== element['offset' + style.capitalize()])
|
|
2189
|
-
return dim + 'px';
|
|
2190
|
-
|
|
2191
|
-
var properties;
|
|
2192
|
-
if (style === 'height') {
|
|
2193
|
-
properties = ['border-top-width', 'padding-top',
|
|
2194
|
-
'padding-bottom', 'border-bottom-width'];
|
|
2195
|
-
}
|
|
2196
|
-
else {
|
|
2197
|
-
properties = ['border-left-width', 'padding-left',
|
|
2198
|
-
'padding-right', 'border-right-width'];
|
|
2199
|
-
}
|
|
2200
|
-
return properties.inject(dim, function(memo, property) {
|
|
2201
|
-
var val = proceed(element, property);
|
|
2202
|
-
return val === null ? memo : memo - parseInt(val, 10);
|
|
2203
|
-
}) + 'px';
|
|
2204
|
-
default: return proceed(element, style);
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2207
|
-
);
|
|
2208
|
-
|
|
2209
|
-
Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
|
|
2210
|
-
function(proceed, element, attribute) {
|
|
2211
|
-
if (attribute === 'title') return element.title;
|
|
2212
|
-
return proceed(element, attribute);
|
|
2213
|
-
}
|
|
2214
|
-
);
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
else if (Prototype.Browser.IE) {
|
|
2218
|
-
// IE doesn't report offsets correctly for static elements, so we change them
|
|
2219
|
-
// to "relative" to get the values, then change them back.
|
|
2220
|
-
Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
|
|
2221
|
-
function(proceed, element) {
|
|
2222
|
-
element = $(element);
|
|
2223
|
-
var position = element.getStyle('position');
|
|
2224
|
-
if (position !== 'static') return proceed(element);
|
|
2225
|
-
element.setStyle({ position: 'relative' });
|
|
2226
|
-
var value = proceed(element);
|
|
2227
|
-
element.setStyle({ position: position });
|
|
2228
|
-
return value;
|
|
2229
|
-
}
|
|
2230
|
-
);
|
|
2231
|
-
|
|
2232
|
-
$w('positionedOffset viewportOffset').each(function(method) {
|
|
2233
|
-
Element.Methods[method] = Element.Methods[method].wrap(
|
|
2234
|
-
function(proceed, element) {
|
|
2235
|
-
element = $(element);
|
|
2236
|
-
var position = element.getStyle('position');
|
|
2237
|
-
if (position !== 'static') return proceed(element);
|
|
2238
|
-
// Trigger hasLayout on the offset parent so that IE6 reports
|
|
2239
|
-
// accurate offsetTop and offsetLeft values for position: fixed.
|
|
2240
|
-
var offsetParent = element.getOffsetParent();
|
|
2241
|
-
if (offsetParent && offsetParent.getStyle('position') === 'fixed')
|
|
2242
|
-
offsetParent.setStyle({ zoom: 1 });
|
|
2243
|
-
element.setStyle({ position: 'relative' });
|
|
2244
|
-
var value = proceed(element);
|
|
2245
|
-
element.setStyle({ position: position });
|
|
2246
|
-
return value;
|
|
2247
|
-
}
|
|
2248
|
-
);
|
|
2249
|
-
});
|
|
2250
|
-
|
|
2251
|
-
Element.Methods.getStyle = function(element, style) {
|
|
2252
|
-
element = $(element);
|
|
2253
|
-
style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
|
|
2254
|
-
var value = element.style[style];
|
|
2255
|
-
if (!value && element.currentStyle) value = element.currentStyle[style];
|
|
2256
|
-
|
|
2257
|
-
if (style == 'opacity') {
|
|
2258
|
-
if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
|
|
2259
|
-
if (value[1]) return parseFloat(value[1]) / 100;
|
|
2260
|
-
return 1.0;
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
if (value == 'auto') {
|
|
2264
|
-
if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
|
|
2265
|
-
return element['offset' + style.capitalize()] + 'px';
|
|
2266
|
-
return null;
|
|
2267
|
-
}
|
|
2268
|
-
return value;
|
|
2269
|
-
};
|
|
2270
|
-
|
|
2271
|
-
Element.Methods.setOpacity = function(element, value) {
|
|
2272
|
-
function stripAlpha(filter){
|
|
2273
|
-
return filter.replace(/alpha\([^\)]*\)/gi,'');
|
|
2274
|
-
}
|
|
2275
|
-
element = $(element);
|
|
2276
|
-
var currentStyle = element.currentStyle;
|
|
2277
|
-
if ((currentStyle && !currentStyle.hasLayout) ||
|
|
2278
|
-
(!currentStyle && element.style.zoom == 'normal'))
|
|
2279
|
-
element.style.zoom = 1;
|
|
2280
|
-
|
|
2281
|
-
var filter = element.getStyle('filter'), style = element.style;
|
|
2282
|
-
if (value == 1 || value === '') {
|
|
2283
|
-
(filter = stripAlpha(filter)) ?
|
|
2284
|
-
style.filter = filter : style.removeAttribute('filter');
|
|
2285
|
-
return element;
|
|
2286
|
-
} else if (value < 0.00001) value = 0;
|
|
2287
|
-
style.filter = stripAlpha(filter) +
|
|
2288
|
-
'alpha(opacity=' + (value * 100) + ')';
|
|
2289
|
-
return element;
|
|
2290
|
-
};
|
|
2291
|
-
|
|
2292
|
-
Element._attributeTranslations = {
|
|
2293
|
-
read: {
|
|
2294
|
-
names: {
|
|
2295
|
-
'class': 'className',
|
|
2296
|
-
'for': 'htmlFor'
|
|
2297
|
-
},
|
|
2298
|
-
values: {
|
|
2299
|
-
_getAttr: function(element, attribute) {
|
|
2300
|
-
return element.getAttribute(attribute, 2);
|
|
2301
|
-
},
|
|
2302
|
-
_getAttrNode: function(element, attribute) {
|
|
2303
|
-
var node = element.getAttributeNode(attribute);
|
|
2304
|
-
return node ? node.value : "";
|
|
2305
|
-
},
|
|
2306
|
-
_getEv: function(element, attribute) {
|
|
2307
|
-
attribute = element.getAttribute(attribute);
|
|
2308
|
-
return attribute ? attribute.toString().slice(23, -2) : null;
|
|
2309
|
-
},
|
|
2310
|
-
_flag: function(element, attribute) {
|
|
2311
|
-
return $(element).hasAttribute(attribute) ? attribute : null;
|
|
2312
|
-
},
|
|
2313
|
-
style: function(element) {
|
|
2314
|
-
return element.style.cssText.toLowerCase();
|
|
2315
|
-
},
|
|
2316
|
-
title: function(element) {
|
|
2317
|
-
return element.title;
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2321
|
-
};
|
|
2322
|
-
|
|
2323
|
-
Element._attributeTranslations.write = {
|
|
2324
|
-
names: Object.extend({
|
|
2325
|
-
cellpadding: 'cellPadding',
|
|
2326
|
-
cellspacing: 'cellSpacing'
|
|
2327
|
-
}, 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 ('outerHTML' in document.createElement('div')) {
|
|
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
|
-
if (t) {
|
|
2486
|
-
div.innerHTML = t[0] + html + t[1];
|
|
2487
|
-
t[2].times(function() { div = div.firstChild; });
|
|
2488
|
-
} else div.innerHTML = html;
|
|
2489
|
-
return $A(div.childNodes);
|
|
2490
|
-
};
|
|
2491
|
-
|
|
2492
|
-
Element._insertionTranslations = {
|
|
2493
|
-
before: function(element, node) {
|
|
2494
|
-
element.parentNode.insertBefore(node, element);
|
|
2495
|
-
},
|
|
2496
|
-
top: function(element, node) {
|
|
2497
|
-
element.insertBefore(node, element.firstChild);
|
|
2498
|
-
},
|
|
2499
|
-
bottom: function(element, node) {
|
|
2500
|
-
element.appendChild(node);
|
|
2501
|
-
},
|
|
2502
|
-
after: function(element, node) {
|
|
2503
|
-
element.parentNode.insertBefore(node, element.nextSibling);
|
|
2504
|
-
},
|
|
2505
|
-
tags: {
|
|
2506
|
-
TABLE: ['<table>', '</table>', 1],
|
|
2507
|
-
TBODY: ['<table><tbody>', '</tbody></table>', 2],
|
|
2508
|
-
TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
|
|
2509
|
-
TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
|
|
2510
|
-
SELECT: ['<select>', '</select>', 1]
|
|
2511
|
-
}
|
|
2512
|
-
};
|
|
2513
|
-
|
|
2514
|
-
(function() {
|
|
2515
|
-
Object.extend(this.tags, {
|
|
2516
|
-
THEAD: this.tags.TBODY,
|
|
2517
|
-
TFOOT: this.tags.TBODY,
|
|
2518
|
-
TH: this.tags.TD
|
|
2519
|
-
});
|
|
2520
|
-
}).call(Element._insertionTranslations);
|
|
2521
|
-
|
|
2522
|
-
Element.Methods.Simulated = {
|
|
2523
|
-
hasAttribute: function(element, attribute) {
|
|
2524
|
-
attribute = Element._attributeTranslations.has[attribute] || attribute;
|
|
2525
|
-
var node = $(element).getAttributeNode(attribute);
|
|
2526
|
-
return node && node.specified;
|
|
2527
|
-
}
|
|
2528
|
-
};
|
|
2529
|
-
|
|
2530
|
-
Element.Methods.ByTag = { };
|
|
2531
|
-
|
|
2532
|
-
Object.extend(Element, Element.Methods);
|
|
2533
|
-
|
|
2534
|
-
if (!Prototype.BrowserFeatures.ElementExtensions &&
|
|
2535
|
-
document.createElement('div').__proto__) {
|
|
2536
|
-
window.HTMLElement = { };
|
|
2537
|
-
window.HTMLElement.prototype = document.createElement('div').__proto__;
|
|
2538
|
-
Prototype.BrowserFeatures.ElementExtensions = true;
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
|
-
Element.extend = (function() {
|
|
2542
|
-
if (Prototype.BrowserFeatures.SpecificElementExtensions)
|
|
2543
|
-
return Prototype.K;
|
|
2544
|
-
|
|
2545
|
-
var Methods = { }, ByTag = Element.Methods.ByTag;
|
|
2546
|
-
|
|
2547
|
-
var extend = Object.extend(function(element) {
|
|
2548
|
-
if (!element || element._extendedByPrototype ||
|
|
2549
|
-
element.nodeType != 1 || element == window) return element;
|
|
2550
|
-
|
|
2551
|
-
var methods = Object.clone(Methods),
|
|
2552
|
-
tagName = element.tagName, property, value;
|
|
2553
|
-
|
|
2554
|
-
// extend methods for specific tags
|
|
2555
|
-
if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
|
|
2556
|
-
|
|
2557
|
-
for (property in methods) {
|
|
2558
|
-
value = methods[property];
|
|
2559
|
-
if (Object.isFunction(value) && !(property in element))
|
|
2560
|
-
element[property] = value.methodize();
|
|
2561
|
-
}
|
|
2562
|
-
|
|
2563
|
-
element._extendedByPrototype = Prototype.emptyFunction;
|
|
2564
|
-
return element;
|
|
2565
|
-
|
|
2566
|
-
}, {
|
|
2567
|
-
refresh: function() {
|
|
2568
|
-
// extend methods for all tags (Safari doesn't need this)
|
|
2569
|
-
if (!Prototype.BrowserFeatures.ElementExtensions) {
|
|
2570
|
-
Object.extend(Methods, Element.Methods);
|
|
2571
|
-
Object.extend(Methods, Element.Methods.Simulated);
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
});
|
|
2575
|
-
|
|
2576
|
-
extend.refresh();
|
|
2577
|
-
return extend;
|
|
2578
|
-
})();
|
|
2579
|
-
|
|
2580
|
-
Element.hasAttribute = function(element, attribute) {
|
|
2581
|
-
if (element.hasAttribute) return element.hasAttribute(attribute);
|
|
2582
|
-
return Element.Methods.Simulated.hasAttribute(element, attribute);
|
|
2583
|
-
};
|
|
2584
|
-
|
|
2585
|
-
Element.addMethods = function(methods) {
|
|
2586
|
-
var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
|
|
2587
|
-
|
|
2588
|
-
if (!methods) {
|
|
2589
|
-
Object.extend(Form, Form.Methods);
|
|
2590
|
-
Object.extend(Form.Element, Form.Element.Methods);
|
|
2591
|
-
Object.extend(Element.Methods.ByTag, {
|
|
2592
|
-
"FORM": Object.clone(Form.Methods),
|
|
2593
|
-
"INPUT": Object.clone(Form.Element.Methods),
|
|
2594
|
-
"SELECT": Object.clone(Form.Element.Methods),
|
|
2595
|
-
"TEXTAREA": Object.clone(Form.Element.Methods)
|
|
2596
|
-
});
|
|
2597
|
-
}
|
|
2598
|
-
|
|
2599
|
-
if (arguments.length == 2) {
|
|
2600
|
-
var tagName = methods;
|
|
2601
|
-
methods = arguments[1];
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
|
-
if (!tagName) Object.extend(Element.Methods, methods || { });
|
|
2605
|
-
else {
|
|
2606
|
-
if (Object.isArray(tagName)) tagName.each(extend);
|
|
2607
|
-
else extend(tagName);
|
|
2608
|
-
}
|
|
2609
|
-
|
|
2610
|
-
function extend(tagName) {
|
|
2611
|
-
tagName = tagName.toUpperCase();
|
|
2612
|
-
if (!Element.Methods.ByTag[tagName])
|
|
2613
|
-
Element.Methods.ByTag[tagName] = { };
|
|
2614
|
-
Object.extend(Element.Methods.ByTag[tagName], methods);
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
|
-
function copy(methods, destination, onlyIfAbsent) {
|
|
2618
|
-
onlyIfAbsent = onlyIfAbsent || false;
|
|
2619
|
-
for (var property in methods) {
|
|
2620
|
-
var value = methods[property];
|
|
2621
|
-
if (!Object.isFunction(value)) continue;
|
|
2622
|
-
if (!onlyIfAbsent || !(property in destination))
|
|
2623
|
-
destination[property] = value.methodize();
|
|
2624
|
-
}
|
|
2625
|
-
}
|
|
2626
|
-
|
|
2627
|
-
function findDOMClass(tagName) {
|
|
2628
|
-
var klass;
|
|
2629
|
-
var trans = {
|
|
2630
|
-
"OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
|
|
2631
|
-
"FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
|
|
2632
|
-
"DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
|
|
2633
|
-
"H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
|
|
2634
|
-
"INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
|
|
2635
|
-
"TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
|
|
2636
|
-
"TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
|
|
2637
|
-
"TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
|
|
2638
|
-
"FrameSet", "IFRAME": "IFrame"
|
|
2639
|
-
};
|
|
2640
|
-
if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
|
|
2641
|
-
if (window[klass]) return window[klass];
|
|
2642
|
-
klass = 'HTML' + tagName + 'Element';
|
|
2643
|
-
if (window[klass]) return window[klass];
|
|
2644
|
-
klass = 'HTML' + tagName.capitalize() + 'Element';
|
|
2645
|
-
if (window[klass]) return window[klass];
|
|
2646
|
-
|
|
2647
|
-
window[klass] = { };
|
|
2648
|
-
window[klass].prototype = document.createElement(tagName).__proto__;
|
|
2649
|
-
return window[klass];
|
|
2650
|
-
}
|
|
2651
|
-
|
|
2652
|
-
if (F.ElementExtensions) {
|
|
2653
|
-
copy(Element.Methods, HTMLElement.prototype);
|
|
2654
|
-
copy(Element.Methods.Simulated, HTMLElement.prototype, true);
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
|
-
if (F.SpecificElementExtensions) {
|
|
2658
|
-
for (var tag in Element.Methods.ByTag) {
|
|
2659
|
-
var klass = findDOMClass(tag);
|
|
2660
|
-
if (Object.isUndefined(klass)) continue;
|
|
2661
|
-
copy(T[tag], klass.prototype);
|
|
2662
|
-
}
|
|
2663
|
-
}
|
|
2664
|
-
|
|
2665
|
-
Object.extend(Element, Element.Methods);
|
|
2666
|
-
delete Element.ByTag;
|
|
2667
|
-
|
|
2668
|
-
if (Element.extend.refresh) Element.extend.refresh();
|
|
2669
|
-
Element.cache = { };
|
|
2670
|
-
};
|
|
2671
|
-
|
|
2672
|
-
document.viewport = {
|
|
2673
|
-
getDimensions: function() {
|
|
2674
|
-
var dimensions = { };
|
|
2675
|
-
var B = Prototype.Browser;
|
|
2676
|
-
$w('width height').each(function(d) {
|
|
2677
|
-
var D = d.capitalize();
|
|
2678
|
-
dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] :
|
|
2679
|
-
(B.Opera) ? document.body['client' + D] : document.documentElement['client' + D];
|
|
2680
|
-
});
|
|
2681
|
-
return dimensions;
|
|
2682
|
-
},
|
|
2683
|
-
|
|
2684
|
-
getWidth: function() {
|
|
2685
|
-
return this.getDimensions().width;
|
|
2686
|
-
},
|
|
2687
|
-
|
|
2688
|
-
getHeight: function() {
|
|
2689
|
-
return this.getDimensions().height;
|
|
2690
|
-
},
|
|
2691
|
-
|
|
2692
|
-
getScrollOffsets: function() {
|
|
2693
|
-
return Element._returnOffset(
|
|
2694
|
-
window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
|
|
2695
|
-
window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
|
|
2696
|
-
}
|
|
2697
|
-
};
|
|
2698
|
-
/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
|
|
2699
|
-
* part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
|
|
2700
|
-
* license. Please see http://www.yui-ext.com/ for more information. */
|
|
2701
|
-
|
|
2702
|
-
var Selector = Class.create({
|
|
2703
|
-
initialize: function(expression) {
|
|
2704
|
-
this.expression = expression.strip();
|
|
2705
|
-
this.compileMatcher();
|
|
2706
|
-
},
|
|
2707
|
-
|
|
2708
|
-
shouldUseXPath: function() {
|
|
2709
|
-
if (!Prototype.BrowserFeatures.XPath) return false;
|
|
2710
|
-
|
|
2711
|
-
var e = this.expression;
|
|
2712
|
-
|
|
2713
|
-
// Safari 3 chokes on :*-of-type and :empty
|
|
2714
|
-
if (Prototype.Browser.WebKit &&
|
|
2715
|
-
(e.include("-of-type") || e.include(":empty")))
|
|
2716
|
-
return false;
|
|
2717
|
-
|
|
2718
|
-
// XPath can't do namespaced attributes, nor can it read
|
|
2719
|
-
// the "checked" property from DOM nodes
|
|
2720
|
-
if ((/(\[[\w-]*?:|:checked)/).test(this.expression))
|
|
2721
|
-
return false;
|
|
2722
|
-
|
|
2723
|
-
return true;
|
|
2724
|
-
},
|
|
2725
|
-
|
|
2726
|
-
compileMatcher: function() {
|
|
2727
|
-
if (this.shouldUseXPath())
|
|
2728
|
-
return this.compileXPathMatcher();
|
|
2729
|
-
|
|
2730
|
-
var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
|
|
2731
|
-
c = Selector.criteria, le, p, m;
|
|
2732
|
-
|
|
2733
|
-
if (Selector._cache[e]) {
|
|
2734
|
-
this.matcher = Selector._cache[e];
|
|
2735
|
-
return;
|
|
2736
|
-
}
|
|
2737
|
-
|
|
2738
|
-
this.matcher = ["this.matcher = function(root) {",
|
|
2739
|
-
"var r = root, h = Selector.handlers, c = false, n;"];
|
|
2740
|
-
|
|
2741
|
-
while (e && le != e && (/\S/).test(e)) {
|
|
2742
|
-
le = e;
|
|
2743
|
-
for (var i in ps) {
|
|
2744
|
-
p = ps[i];
|
|
2745
|
-
if (m = e.match(p)) {
|
|
2746
|
-
this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
|
|
2747
|
-
new Template(c[i]).evaluate(m));
|
|
2748
|
-
e = e.replace(m[0], '');
|
|
2749
|
-
break;
|
|
2750
|
-
}
|
|
2751
|
-
}
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2754
|
-
this.matcher.push("return h.unique(n);\n}");
|
|
2755
|
-
eval(this.matcher.join('\n'));
|
|
2756
|
-
Selector._cache[this.expression] = this.matcher;
|
|
2757
|
-
},
|
|
2758
|
-
|
|
2759
|
-
compileXPathMatcher: function() {
|
|
2760
|
-
var e = this.expression, ps = Selector.patterns,
|
|
2761
|
-
x = Selector.xpath, le, m;
|
|
2762
|
-
|
|
2763
|
-
if (Selector._cache[e]) {
|
|
2764
|
-
this.xpath = Selector._cache[e]; return;
|
|
2765
|
-
}
|
|
2766
|
-
|
|
2767
|
-
this.matcher = ['.//*'];
|
|
2768
|
-
while (e && le != e && (/\S/).test(e)) {
|
|
2769
|
-
le = e;
|
|
2770
|
-
for (var i in ps) {
|
|
2771
|
-
if (m = e.match(ps[i])) {
|
|
2772
|
-
this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
|
|
2773
|
-
new Template(x[i]).evaluate(m));
|
|
2774
|
-
e = e.replace(m[0], '');
|
|
2775
|
-
break;
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
}
|
|
2779
|
-
|
|
2780
|
-
this.xpath = this.matcher.join('');
|
|
2781
|
-
Selector._cache[this.expression] = this.xpath;
|
|
2782
|
-
},
|
|
2783
|
-
|
|
2784
|
-
findElements: function(root) {
|
|
2785
|
-
root = root || document;
|
|
2786
|
-
if (this.xpath) return document._getElementsByXPath(this.xpath, root);
|
|
2787
|
-
return this.matcher(root);
|
|
2788
|
-
},
|
|
2789
|
-
|
|
2790
|
-
match: function(element) {
|
|
2791
|
-
this.tokens = [];
|
|
2792
|
-
|
|
2793
|
-
var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
|
|
2794
|
-
var le, p, m;
|
|
2795
|
-
|
|
2796
|
-
while (e && le !== e && (/\S/).test(e)) {
|
|
2797
|
-
le = e;
|
|
2798
|
-
for (var i in ps) {
|
|
2799
|
-
p = ps[i];
|
|
2800
|
-
if (m = e.match(p)) {
|
|
2801
|
-
// use the Selector.assertions methods unless the selector
|
|
2802
|
-
// is too complex.
|
|
2803
|
-
if (as[i]) {
|
|
2804
|
-
this.tokens.push([i, Object.clone(m)]);
|
|
2805
|
-
e = e.replace(m[0], '');
|
|
2806
|
-
} else {
|
|
2807
|
-
// reluctantly do a document-wide search
|
|
2808
|
-
// and look for a match in the array
|
|
2809
|
-
return this.findElements(document).include(element);
|
|
2810
|
-
}
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
}
|
|
2814
|
-
|
|
2815
|
-
var match = true, name, matches;
|
|
2816
|
-
for (var i = 0, token; token = this.tokens[i]; i++) {
|
|
2817
|
-
name = token[0]; matches = token[1];
|
|
2818
|
-
if (!Selector.assertions[name](element, matches)) {
|
|
2819
|
-
match = false; break;
|
|
2820
|
-
}
|
|
2821
|
-
}
|
|
2822
|
-
|
|
2823
|
-
return match;
|
|
2824
|
-
},
|
|
2825
|
-
|
|
2826
|
-
toString: function() {
|
|
2827
|
-
return this.expression;
|
|
2828
|
-
},
|
|
2829
|
-
|
|
2830
|
-
inspect: function() {
|
|
2831
|
-
return "#<Selector:" + this.expression.inspect() + ">";
|
|
2832
|
-
}
|
|
2833
|
-
});
|
|
2834
|
-
|
|
2835
|
-
Object.extend(Selector, {
|
|
2836
|
-
_cache: { },
|
|
2837
|
-
|
|
2838
|
-
xpath: {
|
|
2839
|
-
descendant: "//*",
|
|
2840
|
-
child: "/*",
|
|
2841
|
-
adjacent: "/following-sibling::*[1]",
|
|
2842
|
-
laterSibling: '/following-sibling::*',
|
|
2843
|
-
tagName: function(m) {
|
|
2844
|
-
if (m[1] == '*') return '';
|
|
2845
|
-
return "[local-name()='" + m[1].toLowerCase() +
|
|
2846
|
-
"' or local-name()='" + m[1].toUpperCase() + "']";
|
|
2847
|
-
},
|
|
2848
|
-
className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
|
|
2849
|
-
id: "[@id='#{1}']",
|
|
2850
|
-
attrPresence: function(m) {
|
|
2851
|
-
m[1] = m[1].toLowerCase();
|
|
2852
|
-
return new Template("[@#{1}]").evaluate(m);
|
|
2853
|
-
},
|
|
2854
|
-
attr: function(m) {
|
|
2855
|
-
m[1] = m[1].toLowerCase();
|
|
2856
|
-
m[3] = m[5] || m[6];
|
|
2857
|
-
return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
|
|
2858
|
-
},
|
|
2859
|
-
pseudo: function(m) {
|
|
2860
|
-
var h = Selector.xpath.pseudos[m[1]];
|
|
2861
|
-
if (!h) return '';
|
|
2862
|
-
if (Object.isFunction(h)) return h(m);
|
|
2863
|
-
return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
|
|
2864
|
-
},
|
|
2865
|
-
operators: {
|
|
2866
|
-
'=': "[@#{1}='#{3}']",
|
|
2867
|
-
'!=': "[@#{1}!='#{3}']",
|
|
2868
|
-
'^=': "[starts-with(@#{1}, '#{3}')]",
|
|
2869
|
-
'$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
|
|
2870
|
-
'*=': "[contains(@#{1}, '#{3}')]",
|
|
2871
|
-
'~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
|
|
2872
|
-
'|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
|
|
2873
|
-
},
|
|
2874
|
-
pseudos: {
|
|
2875
|
-
'first-child': '[not(preceding-sibling::*)]',
|
|
2876
|
-
'last-child': '[not(following-sibling::*)]',
|
|
2877
|
-
'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
|
|
2878
|
-
'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
|
|
2879
|
-
'checked': "[@checked]",
|
|
2880
|
-
'disabled': "[@disabled]",
|
|
2881
|
-
'enabled': "[not(@disabled)]",
|
|
2882
|
-
'not': function(m) {
|
|
2883
|
-
var e = m[6], p = Selector.patterns,
|
|
2884
|
-
x = Selector.xpath, le, v;
|
|
2885
|
-
|
|
2886
|
-
var exclusion = [];
|
|
2887
|
-
while (e && le != e && (/\S/).test(e)) {
|
|
2888
|
-
le = e;
|
|
2889
|
-
for (var i in p) {
|
|
2890
|
-
if (m = e.match(p[i])) {
|
|
2891
|
-
v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
|
|
2892
|
-
exclusion.push("(" + v.substring(1, v.length - 1) + ")");
|
|
2893
|
-
e = e.replace(m[0], '');
|
|
2894
|
-
break;
|
|
2895
|
-
}
|
|
2896
|
-
}
|
|
2897
|
-
}
|
|
2898
|
-
return "[not(" + exclusion.join(" and ") + ")]";
|
|
2899
|
-
},
|
|
2900
|
-
'nth-child': function(m) {
|
|
2901
|
-
return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
|
|
2902
|
-
},
|
|
2903
|
-
'nth-last-child': function(m) {
|
|
2904
|
-
return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
|
|
2905
|
-
},
|
|
2906
|
-
'nth-of-type': function(m) {
|
|
2907
|
-
return Selector.xpath.pseudos.nth("position() ", m);
|
|
2908
|
-
},
|
|
2909
|
-
'nth-last-of-type': function(m) {
|
|
2910
|
-
return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
|
|
2911
|
-
},
|
|
2912
|
-
'first-of-type': function(m) {
|
|
2913
|
-
m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
|
|
2914
|
-
},
|
|
2915
|
-
'last-of-type': function(m) {
|
|
2916
|
-
m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
|
|
2917
|
-
},
|
|
2918
|
-
'only-of-type': function(m) {
|
|
2919
|
-
var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
|
|
2920
|
-
},
|
|
2921
|
-
nth: function(fragment, m) {
|
|
2922
|
-
var mm, formula = m[6], predicate;
|
|
2923
|
-
if (formula == 'even') formula = '2n+0';
|
|
2924
|
-
if (formula == 'odd') formula = '2n+1';
|
|
2925
|
-
if (mm = formula.match(/^(\d+)$/)) // digit only
|
|
2926
|
-
return '[' + fragment + "= " + mm[1] + ']';
|
|
2927
|
-
if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
|
|
2928
|
-
if (mm[1] == "-") mm[1] = -1;
|
|
2929
|
-
var a = mm[1] ? Number(mm[1]) : 1;
|
|
2930
|
-
var b = mm[2] ? Number(mm[2]) : 0;
|
|
2931
|
-
predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
|
|
2932
|
-
"((#{fragment} - #{b}) div #{a} >= 0)]";
|
|
2933
|
-
return new Template(predicate).evaluate({
|
|
2934
|
-
fragment: fragment, a: a, b: b });
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
}
|
|
2938
|
-
},
|
|
2939
|
-
|
|
2940
|
-
criteria: {
|
|
2941
|
-
tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
|
|
2942
|
-
className: 'n = h.className(n, r, "#{1}", c); c = false;',
|
|
2943
|
-
id: 'n = h.id(n, r, "#{1}", c); c = false;',
|
|
2944
|
-
attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
|
|
2945
|
-
attr: function(m) {
|
|
2946
|
-
m[3] = (m[5] || m[6]);
|
|
2947
|
-
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
|
|
2948
|
-
},
|
|
2949
|
-
pseudo: function(m) {
|
|
2950
|
-
if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
|
|
2951
|
-
return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
|
|
2952
|
-
},
|
|
2953
|
-
descendant: 'c = "descendant";',
|
|
2954
|
-
child: 'c = "child";',
|
|
2955
|
-
adjacent: 'c = "adjacent";',
|
|
2956
|
-
laterSibling: 'c = "laterSibling";'
|
|
2957
|
-
},
|
|
2958
|
-
|
|
2959
|
-
patterns: {
|
|
2960
|
-
// combinators must be listed first
|
|
2961
|
-
// (and descendant needs to be last combinator)
|
|
2962
|
-
laterSibling: /^\s*~\s*/,
|
|
2963
|
-
child: /^\s*>\s*/,
|
|
2964
|
-
adjacent: /^\s*\+\s*/,
|
|
2965
|
-
descendant: /^\s/,
|
|
2966
|
-
|
|
2967
|
-
// selectors follow
|
|
2968
|
-
tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
|
|
2969
|
-
id: /^#([\w\-\*]+)(\b|$)/,
|
|
2970
|
-
className: /^\.([\w\-\*]+)(\b|$)/,
|
|
2971
|
-
pseudo:
|
|
2972
|
-
/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
|
|
2973
|
-
attrPresence: /^\[([\w]+)\]/,
|
|
2974
|
-
attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
|
|
2975
|
-
},
|
|
2976
|
-
|
|
2977
|
-
// for Selector.match and Element#match
|
|
2978
|
-
assertions: {
|
|
2979
|
-
tagName: function(element, matches) {
|
|
2980
|
-
return matches[1].toUpperCase() == element.tagName.toUpperCase();
|
|
2981
|
-
},
|
|
2982
|
-
|
|
2983
|
-
className: function(element, matches) {
|
|
2984
|
-
return Element.hasClassName(element, matches[1]);
|
|
2985
|
-
},
|
|
2986
|
-
|
|
2987
|
-
id: function(element, matches) {
|
|
2988
|
-
return element.id === matches[1];
|
|
2989
|
-
},
|
|
2990
|
-
|
|
2991
|
-
attrPresence: function(element, matches) {
|
|
2992
|
-
return Element.hasAttribute(element, matches[1]);
|
|
2993
|
-
},
|
|
2994
|
-
|
|
2995
|
-
attr: function(element, matches) {
|
|
2996
|
-
var nodeValue = Element.readAttribute(element, matches[1]);
|
|
2997
|
-
return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
|
|
2998
|
-
}
|
|
2999
|
-
},
|
|
3000
|
-
|
|
3001
|
-
handlers: {
|
|
3002
|
-
// UTILITY FUNCTIONS
|
|
3003
|
-
// joins two collections
|
|
3004
|
-
concat: function(a, b) {
|
|
3005
|
-
for (var i = 0, node; node = b[i]; i++)
|
|
3006
|
-
a.push(node);
|
|
3007
|
-
return a;
|
|
3008
|
-
},
|
|
3009
|
-
|
|
3010
|
-
// marks an array of nodes for counting
|
|
3011
|
-
mark: function(nodes) {
|
|
3012
|
-
var _true = Prototype.emptyFunction;
|
|
3013
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3014
|
-
node._countedByPrototype = _true;
|
|
3015
|
-
return nodes;
|
|
3016
|
-
},
|
|
3017
|
-
|
|
3018
|
-
unmark: function(nodes) {
|
|
3019
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3020
|
-
node._countedByPrototype = undefined;
|
|
3021
|
-
return nodes;
|
|
3022
|
-
},
|
|
3023
|
-
|
|
3024
|
-
// mark each child node with its position (for nth calls)
|
|
3025
|
-
// "ofType" flag indicates whether we're indexing for nth-of-type
|
|
3026
|
-
// rather than nth-child
|
|
3027
|
-
index: function(parentNode, reverse, ofType) {
|
|
3028
|
-
parentNode._countedByPrototype = Prototype.emptyFunction;
|
|
3029
|
-
if (reverse) {
|
|
3030
|
-
for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
|
|
3031
|
-
var node = nodes[i];
|
|
3032
|
-
if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
|
|
3033
|
-
}
|
|
3034
|
-
} else {
|
|
3035
|
-
for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
|
|
3036
|
-
if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
|
|
3037
|
-
}
|
|
3038
|
-
},
|
|
3039
|
-
|
|
3040
|
-
// filters out duplicates and extends all nodes
|
|
3041
|
-
unique: function(nodes) {
|
|
3042
|
-
if (nodes.length == 0) return nodes;
|
|
3043
|
-
var results = [], n;
|
|
3044
|
-
for (var i = 0, l = nodes.length; i < l; i++)
|
|
3045
|
-
if (!(n = nodes[i])._countedByPrototype) {
|
|
3046
|
-
n._countedByPrototype = Prototype.emptyFunction;
|
|
3047
|
-
results.push(Element.extend(n));
|
|
3048
|
-
}
|
|
3049
|
-
return Selector.handlers.unmark(results);
|
|
3050
|
-
},
|
|
3051
|
-
|
|
3052
|
-
// COMBINATOR FUNCTIONS
|
|
3053
|
-
descendant: function(nodes) {
|
|
3054
|
-
var h = Selector.handlers;
|
|
3055
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
|
3056
|
-
h.concat(results, node.getElementsByTagName('*'));
|
|
3057
|
-
return results;
|
|
3058
|
-
},
|
|
3059
|
-
|
|
3060
|
-
child: function(nodes) {
|
|
3061
|
-
var h = Selector.handlers;
|
|
3062
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
|
3063
|
-
for (var j = 0, child; child = node.childNodes[j]; j++)
|
|
3064
|
-
if (child.nodeType == 1 && child.tagName != '!') results.push(child);
|
|
3065
|
-
}
|
|
3066
|
-
return results;
|
|
3067
|
-
},
|
|
3068
|
-
|
|
3069
|
-
adjacent: function(nodes) {
|
|
3070
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
|
3071
|
-
var next = this.nextElementSibling(node);
|
|
3072
|
-
if (next) results.push(next);
|
|
3073
|
-
}
|
|
3074
|
-
return results;
|
|
3075
|
-
},
|
|
3076
|
-
|
|
3077
|
-
laterSibling: function(nodes) {
|
|
3078
|
-
var h = Selector.handlers;
|
|
3079
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
|
3080
|
-
h.concat(results, Element.nextSiblings(node));
|
|
3081
|
-
return results;
|
|
3082
|
-
},
|
|
3083
|
-
|
|
3084
|
-
nextElementSibling: function(node) {
|
|
3085
|
-
while (node = node.nextSibling)
|
|
3086
|
-
if (node.nodeType == 1) return node;
|
|
3087
|
-
return null;
|
|
3088
|
-
},
|
|
3089
|
-
|
|
3090
|
-
previousElementSibling: function(node) {
|
|
3091
|
-
while (node = node.previousSibling)
|
|
3092
|
-
if (node.nodeType == 1) return node;
|
|
3093
|
-
return null;
|
|
3094
|
-
},
|
|
3095
|
-
|
|
3096
|
-
// TOKEN FUNCTIONS
|
|
3097
|
-
tagName: function(nodes, root, tagName, combinator) {
|
|
3098
|
-
var uTagName = tagName.toUpperCase();
|
|
3099
|
-
var results = [], h = Selector.handlers;
|
|
3100
|
-
if (nodes) {
|
|
3101
|
-
if (combinator) {
|
|
3102
|
-
// fastlane for ordinary descendant combinators
|
|
3103
|
-
if (combinator == "descendant") {
|
|
3104
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3105
|
-
h.concat(results, node.getElementsByTagName(tagName));
|
|
3106
|
-
return results;
|
|
3107
|
-
} else nodes = this[combinator](nodes);
|
|
3108
|
-
if (tagName == "*") return nodes;
|
|
3109
|
-
}
|
|
3110
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3111
|
-
if (node.tagName.toUpperCase() === uTagName) results.push(node);
|
|
3112
|
-
return results;
|
|
3113
|
-
} else return root.getElementsByTagName(tagName);
|
|
3114
|
-
},
|
|
3115
|
-
|
|
3116
|
-
id: function(nodes, root, id, combinator) {
|
|
3117
|
-
var targetNode = $(id), h = Selector.handlers;
|
|
3118
|
-
if (!targetNode) return [];
|
|
3119
|
-
if (!nodes && root == document) return [targetNode];
|
|
3120
|
-
if (nodes) {
|
|
3121
|
-
if (combinator) {
|
|
3122
|
-
if (combinator == 'child') {
|
|
3123
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3124
|
-
if (targetNode.parentNode == node) return [targetNode];
|
|
3125
|
-
} else if (combinator == 'descendant') {
|
|
3126
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3127
|
-
if (Element.descendantOf(targetNode, node)) return [targetNode];
|
|
3128
|
-
} else if (combinator == 'adjacent') {
|
|
3129
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3130
|
-
if (Selector.handlers.previousElementSibling(targetNode) == node)
|
|
3131
|
-
return [targetNode];
|
|
3132
|
-
} else nodes = h[combinator](nodes);
|
|
3133
|
-
}
|
|
3134
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3135
|
-
if (node == targetNode) return [targetNode];
|
|
3136
|
-
return [];
|
|
3137
|
-
}
|
|
3138
|
-
return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
|
|
3139
|
-
},
|
|
3140
|
-
|
|
3141
|
-
className: function(nodes, root, className, combinator) {
|
|
3142
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
|
3143
|
-
return Selector.handlers.byClassName(nodes, root, className);
|
|
3144
|
-
},
|
|
3145
|
-
|
|
3146
|
-
byClassName: function(nodes, root, className) {
|
|
3147
|
-
if (!nodes) nodes = Selector.handlers.descendant([root]);
|
|
3148
|
-
var needle = ' ' + className + ' ';
|
|
3149
|
-
for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
|
|
3150
|
-
nodeClassName = node.className;
|
|
3151
|
-
if (nodeClassName.length == 0) continue;
|
|
3152
|
-
if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
|
|
3153
|
-
results.push(node);
|
|
3154
|
-
}
|
|
3155
|
-
return results;
|
|
3156
|
-
},
|
|
3157
|
-
|
|
3158
|
-
attrPresence: function(nodes, root, attr, combinator) {
|
|
3159
|
-
if (!nodes) nodes = root.getElementsByTagName("*");
|
|
3160
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
|
3161
|
-
var results = [];
|
|
3162
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3163
|
-
if (Element.hasAttribute(node, attr)) results.push(node);
|
|
3164
|
-
return results;
|
|
3165
|
-
},
|
|
3166
|
-
|
|
3167
|
-
attr: function(nodes, root, attr, value, operator, combinator) {
|
|
3168
|
-
if (!nodes) nodes = root.getElementsByTagName("*");
|
|
3169
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
|
3170
|
-
var handler = Selector.operators[operator], results = [];
|
|
3171
|
-
for (var i = 0, node; node = nodes[i]; i++) {
|
|
3172
|
-
var nodeValue = Element.readAttribute(node, attr);
|
|
3173
|
-
if (nodeValue === null) continue;
|
|
3174
|
-
if (handler(nodeValue, value)) results.push(node);
|
|
3175
|
-
}
|
|
3176
|
-
return results;
|
|
3177
|
-
},
|
|
3178
|
-
|
|
3179
|
-
pseudo: function(nodes, name, value, root, combinator) {
|
|
3180
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
|
3181
|
-
if (!nodes) nodes = root.getElementsByTagName("*");
|
|
3182
|
-
return Selector.pseudos[name](nodes, value, root);
|
|
3183
|
-
}
|
|
3184
|
-
},
|
|
3185
|
-
|
|
3186
|
-
pseudos: {
|
|
3187
|
-
'first-child': function(nodes, value, root) {
|
|
3188
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
|
3189
|
-
if (Selector.handlers.previousElementSibling(node)) continue;
|
|
3190
|
-
results.push(node);
|
|
3191
|
-
}
|
|
3192
|
-
return results;
|
|
3193
|
-
},
|
|
3194
|
-
'last-child': function(nodes, value, root) {
|
|
3195
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
|
3196
|
-
if (Selector.handlers.nextElementSibling(node)) continue;
|
|
3197
|
-
results.push(node);
|
|
3198
|
-
}
|
|
3199
|
-
return results;
|
|
3200
|
-
},
|
|
3201
|
-
'only-child': function(nodes, value, root) {
|
|
3202
|
-
var h = Selector.handlers;
|
|
3203
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
|
3204
|
-
if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
|
|
3205
|
-
results.push(node);
|
|
3206
|
-
return results;
|
|
3207
|
-
},
|
|
3208
|
-
'nth-child': function(nodes, formula, root) {
|
|
3209
|
-
return Selector.pseudos.nth(nodes, formula, root);
|
|
3210
|
-
},
|
|
3211
|
-
'nth-last-child': function(nodes, formula, root) {
|
|
3212
|
-
return Selector.pseudos.nth(nodes, formula, root, true);
|
|
3213
|
-
},
|
|
3214
|
-
'nth-of-type': function(nodes, formula, root) {
|
|
3215
|
-
return Selector.pseudos.nth(nodes, formula, root, false, true);
|
|
3216
|
-
},
|
|
3217
|
-
'nth-last-of-type': function(nodes, formula, root) {
|
|
3218
|
-
return Selector.pseudos.nth(nodes, formula, root, true, true);
|
|
3219
|
-
},
|
|
3220
|
-
'first-of-type': function(nodes, formula, root) {
|
|
3221
|
-
return Selector.pseudos.nth(nodes, "1", root, false, true);
|
|
3222
|
-
},
|
|
3223
|
-
'last-of-type': function(nodes, formula, root) {
|
|
3224
|
-
return Selector.pseudos.nth(nodes, "1", root, true, true);
|
|
3225
|
-
},
|
|
3226
|
-
'only-of-type': function(nodes, formula, root) {
|
|
3227
|
-
var p = Selector.pseudos;
|
|
3228
|
-
return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
|
|
3229
|
-
},
|
|
3230
|
-
|
|
3231
|
-
// handles the an+b logic
|
|
3232
|
-
getIndices: function(a, b, total) {
|
|
3233
|
-
if (a == 0) return b > 0 ? [b] : [];
|
|
3234
|
-
return $R(1, total).inject([], function(memo, i) {
|
|
3235
|
-
if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
|
|
3236
|
-
return memo;
|
|
3237
|
-
});
|
|
3238
|
-
},
|
|
3239
|
-
|
|
3240
|
-
// handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
|
|
3241
|
-
nth: function(nodes, formula, root, reverse, ofType) {
|
|
3242
|
-
if (nodes.length == 0) return [];
|
|
3243
|
-
if (formula == 'even') formula = '2n+0';
|
|
3244
|
-
if (formula == 'odd') formula = '2n+1';
|
|
3245
|
-
var h = Selector.handlers, results = [], indexed = [], m;
|
|
3246
|
-
h.mark(nodes);
|
|
3247
|
-
for (var i = 0, node; node = nodes[i]; i++) {
|
|
3248
|
-
if (!node.parentNode._countedByPrototype) {
|
|
3249
|
-
h.index(node.parentNode, reverse, ofType);
|
|
3250
|
-
indexed.push(node.parentNode);
|
|
3251
|
-
}
|
|
3252
|
-
}
|
|
3253
|
-
if (formula.match(/^\d+$/)) { // just a number
|
|
3254
|
-
formula = Number(formula);
|
|
3255
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3256
|
-
if (node.nodeIndex == formula) results.push(node);
|
|
3257
|
-
} else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
|
|
3258
|
-
if (m[1] == "-") m[1] = -1;
|
|
3259
|
-
var a = m[1] ? Number(m[1]) : 1;
|
|
3260
|
-
var b = m[2] ? Number(m[2]) : 0;
|
|
3261
|
-
var indices = Selector.pseudos.getIndices(a, b, nodes.length);
|
|
3262
|
-
for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
|
|
3263
|
-
for (var j = 0; j < l; j++)
|
|
3264
|
-
if (node.nodeIndex == indices[j]) results.push(node);
|
|
3265
|
-
}
|
|
3266
|
-
}
|
|
3267
|
-
h.unmark(nodes);
|
|
3268
|
-
h.unmark(indexed);
|
|
3269
|
-
return results;
|
|
3270
|
-
},
|
|
3271
|
-
|
|
3272
|
-
'empty': function(nodes, value, root) {
|
|
3273
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
|
3274
|
-
// IE treats comments as element nodes
|
|
3275
|
-
if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
|
|
3276
|
-
results.push(node);
|
|
3277
|
-
}
|
|
3278
|
-
return results;
|
|
3279
|
-
},
|
|
3280
|
-
|
|
3281
|
-
'not': function(nodes, selector, root) {
|
|
3282
|
-
var h = Selector.handlers, selectorType, m;
|
|
3283
|
-
var exclusions = new Selector(selector).findElements(root);
|
|
3284
|
-
h.mark(exclusions);
|
|
3285
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
|
3286
|
-
if (!node._countedByPrototype) results.push(node);
|
|
3287
|
-
h.unmark(exclusions);
|
|
3288
|
-
return results;
|
|
3289
|
-
},
|
|
3290
|
-
|
|
3291
|
-
'enabled': function(nodes, value, root) {
|
|
3292
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
|
3293
|
-
if (!node.disabled) results.push(node);
|
|
3294
|
-
return results;
|
|
3295
|
-
},
|
|
3296
|
-
|
|
3297
|
-
'disabled': function(nodes, value, root) {
|
|
3298
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
|
3299
|
-
if (node.disabled) results.push(node);
|
|
3300
|
-
return results;
|
|
3301
|
-
},
|
|
3302
|
-
|
|
3303
|
-
'checked': function(nodes, value, root) {
|
|
3304
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
|
3305
|
-
if (node.checked) results.push(node);
|
|
3306
|
-
return results;
|
|
3307
|
-
}
|
|
3308
|
-
},
|
|
3309
|
-
|
|
3310
|
-
operators: {
|
|
3311
|
-
'=': function(nv, v) { return nv == v; },
|
|
3312
|
-
'!=': function(nv, v) { return nv != v; },
|
|
3313
|
-
'^=': function(nv, v) { return nv.startsWith(v); },
|
|
3314
|
-
'$=': function(nv, v) { return nv.endsWith(v); },
|
|
3315
|
-
'*=': function(nv, v) { return nv.include(v); },
|
|
3316
|
-
'~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
|
|
3317
|
-
'|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
|
|
3318
|
-
},
|
|
3319
|
-
|
|
3320
|
-
split: function(expression) {
|
|
3321
|
-
var expressions = [];
|
|
3322
|
-
expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
|
|
3323
|
-
expressions.push(m[1].strip());
|
|
3324
|
-
});
|
|
3325
|
-
return expressions;
|
|
3326
|
-
},
|
|
3327
|
-
|
|
3328
|
-
matchElements: function(elements, expression) {
|
|
3329
|
-
var matches = $$(expression), h = Selector.handlers;
|
|
3330
|
-
h.mark(matches);
|
|
3331
|
-
for (var i = 0, results = [], element; element = elements[i]; i++)
|
|
3332
|
-
if (element._countedByPrototype) results.push(element);
|
|
3333
|
-
h.unmark(matches);
|
|
3334
|
-
return results;
|
|
3335
|
-
},
|
|
3336
|
-
|
|
3337
|
-
findElement: function(elements, expression, index) {
|
|
3338
|
-
if (Object.isNumber(expression)) {
|
|
3339
|
-
index = expression; expression = false;
|
|
3340
|
-
}
|
|
3341
|
-
return Selector.matchElements(elements, expression || '*')[index || 0];
|
|
3342
|
-
},
|
|
3343
|
-
|
|
3344
|
-
findChildElements: function(element, expressions) {
|
|
3345
|
-
expressions = Selector.split(expressions.join(','));
|
|
3346
|
-
var results = [], h = Selector.handlers;
|
|
3347
|
-
for (var i = 0, l = expressions.length, selector; i < l; i++) {
|
|
3348
|
-
selector = new Selector(expressions[i].strip());
|
|
3349
|
-
h.concat(results, selector.findElements(element));
|
|
3350
|
-
}
|
|
3351
|
-
return (l > 1) ? h.unique(results) : results;
|
|
3352
|
-
}
|
|
3353
|
-
});
|
|
3354
|
-
|
|
3355
|
-
if (Prototype.Browser.IE) {
|
|
3356
|
-
Object.extend(Selector.handlers, {
|
|
3357
|
-
// IE returns comment nodes on getElementsByTagName("*").
|
|
3358
|
-
// Filter them out.
|
|
3359
|
-
concat: function(a, b) {
|
|
3360
|
-
for (var i = 0, node; node = b[i]; i++)
|
|
3361
|
-
if (node.tagName !== "!") a.push(node);
|
|
3362
|
-
return a;
|
|
3363
|
-
},
|
|
3364
|
-
|
|
3365
|
-
// IE improperly serializes _countedByPrototype in (inner|outer)HTML.
|
|
3366
|
-
unmark: function(nodes) {
|
|
3367
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
|
3368
|
-
node.removeAttribute('_countedByPrototype');
|
|
3369
|
-
return nodes;
|
|
3370
|
-
}
|
|
3371
|
-
});
|
|
3372
|
-
}
|
|
3373
|
-
|
|
3374
|
-
function $$() {
|
|
3375
|
-
return Selector.findChildElements(document, $A(arguments));
|
|
3376
|
-
}
|
|
3377
|
-
var Form = {
|
|
3378
|
-
reset: function(form) {
|
|
3379
|
-
$(form).reset();
|
|
3380
|
-
return form;
|
|
3381
|
-
},
|
|
3382
|
-
|
|
3383
|
-
serializeElements: function(elements, options) {
|
|
3384
|
-
if (typeof options != 'object') options = { hash: !!options };
|
|
3385
|
-
else if (Object.isUndefined(options.hash)) options.hash = true;
|
|
3386
|
-
var key, value, submitted = false, submit = options.submit;
|
|
3387
|
-
|
|
3388
|
-
var data = elements.inject({ }, function(result, element) {
|
|
3389
|
-
if (!element.disabled && element.name) {
|
|
3390
|
-
key = element.name; value = $(element).getValue();
|
|
3391
|
-
if (value != null && (element.type != 'submit' || (!submitted &&
|
|
3392
|
-
submit !== false && (!submit || key == submit) && (submitted = true)))) {
|
|
3393
|
-
if (key in result) {
|
|
3394
|
-
// a key is already present; construct an array of values
|
|
3395
|
-
if (!Object.isArray(result[key])) result[key] = [result[key]];
|
|
3396
|
-
result[key].push(value);
|
|
3397
|
-
}
|
|
3398
|
-
else result[key] = value;
|
|
3399
|
-
}
|
|
3400
|
-
}
|
|
3401
|
-
return result;
|
|
3402
|
-
});
|
|
3403
|
-
|
|
3404
|
-
return options.hash ? data : Object.toQueryString(data);
|
|
3405
|
-
}
|
|
3406
|
-
};
|
|
3407
|
-
|
|
3408
|
-
Form.Methods = {
|
|
3409
|
-
serialize: function(form, options) {
|
|
3410
|
-
return Form.serializeElements(Form.getElements(form), options);
|
|
3411
|
-
},
|
|
3412
|
-
|
|
3413
|
-
getElements: function(form) {
|
|
3414
|
-
return $A($(form).getElementsByTagName('*')).inject([],
|
|
3415
|
-
function(elements, child) {
|
|
3416
|
-
if (Form.Element.Serializers[child.tagName.toLowerCase()])
|
|
3417
|
-
elements.push(Element.extend(child));
|
|
3418
|
-
return elements;
|
|
3419
|
-
}
|
|
3420
|
-
);
|
|
3421
|
-
},
|
|
3422
|
-
|
|
3423
|
-
getInputs: function(form, typeName, name) {
|
|
3424
|
-
form = $(form);
|
|
3425
|
-
var inputs = form.getElementsByTagName('input');
|
|
3426
|
-
|
|
3427
|
-
if (!typeName && !name) return $A(inputs).map(Element.extend);
|
|
3428
|
-
|
|
3429
|
-
for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
|
|
3430
|
-
var input = inputs[i];
|
|
3431
|
-
if ((typeName && input.type != typeName) || (name && input.name != name))
|
|
3432
|
-
continue;
|
|
3433
|
-
matchingInputs.push(Element.extend(input));
|
|
3434
|
-
}
|
|
3435
|
-
|
|
3436
|
-
return matchingInputs;
|
|
3437
|
-
},
|
|
3438
|
-
|
|
3439
|
-
disable: function(form) {
|
|
3440
|
-
form = $(form);
|
|
3441
|
-
Form.getElements(form).invoke('disable');
|
|
3442
|
-
return form;
|
|
3443
|
-
},
|
|
3444
|
-
|
|
3445
|
-
enable: function(form) {
|
|
3446
|
-
form = $(form);
|
|
3447
|
-
Form.getElements(form).invoke('enable');
|
|
3448
|
-
return form;
|
|
3449
|
-
},
|
|
3450
|
-
|
|
3451
|
-
findFirstElement: function(form) {
|
|
3452
|
-
var elements = $(form).getElements().findAll(function(element) {
|
|
3453
|
-
return 'hidden' != element.type && !element.disabled;
|
|
3454
|
-
});
|
|
3455
|
-
var firstByIndex = elements.findAll(function(element) {
|
|
3456
|
-
return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
|
|
3457
|
-
}).sortBy(function(element) { return element.tabIndex; }).first();
|
|
3458
|
-
|
|
3459
|
-
return firstByIndex ? firstByIndex : elements.find(function(element) {
|
|
3460
|
-
return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
|
|
3461
|
-
});
|
|
3462
|
-
},
|
|
3463
|
-
|
|
3464
|
-
focusFirstElement: function(form) {
|
|
3465
|
-
form = $(form);
|
|
3466
|
-
form.findFirstElement().activate();
|
|
3467
|
-
return form;
|
|
3468
|
-
},
|
|
3469
|
-
|
|
3470
|
-
request: function(form, options) {
|
|
3471
|
-
form = $(form); options = Object.clone(options || { });
|
|
3472
|
-
|
|
3473
|
-
var params = options.parameters, action = form.readAttribute('action') || '';
|
|
3474
|
-
if (action.blank()) action = window.location.href;
|
|
3475
|
-
options.parameters = form.serialize(true);
|
|
3476
|
-
|
|
3477
|
-
if (params) {
|
|
3478
|
-
if (Object.isString(params)) params = params.toQueryParams();
|
|
3479
|
-
Object.extend(options.parameters, params);
|
|
3480
|
-
}
|
|
3481
|
-
|
|
3482
|
-
if (form.hasAttribute('method') && !options.method)
|
|
3483
|
-
options.method = form.method;
|
|
3484
|
-
|
|
3485
|
-
return new Ajax.Request(action, options);
|
|
3486
|
-
}
|
|
3487
|
-
};
|
|
3488
|
-
|
|
3489
|
-
/*--------------------------------------------------------------------------*/
|
|
3490
|
-
|
|
3491
|
-
Form.Element = {
|
|
3492
|
-
focus: function(element) {
|
|
3493
|
-
$(element).focus();
|
|
3494
|
-
return element;
|
|
3495
|
-
},
|
|
3496
|
-
|
|
3497
|
-
select: function(element) {
|
|
3498
|
-
$(element).select();
|
|
3499
|
-
return element;
|
|
3500
|
-
}
|
|
3501
|
-
};
|
|
3502
|
-
|
|
3503
|
-
Form.Element.Methods = {
|
|
3504
|
-
serialize: function(element) {
|
|
3505
|
-
element = $(element);
|
|
3506
|
-
if (!element.disabled && element.name) {
|
|
3507
|
-
var value = element.getValue();
|
|
3508
|
-
if (value != undefined) {
|
|
3509
|
-
var pair = { };
|
|
3510
|
-
pair[element.name] = value;
|
|
3511
|
-
return Object.toQueryString(pair);
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
return '';
|
|
3515
|
-
},
|
|
3516
|
-
|
|
3517
|
-
getValue: function(element) {
|
|
3518
|
-
element = $(element);
|
|
3519
|
-
var method = element.tagName.toLowerCase();
|
|
3520
|
-
return Form.Element.Serializers[method](element);
|
|
3521
|
-
},
|
|
3522
|
-
|
|
3523
|
-
setValue: function(element, value) {
|
|
3524
|
-
element = $(element);
|
|
3525
|
-
var method = element.tagName.toLowerCase();
|
|
3526
|
-
Form.Element.Serializers[method](element, value);
|
|
3527
|
-
return element;
|
|
3528
|
-
},
|
|
3529
|
-
|
|
3530
|
-
clear: function(element) {
|
|
3531
|
-
$(element).value = '';
|
|
3532
|
-
return element;
|
|
3533
|
-
},
|
|
3534
|
-
|
|
3535
|
-
present: function(element) {
|
|
3536
|
-
return $(element).value != '';
|
|
3537
|
-
},
|
|
3538
|
-
|
|
3539
|
-
activate: function(element) {
|
|
3540
|
-
element = $(element);
|
|
3541
|
-
try {
|
|
3542
|
-
element.focus();
|
|
3543
|
-
if (element.select && (element.tagName.toLowerCase() != 'input' ||
|
|
3544
|
-
!['button', 'reset', 'submit'].include(element.type)))
|
|
3545
|
-
element.select();
|
|
3546
|
-
} catch (e) { }
|
|
3547
|
-
return element;
|
|
3548
|
-
},
|
|
3549
|
-
|
|
3550
|
-
disable: function(element) {
|
|
3551
|
-
element = $(element);
|
|
3552
|
-
element.blur();
|
|
3553
|
-
element.disabled = true;
|
|
3554
|
-
return element;
|
|
3555
|
-
},
|
|
3556
|
-
|
|
3557
|
-
enable: function(element) {
|
|
3558
|
-
element = $(element);
|
|
3559
|
-
element.disabled = false;
|
|
3560
|
-
return element;
|
|
3561
|
-
}
|
|
3562
|
-
};
|
|
3563
|
-
|
|
3564
|
-
/*--------------------------------------------------------------------------*/
|
|
3565
|
-
|
|
3566
|
-
var Field = Form.Element;
|
|
3567
|
-
var $F = Form.Element.Methods.getValue;
|
|
3568
|
-
|
|
3569
|
-
/*--------------------------------------------------------------------------*/
|
|
3570
|
-
|
|
3571
|
-
Form.Element.Serializers = {
|
|
3572
|
-
input: function(element, value) {
|
|
3573
|
-
switch (element.type.toLowerCase()) {
|
|
3574
|
-
case 'checkbox':
|
|
3575
|
-
case 'radio':
|
|
3576
|
-
return Form.Element.Serializers.inputSelector(element, value);
|
|
3577
|
-
default:
|
|
3578
|
-
return Form.Element.Serializers.textarea(element, value);
|
|
3579
|
-
}
|
|
3580
|
-
},
|
|
3581
|
-
|
|
3582
|
-
inputSelector: function(element, value) {
|
|
3583
|
-
if (Object.isUndefined(value)) return element.checked ? element.value : null;
|
|
3584
|
-
else element.checked = !!value;
|
|
3585
|
-
},
|
|
3586
|
-
|
|
3587
|
-
textarea: function(element, value) {
|
|
3588
|
-
if (Object.isUndefined(value)) return element.value;
|
|
3589
|
-
else element.value = value;
|
|
3590
|
-
},
|
|
3591
|
-
|
|
3592
|
-
select: function(element, index) {
|
|
3593
|
-
if (Object.isUndefined(index))
|
|
3594
|
-
return this[element.type == 'select-one' ?
|
|
3595
|
-
'selectOne' : 'selectMany'](element);
|
|
3596
|
-
else {
|
|
3597
|
-
var opt, value, single = !Object.isArray(index);
|
|
3598
|
-
for (var i = 0, length = element.length; i < length; i++) {
|
|
3599
|
-
opt = element.options[i];
|
|
3600
|
-
value = this.optionValue(opt);
|
|
3601
|
-
if (single) {
|
|
3602
|
-
if (value == index) {
|
|
3603
|
-
opt.selected = true;
|
|
3604
|
-
return;
|
|
3605
|
-
}
|
|
3606
|
-
}
|
|
3607
|
-
else opt.selected = index.include(value);
|
|
3608
|
-
}
|
|
3609
|
-
}
|
|
3610
|
-
},
|
|
3611
|
-
|
|
3612
|
-
selectOne: function(element) {
|
|
3613
|
-
var index = element.selectedIndex;
|
|
3614
|
-
return index >= 0 ? this.optionValue(element.options[index]) : null;
|
|
3615
|
-
},
|
|
3616
|
-
|
|
3617
|
-
selectMany: function(element) {
|
|
3618
|
-
var values, length = element.length;
|
|
3619
|
-
if (!length) return null;
|
|
3620
|
-
|
|
3621
|
-
for (var i = 0, values = []; i < length; i++) {
|
|
3622
|
-
var opt = element.options[i];
|
|
3623
|
-
if (opt.selected) values.push(this.optionValue(opt));
|
|
3624
|
-
}
|
|
3625
|
-
return values;
|
|
3626
|
-
},
|
|
3627
|
-
|
|
3628
|
-
optionValue: function(opt) {
|
|
3629
|
-
// extend element because hasAttribute may not be native
|
|
3630
|
-
return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
|
|
3631
|
-
}
|
|
3632
|
-
};
|
|
3633
|
-
|
|
3634
|
-
/*--------------------------------------------------------------------------*/
|
|
3635
|
-
|
|
3636
|
-
Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
|
|
3637
|
-
initialize: function($super, element, frequency, callback) {
|
|
3638
|
-
$super(callback, frequency);
|
|
3639
|
-
this.element = $(element);
|
|
3640
|
-
this.lastValue = this.getValue();
|
|
3641
|
-
},
|
|
3642
|
-
|
|
3643
|
-
execute: function() {
|
|
3644
|
-
var value = this.getValue();
|
|
3645
|
-
if (Object.isString(this.lastValue) && Object.isString(value) ?
|
|
3646
|
-
this.lastValue != value : String(this.lastValue) != String(value)) {
|
|
3647
|
-
this.callback(this.element, value);
|
|
3648
|
-
this.lastValue = value;
|
|
3649
|
-
}
|
|
3650
|
-
}
|
|
3651
|
-
});
|
|
3652
|
-
|
|
3653
|
-
Form.Element.Observer = Class.create(Abstract.TimedObserver, {
|
|
3654
|
-
getValue: function() {
|
|
3655
|
-
return Form.Element.getValue(this.element);
|
|
3656
|
-
}
|
|
3657
|
-
});
|
|
3658
|
-
|
|
3659
|
-
Form.Observer = Class.create(Abstract.TimedObserver, {
|
|
3660
|
-
getValue: function() {
|
|
3661
|
-
return Form.serialize(this.element);
|
|
3662
|
-
}
|
|
3663
|
-
});
|
|
3664
|
-
|
|
3665
|
-
/*--------------------------------------------------------------------------*/
|
|
3666
|
-
|
|
3667
|
-
Abstract.EventObserver = Class.create({
|
|
3668
|
-
initialize: function(element, callback) {
|
|
3669
|
-
this.element = $(element);
|
|
3670
|
-
this.callback = callback;
|
|
3671
|
-
|
|
3672
|
-
this.lastValue = this.getValue();
|
|
3673
|
-
if (this.element.tagName.toLowerCase() == 'form')
|
|
3674
|
-
this.registerFormCallbacks();
|
|
3675
|
-
else
|
|
3676
|
-
this.registerCallback(this.element);
|
|
3677
|
-
},
|
|
3678
|
-
|
|
3679
|
-
onElementEvent: function() {
|
|
3680
|
-
var value = this.getValue();
|
|
3681
|
-
if (this.lastValue != value) {
|
|
3682
|
-
this.callback(this.element, value);
|
|
3683
|
-
this.lastValue = value;
|
|
3684
|
-
}
|
|
3685
|
-
},
|
|
3686
|
-
|
|
3687
|
-
registerFormCallbacks: function() {
|
|
3688
|
-
Form.getElements(this.element).each(this.registerCallback, this);
|
|
3689
|
-
},
|
|
3690
|
-
|
|
3691
|
-
registerCallback: function(element) {
|
|
3692
|
-
if (element.type) {
|
|
3693
|
-
switch (element.type.toLowerCase()) {
|
|
3694
|
-
case 'checkbox':
|
|
3695
|
-
case 'radio':
|
|
3696
|
-
Event.observe(element, 'click', this.onElementEvent.bind(this));
|
|
3697
|
-
break;
|
|
3698
|
-
default:
|
|
3699
|
-
Event.observe(element, 'change', this.onElementEvent.bind(this));
|
|
3700
|
-
break;
|
|
3701
|
-
}
|
|
3702
|
-
}
|
|
3703
|
-
}
|
|
3704
|
-
});
|
|
3705
|
-
|
|
3706
|
-
Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
|
|
3707
|
-
getValue: function() {
|
|
3708
|
-
return Form.Element.getValue(this.element);
|
|
3709
|
-
}
|
|
3710
|
-
});
|
|
3711
|
-
|
|
3712
|
-
Form.EventObserver = Class.create(Abstract.EventObserver, {
|
|
3713
|
-
getValue: function() {
|
|
3714
|
-
return Form.serialize(this.element);
|
|
3715
|
-
}
|
|
3716
|
-
});
|
|
3717
|
-
if (!window.Event) var Event = { };
|
|
3718
|
-
|
|
3719
|
-
Object.extend(Event, {
|
|
3720
|
-
KEY_BACKSPACE: 8,
|
|
3721
|
-
KEY_TAB: 9,
|
|
3722
|
-
KEY_RETURN: 13,
|
|
3723
|
-
KEY_ESC: 27,
|
|
3724
|
-
KEY_LEFT: 37,
|
|
3725
|
-
KEY_UP: 38,
|
|
3726
|
-
KEY_RIGHT: 39,
|
|
3727
|
-
KEY_DOWN: 40,
|
|
3728
|
-
KEY_DELETE: 46,
|
|
3729
|
-
KEY_HOME: 36,
|
|
3730
|
-
KEY_END: 35,
|
|
3731
|
-
KEY_PAGEUP: 33,
|
|
3732
|
-
KEY_PAGEDOWN: 34,
|
|
3733
|
-
KEY_INSERT: 45,
|
|
3734
|
-
|
|
3735
|
-
cache: { },
|
|
3736
|
-
|
|
3737
|
-
relatedTarget: function(event) {
|
|
3738
|
-
var element;
|
|
3739
|
-
switch(event.type) {
|
|
3740
|
-
case 'mouseover': element = event.fromElement; break;
|
|
3741
|
-
case 'mouseout': element = event.toElement; break;
|
|
3742
|
-
default: return null;
|
|
3743
|
-
}
|
|
3744
|
-
return Element.extend(element);
|
|
3745
|
-
}
|
|
3746
|
-
});
|
|
3747
|
-
|
|
3748
|
-
Event.Methods = (function() {
|
|
3749
|
-
var isButton;
|
|
3750
|
-
|
|
3751
|
-
if (Prototype.Browser.IE) {
|
|
3752
|
-
var buttonMap = { 0: 1, 1: 4, 2: 2 };
|
|
3753
|
-
isButton = function(event, code) {
|
|
3754
|
-
return event.button == buttonMap[code];
|
|
3755
|
-
};
|
|
3756
|
-
|
|
3757
|
-
} else if (Prototype.Browser.WebKit) {
|
|
3758
|
-
isButton = function(event, code) {
|
|
3759
|
-
switch (code) {
|
|
3760
|
-
case 0: return event.which == 1 && !event.metaKey;
|
|
3761
|
-
case 1: return event.which == 1 && event.metaKey;
|
|
3762
|
-
default: return false;
|
|
3763
|
-
}
|
|
3764
|
-
};
|
|
3765
|
-
|
|
3766
|
-
} else {
|
|
3767
|
-
isButton = function(event, code) {
|
|
3768
|
-
return event.which ? (event.which === code + 1) : (event.button === code);
|
|
3769
|
-
};
|
|
3770
|
-
}
|
|
3771
|
-
|
|
3772
|
-
return {
|
|
3773
|
-
isLeftClick: function(event) { return isButton(event, 0); },
|
|
3774
|
-
isMiddleClick: function(event) { return isButton(event, 1); },
|
|
3775
|
-
isRightClick: function(event) { return isButton(event, 2); },
|
|
3776
|
-
|
|
3777
|
-
element: function(event) {
|
|
3778
|
-
var node = Event.extend(event).target;
|
|
3779
|
-
return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
|
|
3780
|
-
},
|
|
3781
|
-
|
|
3782
|
-
findElement: function(event, expression) {
|
|
3783
|
-
var element = Event.element(event);
|
|
3784
|
-
if (!expression) return element;
|
|
3785
|
-
var elements = [element].concat(element.ancestors());
|
|
3786
|
-
return Selector.findElement(elements, expression, 0);
|
|
3787
|
-
},
|
|
3788
|
-
|
|
3789
|
-
pointer: function(event) {
|
|
3790
|
-
return {
|
|
3791
|
-
x: event.pageX || (event.clientX +
|
|
3792
|
-
(document.documentElement.scrollLeft || document.body.scrollLeft)),
|
|
3793
|
-
y: event.pageY || (event.clientY +
|
|
3794
|
-
(document.documentElement.scrollTop || document.body.scrollTop))
|
|
3795
|
-
};
|
|
3796
|
-
},
|
|
3797
|
-
|
|
3798
|
-
pointerX: function(event) { return Event.pointer(event).x; },
|
|
3799
|
-
pointerY: function(event) { return Event.pointer(event).y; },
|
|
3800
|
-
|
|
3801
|
-
stop: function(event) {
|
|
3802
|
-
Event.extend(event);
|
|
3803
|
-
event.preventDefault();
|
|
3804
|
-
event.stopPropagation();
|
|
3805
|
-
event.stopped = true;
|
|
3806
|
-
}
|
|
3807
|
-
};
|
|
3808
|
-
})();
|
|
3809
|
-
|
|
3810
|
-
Event.extend = (function() {
|
|
3811
|
-
var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
|
|
3812
|
-
m[name] = Event.Methods[name].methodize();
|
|
3813
|
-
return m;
|
|
3814
|
-
});
|
|
3815
|
-
|
|
3816
|
-
if (Prototype.Browser.IE) {
|
|
3817
|
-
Object.extend(methods, {
|
|
3818
|
-
stopPropagation: function() { this.cancelBubble = true; },
|
|
3819
|
-
preventDefault: function() { this.returnValue = false; },
|
|
3820
|
-
inspect: function() { return "[object Event]"; }
|
|
3821
|
-
});
|
|
3822
|
-
|
|
3823
|
-
return function(event) {
|
|
3824
|
-
if (!event) return false;
|
|
3825
|
-
if (event._extendedByPrototype) return event;
|
|
3826
|
-
|
|
3827
|
-
event._extendedByPrototype = Prototype.emptyFunction;
|
|
3828
|
-
var pointer = Event.pointer(event);
|
|
3829
|
-
Object.extend(event, {
|
|
3830
|
-
target: event.srcElement,
|
|
3831
|
-
relatedTarget: Event.relatedTarget(event),
|
|
3832
|
-
pageX: pointer.x,
|
|
3833
|
-
pageY: pointer.y
|
|
3834
|
-
});
|
|
3835
|
-
return Object.extend(event, methods);
|
|
3836
|
-
};
|
|
3837
|
-
|
|
3838
|
-
} else {
|
|
3839
|
-
Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__;
|
|
3840
|
-
Object.extend(Event.prototype, methods);
|
|
3841
|
-
return Prototype.K;
|
|
3842
|
-
}
|
|
3843
|
-
})();
|
|
3844
|
-
|
|
3845
|
-
Object.extend(Event, (function() {
|
|
3846
|
-
var cache = Event.cache;
|
|
3847
|
-
|
|
3848
|
-
function getEventID(element) {
|
|
3849
|
-
if (element._prototypeEventID) return element._prototypeEventID[0];
|
|
3850
|
-
arguments.callee.id = arguments.callee.id || 1;
|
|
3851
|
-
return element._prototypeEventID = [++arguments.callee.id];
|
|
3852
|
-
}
|
|
3853
|
-
|
|
3854
|
-
function getDOMEventName(eventName) {
|
|
3855
|
-
if (eventName && eventName.include(':')) return "dataavailable";
|
|
3856
|
-
return eventName;
|
|
3857
|
-
}
|
|
3858
|
-
|
|
3859
|
-
function getCacheForID(id) {
|
|
3860
|
-
return cache[id] = cache[id] || { };
|
|
3861
|
-
}
|
|
3862
|
-
|
|
3863
|
-
function getWrappersForEventName(id, eventName) {
|
|
3864
|
-
var c = getCacheForID(id);
|
|
3865
|
-
return c[eventName] = c[eventName] || [];
|
|
3866
|
-
}
|
|
3867
|
-
|
|
3868
|
-
function createWrapper(element, eventName, handler) {
|
|
3869
|
-
var id = getEventID(element);
|
|
3870
|
-
var c = getWrappersForEventName(id, eventName);
|
|
3871
|
-
if (c.pluck("handler").include(handler)) return false;
|
|
3872
|
-
|
|
3873
|
-
var wrapper = function(event) {
|
|
3874
|
-
if (!Event || !Event.extend ||
|
|
3875
|
-
(event.eventName && event.eventName != eventName))
|
|
3876
|
-
return false;
|
|
3877
|
-
|
|
3878
|
-
Event.extend(event);
|
|
3879
|
-
handler.call(element, event);
|
|
3880
|
-
};
|
|
3881
|
-
|
|
3882
|
-
wrapper.handler = handler;
|
|
3883
|
-
c.push(wrapper);
|
|
3884
|
-
return wrapper;
|
|
3885
|
-
}
|
|
3886
|
-
|
|
3887
|
-
function findWrapper(id, eventName, handler) {
|
|
3888
|
-
var c = getWrappersForEventName(id, eventName);
|
|
3889
|
-
return c.find(function(wrapper) { return wrapper.handler == handler; });
|
|
3890
|
-
}
|
|
3891
|
-
|
|
3892
|
-
function destroyWrapper(id, eventName, handler) {
|
|
3893
|
-
var c = getCacheForID(id);
|
|
3894
|
-
if (!c[eventName]) return false;
|
|
3895
|
-
c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
|
|
3896
|
-
}
|
|
3897
|
-
|
|
3898
|
-
function destroyCache() {
|
|
3899
|
-
for (var id in cache)
|
|
3900
|
-
for (var eventName in cache[id])
|
|
3901
|
-
cache[id][eventName] = null;
|
|
3902
|
-
}
|
|
3903
|
-
|
|
3904
|
-
if (window.attachEvent) {
|
|
3905
|
-
window.attachEvent("onunload", destroyCache);
|
|
3906
|
-
}
|
|
3907
|
-
|
|
3908
|
-
return {
|
|
3909
|
-
observe: function(element, eventName, handler) {
|
|
3910
|
-
element = $(element);
|
|
3911
|
-
var name = getDOMEventName(eventName);
|
|
3912
|
-
|
|
3913
|
-
var wrapper = createWrapper(element, eventName, handler);
|
|
3914
|
-
if (!wrapper) return element;
|
|
3915
|
-
|
|
3916
|
-
if (element.addEventListener) {
|
|
3917
|
-
element.addEventListener(name, wrapper, false);
|
|
3918
|
-
} else {
|
|
3919
|
-
element.attachEvent("on" + name, wrapper);
|
|
3920
|
-
}
|
|
3921
|
-
|
|
3922
|
-
return element;
|
|
3923
|
-
},
|
|
3924
|
-
|
|
3925
|
-
stopObserving: function(element, eventName, handler) {
|
|
3926
|
-
element = $(element);
|
|
3927
|
-
var id = getEventID(element), name = getDOMEventName(eventName);
|
|
3928
|
-
|
|
3929
|
-
if (!handler && eventName) {
|
|
3930
|
-
getWrappersForEventName(id, eventName).each(function(wrapper) {
|
|
3931
|
-
element.stopObserving(eventName, wrapper.handler);
|
|
3932
|
-
});
|
|
3933
|
-
return element;
|
|
3934
|
-
|
|
3935
|
-
} else if (!eventName) {
|
|
3936
|
-
Object.keys(getCacheForID(id)).each(function(eventName) {
|
|
3937
|
-
element.stopObserving(eventName);
|
|
3938
|
-
});
|
|
3939
|
-
return element;
|
|
3940
|
-
}
|
|
3941
|
-
|
|
3942
|
-
var wrapper = findWrapper(id, eventName, handler);
|
|
3943
|
-
if (!wrapper) return element;
|
|
3944
|
-
|
|
3945
|
-
if (element.removeEventListener) {
|
|
3946
|
-
element.removeEventListener(name, wrapper, false);
|
|
3947
|
-
} else {
|
|
3948
|
-
element.detachEvent("on" + name, wrapper);
|
|
3949
|
-
}
|
|
3950
|
-
|
|
3951
|
-
destroyWrapper(id, eventName, handler);
|
|
3952
|
-
|
|
3953
|
-
return element;
|
|
3954
|
-
},
|
|
3955
|
-
|
|
3956
|
-
fire: function(element, eventName, memo) {
|
|
3957
|
-
element = $(element);
|
|
3958
|
-
if (element == document && document.createEvent && !element.dispatchEvent)
|
|
3959
|
-
element = document.documentElement;
|
|
3960
|
-
|
|
3961
|
-
var event;
|
|
3962
|
-
if (document.createEvent) {
|
|
3963
|
-
event = document.createEvent("HTMLEvents");
|
|
3964
|
-
event.initEvent("dataavailable", true, true);
|
|
3965
|
-
} else {
|
|
3966
|
-
event = document.createEventObject();
|
|
3967
|
-
event.eventType = "ondataavailable";
|
|
3968
|
-
}
|
|
3969
|
-
|
|
3970
|
-
event.eventName = eventName;
|
|
3971
|
-
event.memo = memo || { };
|
|
3972
|
-
|
|
3973
|
-
if (document.createEvent) {
|
|
3974
|
-
element.dispatchEvent(event);
|
|
3975
|
-
} else {
|
|
3976
|
-
element.fireEvent(event.eventType, event);
|
|
3977
|
-
}
|
|
3978
|
-
|
|
3979
|
-
return Event.extend(event);
|
|
3980
|
-
}
|
|
3981
|
-
};
|
|
3982
|
-
})());
|
|
3983
|
-
|
|
3984
|
-
Object.extend(Event, Event.Methods);
|
|
3985
|
-
|
|
3986
|
-
Element.addMethods({
|
|
3987
|
-
fire: Event.fire,
|
|
3988
|
-
observe: Event.observe,
|
|
3989
|
-
stopObserving: Event.stopObserving
|
|
3990
|
-
});
|
|
3991
|
-
|
|
3992
|
-
Object.extend(document, {
|
|
3993
|
-
fire: Element.Methods.fire.methodize(),
|
|
3994
|
-
observe: Element.Methods.observe.methodize(),
|
|
3995
|
-
stopObserving: Element.Methods.stopObserving.methodize(),
|
|
3996
|
-
loaded: false
|
|
3997
|
-
});
|
|
3998
|
-
|
|
3999
|
-
(function() {
|
|
4000
|
-
/* Support for the DOMContentLoaded event is based on work by Dan Webb,
|
|
4001
|
-
Matthias Miller, Dean Edwards and John Resig. */
|
|
4002
|
-
|
|
4003
|
-
var timer;
|
|
4004
|
-
|
|
4005
|
-
function fireContentLoadedEvent() {
|
|
4006
|
-
if (document.loaded) return;
|
|
4007
|
-
if (timer) window.clearInterval(timer);
|
|
4008
|
-
document.fire("dom:loaded");
|
|
4009
|
-
document.loaded = true;
|
|
4010
|
-
}
|
|
4011
|
-
|
|
4012
|
-
if (document.addEventListener) {
|
|
4013
|
-
if (Prototype.Browser.WebKit) {
|
|
4014
|
-
timer = window.setInterval(function() {
|
|
4015
|
-
if (/loaded|complete/.test(document.readyState))
|
|
4016
|
-
fireContentLoadedEvent();
|
|
4017
|
-
}, 0);
|
|
4018
|
-
|
|
4019
|
-
Event.observe(window, "load", fireContentLoadedEvent);
|
|
4020
|
-
|
|
4021
|
-
} else {
|
|
4022
|
-
document.addEventListener("DOMContentLoaded",
|
|
4023
|
-
fireContentLoadedEvent, false);
|
|
4024
|
-
}
|
|
4025
|
-
|
|
4026
|
-
} else {
|
|
4027
|
-
document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
|
|
4028
|
-
$("__onDOMContentLoaded").onreadystatechange = function() {
|
|
4029
|
-
if (this.readyState == "complete") {
|
|
4030
|
-
this.onreadystatechange = null;
|
|
4031
|
-
fireContentLoadedEvent();
|
|
4032
|
-
}
|
|
4033
|
-
};
|
|
4034
|
-
}
|
|
4035
|
-
})();
|
|
4036
|
-
/*------------------------------- DEPRECATED -------------------------------*/
|
|
4037
|
-
|
|
4038
|
-
Hash.toQueryString = Object.toQueryString;
|
|
4039
|
-
|
|
4040
|
-
var Toggle = { display: Element.toggle };
|
|
4041
|
-
|
|
4042
|
-
Element.Methods.childOf = Element.Methods.descendantOf;
|
|
4043
|
-
|
|
4044
|
-
var Insertion = {
|
|
4045
|
-
Before: function(element, content) {
|
|
4046
|
-
return Element.insert(element, {before:content});
|
|
4047
|
-
},
|
|
4048
|
-
|
|
4049
|
-
Top: function(element, content) {
|
|
4050
|
-
return Element.insert(element, {top:content});
|
|
4051
|
-
},
|
|
4052
|
-
|
|
4053
|
-
Bottom: function(element, content) {
|
|
4054
|
-
return Element.insert(element, {bottom:content});
|
|
4055
|
-
},
|
|
4056
|
-
|
|
4057
|
-
After: function(element, content) {
|
|
4058
|
-
return Element.insert(element, {after:content});
|
|
4059
|
-
}
|
|
4060
|
-
};
|
|
4061
|
-
|
|
4062
|
-
var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
|
|
4063
|
-
|
|
4064
|
-
// This should be moved to script.aculo.us; notice the deprecated methods
|
|
4065
|
-
// further below, that map to the newer Element methods.
|
|
4066
|
-
var Position = {
|
|
4067
|
-
// set to true if needed, warning: firefox performance problems
|
|
4068
|
-
// NOT neeeded for page scrolling, only if draggable contained in
|
|
4069
|
-
// scrollable elements
|
|
4070
|
-
includeScrollOffsets: false,
|
|
4071
|
-
|
|
4072
|
-
// must be called before calling withinIncludingScrolloffset, every time the
|
|
4073
|
-
// page is scrolled
|
|
4074
|
-
prepare: function() {
|
|
4075
|
-
this.deltaX = window.pageXOffset
|
|
4076
|
-
|| document.documentElement.scrollLeft
|
|
4077
|
-
|| document.body.scrollLeft
|
|
4078
|
-
|| 0;
|
|
4079
|
-
this.deltaY = window.pageYOffset
|
|
4080
|
-
|| document.documentElement.scrollTop
|
|
4081
|
-
|| document.body.scrollTop
|
|
4082
|
-
|| 0;
|
|
4083
|
-
},
|
|
4084
|
-
|
|
4085
|
-
// caches x/y coordinate pair to use with overlap
|
|
4086
|
-
within: function(element, x, y) {
|
|
4087
|
-
if (this.includeScrollOffsets)
|
|
4088
|
-
return this.withinIncludingScrolloffsets(element, x, y);
|
|
4089
|
-
this.xcomp = x;
|
|
4090
|
-
this.ycomp = y;
|
|
4091
|
-
this.offset = Element.cumulativeOffset(element);
|
|
4092
|
-
|
|
4093
|
-
return (y >= this.offset[1] &&
|
|
4094
|
-
y < this.offset[1] + element.offsetHeight &&
|
|
4095
|
-
x >= this.offset[0] &&
|
|
4096
|
-
x < this.offset[0] + element.offsetWidth);
|
|
4097
|
-
},
|
|
4098
|
-
|
|
4099
|
-
withinIncludingScrolloffsets: function(element, x, y) {
|
|
4100
|
-
var offsetcache = Element.cumulativeScrollOffset(element);
|
|
4101
|
-
|
|
4102
|
-
this.xcomp = x + offsetcache[0] - this.deltaX;
|
|
4103
|
-
this.ycomp = y + offsetcache[1] - this.deltaY;
|
|
4104
|
-
this.offset = Element.cumulativeOffset(element);
|
|
4105
|
-
|
|
4106
|
-
return (this.ycomp >= this.offset[1] &&
|
|
4107
|
-
this.ycomp < this.offset[1] + element.offsetHeight &&
|
|
4108
|
-
this.xcomp >= this.offset[0] &&
|
|
4109
|
-
this.xcomp < this.offset[0] + element.offsetWidth);
|
|
4110
|
-
},
|
|
4111
|
-
|
|
4112
|
-
// within must be called directly before
|
|
4113
|
-
overlap: function(mode, element) {
|
|
4114
|
-
if (!mode) return 0;
|
|
4115
|
-
if (mode == 'vertical')
|
|
4116
|
-
return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
|
|
4117
|
-
element.offsetHeight;
|
|
4118
|
-
if (mode == 'horizontal')
|
|
4119
|
-
return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
|
|
4120
|
-
element.offsetWidth;
|
|
4121
|
-
},
|
|
4122
|
-
|
|
4123
|
-
// Deprecation layer -- use newer Element methods now (1.5.2).
|
|
4124
|
-
|
|
4125
|
-
cumulativeOffset: Element.Methods.cumulativeOffset,
|
|
4126
|
-
|
|
4127
|
-
positionedOffset: Element.Methods.positionedOffset,
|
|
4128
|
-
|
|
4129
|
-
absolutize: function(element) {
|
|
4130
|
-
Position.prepare();
|
|
4131
|
-
return Element.absolutize(element);
|
|
4132
|
-
},
|
|
4133
|
-
|
|
4134
|
-
relativize: function(element) {
|
|
4135
|
-
Position.prepare();
|
|
4136
|
-
return Element.relativize(element);
|
|
4137
|
-
},
|
|
4138
|
-
|
|
4139
|
-
realOffset: Element.Methods.cumulativeScrollOffset,
|
|
4140
|
-
|
|
4141
|
-
offsetParent: Element.Methods.getOffsetParent,
|
|
4142
|
-
|
|
4143
|
-
page: Element.Methods.viewportOffset,
|
|
4144
|
-
|
|
4145
|
-
clone: function(source, target, options) {
|
|
4146
|
-
options = options || { };
|
|
4147
|
-
return Element.clonePosition(target, source, options);
|
|
4148
|
-
}
|
|
4149
|
-
};
|
|
4150
|
-
|
|
4151
|
-
/*--------------------------------------------------------------------------*/
|
|
4152
|
-
|
|
4153
|
-
if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
|
|
4154
|
-
function iter(name) {
|
|
4155
|
-
return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
|
|
4156
|
-
}
|
|
4157
|
-
|
|
4158
|
-
instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
|
|
4159
|
-
function(element, className) {
|
|
4160
|
-
className = className.toString().strip();
|
|
4161
|
-
var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
|
|
4162
|
-
return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
|
|
4163
|
-
} : function(element, className) {
|
|
4164
|
-
className = className.toString().strip();
|
|
4165
|
-
var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
|
|
4166
|
-
if (!classNames && !className) return elements;
|
|
4167
|
-
|
|
4168
|
-
var nodes = $(element).getElementsByTagName('*');
|
|
4169
|
-
className = ' ' + className + ' ';
|
|
4170
|
-
|
|
4171
|
-
for (var i = 0, child, cn; child = nodes[i]; i++) {
|
|
4172
|
-
if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
|
|
4173
|
-
(classNames && classNames.all(function(name) {
|
|
4174
|
-
return !name.toString().blank() && cn.include(' ' + name + ' ');
|
|
4175
|
-
}))))
|
|
4176
|
-
elements.push(Element.extend(child));
|
|
4177
|
-
}
|
|
4178
|
-
return elements;
|
|
4179
|
-
};
|
|
4180
|
-
|
|
4181
|
-
return function(className, parentElement) {
|
|
4182
|
-
return $(parentElement || document.body).getElementsByClassName(className);
|
|
4183
|
-
};
|
|
4184
|
-
}(Element.Methods);
|
|
4185
|
-
|
|
4186
|
-
/*--------------------------------------------------------------------------*/
|
|
4187
|
-
|
|
4188
|
-
Element.ClassNames = Class.create();
|
|
4189
|
-
Element.ClassNames.prototype = {
|
|
4190
|
-
initialize: function(element) {
|
|
4191
|
-
this.element = $(element);
|
|
4192
|
-
},
|
|
4193
|
-
|
|
4194
|
-
_each: function(iterator) {
|
|
4195
|
-
this.element.className.split(/\s+/).select(function(name) {
|
|
4196
|
-
return name.length > 0;
|
|
4197
|
-
})._each(iterator);
|
|
4198
|
-
},
|
|
4199
|
-
|
|
4200
|
-
set: function(className) {
|
|
4201
|
-
this.element.className = className;
|
|
4202
|
-
},
|
|
4203
|
-
|
|
4204
|
-
add: function(classNameToAdd) {
|
|
4205
|
-
if (this.include(classNameToAdd)) return;
|
|
4206
|
-
this.set($A(this).concat(classNameToAdd).join(' '));
|
|
4207
|
-
},
|
|
4208
|
-
|
|
4209
|
-
remove: function(classNameToRemove) {
|
|
4210
|
-
if (!this.include(classNameToRemove)) return;
|
|
4211
|
-
this.set($A(this).without(classNameToRemove).join(' '));
|
|
4212
|
-
},
|
|
4213
|
-
|
|
4214
|
-
toString: function() {
|
|
4215
|
-
return $A(this).join(' ');
|
|
4216
|
-
}
|
|
4217
|
-
};
|
|
4218
|
-
|
|
4219
|
-
Object.extend(Element.ClassNames.prototype, Enumerable);
|
|
4220
|
-
|
|
4221
|
-
/*--------------------------------------------------------------------------*/
|
|
4222
|
-
|
|
4223
|
-
Element.addMethods();
|