openbill 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -20
- data/README +63 -63
- data/test/functional/products_controller_test.rb +8 -8
- data/test/functional/sessions_controller_test.rb +8 -8
- data/test/functional/settings_controller_test.rb +8 -8
- data/test/functional/users_controller_test.rb +8 -0
- data/test/unit/user_mailer_test.rb +7 -7
- data/test/unit/user_test.rb +7 -7
- metadata +9 -730
- data/.actionScriptProperties +0 -26
- data/.flexProperties +0 -2
- data/.gitignore +0 -4
- data/.loadpath +0 -7
- data/.project +0 -24
- data/CONTRIBUTORS +0 -6
- data/INSTALL +0 -15
- data/Rakefile +0 -51
- data/VERSION +0 -1
- data/app/controllers/application.rb +0 -49
- data/app/controllers/carts_controller.rb +0 -226
- data/app/controllers/products_controller.rb +0 -19
- data/app/controllers/sessions_controller.rb +0 -39
- data/app/controllers/settings_controller.rb +0 -15
- data/app/helpers/application_helper.rb +0 -3
- data/app/helpers/carts_helper.rb +0 -5
- data/app/helpers/products_helper.rb +0 -2
- data/app/helpers/sessions_helper.rb +0 -2
- data/app/helpers/settings_helper.rb +0 -2
- data/app/models/account.rb +0 -16
- data/app/models/billingcycle.rb +0 -7
- data/app/models/currency.rb +0 -5
- data/app/models/emailtemplate.rb +0 -5
- data/app/models/invoice.rb +0 -13
- data/app/models/invoicedetail.rb +0 -8
- data/app/models/option.rb +0 -5
- data/app/models/order.rb +0 -7
- data/app/models/orderdetail.rb +0 -11
- data/app/models/paymentgateway.rb +0 -5
- data/app/models/product.rb +0 -10
- data/app/models/registrar.rb +0 -7
- data/app/models/registrarlog.rb +0 -6
- data/app/models/role.rb +0 -7
- data/app/models/server.rb +0 -5
- data/app/models/serverlog.rb +0 -6
- data/app/models/setting.rb +0 -6
- data/app/models/tld.rb +0 -9
- data/app/models/transaction.rb +0 -8
- data/app/models/user.rb +0 -68
- data/app/models/user_mailer.rb +0 -24
- data/app/models/user_observer.rb +0 -11
- data/app/models/userfieldname.rb +0 -8
- data/app/models/userfieldvalue.rb +0 -6
- data/app/views/carts/_cart_details.html.erb +0 -36
- data/app/views/carts/_check_domain_availability.html.erb +0 -7
- data/app/views/carts/_loginbox.html.erb +0 -33
- data/app/views/carts/_new_domain_available.html.erb +0 -14
- data/app/views/carts/_new_domain_not_available.html.erb +0 -10
- data/app/views/carts/_orderinfobox.html.erb +0 -1
- data/app/views/carts/_product_details.html.erb +0 -43
- data/app/views/carts/_products_list.html.erb +0 -22
- data/app/views/carts/_signupbox.html.erb +0 -51
- data/app/views/carts/checkout.html.erb +0 -22
- data/app/views/carts/customer.html.erb +0 -26
- data/app/views/carts/order.html.erb +0 -17
- data/app/views/layouts/default.html.erb +0 -43
- data/app/views/user_mailer/activation.erb +0 -3
- data/app/views/user_mailer/signup_notification.erb +0 -8
- data/config/boot.rb +0 -109
- data/config/database.yml +0 -20
- data/config/environment.rb +0 -76
- data/config/environments/development.rb +0 -17
- data/config/environments/production.rb +0 -24
- data/config/environments/test.rb +0 -22
- data/config/initializers/inflections.rb +0 -10
- data/config/initializers/mime_types.rb +0 -5
- data/config/initializers/new_rails_defaults.rb +0 -17
- data/config/initializers/site_keys.rb +0 -38
- data/config/locales/en.yml +0 -2
- data/config/routes.rb +0 -31
- data/db/migrate/20090429095737_create_settings.rb +0 -28
- data/db/migrate/20090429102507_create_users.rb +0 -25
- data/db/migrate/20090429113405_create_accounts.rb +0 -12
- data/db/migrate/20090430091300_create_roles.rb +0 -14
- data/db/migrate/20090430103415_create_products.rb +0 -24
- data/db/migrate/20090509144706_create_sessions.rb +0 -16
- data/db/migrate/20090518070457_create_billingcycles.rb +0 -15
- data/db/migrate/20090518105551_create_orders.rb +0 -13
- data/db/migrate/20090518105611_create_invoices.rb +0 -17
- data/db/migrate/20090518105912_create_orderdetails.rb +0 -24
- data/db/migrate/20090518105931_create_invoicedetails.rb +0 -14
- data/db/migrate/20090519051441_create_servers.rb +0 -14
- data/db/migrate/20090519051509_create_registrars.rb +0 -13
- data/db/migrate/20090519051536_create_paymentgateways.rb +0 -13
- data/db/migrate/20090519052025_create_tlds.rb +0 -15
- data/db/migrate/20090519070149_create_transactions.rb +0 -17
- data/db/migrate/20090519070225_create_registrarlogs.rb +0 -16
- data/db/migrate/20090519070248_create_serverlogs.rb +0 -16
- data/db/migrate/20090519071741_create_emailtemplates.rb +0 -18
- data/db/migrate/20090519083539_create_currencies.rb +0 -18
- data/db/migrate/20090522102336_create_userfieldnames.rb +0 -16
- data/db/migrate/20090522102401_create_userfieldvalues.rb +0 -14
- data/db/migrate/20090526092119_create_options.rb +0 -14
- data/html-template/AC_OETags.js +0 -292
- data/html-template/history/history.css +0 -6
- data/html-template/history/history.js +0 -662
- data/html-template/history/historyFrame.html +0 -29
- data/html-template/index.template.html +0 -121
- data/html-template/playerProductInstall.swf +0 -0
- data/lib/authenticated_system.rb +0 -189
- data/lib/authenticated_test_helper.rb +0 -11
- data/lib/tasks/empty +0 -0
- data/openbill.gemspec +0 -788
- data/pkg/openbill-0.0.0.gem +0 -0
- data/pkg/openbill-0.1.3.gem +0 -0
- data/pkg/openbill-0.1.4.gem +0 -0
- data/pkg/openbill-0.1.5.gem +0 -0
- data/public/404.html +0 -30
- data/public/422.html +0 -30
- data/public/500.html +0 -33
- data/public/AC_OETags.js +0 -292
- data/public/admin.html +0 -121
- data/public/admin.swf +0 -0
- data/public/assets/LoadingUndefinedSkin.swf +0 -0
- data/public/assets/UndefinedPersonalSkinLoad.swf +0 -0
- data/public/assets/blanc.png +0 -0
- data/public/assets/botones/Boton_dis.png +0 -0
- data/public/assets/botones/PopUpButton.png +0 -0
- data/public/assets/botones/PopUpButton1.png +0 -0
- data/public/assets/botones/PopUpButton2.png +0 -0
- data/public/assets/botones/PopUpButton_0.png +0 -0
- data/public/assets/botones/PopUpButton_1.png +0 -0
- data/public/assets/botones/PopUpButton_2.png +0 -0
- data/public/assets/botones/PopUpButton_dis.png +0 -0
- data/public/assets/botones/PopUpMenuButton.png +0 -0
- data/public/assets/botones/PopUpMenuButton1.png +0 -0
- data/public/assets/botones/PopUpMenuButton2.png +0 -0
- data/public/assets/botones/PopUpMenuButton_0.png +0 -0
- data/public/assets/botones/PopUpMenuButton_1.png +0 -0
- data/public/assets/botones/PopUpMenuButton_2.png +0 -0
- data/public/assets/botones/PopUpMenuButton_dis.png +0 -0
- data/public/assets/botones/Scroll_barra.png +0 -0
- data/public/assets/botones/Scroll_barra1.png +0 -0
- data/public/assets/botones/Scroll_barra2.png +0 -0
- data/public/assets/botones/Scroll_down.png +0 -0
- data/public/assets/botones/Scroll_down1.png +0 -0
- data/public/assets/botones/Scroll_fondo.png +0 -0
- data/public/assets/botones/Scroll_icon.png +0 -0
- data/public/assets/botones/Scroll_up.png +0 -0
- data/public/assets/botones/Scroll_up1.png +0 -0
- data/public/assets/botones/TabNavigator.png +0 -0
- data/public/assets/botones/TabNavigator1.png +0 -0
- data/public/assets/botones/TabNavigator2.png +0 -0
- data/public/assets/botones/TabNavigator3.png +0 -0
- data/public/assets/botones/Thumbs.db +0 -0
- data/public/assets/botones/accordion_backround.png +0 -0
- data/public/assets/botones/accordion_barra.png +0 -0
- data/public/assets/botones/accordion_barra1.png +0 -0
- data/public/assets/botones/accordion_barra2.png +0 -0
- data/public/assets/botones/accordion_barra3.png +0 -0
- data/public/assets/botones/adelante.png +0 -0
- data/public/assets/botones/adelante1.png +0 -0
- data/public/assets/botones/adelante2.png +0 -0
- data/public/assets/botones/adelante_dis.png +0 -0
- data/public/assets/botones/atras.png +0 -0
- data/public/assets/botones/atras1.png +0 -0
- data/public/assets/botones/atras2.png +0 -0
- data/public/assets/botones/atras_dis.png +0 -0
- data/public/assets/botones/barra.png +0 -0
- data/public/assets/botones/barra_dis.png +0 -0
- data/public/assets/botones/barra_v.png +0 -0
- data/public/assets/botones/boton.jpg +0 -0
- data/public/assets/botones/boton.png +0 -0
- data/public/assets/botones/boton1.png +0 -0
- data/public/assets/botones/boton2.png +0 -0
- data/public/assets/botones/boton_classic.png +0 -0
- data/public/assets/botones/boton_classic1.png +0 -0
- data/public/assets/botones/boton_classic2.png +0 -0
- data/public/assets/botones/bullet.png +0 -0
- data/public/assets/botones/bullet1.png +0 -0
- data/public/assets/botones/bullet_V_dis.png +0 -0
- data/public/assets/botones/bullet_dis.png +0 -0
- data/public/assets/botones/bullet_v.png +0 -0
- data/public/assets/botones/bullet_v1.png +0 -0
- data/public/assets/botones/chekOff.png +0 -0
- data/public/assets/botones/chekOff1.png +0 -0
- data/public/assets/botones/chekOff2.png +0 -0
- data/public/assets/botones/chekOn.png +0 -0
- data/public/assets/botones/chekOn1.png +0 -0
- data/public/assets/botones/chekOn2.png +0 -0
- data/public/assets/botones/chek_dis.png +0 -0
- data/public/assets/botones/close.png +0 -0
- data/public/assets/botones/close1.png +0 -0
- data/public/assets/botones/close2.png +0 -0
- data/public/assets/botones/close_folder.png +0 -0
- data/public/assets/botones/colorPicker.png +0 -0
- data/public/assets/botones/colorPicker1.png +0 -0
- data/public/assets/botones/colorPicker2.png +0 -0
- data/public/assets/botones/colorPicker_blanco.png +0 -0
- data/public/assets/botones/colorPicker_blanco1.png +0 -0
- data/public/assets/botones/colorPicker_blanco2.png +0 -0
- data/public/assets/botones/colorPicker_dis.png +0 -0
- data/public/assets/botones/combo.png +0 -0
- data/public/assets/botones/combo1.png +0 -0
- data/public/assets/botones/combo2.png +0 -0
- data/public/assets/botones/combo_dis.png +0 -0
- data/public/assets/botones/dataIcon.png +0 -0
- data/public/assets/botones/dataIcon1.png +0 -0
- data/public/assets/botones/dataIcon2.png +0 -0
- data/public/assets/botones/dataIcon_dis.png +0 -0
- data/public/assets/botones/dataText.png +0 -0
- data/public/assets/botones/folder_close.png +0 -0
- data/public/assets/botones/folder_open.png +0 -0
- data/public/assets/botones/hoja.png +0 -0
- data/public/assets/botones/icon_down.png +0 -0
- data/public/assets/botones/icon_up.png +0 -0
- data/public/assets/botones/last_toggle.png +0 -0
- data/public/assets/botones/last_toggle1.png +0 -0
- data/public/assets/botones/last_toggle2.png +0 -0
- data/public/assets/botones/last_toggle3.png +0 -0
- data/public/assets/botones/numericStepper_Down.png +0 -0
- data/public/assets/botones/numericStepper_Down1.png +0 -0
- data/public/assets/botones/numericStepper_Down2.png +0 -0
- data/public/assets/botones/numericStepper_Down_dis.png +0 -0
- data/public/assets/botones/numericStepper_Text.png +0 -0
- data/public/assets/botones/numericStepper_Up.png +0 -0
- data/public/assets/botones/numericStepper_Up1.png +0 -0
- data/public/assets/botones/numericStepper_Up2.png +0 -0
- data/public/assets/botones/numericStepper_Up_dis.png +0 -0
- data/public/assets/botones/open_folder.png +0 -0
- data/public/assets/botones/prev_toggle.png +0 -0
- data/public/assets/botones/prev_toggle1.png +0 -0
- data/public/assets/botones/prev_toggle2.png +0 -0
- data/public/assets/botones/prev_toggle3.png +0 -0
- data/public/assets/botones/progress.png +0 -0
- data/public/assets/botones/progress_barra.png +0 -0
- data/public/assets/botones/progress_charning.png +0 -0
- data/public/assets/botones/progress_dis.png +0 -0
- data/public/assets/botones/radio.png +0 -0
- data/public/assets/botones/radio1.png +0 -0
- data/public/assets/botones/radio2.png +0 -0
- data/public/assets/botones/radio3.png +0 -0
- data/public/assets/botones/radio4.png +0 -0
- data/public/assets/botones/radio_dis.png +0 -0
- data/public/assets/botones/seleccionData.png +0 -0
- data/public/assets/botones/seleccionDataSelected.png +0 -0
- data/public/assets/botones/seleccionDataUp.png +0 -0
- data/public/assets/botones/textArea.png +0 -0
- data/public/assets/botones/textInput.png +0 -0
- data/public/assets/botones/textInput_error.png +0 -0
- data/public/assets/botones/textInput_no.png +0 -0
- data/public/assets/botones/toggle_medio.png +0 -0
- data/public/assets/botones/toggle_medio1.png +0 -0
- data/public/assets/botones/toggle_medio2.png +0 -0
- data/public/assets/botones/toggle_medio3.png +0 -0
- data/public/assets/botones/toolTip.png +0 -0
- data/public/assets/general/Fondo4.jpg +0 -0
- data/public/assets/general/Fondo5.jpg +0 -0
- data/public/assets/general/MenuItem.png +0 -0
- data/public/assets/general/MenuItem1.png +0 -0
- data/public/assets/general/Thumbs.db +0 -0
- data/public/assets/general/alert_fondo.png +0 -0
- data/public/assets/general/alert_fondo1.png +0 -0
- data/public/assets/general/alert_titulo.png +0 -0
- data/public/assets/general/alert_titulo1.png +0 -0
- data/public/assets/general/blanc.png +0 -0
- data/public/assets/general/fondo.jpg +0 -0
- data/public/assets/general/fondo1.jpg +0 -0
- data/public/assets/general/fondo2.jpg +0 -0
- data/public/assets/general/fondo3.jpg +0 -0
- data/public/assets/general/fondo_list.png +0 -0
- data/public/assets/general/menu.png +0 -0
- data/public/assets/general/panel.png +0 -0
- data/public/assets/general/separator.png +0 -0
- data/public/assets/general/titleWindow.png +0 -0
- data/public/assets/general/titleWindow1.png +0 -0
- data/public/assets/icons/Thumbs.db +0 -0
- data/public/assets/icons/ai.jpg +0 -0
- data/public/assets/icons/air.jpg +0 -0
- data/public/assets/icons/fl.jpg +0 -0
- data/public/assets/icons/fw.jpg +0 -0
- data/public/assets/icons/fx.jpg +0 -0
- data/public/assets/icons/ps.jpg +0 -0
- data/public/assets/scroll/Thumbs.db +0 -0
- data/public/assets/scroll/barra.png +0 -0
- data/public/assets/scroll/barra1.png +0 -0
- data/public/assets/scroll/barra2.png +0 -0
- data/public/assets/scroll/barra_1.png +0 -0
- data/public/assets/scroll/barra_2.png +0 -0
- data/public/assets/scroll/down.png +0 -0
- data/public/assets/scroll/down1.png +0 -0
- data/public/assets/scroll/down_1.png +0 -0
- data/public/assets/scroll/down_2.png +0 -0
- data/public/assets/scroll/fondo.png +0 -0
- data/public/assets/scroll/fondo_1.png +0 -0
- data/public/assets/scroll/fondo_2.png +0 -0
- data/public/assets/scroll/up.png +0 -0
- data/public/assets/scroll/up1.png +0 -0
- data/public/assets/scroll/up_1.png +0 -0
- data/public/assets/scroll/up_2.png +0 -0
- data/public/assets/xml/listData.xml +0 -21
- data/public/dispatch.cgi +0 -10
- data/public/dispatch.fcgi +0 -24
- data/public/dispatch.rb +0 -10
- data/public/favicon.ico +0 -0
- data/public/framework_3.0.0.477.swf +0 -0
- data/public/framework_3.0.0.477.swz +0 -0
- data/public/history/history.css +0 -6
- data/public/history/history.js +0 -662
- data/public/history/historyFrame.html +0 -29
- data/public/images/avatar.png +0 -0
- data/public/images/logo.png +0 -0
- data/public/images/rails.png +0 -0
- data/public/images/spinner.gif +0 -0
- data/public/index.html +0 -1
- data/public/javascripts/application.js +0 -2
- data/public/javascripts/controls.js +0 -963
- data/public/javascripts/dragdrop.js +0 -973
- data/public/javascripts/effects.js +0 -1128
- data/public/javascripts/jquery-1.3.min.js +0 -19
- data/public/javascripts/jquery.localscroll.js +0 -104
- data/public/javascripts/jquery.scrollTo.js +0 -150
- data/public/javascripts/prototype.js +0 -4320
- data/public/playerProductInstall.swf +0 -0
- data/public/robots.txt +0 -5
- data/public/stylesheets/base.css +0 -336
- data/public/stylesheets/darkroom.css +0 -1374
- data/public/stylesheets/darkroom.swf +0 -0
- data/public/stylesheets/default.css +0 -1034
- data/public/stylesheets/myriad.swf +0 -0
- data/public/stylesheets/scaffold.css +0 -54
- data/public/stylesheets/themes/bec-green/style.css +0 -290
- data/public/stylesheets/themes/bec/style.css +0 -301
- data/public/stylesheets/themes/blue/style.css +0 -280
- data/public/stylesheets/themes/default/style.css +0 -267
- data/public/stylesheets/themes/djime-cerulean/style.css +0 -298
- data/public/stylesheets/themes/kathleene/style.css +0 -272
- data/public/stylesheets/themes/openbill/style.css +0 -272
- data/public/stylesheets/themes/orange/style.css +0 -263
- data/public/stylesheets/themes/reidb-greenish/style.css +0 -301
- data/rdoc/empty +0 -0
- data/rdoc/logo.max +0 -0
- data/rdoc/logo.png +0 -0
- data/script/about +0 -4
- data/script/console +0 -3
- data/script/dbconsole +0 -3
- data/script/destroy +0 -3
- data/script/generate +0 -3
- data/script/performance/benchmarker +0 -3
- data/script/performance/profiler +0 -3
- data/script/performance/request +0 -3
- data/script/plugin +0 -3
- data/script/process/inspector +0 -3
- data/script/process/reaper +0 -3
- data/script/process/spawner +0 -3
- data/script/runner +0 -3
- data/script/server +0 -3
- data/src/admin.mxml +0 -62
- data/src/assets/LoadingUndefinedSkin.swf +0 -0
- data/src/assets/UndefinedPersonalSkinLoad.swf +0 -0
- data/src/assets/blanc.png +0 -0
- data/src/assets/botones/Boton_dis.png +0 -0
- data/src/assets/botones/PopUpButton.png +0 -0
- data/src/assets/botones/PopUpButton1.png +0 -0
- data/src/assets/botones/PopUpButton2.png +0 -0
- data/src/assets/botones/PopUpButton_0.png +0 -0
- data/src/assets/botones/PopUpButton_1.png +0 -0
- data/src/assets/botones/PopUpButton_2.png +0 -0
- data/src/assets/botones/PopUpButton_dis.png +0 -0
- data/src/assets/botones/PopUpMenuButton.png +0 -0
- data/src/assets/botones/PopUpMenuButton1.png +0 -0
- data/src/assets/botones/PopUpMenuButton2.png +0 -0
- data/src/assets/botones/PopUpMenuButton_0.png +0 -0
- data/src/assets/botones/PopUpMenuButton_1.png +0 -0
- data/src/assets/botones/PopUpMenuButton_2.png +0 -0
- data/src/assets/botones/PopUpMenuButton_dis.png +0 -0
- data/src/assets/botones/Scroll_barra.png +0 -0
- data/src/assets/botones/Scroll_barra1.png +0 -0
- data/src/assets/botones/Scroll_barra2.png +0 -0
- data/src/assets/botones/Scroll_down.png +0 -0
- data/src/assets/botones/Scroll_down1.png +0 -0
- data/src/assets/botones/Scroll_fondo.png +0 -0
- data/src/assets/botones/Scroll_icon.png +0 -0
- data/src/assets/botones/Scroll_up.png +0 -0
- data/src/assets/botones/Scroll_up1.png +0 -0
- data/src/assets/botones/TabNavigator.png +0 -0
- data/src/assets/botones/TabNavigator1.png +0 -0
- data/src/assets/botones/TabNavigator2.png +0 -0
- data/src/assets/botones/TabNavigator3.png +0 -0
- data/src/assets/botones/Thumbs.db +0 -0
- data/src/assets/botones/accordion_backround.png +0 -0
- data/src/assets/botones/accordion_barra.png +0 -0
- data/src/assets/botones/accordion_barra1.png +0 -0
- data/src/assets/botones/accordion_barra2.png +0 -0
- data/src/assets/botones/accordion_barra3.png +0 -0
- data/src/assets/botones/adelante.png +0 -0
- data/src/assets/botones/adelante1.png +0 -0
- data/src/assets/botones/adelante2.png +0 -0
- data/src/assets/botones/adelante_dis.png +0 -0
- data/src/assets/botones/atras.png +0 -0
- data/src/assets/botones/atras1.png +0 -0
- data/src/assets/botones/atras2.png +0 -0
- data/src/assets/botones/atras_dis.png +0 -0
- data/src/assets/botones/barra.png +0 -0
- data/src/assets/botones/barra_dis.png +0 -0
- data/src/assets/botones/barra_v.png +0 -0
- data/src/assets/botones/boton.jpg +0 -0
- data/src/assets/botones/boton.png +0 -0
- data/src/assets/botones/boton1.png +0 -0
- data/src/assets/botones/boton2.png +0 -0
- data/src/assets/botones/boton_classic.png +0 -0
- data/src/assets/botones/boton_classic1.png +0 -0
- data/src/assets/botones/boton_classic2.png +0 -0
- data/src/assets/botones/bullet.png +0 -0
- data/src/assets/botones/bullet1.png +0 -0
- data/src/assets/botones/bullet_V_dis.png +0 -0
- data/src/assets/botones/bullet_dis.png +0 -0
- data/src/assets/botones/bullet_v.png +0 -0
- data/src/assets/botones/bullet_v1.png +0 -0
- data/src/assets/botones/chekOff.png +0 -0
- data/src/assets/botones/chekOff1.png +0 -0
- data/src/assets/botones/chekOff2.png +0 -0
- data/src/assets/botones/chekOn.png +0 -0
- data/src/assets/botones/chekOn1.png +0 -0
- data/src/assets/botones/chekOn2.png +0 -0
- data/src/assets/botones/chek_dis.png +0 -0
- data/src/assets/botones/close.png +0 -0
- data/src/assets/botones/close1.png +0 -0
- data/src/assets/botones/close2.png +0 -0
- data/src/assets/botones/close_folder.png +0 -0
- data/src/assets/botones/colorPicker.png +0 -0
- data/src/assets/botones/colorPicker1.png +0 -0
- data/src/assets/botones/colorPicker2.png +0 -0
- data/src/assets/botones/colorPicker_blanco.png +0 -0
- data/src/assets/botones/colorPicker_blanco1.png +0 -0
- data/src/assets/botones/colorPicker_blanco2.png +0 -0
- data/src/assets/botones/colorPicker_dis.png +0 -0
- data/src/assets/botones/combo.png +0 -0
- data/src/assets/botones/combo1.png +0 -0
- data/src/assets/botones/combo2.png +0 -0
- data/src/assets/botones/combo_dis.png +0 -0
- data/src/assets/botones/dataIcon.png +0 -0
- data/src/assets/botones/dataIcon1.png +0 -0
- data/src/assets/botones/dataIcon2.png +0 -0
- data/src/assets/botones/dataIcon_dis.png +0 -0
- data/src/assets/botones/dataText.png +0 -0
- data/src/assets/botones/folder_close.png +0 -0
- data/src/assets/botones/folder_open.png +0 -0
- data/src/assets/botones/hoja.png +0 -0
- data/src/assets/botones/icon_down.png +0 -0
- data/src/assets/botones/icon_up.png +0 -0
- data/src/assets/botones/last_toggle.png +0 -0
- data/src/assets/botones/last_toggle1.png +0 -0
- data/src/assets/botones/last_toggle2.png +0 -0
- data/src/assets/botones/last_toggle3.png +0 -0
- data/src/assets/botones/numericStepper_Down.png +0 -0
- data/src/assets/botones/numericStepper_Down1.png +0 -0
- data/src/assets/botones/numericStepper_Down2.png +0 -0
- data/src/assets/botones/numericStepper_Down_dis.png +0 -0
- data/src/assets/botones/numericStepper_Text.png +0 -0
- data/src/assets/botones/numericStepper_Up.png +0 -0
- data/src/assets/botones/numericStepper_Up1.png +0 -0
- data/src/assets/botones/numericStepper_Up2.png +0 -0
- data/src/assets/botones/numericStepper_Up_dis.png +0 -0
- data/src/assets/botones/open_folder.png +0 -0
- data/src/assets/botones/prev_toggle.png +0 -0
- data/src/assets/botones/prev_toggle1.png +0 -0
- data/src/assets/botones/prev_toggle2.png +0 -0
- data/src/assets/botones/prev_toggle3.png +0 -0
- data/src/assets/botones/progress.png +0 -0
- data/src/assets/botones/progress_barra.png +0 -0
- data/src/assets/botones/progress_charning.png +0 -0
- data/src/assets/botones/progress_dis.png +0 -0
- data/src/assets/botones/radio.png +0 -0
- data/src/assets/botones/radio1.png +0 -0
- data/src/assets/botones/radio2.png +0 -0
- data/src/assets/botones/radio3.png +0 -0
- data/src/assets/botones/radio4.png +0 -0
- data/src/assets/botones/radio_dis.png +0 -0
- data/src/assets/botones/seleccionData.png +0 -0
- data/src/assets/botones/seleccionDataSelected.png +0 -0
- data/src/assets/botones/seleccionDataUp.png +0 -0
- data/src/assets/botones/textArea.png +0 -0
- data/src/assets/botones/textInput.png +0 -0
- data/src/assets/botones/textInput_error.png +0 -0
- data/src/assets/botones/textInput_no.png +0 -0
- data/src/assets/botones/toggle_medio.png +0 -0
- data/src/assets/botones/toggle_medio1.png +0 -0
- data/src/assets/botones/toggle_medio2.png +0 -0
- data/src/assets/botones/toggle_medio3.png +0 -0
- data/src/assets/botones/toolTip.png +0 -0
- data/src/assets/general/Fondo4.jpg +0 -0
- data/src/assets/general/Fondo5.jpg +0 -0
- data/src/assets/general/MenuItem.png +0 -0
- data/src/assets/general/MenuItem1.png +0 -0
- data/src/assets/general/Thumbs.db +0 -0
- data/src/assets/general/alert_fondo.png +0 -0
- data/src/assets/general/alert_fondo1.png +0 -0
- data/src/assets/general/alert_titulo.png +0 -0
- data/src/assets/general/alert_titulo1.png +0 -0
- data/src/assets/general/blanc.png +0 -0
- data/src/assets/general/fondo.jpg +0 -0
- data/src/assets/general/fondo1.jpg +0 -0
- data/src/assets/general/fondo2.jpg +0 -0
- data/src/assets/general/fondo3.jpg +0 -0
- data/src/assets/general/fondo_list.png +0 -0
- data/src/assets/general/menu.png +0 -0
- data/src/assets/general/panel.png +0 -0
- data/src/assets/general/separator.png +0 -0
- data/src/assets/general/titleWindow.png +0 -0
- data/src/assets/general/titleWindow1.png +0 -0
- data/src/assets/icons/Thumbs.db +0 -0
- data/src/assets/icons/ai.jpg +0 -0
- data/src/assets/icons/air.jpg +0 -0
- data/src/assets/icons/fl.jpg +0 -0
- data/src/assets/icons/fw.jpg +0 -0
- data/src/assets/icons/fx.jpg +0 -0
- data/src/assets/icons/ps.jpg +0 -0
- data/src/assets/programmatic/BigThumbClass.as +0 -14
- data/src/assets/programmatic/CustomPreloader.as +0 -79
- data/src/assets/programmatic/MyDateField.as +0 -22
- data/src/assets/scroll/Thumbs.db +0 -0
- data/src/assets/scroll/barra.png +0 -0
- data/src/assets/scroll/barra1.png +0 -0
- data/src/assets/scroll/barra2.png +0 -0
- data/src/assets/scroll/barra_1.png +0 -0
- data/src/assets/scroll/barra_2.png +0 -0
- data/src/assets/scroll/down.png +0 -0
- data/src/assets/scroll/down1.png +0 -0
- data/src/assets/scroll/down_1.png +0 -0
- data/src/assets/scroll/down_2.png +0 -0
- data/src/assets/scroll/fondo.png +0 -0
- data/src/assets/scroll/fondo_1.png +0 -0
- data/src/assets/scroll/fondo_2.png +0 -0
- data/src/assets/scroll/up.png +0 -0
- data/src/assets/scroll/up1.png +0 -0
- data/src/assets/scroll/up_1.png +0 -0
- data/src/assets/scroll/up_2.png +0 -0
- data/src/assets/xml/listData.xml +0 -21
- data/src/images/logo.png +0 -0
- data/src/libs/Cairngorm.swc +0 -0
- data/src/libs/flexlib.swc +0 -0
- data/src/org/rsos/openbill/business/RailsDelegate.as +0 -109
- data/src/org/rsos/openbill/business/Services.mxml +0 -15
- data/src/org/rsos/openbill/command/FpCommand.as +0 -44
- data/src/org/rsos/openbill/command/LoginCommand.as +0 -52
- data/src/org/rsos/openbill/command/LogoutCommand.as +0 -43
- data/src/org/rsos/openbill/command/ProductCommand.as +0 -49
- data/src/org/rsos/openbill/command/SettingCommand.as +0 -39
- data/src/org/rsos/openbill/control/OpenbillController.as +0 -25
- data/src/org/rsos/openbill/event/FpEvent.as +0 -29
- data/src/org/rsos/openbill/event/LoginEvent.as +0 -29
- data/src/org/rsos/openbill/event/LogoutEvent.as +0 -26
- data/src/org/rsos/openbill/event/ProductEvent.as +0 -29
- data/src/org/rsos/openbill/event/SettingEvent.as +0 -29
- data/src/org/rsos/openbill/model/OpenbillModelLocator.as +0 -188
- data/src/org/rsos/openbill/util/ValueObjectUtil.as +0 -19
- data/src/org/rsos/openbill/view/Content.mxml +0 -4
- data/src/org/rsos/openbill/view/Footer.mxml +0 -25
- data/src/org/rsos/openbill/view/Header.mxml +0 -31
- data/src/org/rsos/openbill/view/Product.mxml +0 -82
- data/src/org/rsos/openbill/view/Setting.mxml +0 -111
- data/src/org/rsos/openbill/view/SignIn.mxml +0 -67
- data/src/org/rsos/openbill/vo/AccountVO.as +0 -13
- data/src/org/rsos/openbill/vo/CurrencyVO.as +0 -18
- data/src/org/rsos/openbill/vo/ProductVO.as +0 -17
- data/src/org/rsos/openbill/vo/RoleVO.as +0 -14
- data/src/org/rsos/openbill/vo/SettingVO.as +0 -29
- data/src/org/rsos/openbill/vo/UserVO.as +0 -18
- data/src/stylesheets/darkroom.css +0 -1374
- data/src/stylesheets/darkroom.swf +0 -0
- data/src/stylesheets/default.css +0 -1034
- data/src/stylesheets/myriad.swf +0 -0
- data/test/fixtures/accounts.yml +0 -3
- data/test/fixtures/billingcycles.yml +0 -41
- data/test/fixtures/currencies.yml +0 -11
- data/test/fixtures/emailtemplates.yml +0 -8
- data/test/fixtures/invoicedetails.yml +0 -0
- data/test/fixtures/invoices.yml +0 -0
- data/test/fixtures/options.yml +0 -0
- data/test/fixtures/orderdetails.yml +0 -0
- data/test/fixtures/orders.yml +0 -0
- data/test/fixtures/paymentgateways.yml +0 -0
- data/test/fixtures/products.yml +0 -40
- data/test/fixtures/registrarlogs.yml +0 -0
- data/test/fixtures/registrars.yml +0 -4
- data/test/fixtures/roles.yml +0 -19
- data/test/fixtures/serverlogs.yml +0 -0
- data/test/fixtures/servers.yml +0 -0
- data/test/fixtures/settings.yml +0 -7
- data/test/fixtures/tlds.yml +0 -17
- data/test/fixtures/transactions.yml +0 -0
- data/test/fixtures/userfieldnames.yml +0 -9
- data/test/fixtures/userfieldvalues.yml +0 -11
- data/test/fixtures/users.yml +0 -28
- data/test/integration/empty +0 -0
- data/vendor/generators/cairngorm/USAGE +0 -7
- data/vendor/generators/cairngorm/cairngorm_generator.rb +0 -23
- data/vendor/generators/cairngorm/templates/Controller_template.as +0 -20
- data/vendor/generators/cairngorm/templates/ModelLocator_template.as +0 -29
- data/vendor/generators/cairngorm/templates/Services_template.mxml +0 -8
- data/vendor/generators/cairngorm/templates/ValueObjectUtil_template.as +0 -19
- data/vendor/generators/cairngorm/templates/main_template.mxml +0 -27
- data/vendor/generators/command/USAGE +0 -10
- data/vendor/generators/command/command_generator.rb +0 -8
- data/vendor/generators/command/templates/command_template.as +0 -39
- data/vendor/generators/command/templates/event_template.as +0 -26
- data/vendor/generators/delegate/USAGE +0 -8
- data/vendor/generators/delegate/delegate_generator.rb +0 -7
- data/vendor/generators/delegate/templates/delegate_template.as +0 -26
- data/vendor/generators/event/USAGE +0 -8
- data/vendor/generators/event/event_generator.rb +0 -7
- data/vendor/generators/event/templates/event_template.as +0 -26
- data/vendor/generators/vo/USAGE +0 -9
- data/vendor/generators/vo/templates/vo_template.as +0 -18
- data/vendor/generators/vo/vo_generator.rb +0 -7
- data/vendor/generators/worbservice/USAGE +0 -8
- data/vendor/generators/worbservice/templates/service.rb +0 -11
- data/vendor/generators/worbservice/worbservice_generator.rb +0 -7
- data/vendor/plugins/enum-column/init.rb +0 -9
- data/vendor/plugins/enum-column/lib/enum/active_record_helper.rb +0 -107
- data/vendor/plugins/enum-column/lib/enum/enum_adapter.rb +0 -76
- data/vendor/plugins/enum-column/lib/enum/mysql_adapter.rb +0 -33
- data/vendor/plugins/enum-column/lib/enum/postgresql_adapter.rb +0 -64
- data/vendor/plugins/enum-column/lib/enum/quoting.rb +0 -17
- data/vendor/plugins/enum-column/lib/enum/schema_definitions.rb +0 -12
- data/vendor/plugins/enum-column/lib/enum/schema_statements.rb +0 -32
- data/vendor/plugins/enum-column/lib/enum/sqlite3_adapter.rb +0 -52
- data/vendor/plugins/enum-column/lib/enum/validations.rb +0 -40
- data/vendor/plugins/enum-column/readme.html +0 -125
- data/vendor/plugins/enum-column/test/db/schema.rb +0 -28
- data/vendor/plugins/enum-column/test/enum_mysql_test.rb +0 -220
- data/vendor/plugins/enum-column/test/fixtures/db_definitions/mysql.drop.sql +0 -32
- data/vendor/plugins/enum-column/test/fixtures/db_definitions/mysql.sql +0 -244
- data/vendor/plugins/enum-column/test/fixtures/enumeration.rb +0 -20
- data/vendor/plugins/enum-column/test/test_helper.rb +0 -18
- data/vendor/plugins/restful-authentication/.gitignore +0 -21
- data/vendor/plugins/restful-authentication/CHANGELOG +0 -68
- data/vendor/plugins/restful-authentication/LICENSE +0 -20
- data/vendor/plugins/restful-authentication/README.textile +0 -224
- data/vendor/plugins/restful-authentication/Rakefile +0 -32
- data/vendor/plugins/restful-authentication/TODO +0 -15
- data/vendor/plugins/restful-authentication/generators/authenticated/USAGE +0 -1
- data/vendor/plugins/restful-authentication/generators/authenticated/authenticated_generator.rb +0 -478
- data/vendor/plugins/restful-authentication/generators/authenticated/lib/insert_routes.rb +0 -54
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/_model_partial.html.erb +0 -8
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/activation.erb +0 -3
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/authenticated_system.rb +0 -189
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/authenticated_test_helper.rb +0 -22
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/controller.rb +0 -43
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/features/accounts.feature +0 -109
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/features/sessions.feature +0 -134
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/features/step_definitions/ra_env.rb +0 -9
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb +0 -48
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/features/step_definitions/ra_resource_steps.rb +0 -178
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/features/step_definitions/ra_response_steps.rb +0 -169
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/features/step_definitions/rest_auth_features_helper.rb +0 -81
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/features/step_definitions/user_steps.rb +0 -131
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/helper.rb +0 -2
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/login.html.erb +0 -16
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/mailer.rb +0 -25
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/migration.rb +0 -26
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/model.rb +0 -83
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/model_controller.rb +0 -85
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/model_helper.rb +0 -93
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/model_helper_spec.rb +0 -158
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/observer.rb +0 -11
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/signup.html.erb +0 -19
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/signup_notification.erb +0 -8
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/site_keys.rb +0 -38
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/spec/controllers/access_control_spec.rb +0 -90
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/spec/controllers/authenticated_system_spec.rb +0 -102
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/spec/controllers/sessions_controller_spec.rb +0 -139
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/spec/controllers/users_controller_spec.rb +0 -198
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/spec/fixtures/users.yml +0 -60
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/spec/helpers/users_helper_spec.rb +0 -141
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/spec/models/user_spec.rb +0 -290
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/test/functional_test.rb +0 -82
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/test/mailer_test.rb +0 -31
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/test/model_functional_test.rb +0 -93
- data/vendor/plugins/restful-authentication/generators/authenticated/templates/test/unit_test.rb +0 -164
- data/vendor/plugins/restful-authentication/init.rb +0 -1
- data/vendor/plugins/restful-authentication/lib/authentication.rb +0 -40
- data/vendor/plugins/restful-authentication/lib/authentication/by_cookie_token.rb +0 -82
- data/vendor/plugins/restful-authentication/lib/authentication/by_password.rb +0 -64
- data/vendor/plugins/restful-authentication/lib/authorization.rb +0 -14
- data/vendor/plugins/restful-authentication/lib/authorization/aasm_roles.rb +0 -63
- data/vendor/plugins/restful-authentication/lib/authorization/stateful_roles.rb +0 -62
- data/vendor/plugins/restful-authentication/lib/trustification.rb +0 -14
- data/vendor/plugins/restful-authentication/lib/trustification/email_validation.rb +0 -20
- data/vendor/plugins/restful-authentication/notes/AccessControl.txt +0 -2
- data/vendor/plugins/restful-authentication/notes/Authentication.txt +0 -5
- data/vendor/plugins/restful-authentication/notes/Authorization.txt +0 -154
- data/vendor/plugins/restful-authentication/notes/RailsPlugins.txt +0 -78
- data/vendor/plugins/restful-authentication/notes/SecurityFramework.graffle +0 -0
- data/vendor/plugins/restful-authentication/notes/SecurityFramework.png +0 -0
- data/vendor/plugins/restful-authentication/notes/SecurityPatterns.txt +0 -163
- data/vendor/plugins/restful-authentication/notes/Tradeoffs.txt +0 -126
- data/vendor/plugins/restful-authentication/notes/Trustification.txt +0 -49
- data/vendor/plugins/restful-authentication/rails/init.rb +0 -3
- data/vendor/plugins/restful-authentication/restful-authentication.gemspec +0 -33
- data/vendor/plugins/restful-authentication/tasks/auth.rake +0 -33
- data/vendor/plugins/ruby-enom/README.markdown +0 -37
- data/vendor/plugins/ruby-enom/ruby-enom.rb +0 -198
@@ -1,19 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jQuery JavaScript Library v1.3
|
3
|
-
* http://jquery.com/
|
4
|
-
*
|
5
|
-
* Copyright (c) 2009 John Resig
|
6
|
-
* Dual licensed under the MIT and GPL licenses.
|
7
|
-
* http://docs.jquery.com/License
|
8
|
-
*
|
9
|
-
* Date: 2009-01-13 12:50:31 -0500 (Tue, 13 Jan 2009)
|
10
|
-
* Revision: 6104
|
11
|
-
*/
|
12
|
-
(function(){var l=this,g,x=l.jQuery,o=l.$,n=l.jQuery=l.$=function(D,E){return new n.fn.init(D,E)},C=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;n.fn=n.prototype={init:function(D,G){D=D||document;if(D.nodeType){this[0]=D;this.length=1;this.context=D;return this}if(typeof D==="string"){var F=C.exec(D);if(F&&(F[1]||!G)){if(F[1]){D=n.clean([F[1]],G)}else{var H=document.getElementById(F[3]);if(H){if(H.id!=F[3]){return n().find(D)}var E=n(H);E.context=document;E.selector=D;return E}D=[]}}else{return n(G).find(D)}}else{if(n.isFunction(D)){return n(document).ready(D)}}if(D.selector&&D.context){this.selector=D.selector;this.context=D.context}return this.setArray(n.makeArray(D))},selector:"",jquery:"1.3",size:function(){return this.length},get:function(D){return D===g?n.makeArray(this):this[D]},pushStack:function(E,G,D){var F=n(E);F.prevObject=this;F.context=this.context;if(G==="find"){F.selector=this.selector+(this.selector?" ":"")+D}else{if(G){F.selector=this.selector+"."+G+"("+D+")"}}return F},setArray:function(D){this.length=0;Array.prototype.push.apply(this,D);return this},each:function(E,D){return n.each(this,E,D)},index:function(D){return n.inArray(D&&D.jquery?D[0]:D,this)},attr:function(E,G,F){var D=E;if(typeof E==="string"){if(G===g){return this[0]&&n[F||"attr"](this[0],E)}else{D={};D[E]=G}}return this.each(function(H){for(E in D){n.attr(F?this.style:this,E,n.prop(this,D[E],F,H,E))}})},css:function(D,E){if((D=="width"||D=="height")&&parseFloat(E)<0){E=g}return this.attr(D,E,"curCSS")},text:function(E){if(typeof E!=="object"&&E!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(E))}var D="";n.each(E||this,function(){n.each(this.childNodes,function(){if(this.nodeType!=8){D+=this.nodeType!=1?this.nodeValue:n.fn.text([this])}})});return D},wrapAll:function(D){if(this[0]){var E=n(D,this[0].ownerDocument).clone();if(this[0].parentNode){E.insertBefore(this[0])}E.map(function(){var F=this;while(F.firstChild){F=F.firstChild}return F}).append(this)}return this},wrapInner:function(D){return this.each(function(){n(this).contents().wrapAll(D)})},wrap:function(D){return this.each(function(){n(this).wrapAll(D)})},append:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.appendChild(D)}})},prepend:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.insertBefore(D,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this)})},after:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this.nextSibling)})},end:function(){return this.prevObject||n([])},push:[].push,find:function(D){if(this.length===1&&!/,/.test(D)){var F=this.pushStack([],"find",D);F.length=0;n.find(D,this[0],F);return F}else{var E=n.map(this,function(G){return n.find(D,G)});return this.pushStack(/[^+>] [^+>]/.test(D)?n.unique(E):E,"find",D)}},clone:function(E){var D=this.map(function(){if(!n.support.noCloneEvent&&!n.isXMLDoc(this)){var H=this.cloneNode(true),G=document.createElement("div");G.appendChild(H);return n.clean([G.innerHTML])[0]}else{return this.cloneNode(true)}});var F=D.find("*").andSelf().each(function(){if(this[h]!==g){this[h]=null}});if(E===true){this.find("*").andSelf().each(function(H){if(this.nodeType==3){return}var G=n.data(this,"events");for(var J in G){for(var I in G[J]){n.event.add(F[H],J,G[J][I],G[J][I].data)}}})}return D},filter:function(D){return this.pushStack(n.isFunction(D)&&n.grep(this,function(F,E){return D.call(F,E)})||n.multiFilter(D,n.grep(this,function(E){return E.nodeType===1})),"filter",D)},closest:function(D){var E=n.expr.match.POS.test(D)?n(D):null;return this.map(function(){var F=this;while(F&&F.ownerDocument){if(E?E.index(F)>-1:n(F).is(D)){return F}F=F.parentNode}})},not:function(D){if(typeof D==="string"){if(f.test(D)){return this.pushStack(n.multiFilter(D,this,true),"not",D)}else{D=n.multiFilter(D,this)}}var E=D.length&&D[D.length-1]!==g&&!D.nodeType;return this.filter(function(){return E?n.inArray(this,D)<0:this!=D})},add:function(D){return this.pushStack(n.unique(n.merge(this.get(),typeof D==="string"?n(D):n.makeArray(D))))},is:function(D){return !!D&&n.multiFilter(D,this).length>0},hasClass:function(D){return !!D&&this.is("."+D)},val:function(J){if(J===g){var D=this[0];if(D){if(n.nodeName(D,"option")){return(D.attributes.value||{}).specified?D.value:D.text}if(n.nodeName(D,"select")){var H=D.selectedIndex,K=[],L=D.options,G=D.type=="select-one";if(H<0){return null}for(var E=G?H:0,I=G?H+1:L.length;E<I;E++){var F=L[E];if(F.selected){J=n(F).val();if(G){return J}K.push(J)}}return K}return(D.value||"").replace(/\r/g,"")}return g}if(typeof J==="number"){J+=""}return this.each(function(){if(this.nodeType!=1){return}if(n.isArray(J)&&/radio|checkbox/.test(this.type)){this.checked=(n.inArray(this.value,J)>=0||n.inArray(this.name,J)>=0)}else{if(n.nodeName(this,"select")){var M=n.makeArray(J);n("option",this).each(function(){this.selected=(n.inArray(this.value,M)>=0||n.inArray(this.text,M)>=0)});if(!M.length){this.selectedIndex=-1}}else{this.value=J}}})},html:function(D){return D===g?(this[0]?this[0].innerHTML:null):this.empty().append(D)},replaceWith:function(D){return this.after(D).remove()},eq:function(D){return this.slice(D,+D+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(D){return this.pushStack(n.map(this,function(F,E){return D.call(F,E,F)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=n.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild,D=this.length>1?I.cloneNode(true):I;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),G>0?D.cloneNode(true):I)}}if(F){n.each(F,y)}}return this;function K(N,O){return M&&n.nodeName(N,"table")&&n.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};n.fn.init.prototype=n.fn;function y(D,E){if(E.src){n.ajax({url:E.src,async:false,dataType:"script"})}else{n.globalEval(E.text||E.textContent||E.innerHTML||"")}if(E.parentNode){E.parentNode.removeChild(E)}}function e(){return +new Date}n.extend=n.fn.extend=function(){var I=arguments[0]||{},G=1,H=arguments.length,D=false,F;if(typeof I==="boolean"){D=I;I=arguments[1]||{};G=2}if(typeof I!=="object"&&!n.isFunction(I)){I={}}if(H==G){I=this;--G}for(;G<H;G++){if((F=arguments[G])!=null){for(var E in F){var J=I[E],K=F[E];if(I===K){continue}if(D&&K&&typeof K==="object"&&!K.nodeType){I[E]=n.extend(D,J||(K.length!=null?[]:{}),K)}else{if(K!==g){I[E]=K}}}}}return I};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,p=document.defaultView||{},r=Object.prototype.toString;n.extend({noConflict:function(D){l.$=o;if(D){l.jQuery=x}return n},isFunction:function(D){return r.call(D)==="[object Function]"},isArray:function(D){return r.call(D)==="[object Array]"},isXMLDoc:function(D){return D.documentElement&&!D.body||D.tagName&&D.ownerDocument&&!D.ownerDocument.body},globalEval:function(F){F=n.trim(F);if(F){var E=document.getElementsByTagName("head")[0]||document.documentElement,D=document.createElement("script");D.type="text/javascript";if(n.support.scriptEval){D.appendChild(document.createTextNode(F))}else{D.text=F}E.insertBefore(D,E.firstChild);E.removeChild(D)}},nodeName:function(E,D){return E.nodeName&&E.nodeName.toUpperCase()==D.toUpperCase()},each:function(F,J,E){var D,G=0,H=F.length;if(E){if(H===g){for(D in F){if(J.apply(F[D],E)===false){break}}}else{for(;G<H;){if(J.apply(F[G++],E)===false){break}}}}else{if(H===g){for(D in F){if(J.call(F[D],D,F[D])===false){break}}}else{for(var I=F[0];G<H&&J.call(I,G,I)!==false;I=F[++G]){}}}return F},prop:function(G,H,F,E,D){if(n.isFunction(H)){H=H.call(G,E)}return typeof H==="number"&&F=="curCSS"&&!b.test(D)?H+"px":H},className:{add:function(D,E){n.each((E||"").split(/\s+/),function(F,G){if(D.nodeType==1&&!n.className.has(D.className,G)){D.className+=(D.className?" ":"")+G}})},remove:function(D,E){if(D.nodeType==1){D.className=E!==g?n.grep(D.className.split(/\s+/),function(F){return !n.className.has(E,F)}).join(" "):""}},has:function(E,D){return n.inArray(D,(E.className||E).toString().split(/\s+/))>-1}},swap:function(G,F,H){var D={};for(var E in F){D[E]=G.style[E];G.style[E]=F[E]}H.call(G);for(var E in F){G.style[E]=D[E]}},css:function(F,D,H){if(D=="width"||D=="height"){var J,E={position:"absolute",visibility:"hidden",display:"block"},I=D=="width"?["Left","Right"]:["Top","Bottom"];function G(){J=D=="width"?F.offsetWidth:F.offsetHeight;var L=0,K=0;n.each(I,function(){L+=parseFloat(n.curCSS(F,"padding"+this,true))||0;K+=parseFloat(n.curCSS(F,"border"+this+"Width",true))||0});J-=Math.round(L+K)}if(n(F).is(":visible")){G()}else{n.swap(F,E,G)}return Math.max(0,J)}return n.curCSS(F,D,H)},curCSS:function(H,E,F){var K,D=H.style;if(E=="opacity"&&!n.support.opacity){K=n.attr(D,"opacity");return K==""?"1":K}if(E.match(/float/i)){E=v}if(!F&&D&&D[E]){K=D[E]}else{if(p.getComputedStyle){if(E.match(/float/i)){E="float"}E=E.replace(/([A-Z])/g,"-$1").toLowerCase();var L=p.getComputedStyle(H,null);if(L){K=L.getPropertyValue(E)}if(E=="opacity"&&K==""){K="1"}}else{if(H.currentStyle){var I=E.replace(/\-(\w)/g,function(M,N){return N.toUpperCase()});K=H.currentStyle[E]||H.currentStyle[I];if(!/^\d+(px)?$/i.test(K)&&/^\d/.test(K)){var G=D.left,J=H.runtimeStyle.left;H.runtimeStyle.left=H.currentStyle.left;D.left=K||0;K=D.pixelLeft+"px";D.left=G;H.runtimeStyle.left=J}}}}return K},clean:function(E,J,H){J=J||document;if(typeof J.createElement==="undefined"){J=J.ownerDocument||J[0]&&J[0].ownerDocument||document}if(!H&&E.length===1&&typeof E[0]==="string"){var G=/^<(\w+)\s*\/?>$/.exec(E[0]);if(G){return[J.createElement(G[1])]}}var F=[],D=[],K=J.createElement("div");n.each(E,function(O,Q){if(typeof Q==="number"){Q+=""}if(!Q){return}if(typeof Q==="string"){Q=Q.replace(/(<(\w+)[^>]*?)\/>/g,function(S,T,R){return R.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?S:T+"></"+R+">"});var N=n.trim(Q).toLowerCase();var P=!N.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!N.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||N.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!N.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!N.indexOf("<td")||!N.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!N.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!n.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];K.innerHTML=P[1]+Q+P[2];while(P[0]--){K=K.lastChild}if(!n.support.tbody){var M=!N.indexOf("<table")&&N.indexOf("<tbody")<0?K.firstChild&&K.firstChild.childNodes:P[1]=="<table>"&&N.indexOf("<tbody")<0?K.childNodes:[];for(var L=M.length-1;L>=0;--L){if(n.nodeName(M[L],"tbody")&&!M[L].childNodes.length){M[L].parentNode.removeChild(M[L])}}}if(!n.support.leadingWhitespace&&/^\s/.test(Q)){K.insertBefore(J.createTextNode(Q.match(/^\s*/)[0]),K.firstChild)}Q=n.makeArray(K.childNodes)}if(Q.nodeType){F.push(Q)}else{F=n.merge(F,Q)}});if(H){for(var I=0;F[I];I++){if(n.nodeName(F[I],"script")&&(!F[I].type||F[I].type.toLowerCase()==="text/javascript")){D.push(F[I].parentNode?F[I].parentNode.removeChild(F[I]):F[I])}else{if(F[I].nodeType===1){F.splice.apply(F,[I+1,0].concat(n.makeArray(F[I].getElementsByTagName("script"))))}H.appendChild(F[I])}}return D}return F},attr:function(I,F,J){if(!I||I.nodeType==3||I.nodeType==8){return g}var G=!n.isXMLDoc(I),K=J!==g;F=G&&n.props[F]||F;if(I.tagName){var E=/href|src|style/.test(F);if(F=="selected"&&I.parentNode){I.parentNode.selectedIndex}if(F in I&&G&&!E){if(K){if(F=="type"&&n.nodeName(I,"input")&&I.parentNode){throw"type property can't be changed"}I[F]=J}if(n.nodeName(I,"form")&&I.getAttributeNode(F)){return I.getAttributeNode(F).nodeValue}if(F=="tabIndex"){var H=I.getAttributeNode("tabIndex");return H&&H.specified?H.value:I.nodeName.match(/^(a|area|button|input|object|select|textarea)$/i)?0:g}return I[F]}if(!n.support.style&&G&&F=="style"){return n.attr(I.style,"cssText",J)}if(K){I.setAttribute(F,""+J)}var D=!n.support.hrefNormalized&&G&&E?I.getAttribute(F,2):I.getAttribute(F);return D===null?g:D}if(!n.support.opacity&&F=="opacity"){if(K){I.zoom=1;I.filter=(I.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(J)+""=="NaN"?"":"alpha(opacity="+J*100+")")}return I.filter&&I.filter.indexOf("opacity=")>=0?(parseFloat(I.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}F=F.replace(/-([a-z])/ig,function(L,M){return M.toUpperCase()});if(K){I[F]=J}return I[F]},trim:function(D){return(D||"").replace(/^\s+|\s+$/g,"")},makeArray:function(F){var D=[];if(F!=null){var E=F.length;if(E==null||typeof F==="string"||n.isFunction(F)||F.setInterval){D[0]=F}else{while(E){D[--E]=F[E]}}}return D},inArray:function(F,G){for(var D=0,E=G.length;D<E;D++){if(G[D]===F){return D}}return -1},merge:function(G,D){var E=0,F,H=G.length;if(!n.support.getAll){while((F=D[E++])!=null){if(F.nodeType!=8){G[H++]=F}}}else{while((F=D[E++])!=null){G[H++]=F}}return G},unique:function(J){var E=[],D={};try{for(var F=0,G=J.length;F<G;F++){var I=n.data(J[F]);if(!D[I]){D[I]=true;E.push(J[F])}}}catch(H){E=J}return E},grep:function(E,I,D){var F=[];for(var G=0,H=E.length;G<H;G++){if(!D!=!I(E[G],G)){F.push(E[G])}}return F},map:function(D,I){var E=[];for(var F=0,G=D.length;F<G;F++){var H=I(D[F],F);if(H!=null){E[E.length]=H}}return E.concat.apply([],E)}});var B=navigator.userAgent.toLowerCase();n.browser={version:(B.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(B),opera:/opera/.test(B),msie:/msie/.test(B)&&!/opera/.test(B),mozilla:/mozilla/.test(B)&&!/(compatible|webkit)/.test(B)};n.each({parent:function(D){return D.parentNode},parents:function(D){return n.dir(D,"parentNode")},next:function(D){return n.nth(D,2,"nextSibling")},prev:function(D){return n.nth(D,2,"previousSibling")},nextAll:function(D){return n.dir(D,"nextSibling")},prevAll:function(D){return n.dir(D,"previousSibling")},siblings:function(D){return n.sibling(D.parentNode.firstChild,D)},children:function(D){return n.sibling(D.firstChild)},contents:function(D){return n.nodeName(D,"iframe")?D.contentDocument||D.contentWindow.document:n.makeArray(D.childNodes)}},function(D,E){n.fn[D]=function(F){var G=n.map(this,E);if(F&&typeof F=="string"){G=n.multiFilter(F,G)}return this.pushStack(n.unique(G),D,F)}});n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(D,E){n.fn[D]=function(){var F=arguments;return this.each(function(){for(var G=0,H=F.length;G<H;G++){n(F[G])[E](this)}})}});n.each({removeAttr:function(D){n.attr(this,D,"");if(this.nodeType==1){this.removeAttribute(D)}},addClass:function(D){n.className.add(this,D)},removeClass:function(D){n.className.remove(this,D)},toggleClass:function(E,D){if(typeof D!=="boolean"){D=!n.className.has(this,E)}n.className[D?"add":"remove"](this,E)},remove:function(D){if(!D||n.filter(D,[this]).length){n("*",this).add([this]).each(function(){n.event.remove(this);n.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){n(">*",this).remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(D,E){n.fn[D]=function(){return this.each(E,arguments)}});function j(D,E){return D[0]&&parseInt(n.curCSS(D[0],E,true),10)||0}var h="jQuery"+e(),u=0,z={};n.extend({cache:{},data:function(E,D,F){E=E==l?z:E;var G=E[h];if(!G){G=E[h]=++u}if(D&&!n.cache[G]){n.cache[G]={}}if(F!==g){n.cache[G][D]=F}return D?n.cache[G][D]:G},removeData:function(E,D){E=E==l?z:E;var G=E[h];if(D){if(n.cache[G]){delete n.cache[G][D];D="";for(D in n.cache[G]){break}if(!D){n.removeData(E)}}}else{try{delete E[h]}catch(F){if(E.removeAttribute){E.removeAttribute(h)}}delete n.cache[G]}},queue:function(E,D,G){if(E){D=(D||"fx")+"queue";var F=n.data(E,D);if(!F||n.isArray(G)){F=n.data(E,D,n.makeArray(G))}else{if(G){F.push(G)}}}return F},dequeue:function(G,F){var D=n.queue(G,F),E=D.shift();if(!F||F==="fx"){E=D[0]}if(E!==g){E.call(G)}}});n.fn.extend({data:function(D,F){var G=D.split(".");G[1]=G[1]?"."+G[1]:"";if(F===g){var E=this.triggerHandler("getData"+G[1]+"!",[G[0]]);if(E===g&&this.length){E=n.data(this[0],D)}return E===g&&G[1]?this.data(G[0]):E}else{return this.trigger("setData"+G[1]+"!",[G[0],F]).each(function(){n.data(this,D,F)})}},removeData:function(D){return this.each(function(){n.removeData(this,D)})},queue:function(D,E){if(typeof D!=="string"){E=D;D="fx"}if(E===g){return n.queue(this[0],D)}return this.each(function(){var F=n.queue(this,D,E);if(D=="fx"&&F.length==1){F[0].call(this)}})},dequeue:function(D){return this.each(function(){n.dequeue(this,D)})}});
|
13
|
-
/*
|
14
|
-
* Sizzle CSS Selector Engine - v0.9.1
|
15
|
-
* Copyright 2009, The Dojo Foundation
|
16
|
-
* Released under the MIT, BSD, and GPL Licenses.
|
17
|
-
* More information: http://sizzlejs.com/
|
18
|
-
*/
|
19
|
-
(function(){var N=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,I=0,F=Object.prototype.toString;var E=function(ae,S,aa,V){aa=aa||[];S=S||document;if(S.nodeType!==1&&S.nodeType!==9){return[]}if(!ae||typeof ae!=="string"){return aa}var ab=[],ac,Y,ah,ag,Z,R,Q=true;N.lastIndex=0;while((ac=N.exec(ae))!==null){ab.push(ac[1]);if(ac[2]){R=RegExp.rightContext;break}}if(ab.length>1&&G.match.POS.exec(ae)){if(ab.length===2&&G.relative[ab[0]]){var U="",X;while((X=G.match.POS.exec(ae))){U+=X[0];ae=ae.replace(G.match.POS,"")}Y=E.filter(U,E(/\s$/.test(ae)?ae+"*":ae,S))}else{Y=G.relative[ab[0]]?[S]:E(ab.shift(),S);while(ab.length){var P=[];ae=ab.shift();if(G.relative[ae]){ae+=ab.shift()}for(var af=0,ad=Y.length;af<ad;af++){E(ae,Y[af],P)}Y=P}}}else{var ai=V?{expr:ab.pop(),set:D(V)}:E.find(ab.pop(),ab.length===1&&S.parentNode?S.parentNode:S);Y=E.filter(ai.expr,ai.set);if(ab.length>0){ah=D(Y)}else{Q=false}while(ab.length){var T=ab.pop(),W=T;if(!G.relative[T]){T=""}else{W=ab.pop()}if(W==null){W=S}G.relative[T](ah,W,M(S))}}if(!ah){ah=Y}if(!ah){throw"Syntax error, unrecognized expression: "+(T||ae)}if(F.call(ah)==="[object Array]"){if(!Q){aa.push.apply(aa,ah)}else{if(S.nodeType===1){for(var af=0;ah[af]!=null;af++){if(ah[af]&&(ah[af]===true||ah[af].nodeType===1&&H(S,ah[af]))){aa.push(Y[af])}}}else{for(var af=0;ah[af]!=null;af++){if(ah[af]&&ah[af].nodeType===1){aa.push(Y[af])}}}}}else{D(ah,aa)}if(R){E(R,S,aa,V)}return aa};E.matches=function(P,Q){return E(P,null,null,Q)};E.find=function(V,S){var W,Q;if(!V){return[]}for(var R=0,P=G.order.length;R<P;R++){var T=G.order[R],Q;if((Q=G.match[T].exec(V))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){Q[1]=(Q[1]||"").replace(/\\/g,"");W=G.find[T](Q,S);if(W!=null){V=V.replace(G.match[T],"");break}}}}if(!W){W=S.getElementsByTagName("*")}return{set:W,expr:V}};E.filter=function(S,ac,ad,T){var Q=S,Y=[],ah=ac,V,ab;while(S&&ac.length){for(var U in G.filter){if((V=G.match[U].exec(S))!=null){var Z=G.filter[U],R=null,X=0,aa,ag;ab=false;if(ah==Y){Y=[]}if(G.preFilter[U]){V=G.preFilter[U](V,ah,ad,Y,T);if(!V){ab=aa=true}else{if(V===true){continue}else{if(V[0]===true){R=[];var W=null,af;for(var ae=0;(af=ah[ae])!==g;ae++){if(af&&W!==af){R.push(af);W=af}}}}}}if(V){for(var ae=0;(ag=ah[ae])!==g;ae++){if(ag){if(R&&ag!=R[X]){X++}aa=Z(ag,V,X,R);var P=T^!!aa;if(ad&&aa!=null){if(P){ab=true}else{ah[ae]=false}}else{if(P){Y.push(ag);ab=true}}}}}if(aa!==g){if(!ad){ah=Y}S=S.replace(G.match[U],"");if(!ab){return[]}break}}}S=S.replace(/\s*,\s*/,"");if(S==Q){if(ab==null){throw"Syntax error, unrecognized expression: "+S}else{break}}Q=S}return ah};var G=E.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(P){return P.getAttribute("href")}},relative:{"+":function(T,Q){for(var R=0,P=T.length;R<P;R++){var S=T[R];if(S){var U=S.previousSibling;while(U&&U.nodeType!==1){U=U.previousSibling}T[R]=typeof Q==="string"?U||false:U===Q}}if(typeof Q==="string"){E.filter(Q,T,true)}},">":function(U,Q,V){if(typeof Q==="string"&&!/\W/.test(Q)){Q=V?Q:Q.toUpperCase();for(var R=0,P=U.length;R<P;R++){var T=U[R];if(T){var S=T.parentNode;U[R]=S.nodeName===Q?S:false}}}else{for(var R=0,P=U.length;R<P;R++){var T=U[R];if(T){U[R]=typeof Q==="string"?T.parentNode:T.parentNode===Q}}if(typeof Q==="string"){E.filter(Q,U,true)}}},"":function(S,Q,U){var R="done"+(I++),P=O;if(!Q.match(/\W/)){var T=Q=U?Q:Q.toUpperCase();P=L}P("parentNode",Q,R,S,T,U)},"~":function(S,Q,U){var R="done"+(I++),P=O;if(typeof Q==="string"&&!Q.match(/\W/)){var T=Q=U?Q:Q.toUpperCase();P=L}P("previousSibling",Q,R,S,T,U)}},find:{ID:function(Q,R){if(R.getElementById){var P=R.getElementById(Q[1]);return P?[P]:[]}},NAME:function(P,Q){return Q.getElementsByName?Q.getElementsByName(P[1]):null},TAG:function(P,Q){return Q.getElementsByTagName(P[1])}},preFilter:{CLASS:function(S,Q,R,P,U){S=" "+S[1].replace(/\\/g,"")+" ";for(var T=0;Q[T];T++){if(U^(" "+Q[T].className+" ").indexOf(S)>=0){if(!R){P.push(Q[T])}}else{if(R){Q[T]=false}}}return false},ID:function(P){return P[1].replace(/\\/g,"")},TAG:function(Q,P){for(var R=0;!P[R];R++){}return M(P[R])?Q[1]:Q[1].toUpperCase()},CHILD:function(P){if(P[1]=="nth"){var Q=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(P[2]=="even"&&"2n"||P[2]=="odd"&&"2n+1"||!/\D/.test(P[2])&&"0n+"+P[2]||P[2]);P[2]=(Q[1]+(Q[2]||1))-0;P[3]=Q[3]-0}P[0]="done"+(I++);return P},ATTR:function(Q){var P=Q[1];if(G.attrMap[P]){Q[1]=G.attrMap[P]}if(Q[2]==="~="){Q[4]=" "+Q[4]+" "}return Q},PSEUDO:function(T,Q,R,P,U){if(T[1]==="not"){if(T[3].match(N).length>1){T[3]=E(T[3],null,null,Q)}else{var S=E.filter(T[3],Q,R,true^U);if(!R){P.push.apply(P,S)}return false}}else{if(G.match.POS.test(T[0])){return true}}return T},POS:function(P){P.unshift(true);return P}},filters:{enabled:function(P){return P.disabled===false&&P.type!=="hidden"},disabled:function(P){return P.disabled===true},checked:function(P){return P.checked===true},selected:function(P){P.parentNode.selectedIndex;return P.selected===true},parent:function(P){return !!P.firstChild},empty:function(P){return !P.firstChild},has:function(R,Q,P){return !!E(P[3],R).length},header:function(P){return/h\d/i.test(P.nodeName)},text:function(P){return"text"===P.type},radio:function(P){return"radio"===P.type},checkbox:function(P){return"checkbox"===P.type},file:function(P){return"file"===P.type},password:function(P){return"password"===P.type},submit:function(P){return"submit"===P.type},image:function(P){return"image"===P.type},reset:function(P){return"reset"===P.type},button:function(P){return"button"===P.type||P.nodeName.toUpperCase()==="BUTTON"},input:function(P){return/input|select|textarea|button/i.test(P.nodeName)}},setFilters:{first:function(Q,P){return P===0},last:function(R,Q,P,S){return Q===S.length-1},even:function(Q,P){return P%2===0},odd:function(Q,P){return P%2===1},lt:function(R,Q,P){return Q<P[3]-0},gt:function(R,Q,P){return Q>P[3]-0},nth:function(R,Q,P){return P[3]-0==Q},eq:function(R,Q,P){return P[3]-0==Q}},filter:{CHILD:function(P,S){var V=S[1],W=P.parentNode;var U="child"+W.childNodes.length;if(W&&(!W[U]||!P.nodeIndex)){var T=1;for(var Q=W.firstChild;Q;Q=Q.nextSibling){if(Q.nodeType==1){Q.nodeIndex=T++}}W[U]=T-1}if(V=="first"){return P.nodeIndex==1}else{if(V=="last"){return P.nodeIndex==W[U]}else{if(V=="only"){return W[U]==1}else{if(V=="nth"){var Y=false,R=S[2],X=S[3];if(R==1&&X==0){return true}if(R==0){if(P.nodeIndex==X){Y=true}}else{if((P.nodeIndex-X)%R==0&&(P.nodeIndex-X)/R>=0){Y=true}}return Y}}}}},PSEUDO:function(V,R,S,W){var Q=R[1],T=G.filters[Q];if(T){return T(V,S,R,W)}else{if(Q==="contains"){return(V.textContent||V.innerText||"").indexOf(R[3])>=0}else{if(Q==="not"){var U=R[3];for(var S=0,P=U.length;S<P;S++){if(U[S]===V){return false}}return true}}}},ID:function(Q,P){return Q.nodeType===1&&Q.getAttribute("id")===P},TAG:function(Q,P){return(P==="*"&&Q.nodeType===1)||Q.nodeName===P},CLASS:function(Q,P){return P.test(Q.className)},ATTR:function(T,R){var P=G.attrHandle[R[1]]?G.attrHandle[R[1]](T):T[R[1]]||T.getAttribute(R[1]),U=P+"",S=R[2],Q=R[4];return P==null?false:S==="="?U===Q:S==="*="?U.indexOf(Q)>=0:S==="~="?(" "+U+" ").indexOf(Q)>=0:!R[4]?P:S==="!="?U!=Q:S==="^="?U.indexOf(Q)===0:S==="$="?U.substr(U.length-Q.length)===Q:S==="|="?U===Q||U.substr(0,Q.length+1)===Q+"-":false},POS:function(T,Q,R,U){var P=Q[2],S=G.setFilters[P];if(S){return S(T,R,Q,U)}}}};for(var K in G.match){G.match[K]=RegExp(G.match[K].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var D=function(Q,P){Q=Array.prototype.slice.call(Q);if(P){P.push.apply(P,Q);return P}return Q};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(J){D=function(T,S){var Q=S||[];if(F.call(T)==="[object Array]"){Array.prototype.push.apply(Q,T)}else{if(typeof T.length==="number"){for(var R=0,P=T.length;R<P;R++){Q.push(T[R])}}else{for(var R=0;T[R];R++){Q.push(T[R])}}}return Q}}(function(){var Q=document.createElement("form"),R="script"+(new Date).getTime();Q.innerHTML="<input name='"+R+"'/>";var P=document.documentElement;P.insertBefore(Q,P.firstChild);if(!!document.getElementById(R)){G.find.ID=function(T,U){if(U.getElementById){var S=U.getElementById(T[1]);return S?S.id===T[1]||S.getAttributeNode&&S.getAttributeNode("id").nodeValue===T[1]?[S]:g:[]}};G.filter.ID=function(U,S){var T=U.getAttributeNode&&U.getAttributeNode("id");return U.nodeType===1&&T&&T.nodeValue===S}}P.removeChild(Q)})();(function(){var P=document.createElement("div");P.appendChild(document.createComment(""));if(P.getElementsByTagName("*").length>0){G.find.TAG=function(Q,U){var T=U.getElementsByTagName(Q[1]);if(Q[1]==="*"){var S=[];for(var R=0;T[R];R++){if(T[R].nodeType===1){S.push(T[R])}}T=S}return T}}P.innerHTML="<a href='#'></a>";if(P.firstChild.getAttribute("href")!=="#"){G.attrHandle.href=function(Q){return Q.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var P=E;E=function(T,S,Q,R){S=S||document;if(!R&&S.nodeType===9){try{return D(S.querySelectorAll(T),Q)}catch(U){}}return P(T,S,Q,R)};E.find=P.find;E.filter=P.filter;E.selectors=P.selectors;E.matches=P.matches})()}if(document.documentElement.getElementsByClassName){G.order.splice(1,0,"CLASS");G.find.CLASS=function(P,Q){return Q.getElementsByClassName(P[1])}}function L(Q,W,V,Z,X,Y){for(var T=0,R=Z.length;T<R;T++){var P=Z[T];if(P){P=P[Q];var U=false;while(P&&P.nodeType){var S=P[V];if(S){U=Z[S];break}if(P.nodeType===1&&!Y){P[V]=T}if(P.nodeName===W){U=P;break}P=P[Q]}Z[T]=U}}}function O(Q,V,U,Y,W,X){for(var S=0,R=Y.length;S<R;S++){var P=Y[S];if(P){P=P[Q];var T=false;while(P&&P.nodeType){if(P[U]){T=Y[P[U]];break}if(P.nodeType===1){if(!X){P[U]=S}if(typeof V!=="string"){if(P===V){T=true;break}}else{if(E.filter(V,[P]).length>0){T=P;break}}}P=P[Q]}Y[S]=T}}}var H=document.compareDocumentPosition?function(Q,P){return Q.compareDocumentPosition(P)&16}:function(Q,P){return Q!==P&&(Q.contains?Q.contains(P):true)};var M=function(P){return P.documentElement&&!P.body||P.tagName&&P.ownerDocument&&!P.ownerDocument.body};n.find=E;n.filter=E.filter;n.expr=E.selectors;n.expr[":"]=n.expr.filters;E.selectors.filters.hidden=function(P){return"hidden"===P.type||n.css(P,"display")==="none"||n.css(P,"visibility")==="hidden"};E.selectors.filters.visible=function(P){return"hidden"!==P.type&&n.css(P,"display")!=="none"&&n.css(P,"visibility")!=="hidden"};E.selectors.filters.animated=function(P){return n.grep(n.timers,function(Q){return P===Q.elem}).length};n.multiFilter=function(R,P,Q){if(Q){R=":not("+R+")"}return E.matches(R,P)};n.dir=function(R,Q){var P=[],S=R[Q];while(S&&S!=document){if(S.nodeType==1){P.push(S)}S=S[Q]}return P};n.nth=function(T,P,R,S){P=P||1;var Q=0;for(;T;T=T[R]){if(T.nodeType==1&&++Q==P){break}}return T};n.sibling=function(R,Q){var P=[];for(;R;R=R.nextSibling){if(R.nodeType==1&&R!=Q){P.push(R)}}return P};return;l.Sizzle=E})();n.event={add:function(H,E,G,J){if(H.nodeType==3||H.nodeType==8){return}if(H.setInterval&&H!=l){H=l}if(!G.guid){G.guid=this.guid++}if(J!==g){var F=G;G=this.proxy(F);G.data=J}var D=n.data(H,"events")||n.data(H,"events",{}),I=n.data(H,"handle")||n.data(H,"handle",function(){return typeof n!=="undefined"&&!n.event.triggered?n.event.handle.apply(arguments.callee.elem,arguments):g});I.elem=H;n.each(E.split(/\s+/),function(L,M){var N=M.split(".");M=N.shift();G.type=N.slice().sort().join(".");var K=D[M];if(n.event.specialAll[M]){n.event.specialAll[M].setup.call(H,J,N)}if(!K){K=D[M]={};if(!n.event.special[M]||n.event.special[M].setup.call(H,J,N)===false){if(H.addEventListener){H.addEventListener(M,I,false)}else{if(H.attachEvent){H.attachEvent("on"+M,I)}}}}K[G.guid]=G;n.event.global[M]=true});H=null},guid:1,global:{},remove:function(J,G,I){if(J.nodeType==3||J.nodeType==8){return}var F=n.data(J,"events"),E,D;if(F){if(G===g||(typeof G==="string"&&G.charAt(0)==".")){for(var H in F){this.remove(J,H+(G||""))}}else{if(G.type){I=G.handler;G=G.type}n.each(G.split(/\s+/),function(L,N){var P=N.split(".");N=P.shift();var M=RegExp("(^|\\.)"+P.slice().sort().join(".*\\.")+"(\\.|$)");if(F[N]){if(I){delete F[N][I.guid]}else{for(var O in F[N]){if(M.test(F[N][O].type)){delete F[N][O]}}}if(n.event.specialAll[N]){n.event.specialAll[N].teardown.call(J,P)}for(E in F[N]){break}if(!E){if(!n.event.special[N]||n.event.special[N].teardown.call(J,P)===false){if(J.removeEventListener){J.removeEventListener(N,n.data(J,"handle"),false)}else{if(J.detachEvent){J.detachEvent("on"+N,n.data(J,"handle"))}}}E=null;delete F[N]}}})}for(E in F){break}if(!E){var K=n.data(J,"handle");if(K){K.elem=null}n.removeData(J,"events");n.removeData(J,"handle")}}},trigger:function(H,J,G,D){var F=H.type||H;if(!D){H=typeof H==="object"?H[h]?H:n.extend(n.Event(F),H):n.Event(F);if(F.indexOf("!")>=0){H.type=F=F.slice(0,-1);H.exclusive=true}if(!G){H.stopPropagation();if(this.global[F]){n.each(n.cache,function(){if(this.events&&this.events[F]){n.event.trigger(H,J,this.handle.elem)}})}}if(!G||G.nodeType==3||G.nodeType==8){return g}H.result=g;H.target=G;J=n.makeArray(J);J.unshift(H)}H.currentTarget=G;var I=n.data(G,"handle");if(I){I.apply(G,J)}if((!G[F]||(n.nodeName(G,"a")&&F=="click"))&&G["on"+F]&&G["on"+F].apply(G,J)===false){H.result=false}if(!D&&G[F]&&!H.isDefaultPrevented()&&!(n.nodeName(G,"a")&&F=="click")){this.triggered=true;try{G[F]()}catch(K){}}this.triggered=false;if(!H.isPropagationStopped()){var E=G.parentNode||G.ownerDocument;if(E){n.event.trigger(H,J,E,true)}}},handle:function(J){var I,D;J=arguments[0]=n.event.fix(J||l.event);var K=J.type.split(".");J.type=K.shift();I=!K.length&&!J.exclusive;var H=RegExp("(^|\\.)"+K.slice().sort().join(".*\\.")+"(\\.|$)");D=(n.data(this,"events")||{})[J.type];for(var F in D){var G=D[F];if(I||H.test(G.type)){J.handler=G;J.data=G.data;var E=G.apply(this,arguments);if(E!==g){J.result=E;if(E===false){J.preventDefault();J.stopPropagation()}}if(J.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(G){if(G[h]){return G}var E=G;G=n.Event(E);for(var F=this.props.length,I;F;){I=this.props[--F];G[I]=E[I]}if(!G.target){G.target=G.srcElement||document}if(G.target.nodeType==3){G.target=G.target.parentNode}if(!G.relatedTarget&&G.fromElement){G.relatedTarget=G.fromElement==G.target?G.toElement:G.fromElement}if(G.pageX==null&&G.clientX!=null){var H=document.documentElement,D=document.body;G.pageX=G.clientX+(H&&H.scrollLeft||D&&D.scrollLeft||0)-(H.clientLeft||0);G.pageY=G.clientY+(H&&H.scrollTop||D&&D.scrollTop||0)-(H.clientTop||0)}if(!G.which&&((G.charCode||G.charCode===0)?G.charCode:G.keyCode)){G.which=G.charCode||G.keyCode}if(!G.metaKey&&G.ctrlKey){G.metaKey=G.ctrlKey}if(!G.which&&G.button){G.which=(G.button&1?1:(G.button&2?3:(G.button&4?2:0)))}return G},proxy:function(E,D){D=D||function(){return E.apply(this,arguments)};D.guid=E.guid=E.guid||D.guid||this.guid++;return D},special:{ready:{setup:A,teardown:function(){}}},specialAll:{live:{setup:function(D,E){n.event.add(this,E[0],c)},teardown:function(F){if(F.length){var D=0,E=RegExp("(^|\\.)"+F[0]+"(\\.|$)");n.each((n.data(this,"events").live||{}),function(){if(E.test(this.type)){D++}});if(D<1){n.event.remove(this,F[0],c)}}}}}};n.Event=function(D){if(!this.preventDefault){return new n.Event(D)}if(D&&D.type){this.originalEvent=D;this.type=D.type;this.timeStamp=D.timeStamp}else{this.type=D}if(!this.timeStamp){this.timeStamp=e()}this[h]=true};function k(){return false}function t(){return true}n.Event.prototype={preventDefault:function(){this.isDefaultPrevented=t;var D=this.originalEvent;if(!D){return}if(D.preventDefault){D.preventDefault()}D.returnValue=false},stopPropagation:function(){this.isPropagationStopped=t;var D=this.originalEvent;if(!D){return}if(D.stopPropagation){D.stopPropagation()}D.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=t;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(E){var D=E.relatedTarget;while(D&&D!=this){try{D=D.parentNode}catch(F){D=this}}if(D!=this){E.type=E.data;n.event.handle.apply(this,arguments)}};n.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(E,D){n.event.special[D]={setup:function(){n.event.add(this,E,a,D)},teardown:function(){n.event.remove(this,E,a)}}});n.fn.extend({bind:function(E,F,D){return E=="unload"?this.one(E,F,D):this.each(function(){n.event.add(this,E,D||F,D&&F)})},one:function(F,G,E){var D=n.event.proxy(E||G,function(H){n(this).unbind(H,D);return(E||G).apply(this,arguments)});return this.each(function(){n.event.add(this,F,D,E&&G)})},unbind:function(E,D){return this.each(function(){n.event.remove(this,E,D)})},trigger:function(D,E){return this.each(function(){n.event.trigger(D,E,this)})},triggerHandler:function(D,F){if(this[0]){var E=n.Event(D);E.preventDefault();E.stopPropagation();n.event.trigger(E,F,this[0]);return E.result}},toggle:function(F){var D=arguments,E=1;while(E<D.length){n.event.proxy(F,D[E++])}return this.click(n.event.proxy(F,function(G){this.lastToggle=(this.lastToggle||0)%E;G.preventDefault();return D[this.lastToggle++].apply(this,arguments)||false}))},hover:function(D,E){return this.mouseenter(D).mouseleave(E)},ready:function(D){A();if(n.isReady){D.call(document,n)}else{n.readyList.push(D)}return this},live:function(F,E){var D=n.event.proxy(E);D.guid+=this.selector+F;n(document).bind(i(F,this.selector),this.selector,D);return this},die:function(E,D){n(document).unbind(i(E,this.selector),D?{guid:D.guid+this.selector+E}:null);return this}});function c(G){var D=RegExp("(^|\\.)"+G.type+"(\\.|$)"),F=true,E=[];n.each(n.data(this,"events").live||[],function(H,I){if(D.test(I.type)){var J=n(G.target).closest(I.data)[0];if(J){E.push({elem:J,fn:I})}}});n.each(E,function(){if(!G.isImmediatePropagationStopped()&&this.fn.call(this.elem,G,this.fn.data)===false){F=false}});return F}function i(E,D){return["live",E,D.replace(/\./g,"`").replace(/ /g,"|")].join(".")}n.extend({isReady:false,readyList:[],ready:function(){if(!n.isReady){n.isReady=true;if(n.readyList){n.each(n.readyList,function(){this.call(document,n)});n.readyList=null}n(document).triggerHandler("ready")}}});var w=false;function A(){if(w){return}w=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);n.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);n.ready()}});if(document.documentElement.doScroll&&!l.frameElement){(function(){if(n.isReady){return}try{document.documentElement.doScroll("left")}catch(D){setTimeout(arguments.callee,0);return}n.ready()})()}}}n.event.add(l,"load",n.ready)}n.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(E,D){n.fn[D]=function(F){return F?this.bind(D,F):this.trigger(D)}});n(l).bind("unload",function(){for(var D in n.cache){if(D!=1&&n.cache[D].handle){n.event.remove(n.cache[D].handle.elem)}}});(function(){n.support={};var E=document.documentElement,F=document.createElement("script"),J=document.createElement("div"),I="script"+(new Date).getTime();J.style.display="none";J.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var G=J.getElementsByTagName("*"),D=J.getElementsByTagName("a")[0];if(!G||!G.length||!D){return}n.support={leadingWhitespace:J.firstChild.nodeType==3,tbody:!J.getElementsByTagName("tbody").length,objectAll:!!J.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!J.getElementsByTagName("link").length,style:/red/.test(D.getAttribute("style")),hrefNormalized:D.getAttribute("href")==="/a",opacity:D.style.opacity==="0.5",cssFloat:!!D.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};F.type="text/javascript";try{F.appendChild(document.createTextNode("window."+I+"=1;"))}catch(H){}E.insertBefore(F,E.firstChild);if(l[I]){n.support.scriptEval=true;delete l[I]}E.removeChild(F);if(J.attachEvent&&J.fireEvent){J.attachEvent("onclick",function(){n.support.noCloneEvent=false;J.detachEvent("onclick",arguments.callee)});J.cloneNode(true).fireEvent("onclick")}n(function(){var K=document.createElement("div");K.style.width="1px";K.style.paddingLeft="1px";document.body.appendChild(K);n.boxModel=n.support.boxModel=K.offsetWidth===2;document.body.removeChild(K)})})();var v=n.support.cssFloat?"cssFloat":"styleFloat";n.props={"for":"htmlFor","class":"className","float":v,cssFloat:v,styleFloat:v,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};n.fn.extend({_load:n.fn.load,load:function(F,I,J){if(typeof F!=="string"){return this._load(F)}var H=F.indexOf(" ");if(H>=0){var D=F.slice(H,F.length);F=F.slice(0,H)}var G="GET";if(I){if(n.isFunction(I)){J=I;I=null}else{if(typeof I==="object"){I=n.param(I);G="POST"}}}var E=this;n.ajax({url:F,type:G,dataType:"html",data:I,complete:function(L,K){if(K=="success"||K=="notmodified"){E.html(D?n("<div/>").append(L.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(D):L.responseText)}if(J){E.each(J,[L.responseText,K,L])}}});return this},serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?n.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type))}).map(function(D,E){var F=n(this).val();return F==null?null:n.isArray(F)?n.map(F,function(H,G){return{name:E.name,value:H}}):{name:E.name,value:F}}).get()}});n.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(D,E){n.fn[E]=function(F){return this.bind(E,F)}});var q=e();n.extend({get:function(D,F,G,E){if(n.isFunction(F)){G=F;F=null}return n.ajax({type:"GET",url:D,data:F,success:G,dataType:E})},getScript:function(D,E){return n.get(D,null,E,"script")},getJSON:function(D,E,F){return n.get(D,E,F,"json")},post:function(D,F,G,E){if(n.isFunction(F)){G=F;F={}}return n.ajax({type:"POST",url:D,data:F,success:G,dataType:E})},ajaxSetup:function(D){n.extend(n.ajaxSettings,D)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(L){L=n.extend(true,L,n.extend(true,{},n.ajaxSettings,L));var V,E=/=\?(&|$)/g,Q,U,F=L.type.toUpperCase();if(L.data&&L.processData&&typeof L.data!=="string"){L.data=n.param(L.data)}if(L.dataType=="jsonp"){if(F=="GET"){if(!L.url.match(E)){L.url+=(L.url.match(/\?/)?"&":"?")+(L.jsonp||"callback")+"=?"}}else{if(!L.data||!L.data.match(E)){L.data=(L.data?L.data+"&":"")+(L.jsonp||"callback")+"=?"}}L.dataType="json"}if(L.dataType=="json"&&(L.data&&L.data.match(E)||L.url.match(E))){V="jsonp"+q++;if(L.data){L.data=(L.data+"").replace(E,"="+V+"$1")}L.url=L.url.replace(E,"="+V+"$1");L.dataType="script";l[V]=function(W){U=W;H();K();l[V]=g;try{delete l[V]}catch(X){}if(G){G.removeChild(S)}}}if(L.dataType=="script"&&L.cache==null){L.cache=false}if(L.cache===false&&F=="GET"){var D=e();var T=L.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+D+"$2");L.url=T+((T==L.url)?(L.url.match(/\?/)?"&":"?")+"_="+D:"")}if(L.data&&F=="GET"){L.url+=(L.url.match(/\?/)?"&":"?")+L.data;L.data=null}if(L.global&&!n.active++){n.event.trigger("ajaxStart")}var P=/^(\w+:)?\/\/([^\/?#]+)/.exec(L.url);if(L.dataType=="script"&&F=="GET"&&P&&(P[1]&&P[1]!=location.protocol||P[2]!=location.host)){var G=document.getElementsByTagName("head")[0];var S=document.createElement("script");S.src=L.url;if(L.scriptCharset){S.charset=L.scriptCharset}if(!V){var N=false;S.onload=S.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){N=true;H();K();G.removeChild(S)}}}G.appendChild(S);return g}var J=false;var I=L.xhr();if(L.username){I.open(F,L.url,L.async,L.username,L.password)}else{I.open(F,L.url,L.async)}try{if(L.data){I.setRequestHeader("Content-Type",L.contentType)}if(L.ifModified){I.setRequestHeader("If-Modified-Since",n.lastModified[L.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}I.setRequestHeader("X-Requested-With","XMLHttpRequest");I.setRequestHeader("Accept",L.dataType&&L.accepts[L.dataType]?L.accepts[L.dataType]+", */*":L.accepts._default)}catch(R){}if(L.beforeSend&&L.beforeSend(I,L)===false){if(L.global&&!--n.active){n.event.trigger("ajaxStop")}I.abort();return false}if(L.global){n.event.trigger("ajaxSend",[I,L])}var M=function(W){if(I.readyState==0){if(O){clearInterval(O);O=null;if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}}else{if(!J&&I&&(I.readyState==4||W=="timeout")){J=true;if(O){clearInterval(O);O=null}Q=W=="timeout"?"timeout":!n.httpSuccess(I)?"error":L.ifModified&&n.httpNotModified(I,L.url)?"notmodified":"success";if(Q=="success"){try{U=n.httpData(I,L.dataType,L)}catch(Y){Q="parsererror"}}if(Q=="success"){var X;try{X=I.getResponseHeader("Last-Modified")}catch(Y){}if(L.ifModified&&X){n.lastModified[L.url]=X}if(!V){H()}}else{n.handleError(L,I,Q)}K();if(L.async){I=null}}}};if(L.async){var O=setInterval(M,13);if(L.timeout>0){setTimeout(function(){if(I){if(!J){M("timeout")}if(I){I.abort()}}},L.timeout)}}try{I.send(L.data)}catch(R){n.handleError(L,I,null,R)}if(!L.async){M()}function H(){if(L.success){L.success(U,Q)}if(L.global){n.event.trigger("ajaxSuccess",[I,L])}}function K(){if(L.complete){L.complete(I,Q)}if(L.global){n.event.trigger("ajaxComplete",[I,L])}if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}return I},handleError:function(E,G,D,F){if(E.error){E.error(G,D,F)}if(E.global){n.event.trigger("ajaxError",[G,E,F])}},active:0,httpSuccess:function(E){try{return !E.status&&location.protocol=="file:"||(E.status>=200&&E.status<300)||E.status==304||E.status==1223}catch(D){}return false},httpNotModified:function(F,D){try{var G=F.getResponseHeader("Last-Modified");return F.status==304||G==n.lastModified[D]}catch(E){}return false},httpData:function(I,G,F){var E=I.getResponseHeader("content-type"),D=G=="xml"||!G&&E&&E.indexOf("xml")>=0,H=D?I.responseXML:I.responseText;if(D&&H.documentElement.tagName=="parsererror"){throw"parsererror"}if(F&&F.dataFilter){H=F.dataFilter(H,G)}if(typeof H==="string"){if(G=="script"){n.globalEval(H)}if(G=="json"){H=l["eval"]("("+H+")")}}return H},param:function(D){var F=[];function G(H,I){F[F.length]=encodeURIComponent(H)+"="+encodeURIComponent(I)}if(n.isArray(D)||D.jquery){n.each(D,function(){G(this.name,this.value)})}else{for(var E in D){if(n.isArray(D[E])){n.each(D[E],function(){G(E,this)})}else{G(E,n.isFunction(D[E])?D[E]():D[E])}}}return F.join("&").replace(/%20/g,"+")}});var m={},d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function s(E,D){var F={};n.each(d.concat.apply([],d.slice(0,D)),function(){F[this]=E});return F}n.fn.extend({show:function(I,K){if(I){return this.animate(s("show",3),I,K)}else{for(var G=0,E=this.length;G<E;G++){var D=n.data(this[G],"olddisplay");this[G].style.display=D||"";if(n.css(this[G],"display")==="none"){var F=this[G].tagName,J;if(m[F]){J=m[F]}else{var H=n("<"+F+" />").appendTo("body");J=H.css("display");if(J==="none"){J="block"}H.remove();m[F]=J}this[G].style.display=n.data(this[G],"olddisplay",J)}}return this}},hide:function(G,H){if(G){return this.animate(s("hide",3),G,H)}else{for(var F=0,E=this.length;F<E;F++){var D=n.data(this[F],"olddisplay");if(!D&&D!=="none"){n.data(this[F],"olddisplay",n.css(this[F],"display"))}this[F].style.display="none"}return this}},_toggle:n.fn.toggle,toggle:function(F,E){var D=typeof F==="boolean";return n.isFunction(F)&&n.isFunction(E)?this._toggle.apply(this,arguments):F==null||D?this.each(function(){var G=D?F:n(this).is(":hidden");n(this)[G?"show":"hide"]()}):this.animate(s("toggle",3),F,E)},fadeTo:function(D,F,E){return this.animate({opacity:F},D,E)},animate:function(H,E,G,F){var D=n.speed(E,G,F);return this[D.queue===false?"each":"queue"](function(){var J=n.extend({},D),L,K=this.nodeType==1&&n(this).is(":hidden"),I=this;for(L in H){if(H[L]=="hide"&&K||H[L]=="show"&&!K){return J.complete.call(this)}if((L=="height"||L=="width")&&this.style){J.display=n.css(this,"display");J.overflow=this.style.overflow}}if(J.overflow!=null){this.style.overflow="hidden"}J.curAnim=n.extend({},H);n.each(H,function(N,R){var Q=new n.fx(I,J,N);if(/toggle|show|hide/.test(R)){Q[R=="toggle"?K?"show":"hide":R](H)}else{var P=R.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),S=Q.cur(true)||0;if(P){var M=parseFloat(P[2]),O=P[3]||"px";if(O!="px"){I.style[N]=(M||1)+O;S=((M||1)/Q.cur(true))*S;I.style[N]=S+O}if(P[1]){M=((P[1]=="-="?-1:1)*M)+S}Q.custom(S,M,O)}else{Q.custom(S,R,"")}}});return true})},stop:function(E,D){var F=n.timers;if(E){this.queue([])}this.each(function(){for(var G=F.length-1;G>=0;G--){if(F[G].elem==this){if(D){F[G](true)}F.splice(G,1)}}});if(!D){this.dequeue()}return this}});n.each({slideDown:s("show",1),slideUp:s("hide",1),slideToggle:s("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(D,E){n.fn[D]=function(F,G){return this.animate(E,F,G)}});n.extend({speed:function(F,G,E){var D=typeof F==="object"?F:{complete:E||!E&&G||n.isFunction(F)&&F,duration:F,easing:E&&G||G&&!n.isFunction(G)&&G};D.duration=n.fx.off?0:typeof D.duration==="number"?D.duration:n.fx.speeds[D.duration]||n.fx.speeds._default;D.old=D.complete;D.complete=function(){if(D.queue!==false){n(this).dequeue()}if(n.isFunction(D.old)){D.old.call(this)}};return D},easing:{linear:function(F,G,D,E){return D+E*F},swing:function(F,G,D,E){return((-Math.cos(F*Math.PI)/2)+0.5)*E+D}},timers:[],timerId:null,fx:function(E,D,F){this.options=D;this.elem=E;this.prop=F;if(!D.orig){D.orig={}}}});n.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(n.fx.step[this.prop]||n.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(E){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var D=parseFloat(n.css(this.elem,this.prop,E));return D&&D>-10000?D:parseFloat(n.curCSS(this.elem,this.prop))||0},custom:function(H,G,F){this.startTime=e();this.start=H;this.end=G;this.unit=F||this.unit||"px";this.now=this.start;this.pos=this.state=0;var D=this;function E(I){return D.step(I)}E.elem=this.elem;n.timers.push(E);if(E()&&n.timerId==null){n.timerId=setInterval(function(){var J=n.timers;for(var I=0;I<J.length;I++){if(!J[I]()){J.splice(I--,1)}}if(!J.length){clearInterval(n.timerId);n.timerId=null}},13)}},show:function(){this.options.orig[this.prop]=n.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());n(this.elem).show()},hide:function(){this.options.orig[this.prop]=n.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(G){var F=e();if(G||F>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var D=true;for(var E in this.options.curAnim){if(this.options.curAnim[E]!==true){D=false}}if(D){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(n.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){n(this.elem).hide()}if(this.options.hide||this.options.show){for(var H in this.options.curAnim){n.attr(this.elem.style,H,this.options.orig[H])}}}if(D){this.options.complete.call(this.elem)}return false}else{var I=F-this.startTime;this.state=I/this.options.duration;this.pos=n.easing[this.options.easing||(n.easing.swing?"swing":"linear")](this.state,I,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};n.extend(n.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(D){n.attr(D.elem.style,"opacity",D.now)},_default:function(D){if(D.elem.style&&D.elem.style[D.prop]!=null){D.elem.style[D.prop]=D.now+D.unit}else{D.elem[D.prop]=D.now}}}});if(document.documentElement.getBoundingClientRect){n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}var F=this[0].getBoundingClientRect(),I=this[0].ownerDocument,E=I.body,D=I.documentElement,K=D.clientTop||E.clientTop||0,J=D.clientLeft||E.clientLeft||0,H=F.top+(self.pageYOffset||n.boxModel&&D.scrollTop||E.scrollTop)-K,G=F.left+(self.pageXOffset||n.boxModel&&D.scrollLeft||E.scrollLeft)-J;return{top:H,left:G}}}else{n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}n.offset.initialized||n.offset.initialize();var I=this[0],F=I.offsetParent,E=I,N=I.ownerDocument,L,G=N.documentElement,J=N.body,K=N.defaultView,D=K.getComputedStyle(I,null),M=I.offsetTop,H=I.offsetLeft;while((I=I.parentNode)&&I!==J&&I!==G){L=K.getComputedStyle(I,null);M-=I.scrollTop,H-=I.scrollLeft;if(I===F){M+=I.offsetTop,H+=I.offsetLeft;if(n.offset.doesNotAddBorder&&!(n.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(I.tagName))){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}E=F,F=I.offsetParent}if(n.offset.subtractsBorderForOverflowNotVisible&&L.overflow!=="visible"){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}D=L}if(D.position==="relative"||D.position==="static"){M+=J.offsetTop,H+=J.offsetLeft}if(D.position==="fixed"){M+=Math.max(G.scrollTop,J.scrollTop),H+=Math.max(G.scrollLeft,J.scrollLeft)}return{top:M,left:H}}}n.offset={initialize:function(){if(this.initialized){return}var K=document.body,E=document.createElement("div"),G,F,M,H,L,D,I=K.style.marginTop,J='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"cellpadding="0"cellspacing="0"><tr><td></td></tr></table>';L={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(D in L){E.style[D]=L[D]}E.innerHTML=J;K.insertBefore(E,K.firstChild);G=E.firstChild,F=G.firstChild,H=G.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(F.offsetTop!==5);this.doesAddBorderForTableAndCells=(H.offsetTop===5);G.style.overflow="hidden",G.style.position="relative";this.subtractsBorderForOverflowNotVisible=(F.offsetTop===-5);K.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(K.offsetTop===0);K.style.marginTop=I;K.removeChild(E);this.initialized=true},bodyOffset:function(D){n.offset.initialized||n.offset.initialize();var F=D.offsetTop,E=D.offsetLeft;if(n.offset.doesNotIncludeMarginInBodyOffset){F+=parseInt(n.curCSS(D,"marginTop",true),10)||0,E+=parseInt(n.curCSS(D,"marginLeft",true),10)||0}return{top:F,left:E}}};n.fn.extend({position:function(){var H=0,G=0,E;if(this[0]){var F=this.offsetParent(),I=this.offset(),D=/^body|html$/i.test(F[0].tagName)?{top:0,left:0}:F.offset();I.top-=j(this,"marginTop");I.left-=j(this,"marginLeft");D.top+=j(F,"borderTopWidth");D.left+=j(F,"borderLeftWidth");E={top:I.top-D.top,left:I.left-D.left}}return E},offsetParent:function(){var D=this[0].offsetParent||document.body;while(D&&(!/^body|html$/i.test(D.tagName)&&n.css(D,"position")=="static")){D=D.offsetParent}return n(D)}});n.each(["Left","Top"],function(E,D){var F="scroll"+D;n.fn[F]=function(G){if(!this[0]){return null}return G!==g?this.each(function(){this==l||this==document?l.scrollTo(!E?G:n(l).scrollLeft(),E?G:n(l).scrollTop()):this[F]=G}):this[0]==l||this[0]==document?self[E?"pageYOffset":"pageXOffset"]||n.boxModel&&document.documentElement[F]||document.body[F]:this[0][F]}});n.each(["Height","Width"],function(G,E){var D=G?"Left":"Top",F=G?"Right":"Bottom";n.fn["inner"+E]=function(){return this[E.toLowerCase()]()+j(this,"padding"+D)+j(this,"padding"+F)};n.fn["outer"+E]=function(I){return this["inner"+E]()+j(this,"border"+D+"Width")+j(this,"border"+F+"Width")+(I?j(this,"margin"+D)+j(this,"margin"+F):0)};var H=E.toLowerCase();n.fn[H]=function(I){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+E]||document.body["client"+E]:this[0]==document?Math.max(document.documentElement["client"+E],document.body["scroll"+E],document.documentElement["scroll"+E],document.body["offset"+E],document.documentElement["offset"+E]):I===g?(this.length?n.css(this[0],H):null):this.css(H,typeof I==="string"?I:I+"px")}})})();
|
@@ -1,104 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jQuery.LocalScroll
|
3
|
-
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
4
|
-
* Dual licensed under MIT and GPL.
|
5
|
-
* Date: 6/3/2008
|
6
|
-
*
|
7
|
-
* @projectDescription Animated scrolling navigation, using anchors.
|
8
|
-
* http://flesler.blogspot.com/2007/10/jquerylocalscroll-10.html
|
9
|
-
* @author Ariel Flesler
|
10
|
-
* @version 1.2.6
|
11
|
-
*
|
12
|
-
* @id jQuery.fn.localScroll
|
13
|
-
* @param {Object} settings Hash of settings, it is passed in to jQuery.ScrollTo, none is required.
|
14
|
-
* @return {jQuery} Returns the same jQuery object, for chaining.
|
15
|
-
*
|
16
|
-
* @example $('ul.links').localScroll();
|
17
|
-
*
|
18
|
-
* @example $('ul.links').localScroll({ filter:'.animated', duration:400, axis:'x' });
|
19
|
-
*
|
20
|
-
* @example $.localScroll({ target:'#pane', axis:'xy', queue:true, event:'mouseover' });
|
21
|
-
*
|
22
|
-
* Notes:
|
23
|
-
* - The plugin requires jQuery.ScrollTo.
|
24
|
-
* - The hash of settings, is passed to jQuery.ScrollTo, so the settings are valid for that plugin as well.
|
25
|
-
* - jQuery.localScroll can be used if the desired links, are all over the document, it accepts the same settings.
|
26
|
-
* - If the setting 'lazy' is set to true, then the binding will still work for later added anchors.
|
27
|
-
* - The setting 'speed' is deprecated, use 'duration' instead.
|
28
|
-
* - If onBefore returns false, the event is ignored.
|
29
|
-
**/
|
30
|
-
;(function( $ ){
|
31
|
-
var URI = location.href.replace(/#.*/,'');//local url without hash
|
32
|
-
|
33
|
-
var $localScroll = $.localScroll = function( settings ){
|
34
|
-
$('body').localScroll( settings );
|
35
|
-
};
|
36
|
-
|
37
|
-
//Many of these defaults, belong to jQuery.ScrollTo, check it's demo for an example of each option.
|
38
|
-
//@see http://www.freewebs.com/flesler/jQuery.ScrollTo/
|
39
|
-
$localScroll.defaults = {//the defaults are public and can be overriden.
|
40
|
-
duration:1000, //how long to animate.
|
41
|
-
axis:'y',//which of top and left should be modified.
|
42
|
-
event:'click',//on which event to react.
|
43
|
-
stop:true//avoid queuing animations
|
44
|
-
/*
|
45
|
-
lock:false,//ignore events if already animating
|
46
|
-
lazy:false,//if true, links can be added later, and will still work.
|
47
|
-
target:null, //what to scroll (selector or element). Keep it null if want to scroll the whole window.
|
48
|
-
filter:null, //filter some anchors out of the matched elements.
|
49
|
-
hash: false//if true, the hash of the selected link, will appear on the address bar.
|
50
|
-
*/
|
51
|
-
};
|
52
|
-
|
53
|
-
//if the URL contains a hash, it will scroll to the pointed element
|
54
|
-
$localScroll.hash = function( settings ){
|
55
|
-
settings = $.extend( {}, $localScroll.defaults, settings );
|
56
|
-
settings.hash = false;//can't be true
|
57
|
-
if( location.hash )
|
58
|
-
setTimeout(function(){ scroll( 0, location, settings ); }, 0 );//better wrapped with a setTimeout
|
59
|
-
};
|
60
|
-
|
61
|
-
$.fn.localScroll = function( settings ){
|
62
|
-
settings = $.extend( {}, $localScroll.defaults, settings );
|
63
|
-
|
64
|
-
return ( settings.persistent || settings.lazy )
|
65
|
-
? this.bind( settings.event, function( e ){//use event delegation, more links can be added later.
|
66
|
-
var a = $([e.target, e.target.parentNode]).filter(filter)[0];//if a valid link was clicked.
|
67
|
-
a && scroll( e, a, settings );//do scroll.
|
68
|
-
})
|
69
|
-
: this.find('a,area')//bind concretely, to each matching link
|
70
|
-
.filter( filter ).bind( settings.event, function(e){
|
71
|
-
scroll( e, this, settings );
|
72
|
-
}).end()
|
73
|
-
.end();
|
74
|
-
|
75
|
-
function filter(){//is this a link that points to an anchor and passes a possible filter ? href is checked to avoid a bug in FF.
|
76
|
-
return !!this.href && !!this.hash && this.href.replace(this.hash,'') == URI && (!settings.filter || $(this).is( settings.filter ));
|
77
|
-
};
|
78
|
-
};
|
79
|
-
|
80
|
-
function scroll( e, link, settings ){
|
81
|
-
var id = link.hash.slice(1),
|
82
|
-
elem = document.getElementById(id) || document.getElementsByName(id)[0];
|
83
|
-
if ( elem ){
|
84
|
-
e && e.preventDefault();
|
85
|
-
var $target = $( settings.target || $.scrollTo.window() );//if none specified, then the window.
|
86
|
-
|
87
|
-
if( settings.lock && $target.is(':animated') ||
|
88
|
-
settings.onBefore && settings.onBefore.call(link, e, elem, $target) === false ) return;
|
89
|
-
|
90
|
-
if( settings.stop )
|
91
|
-
$target.queue('fx',[]).stop();//remove all its animations
|
92
|
-
$target
|
93
|
-
.scrollTo( elem, settings )//do scroll
|
94
|
-
.trigger('notify.serialScroll',[elem]);//notify serialScroll about this change
|
95
|
-
if( settings.hash )
|
96
|
-
$target.queue(function(){
|
97
|
-
location = link.hash;
|
98
|
-
// make sure this function is released
|
99
|
-
$(this).dequeue();
|
100
|
-
});
|
101
|
-
}
|
102
|
-
};
|
103
|
-
|
104
|
-
})( jQuery );
|
@@ -1,150 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jQuery.ScrollTo
|
3
|
-
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
4
|
-
* Dual licensed under MIT and GPL.
|
5
|
-
* Date: 2/19/2008
|
6
|
-
*
|
7
|
-
* @projectDescription Easy element scrolling using jQuery.
|
8
|
-
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
9
|
-
* Tested with jQuery 1.2.1. On FF 2.0.0.11, IE 6, Opera 9.22 and Safari 3 beta. on Windows.
|
10
|
-
*
|
11
|
-
* @author Ariel Flesler
|
12
|
-
* @version 1.3.3
|
13
|
-
*
|
14
|
-
* @id jQuery.scrollTo
|
15
|
-
* @id jQuery.fn.scrollTo
|
16
|
-
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
|
17
|
-
* The different options for target are:
|
18
|
-
* - A number position (will be applied to all axes).
|
19
|
-
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
|
20
|
-
* - A jQuery/DOM element ( logically, child of the element to scroll )
|
21
|
-
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
|
22
|
-
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
|
23
|
-
* @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
|
24
|
-
* @param {Object} settings Hash of settings, optional.
|
25
|
-
* @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
|
26
|
-
* @option {Number} duration The OVERALL length of the animation.
|
27
|
-
* @option {String} easing The easing method for the animation.
|
28
|
-
* @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
|
29
|
-
* @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
|
30
|
-
* @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
|
31
|
-
* @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
|
32
|
-
* @option {Function} onAfter Function to be called after the scrolling ends.
|
33
|
-
* @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
|
34
|
-
* @return {jQuery} Returns the same jQuery object, for chaining.
|
35
|
-
*
|
36
|
-
* @example $('div').scrollTo( 340 );
|
37
|
-
*
|
38
|
-
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
|
39
|
-
*
|
40
|
-
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
|
41
|
-
*
|
42
|
-
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
|
43
|
-
* $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
|
44
|
-
* alert('scrolled!!');
|
45
|
-
* }});
|
46
|
-
*
|
47
|
-
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { offset:-20 } );
|
48
|
-
*
|
49
|
-
* Notes:
|
50
|
-
* - jQuery.scrollTo will make the whole window scroll, it accepts the same arguments as jQuery.fn.scrollTo.
|
51
|
-
* - If you are interested in animated anchor navigation, check http://jquery.com/plugins/project/LocalScroll.
|
52
|
-
* - The options margin, offset and over are ignored, if the target is not a jQuery object or a DOM element.
|
53
|
-
* - The option 'queue' won't be taken into account, if only 1 axis is given.
|
54
|
-
*/
|
55
|
-
;(function( $ ){
|
56
|
-
|
57
|
-
var $scrollTo = $.scrollTo = function( target, duration, settings ){
|
58
|
-
$scrollTo.window().scrollTo( target, duration, settings );
|
59
|
-
};
|
60
|
-
|
61
|
-
$scrollTo.defaults = {
|
62
|
-
axis:'y',
|
63
|
-
duration:1
|
64
|
-
};
|
65
|
-
|
66
|
-
//returns the element that needs to be animated to scroll the window
|
67
|
-
$scrollTo.window = function(){
|
68
|
-
return $( $.browser.safari ? 'body' : 'html' );
|
69
|
-
};
|
70
|
-
|
71
|
-
$.fn.scrollTo = function( target, duration, settings ){
|
72
|
-
if( typeof duration == 'object' ){
|
73
|
-
settings = duration;
|
74
|
-
duration = 0;
|
75
|
-
}
|
76
|
-
settings = $.extend( {}, $scrollTo.defaults, settings );
|
77
|
-
duration = duration || settings.speed || settings.duration;//speed is still recognized for backwards compatibility
|
78
|
-
settings.queue = settings.queue && settings.axis.length > 1;//make sure the settings are given right
|
79
|
-
if( settings.queue )
|
80
|
-
duration /= 2;//let's keep the overall speed, the same.
|
81
|
-
settings.offset = both( settings.offset );
|
82
|
-
settings.over = both( settings.over );
|
83
|
-
|
84
|
-
return this.each(function(){
|
85
|
-
var elem = this, $elem = $(elem),
|
86
|
-
t = target, toff, attr = {},
|
87
|
-
win = $elem.is('html,body');
|
88
|
-
switch( typeof t ){
|
89
|
-
case 'number'://will pass the regex
|
90
|
-
case 'string':
|
91
|
-
if( /^([+-]=)?\d+(px)?$/.test(t) ){
|
92
|
-
t = both( t );
|
93
|
-
break;//we are done
|
94
|
-
}
|
95
|
-
t = $(t,this);// relative selector, no break!
|
96
|
-
case 'object':
|
97
|
-
if( t.is || t.style )//DOM/jQuery
|
98
|
-
toff = (t = $(t)).offset();//get the real position of the target
|
99
|
-
}
|
100
|
-
$.each( settings.axis.split(''), function( i, axis ){
|
101
|
-
var Pos = axis == 'x' ? 'Left' : 'Top',
|
102
|
-
pos = Pos.toLowerCase(),
|
103
|
-
key = 'scroll' + Pos,
|
104
|
-
act = elem[key],
|
105
|
-
Dim = axis == 'x' ? 'Width' : 'Height',
|
106
|
-
dim = Dim.toLowerCase();
|
107
|
-
|
108
|
-
if( toff ){//jQuery/DOM
|
109
|
-
attr[key] = toff[pos] + ( win ? 0 : act - $elem.offset()[pos] );
|
110
|
-
|
111
|
-
if( settings.margin ){//if it's a dom element, reduce the margin
|
112
|
-
attr[key] -= parseInt(t.css('margin'+Pos)) || 0;
|
113
|
-
attr[key] -= parseInt(t.css('border'+Pos+'Width')) || 0;
|
114
|
-
}
|
115
|
-
|
116
|
-
attr[key] += settings.offset[pos] || 0;//add/deduct the offset
|
117
|
-
|
118
|
-
if( settings.over[pos] )//scroll to a fraction of its width/height
|
119
|
-
attr[key] += t[dim]() * settings.over[pos];
|
120
|
-
}else
|
121
|
-
attr[key] = t[pos];//remove the unnecesary 'px'
|
122
|
-
|
123
|
-
if( /^\d+$/.test(attr[key]) )//number or 'number'
|
124
|
-
attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max(Dim) );//check the limits
|
125
|
-
|
126
|
-
if( !i && settings.queue ){//queueing each axis is required
|
127
|
-
if( act != attr[key] )//don't waste time animating, if there's no need.
|
128
|
-
animate( settings.onAfterFirst );//intermediate animation
|
129
|
-
delete attr[key];//don't animate this axis again in the next iteration.
|
130
|
-
}
|
131
|
-
});
|
132
|
-
animate( settings.onAfter );
|
133
|
-
|
134
|
-
function animate( callback ){
|
135
|
-
$elem.animate( attr, duration, settings.easing, callback && function(){
|
136
|
-
callback.call(this, target);
|
137
|
-
});
|
138
|
-
};
|
139
|
-
function max( Dim ){
|
140
|
-
var el = win ? $.browser.opera ? document.body : document.documentElement : elem;
|
141
|
-
return el['scroll'+Dim] - el['client'+Dim];
|
142
|
-
};
|
143
|
-
});
|
144
|
-
};
|
145
|
-
|
146
|
-
function both( val ){
|
147
|
-
return typeof val == 'object' ? val : { top:val, left:val };
|
148
|
-
};
|
149
|
-
|
150
|
-
})( jQuery );
|
@@ -1,4320 +0,0 @@
|
|
1
|
-
/* Prototype JavaScript framework, version 1.6.0.3
|
2
|
-
* (c) 2005-2008 Sam Stephenson
|
3
|
-
*
|
4
|
-
* Prototype is freely distributable under the terms of an MIT-style license.
|
5
|
-
* For details, see the Prototype web site: http://www.prototypejs.org/
|
6
|
-
*
|
7
|
-
*--------------------------------------------------------------------------*/
|
8
|
-
|
9
|
-
var Prototype = {
|
10
|
-
Version: '1.6.0.3',
|
11
|
-
|
12
|
-
Browser: {
|
13
|
-
IE: !!(window.attachEvent &&
|
14
|
-
navigator.userAgent.indexOf('Opera') === -1),
|
15
|
-
Opera: navigator.userAgent.indexOf('Opera') > -1,
|
16
|
-
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
|
17
|
-
Gecko: navigator.userAgent.indexOf('Gecko') > -1 &&
|
18
|
-
navigator.userAgent.indexOf('KHTML') === -1,
|
19
|
-
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
|
20
|
-
},
|
21
|
-
|
22
|
-
BrowserFeatures: {
|
23
|
-
XPath: !!document.evaluate,
|
24
|
-
SelectorsAPI: !!document.querySelector,
|
25
|
-
ElementExtensions: !!window.HTMLElement,
|
26
|
-
SpecificElementExtensions:
|
27
|
-
document.createElement('div')['__proto__'] &&
|
28
|
-
document.createElement('div')['__proto__'] !==
|
29
|
-
document.createElement('form')['__proto__']
|
30
|
-
},
|
31
|
-
|
32
|
-
ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
|
33
|
-
JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
|
34
|
-
|
35
|
-
emptyFunction: function() { },
|
36
|
-
K: function(x) { return x }
|
37
|
-
};
|
38
|
-
|
39
|
-
if (Prototype.Browser.MobileSafari)
|
40
|
-
Prototype.BrowserFeatures.SpecificElementExtensions = false;
|
41
|
-
|
42
|
-
|
43
|
-
/* Based on Alex Arnell's inheritance implementation. */
|
44
|
-
var Class = {
|
45
|
-
create: function() {
|
46
|
-
var parent = null, properties = $A(arguments);
|
47
|
-
if (Object.isFunction(properties[0]))
|
48
|
-
parent = properties.shift();
|
49
|
-
|
50
|
-
function klass() {
|
51
|
-
this.initialize.apply(this, arguments);
|
52
|
-
}
|
53
|
-
|
54
|
-
Object.extend(klass, Class.Methods);
|
55
|
-
klass.superclass = parent;
|
56
|
-
klass.subclasses = [];
|
57
|
-
|
58
|
-
if (parent) {
|
59
|
-
var subclass = function() { };
|
60
|
-
subclass.prototype = parent.prototype;
|
61
|
-
klass.prototype = new subclass;
|
62
|
-
parent.subclasses.push(klass);
|
63
|
-
}
|
64
|
-
|
65
|
-
for (var i = 0; i < properties.length; i++)
|
66
|
-
klass.addMethods(properties[i]);
|
67
|
-
|
68
|
-
if (!klass.prototype.initialize)
|
69
|
-
klass.prototype.initialize = Prototype.emptyFunction;
|
70
|
-
|
71
|
-
klass.prototype.constructor = klass;
|
72
|
-
|
73
|
-
return klass;
|
74
|
-
}
|
75
|
-
};
|
76
|
-
|
77
|
-
Class.Methods = {
|
78
|
-
addMethods: function(source) {
|
79
|
-
var ancestor = this.superclass && this.superclass.prototype;
|
80
|
-
var properties = Object.keys(source);
|
81
|
-
|
82
|
-
if (!Object.keys({ toString: true }).length)
|
83
|
-
properties.push("toString", "valueOf");
|
84
|
-
|
85
|
-
for (var i = 0, length = properties.length; i < length; i++) {
|
86
|
-
var property = properties[i], value = source[property];
|
87
|
-
if (ancestor && Object.isFunction(value) &&
|
88
|
-
value.argumentNames().first() == "$super") {
|
89
|
-
var method = value;
|
90
|
-
value = (function(m) {
|
91
|
-
return function() { return ancestor[m].apply(this, arguments) };
|
92
|
-
})(property).wrap(method);
|
93
|
-
|
94
|
-
value.valueOf = method.valueOf.bind(method);
|
95
|
-
value.toString = method.toString.bind(method);
|
96
|
-
}
|
97
|
-
this.prototype[property] = value;
|
98
|
-
}
|
99
|
-
|
100
|
-
return this;
|
101
|
-
}
|
102
|
-
};
|
103
|
-
|
104
|
-
var Abstract = { };
|
105
|
-
|
106
|
-
Object.extend = function(destination, source) {
|
107
|
-
for (var property in source)
|
108
|
-
destination[property] = source[property];
|
109
|
-
return destination;
|
110
|
-
};
|
111
|
-
|
112
|
-
Object.extend(Object, {
|
113
|
-
inspect: function(object) {
|
114
|
-
try {
|
115
|
-
if (Object.isUndefined(object)) return 'undefined';
|
116
|
-
if (object === null) return 'null';
|
117
|
-
return object.inspect ? object.inspect() : String(object);
|
118
|
-
} catch (e) {
|
119
|
-
if (e instanceof RangeError) return '...';
|
120
|
-
throw e;
|
121
|
-
}
|
122
|
-
},
|
123
|
-
|
124
|
-
toJSON: function(object) {
|
125
|
-
var type = typeof object;
|
126
|
-
switch (type) {
|
127
|
-
case 'undefined':
|
128
|
-
case 'function':
|
129
|
-
case 'unknown': return;
|
130
|
-
case 'boolean': return object.toString();
|
131
|
-
}
|
132
|
-
|
133
|
-
if (object === null) return 'null';
|
134
|
-
if (object.toJSON) return object.toJSON();
|
135
|
-
if (Object.isElement(object)) return;
|
136
|
-
|
137
|
-
var results = [];
|
138
|
-
for (var property in object) {
|
139
|
-
var value = Object.toJSON(object[property]);
|
140
|
-
if (!Object.isUndefined(value))
|
141
|
-
results.push(property.toJSON() + ': ' + value);
|
142
|
-
}
|
143
|
-
|
144
|
-
return '{' + results.join(', ') + '}';
|
145
|
-
},
|
146
|
-
|
147
|
-
toQueryString: function(object) {
|
148
|
-
return $H(object).toQueryString();
|
149
|
-
},
|
150
|
-
|
151
|
-
toHTML: function(object) {
|
152
|
-
return object && object.toHTML ? object.toHTML() : String.interpret(object);
|
153
|
-
},
|
154
|
-
|
155
|
-
keys: function(object) {
|
156
|
-
var keys = [];
|
157
|
-
for (var property in object)
|
158
|
-
keys.push(property);
|
159
|
-
return keys;
|
160
|
-
},
|
161
|
-
|
162
|
-
values: function(object) {
|
163
|
-
var values = [];
|
164
|
-
for (var property in object)
|
165
|
-
values.push(object[property]);
|
166
|
-
return values;
|
167
|
-
},
|
168
|
-
|
169
|
-
clone: function(object) {
|
170
|
-
return Object.extend({ }, object);
|
171
|
-
},
|
172
|
-
|
173
|
-
isElement: function(object) {
|
174
|
-
return !!(object && object.nodeType == 1);
|
175
|
-
},
|
176
|
-
|
177
|
-
isArray: function(object) {
|
178
|
-
return object != null && typeof object == "object" &&
|
179
|
-
'splice' in object && 'join' in object;
|
180
|
-
},
|
181
|
-
|
182
|
-
isHash: function(object) {
|
183
|
-
return object instanceof Hash;
|
184
|
-
},
|
185
|
-
|
186
|
-
isFunction: function(object) {
|
187
|
-
return typeof object == "function";
|
188
|
-
},
|
189
|
-
|
190
|
-
isString: function(object) {
|
191
|
-
return typeof object == "string";
|
192
|
-
},
|
193
|
-
|
194
|
-
isNumber: function(object) {
|
195
|
-
return typeof object == "number";
|
196
|
-
},
|
197
|
-
|
198
|
-
isUndefined: function(object) {
|
199
|
-
return typeof object == "undefined";
|
200
|
-
}
|
201
|
-
});
|
202
|
-
|
203
|
-
Object.extend(Function.prototype, {
|
204
|
-
argumentNames: function() {
|
205
|
-
var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1]
|
206
|
-
.replace(/\s+/g, '').split(',');
|
207
|
-
return names.length == 1 && !names[0] ? [] : names;
|
208
|
-
},
|
209
|
-
|
210
|
-
bind: function() {
|
211
|
-
if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
|
212
|
-
var __method = this, args = $A(arguments), object = args.shift();
|
213
|
-
return function() {
|
214
|
-
return __method.apply(object, args.concat($A(arguments)));
|
215
|
-
}
|
216
|
-
},
|
217
|
-
|
218
|
-
bindAsEventListener: function() {
|
219
|
-
var __method = this, args = $A(arguments), object = args.shift();
|
220
|
-
return function(event) {
|
221
|
-
return __method.apply(object, [event || window.event].concat(args));
|
222
|
-
}
|
223
|
-
},
|
224
|
-
|
225
|
-
curry: function() {
|
226
|
-
if (!arguments.length) return this;
|
227
|
-
var __method = this, args = $A(arguments);
|
228
|
-
return function() {
|
229
|
-
return __method.apply(this, args.concat($A(arguments)));
|
230
|
-
}
|
231
|
-
},
|
232
|
-
|
233
|
-
delay: function() {
|
234
|
-
var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
|
235
|
-
return window.setTimeout(function() {
|
236
|
-
return __method.apply(__method, args);
|
237
|
-
}, timeout);
|
238
|
-
},
|
239
|
-
|
240
|
-
defer: function() {
|
241
|
-
var args = [0.01].concat($A(arguments));
|
242
|
-
return this.delay.apply(this, args);
|
243
|
-
},
|
244
|
-
|
245
|
-
wrap: function(wrapper) {
|
246
|
-
var __method = this;
|
247
|
-
return function() {
|
248
|
-
return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
|
249
|
-
}
|
250
|
-
},
|
251
|
-
|
252
|
-
methodize: function() {
|
253
|
-
if (this._methodized) return this._methodized;
|
254
|
-
var __method = this;
|
255
|
-
return this._methodized = function() {
|
256
|
-
return __method.apply(null, [this].concat($A(arguments)));
|
257
|
-
};
|
258
|
-
}
|
259
|
-
});
|
260
|
-
|
261
|
-
Date.prototype.toJSON = function() {
|
262
|
-
return '"' + this.getUTCFullYear() + '-' +
|
263
|
-
(this.getUTCMonth() + 1).toPaddedString(2) + '-' +
|
264
|
-
this.getUTCDate().toPaddedString(2) + 'T' +
|
265
|
-
this.getUTCHours().toPaddedString(2) + ':' +
|
266
|
-
this.getUTCMinutes().toPaddedString(2) + ':' +
|
267
|
-
this.getUTCSeconds().toPaddedString(2) + 'Z"';
|
268
|
-
};
|
269
|
-
|
270
|
-
var Try = {
|
271
|
-
these: function() {
|
272
|
-
var returnValue;
|
273
|
-
|
274
|
-
for (var i = 0, length = arguments.length; i < length; i++) {
|
275
|
-
var lambda = arguments[i];
|
276
|
-
try {
|
277
|
-
returnValue = lambda();
|
278
|
-
break;
|
279
|
-
} catch (e) { }
|
280
|
-
}
|
281
|
-
|
282
|
-
return returnValue;
|
283
|
-
}
|
284
|
-
};
|
285
|
-
|
286
|
-
RegExp.prototype.match = RegExp.prototype.test;
|
287
|
-
|
288
|
-
RegExp.escape = function(str) {
|
289
|
-
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
290
|
-
};
|
291
|
-
|
292
|
-
/*--------------------------------------------------------------------------*/
|
293
|
-
|
294
|
-
var PeriodicalExecuter = Class.create({
|
295
|
-
initialize: function(callback, frequency) {
|
296
|
-
this.callback = callback;
|
297
|
-
this.frequency = frequency;
|
298
|
-
this.currentlyExecuting = false;
|
299
|
-
|
300
|
-
this.registerCallback();
|
301
|
-
},
|
302
|
-
|
303
|
-
registerCallback: function() {
|
304
|
-
this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
|
305
|
-
},
|
306
|
-
|
307
|
-
execute: function() {
|
308
|
-
this.callback(this);
|
309
|
-
},
|
310
|
-
|
311
|
-
stop: function() {
|
312
|
-
if (!this.timer) return;
|
313
|
-
clearInterval(this.timer);
|
314
|
-
this.timer = null;
|
315
|
-
},
|
316
|
-
|
317
|
-
onTimerEvent: function() {
|
318
|
-
if (!this.currentlyExecuting) {
|
319
|
-
try {
|
320
|
-
this.currentlyExecuting = true;
|
321
|
-
this.execute();
|
322
|
-
} finally {
|
323
|
-
this.currentlyExecuting = false;
|
324
|
-
}
|
325
|
-
}
|
326
|
-
}
|
327
|
-
});
|
328
|
-
Object.extend(String, {
|
329
|
-
interpret: function(value) {
|
330
|
-
return value == null ? '' : String(value);
|
331
|
-
},
|
332
|
-
specialChar: {
|
333
|
-
'\b': '\\b',
|
334
|
-
'\t': '\\t',
|
335
|
-
'\n': '\\n',
|
336
|
-
'\f': '\\f',
|
337
|
-
'\r': '\\r',
|
338
|
-
'\\': '\\\\'
|
339
|
-
}
|
340
|
-
});
|
341
|
-
|
342
|
-
Object.extend(String.prototype, {
|
343
|
-
gsub: function(pattern, replacement) {
|
344
|
-
var result = '', source = this, match;
|
345
|
-
replacement = arguments.callee.prepareReplacement(replacement);
|
346
|
-
|
347
|
-
while (source.length > 0) {
|
348
|
-
if (match = source.match(pattern)) {
|
349
|
-
result += source.slice(0, match.index);
|
350
|
-
result += String.interpret(replacement(match));
|
351
|
-
source = source.slice(match.index + match[0].length);
|
352
|
-
} else {
|
353
|
-
result += source, source = '';
|
354
|
-
}
|
355
|
-
}
|
356
|
-
return result;
|
357
|
-
},
|
358
|
-
|
359
|
-
sub: function(pattern, replacement, count) {
|
360
|
-
replacement = this.gsub.prepareReplacement(replacement);
|
361
|
-
count = Object.isUndefined(count) ? 1 : count;
|
362
|
-
|
363
|
-
return this.gsub(pattern, function(match) {
|
364
|
-
if (--count < 0) return match[0];
|
365
|
-
return replacement(match);
|
366
|
-
});
|
367
|
-
},
|
368
|
-
|
369
|
-
scan: function(pattern, iterator) {
|
370
|
-
this.gsub(pattern, iterator);
|
371
|
-
return String(this);
|
372
|
-
},
|
373
|
-
|
374
|
-
truncate: function(length, truncation) {
|
375
|
-
length = length || 30;
|
376
|
-
truncation = Object.isUndefined(truncation) ? '...' : truncation;
|
377
|
-
return this.length > length ?
|
378
|
-
this.slice(0, length - truncation.length) + truncation : String(this);
|
379
|
-
},
|
380
|
-
|
381
|
-
strip: function() {
|
382
|
-
return this.replace(/^\s+/, '').replace(/\s+$/, '');
|
383
|
-
},
|
384
|
-
|
385
|
-
stripTags: function() {
|
386
|
-
return this.replace(/<\/?[^>]+>/gi, '');
|
387
|
-
},
|
388
|
-
|
389
|
-
stripScripts: function() {
|
390
|
-
return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
|
391
|
-
},
|
392
|
-
|
393
|
-
extractScripts: function() {
|
394
|
-
var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
|
395
|
-
var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
|
396
|
-
return (this.match(matchAll) || []).map(function(scriptTag) {
|
397
|
-
return (scriptTag.match(matchOne) || ['', ''])[1];
|
398
|
-
});
|
399
|
-
},
|
400
|
-
|
401
|
-
evalScripts: function() {
|
402
|
-
return this.extractScripts().map(function(script) { return eval(script) });
|
403
|
-
},
|
404
|
-
|
405
|
-
escapeHTML: function() {
|
406
|
-
var self = arguments.callee;
|
407
|
-
self.text.data = this;
|
408
|
-
return self.div.innerHTML;
|
409
|
-
},
|
410
|
-
|
411
|
-
unescapeHTML: function() {
|
412
|
-
var div = new Element('div');
|
413
|
-
div.innerHTML = this.stripTags();
|
414
|
-
return div.childNodes[0] ? (div.childNodes.length > 1 ?
|
415
|
-
$A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
|
416
|
-
div.childNodes[0].nodeValue) : '';
|
417
|
-
},
|
418
|
-
|
419
|
-
toQueryParams: function(separator) {
|
420
|
-
var match = this.strip().match(/([^?#]*)(#.*)?$/);
|
421
|
-
if (!match) return { };
|
422
|
-
|
423
|
-
return match[1].split(separator || '&').inject({ }, function(hash, pair) {
|
424
|
-
if ((pair = pair.split('='))[0]) {
|
425
|
-
var key = decodeURIComponent(pair.shift());
|
426
|
-
var value = pair.length > 1 ? pair.join('=') : pair[0];
|
427
|
-
if (value != undefined) value = decodeURIComponent(value);
|
428
|
-
|
429
|
-
if (key in hash) {
|
430
|
-
if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
|
431
|
-
hash[key].push(value);
|
432
|
-
}
|
433
|
-
else hash[key] = value;
|
434
|
-
}
|
435
|
-
return hash;
|
436
|
-
});
|
437
|
-
},
|
438
|
-
|
439
|
-
toArray: function() {
|
440
|
-
return this.split('');
|
441
|
-
},
|
442
|
-
|
443
|
-
succ: function() {
|
444
|
-
return this.slice(0, this.length - 1) +
|
445
|
-
String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
|
446
|
-
},
|
447
|
-
|
448
|
-
times: function(count) {
|
449
|
-
return count < 1 ? '' : new Array(count + 1).join(this);
|
450
|
-
},
|
451
|
-
|
452
|
-
camelize: function() {
|
453
|
-
var parts = this.split('-'), len = parts.length;
|
454
|
-
if (len == 1) return parts[0];
|
455
|
-
|
456
|
-
var camelized = this.charAt(0) == '-'
|
457
|
-
? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
|
458
|
-
: parts[0];
|
459
|
-
|
460
|
-
for (var i = 1; i < len; i++)
|
461
|
-
camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
|
462
|
-
|
463
|
-
return camelized;
|
464
|
-
},
|
465
|
-
|
466
|
-
capitalize: function() {
|
467
|
-
return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
|
468
|
-
},
|
469
|
-
|
470
|
-
underscore: function() {
|
471
|
-
return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
|
472
|
-
},
|
473
|
-
|
474
|
-
dasherize: function() {
|
475
|
-
return this.gsub(/_/,'-');
|
476
|
-
},
|
477
|
-
|
478
|
-
inspect: function(useDoubleQuotes) {
|
479
|
-
var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
|
480
|
-
var character = String.specialChar[match[0]];
|
481
|
-
return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
|
482
|
-
});
|
483
|
-
if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
|
484
|
-
return "'" + escapedString.replace(/'/g, '\\\'') + "'";
|
485
|
-
},
|
486
|
-
|
487
|
-
toJSON: function() {
|
488
|
-
return this.inspect(true);
|
489
|
-
},
|
490
|
-
|
491
|
-
unfilterJSON: function(filter) {
|
492
|
-
return this.sub(filter || Prototype.JSONFilter, '#{1}');
|
493
|
-
},
|
494
|
-
|
495
|
-
isJSON: function() {
|
496
|
-
var str = this;
|
497
|
-
if (str.blank()) return false;
|
498
|
-
str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
|
499
|
-
return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
|
500
|
-
},
|
501
|
-
|
502
|
-
evalJSON: function(sanitize) {
|
503
|
-
var json = this.unfilterJSON();
|
504
|
-
try {
|
505
|
-
if (!sanitize || json.isJSON()) return eval('(' + json + ')');
|
506
|
-
} catch (e) { }
|
507
|
-
throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
|
508
|
-
},
|
509
|
-
|
510
|
-
include: function(pattern) {
|
511
|
-
return this.indexOf(pattern) > -1;
|
512
|
-
},
|
513
|
-
|
514
|
-
startsWith: function(pattern) {
|
515
|
-
return this.indexOf(pattern) === 0;
|
516
|
-
},
|
517
|
-
|
518
|
-
endsWith: function(pattern) {
|
519
|
-
var d = this.length - pattern.length;
|
520
|
-
return d >= 0 && this.lastIndexOf(pattern) === d;
|
521
|
-
},
|
522
|
-
|
523
|
-
empty: function() {
|
524
|
-
return this == '';
|
525
|
-
},
|
526
|
-
|
527
|
-
blank: function() {
|
528
|
-
return /^\s*$/.test(this);
|
529
|
-
},
|
530
|
-
|
531
|
-
interpolate: function(object, pattern) {
|
532
|
-
return new Template(this, pattern).evaluate(object);
|
533
|
-
}
|
534
|
-
});
|
535
|
-
|
536
|
-
if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
|
537
|
-
escapeHTML: function() {
|
538
|
-
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
539
|
-
},
|
540
|
-
unescapeHTML: function() {
|
541
|
-
return this.stripTags().replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
542
|
-
}
|
543
|
-
});
|
544
|
-
|
545
|
-
String.prototype.gsub.prepareReplacement = function(replacement) {
|
546
|
-
if (Object.isFunction(replacement)) return replacement;
|
547
|
-
var template = new Template(replacement);
|
548
|
-
return function(match) { return template.evaluate(match) };
|
549
|
-
};
|
550
|
-
|
551
|
-
String.prototype.parseQuery = String.prototype.toQueryParams;
|
552
|
-
|
553
|
-
Object.extend(String.prototype.escapeHTML, {
|
554
|
-
div: document.createElement('div'),
|
555
|
-
text: document.createTextNode('')
|
556
|
-
});
|
557
|
-
|
558
|
-
String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);
|
559
|
-
|
560
|
-
var Template = Class.create({
|
561
|
-
initialize: function(template, pattern) {
|
562
|
-
this.template = template.toString();
|
563
|
-
this.pattern = pattern || Template.Pattern;
|
564
|
-
},
|
565
|
-
|
566
|
-
evaluate: function(object) {
|
567
|
-
if (Object.isFunction(object.toTemplateReplacements))
|
568
|
-
object = object.toTemplateReplacements();
|
569
|
-
|
570
|
-
return this.template.gsub(this.pattern, function(match) {
|
571
|
-
if (object == null) return '';
|
572
|
-
|
573
|
-
var before = match[1] || '';
|
574
|
-
if (before == '\\') return match[2];
|
575
|
-
|
576
|
-
var ctx = object, expr = match[3];
|
577
|
-
var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
|
578
|
-
match = pattern.exec(expr);
|
579
|
-
if (match == null) return before;
|
580
|
-
|
581
|
-
while (match != null) {
|
582
|
-
var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
|
583
|
-
ctx = ctx[comp];
|
584
|
-
if (null == ctx || '' == match[3]) break;
|
585
|
-
expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
|
586
|
-
match = pattern.exec(expr);
|
587
|
-
}
|
588
|
-
|
589
|
-
return before + String.interpret(ctx);
|
590
|
-
});
|
591
|
-
}
|
592
|
-
});
|
593
|
-
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
|
594
|
-
|
595
|
-
var $break = { };
|
596
|
-
|
597
|
-
var Enumerable = {
|
598
|
-
each: function(iterator, context) {
|
599
|
-
var index = 0;
|
600
|
-
try {
|
601
|
-
this._each(function(value) {
|
602
|
-
iterator.call(context, value, index++);
|
603
|
-
});
|
604
|
-
} catch (e) {
|
605
|
-
if (e != $break) throw e;
|
606
|
-
}
|
607
|
-
return this;
|
608
|
-
},
|
609
|
-
|
610
|
-
eachSlice: function(number, iterator, context) {
|
611
|
-
var index = -number, slices = [], array = this.toArray();
|
612
|
-
if (number < 1) return array;
|
613
|
-
while ((index += number) < array.length)
|
614
|
-
slices.push(array.slice(index, index+number));
|
615
|
-
return slices.collect(iterator, context);
|
616
|
-
},
|
617
|
-
|
618
|
-
all: function(iterator, context) {
|
619
|
-
iterator = iterator || Prototype.K;
|
620
|
-
var result = true;
|
621
|
-
this.each(function(value, index) {
|
622
|
-
result = result && !!iterator.call(context, value, index);
|
623
|
-
if (!result) throw $break;
|
624
|
-
});
|
625
|
-
return result;
|
626
|
-
},
|
627
|
-
|
628
|
-
any: function(iterator, context) {
|
629
|
-
iterator = iterator || Prototype.K;
|
630
|
-
var result = false;
|
631
|
-
this.each(function(value, index) {
|
632
|
-
if (result = !!iterator.call(context, value, index))
|
633
|
-
throw $break;
|
634
|
-
});
|
635
|
-
return result;
|
636
|
-
},
|
637
|
-
|
638
|
-
collect: function(iterator, context) {
|
639
|
-
iterator = iterator || Prototype.K;
|
640
|
-
var results = [];
|
641
|
-
this.each(function(value, index) {
|
642
|
-
results.push(iterator.call(context, value, index));
|
643
|
-
});
|
644
|
-
return results;
|
645
|
-
},
|
646
|
-
|
647
|
-
detect: function(iterator, context) {
|
648
|
-
var result;
|
649
|
-
this.each(function(value, index) {
|
650
|
-
if (iterator.call(context, value, index)) {
|
651
|
-
result = value;
|
652
|
-
throw $break;
|
653
|
-
}
|
654
|
-
});
|
655
|
-
return result;
|
656
|
-
},
|
657
|
-
|
658
|
-
findAll: function(iterator, context) {
|
659
|
-
var results = [];
|
660
|
-
this.each(function(value, index) {
|
661
|
-
if (iterator.call(context, value, index))
|
662
|
-
results.push(value);
|
663
|
-
});
|
664
|
-
return results;
|
665
|
-
},
|
666
|
-
|
667
|
-
grep: function(filter, iterator, context) {
|
668
|
-
iterator = iterator || Prototype.K;
|
669
|
-
var results = [];
|
670
|
-
|
671
|
-
if (Object.isString(filter))
|
672
|
-
filter = new RegExp(filter);
|
673
|
-
|
674
|
-
this.each(function(value, index) {
|
675
|
-
if (filter.match(value))
|
676
|
-
results.push(iterator.call(context, value, index));
|
677
|
-
});
|
678
|
-
return results;
|
679
|
-
},
|
680
|
-
|
681
|
-
include: function(object) {
|
682
|
-
if (Object.isFunction(this.indexOf))
|
683
|
-
if (this.indexOf(object) != -1) return true;
|
684
|
-
|
685
|
-
var found = false;
|
686
|
-
this.each(function(value) {
|
687
|
-
if (value == object) {
|
688
|
-
found = true;
|
689
|
-
throw $break;
|
690
|
-
}
|
691
|
-
});
|
692
|
-
return found;
|
693
|
-
},
|
694
|
-
|
695
|
-
inGroupsOf: function(number, fillWith) {
|
696
|
-
fillWith = Object.isUndefined(fillWith) ? null : fillWith;
|
697
|
-
return this.eachSlice(number, function(slice) {
|
698
|
-
while(slice.length < number) slice.push(fillWith);
|
699
|
-
return slice;
|
700
|
-
});
|
701
|
-
},
|
702
|
-
|
703
|
-
inject: function(memo, iterator, context) {
|
704
|
-
this.each(function(value, index) {
|
705
|
-
memo = iterator.call(context, memo, value, index);
|
706
|
-
});
|
707
|
-
return memo;
|
708
|
-
},
|
709
|
-
|
710
|
-
invoke: function(method) {
|
711
|
-
var args = $A(arguments).slice(1);
|
712
|
-
return this.map(function(value) {
|
713
|
-
return value[method].apply(value, args);
|
714
|
-
});
|
715
|
-
},
|
716
|
-
|
717
|
-
max: function(iterator, context) {
|
718
|
-
iterator = iterator || Prototype.K;
|
719
|
-
var result;
|
720
|
-
this.each(function(value, index) {
|
721
|
-
value = iterator.call(context, value, index);
|
722
|
-
if (result == null || value >= result)
|
723
|
-
result = value;
|
724
|
-
});
|
725
|
-
return result;
|
726
|
-
},
|
727
|
-
|
728
|
-
min: function(iterator, context) {
|
729
|
-
iterator = iterator || Prototype.K;
|
730
|
-
var result;
|
731
|
-
this.each(function(value, index) {
|
732
|
-
value = iterator.call(context, value, index);
|
733
|
-
if (result == null || value < result)
|
734
|
-
result = value;
|
735
|
-
});
|
736
|
-
return result;
|
737
|
-
},
|
738
|
-
|
739
|
-
partition: function(iterator, context) {
|
740
|
-
iterator = iterator || Prototype.K;
|
741
|
-
var trues = [], falses = [];
|
742
|
-
this.each(function(value, index) {
|
743
|
-
(iterator.call(context, value, index) ?
|
744
|
-
trues : falses).push(value);
|
745
|
-
});
|
746
|
-
return [trues, falses];
|
747
|
-
},
|
748
|
-
|
749
|
-
pluck: function(property) {
|
750
|
-
var results = [];
|
751
|
-
this.each(function(value) {
|
752
|
-
results.push(value[property]);
|
753
|
-
});
|
754
|
-
return results;
|
755
|
-
},
|
756
|
-
|
757
|
-
reject: function(iterator, context) {
|
758
|
-
var results = [];
|
759
|
-
this.each(function(value, index) {
|
760
|
-
if (!iterator.call(context, value, index))
|
761
|
-
results.push(value);
|
762
|
-
});
|
763
|
-
return results;
|
764
|
-
},
|
765
|
-
|
766
|
-
sortBy: function(iterator, context) {
|
767
|
-
return this.map(function(value, index) {
|
768
|
-
return {
|
769
|
-
value: value,
|
770
|
-
criteria: iterator.call(context, value, index)
|
771
|
-
};
|
772
|
-
}).sort(function(left, right) {
|
773
|
-
var a = left.criteria, b = right.criteria;
|
774
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
775
|
-
}).pluck('value');
|
776
|
-
},
|
777
|
-
|
778
|
-
toArray: function() {
|
779
|
-
return this.map();
|
780
|
-
},
|
781
|
-
|
782
|
-
zip: function() {
|
783
|
-
var iterator = Prototype.K, args = $A(arguments);
|
784
|
-
if (Object.isFunction(args.last()))
|
785
|
-
iterator = args.pop();
|
786
|
-
|
787
|
-
var collections = [this].concat(args).map($A);
|
788
|
-
return this.map(function(value, index) {
|
789
|
-
return iterator(collections.pluck(index));
|
790
|
-
});
|
791
|
-
},
|
792
|
-
|
793
|
-
size: function() {
|
794
|
-
return this.toArray().length;
|
795
|
-
},
|
796
|
-
|
797
|
-
inspect: function() {
|
798
|
-
return '#<Enumerable:' + this.toArray().inspect() + '>';
|
799
|
-
}
|
800
|
-
};
|
801
|
-
|
802
|
-
Object.extend(Enumerable, {
|
803
|
-
map: Enumerable.collect,
|
804
|
-
find: Enumerable.detect,
|
805
|
-
select: Enumerable.findAll,
|
806
|
-
filter: Enumerable.findAll,
|
807
|
-
member: Enumerable.include,
|
808
|
-
entries: Enumerable.toArray,
|
809
|
-
every: Enumerable.all,
|
810
|
-
some: Enumerable.any
|
811
|
-
});
|
812
|
-
function $A(iterable) {
|
813
|
-
if (!iterable) return [];
|
814
|
-
if (iterable.toArray) return iterable.toArray();
|
815
|
-
var length = iterable.length || 0, results = new Array(length);
|
816
|
-
while (length--) results[length] = iterable[length];
|
817
|
-
return results;
|
818
|
-
}
|
819
|
-
|
820
|
-
if (Prototype.Browser.WebKit) {
|
821
|
-
$A = function(iterable) {
|
822
|
-
if (!iterable) return [];
|
823
|
-
// In Safari, only use the `toArray` method if it's not a NodeList.
|
824
|
-
// A NodeList is a function, has an function `item` property, and a numeric
|
825
|
-
// `length` property. Adapted from Google Doctype.
|
826
|
-
if (!(typeof iterable === 'function' && typeof iterable.length ===
|
827
|
-
'number' && typeof iterable.item === 'function') && iterable.toArray)
|
828
|
-
return iterable.toArray();
|
829
|
-
var length = iterable.length || 0, results = new Array(length);
|
830
|
-
while (length--) results[length] = iterable[length];
|
831
|
-
return results;
|
832
|
-
};
|
833
|
-
}
|
834
|
-
|
835
|
-
Array.from = $A;
|
836
|
-
|
837
|
-
Object.extend(Array.prototype, Enumerable);
|
838
|
-
|
839
|
-
if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
|
840
|
-
|
841
|
-
Object.extend(Array.prototype, {
|
842
|
-
_each: function(iterator) {
|
843
|
-
for (var i = 0, length = this.length; i < length; i++)
|
844
|
-
iterator(this[i]);
|
845
|
-
},
|
846
|
-
|
847
|
-
clear: function() {
|
848
|
-
this.length = 0;
|
849
|
-
return this;
|
850
|
-
},
|
851
|
-
|
852
|
-
first: function() {
|
853
|
-
return this[0];
|
854
|
-
},
|
855
|
-
|
856
|
-
last: function() {
|
857
|
-
return this[this.length - 1];
|
858
|
-
},
|
859
|
-
|
860
|
-
compact: function() {
|
861
|
-
return this.select(function(value) {
|
862
|
-
return value != null;
|
863
|
-
});
|
864
|
-
},
|
865
|
-
|
866
|
-
flatten: function() {
|
867
|
-
return this.inject([], function(array, value) {
|
868
|
-
return array.concat(Object.isArray(value) ?
|
869
|
-
value.flatten() : [value]);
|
870
|
-
});
|
871
|
-
},
|
872
|
-
|
873
|
-
without: function() {
|
874
|
-
var values = $A(arguments);
|
875
|
-
return this.select(function(value) {
|
876
|
-
return !values.include(value);
|
877
|
-
});
|
878
|
-
},
|
879
|
-
|
880
|
-
reverse: function(inline) {
|
881
|
-
return (inline !== false ? this : this.toArray())._reverse();
|
882
|
-
},
|
883
|
-
|
884
|
-
reduce: function() {
|
885
|
-
return this.length > 1 ? this : this[0];
|
886
|
-
},
|
887
|
-
|
888
|
-
uniq: function(sorted) {
|
889
|
-
return this.inject([], function(array, value, index) {
|
890
|
-
if (0 == index || (sorted ? array.last() != value : !array.include(value)))
|
891
|
-
array.push(value);
|
892
|
-
return array;
|
893
|
-
});
|
894
|
-
},
|
895
|
-
|
896
|
-
intersect: function(array) {
|
897
|
-
return this.uniq().findAll(function(item) {
|
898
|
-
return array.detect(function(value) { return item === value });
|
899
|
-
});
|
900
|
-
},
|
901
|
-
|
902
|
-
clone: function() {
|
903
|
-
return [].concat(this);
|
904
|
-
},
|
905
|
-
|
906
|
-
size: function() {
|
907
|
-
return this.length;
|
908
|
-
},
|
909
|
-
|
910
|
-
inspect: function() {
|
911
|
-
return '[' + this.map(Object.inspect).join(', ') + ']';
|
912
|
-
},
|
913
|
-
|
914
|
-
toJSON: function() {
|
915
|
-
var results = [];
|
916
|
-
this.each(function(object) {
|
917
|
-
var value = Object.toJSON(object);
|
918
|
-
if (!Object.isUndefined(value)) results.push(value);
|
919
|
-
});
|
920
|
-
return '[' + results.join(', ') + ']';
|
921
|
-
}
|
922
|
-
});
|
923
|
-
|
924
|
-
// use native browser JS 1.6 implementation if available
|
925
|
-
if (Object.isFunction(Array.prototype.forEach))
|
926
|
-
Array.prototype._each = Array.prototype.forEach;
|
927
|
-
|
928
|
-
if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
|
929
|
-
i || (i = 0);
|
930
|
-
var length = this.length;
|
931
|
-
if (i < 0) i = length + i;
|
932
|
-
for (; i < length; i++)
|
933
|
-
if (this[i] === item) return i;
|
934
|
-
return -1;
|
935
|
-
};
|
936
|
-
|
937
|
-
if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
|
938
|
-
i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
|
939
|
-
var n = this.slice(0, i).reverse().indexOf(item);
|
940
|
-
return (n < 0) ? n : i - n - 1;
|
941
|
-
};
|
942
|
-
|
943
|
-
Array.prototype.toArray = Array.prototype.clone;
|
944
|
-
|
945
|
-
function $w(string) {
|
946
|
-
if (!Object.isString(string)) return [];
|
947
|
-
string = string.strip();
|
948
|
-
return string ? string.split(/\s+/) : [];
|
949
|
-
}
|
950
|
-
|
951
|
-
if (Prototype.Browser.Opera){
|
952
|
-
Array.prototype.concat = function() {
|
953
|
-
var array = [];
|
954
|
-
for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
|
955
|
-
for (var i = 0, length = arguments.length; i < length; i++) {
|
956
|
-
if (Object.isArray(arguments[i])) {
|
957
|
-
for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
|
958
|
-
array.push(arguments[i][j]);
|
959
|
-
} else {
|
960
|
-
array.push(arguments[i]);
|
961
|
-
}
|
962
|
-
}
|
963
|
-
return array;
|
964
|
-
};
|
965
|
-
}
|
966
|
-
Object.extend(Number.prototype, {
|
967
|
-
toColorPart: function() {
|
968
|
-
return this.toPaddedString(2, 16);
|
969
|
-
},
|
970
|
-
|
971
|
-
succ: function() {
|
972
|
-
return this + 1;
|
973
|
-
},
|
974
|
-
|
975
|
-
times: function(iterator, context) {
|
976
|
-
$R(0, this, true).each(iterator, context);
|
977
|
-
return this;
|
978
|
-
},
|
979
|
-
|
980
|
-
toPaddedString: function(length, radix) {
|
981
|
-
var string = this.toString(radix || 10);
|
982
|
-
return '0'.times(length - string.length) + string;
|
983
|
-
},
|
984
|
-
|
985
|
-
toJSON: function() {
|
986
|
-
return isFinite(this) ? this.toString() : 'null';
|
987
|
-
}
|
988
|
-
});
|
989
|
-
|
990
|
-
$w('abs round ceil floor').each(function(method){
|
991
|
-
Number.prototype[method] = Math[method].methodize();
|
992
|
-
});
|
993
|
-
function $H(object) {
|
994
|
-
return new Hash(object);
|
995
|
-
};
|
996
|
-
|
997
|
-
var Hash = Class.create(Enumerable, (function() {
|
998
|
-
|
999
|
-
function toQueryPair(key, value) {
|
1000
|
-
if (Object.isUndefined(value)) return key;
|
1001
|
-
return key + '=' + encodeURIComponent(String.interpret(value));
|
1002
|
-
}
|
1003
|
-
|
1004
|
-
return {
|
1005
|
-
initialize: function(object) {
|
1006
|
-
this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
|
1007
|
-
},
|
1008
|
-
|
1009
|
-
_each: function(iterator) {
|
1010
|
-
for (var key in this._object) {
|
1011
|
-
var value = this._object[key], pair = [key, value];
|
1012
|
-
pair.key = key;
|
1013
|
-
pair.value = value;
|
1014
|
-
iterator(pair);
|
1015
|
-
}
|
1016
|
-
},
|
1017
|
-
|
1018
|
-
set: function(key, value) {
|
1019
|
-
return this._object[key] = value;
|
1020
|
-
},
|
1021
|
-
|
1022
|
-
get: function(key) {
|
1023
|
-
// simulating poorly supported hasOwnProperty
|
1024
|
-
if (this._object[key] !== Object.prototype[key])
|
1025
|
-
return this._object[key];
|
1026
|
-
},
|
1027
|
-
|
1028
|
-
unset: function(key) {
|
1029
|
-
var value = this._object[key];
|
1030
|
-
delete this._object[key];
|
1031
|
-
return value;
|
1032
|
-
},
|
1033
|
-
|
1034
|
-
toObject: function() {
|
1035
|
-
return Object.clone(this._object);
|
1036
|
-
},
|
1037
|
-
|
1038
|
-
keys: function() {
|
1039
|
-
return this.pluck('key');
|
1040
|
-
},
|
1041
|
-
|
1042
|
-
values: function() {
|
1043
|
-
return this.pluck('value');
|
1044
|
-
},
|
1045
|
-
|
1046
|
-
index: function(value) {
|
1047
|
-
var match = this.detect(function(pair) {
|
1048
|
-
return pair.value === value;
|
1049
|
-
});
|
1050
|
-
return match && match.key;
|
1051
|
-
},
|
1052
|
-
|
1053
|
-
merge: function(object) {
|
1054
|
-
return this.clone().update(object);
|
1055
|
-
},
|
1056
|
-
|
1057
|
-
update: function(object) {
|
1058
|
-
return new Hash(object).inject(this, function(result, pair) {
|
1059
|
-
result.set(pair.key, pair.value);
|
1060
|
-
return result;
|
1061
|
-
});
|
1062
|
-
},
|
1063
|
-
|
1064
|
-
toQueryString: function() {
|
1065
|
-
return this.inject([], function(results, pair) {
|
1066
|
-
var key = encodeURIComponent(pair.key), values = pair.value;
|
1067
|
-
|
1068
|
-
if (values && typeof values == 'object') {
|
1069
|
-
if (Object.isArray(values))
|
1070
|
-
return results.concat(values.map(toQueryPair.curry(key)));
|
1071
|
-
} else results.push(toQueryPair(key, values));
|
1072
|
-
return results;
|
1073
|
-
}).join('&');
|
1074
|
-
},
|
1075
|
-
|
1076
|
-
inspect: function() {
|
1077
|
-
return '#<Hash:{' + this.map(function(pair) {
|
1078
|
-
return pair.map(Object.inspect).join(': ');
|
1079
|
-
}).join(', ') + '}>';
|
1080
|
-
},
|
1081
|
-
|
1082
|
-
toJSON: function() {
|
1083
|
-
return Object.toJSON(this.toObject());
|
1084
|
-
},
|
1085
|
-
|
1086
|
-
clone: function() {
|
1087
|
-
return new Hash(this);
|
1088
|
-
}
|
1089
|
-
}
|
1090
|
-
})());
|
1091
|
-
|
1092
|
-
Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
|
1093
|
-
Hash.from = $H;
|
1094
|
-
var ObjectRange = Class.create(Enumerable, {
|
1095
|
-
initialize: function(start, end, exclusive) {
|
1096
|
-
this.start = start;
|
1097
|
-
this.end = end;
|
1098
|
-
this.exclusive = exclusive;
|
1099
|
-
},
|
1100
|
-
|
1101
|
-
_each: function(iterator) {
|
1102
|
-
var value = this.start;
|
1103
|
-
while (this.include(value)) {
|
1104
|
-
iterator(value);
|
1105
|
-
value = value.succ();
|
1106
|
-
}
|
1107
|
-
},
|
1108
|
-
|
1109
|
-
include: function(value) {
|
1110
|
-
if (value < this.start)
|
1111
|
-
return false;
|
1112
|
-
if (this.exclusive)
|
1113
|
-
return value < this.end;
|
1114
|
-
return value <= this.end;
|
1115
|
-
}
|
1116
|
-
});
|
1117
|
-
|
1118
|
-
var $R = function(start, end, exclusive) {
|
1119
|
-
return new ObjectRange(start, end, exclusive);
|
1120
|
-
};
|
1121
|
-
|
1122
|
-
var Ajax = {
|
1123
|
-
getTransport: function() {
|
1124
|
-
return Try.these(
|
1125
|
-
function() {return new XMLHttpRequest()},
|
1126
|
-
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
|
1127
|
-
function() {return new ActiveXObject('Microsoft.XMLHTTP')}
|
1128
|
-
) || false;
|
1129
|
-
},
|
1130
|
-
|
1131
|
-
activeRequestCount: 0
|
1132
|
-
};
|
1133
|
-
|
1134
|
-
Ajax.Responders = {
|
1135
|
-
responders: [],
|
1136
|
-
|
1137
|
-
_each: function(iterator) {
|
1138
|
-
this.responders._each(iterator);
|
1139
|
-
},
|
1140
|
-
|
1141
|
-
register: function(responder) {
|
1142
|
-
if (!this.include(responder))
|
1143
|
-
this.responders.push(responder);
|
1144
|
-
},
|
1145
|
-
|
1146
|
-
unregister: function(responder) {
|
1147
|
-
this.responders = this.responders.without(responder);
|
1148
|
-
},
|
1149
|
-
|
1150
|
-
dispatch: function(callback, request, transport, json) {
|
1151
|
-
this.each(function(responder) {
|
1152
|
-
if (Object.isFunction(responder[callback])) {
|
1153
|
-
try {
|
1154
|
-
responder[callback].apply(responder, [request, transport, json]);
|
1155
|
-
} catch (e) { }
|
1156
|
-
}
|
1157
|
-
});
|
1158
|
-
}
|
1159
|
-
};
|
1160
|
-
|
1161
|
-
Object.extend(Ajax.Responders, Enumerable);
|
1162
|
-
|
1163
|
-
Ajax.Responders.register({
|
1164
|
-
onCreate: function() { Ajax.activeRequestCount++ },
|
1165
|
-
onComplete: function() { Ajax.activeRequestCount-- }
|
1166
|
-
});
|
1167
|
-
|
1168
|
-
Ajax.Base = Class.create({
|
1169
|
-
initialize: function(options) {
|
1170
|
-
this.options = {
|
1171
|
-
method: 'post',
|
1172
|
-
asynchronous: true,
|
1173
|
-
contentType: 'application/x-www-form-urlencoded',
|
1174
|
-
encoding: 'UTF-8',
|
1175
|
-
parameters: '',
|
1176
|
-
evalJSON: true,
|
1177
|
-
evalJS: true
|
1178
|
-
};
|
1179
|
-
Object.extend(this.options, options || { });
|
1180
|
-
|
1181
|
-
this.options.method = this.options.method.toLowerCase();
|
1182
|
-
|
1183
|
-
if (Object.isString(this.options.parameters))
|
1184
|
-
this.options.parameters = this.options.parameters.toQueryParams();
|
1185
|
-
else if (Object.isHash(this.options.parameters))
|
1186
|
-
this.options.parameters = this.options.parameters.toObject();
|
1187
|
-
}
|
1188
|
-
});
|
1189
|
-
|
1190
|
-
Ajax.Request = Class.create(Ajax.Base, {
|
1191
|
-
_complete: false,
|
1192
|
-
|
1193
|
-
initialize: function($super, url, options) {
|
1194
|
-
$super(options);
|
1195
|
-
this.transport = Ajax.getTransport();
|
1196
|
-
this.request(url);
|
1197
|
-
},
|
1198
|
-
|
1199
|
-
request: function(url) {
|
1200
|
-
this.url = url;
|
1201
|
-
this.method = this.options.method;
|
1202
|
-
var params = Object.clone(this.options.parameters);
|
1203
|
-
|
1204
|
-
if (!['get', 'post'].include(this.method)) {
|
1205
|
-
// simulate other verbs over post
|
1206
|
-
params['_method'] = this.method;
|
1207
|
-
this.method = 'post';
|
1208
|
-
}
|
1209
|
-
|
1210
|
-
this.parameters = params;
|
1211
|
-
|
1212
|
-
if (params = Object.toQueryString(params)) {
|
1213
|
-
// when GET, append parameters to URL
|
1214
|
-
if (this.method == 'get')
|
1215
|
-
this.url += (this.url.include('?') ? '&' : '?') + params;
|
1216
|
-
else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
|
1217
|
-
params += '&_=';
|
1218
|
-
}
|
1219
|
-
|
1220
|
-
try {
|
1221
|
-
var response = new Ajax.Response(this);
|
1222
|
-
if (this.options.onCreate) this.options.onCreate(response);
|
1223
|
-
Ajax.Responders.dispatch('onCreate', this, response);
|
1224
|
-
|
1225
|
-
this.transport.open(this.method.toUpperCase(), this.url,
|
1226
|
-
this.options.asynchronous);
|
1227
|
-
|
1228
|
-
if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
|
1229
|
-
|
1230
|
-
this.transport.onreadystatechange = this.onStateChange.bind(this);
|
1231
|
-
this.setRequestHeaders();
|
1232
|
-
|
1233
|
-
this.body = this.method == 'post' ? (this.options.postBody || params) : null;
|
1234
|
-
this.transport.send(this.body);
|
1235
|
-
|
1236
|
-
/* Force Firefox to handle ready state 4 for synchronous requests */
|
1237
|
-
if (!this.options.asynchronous && this.transport.overrideMimeType)
|
1238
|
-
this.onStateChange();
|
1239
|
-
|
1240
|
-
}
|
1241
|
-
catch (e) {
|
1242
|
-
this.dispatchException(e);
|
1243
|
-
}
|
1244
|
-
},
|
1245
|
-
|
1246
|
-
onStateChange: function() {
|
1247
|
-
var readyState = this.transport.readyState;
|
1248
|
-
if (readyState > 1 && !((readyState == 4) && this._complete))
|
1249
|
-
this.respondToReadyState(this.transport.readyState);
|
1250
|
-
},
|
1251
|
-
|
1252
|
-
setRequestHeaders: function() {
|
1253
|
-
var headers = {
|
1254
|
-
'X-Requested-With': 'XMLHttpRequest',
|
1255
|
-
'X-Prototype-Version': Prototype.Version,
|
1256
|
-
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
|
1257
|
-
};
|
1258
|
-
|
1259
|
-
if (this.method == 'post') {
|
1260
|
-
headers['Content-type'] = this.options.contentType +
|
1261
|
-
(this.options.encoding ? '; charset=' + this.options.encoding : '');
|
1262
|
-
|
1263
|
-
/* Force "Connection: close" for older Mozilla browsers to work
|
1264
|
-
* around a bug where XMLHttpRequest sends an incorrect
|
1265
|
-
* Content-length header. See Mozilla Bugzilla #246651.
|
1266
|
-
*/
|
1267
|
-
if (this.transport.overrideMimeType &&
|
1268
|
-
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
|
1269
|
-
headers['Connection'] = 'close';
|
1270
|
-
}
|
1271
|
-
|
1272
|
-
// user-defined headers
|
1273
|
-
if (typeof this.options.requestHeaders == 'object') {
|
1274
|
-
var extras = this.options.requestHeaders;
|
1275
|
-
|
1276
|
-
if (Object.isFunction(extras.push))
|
1277
|
-
for (var i = 0, length = extras.length; i < length; i += 2)
|
1278
|
-
headers[extras[i]] = extras[i+1];
|
1279
|
-
else
|
1280
|
-
$H(extras).each(function(pair) { headers[pair.key] = pair.value });
|
1281
|
-
}
|
1282
|
-
|
1283
|
-
for (var name in headers)
|
1284
|
-
this.transport.setRequestHeader(name, headers[name]);
|
1285
|
-
},
|
1286
|
-
|
1287
|
-
success: function() {
|
1288
|
-
var status = this.getStatus();
|
1289
|
-
return !status || (status >= 200 && status < 300);
|
1290
|
-
},
|
1291
|
-
|
1292
|
-
getStatus: function() {
|
1293
|
-
try {
|
1294
|
-
return this.transport.status || 0;
|
1295
|
-
} catch (e) { return 0 }
|
1296
|
-
},
|
1297
|
-
|
1298
|
-
respondToReadyState: function(readyState) {
|
1299
|
-
var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
|
1300
|
-
|
1301
|
-
if (state == 'Complete') {
|
1302
|
-
try {
|
1303
|
-
this._complete = true;
|
1304
|
-
(this.options['on' + response.status]
|
1305
|
-
|| this.options['on' + (this.success() ? 'Success' : 'Failure')]
|
1306
|
-
|| Prototype.emptyFunction)(response, response.headerJSON);
|
1307
|
-
} catch (e) {
|
1308
|
-
this.dispatchException(e);
|
1309
|
-
}
|
1310
|
-
|
1311
|
-
var contentType = response.getHeader('Content-type');
|
1312
|
-
if (this.options.evalJS == 'force'
|
1313
|
-
|| (this.options.evalJS && this.isSameOrigin() && contentType
|
1314
|
-
&& contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
|
1315
|
-
this.evalResponse();
|
1316
|
-
}
|
1317
|
-
|
1318
|
-
try {
|
1319
|
-
(this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
|
1320
|
-
Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
|
1321
|
-
} catch (e) {
|
1322
|
-
this.dispatchException(e);
|
1323
|
-
}
|
1324
|
-
|
1325
|
-
if (state == 'Complete') {
|
1326
|
-
// avoid memory leak in MSIE: clean up
|
1327
|
-
this.transport.onreadystatechange = Prototype.emptyFunction;
|
1328
|
-
}
|
1329
|
-
},
|
1330
|
-
|
1331
|
-
isSameOrigin: function() {
|
1332
|
-
var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
|
1333
|
-
return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
|
1334
|
-
protocol: location.protocol,
|
1335
|
-
domain: document.domain,
|
1336
|
-
port: location.port ? ':' + location.port : ''
|
1337
|
-
}));
|
1338
|
-
},
|
1339
|
-
|
1340
|
-
getHeader: function(name) {
|
1341
|
-
try {
|
1342
|
-
return this.transport.getResponseHeader(name) || null;
|
1343
|
-
} catch (e) { return null }
|
1344
|
-
},
|
1345
|
-
|
1346
|
-
evalResponse: function() {
|
1347
|
-
try {
|
1348
|
-
return eval((this.transport.responseText || '').unfilterJSON());
|
1349
|
-
} catch (e) {
|
1350
|
-
this.dispatchException(e);
|
1351
|
-
}
|
1352
|
-
},
|
1353
|
-
|
1354
|
-
dispatchException: function(exception) {
|
1355
|
-
(this.options.onException || Prototype.emptyFunction)(this, exception);
|
1356
|
-
Ajax.Responders.dispatch('onException', this, exception);
|
1357
|
-
}
|
1358
|
-
});
|
1359
|
-
|
1360
|
-
Ajax.Request.Events =
|
1361
|
-
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
|
1362
|
-
|
1363
|
-
Ajax.Response = Class.create({
|
1364
|
-
initialize: function(request){
|
1365
|
-
this.request = request;
|
1366
|
-
var transport = this.transport = request.transport,
|
1367
|
-
readyState = this.readyState = transport.readyState;
|
1368
|
-
|
1369
|
-
if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
|
1370
|
-
this.status = this.getStatus();
|
1371
|
-
this.statusText = this.getStatusText();
|
1372
|
-
this.responseText = String.interpret(transport.responseText);
|
1373
|
-
this.headerJSON = this._getHeaderJSON();
|
1374
|
-
}
|
1375
|
-
|
1376
|
-
if(readyState == 4) {
|
1377
|
-
var xml = transport.responseXML;
|
1378
|
-
this.responseXML = Object.isUndefined(xml) ? null : xml;
|
1379
|
-
this.responseJSON = this._getResponseJSON();
|
1380
|
-
}
|
1381
|
-
},
|
1382
|
-
|
1383
|
-
status: 0,
|
1384
|
-
statusText: '',
|
1385
|
-
|
1386
|
-
getStatus: Ajax.Request.prototype.getStatus,
|
1387
|
-
|
1388
|
-
getStatusText: function() {
|
1389
|
-
try {
|
1390
|
-
return this.transport.statusText || '';
|
1391
|
-
} catch (e) { return '' }
|
1392
|
-
},
|
1393
|
-
|
1394
|
-
getHeader: Ajax.Request.prototype.getHeader,
|
1395
|
-
|
1396
|
-
getAllHeaders: function() {
|
1397
|
-
try {
|
1398
|
-
return this.getAllResponseHeaders();
|
1399
|
-
} catch (e) { return null }
|
1400
|
-
},
|
1401
|
-
|
1402
|
-
getResponseHeader: function(name) {
|
1403
|
-
return this.transport.getResponseHeader(name);
|
1404
|
-
},
|
1405
|
-
|
1406
|
-
getAllResponseHeaders: function() {
|
1407
|
-
return this.transport.getAllResponseHeaders();
|
1408
|
-
},
|
1409
|
-
|
1410
|
-
_getHeaderJSON: function() {
|
1411
|
-
var json = this.getHeader('X-JSON');
|
1412
|
-
if (!json) return null;
|
1413
|
-
json = decodeURIComponent(escape(json));
|
1414
|
-
try {
|
1415
|
-
return json.evalJSON(this.request.options.sanitizeJSON ||
|
1416
|
-
!this.request.isSameOrigin());
|
1417
|
-
} catch (e) {
|
1418
|
-
this.request.dispatchException(e);
|
1419
|
-
}
|
1420
|
-
},
|
1421
|
-
|
1422
|
-
_getResponseJSON: function() {
|
1423
|
-
var options = this.request.options;
|
1424
|
-
if (!options.evalJSON || (options.evalJSON != 'force' &&
|
1425
|
-
!(this.getHeader('Content-type') || '').include('application/json')) ||
|
1426
|
-
this.responseText.blank())
|
1427
|
-
return null;
|
1428
|
-
try {
|
1429
|
-
return this.responseText.evalJSON(options.sanitizeJSON ||
|
1430
|
-
!this.request.isSameOrigin());
|
1431
|
-
} catch (e) {
|
1432
|
-
this.request.dispatchException(e);
|
1433
|
-
}
|
1434
|
-
}
|
1435
|
-
});
|
1436
|
-
|
1437
|
-
Ajax.Updater = Class.create(Ajax.Request, {
|
1438
|
-
initialize: function($super, container, url, options) {
|
1439
|
-
this.container = {
|
1440
|
-
success: (container.success || container),
|
1441
|
-
failure: (container.failure || (container.success ? null : container))
|
1442
|
-
};
|
1443
|
-
|
1444
|
-
options = Object.clone(options);
|
1445
|
-
var onComplete = options.onComplete;
|
1446
|
-
options.onComplete = (function(response, json) {
|
1447
|
-
this.updateContent(response.responseText);
|
1448
|
-
if (Object.isFunction(onComplete)) onComplete(response, json);
|
1449
|
-
}).bind(this);
|
1450
|
-
|
1451
|
-
$super(url, options);
|
1452
|
-
},
|
1453
|
-
|
1454
|
-
updateContent: function(responseText) {
|
1455
|
-
var receiver = this.container[this.success() ? 'success' : 'failure'],
|
1456
|
-
options = this.options;
|
1457
|
-
|
1458
|
-
if (!options.evalScripts) responseText = responseText.stripScripts();
|
1459
|
-
|
1460
|
-
if (receiver = $(receiver)) {
|
1461
|
-
if (options.insertion) {
|
1462
|
-
if (Object.isString(options.insertion)) {
|
1463
|
-
var insertion = { }; insertion[options.insertion] = responseText;
|
1464
|
-
receiver.insert(insertion);
|
1465
|
-
}
|
1466
|
-
else options.insertion(receiver, responseText);
|
1467
|
-
}
|
1468
|
-
else receiver.update(responseText);
|
1469
|
-
}
|
1470
|
-
}
|
1471
|
-
});
|
1472
|
-
|
1473
|
-
Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
|
1474
|
-
initialize: function($super, container, url, options) {
|
1475
|
-
$super(options);
|
1476
|
-
this.onComplete = this.options.onComplete;
|
1477
|
-
|
1478
|
-
this.frequency = (this.options.frequency || 2);
|
1479
|
-
this.decay = (this.options.decay || 1);
|
1480
|
-
|
1481
|
-
this.updater = { };
|
1482
|
-
this.container = container;
|
1483
|
-
this.url = url;
|
1484
|
-
|
1485
|
-
this.start();
|
1486
|
-
},
|
1487
|
-
|
1488
|
-
start: function() {
|
1489
|
-
this.options.onComplete = this.updateComplete.bind(this);
|
1490
|
-
this.onTimerEvent();
|
1491
|
-
},
|
1492
|
-
|
1493
|
-
stop: function() {
|
1494
|
-
this.updater.options.onComplete = undefined;
|
1495
|
-
clearTimeout(this.timer);
|
1496
|
-
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
|
1497
|
-
},
|
1498
|
-
|
1499
|
-
updateComplete: function(response) {
|
1500
|
-
if (this.options.decay) {
|
1501
|
-
this.decay = (response.responseText == this.lastText ?
|
1502
|
-
this.decay * this.options.decay : 1);
|
1503
|
-
|
1504
|
-
this.lastText = response.responseText;
|
1505
|
-
}
|
1506
|
-
this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
|
1507
|
-
},
|
1508
|
-
|
1509
|
-
onTimerEvent: function() {
|
1510
|
-
this.updater = new Ajax.Updater(this.container, this.url, this.options);
|
1511
|
-
}
|
1512
|
-
});
|
1513
|
-
function $(element) {
|
1514
|
-
if (arguments.length > 1) {
|
1515
|
-
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
|
1516
|
-
elements.push($(arguments[i]));
|
1517
|
-
return elements;
|
1518
|
-
}
|
1519
|
-
if (Object.isString(element))
|
1520
|
-
element = document.getElementById(element);
|
1521
|
-
return Element.extend(element);
|
1522
|
-
}
|
1523
|
-
|
1524
|
-
if (Prototype.BrowserFeatures.XPath) {
|
1525
|
-
document._getElementsByXPath = function(expression, parentElement) {
|
1526
|
-
var results = [];
|
1527
|
-
var query = document.evaluate(expression, $(parentElement) || document,
|
1528
|
-
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
|
1529
|
-
for (var i = 0, length = query.snapshotLength; i < length; i++)
|
1530
|
-
results.push(Element.extend(query.snapshotItem(i)));
|
1531
|
-
return results;
|
1532
|
-
};
|
1533
|
-
}
|
1534
|
-
|
1535
|
-
/*--------------------------------------------------------------------------*/
|
1536
|
-
|
1537
|
-
if (!window.Node) var Node = { };
|
1538
|
-
|
1539
|
-
if (!Node.ELEMENT_NODE) {
|
1540
|
-
// DOM level 2 ECMAScript Language Binding
|
1541
|
-
Object.extend(Node, {
|
1542
|
-
ELEMENT_NODE: 1,
|
1543
|
-
ATTRIBUTE_NODE: 2,
|
1544
|
-
TEXT_NODE: 3,
|
1545
|
-
CDATA_SECTION_NODE: 4,
|
1546
|
-
ENTITY_REFERENCE_NODE: 5,
|
1547
|
-
ENTITY_NODE: 6,
|
1548
|
-
PROCESSING_INSTRUCTION_NODE: 7,
|
1549
|
-
COMMENT_NODE: 8,
|
1550
|
-
DOCUMENT_NODE: 9,
|
1551
|
-
DOCUMENT_TYPE_NODE: 10,
|
1552
|
-
DOCUMENT_FRAGMENT_NODE: 11,
|
1553
|
-
NOTATION_NODE: 12
|
1554
|
-
});
|
1555
|
-
}
|
1556
|
-
|
1557
|
-
(function() {
|
1558
|
-
var element = this.Element;
|
1559
|
-
this.Element = function(tagName, attributes) {
|
1560
|
-
attributes = attributes || { };
|
1561
|
-
tagName = tagName.toLowerCase();
|
1562
|
-
var cache = Element.cache;
|
1563
|
-
if (Prototype.Browser.IE && attributes.name) {
|
1564
|
-
tagName = '<' + tagName + ' name="' + attributes.name + '">';
|
1565
|
-
delete attributes.name;
|
1566
|
-
return Element.writeAttribute(document.createElement(tagName), attributes);
|
1567
|
-
}
|
1568
|
-
if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
|
1569
|
-
return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
|
1570
|
-
};
|
1571
|
-
Object.extend(this.Element, element || { });
|
1572
|
-
if (element) this.Element.prototype = element.prototype;
|
1573
|
-
}).call(window);
|
1574
|
-
|
1575
|
-
Element.cache = { };
|
1576
|
-
|
1577
|
-
Element.Methods = {
|
1578
|
-
visible: function(element) {
|
1579
|
-
return $(element).style.display != 'none';
|
1580
|
-
},
|
1581
|
-
|
1582
|
-
toggle: function(element) {
|
1583
|
-
element = $(element);
|
1584
|
-
Element[Element.visible(element) ? 'hide' : 'show'](element);
|
1585
|
-
return element;
|
1586
|
-
},
|
1587
|
-
|
1588
|
-
hide: function(element) {
|
1589
|
-
element = $(element);
|
1590
|
-
element.style.display = 'none';
|
1591
|
-
return element;
|
1592
|
-
},
|
1593
|
-
|
1594
|
-
show: function(element) {
|
1595
|
-
element = $(element);
|
1596
|
-
element.style.display = '';
|
1597
|
-
return element;
|
1598
|
-
},
|
1599
|
-
|
1600
|
-
remove: function(element) {
|
1601
|
-
element = $(element);
|
1602
|
-
element.parentNode.removeChild(element);
|
1603
|
-
return element;
|
1604
|
-
},
|
1605
|
-
|
1606
|
-
update: function(element, content) {
|
1607
|
-
element = $(element);
|
1608
|
-
if (content && content.toElement) content = content.toElement();
|
1609
|
-
if (Object.isElement(content)) return element.update().insert(content);
|
1610
|
-
content = Object.toHTML(content);
|
1611
|
-
element.innerHTML = content.stripScripts();
|
1612
|
-
content.evalScripts.bind(content).defer();
|
1613
|
-
return element;
|
1614
|
-
},
|
1615
|
-
|
1616
|
-
replace: function(element, content) {
|
1617
|
-
element = $(element);
|
1618
|
-
if (content && content.toElement) content = content.toElement();
|
1619
|
-
else if (!Object.isElement(content)) {
|
1620
|
-
content = Object.toHTML(content);
|
1621
|
-
var range = element.ownerDocument.createRange();
|
1622
|
-
range.selectNode(element);
|
1623
|
-
content.evalScripts.bind(content).defer();
|
1624
|
-
content = range.createContextualFragment(content.stripScripts());
|
1625
|
-
}
|
1626
|
-
element.parentNode.replaceChild(content, element);
|
1627
|
-
return element;
|
1628
|
-
},
|
1629
|
-
|
1630
|
-
insert: function(element, insertions) {
|
1631
|
-
element = $(element);
|
1632
|
-
|
1633
|
-
if (Object.isString(insertions) || Object.isNumber(insertions) ||
|
1634
|
-
Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
|
1635
|
-
insertions = {bottom:insertions};
|
1636
|
-
|
1637
|
-
var content, insert, tagName, childNodes;
|
1638
|
-
|
1639
|
-
for (var position in insertions) {
|
1640
|
-
content = insertions[position];
|
1641
|
-
position = position.toLowerCase();
|
1642
|
-
insert = Element._insertionTranslations[position];
|
1643
|
-
|
1644
|
-
if (content && content.toElement) content = content.toElement();
|
1645
|
-
if (Object.isElement(content)) {
|
1646
|
-
insert(element, content);
|
1647
|
-
continue;
|
1648
|
-
}
|
1649
|
-
|
1650
|
-
content = Object.toHTML(content);
|
1651
|
-
|
1652
|
-
tagName = ((position == 'before' || position == 'after')
|
1653
|
-
? element.parentNode : element).tagName.toUpperCase();
|
1654
|
-
|
1655
|
-
childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
|
1656
|
-
|
1657
|
-
if (position == 'top' || position == 'after') childNodes.reverse();
|
1658
|
-
childNodes.each(insert.curry(element));
|
1659
|
-
|
1660
|
-
content.evalScripts.bind(content).defer();
|
1661
|
-
}
|
1662
|
-
|
1663
|
-
return element;
|
1664
|
-
},
|
1665
|
-
|
1666
|
-
wrap: function(element, wrapper, attributes) {
|
1667
|
-
element = $(element);
|
1668
|
-
if (Object.isElement(wrapper))
|
1669
|
-
$(wrapper).writeAttribute(attributes || { });
|
1670
|
-
else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
|
1671
|
-
else wrapper = new Element('div', wrapper);
|
1672
|
-
if (element.parentNode)
|
1673
|
-
element.parentNode.replaceChild(wrapper, element);
|
1674
|
-
wrapper.appendChild(element);
|
1675
|
-
return wrapper;
|
1676
|
-
},
|
1677
|
-
|
1678
|
-
inspect: function(element) {
|
1679
|
-
element = $(element);
|
1680
|
-
var result = '<' + element.tagName.toLowerCase();
|
1681
|
-
$H({'id': 'id', 'className': 'class'}).each(function(pair) {
|
1682
|
-
var property = pair.first(), attribute = pair.last();
|
1683
|
-
var value = (element[property] || '').toString();
|
1684
|
-
if (value) result += ' ' + attribute + '=' + value.inspect(true);
|
1685
|
-
});
|
1686
|
-
return result + '>';
|
1687
|
-
},
|
1688
|
-
|
1689
|
-
recursivelyCollect: function(element, property) {
|
1690
|
-
element = $(element);
|
1691
|
-
var elements = [];
|
1692
|
-
while (element = element[property])
|
1693
|
-
if (element.nodeType == 1)
|
1694
|
-
elements.push(Element.extend(element));
|
1695
|
-
return elements;
|
1696
|
-
},
|
1697
|
-
|
1698
|
-
ancestors: function(element) {
|
1699
|
-
return $(element).recursivelyCollect('parentNode');
|
1700
|
-
},
|
1701
|
-
|
1702
|
-
descendants: function(element) {
|
1703
|
-
return $(element).select("*");
|
1704
|
-
},
|
1705
|
-
|
1706
|
-
firstDescendant: function(element) {
|
1707
|
-
element = $(element).firstChild;
|
1708
|
-
while (element && element.nodeType != 1) element = element.nextSibling;
|
1709
|
-
return $(element);
|
1710
|
-
},
|
1711
|
-
|
1712
|
-
immediateDescendants: function(element) {
|
1713
|
-
if (!(element = $(element).firstChild)) return [];
|
1714
|
-
while (element && element.nodeType != 1) element = element.nextSibling;
|
1715
|
-
if (element) return [element].concat($(element).nextSiblings());
|
1716
|
-
return [];
|
1717
|
-
},
|
1718
|
-
|
1719
|
-
previousSiblings: function(element) {
|
1720
|
-
return $(element).recursivelyCollect('previousSibling');
|
1721
|
-
},
|
1722
|
-
|
1723
|
-
nextSiblings: function(element) {
|
1724
|
-
return $(element).recursivelyCollect('nextSibling');
|
1725
|
-
},
|
1726
|
-
|
1727
|
-
siblings: function(element) {
|
1728
|
-
element = $(element);
|
1729
|
-
return element.previousSiblings().reverse().concat(element.nextSiblings());
|
1730
|
-
},
|
1731
|
-
|
1732
|
-
match: function(element, selector) {
|
1733
|
-
if (Object.isString(selector))
|
1734
|
-
selector = new Selector(selector);
|
1735
|
-
return selector.match($(element));
|
1736
|
-
},
|
1737
|
-
|
1738
|
-
up: function(element, expression, index) {
|
1739
|
-
element = $(element);
|
1740
|
-
if (arguments.length == 1) return $(element.parentNode);
|
1741
|
-
var ancestors = element.ancestors();
|
1742
|
-
return Object.isNumber(expression) ? ancestors[expression] :
|
1743
|
-
Selector.findElement(ancestors, expression, index);
|
1744
|
-
},
|
1745
|
-
|
1746
|
-
down: function(element, expression, index) {
|
1747
|
-
element = $(element);
|
1748
|
-
if (arguments.length == 1) return element.firstDescendant();
|
1749
|
-
return Object.isNumber(expression) ? element.descendants()[expression] :
|
1750
|
-
Element.select(element, expression)[index || 0];
|
1751
|
-
},
|
1752
|
-
|
1753
|
-
previous: function(element, expression, index) {
|
1754
|
-
element = $(element);
|
1755
|
-
if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
|
1756
|
-
var previousSiblings = element.previousSiblings();
|
1757
|
-
return Object.isNumber(expression) ? previousSiblings[expression] :
|
1758
|
-
Selector.findElement(previousSiblings, expression, index);
|
1759
|
-
},
|
1760
|
-
|
1761
|
-
next: function(element, expression, index) {
|
1762
|
-
element = $(element);
|
1763
|
-
if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
|
1764
|
-
var nextSiblings = element.nextSiblings();
|
1765
|
-
return Object.isNumber(expression) ? nextSiblings[expression] :
|
1766
|
-
Selector.findElement(nextSiblings, expression, index);
|
1767
|
-
},
|
1768
|
-
|
1769
|
-
select: function() {
|
1770
|
-
var args = $A(arguments), element = $(args.shift());
|
1771
|
-
return Selector.findChildElements(element, args);
|
1772
|
-
},
|
1773
|
-
|
1774
|
-
adjacent: function() {
|
1775
|
-
var args = $A(arguments), element = $(args.shift());
|
1776
|
-
return Selector.findChildElements(element.parentNode, args).without(element);
|
1777
|
-
},
|
1778
|
-
|
1779
|
-
identify: function(element) {
|
1780
|
-
element = $(element);
|
1781
|
-
var id = element.readAttribute('id'), self = arguments.callee;
|
1782
|
-
if (id) return id;
|
1783
|
-
do { id = 'anonymous_element_' + self.counter++ } while ($(id));
|
1784
|
-
element.writeAttribute('id', id);
|
1785
|
-
return id;
|
1786
|
-
},
|
1787
|
-
|
1788
|
-
readAttribute: function(element, name) {
|
1789
|
-
element = $(element);
|
1790
|
-
if (Prototype.Browser.IE) {
|
1791
|
-
var t = Element._attributeTranslations.read;
|
1792
|
-
if (t.values[name]) return t.values[name](element, name);
|
1793
|
-
if (t.names[name]) name = t.names[name];
|
1794
|
-
if (name.include(':')) {
|
1795
|
-
return (!element.attributes || !element.attributes[name]) ? null :
|
1796
|
-
element.attributes[name].value;
|
1797
|
-
}
|
1798
|
-
}
|
1799
|
-
return element.getAttribute(name);
|
1800
|
-
},
|
1801
|
-
|
1802
|
-
writeAttribute: function(element, name, value) {
|
1803
|
-
element = $(element);
|
1804
|
-
var attributes = { }, t = Element._attributeTranslations.write;
|
1805
|
-
|
1806
|
-
if (typeof name == 'object') attributes = name;
|
1807
|
-
else attributes[name] = Object.isUndefined(value) ? true : value;
|
1808
|
-
|
1809
|
-
for (var attr in attributes) {
|
1810
|
-
name = t.names[attr] || attr;
|
1811
|
-
value = attributes[attr];
|
1812
|
-
if (t.values[attr]) name = t.values[attr](element, value);
|
1813
|
-
if (value === false || value === null)
|
1814
|
-
element.removeAttribute(name);
|
1815
|
-
else if (value === true)
|
1816
|
-
element.setAttribute(name, name);
|
1817
|
-
else element.setAttribute(name, value);
|
1818
|
-
}
|
1819
|
-
return element;
|
1820
|
-
},
|
1821
|
-
|
1822
|
-
getHeight: function(element) {
|
1823
|
-
return $(element).getDimensions().height;
|
1824
|
-
},
|
1825
|
-
|
1826
|
-
getWidth: function(element) {
|
1827
|
-
return $(element).getDimensions().width;
|
1828
|
-
},
|
1829
|
-
|
1830
|
-
classNames: function(element) {
|
1831
|
-
return new Element.ClassNames(element);
|
1832
|
-
},
|
1833
|
-
|
1834
|
-
hasClassName: function(element, className) {
|
1835
|
-
if (!(element = $(element))) return;
|
1836
|
-
var elementClassName = element.className;
|
1837
|
-
return (elementClassName.length > 0 && (elementClassName == className ||
|
1838
|
-
new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
|
1839
|
-
},
|
1840
|
-
|
1841
|
-
addClassName: function(element, className) {
|
1842
|
-
if (!(element = $(element))) return;
|
1843
|
-
if (!element.hasClassName(className))
|
1844
|
-
element.className += (element.className ? ' ' : '') + className;
|
1845
|
-
return element;
|
1846
|
-
},
|
1847
|
-
|
1848
|
-
removeClassName: function(element, className) {
|
1849
|
-
if (!(element = $(element))) return;
|
1850
|
-
element.className = element.className.replace(
|
1851
|
-
new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
|
1852
|
-
return element;
|
1853
|
-
},
|
1854
|
-
|
1855
|
-
toggleClassName: function(element, className) {
|
1856
|
-
if (!(element = $(element))) return;
|
1857
|
-
return element[element.hasClassName(className) ?
|
1858
|
-
'removeClassName' : 'addClassName'](className);
|
1859
|
-
},
|
1860
|
-
|
1861
|
-
// removes whitespace-only text node children
|
1862
|
-
cleanWhitespace: function(element) {
|
1863
|
-
element = $(element);
|
1864
|
-
var node = element.firstChild;
|
1865
|
-
while (node) {
|
1866
|
-
var nextNode = node.nextSibling;
|
1867
|
-
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
|
1868
|
-
element.removeChild(node);
|
1869
|
-
node = nextNode;
|
1870
|
-
}
|
1871
|
-
return element;
|
1872
|
-
},
|
1873
|
-
|
1874
|
-
empty: function(element) {
|
1875
|
-
return $(element).innerHTML.blank();
|
1876
|
-
},
|
1877
|
-
|
1878
|
-
descendantOf: function(element, ancestor) {
|
1879
|
-
element = $(element), ancestor = $(ancestor);
|
1880
|
-
|
1881
|
-
if (element.compareDocumentPosition)
|
1882
|
-
return (element.compareDocumentPosition(ancestor) & 8) === 8;
|
1883
|
-
|
1884
|
-
if (ancestor.contains)
|
1885
|
-
return ancestor.contains(element) && ancestor !== element;
|
1886
|
-
|
1887
|
-
while (element = element.parentNode)
|
1888
|
-
if (element == ancestor) return true;
|
1889
|
-
|
1890
|
-
return false;
|
1891
|
-
},
|
1892
|
-
|
1893
|
-
scrollTo: function(element) {
|
1894
|
-
element = $(element);
|
1895
|
-
var pos = element.cumulativeOffset();
|
1896
|
-
window.scrollTo(pos[0], pos[1]);
|
1897
|
-
return element;
|
1898
|
-
},
|
1899
|
-
|
1900
|
-
getStyle: function(element, style) {
|
1901
|
-
element = $(element);
|
1902
|
-
style = style == 'float' ? 'cssFloat' : style.camelize();
|
1903
|
-
var value = element.style[style];
|
1904
|
-
if (!value || value == 'auto') {
|
1905
|
-
var css = document.defaultView.getComputedStyle(element, null);
|
1906
|
-
value = css ? css[style] : null;
|
1907
|
-
}
|
1908
|
-
if (style == 'opacity') return value ? parseFloat(value) : 1.0;
|
1909
|
-
return value == 'auto' ? null : value;
|
1910
|
-
},
|
1911
|
-
|
1912
|
-
getOpacity: function(element) {
|
1913
|
-
return $(element).getStyle('opacity');
|
1914
|
-
},
|
1915
|
-
|
1916
|
-
setStyle: function(element, styles) {
|
1917
|
-
element = $(element);
|
1918
|
-
var elementStyle = element.style, match;
|
1919
|
-
if (Object.isString(styles)) {
|
1920
|
-
element.style.cssText += ';' + styles;
|
1921
|
-
return styles.include('opacity') ?
|
1922
|
-
element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
|
1923
|
-
}
|
1924
|
-
for (var property in styles)
|
1925
|
-
if (property == 'opacity') element.setOpacity(styles[property]);
|
1926
|
-
else
|
1927
|
-
elementStyle[(property == 'float' || property == 'cssFloat') ?
|
1928
|
-
(Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
|
1929
|
-
property] = styles[property];
|
1930
|
-
|
1931
|
-
return element;
|
1932
|
-
},
|
1933
|
-
|
1934
|
-
setOpacity: function(element, value) {
|
1935
|
-
element = $(element);
|
1936
|
-
element.style.opacity = (value == 1 || value === '') ? '' :
|
1937
|
-
(value < 0.00001) ? 0 : value;
|
1938
|
-
return element;
|
1939
|
-
},
|
1940
|
-
|
1941
|
-
getDimensions: function(element) {
|
1942
|
-
element = $(element);
|
1943
|
-
var display = element.getStyle('display');
|
1944
|
-
if (display != 'none' && display != null) // Safari bug
|
1945
|
-
return {width: element.offsetWidth, height: element.offsetHeight};
|
1946
|
-
|
1947
|
-
// All *Width and *Height properties give 0 on elements with display none,
|
1948
|
-
// so enable the element temporarily
|
1949
|
-
var els = element.style;
|
1950
|
-
var originalVisibility = els.visibility;
|
1951
|
-
var originalPosition = els.position;
|
1952
|
-
var originalDisplay = els.display;
|
1953
|
-
els.visibility = 'hidden';
|
1954
|
-
els.position = 'absolute';
|
1955
|
-
els.display = 'block';
|
1956
|
-
var originalWidth = element.clientWidth;
|
1957
|
-
var originalHeight = element.clientHeight;
|
1958
|
-
els.display = originalDisplay;
|
1959
|
-
els.position = originalPosition;
|
1960
|
-
els.visibility = originalVisibility;
|
1961
|
-
return {width: originalWidth, height: originalHeight};
|
1962
|
-
},
|
1963
|
-
|
1964
|
-
makePositioned: function(element) {
|
1965
|
-
element = $(element);
|
1966
|
-
var pos = Element.getStyle(element, 'position');
|
1967
|
-
if (pos == 'static' || !pos) {
|
1968
|
-
element._madePositioned = true;
|
1969
|
-
element.style.position = 'relative';
|
1970
|
-
// Opera returns the offset relative to the positioning context, when an
|
1971
|
-
// element is position relative but top and left have not been defined
|
1972
|
-
if (Prototype.Browser.Opera) {
|
1973
|
-
element.style.top = 0;
|
1974
|
-
element.style.left = 0;
|
1975
|
-
}
|
1976
|
-
}
|
1977
|
-
return element;
|
1978
|
-
},
|
1979
|
-
|
1980
|
-
undoPositioned: function(element) {
|
1981
|
-
element = $(element);
|
1982
|
-
if (element._madePositioned) {
|
1983
|
-
element._madePositioned = undefined;
|
1984
|
-
element.style.position =
|
1985
|
-
element.style.top =
|
1986
|
-
element.style.left =
|
1987
|
-
element.style.bottom =
|
1988
|
-
element.style.right = '';
|
1989
|
-
}
|
1990
|
-
return element;
|
1991
|
-
},
|
1992
|
-
|
1993
|
-
makeClipping: function(element) {
|
1994
|
-
element = $(element);
|
1995
|
-
if (element._overflow) return element;
|
1996
|
-
element._overflow = Element.getStyle(element, 'overflow') || 'auto';
|
1997
|
-
if (element._overflow !== 'hidden')
|
1998
|
-
element.style.overflow = 'hidden';
|
1999
|
-
return element;
|
2000
|
-
},
|
2001
|
-
|
2002
|
-
undoClipping: function(element) {
|
2003
|
-
element = $(element);
|
2004
|
-
if (!element._overflow) return element;
|
2005
|
-
element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
|
2006
|
-
element._overflow = null;
|
2007
|
-
return element;
|
2008
|
-
},
|
2009
|
-
|
2010
|
-
cumulativeOffset: function(element) {
|
2011
|
-
var valueT = 0, valueL = 0;
|
2012
|
-
do {
|
2013
|
-
valueT += element.offsetTop || 0;
|
2014
|
-
valueL += element.offsetLeft || 0;
|
2015
|
-
element = element.offsetParent;
|
2016
|
-
} while (element);
|
2017
|
-
return Element._returnOffset(valueL, valueT);
|
2018
|
-
},
|
2019
|
-
|
2020
|
-
positionedOffset: function(element) {
|
2021
|
-
var valueT = 0, valueL = 0;
|
2022
|
-
do {
|
2023
|
-
valueT += element.offsetTop || 0;
|
2024
|
-
valueL += element.offsetLeft || 0;
|
2025
|
-
element = element.offsetParent;
|
2026
|
-
if (element) {
|
2027
|
-
if (element.tagName.toUpperCase() == 'BODY') break;
|
2028
|
-
var p = Element.getStyle(element, 'position');
|
2029
|
-
if (p !== 'static') break;
|
2030
|
-
}
|
2031
|
-
} while (element);
|
2032
|
-
return Element._returnOffset(valueL, valueT);
|
2033
|
-
},
|
2034
|
-
|
2035
|
-
absolutize: function(element) {
|
2036
|
-
element = $(element);
|
2037
|
-
if (element.getStyle('position') == 'absolute') return element;
|
2038
|
-
// Position.prepare(); // To be done manually by Scripty when it needs it.
|
2039
|
-
|
2040
|
-
var offsets = element.positionedOffset();
|
2041
|
-
var top = offsets[1];
|
2042
|
-
var left = offsets[0];
|
2043
|
-
var width = element.clientWidth;
|
2044
|
-
var height = element.clientHeight;
|
2045
|
-
|
2046
|
-
element._originalLeft = left - parseFloat(element.style.left || 0);
|
2047
|
-
element._originalTop = top - parseFloat(element.style.top || 0);
|
2048
|
-
element._originalWidth = element.style.width;
|
2049
|
-
element._originalHeight = element.style.height;
|
2050
|
-
|
2051
|
-
element.style.position = 'absolute';
|
2052
|
-
element.style.top = top + 'px';
|
2053
|
-
element.style.left = left + 'px';
|
2054
|
-
element.style.width = width + 'px';
|
2055
|
-
element.style.height = height + 'px';
|
2056
|
-
return element;
|
2057
|
-
},
|
2058
|
-
|
2059
|
-
relativize: function(element) {
|
2060
|
-
element = $(element);
|
2061
|
-
if (element.getStyle('position') == 'relative') return element;
|
2062
|
-
// Position.prepare(); // To be done manually by Scripty when it needs it.
|
2063
|
-
|
2064
|
-
element.style.position = 'relative';
|
2065
|
-
var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
|
2066
|
-
var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
|
2067
|
-
|
2068
|
-
element.style.top = top + 'px';
|
2069
|
-
element.style.left = left + 'px';
|
2070
|
-
element.style.height = element._originalHeight;
|
2071
|
-
element.style.width = element._originalWidth;
|
2072
|
-
return element;
|
2073
|
-
},
|
2074
|
-
|
2075
|
-
cumulativeScrollOffset: function(element) {
|
2076
|
-
var valueT = 0, valueL = 0;
|
2077
|
-
do {
|
2078
|
-
valueT += element.scrollTop || 0;
|
2079
|
-
valueL += element.scrollLeft || 0;
|
2080
|
-
element = element.parentNode;
|
2081
|
-
} while (element);
|
2082
|
-
return Element._returnOffset(valueL, valueT);
|
2083
|
-
},
|
2084
|
-
|
2085
|
-
getOffsetParent: function(element) {
|
2086
|
-
if (element.offsetParent) return $(element.offsetParent);
|
2087
|
-
if (element == document.body) return $(element);
|
2088
|
-
|
2089
|
-
while ((element = element.parentNode) && element != document.body)
|
2090
|
-
if (Element.getStyle(element, 'position') != 'static')
|
2091
|
-
return $(element);
|
2092
|
-
|
2093
|
-
return $(document.body);
|
2094
|
-
},
|
2095
|
-
|
2096
|
-
viewportOffset: function(forElement) {
|
2097
|
-
var valueT = 0, valueL = 0;
|
2098
|
-
|
2099
|
-
var element = forElement;
|
2100
|
-
do {
|
2101
|
-
valueT += element.offsetTop || 0;
|
2102
|
-
valueL += element.offsetLeft || 0;
|
2103
|
-
|
2104
|
-
// Safari fix
|
2105
|
-
if (element.offsetParent == document.body &&
|
2106
|
-
Element.getStyle(element, 'position') == 'absolute') break;
|
2107
|
-
|
2108
|
-
} while (element = element.offsetParent);
|
2109
|
-
|
2110
|
-
element = forElement;
|
2111
|
-
do {
|
2112
|
-
if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
|
2113
|
-
valueT -= element.scrollTop || 0;
|
2114
|
-
valueL -= element.scrollLeft || 0;
|
2115
|
-
}
|
2116
|
-
} while (element = element.parentNode);
|
2117
|
-
|
2118
|
-
return Element._returnOffset(valueL, valueT);
|
2119
|
-
},
|
2120
|
-
|
2121
|
-
clonePosition: function(element, source) {
|
2122
|
-
var options = Object.extend({
|
2123
|
-
setLeft: true,
|
2124
|
-
setTop: true,
|
2125
|
-
setWidth: true,
|
2126
|
-
setHeight: true,
|
2127
|
-
offsetTop: 0,
|
2128
|
-
offsetLeft: 0
|
2129
|
-
}, arguments[2] || { });
|
2130
|
-
|
2131
|
-
// find page position of source
|
2132
|
-
source = $(source);
|
2133
|
-
var p = source.viewportOffset();
|
2134
|
-
|
2135
|
-
// find coordinate system to use
|
2136
|
-
element = $(element);
|
2137
|
-
var delta = [0, 0];
|
2138
|
-
var parent = null;
|
2139
|
-
// delta [0,0] will do fine with position: fixed elements,
|
2140
|
-
// position:absolute needs offsetParent deltas
|
2141
|
-
if (Element.getStyle(element, 'position') == 'absolute') {
|
2142
|
-
parent = element.getOffsetParent();
|
2143
|
-
delta = parent.viewportOffset();
|
2144
|
-
}
|
2145
|
-
|
2146
|
-
// correct by body offsets (fixes Safari)
|
2147
|
-
if (parent == document.body) {
|
2148
|
-
delta[0] -= document.body.offsetLeft;
|
2149
|
-
delta[1] -= document.body.offsetTop;
|
2150
|
-
}
|
2151
|
-
|
2152
|
-
// set position
|
2153
|
-
if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
|
2154
|
-
if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
|
2155
|
-
if (options.setWidth) element.style.width = source.offsetWidth + 'px';
|
2156
|
-
if (options.setHeight) element.style.height = source.offsetHeight + 'px';
|
2157
|
-
return element;
|
2158
|
-
}
|
2159
|
-
};
|
2160
|
-
|
2161
|
-
Element.Methods.identify.counter = 1;
|
2162
|
-
|
2163
|
-
Object.extend(Element.Methods, {
|
2164
|
-
getElementsBySelector: Element.Methods.select,
|
2165
|
-
childElements: Element.Methods.immediateDescendants
|
2166
|
-
});
|
2167
|
-
|
2168
|
-
Element._attributeTranslations = {
|
2169
|
-
write: {
|
2170
|
-
names: {
|
2171
|
-
className: 'class',
|
2172
|
-
htmlFor: 'for'
|
2173
|
-
},
|
2174
|
-
values: { }
|
2175
|
-
}
|
2176
|
-
};
|
2177
|
-
|
2178
|
-
if (Prototype.Browser.Opera) {
|
2179
|
-
Element.Methods.getStyle = Element.Methods.getStyle.wrap(
|
2180
|
-
function(proceed, element, style) {
|
2181
|
-
switch (style) {
|
2182
|
-
case 'left': case 'top': case 'right': case 'bottom':
|
2183
|
-
if (proceed(element, 'position') === 'static') return null;
|
2184
|
-
case 'height': case 'width':
|
2185
|
-
// returns '0px' for hidden elements; we want it to return null
|
2186
|
-
if (!Element.visible(element)) return null;
|
2187
|
-
|
2188
|
-
// returns the border-box dimensions rather than the content-box
|
2189
|
-
// dimensions, so we subtract padding and borders from the value
|
2190
|
-
var dim = parseInt(proceed(element, style), 10);
|
2191
|
-
|
2192
|
-
if (dim !== element['offset' + style.capitalize()])
|
2193
|
-
return dim + 'px';
|
2194
|
-
|
2195
|
-
var properties;
|
2196
|
-
if (style === 'height') {
|
2197
|
-
properties = ['border-top-width', 'padding-top',
|
2198
|
-
'padding-bottom', 'border-bottom-width'];
|
2199
|
-
}
|
2200
|
-
else {
|
2201
|
-
properties = ['border-left-width', 'padding-left',
|
2202
|
-
'padding-right', 'border-right-width'];
|
2203
|
-
}
|
2204
|
-
return properties.inject(dim, function(memo, property) {
|
2205
|
-
var val = proceed(element, property);
|
2206
|
-
return val === null ? memo : memo - parseInt(val, 10);
|
2207
|
-
}) + 'px';
|
2208
|
-
default: return proceed(element, style);
|
2209
|
-
}
|
2210
|
-
}
|
2211
|
-
);
|
2212
|
-
|
2213
|
-
Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
|
2214
|
-
function(proceed, element, attribute) {
|
2215
|
-
if (attribute === 'title') return element.title;
|
2216
|
-
return proceed(element, attribute);
|
2217
|
-
}
|
2218
|
-
);
|
2219
|
-
}
|
2220
|
-
|
2221
|
-
else if (Prototype.Browser.IE) {
|
2222
|
-
// IE doesn't report offsets correctly for static elements, so we change them
|
2223
|
-
// to "relative" to get the values, then change them back.
|
2224
|
-
Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
|
2225
|
-
function(proceed, element) {
|
2226
|
-
element = $(element);
|
2227
|
-
// IE throws an error if element is not in document
|
2228
|
-
try { element.offsetParent }
|
2229
|
-
catch(e) { return $(document.body) }
|
2230
|
-
var position = element.getStyle('position');
|
2231
|
-
if (position !== 'static') return proceed(element);
|
2232
|
-
element.setStyle({ position: 'relative' });
|
2233
|
-
var value = proceed(element);
|
2234
|
-
element.setStyle({ position: position });
|
2235
|
-
return value;
|
2236
|
-
}
|
2237
|
-
);
|
2238
|
-
|
2239
|
-
$w('positionedOffset viewportOffset').each(function(method) {
|
2240
|
-
Element.Methods[method] = Element.Methods[method].wrap(
|
2241
|
-
function(proceed, element) {
|
2242
|
-
element = $(element);
|
2243
|
-
try { element.offsetParent }
|
2244
|
-
catch(e) { return Element._returnOffset(0,0) }
|
2245
|
-
var position = element.getStyle('position');
|
2246
|
-
if (position !== 'static') return proceed(element);
|
2247
|
-
// Trigger hasLayout on the offset parent so that IE6 reports
|
2248
|
-
// accurate offsetTop and offsetLeft values for position: fixed.
|
2249
|
-
var offsetParent = element.getOffsetParent();
|
2250
|
-
if (offsetParent && offsetParent.getStyle('position') === 'fixed')
|
2251
|
-
offsetParent.setStyle({ zoom: 1 });
|
2252
|
-
element.setStyle({ position: 'relative' });
|
2253
|
-
var value = proceed(element);
|
2254
|
-
element.setStyle({ position: position });
|
2255
|
-
return value;
|
2256
|
-
}
|
2257
|
-
);
|
2258
|
-
});
|
2259
|
-
|
2260
|
-
Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
|
2261
|
-
function(proceed, element) {
|
2262
|
-
try { element.offsetParent }
|
2263
|
-
catch(e) { return Element._returnOffset(0,0) }
|
2264
|
-
return proceed(element);
|
2265
|
-
}
|
2266
|
-
);
|
2267
|
-
|
2268
|
-
Element.Methods.getStyle = function(element, style) {
|
2269
|
-
element = $(element);
|
2270
|
-
style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
|
2271
|
-
var value = element.style[style];
|
2272
|
-
if (!value && element.currentStyle) value = element.currentStyle[style];
|
2273
|
-
|
2274
|
-
if (style == 'opacity') {
|
2275
|
-
if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
|
2276
|
-
if (value[1]) return parseFloat(value[1]) / 100;
|
2277
|
-
return 1.0;
|
2278
|
-
}
|
2279
|
-
|
2280
|
-
if (value == 'auto') {
|
2281
|
-
if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
|
2282
|
-
return element['offset' + style.capitalize()] + 'px';
|
2283
|
-
return null;
|
2284
|
-
}
|
2285
|
-
return value;
|
2286
|
-
};
|
2287
|
-
|
2288
|
-
Element.Methods.setOpacity = function(element, value) {
|
2289
|
-
function stripAlpha(filter){
|
2290
|
-
return filter.replace(/alpha\([^\)]*\)/gi,'');
|
2291
|
-
}
|
2292
|
-
element = $(element);
|
2293
|
-
var currentStyle = element.currentStyle;
|
2294
|
-
if ((currentStyle && !currentStyle.hasLayout) ||
|
2295
|
-
(!currentStyle && element.style.zoom == 'normal'))
|
2296
|
-
element.style.zoom = 1;
|
2297
|
-
|
2298
|
-
var filter = element.getStyle('filter'), style = element.style;
|
2299
|
-
if (value == 1 || value === '') {
|
2300
|
-
(filter = stripAlpha(filter)) ?
|
2301
|
-
style.filter = filter : style.removeAttribute('filter');
|
2302
|
-
return element;
|
2303
|
-
} else if (value < 0.00001) value = 0;
|
2304
|
-
style.filter = stripAlpha(filter) +
|
2305
|
-
'alpha(opacity=' + (value * 100) + ')';
|
2306
|
-
return element;
|
2307
|
-
};
|
2308
|
-
|
2309
|
-
Element._attributeTranslations = {
|
2310
|
-
read: {
|
2311
|
-
names: {
|
2312
|
-
'class': 'className',
|
2313
|
-
'for': 'htmlFor'
|
2314
|
-
},
|
2315
|
-
values: {
|
2316
|
-
_getAttr: function(element, attribute) {
|
2317
|
-
return element.getAttribute(attribute, 2);
|
2318
|
-
},
|
2319
|
-
_getAttrNode: function(element, attribute) {
|
2320
|
-
var node = element.getAttributeNode(attribute);
|
2321
|
-
return node ? node.value : "";
|
2322
|
-
},
|
2323
|
-
_getEv: function(element, attribute) {
|
2324
|
-
attribute = element.getAttribute(attribute);
|
2325
|
-
return attribute ? attribute.toString().slice(23, -2) : null;
|
2326
|
-
},
|
2327
|
-
_flag: function(element, attribute) {
|
2328
|
-
return $(element).hasAttribute(attribute) ? attribute : null;
|
2329
|
-
},
|
2330
|
-
style: function(element) {
|
2331
|
-
return element.style.cssText.toLowerCase();
|
2332
|
-
},
|
2333
|
-
title: function(element) {
|
2334
|
-
return element.title;
|
2335
|
-
}
|
2336
|
-
}
|
2337
|
-
}
|
2338
|
-
};
|
2339
|
-
|
2340
|
-
Element._attributeTranslations.write = {
|
2341
|
-
names: Object.extend({
|
2342
|
-
cellpadding: 'cellPadding',
|
2343
|
-
cellspacing: 'cellSpacing'
|
2344
|
-
}, Element._attributeTranslations.read.names),
|
2345
|
-
values: {
|
2346
|
-
checked: function(element, value) {
|
2347
|
-
element.checked = !!value;
|
2348
|
-
},
|
2349
|
-
|
2350
|
-
style: function(element, value) {
|
2351
|
-
element.style.cssText = value ? value : '';
|
2352
|
-
}
|
2353
|
-
}
|
2354
|
-
};
|
2355
|
-
|
2356
|
-
Element._attributeTranslations.has = {};
|
2357
|
-
|
2358
|
-
$w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
|
2359
|
-
'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
|
2360
|
-
Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
|
2361
|
-
Element._attributeTranslations.has[attr.toLowerCase()] = attr;
|
2362
|
-
});
|
2363
|
-
|
2364
|
-
(function(v) {
|
2365
|
-
Object.extend(v, {
|
2366
|
-
href: v._getAttr,
|
2367
|
-
src: v._getAttr,
|
2368
|
-
type: v._getAttr,
|
2369
|
-
action: v._getAttrNode,
|
2370
|
-
disabled: v._flag,
|
2371
|
-
checked: v._flag,
|
2372
|
-
readonly: v._flag,
|
2373
|
-
multiple: v._flag,
|
2374
|
-
onload: v._getEv,
|
2375
|
-
onunload: v._getEv,
|
2376
|
-
onclick: v._getEv,
|
2377
|
-
ondblclick: v._getEv,
|
2378
|
-
onmousedown: v._getEv,
|
2379
|
-
onmouseup: v._getEv,
|
2380
|
-
onmouseover: v._getEv,
|
2381
|
-
onmousemove: v._getEv,
|
2382
|
-
onmouseout: v._getEv,
|
2383
|
-
onfocus: v._getEv,
|
2384
|
-
onblur: v._getEv,
|
2385
|
-
onkeypress: v._getEv,
|
2386
|
-
onkeydown: v._getEv,
|
2387
|
-
onkeyup: v._getEv,
|
2388
|
-
onsubmit: v._getEv,
|
2389
|
-
onreset: v._getEv,
|
2390
|
-
onselect: v._getEv,
|
2391
|
-
onchange: v._getEv
|
2392
|
-
});
|
2393
|
-
})(Element._attributeTranslations.read.values);
|
2394
|
-
}
|
2395
|
-
|
2396
|
-
else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
|
2397
|
-
Element.Methods.setOpacity = function(element, value) {
|
2398
|
-
element = $(element);
|
2399
|
-
element.style.opacity = (value == 1) ? 0.999999 :
|
2400
|
-
(value === '') ? '' : (value < 0.00001) ? 0 : value;
|
2401
|
-
return element;
|
2402
|
-
};
|
2403
|
-
}
|
2404
|
-
|
2405
|
-
else if (Prototype.Browser.WebKit) {
|
2406
|
-
Element.Methods.setOpacity = function(element, value) {
|
2407
|
-
element = $(element);
|
2408
|
-
element.style.opacity = (value == 1 || value === '') ? '' :
|
2409
|
-
(value < 0.00001) ? 0 : value;
|
2410
|
-
|
2411
|
-
if (value == 1)
|
2412
|
-
if(element.tagName.toUpperCase() == 'IMG' && element.width) {
|
2413
|
-
element.width++; element.width--;
|
2414
|
-
} else try {
|
2415
|
-
var n = document.createTextNode(' ');
|
2416
|
-
element.appendChild(n);
|
2417
|
-
element.removeChild(n);
|
2418
|
-
} catch (e) { }
|
2419
|
-
|
2420
|
-
return element;
|
2421
|
-
};
|
2422
|
-
|
2423
|
-
// Safari returns margins on body which is incorrect if the child is absolutely
|
2424
|
-
// positioned. For performance reasons, redefine Element#cumulativeOffset for
|
2425
|
-
// KHTML/WebKit only.
|
2426
|
-
Element.Methods.cumulativeOffset = function(element) {
|
2427
|
-
var valueT = 0, valueL = 0;
|
2428
|
-
do {
|
2429
|
-
valueT += element.offsetTop || 0;
|
2430
|
-
valueL += element.offsetLeft || 0;
|
2431
|
-
if (element.offsetParent == document.body)
|
2432
|
-
if (Element.getStyle(element, 'position') == 'absolute') break;
|
2433
|
-
|
2434
|
-
element = element.offsetParent;
|
2435
|
-
} while (element);
|
2436
|
-
|
2437
|
-
return Element._returnOffset(valueL, valueT);
|
2438
|
-
};
|
2439
|
-
}
|
2440
|
-
|
2441
|
-
if (Prototype.Browser.IE || Prototype.Browser.Opera) {
|
2442
|
-
// IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
|
2443
|
-
Element.Methods.update = function(element, content) {
|
2444
|
-
element = $(element);
|
2445
|
-
|
2446
|
-
if (content && content.toElement) content = content.toElement();
|
2447
|
-
if (Object.isElement(content)) return element.update().insert(content);
|
2448
|
-
|
2449
|
-
content = Object.toHTML(content);
|
2450
|
-
var tagName = element.tagName.toUpperCase();
|
2451
|
-
|
2452
|
-
if (tagName in Element._insertionTranslations.tags) {
|
2453
|
-
$A(element.childNodes).each(function(node) { element.removeChild(node) });
|
2454
|
-
Element._getContentFromAnonymousElement(tagName, content.stripScripts())
|
2455
|
-
.each(function(node) { element.appendChild(node) });
|
2456
|
-
}
|
2457
|
-
else element.innerHTML = content.stripScripts();
|
2458
|
-
|
2459
|
-
content.evalScripts.bind(content).defer();
|
2460
|
-
return element;
|
2461
|
-
};
|
2462
|
-
}
|
2463
|
-
|
2464
|
-
if ('outerHTML' in document.createElement('div')) {
|
2465
|
-
Element.Methods.replace = function(element, content) {
|
2466
|
-
element = $(element);
|
2467
|
-
|
2468
|
-
if (content && content.toElement) content = content.toElement();
|
2469
|
-
if (Object.isElement(content)) {
|
2470
|
-
element.parentNode.replaceChild(content, element);
|
2471
|
-
return element;
|
2472
|
-
}
|
2473
|
-
|
2474
|
-
content = Object.toHTML(content);
|
2475
|
-
var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
|
2476
|
-
|
2477
|
-
if (Element._insertionTranslations.tags[tagName]) {
|
2478
|
-
var nextSibling = element.next();
|
2479
|
-
var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
|
2480
|
-
parent.removeChild(element);
|
2481
|
-
if (nextSibling)
|
2482
|
-
fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
|
2483
|
-
else
|
2484
|
-
fragments.each(function(node) { parent.appendChild(node) });
|
2485
|
-
}
|
2486
|
-
else element.outerHTML = content.stripScripts();
|
2487
|
-
|
2488
|
-
content.evalScripts.bind(content).defer();
|
2489
|
-
return element;
|
2490
|
-
};
|
2491
|
-
}
|
2492
|
-
|
2493
|
-
Element._returnOffset = function(l, t) {
|
2494
|
-
var result = [l, t];
|
2495
|
-
result.left = l;
|
2496
|
-
result.top = t;
|
2497
|
-
return result;
|
2498
|
-
};
|
2499
|
-
|
2500
|
-
Element._getContentFromAnonymousElement = function(tagName, html) {
|
2501
|
-
var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
|
2502
|
-
if (t) {
|
2503
|
-
div.innerHTML = t[0] + html + t[1];
|
2504
|
-
t[2].times(function() { div = div.firstChild });
|
2505
|
-
} else div.innerHTML = html;
|
2506
|
-
return $A(div.childNodes);
|
2507
|
-
};
|
2508
|
-
|
2509
|
-
Element._insertionTranslations = {
|
2510
|
-
before: function(element, node) {
|
2511
|
-
element.parentNode.insertBefore(node, element);
|
2512
|
-
},
|
2513
|
-
top: function(element, node) {
|
2514
|
-
element.insertBefore(node, element.firstChild);
|
2515
|
-
},
|
2516
|
-
bottom: function(element, node) {
|
2517
|
-
element.appendChild(node);
|
2518
|
-
},
|
2519
|
-
after: function(element, node) {
|
2520
|
-
element.parentNode.insertBefore(node, element.nextSibling);
|
2521
|
-
},
|
2522
|
-
tags: {
|
2523
|
-
TABLE: ['<table>', '</table>', 1],
|
2524
|
-
TBODY: ['<table><tbody>', '</tbody></table>', 2],
|
2525
|
-
TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
|
2526
|
-
TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
|
2527
|
-
SELECT: ['<select>', '</select>', 1]
|
2528
|
-
}
|
2529
|
-
};
|
2530
|
-
|
2531
|
-
(function() {
|
2532
|
-
Object.extend(this.tags, {
|
2533
|
-
THEAD: this.tags.TBODY,
|
2534
|
-
TFOOT: this.tags.TBODY,
|
2535
|
-
TH: this.tags.TD
|
2536
|
-
});
|
2537
|
-
}).call(Element._insertionTranslations);
|
2538
|
-
|
2539
|
-
Element.Methods.Simulated = {
|
2540
|
-
hasAttribute: function(element, attribute) {
|
2541
|
-
attribute = Element._attributeTranslations.has[attribute] || attribute;
|
2542
|
-
var node = $(element).getAttributeNode(attribute);
|
2543
|
-
return !!(node && node.specified);
|
2544
|
-
}
|
2545
|
-
};
|
2546
|
-
|
2547
|
-
Element.Methods.ByTag = { };
|
2548
|
-
|
2549
|
-
Object.extend(Element, Element.Methods);
|
2550
|
-
|
2551
|
-
if (!Prototype.BrowserFeatures.ElementExtensions &&
|
2552
|
-
document.createElement('div')['__proto__']) {
|
2553
|
-
window.HTMLElement = { };
|
2554
|
-
window.HTMLElement.prototype = document.createElement('div')['__proto__'];
|
2555
|
-
Prototype.BrowserFeatures.ElementExtensions = true;
|
2556
|
-
}
|
2557
|
-
|
2558
|
-
Element.extend = (function() {
|
2559
|
-
if (Prototype.BrowserFeatures.SpecificElementExtensions)
|
2560
|
-
return Prototype.K;
|
2561
|
-
|
2562
|
-
var Methods = { }, ByTag = Element.Methods.ByTag;
|
2563
|
-
|
2564
|
-
var extend = Object.extend(function(element) {
|
2565
|
-
if (!element || element._extendedByPrototype ||
|
2566
|
-
element.nodeType != 1 || element == window) return element;
|
2567
|
-
|
2568
|
-
var methods = Object.clone(Methods),
|
2569
|
-
tagName = element.tagName.toUpperCase(), property, value;
|
2570
|
-
|
2571
|
-
// extend methods for specific tags
|
2572
|
-
if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
|
2573
|
-
|
2574
|
-
for (property in methods) {
|
2575
|
-
value = methods[property];
|
2576
|
-
if (Object.isFunction(value) && !(property in element))
|
2577
|
-
element[property] = value.methodize();
|
2578
|
-
}
|
2579
|
-
|
2580
|
-
element._extendedByPrototype = Prototype.emptyFunction;
|
2581
|
-
return element;
|
2582
|
-
|
2583
|
-
}, {
|
2584
|
-
refresh: function() {
|
2585
|
-
// extend methods for all tags (Safari doesn't need this)
|
2586
|
-
if (!Prototype.BrowserFeatures.ElementExtensions) {
|
2587
|
-
Object.extend(Methods, Element.Methods);
|
2588
|
-
Object.extend(Methods, Element.Methods.Simulated);
|
2589
|
-
}
|
2590
|
-
}
|
2591
|
-
});
|
2592
|
-
|
2593
|
-
extend.refresh();
|
2594
|
-
return extend;
|
2595
|
-
})();
|
2596
|
-
|
2597
|
-
Element.hasAttribute = function(element, attribute) {
|
2598
|
-
if (element.hasAttribute) return element.hasAttribute(attribute);
|
2599
|
-
return Element.Methods.Simulated.hasAttribute(element, attribute);
|
2600
|
-
};
|
2601
|
-
|
2602
|
-
Element.addMethods = function(methods) {
|
2603
|
-
var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
|
2604
|
-
|
2605
|
-
if (!methods) {
|
2606
|
-
Object.extend(Form, Form.Methods);
|
2607
|
-
Object.extend(Form.Element, Form.Element.Methods);
|
2608
|
-
Object.extend(Element.Methods.ByTag, {
|
2609
|
-
"FORM": Object.clone(Form.Methods),
|
2610
|
-
"INPUT": Object.clone(Form.Element.Methods),
|
2611
|
-
"SELECT": Object.clone(Form.Element.Methods),
|
2612
|
-
"TEXTAREA": Object.clone(Form.Element.Methods)
|
2613
|
-
});
|
2614
|
-
}
|
2615
|
-
|
2616
|
-
if (arguments.length == 2) {
|
2617
|
-
var tagName = methods;
|
2618
|
-
methods = arguments[1];
|
2619
|
-
}
|
2620
|
-
|
2621
|
-
if (!tagName) Object.extend(Element.Methods, methods || { });
|
2622
|
-
else {
|
2623
|
-
if (Object.isArray(tagName)) tagName.each(extend);
|
2624
|
-
else extend(tagName);
|
2625
|
-
}
|
2626
|
-
|
2627
|
-
function extend(tagName) {
|
2628
|
-
tagName = tagName.toUpperCase();
|
2629
|
-
if (!Element.Methods.ByTag[tagName])
|
2630
|
-
Element.Methods.ByTag[tagName] = { };
|
2631
|
-
Object.extend(Element.Methods.ByTag[tagName], methods);
|
2632
|
-
}
|
2633
|
-
|
2634
|
-
function copy(methods, destination, onlyIfAbsent) {
|
2635
|
-
onlyIfAbsent = onlyIfAbsent || false;
|
2636
|
-
for (var property in methods) {
|
2637
|
-
var value = methods[property];
|
2638
|
-
if (!Object.isFunction(value)) continue;
|
2639
|
-
if (!onlyIfAbsent || !(property in destination))
|
2640
|
-
destination[property] = value.methodize();
|
2641
|
-
}
|
2642
|
-
}
|
2643
|
-
|
2644
|
-
function findDOMClass(tagName) {
|
2645
|
-
var klass;
|
2646
|
-
var trans = {
|
2647
|
-
"OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
|
2648
|
-
"FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
|
2649
|
-
"DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
|
2650
|
-
"H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
|
2651
|
-
"INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
|
2652
|
-
"TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
|
2653
|
-
"TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
|
2654
|
-
"TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
|
2655
|
-
"FrameSet", "IFRAME": "IFrame"
|
2656
|
-
};
|
2657
|
-
if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
|
2658
|
-
if (window[klass]) return window[klass];
|
2659
|
-
klass = 'HTML' + tagName + 'Element';
|
2660
|
-
if (window[klass]) return window[klass];
|
2661
|
-
klass = 'HTML' + tagName.capitalize() + 'Element';
|
2662
|
-
if (window[klass]) return window[klass];
|
2663
|
-
|
2664
|
-
window[klass] = { };
|
2665
|
-
window[klass].prototype = document.createElement(tagName)['__proto__'];
|
2666
|
-
return window[klass];
|
2667
|
-
}
|
2668
|
-
|
2669
|
-
if (F.ElementExtensions) {
|
2670
|
-
copy(Element.Methods, HTMLElement.prototype);
|
2671
|
-
copy(Element.Methods.Simulated, HTMLElement.prototype, true);
|
2672
|
-
}
|
2673
|
-
|
2674
|
-
if (F.SpecificElementExtensions) {
|
2675
|
-
for (var tag in Element.Methods.ByTag) {
|
2676
|
-
var klass = findDOMClass(tag);
|
2677
|
-
if (Object.isUndefined(klass)) continue;
|
2678
|
-
copy(T[tag], klass.prototype);
|
2679
|
-
}
|
2680
|
-
}
|
2681
|
-
|
2682
|
-
Object.extend(Element, Element.Methods);
|
2683
|
-
delete Element.ByTag;
|
2684
|
-
|
2685
|
-
if (Element.extend.refresh) Element.extend.refresh();
|
2686
|
-
Element.cache = { };
|
2687
|
-
};
|
2688
|
-
|
2689
|
-
document.viewport = {
|
2690
|
-
getDimensions: function() {
|
2691
|
-
var dimensions = { }, B = Prototype.Browser;
|
2692
|
-
$w('width height').each(function(d) {
|
2693
|
-
var D = d.capitalize();
|
2694
|
-
if (B.WebKit && !document.evaluate) {
|
2695
|
-
// Safari <3.0 needs self.innerWidth/Height
|
2696
|
-
dimensions[d] = self['inner' + D];
|
2697
|
-
} else if (B.Opera && parseFloat(window.opera.version()) < 9.5) {
|
2698
|
-
// Opera <9.5 needs document.body.clientWidth/Height
|
2699
|
-
dimensions[d] = document.body['client' + D]
|
2700
|
-
} else {
|
2701
|
-
dimensions[d] = document.documentElement['client' + D];
|
2702
|
-
}
|
2703
|
-
});
|
2704
|
-
return dimensions;
|
2705
|
-
},
|
2706
|
-
|
2707
|
-
getWidth: function() {
|
2708
|
-
return this.getDimensions().width;
|
2709
|
-
},
|
2710
|
-
|
2711
|
-
getHeight: function() {
|
2712
|
-
return this.getDimensions().height;
|
2713
|
-
},
|
2714
|
-
|
2715
|
-
getScrollOffsets: function() {
|
2716
|
-
return Element._returnOffset(
|
2717
|
-
window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
|
2718
|
-
window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
|
2719
|
-
}
|
2720
|
-
};
|
2721
|
-
/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
|
2722
|
-
* part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
|
2723
|
-
* license. Please see http://www.yui-ext.com/ for more information. */
|
2724
|
-
|
2725
|
-
var Selector = Class.create({
|
2726
|
-
initialize: function(expression) {
|
2727
|
-
this.expression = expression.strip();
|
2728
|
-
|
2729
|
-
if (this.shouldUseSelectorsAPI()) {
|
2730
|
-
this.mode = 'selectorsAPI';
|
2731
|
-
} else if (this.shouldUseXPath()) {
|
2732
|
-
this.mode = 'xpath';
|
2733
|
-
this.compileXPathMatcher();
|
2734
|
-
} else {
|
2735
|
-
this.mode = "normal";
|
2736
|
-
this.compileMatcher();
|
2737
|
-
}
|
2738
|
-
|
2739
|
-
},
|
2740
|
-
|
2741
|
-
shouldUseXPath: function() {
|
2742
|
-
if (!Prototype.BrowserFeatures.XPath) return false;
|
2743
|
-
|
2744
|
-
var e = this.expression;
|
2745
|
-
|
2746
|
-
// Safari 3 chokes on :*-of-type and :empty
|
2747
|
-
if (Prototype.Browser.WebKit &&
|
2748
|
-
(e.include("-of-type") || e.include(":empty")))
|
2749
|
-
return false;
|
2750
|
-
|
2751
|
-
// XPath can't do namespaced attributes, nor can it read
|
2752
|
-
// the "checked" property from DOM nodes
|
2753
|
-
if ((/(\[[\w-]*?:|:checked)/).test(e))
|
2754
|
-
return false;
|
2755
|
-
|
2756
|
-
return true;
|
2757
|
-
},
|
2758
|
-
|
2759
|
-
shouldUseSelectorsAPI: function() {
|
2760
|
-
if (!Prototype.BrowserFeatures.SelectorsAPI) return false;
|
2761
|
-
|
2762
|
-
if (!Selector._div) Selector._div = new Element('div');
|
2763
|
-
|
2764
|
-
// Make sure the browser treats the selector as valid. Test on an
|
2765
|
-
// isolated element to minimize cost of this check.
|
2766
|
-
try {
|
2767
|
-
Selector._div.querySelector(this.expression);
|
2768
|
-
} catch(e) {
|
2769
|
-
return false;
|
2770
|
-
}
|
2771
|
-
|
2772
|
-
return true;
|
2773
|
-
},
|
2774
|
-
|
2775
|
-
compileMatcher: function() {
|
2776
|
-
var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
|
2777
|
-
c = Selector.criteria, le, p, m;
|
2778
|
-
|
2779
|
-
if (Selector._cache[e]) {
|
2780
|
-
this.matcher = Selector._cache[e];
|
2781
|
-
return;
|
2782
|
-
}
|
2783
|
-
|
2784
|
-
this.matcher = ["this.matcher = function(root) {",
|
2785
|
-
"var r = root, h = Selector.handlers, c = false, n;"];
|
2786
|
-
|
2787
|
-
while (e && le != e && (/\S/).test(e)) {
|
2788
|
-
le = e;
|
2789
|
-
for (var i in ps) {
|
2790
|
-
p = ps[i];
|
2791
|
-
if (m = e.match(p)) {
|
2792
|
-
this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
|
2793
|
-
new Template(c[i]).evaluate(m));
|
2794
|
-
e = e.replace(m[0], '');
|
2795
|
-
break;
|
2796
|
-
}
|
2797
|
-
}
|
2798
|
-
}
|
2799
|
-
|
2800
|
-
this.matcher.push("return h.unique(n);\n}");
|
2801
|
-
eval(this.matcher.join('\n'));
|
2802
|
-
Selector._cache[this.expression] = this.matcher;
|
2803
|
-
},
|
2804
|
-
|
2805
|
-
compileXPathMatcher: function() {
|
2806
|
-
var e = this.expression, ps = Selector.patterns,
|
2807
|
-
x = Selector.xpath, le, m;
|
2808
|
-
|
2809
|
-
if (Selector._cache[e]) {
|
2810
|
-
this.xpath = Selector._cache[e]; return;
|
2811
|
-
}
|
2812
|
-
|
2813
|
-
this.matcher = ['.//*'];
|
2814
|
-
while (e && le != e && (/\S/).test(e)) {
|
2815
|
-
le = e;
|
2816
|
-
for (var i in ps) {
|
2817
|
-
if (m = e.match(ps[i])) {
|
2818
|
-
this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
|
2819
|
-
new Template(x[i]).evaluate(m));
|
2820
|
-
e = e.replace(m[0], '');
|
2821
|
-
break;
|
2822
|
-
}
|
2823
|
-
}
|
2824
|
-
}
|
2825
|
-
|
2826
|
-
this.xpath = this.matcher.join('');
|
2827
|
-
Selector._cache[this.expression] = this.xpath;
|
2828
|
-
},
|
2829
|
-
|
2830
|
-
findElements: function(root) {
|
2831
|
-
root = root || document;
|
2832
|
-
var e = this.expression, results;
|
2833
|
-
|
2834
|
-
switch (this.mode) {
|
2835
|
-
case 'selectorsAPI':
|
2836
|
-
// querySelectorAll queries document-wide, then filters to descendants
|
2837
|
-
// of the context element. That's not what we want.
|
2838
|
-
// Add an explicit context to the selector if necessary.
|
2839
|
-
if (root !== document) {
|
2840
|
-
var oldId = root.id, id = $(root).identify();
|
2841
|
-
e = "#" + id + " " + e;
|
2842
|
-
}
|
2843
|
-
|
2844
|
-
results = $A(root.querySelectorAll(e)).map(Element.extend);
|
2845
|
-
root.id = oldId;
|
2846
|
-
|
2847
|
-
return results;
|
2848
|
-
case 'xpath':
|
2849
|
-
return document._getElementsByXPath(this.xpath, root);
|
2850
|
-
default:
|
2851
|
-
return this.matcher(root);
|
2852
|
-
}
|
2853
|
-
},
|
2854
|
-
|
2855
|
-
match: function(element) {
|
2856
|
-
this.tokens = [];
|
2857
|
-
|
2858
|
-
var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
|
2859
|
-
var le, p, m;
|
2860
|
-
|
2861
|
-
while (e && le !== e && (/\S/).test(e)) {
|
2862
|
-
le = e;
|
2863
|
-
for (var i in ps) {
|
2864
|
-
p = ps[i];
|
2865
|
-
if (m = e.match(p)) {
|
2866
|
-
// use the Selector.assertions methods unless the selector
|
2867
|
-
// is too complex.
|
2868
|
-
if (as[i]) {
|
2869
|
-
this.tokens.push([i, Object.clone(m)]);
|
2870
|
-
e = e.replace(m[0], '');
|
2871
|
-
} else {
|
2872
|
-
// reluctantly do a document-wide search
|
2873
|
-
// and look for a match in the array
|
2874
|
-
return this.findElements(document).include(element);
|
2875
|
-
}
|
2876
|
-
}
|
2877
|
-
}
|
2878
|
-
}
|
2879
|
-
|
2880
|
-
var match = true, name, matches;
|
2881
|
-
for (var i = 0, token; token = this.tokens[i]; i++) {
|
2882
|
-
name = token[0], matches = token[1];
|
2883
|
-
if (!Selector.assertions[name](element, matches)) {
|
2884
|
-
match = false; break;
|
2885
|
-
}
|
2886
|
-
}
|
2887
|
-
|
2888
|
-
return match;
|
2889
|
-
},
|
2890
|
-
|
2891
|
-
toString: function() {
|
2892
|
-
return this.expression;
|
2893
|
-
},
|
2894
|
-
|
2895
|
-
inspect: function() {
|
2896
|
-
return "#<Selector:" + this.expression.inspect() + ">";
|
2897
|
-
}
|
2898
|
-
});
|
2899
|
-
|
2900
|
-
Object.extend(Selector, {
|
2901
|
-
_cache: { },
|
2902
|
-
|
2903
|
-
xpath: {
|
2904
|
-
descendant: "//*",
|
2905
|
-
child: "/*",
|
2906
|
-
adjacent: "/following-sibling::*[1]",
|
2907
|
-
laterSibling: '/following-sibling::*',
|
2908
|
-
tagName: function(m) {
|
2909
|
-
if (m[1] == '*') return '';
|
2910
|
-
return "[local-name()='" + m[1].toLowerCase() +
|
2911
|
-
"' or local-name()='" + m[1].toUpperCase() + "']";
|
2912
|
-
},
|
2913
|
-
className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
|
2914
|
-
id: "[@id='#{1}']",
|
2915
|
-
attrPresence: function(m) {
|
2916
|
-
m[1] = m[1].toLowerCase();
|
2917
|
-
return new Template("[@#{1}]").evaluate(m);
|
2918
|
-
},
|
2919
|
-
attr: function(m) {
|
2920
|
-
m[1] = m[1].toLowerCase();
|
2921
|
-
m[3] = m[5] || m[6];
|
2922
|
-
return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
|
2923
|
-
},
|
2924
|
-
pseudo: function(m) {
|
2925
|
-
var h = Selector.xpath.pseudos[m[1]];
|
2926
|
-
if (!h) return '';
|
2927
|
-
if (Object.isFunction(h)) return h(m);
|
2928
|
-
return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
|
2929
|
-
},
|
2930
|
-
operators: {
|
2931
|
-
'=': "[@#{1}='#{3}']",
|
2932
|
-
'!=': "[@#{1}!='#{3}']",
|
2933
|
-
'^=': "[starts-with(@#{1}, '#{3}')]",
|
2934
|
-
'$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
|
2935
|
-
'*=': "[contains(@#{1}, '#{3}')]",
|
2936
|
-
'~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
|
2937
|
-
'|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
|
2938
|
-
},
|
2939
|
-
pseudos: {
|
2940
|
-
'first-child': '[not(preceding-sibling::*)]',
|
2941
|
-
'last-child': '[not(following-sibling::*)]',
|
2942
|
-
'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
|
2943
|
-
'empty': "[count(*) = 0 and (count(text()) = 0)]",
|
2944
|
-
'checked': "[@checked]",
|
2945
|
-
'disabled': "[(@disabled) and (@type!='hidden')]",
|
2946
|
-
'enabled': "[not(@disabled) and (@type!='hidden')]",
|
2947
|
-
'not': function(m) {
|
2948
|
-
var e = m[6], p = Selector.patterns,
|
2949
|
-
x = Selector.xpath, le, v;
|
2950
|
-
|
2951
|
-
var exclusion = [];
|
2952
|
-
while (e && le != e && (/\S/).test(e)) {
|
2953
|
-
le = e;
|
2954
|
-
for (var i in p) {
|
2955
|
-
if (m = e.match(p[i])) {
|
2956
|
-
v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
|
2957
|
-
exclusion.push("(" + v.substring(1, v.length - 1) + ")");
|
2958
|
-
e = e.replace(m[0], '');
|
2959
|
-
break;
|
2960
|
-
}
|
2961
|
-
}
|
2962
|
-
}
|
2963
|
-
return "[not(" + exclusion.join(" and ") + ")]";
|
2964
|
-
},
|
2965
|
-
'nth-child': function(m) {
|
2966
|
-
return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
|
2967
|
-
},
|
2968
|
-
'nth-last-child': function(m) {
|
2969
|
-
return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
|
2970
|
-
},
|
2971
|
-
'nth-of-type': function(m) {
|
2972
|
-
return Selector.xpath.pseudos.nth("position() ", m);
|
2973
|
-
},
|
2974
|
-
'nth-last-of-type': function(m) {
|
2975
|
-
return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
|
2976
|
-
},
|
2977
|
-
'first-of-type': function(m) {
|
2978
|
-
m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
|
2979
|
-
},
|
2980
|
-
'last-of-type': function(m) {
|
2981
|
-
m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
|
2982
|
-
},
|
2983
|
-
'only-of-type': function(m) {
|
2984
|
-
var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
|
2985
|
-
},
|
2986
|
-
nth: function(fragment, m) {
|
2987
|
-
var mm, formula = m[6], predicate;
|
2988
|
-
if (formula == 'even') formula = '2n+0';
|
2989
|
-
if (formula == 'odd') formula = '2n+1';
|
2990
|
-
if (mm = formula.match(/^(\d+)$/)) // digit only
|
2991
|
-
return '[' + fragment + "= " + mm[1] + ']';
|
2992
|
-
if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
|
2993
|
-
if (mm[1] == "-") mm[1] = -1;
|
2994
|
-
var a = mm[1] ? Number(mm[1]) : 1;
|
2995
|
-
var b = mm[2] ? Number(mm[2]) : 0;
|
2996
|
-
predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
|
2997
|
-
"((#{fragment} - #{b}) div #{a} >= 0)]";
|
2998
|
-
return new Template(predicate).evaluate({
|
2999
|
-
fragment: fragment, a: a, b: b });
|
3000
|
-
}
|
3001
|
-
}
|
3002
|
-
}
|
3003
|
-
},
|
3004
|
-
|
3005
|
-
criteria: {
|
3006
|
-
tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
|
3007
|
-
className: 'n = h.className(n, r, "#{1}", c); c = false;',
|
3008
|
-
id: 'n = h.id(n, r, "#{1}", c); c = false;',
|
3009
|
-
attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
|
3010
|
-
attr: function(m) {
|
3011
|
-
m[3] = (m[5] || m[6]);
|
3012
|
-
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
|
3013
|
-
},
|
3014
|
-
pseudo: function(m) {
|
3015
|
-
if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
|
3016
|
-
return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
|
3017
|
-
},
|
3018
|
-
descendant: 'c = "descendant";',
|
3019
|
-
child: 'c = "child";',
|
3020
|
-
adjacent: 'c = "adjacent";',
|
3021
|
-
laterSibling: 'c = "laterSibling";'
|
3022
|
-
},
|
3023
|
-
|
3024
|
-
patterns: {
|
3025
|
-
// combinators must be listed first
|
3026
|
-
// (and descendant needs to be last combinator)
|
3027
|
-
laterSibling: /^\s*~\s*/,
|
3028
|
-
child: /^\s*>\s*/,
|
3029
|
-
adjacent: /^\s*\+\s*/,
|
3030
|
-
descendant: /^\s/,
|
3031
|
-
|
3032
|
-
// selectors follow
|
3033
|
-
tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
|
3034
|
-
id: /^#([\w\-\*]+)(\b|$)/,
|
3035
|
-
className: /^\.([\w\-\*]+)(\b|$)/,
|
3036
|
-
pseudo:
|
3037
|
-
/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
|
3038
|
-
attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/,
|
3039
|
-
attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
|
3040
|
-
},
|
3041
|
-
|
3042
|
-
// for Selector.match and Element#match
|
3043
|
-
assertions: {
|
3044
|
-
tagName: function(element, matches) {
|
3045
|
-
return matches[1].toUpperCase() == element.tagName.toUpperCase();
|
3046
|
-
},
|
3047
|
-
|
3048
|
-
className: function(element, matches) {
|
3049
|
-
return Element.hasClassName(element, matches[1]);
|
3050
|
-
},
|
3051
|
-
|
3052
|
-
id: function(element, matches) {
|
3053
|
-
return element.id === matches[1];
|
3054
|
-
},
|
3055
|
-
|
3056
|
-
attrPresence: function(element, matches) {
|
3057
|
-
return Element.hasAttribute(element, matches[1]);
|
3058
|
-
},
|
3059
|
-
|
3060
|
-
attr: function(element, matches) {
|
3061
|
-
var nodeValue = Element.readAttribute(element, matches[1]);
|
3062
|
-
return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
|
3063
|
-
}
|
3064
|
-
},
|
3065
|
-
|
3066
|
-
handlers: {
|
3067
|
-
// UTILITY FUNCTIONS
|
3068
|
-
// joins two collections
|
3069
|
-
concat: function(a, b) {
|
3070
|
-
for (var i = 0, node; node = b[i]; i++)
|
3071
|
-
a.push(node);
|
3072
|
-
return a;
|
3073
|
-
},
|
3074
|
-
|
3075
|
-
// marks an array of nodes for counting
|
3076
|
-
mark: function(nodes) {
|
3077
|
-
var _true = Prototype.emptyFunction;
|
3078
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3079
|
-
node._countedByPrototype = _true;
|
3080
|
-
return nodes;
|
3081
|
-
},
|
3082
|
-
|
3083
|
-
unmark: function(nodes) {
|
3084
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3085
|
-
node._countedByPrototype = undefined;
|
3086
|
-
return nodes;
|
3087
|
-
},
|
3088
|
-
|
3089
|
-
// mark each child node with its position (for nth calls)
|
3090
|
-
// "ofType" flag indicates whether we're indexing for nth-of-type
|
3091
|
-
// rather than nth-child
|
3092
|
-
index: function(parentNode, reverse, ofType) {
|
3093
|
-
parentNode._countedByPrototype = Prototype.emptyFunction;
|
3094
|
-
if (reverse) {
|
3095
|
-
for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
|
3096
|
-
var node = nodes[i];
|
3097
|
-
if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
|
3098
|
-
}
|
3099
|
-
} else {
|
3100
|
-
for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
|
3101
|
-
if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
|
3102
|
-
}
|
3103
|
-
},
|
3104
|
-
|
3105
|
-
// filters out duplicates and extends all nodes
|
3106
|
-
unique: function(nodes) {
|
3107
|
-
if (nodes.length == 0) return nodes;
|
3108
|
-
var results = [], n;
|
3109
|
-
for (var i = 0, l = nodes.length; i < l; i++)
|
3110
|
-
if (!(n = nodes[i])._countedByPrototype) {
|
3111
|
-
n._countedByPrototype = Prototype.emptyFunction;
|
3112
|
-
results.push(Element.extend(n));
|
3113
|
-
}
|
3114
|
-
return Selector.handlers.unmark(results);
|
3115
|
-
},
|
3116
|
-
|
3117
|
-
// COMBINATOR FUNCTIONS
|
3118
|
-
descendant: function(nodes) {
|
3119
|
-
var h = Selector.handlers;
|
3120
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3121
|
-
h.concat(results, node.getElementsByTagName('*'));
|
3122
|
-
return results;
|
3123
|
-
},
|
3124
|
-
|
3125
|
-
child: function(nodes) {
|
3126
|
-
var h = Selector.handlers;
|
3127
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3128
|
-
for (var j = 0, child; child = node.childNodes[j]; j++)
|
3129
|
-
if (child.nodeType == 1 && child.tagName != '!') results.push(child);
|
3130
|
-
}
|
3131
|
-
return results;
|
3132
|
-
},
|
3133
|
-
|
3134
|
-
adjacent: function(nodes) {
|
3135
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3136
|
-
var next = this.nextElementSibling(node);
|
3137
|
-
if (next) results.push(next);
|
3138
|
-
}
|
3139
|
-
return results;
|
3140
|
-
},
|
3141
|
-
|
3142
|
-
laterSibling: function(nodes) {
|
3143
|
-
var h = Selector.handlers;
|
3144
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3145
|
-
h.concat(results, Element.nextSiblings(node));
|
3146
|
-
return results;
|
3147
|
-
},
|
3148
|
-
|
3149
|
-
nextElementSibling: function(node) {
|
3150
|
-
while (node = node.nextSibling)
|
3151
|
-
if (node.nodeType == 1) return node;
|
3152
|
-
return null;
|
3153
|
-
},
|
3154
|
-
|
3155
|
-
previousElementSibling: function(node) {
|
3156
|
-
while (node = node.previousSibling)
|
3157
|
-
if (node.nodeType == 1) return node;
|
3158
|
-
return null;
|
3159
|
-
},
|
3160
|
-
|
3161
|
-
// TOKEN FUNCTIONS
|
3162
|
-
tagName: function(nodes, root, tagName, combinator) {
|
3163
|
-
var uTagName = tagName.toUpperCase();
|
3164
|
-
var results = [], h = Selector.handlers;
|
3165
|
-
if (nodes) {
|
3166
|
-
if (combinator) {
|
3167
|
-
// fastlane for ordinary descendant combinators
|
3168
|
-
if (combinator == "descendant") {
|
3169
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3170
|
-
h.concat(results, node.getElementsByTagName(tagName));
|
3171
|
-
return results;
|
3172
|
-
} else nodes = this[combinator](nodes);
|
3173
|
-
if (tagName == "*") return nodes;
|
3174
|
-
}
|
3175
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3176
|
-
if (node.tagName.toUpperCase() === uTagName) results.push(node);
|
3177
|
-
return results;
|
3178
|
-
} else return root.getElementsByTagName(tagName);
|
3179
|
-
},
|
3180
|
-
|
3181
|
-
id: function(nodes, root, id, combinator) {
|
3182
|
-
var targetNode = $(id), h = Selector.handlers;
|
3183
|
-
if (!targetNode) return [];
|
3184
|
-
if (!nodes && root == document) return [targetNode];
|
3185
|
-
if (nodes) {
|
3186
|
-
if (combinator) {
|
3187
|
-
if (combinator == 'child') {
|
3188
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3189
|
-
if (targetNode.parentNode == node) return [targetNode];
|
3190
|
-
} else if (combinator == 'descendant') {
|
3191
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3192
|
-
if (Element.descendantOf(targetNode, node)) return [targetNode];
|
3193
|
-
} else if (combinator == 'adjacent') {
|
3194
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3195
|
-
if (Selector.handlers.previousElementSibling(targetNode) == node)
|
3196
|
-
return [targetNode];
|
3197
|
-
} else nodes = h[combinator](nodes);
|
3198
|
-
}
|
3199
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3200
|
-
if (node == targetNode) return [targetNode];
|
3201
|
-
return [];
|
3202
|
-
}
|
3203
|
-
return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
|
3204
|
-
},
|
3205
|
-
|
3206
|
-
className: function(nodes, root, className, combinator) {
|
3207
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
3208
|
-
return Selector.handlers.byClassName(nodes, root, className);
|
3209
|
-
},
|
3210
|
-
|
3211
|
-
byClassName: function(nodes, root, className) {
|
3212
|
-
if (!nodes) nodes = Selector.handlers.descendant([root]);
|
3213
|
-
var needle = ' ' + className + ' ';
|
3214
|
-
for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
|
3215
|
-
nodeClassName = node.className;
|
3216
|
-
if (nodeClassName.length == 0) continue;
|
3217
|
-
if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
|
3218
|
-
results.push(node);
|
3219
|
-
}
|
3220
|
-
return results;
|
3221
|
-
},
|
3222
|
-
|
3223
|
-
attrPresence: function(nodes, root, attr, combinator) {
|
3224
|
-
if (!nodes) nodes = root.getElementsByTagName("*");
|
3225
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
3226
|
-
var results = [];
|
3227
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3228
|
-
if (Element.hasAttribute(node, attr)) results.push(node);
|
3229
|
-
return results;
|
3230
|
-
},
|
3231
|
-
|
3232
|
-
attr: function(nodes, root, attr, value, operator, combinator) {
|
3233
|
-
if (!nodes) nodes = root.getElementsByTagName("*");
|
3234
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
3235
|
-
var handler = Selector.operators[operator], results = [];
|
3236
|
-
for (var i = 0, node; node = nodes[i]; i++) {
|
3237
|
-
var nodeValue = Element.readAttribute(node, attr);
|
3238
|
-
if (nodeValue === null) continue;
|
3239
|
-
if (handler(nodeValue, value)) results.push(node);
|
3240
|
-
}
|
3241
|
-
return results;
|
3242
|
-
},
|
3243
|
-
|
3244
|
-
pseudo: function(nodes, name, value, root, combinator) {
|
3245
|
-
if (nodes && combinator) nodes = this[combinator](nodes);
|
3246
|
-
if (!nodes) nodes = root.getElementsByTagName("*");
|
3247
|
-
return Selector.pseudos[name](nodes, value, root);
|
3248
|
-
}
|
3249
|
-
},
|
3250
|
-
|
3251
|
-
pseudos: {
|
3252
|
-
'first-child': function(nodes, value, root) {
|
3253
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3254
|
-
if (Selector.handlers.previousElementSibling(node)) continue;
|
3255
|
-
results.push(node);
|
3256
|
-
}
|
3257
|
-
return results;
|
3258
|
-
},
|
3259
|
-
'last-child': function(nodes, value, root) {
|
3260
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3261
|
-
if (Selector.handlers.nextElementSibling(node)) continue;
|
3262
|
-
results.push(node);
|
3263
|
-
}
|
3264
|
-
return results;
|
3265
|
-
},
|
3266
|
-
'only-child': function(nodes, value, root) {
|
3267
|
-
var h = Selector.handlers;
|
3268
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3269
|
-
if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
|
3270
|
-
results.push(node);
|
3271
|
-
return results;
|
3272
|
-
},
|
3273
|
-
'nth-child': function(nodes, formula, root) {
|
3274
|
-
return Selector.pseudos.nth(nodes, formula, root);
|
3275
|
-
},
|
3276
|
-
'nth-last-child': function(nodes, formula, root) {
|
3277
|
-
return Selector.pseudos.nth(nodes, formula, root, true);
|
3278
|
-
},
|
3279
|
-
'nth-of-type': function(nodes, formula, root) {
|
3280
|
-
return Selector.pseudos.nth(nodes, formula, root, false, true);
|
3281
|
-
},
|
3282
|
-
'nth-last-of-type': function(nodes, formula, root) {
|
3283
|
-
return Selector.pseudos.nth(nodes, formula, root, true, true);
|
3284
|
-
},
|
3285
|
-
'first-of-type': function(nodes, formula, root) {
|
3286
|
-
return Selector.pseudos.nth(nodes, "1", root, false, true);
|
3287
|
-
},
|
3288
|
-
'last-of-type': function(nodes, formula, root) {
|
3289
|
-
return Selector.pseudos.nth(nodes, "1", root, true, true);
|
3290
|
-
},
|
3291
|
-
'only-of-type': function(nodes, formula, root) {
|
3292
|
-
var p = Selector.pseudos;
|
3293
|
-
return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
|
3294
|
-
},
|
3295
|
-
|
3296
|
-
// handles the an+b logic
|
3297
|
-
getIndices: function(a, b, total) {
|
3298
|
-
if (a == 0) return b > 0 ? [b] : [];
|
3299
|
-
return $R(1, total).inject([], function(memo, i) {
|
3300
|
-
if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
|
3301
|
-
return memo;
|
3302
|
-
});
|
3303
|
-
},
|
3304
|
-
|
3305
|
-
// handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
|
3306
|
-
nth: function(nodes, formula, root, reverse, ofType) {
|
3307
|
-
if (nodes.length == 0) return [];
|
3308
|
-
if (formula == 'even') formula = '2n+0';
|
3309
|
-
if (formula == 'odd') formula = '2n+1';
|
3310
|
-
var h = Selector.handlers, results = [], indexed = [], m;
|
3311
|
-
h.mark(nodes);
|
3312
|
-
for (var i = 0, node; node = nodes[i]; i++) {
|
3313
|
-
if (!node.parentNode._countedByPrototype) {
|
3314
|
-
h.index(node.parentNode, reverse, ofType);
|
3315
|
-
indexed.push(node.parentNode);
|
3316
|
-
}
|
3317
|
-
}
|
3318
|
-
if (formula.match(/^\d+$/)) { // just a number
|
3319
|
-
formula = Number(formula);
|
3320
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3321
|
-
if (node.nodeIndex == formula) results.push(node);
|
3322
|
-
} else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
|
3323
|
-
if (m[1] == "-") m[1] = -1;
|
3324
|
-
var a = m[1] ? Number(m[1]) : 1;
|
3325
|
-
var b = m[2] ? Number(m[2]) : 0;
|
3326
|
-
var indices = Selector.pseudos.getIndices(a, b, nodes.length);
|
3327
|
-
for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
|
3328
|
-
for (var j = 0; j < l; j++)
|
3329
|
-
if (node.nodeIndex == indices[j]) results.push(node);
|
3330
|
-
}
|
3331
|
-
}
|
3332
|
-
h.unmark(nodes);
|
3333
|
-
h.unmark(indexed);
|
3334
|
-
return results;
|
3335
|
-
},
|
3336
|
-
|
3337
|
-
'empty': function(nodes, value, root) {
|
3338
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
3339
|
-
// IE treats comments as element nodes
|
3340
|
-
if (node.tagName == '!' || node.firstChild) continue;
|
3341
|
-
results.push(node);
|
3342
|
-
}
|
3343
|
-
return results;
|
3344
|
-
},
|
3345
|
-
|
3346
|
-
'not': function(nodes, selector, root) {
|
3347
|
-
var h = Selector.handlers, selectorType, m;
|
3348
|
-
var exclusions = new Selector(selector).findElements(root);
|
3349
|
-
h.mark(exclusions);
|
3350
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3351
|
-
if (!node._countedByPrototype) results.push(node);
|
3352
|
-
h.unmark(exclusions);
|
3353
|
-
return results;
|
3354
|
-
},
|
3355
|
-
|
3356
|
-
'enabled': function(nodes, value, root) {
|
3357
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3358
|
-
if (!node.disabled && (!node.type || node.type !== 'hidden'))
|
3359
|
-
results.push(node);
|
3360
|
-
return results;
|
3361
|
-
},
|
3362
|
-
|
3363
|
-
'disabled': function(nodes, value, root) {
|
3364
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3365
|
-
if (node.disabled) results.push(node);
|
3366
|
-
return results;
|
3367
|
-
},
|
3368
|
-
|
3369
|
-
'checked': function(nodes, value, root) {
|
3370
|
-
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
3371
|
-
if (node.checked) results.push(node);
|
3372
|
-
return results;
|
3373
|
-
}
|
3374
|
-
},
|
3375
|
-
|
3376
|
-
operators: {
|
3377
|
-
'=': function(nv, v) { return nv == v; },
|
3378
|
-
'!=': function(nv, v) { return nv != v; },
|
3379
|
-
'^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
|
3380
|
-
'$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
|
3381
|
-
'*=': function(nv, v) { return nv == v || nv && nv.include(v); },
|
3382
|
-
'$=': function(nv, v) { return nv.endsWith(v); },
|
3383
|
-
'*=': function(nv, v) { return nv.include(v); },
|
3384
|
-
'~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
|
3385
|
-
'|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
|
3386
|
-
'-').include('-' + (v || "").toUpperCase() + '-'); }
|
3387
|
-
},
|
3388
|
-
|
3389
|
-
split: function(expression) {
|
3390
|
-
var expressions = [];
|
3391
|
-
expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
|
3392
|
-
expressions.push(m[1].strip());
|
3393
|
-
});
|
3394
|
-
return expressions;
|
3395
|
-
},
|
3396
|
-
|
3397
|
-
matchElements: function(elements, expression) {
|
3398
|
-
var matches = $$(expression), h = Selector.handlers;
|
3399
|
-
h.mark(matches);
|
3400
|
-
for (var i = 0, results = [], element; element = elements[i]; i++)
|
3401
|
-
if (element._countedByPrototype) results.push(element);
|
3402
|
-
h.unmark(matches);
|
3403
|
-
return results;
|
3404
|
-
},
|
3405
|
-
|
3406
|
-
findElement: function(elements, expression, index) {
|
3407
|
-
if (Object.isNumber(expression)) {
|
3408
|
-
index = expression; expression = false;
|
3409
|
-
}
|
3410
|
-
return Selector.matchElements(elements, expression || '*')[index || 0];
|
3411
|
-
},
|
3412
|
-
|
3413
|
-
findChildElements: function(element, expressions) {
|
3414
|
-
expressions = Selector.split(expressions.join(','));
|
3415
|
-
var results = [], h = Selector.handlers;
|
3416
|
-
for (var i = 0, l = expressions.length, selector; i < l; i++) {
|
3417
|
-
selector = new Selector(expressions[i].strip());
|
3418
|
-
h.concat(results, selector.findElements(element));
|
3419
|
-
}
|
3420
|
-
return (l > 1) ? h.unique(results) : results;
|
3421
|
-
}
|
3422
|
-
});
|
3423
|
-
|
3424
|
-
if (Prototype.Browser.IE) {
|
3425
|
-
Object.extend(Selector.handlers, {
|
3426
|
-
// IE returns comment nodes on getElementsByTagName("*").
|
3427
|
-
// Filter them out.
|
3428
|
-
concat: function(a, b) {
|
3429
|
-
for (var i = 0, node; node = b[i]; i++)
|
3430
|
-
if (node.tagName !== "!") a.push(node);
|
3431
|
-
return a;
|
3432
|
-
},
|
3433
|
-
|
3434
|
-
// IE improperly serializes _countedByPrototype in (inner|outer)HTML.
|
3435
|
-
unmark: function(nodes) {
|
3436
|
-
for (var i = 0, node; node = nodes[i]; i++)
|
3437
|
-
node.removeAttribute('_countedByPrototype');
|
3438
|
-
return nodes;
|
3439
|
-
}
|
3440
|
-
});
|
3441
|
-
}
|
3442
|
-
|
3443
|
-
function $$() {
|
3444
|
-
return Selector.findChildElements(document, $A(arguments));
|
3445
|
-
}
|
3446
|
-
var Form = {
|
3447
|
-
reset: function(form) {
|
3448
|
-
$(form).reset();
|
3449
|
-
return form;
|
3450
|
-
},
|
3451
|
-
|
3452
|
-
serializeElements: function(elements, options) {
|
3453
|
-
if (typeof options != 'object') options = { hash: !!options };
|
3454
|
-
else if (Object.isUndefined(options.hash)) options.hash = true;
|
3455
|
-
var key, value, submitted = false, submit = options.submit;
|
3456
|
-
|
3457
|
-
var data = elements.inject({ }, function(result, element) {
|
3458
|
-
if (!element.disabled && element.name) {
|
3459
|
-
key = element.name; value = $(element).getValue();
|
3460
|
-
if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
|
3461
|
-
submit !== false && (!submit || key == submit) && (submitted = true)))) {
|
3462
|
-
if (key in result) {
|
3463
|
-
// a key is already present; construct an array of values
|
3464
|
-
if (!Object.isArray(result[key])) result[key] = [result[key]];
|
3465
|
-
result[key].push(value);
|
3466
|
-
}
|
3467
|
-
else result[key] = value;
|
3468
|
-
}
|
3469
|
-
}
|
3470
|
-
return result;
|
3471
|
-
});
|
3472
|
-
|
3473
|
-
return options.hash ? data : Object.toQueryString(data);
|
3474
|
-
}
|
3475
|
-
};
|
3476
|
-
|
3477
|
-
Form.Methods = {
|
3478
|
-
serialize: function(form, options) {
|
3479
|
-
return Form.serializeElements(Form.getElements(form), options);
|
3480
|
-
},
|
3481
|
-
|
3482
|
-
getElements: function(form) {
|
3483
|
-
return $A($(form).getElementsByTagName('*')).inject([],
|
3484
|
-
function(elements, child) {
|
3485
|
-
if (Form.Element.Serializers[child.tagName.toLowerCase()])
|
3486
|
-
elements.push(Element.extend(child));
|
3487
|
-
return elements;
|
3488
|
-
}
|
3489
|
-
);
|
3490
|
-
},
|
3491
|
-
|
3492
|
-
getInputs: function(form, typeName, name) {
|
3493
|
-
form = $(form);
|
3494
|
-
var inputs = form.getElementsByTagName('input');
|
3495
|
-
|
3496
|
-
if (!typeName && !name) return $A(inputs).map(Element.extend);
|
3497
|
-
|
3498
|
-
for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
|
3499
|
-
var input = inputs[i];
|
3500
|
-
if ((typeName && input.type != typeName) || (name && input.name != name))
|
3501
|
-
continue;
|
3502
|
-
matchingInputs.push(Element.extend(input));
|
3503
|
-
}
|
3504
|
-
|
3505
|
-
return matchingInputs;
|
3506
|
-
},
|
3507
|
-
|
3508
|
-
disable: function(form) {
|
3509
|
-
form = $(form);
|
3510
|
-
Form.getElements(form).invoke('disable');
|
3511
|
-
return form;
|
3512
|
-
},
|
3513
|
-
|
3514
|
-
enable: function(form) {
|
3515
|
-
form = $(form);
|
3516
|
-
Form.getElements(form).invoke('enable');
|
3517
|
-
return form;
|
3518
|
-
},
|
3519
|
-
|
3520
|
-
findFirstElement: function(form) {
|
3521
|
-
var elements = $(form).getElements().findAll(function(element) {
|
3522
|
-
return 'hidden' != element.type && !element.disabled;
|
3523
|
-
});
|
3524
|
-
var firstByIndex = elements.findAll(function(element) {
|
3525
|
-
return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
|
3526
|
-
}).sortBy(function(element) { return element.tabIndex }).first();
|
3527
|
-
|
3528
|
-
return firstByIndex ? firstByIndex : elements.find(function(element) {
|
3529
|
-
return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
|
3530
|
-
});
|
3531
|
-
},
|
3532
|
-
|
3533
|
-
focusFirstElement: function(form) {
|
3534
|
-
form = $(form);
|
3535
|
-
form.findFirstElement().activate();
|
3536
|
-
return form;
|
3537
|
-
},
|
3538
|
-
|
3539
|
-
request: function(form, options) {
|
3540
|
-
form = $(form), options = Object.clone(options || { });
|
3541
|
-
|
3542
|
-
var params = options.parameters, action = form.readAttribute('action') || '';
|
3543
|
-
if (action.blank()) action = window.location.href;
|
3544
|
-
options.parameters = form.serialize(true);
|
3545
|
-
|
3546
|
-
if (params) {
|
3547
|
-
if (Object.isString(params)) params = params.toQueryParams();
|
3548
|
-
Object.extend(options.parameters, params);
|
3549
|
-
}
|
3550
|
-
|
3551
|
-
if (form.hasAttribute('method') && !options.method)
|
3552
|
-
options.method = form.method;
|
3553
|
-
|
3554
|
-
return new Ajax.Request(action, options);
|
3555
|
-
}
|
3556
|
-
};
|
3557
|
-
|
3558
|
-
/*--------------------------------------------------------------------------*/
|
3559
|
-
|
3560
|
-
Form.Element = {
|
3561
|
-
focus: function(element) {
|
3562
|
-
$(element).focus();
|
3563
|
-
return element;
|
3564
|
-
},
|
3565
|
-
|
3566
|
-
select: function(element) {
|
3567
|
-
$(element).select();
|
3568
|
-
return element;
|
3569
|
-
}
|
3570
|
-
};
|
3571
|
-
|
3572
|
-
Form.Element.Methods = {
|
3573
|
-
serialize: function(element) {
|
3574
|
-
element = $(element);
|
3575
|
-
if (!element.disabled && element.name) {
|
3576
|
-
var value = element.getValue();
|
3577
|
-
if (value != undefined) {
|
3578
|
-
var pair = { };
|
3579
|
-
pair[element.name] = value;
|
3580
|
-
return Object.toQueryString(pair);
|
3581
|
-
}
|
3582
|
-
}
|
3583
|
-
return '';
|
3584
|
-
},
|
3585
|
-
|
3586
|
-
getValue: function(element) {
|
3587
|
-
element = $(element);
|
3588
|
-
var method = element.tagName.toLowerCase();
|
3589
|
-
return Form.Element.Serializers[method](element);
|
3590
|
-
},
|
3591
|
-
|
3592
|
-
setValue: function(element, value) {
|
3593
|
-
element = $(element);
|
3594
|
-
var method = element.tagName.toLowerCase();
|
3595
|
-
Form.Element.Serializers[method](element, value);
|
3596
|
-
return element;
|
3597
|
-
},
|
3598
|
-
|
3599
|
-
clear: function(element) {
|
3600
|
-
$(element).value = '';
|
3601
|
-
return element;
|
3602
|
-
},
|
3603
|
-
|
3604
|
-
present: function(element) {
|
3605
|
-
return $(element).value != '';
|
3606
|
-
},
|
3607
|
-
|
3608
|
-
activate: function(element) {
|
3609
|
-
element = $(element);
|
3610
|
-
try {
|
3611
|
-
element.focus();
|
3612
|
-
if (element.select && (element.tagName.toLowerCase() != 'input' ||
|
3613
|
-
!['button', 'reset', 'submit'].include(element.type)))
|
3614
|
-
element.select();
|
3615
|
-
} catch (e) { }
|
3616
|
-
return element;
|
3617
|
-
},
|
3618
|
-
|
3619
|
-
disable: function(element) {
|
3620
|
-
element = $(element);
|
3621
|
-
element.disabled = true;
|
3622
|
-
return element;
|
3623
|
-
},
|
3624
|
-
|
3625
|
-
enable: function(element) {
|
3626
|
-
element = $(element);
|
3627
|
-
element.disabled = false;
|
3628
|
-
return element;
|
3629
|
-
}
|
3630
|
-
};
|
3631
|
-
|
3632
|
-
/*--------------------------------------------------------------------------*/
|
3633
|
-
|
3634
|
-
var Field = Form.Element;
|
3635
|
-
var $F = Form.Element.Methods.getValue;
|
3636
|
-
|
3637
|
-
/*--------------------------------------------------------------------------*/
|
3638
|
-
|
3639
|
-
Form.Element.Serializers = {
|
3640
|
-
input: function(element, value) {
|
3641
|
-
switch (element.type.toLowerCase()) {
|
3642
|
-
case 'checkbox':
|
3643
|
-
case 'radio':
|
3644
|
-
return Form.Element.Serializers.inputSelector(element, value);
|
3645
|
-
default:
|
3646
|
-
return Form.Element.Serializers.textarea(element, value);
|
3647
|
-
}
|
3648
|
-
},
|
3649
|
-
|
3650
|
-
inputSelector: function(element, value) {
|
3651
|
-
if (Object.isUndefined(value)) return element.checked ? element.value : null;
|
3652
|
-
else element.checked = !!value;
|
3653
|
-
},
|
3654
|
-
|
3655
|
-
textarea: function(element, value) {
|
3656
|
-
if (Object.isUndefined(value)) return element.value;
|
3657
|
-
else element.value = value;
|
3658
|
-
},
|
3659
|
-
|
3660
|
-
select: function(element, value) {
|
3661
|
-
if (Object.isUndefined(value))
|
3662
|
-
return this[element.type == 'select-one' ?
|
3663
|
-
'selectOne' : 'selectMany'](element);
|
3664
|
-
else {
|
3665
|
-
var opt, currentValue, single = !Object.isArray(value);
|
3666
|
-
for (var i = 0, length = element.length; i < length; i++) {
|
3667
|
-
opt = element.options[i];
|
3668
|
-
currentValue = this.optionValue(opt);
|
3669
|
-
if (single) {
|
3670
|
-
if (currentValue == value) {
|
3671
|
-
opt.selected = true;
|
3672
|
-
return;
|
3673
|
-
}
|
3674
|
-
}
|
3675
|
-
else opt.selected = value.include(currentValue);
|
3676
|
-
}
|
3677
|
-
}
|
3678
|
-
},
|
3679
|
-
|
3680
|
-
selectOne: function(element) {
|
3681
|
-
var index = element.selectedIndex;
|
3682
|
-
return index >= 0 ? this.optionValue(element.options[index]) : null;
|
3683
|
-
},
|
3684
|
-
|
3685
|
-
selectMany: function(element) {
|
3686
|
-
var values, length = element.length;
|
3687
|
-
if (!length) return null;
|
3688
|
-
|
3689
|
-
for (var i = 0, values = []; i < length; i++) {
|
3690
|
-
var opt = element.options[i];
|
3691
|
-
if (opt.selected) values.push(this.optionValue(opt));
|
3692
|
-
}
|
3693
|
-
return values;
|
3694
|
-
},
|
3695
|
-
|
3696
|
-
optionValue: function(opt) {
|
3697
|
-
// extend element because hasAttribute may not be native
|
3698
|
-
return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
|
3699
|
-
}
|
3700
|
-
};
|
3701
|
-
|
3702
|
-
/*--------------------------------------------------------------------------*/
|
3703
|
-
|
3704
|
-
Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
|
3705
|
-
initialize: function($super, element, frequency, callback) {
|
3706
|
-
$super(callback, frequency);
|
3707
|
-
this.element = $(element);
|
3708
|
-
this.lastValue = this.getValue();
|
3709
|
-
},
|
3710
|
-
|
3711
|
-
execute: function() {
|
3712
|
-
var value = this.getValue();
|
3713
|
-
if (Object.isString(this.lastValue) && Object.isString(value) ?
|
3714
|
-
this.lastValue != value : String(this.lastValue) != String(value)) {
|
3715
|
-
this.callback(this.element, value);
|
3716
|
-
this.lastValue = value;
|
3717
|
-
}
|
3718
|
-
}
|
3719
|
-
});
|
3720
|
-
|
3721
|
-
Form.Element.Observer = Class.create(Abstract.TimedObserver, {
|
3722
|
-
getValue: function() {
|
3723
|
-
return Form.Element.getValue(this.element);
|
3724
|
-
}
|
3725
|
-
});
|
3726
|
-
|
3727
|
-
Form.Observer = Class.create(Abstract.TimedObserver, {
|
3728
|
-
getValue: function() {
|
3729
|
-
return Form.serialize(this.element);
|
3730
|
-
}
|
3731
|
-
});
|
3732
|
-
|
3733
|
-
/*--------------------------------------------------------------------------*/
|
3734
|
-
|
3735
|
-
Abstract.EventObserver = Class.create({
|
3736
|
-
initialize: function(element, callback) {
|
3737
|
-
this.element = $(element);
|
3738
|
-
this.callback = callback;
|
3739
|
-
|
3740
|
-
this.lastValue = this.getValue();
|
3741
|
-
if (this.element.tagName.toLowerCase() == 'form')
|
3742
|
-
this.registerFormCallbacks();
|
3743
|
-
else
|
3744
|
-
this.registerCallback(this.element);
|
3745
|
-
},
|
3746
|
-
|
3747
|
-
onElementEvent: function() {
|
3748
|
-
var value = this.getValue();
|
3749
|
-
if (this.lastValue != value) {
|
3750
|
-
this.callback(this.element, value);
|
3751
|
-
this.lastValue = value;
|
3752
|
-
}
|
3753
|
-
},
|
3754
|
-
|
3755
|
-
registerFormCallbacks: function() {
|
3756
|
-
Form.getElements(this.element).each(this.registerCallback, this);
|
3757
|
-
},
|
3758
|
-
|
3759
|
-
registerCallback: function(element) {
|
3760
|
-
if (element.type) {
|
3761
|
-
switch (element.type.toLowerCase()) {
|
3762
|
-
case 'checkbox':
|
3763
|
-
case 'radio':
|
3764
|
-
Event.observe(element, 'click', this.onElementEvent.bind(this));
|
3765
|
-
break;
|
3766
|
-
default:
|
3767
|
-
Event.observe(element, 'change', this.onElementEvent.bind(this));
|
3768
|
-
break;
|
3769
|
-
}
|
3770
|
-
}
|
3771
|
-
}
|
3772
|
-
});
|
3773
|
-
|
3774
|
-
Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
|
3775
|
-
getValue: function() {
|
3776
|
-
return Form.Element.getValue(this.element);
|
3777
|
-
}
|
3778
|
-
});
|
3779
|
-
|
3780
|
-
Form.EventObserver = Class.create(Abstract.EventObserver, {
|
3781
|
-
getValue: function() {
|
3782
|
-
return Form.serialize(this.element);
|
3783
|
-
}
|
3784
|
-
});
|
3785
|
-
if (!window.Event) var Event = { };
|
3786
|
-
|
3787
|
-
Object.extend(Event, {
|
3788
|
-
KEY_BACKSPACE: 8,
|
3789
|
-
KEY_TAB: 9,
|
3790
|
-
KEY_RETURN: 13,
|
3791
|
-
KEY_ESC: 27,
|
3792
|
-
KEY_LEFT: 37,
|
3793
|
-
KEY_UP: 38,
|
3794
|
-
KEY_RIGHT: 39,
|
3795
|
-
KEY_DOWN: 40,
|
3796
|
-
KEY_DELETE: 46,
|
3797
|
-
KEY_HOME: 36,
|
3798
|
-
KEY_END: 35,
|
3799
|
-
KEY_PAGEUP: 33,
|
3800
|
-
KEY_PAGEDOWN: 34,
|
3801
|
-
KEY_INSERT: 45,
|
3802
|
-
|
3803
|
-
cache: { },
|
3804
|
-
|
3805
|
-
relatedTarget: function(event) {
|
3806
|
-
var element;
|
3807
|
-
switch(event.type) {
|
3808
|
-
case 'mouseover': element = event.fromElement; break;
|
3809
|
-
case 'mouseout': element = event.toElement; break;
|
3810
|
-
default: return null;
|
3811
|
-
}
|
3812
|
-
return Element.extend(element);
|
3813
|
-
}
|
3814
|
-
});
|
3815
|
-
|
3816
|
-
Event.Methods = (function() {
|
3817
|
-
var isButton;
|
3818
|
-
|
3819
|
-
if (Prototype.Browser.IE) {
|
3820
|
-
var buttonMap = { 0: 1, 1: 4, 2: 2 };
|
3821
|
-
isButton = function(event, code) {
|
3822
|
-
return event.button == buttonMap[code];
|
3823
|
-
};
|
3824
|
-
|
3825
|
-
} else if (Prototype.Browser.WebKit) {
|
3826
|
-
isButton = function(event, code) {
|
3827
|
-
switch (code) {
|
3828
|
-
case 0: return event.which == 1 && !event.metaKey;
|
3829
|
-
case 1: return event.which == 1 && event.metaKey;
|
3830
|
-
default: return false;
|
3831
|
-
}
|
3832
|
-
};
|
3833
|
-
|
3834
|
-
} else {
|
3835
|
-
isButton = function(event, code) {
|
3836
|
-
return event.which ? (event.which === code + 1) : (event.button === code);
|
3837
|
-
};
|
3838
|
-
}
|
3839
|
-
|
3840
|
-
return {
|
3841
|
-
isLeftClick: function(event) { return isButton(event, 0) },
|
3842
|
-
isMiddleClick: function(event) { return isButton(event, 1) },
|
3843
|
-
isRightClick: function(event) { return isButton(event, 2) },
|
3844
|
-
|
3845
|
-
element: function(event) {
|
3846
|
-
event = Event.extend(event);
|
3847
|
-
|
3848
|
-
var node = event.target,
|
3849
|
-
type = event.type,
|
3850
|
-
currentTarget = event.currentTarget;
|
3851
|
-
|
3852
|
-
if (currentTarget && currentTarget.tagName) {
|
3853
|
-
// Firefox screws up the "click" event when moving between radio buttons
|
3854
|
-
// via arrow keys. It also screws up the "load" and "error" events on images,
|
3855
|
-
// reporting the document as the target instead of the original image.
|
3856
|
-
if (type === 'load' || type === 'error' ||
|
3857
|
-
(type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
|
3858
|
-
&& currentTarget.type === 'radio'))
|
3859
|
-
node = currentTarget;
|
3860
|
-
}
|
3861
|
-
if (node.nodeType == Node.TEXT_NODE) node = node.parentNode;
|
3862
|
-
return Element.extend(node);
|
3863
|
-
},
|
3864
|
-
|
3865
|
-
findElement: function(event, expression) {
|
3866
|
-
var element = Event.element(event);
|
3867
|
-
if (!expression) return element;
|
3868
|
-
var elements = [element].concat(element.ancestors());
|
3869
|
-
return Selector.findElement(elements, expression, 0);
|
3870
|
-
},
|
3871
|
-
|
3872
|
-
pointer: function(event) {
|
3873
|
-
var docElement = document.documentElement,
|
3874
|
-
body = document.body || { scrollLeft: 0, scrollTop: 0 };
|
3875
|
-
return {
|
3876
|
-
x: event.pageX || (event.clientX +
|
3877
|
-
(docElement.scrollLeft || body.scrollLeft) -
|
3878
|
-
(docElement.clientLeft || 0)),
|
3879
|
-
y: event.pageY || (event.clientY +
|
3880
|
-
(docElement.scrollTop || body.scrollTop) -
|
3881
|
-
(docElement.clientTop || 0))
|
3882
|
-
};
|
3883
|
-
},
|
3884
|
-
|
3885
|
-
pointerX: function(event) { return Event.pointer(event).x },
|
3886
|
-
pointerY: function(event) { return Event.pointer(event).y },
|
3887
|
-
|
3888
|
-
stop: function(event) {
|
3889
|
-
Event.extend(event);
|
3890
|
-
event.preventDefault();
|
3891
|
-
event.stopPropagation();
|
3892
|
-
event.stopped = true;
|
3893
|
-
}
|
3894
|
-
};
|
3895
|
-
})();
|
3896
|
-
|
3897
|
-
Event.extend = (function() {
|
3898
|
-
var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
|
3899
|
-
m[name] = Event.Methods[name].methodize();
|
3900
|
-
return m;
|
3901
|
-
});
|
3902
|
-
|
3903
|
-
if (Prototype.Browser.IE) {
|
3904
|
-
Object.extend(methods, {
|
3905
|
-
stopPropagation: function() { this.cancelBubble = true },
|
3906
|
-
preventDefault: function() { this.returnValue = false },
|
3907
|
-
inspect: function() { return "[object Event]" }
|
3908
|
-
});
|
3909
|
-
|
3910
|
-
return function(event) {
|
3911
|
-
if (!event) return false;
|
3912
|
-
if (event._extendedByPrototype) return event;
|
3913
|
-
|
3914
|
-
event._extendedByPrototype = Prototype.emptyFunction;
|
3915
|
-
var pointer = Event.pointer(event);
|
3916
|
-
Object.extend(event, {
|
3917
|
-
target: event.srcElement,
|
3918
|
-
relatedTarget: Event.relatedTarget(event),
|
3919
|
-
pageX: pointer.x,
|
3920
|
-
pageY: pointer.y
|
3921
|
-
});
|
3922
|
-
return Object.extend(event, methods);
|
3923
|
-
};
|
3924
|
-
|
3925
|
-
} else {
|
3926
|
-
Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__'];
|
3927
|
-
Object.extend(Event.prototype, methods);
|
3928
|
-
return Prototype.K;
|
3929
|
-
}
|
3930
|
-
})();
|
3931
|
-
|
3932
|
-
Object.extend(Event, (function() {
|
3933
|
-
var cache = Event.cache;
|
3934
|
-
|
3935
|
-
function getEventID(element) {
|
3936
|
-
if (element._prototypeEventID) return element._prototypeEventID[0];
|
3937
|
-
arguments.callee.id = arguments.callee.id || 1;
|
3938
|
-
return element._prototypeEventID = [++arguments.callee.id];
|
3939
|
-
}
|
3940
|
-
|
3941
|
-
function getDOMEventName(eventName) {
|
3942
|
-
if (eventName && eventName.include(':')) return "dataavailable";
|
3943
|
-
return eventName;
|
3944
|
-
}
|
3945
|
-
|
3946
|
-
function getCacheForID(id) {
|
3947
|
-
return cache[id] = cache[id] || { };
|
3948
|
-
}
|
3949
|
-
|
3950
|
-
function getWrappersForEventName(id, eventName) {
|
3951
|
-
var c = getCacheForID(id);
|
3952
|
-
return c[eventName] = c[eventName] || [];
|
3953
|
-
}
|
3954
|
-
|
3955
|
-
function createWrapper(element, eventName, handler) {
|
3956
|
-
var id = getEventID(element);
|
3957
|
-
var c = getWrappersForEventName(id, eventName);
|
3958
|
-
if (c.pluck("handler").include(handler)) return false;
|
3959
|
-
|
3960
|
-
var wrapper = function(event) {
|
3961
|
-
if (!Event || !Event.extend ||
|
3962
|
-
(event.eventName && event.eventName != eventName))
|
3963
|
-
return false;
|
3964
|
-
|
3965
|
-
Event.extend(event);
|
3966
|
-
handler.call(element, event);
|
3967
|
-
};
|
3968
|
-
|
3969
|
-
wrapper.handler = handler;
|
3970
|
-
c.push(wrapper);
|
3971
|
-
return wrapper;
|
3972
|
-
}
|
3973
|
-
|
3974
|
-
function findWrapper(id, eventName, handler) {
|
3975
|
-
var c = getWrappersForEventName(id, eventName);
|
3976
|
-
return c.find(function(wrapper) { return wrapper.handler == handler });
|
3977
|
-
}
|
3978
|
-
|
3979
|
-
function destroyWrapper(id, eventName, handler) {
|
3980
|
-
var c = getCacheForID(id);
|
3981
|
-
if (!c[eventName]) return false;
|
3982
|
-
c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
|
3983
|
-
}
|
3984
|
-
|
3985
|
-
function destroyCache() {
|
3986
|
-
for (var id in cache)
|
3987
|
-
for (var eventName in cache[id])
|
3988
|
-
cache[id][eventName] = null;
|
3989
|
-
}
|
3990
|
-
|
3991
|
-
|
3992
|
-
// Internet Explorer needs to remove event handlers on page unload
|
3993
|
-
// in order to avoid memory leaks.
|
3994
|
-
if (window.attachEvent) {
|
3995
|
-
window.attachEvent("onunload", destroyCache);
|
3996
|
-
}
|
3997
|
-
|
3998
|
-
// Safari has a dummy event handler on page unload so that it won't
|
3999
|
-
// use its bfcache. Safari <= 3.1 has an issue with restoring the "document"
|
4000
|
-
// object when page is returned to via the back button using its bfcache.
|
4001
|
-
if (Prototype.Browser.WebKit) {
|
4002
|
-
window.addEventListener('unload', Prototype.emptyFunction, false);
|
4003
|
-
}
|
4004
|
-
|
4005
|
-
return {
|
4006
|
-
observe: function(element, eventName, handler) {
|
4007
|
-
element = $(element);
|
4008
|
-
var name = getDOMEventName(eventName);
|
4009
|
-
|
4010
|
-
var wrapper = createWrapper(element, eventName, handler);
|
4011
|
-
if (!wrapper) return element;
|
4012
|
-
|
4013
|
-
if (element.addEventListener) {
|
4014
|
-
element.addEventListener(name, wrapper, false);
|
4015
|
-
} else {
|
4016
|
-
element.attachEvent("on" + name, wrapper);
|
4017
|
-
}
|
4018
|
-
|
4019
|
-
return element;
|
4020
|
-
},
|
4021
|
-
|
4022
|
-
stopObserving: function(element, eventName, handler) {
|
4023
|
-
element = $(element);
|
4024
|
-
var id = getEventID(element), name = getDOMEventName(eventName);
|
4025
|
-
|
4026
|
-
if (!handler && eventName) {
|
4027
|
-
getWrappersForEventName(id, eventName).each(function(wrapper) {
|
4028
|
-
element.stopObserving(eventName, wrapper.handler);
|
4029
|
-
});
|
4030
|
-
return element;
|
4031
|
-
|
4032
|
-
} else if (!eventName) {
|
4033
|
-
Object.keys(getCacheForID(id)).each(function(eventName) {
|
4034
|
-
element.stopObserving(eventName);
|
4035
|
-
});
|
4036
|
-
return element;
|
4037
|
-
}
|
4038
|
-
|
4039
|
-
var wrapper = findWrapper(id, eventName, handler);
|
4040
|
-
if (!wrapper) return element;
|
4041
|
-
|
4042
|
-
if (element.removeEventListener) {
|
4043
|
-
element.removeEventListener(name, wrapper, false);
|
4044
|
-
} else {
|
4045
|
-
element.detachEvent("on" + name, wrapper);
|
4046
|
-
}
|
4047
|
-
|
4048
|
-
destroyWrapper(id, eventName, handler);
|
4049
|
-
|
4050
|
-
return element;
|
4051
|
-
},
|
4052
|
-
|
4053
|
-
fire: function(element, eventName, memo) {
|
4054
|
-
element = $(element);
|
4055
|
-
if (element == document && document.createEvent && !element.dispatchEvent)
|
4056
|
-
element = document.documentElement;
|
4057
|
-
|
4058
|
-
var event;
|
4059
|
-
if (document.createEvent) {
|
4060
|
-
event = document.createEvent("HTMLEvents");
|
4061
|
-
event.initEvent("dataavailable", true, true);
|
4062
|
-
} else {
|
4063
|
-
event = document.createEventObject();
|
4064
|
-
event.eventType = "ondataavailable";
|
4065
|
-
}
|
4066
|
-
|
4067
|
-
event.eventName = eventName;
|
4068
|
-
event.memo = memo || { };
|
4069
|
-
|
4070
|
-
if (document.createEvent) {
|
4071
|
-
element.dispatchEvent(event);
|
4072
|
-
} else {
|
4073
|
-
element.fireEvent(event.eventType, event);
|
4074
|
-
}
|
4075
|
-
|
4076
|
-
return Event.extend(event);
|
4077
|
-
}
|
4078
|
-
};
|
4079
|
-
})());
|
4080
|
-
|
4081
|
-
Object.extend(Event, Event.Methods);
|
4082
|
-
|
4083
|
-
Element.addMethods({
|
4084
|
-
fire: Event.fire,
|
4085
|
-
observe: Event.observe,
|
4086
|
-
stopObserving: Event.stopObserving
|
4087
|
-
});
|
4088
|
-
|
4089
|
-
Object.extend(document, {
|
4090
|
-
fire: Element.Methods.fire.methodize(),
|
4091
|
-
observe: Element.Methods.observe.methodize(),
|
4092
|
-
stopObserving: Element.Methods.stopObserving.methodize(),
|
4093
|
-
loaded: false
|
4094
|
-
});
|
4095
|
-
|
4096
|
-
(function() {
|
4097
|
-
/* Support for the DOMContentLoaded event is based on work by Dan Webb,
|
4098
|
-
Matthias Miller, Dean Edwards and John Resig. */
|
4099
|
-
|
4100
|
-
var timer;
|
4101
|
-
|
4102
|
-
function fireContentLoadedEvent() {
|
4103
|
-
if (document.loaded) return;
|
4104
|
-
if (timer) window.clearInterval(timer);
|
4105
|
-
document.fire("dom:loaded");
|
4106
|
-
document.loaded = true;
|
4107
|
-
}
|
4108
|
-
|
4109
|
-
if (document.addEventListener) {
|
4110
|
-
if (Prototype.Browser.WebKit) {
|
4111
|
-
timer = window.setInterval(function() {
|
4112
|
-
if (/loaded|complete/.test(document.readyState))
|
4113
|
-
fireContentLoadedEvent();
|
4114
|
-
}, 0);
|
4115
|
-
|
4116
|
-
Event.observe(window, "load", fireContentLoadedEvent);
|
4117
|
-
|
4118
|
-
} else {
|
4119
|
-
document.addEventListener("DOMContentLoaded",
|
4120
|
-
fireContentLoadedEvent, false);
|
4121
|
-
}
|
4122
|
-
|
4123
|
-
} else {
|
4124
|
-
document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
|
4125
|
-
$("__onDOMContentLoaded").onreadystatechange = function() {
|
4126
|
-
if (this.readyState == "complete") {
|
4127
|
-
this.onreadystatechange = null;
|
4128
|
-
fireContentLoadedEvent();
|
4129
|
-
}
|
4130
|
-
};
|
4131
|
-
}
|
4132
|
-
})();
|
4133
|
-
/*------------------------------- DEPRECATED -------------------------------*/
|
4134
|
-
|
4135
|
-
Hash.toQueryString = Object.toQueryString;
|
4136
|
-
|
4137
|
-
var Toggle = { display: Element.toggle };
|
4138
|
-
|
4139
|
-
Element.Methods.childOf = Element.Methods.descendantOf;
|
4140
|
-
|
4141
|
-
var Insertion = {
|
4142
|
-
Before: function(element, content) {
|
4143
|
-
return Element.insert(element, {before:content});
|
4144
|
-
},
|
4145
|
-
|
4146
|
-
Top: function(element, content) {
|
4147
|
-
return Element.insert(element, {top:content});
|
4148
|
-
},
|
4149
|
-
|
4150
|
-
Bottom: function(element, content) {
|
4151
|
-
return Element.insert(element, {bottom:content});
|
4152
|
-
},
|
4153
|
-
|
4154
|
-
After: function(element, content) {
|
4155
|
-
return Element.insert(element, {after:content});
|
4156
|
-
}
|
4157
|
-
};
|
4158
|
-
|
4159
|
-
var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
|
4160
|
-
|
4161
|
-
// This should be moved to script.aculo.us; notice the deprecated methods
|
4162
|
-
// further below, that map to the newer Element methods.
|
4163
|
-
var Position = {
|
4164
|
-
// set to true if needed, warning: firefox performance problems
|
4165
|
-
// NOT neeeded for page scrolling, only if draggable contained in
|
4166
|
-
// scrollable elements
|
4167
|
-
includeScrollOffsets: false,
|
4168
|
-
|
4169
|
-
// must be called before calling withinIncludingScrolloffset, every time the
|
4170
|
-
// page is scrolled
|
4171
|
-
prepare: function() {
|
4172
|
-
this.deltaX = window.pageXOffset
|
4173
|
-
|| document.documentElement.scrollLeft
|
4174
|
-
|| document.body.scrollLeft
|
4175
|
-
|| 0;
|
4176
|
-
this.deltaY = window.pageYOffset
|
4177
|
-
|| document.documentElement.scrollTop
|
4178
|
-
|| document.body.scrollTop
|
4179
|
-
|| 0;
|
4180
|
-
},
|
4181
|
-
|
4182
|
-
// caches x/y coordinate pair to use with overlap
|
4183
|
-
within: function(element, x, y) {
|
4184
|
-
if (this.includeScrollOffsets)
|
4185
|
-
return this.withinIncludingScrolloffsets(element, x, y);
|
4186
|
-
this.xcomp = x;
|
4187
|
-
this.ycomp = y;
|
4188
|
-
this.offset = Element.cumulativeOffset(element);
|
4189
|
-
|
4190
|
-
return (y >= this.offset[1] &&
|
4191
|
-
y < this.offset[1] + element.offsetHeight &&
|
4192
|
-
x >= this.offset[0] &&
|
4193
|
-
x < this.offset[0] + element.offsetWidth);
|
4194
|
-
},
|
4195
|
-
|
4196
|
-
withinIncludingScrolloffsets: function(element, x, y) {
|
4197
|
-
var offsetcache = Element.cumulativeScrollOffset(element);
|
4198
|
-
|
4199
|
-
this.xcomp = x + offsetcache[0] - this.deltaX;
|
4200
|
-
this.ycomp = y + offsetcache[1] - this.deltaY;
|
4201
|
-
this.offset = Element.cumulativeOffset(element);
|
4202
|
-
|
4203
|
-
return (this.ycomp >= this.offset[1] &&
|
4204
|
-
this.ycomp < this.offset[1] + element.offsetHeight &&
|
4205
|
-
this.xcomp >= this.offset[0] &&
|
4206
|
-
this.xcomp < this.offset[0] + element.offsetWidth);
|
4207
|
-
},
|
4208
|
-
|
4209
|
-
// within must be called directly before
|
4210
|
-
overlap: function(mode, element) {
|
4211
|
-
if (!mode) return 0;
|
4212
|
-
if (mode == 'vertical')
|
4213
|
-
return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
|
4214
|
-
element.offsetHeight;
|
4215
|
-
if (mode == 'horizontal')
|
4216
|
-
return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
|
4217
|
-
element.offsetWidth;
|
4218
|
-
},
|
4219
|
-
|
4220
|
-
// Deprecation layer -- use newer Element methods now (1.5.2).
|
4221
|
-
|
4222
|
-
cumulativeOffset: Element.Methods.cumulativeOffset,
|
4223
|
-
|
4224
|
-
positionedOffset: Element.Methods.positionedOffset,
|
4225
|
-
|
4226
|
-
absolutize: function(element) {
|
4227
|
-
Position.prepare();
|
4228
|
-
return Element.absolutize(element);
|
4229
|
-
},
|
4230
|
-
|
4231
|
-
relativize: function(element) {
|
4232
|
-
Position.prepare();
|
4233
|
-
return Element.relativize(element);
|
4234
|
-
},
|
4235
|
-
|
4236
|
-
realOffset: Element.Methods.cumulativeScrollOffset,
|
4237
|
-
|
4238
|
-
offsetParent: Element.Methods.getOffsetParent,
|
4239
|
-
|
4240
|
-
page: Element.Methods.viewportOffset,
|
4241
|
-
|
4242
|
-
clone: function(source, target, options) {
|
4243
|
-
options = options || { };
|
4244
|
-
return Element.clonePosition(target, source, options);
|
4245
|
-
}
|
4246
|
-
};
|
4247
|
-
|
4248
|
-
/*--------------------------------------------------------------------------*/
|
4249
|
-
|
4250
|
-
if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
|
4251
|
-
function iter(name) {
|
4252
|
-
return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
|
4253
|
-
}
|
4254
|
-
|
4255
|
-
instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
|
4256
|
-
function(element, className) {
|
4257
|
-
className = className.toString().strip();
|
4258
|
-
var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
|
4259
|
-
return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
|
4260
|
-
} : function(element, className) {
|
4261
|
-
className = className.toString().strip();
|
4262
|
-
var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
|
4263
|
-
if (!classNames && !className) return elements;
|
4264
|
-
|
4265
|
-
var nodes = $(element).getElementsByTagName('*');
|
4266
|
-
className = ' ' + className + ' ';
|
4267
|
-
|
4268
|
-
for (var i = 0, child, cn; child = nodes[i]; i++) {
|
4269
|
-
if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
|
4270
|
-
(classNames && classNames.all(function(name) {
|
4271
|
-
return !name.toString().blank() && cn.include(' ' + name + ' ');
|
4272
|
-
}))))
|
4273
|
-
elements.push(Element.extend(child));
|
4274
|
-
}
|
4275
|
-
return elements;
|
4276
|
-
};
|
4277
|
-
|
4278
|
-
return function(className, parentElement) {
|
4279
|
-
return $(parentElement || document.body).getElementsByClassName(className);
|
4280
|
-
};
|
4281
|
-
}(Element.Methods);
|
4282
|
-
|
4283
|
-
/*--------------------------------------------------------------------------*/
|
4284
|
-
|
4285
|
-
Element.ClassNames = Class.create();
|
4286
|
-
Element.ClassNames.prototype = {
|
4287
|
-
initialize: function(element) {
|
4288
|
-
this.element = $(element);
|
4289
|
-
},
|
4290
|
-
|
4291
|
-
_each: function(iterator) {
|
4292
|
-
this.element.className.split(/\s+/).select(function(name) {
|
4293
|
-
return name.length > 0;
|
4294
|
-
})._each(iterator);
|
4295
|
-
},
|
4296
|
-
|
4297
|
-
set: function(className) {
|
4298
|
-
this.element.className = className;
|
4299
|
-
},
|
4300
|
-
|
4301
|
-
add: function(classNameToAdd) {
|
4302
|
-
if (this.include(classNameToAdd)) return;
|
4303
|
-
this.set($A(this).concat(classNameToAdd).join(' '));
|
4304
|
-
},
|
4305
|
-
|
4306
|
-
remove: function(classNameToRemove) {
|
4307
|
-
if (!this.include(classNameToRemove)) return;
|
4308
|
-
this.set($A(this).without(classNameToRemove).join(' '));
|
4309
|
-
},
|
4310
|
-
|
4311
|
-
toString: function() {
|
4312
|
-
return $A(this).join(' ');
|
4313
|
-
}
|
4314
|
-
};
|
4315
|
-
|
4316
|
-
Object.extend(Element.ClassNames.prototype, Enumerable);
|
4317
|
-
|
4318
|
-
/*--------------------------------------------------------------------------*/
|
4319
|
-
|
4320
|
-
Element.addMethods();
|