ramaze 0.3.9.1 → 2008.06
Sign up to get free protection for your applications and to get access to all the features.
- data/{doc/README → README.markdown} +78 -32
- data/Rakefile +53 -50
- data/benchmark/results.txt +131 -0
- data/benchmark/run.rb +362 -0
- data/benchmark/suite/minimal.rb +13 -0
- data/benchmark/suite/no_informer.rb +9 -0
- data/benchmark/suite/no_sessions.rb +10 -0
- data/benchmark/suite/no_template.rb +9 -0
- data/benchmark/suite/simple.rb +7 -0
- data/benchmark/suite/template_amrita2.rb +17 -0
- data/benchmark/suite/template_builder.rb +12 -0
- data/benchmark/suite/template_erubis.rb +10 -0
- data/benchmark/suite/template_ezamar.rb +10 -0
- data/benchmark/suite/template_haml.rb +15 -0
- data/benchmark/suite/template_liquid.rb +13 -0
- data/benchmark/suite/template_markaby.rb +11 -0
- data/benchmark/suite/template_nagoro.rb +10 -0
- data/benchmark/suite/template_redcloth.rb +15 -0
- data/benchmark/suite/template_tenjin.rb +10 -0
- data/benchmark/test.rb +35 -0
- data/bin/ramaze +32 -122
- data/cache.yaml +7 -0
- data/doc/AUTHORS +26 -22
- data/doc/CHANGELOG +16720 -3907
- data/doc/INSTALL +77 -19
- data/doc/LEGAL +0 -4
- data/doc/meta/announcement.txt +43 -54
- data/doc/meta/configuration.txt +3 -2
- data/doc/readme_chunks/examples.txt +2 -2
- data/doc/readme_chunks/installing.txt +66 -20
- data/doc/tutorial/todolist.html +338 -520
- data/doc/tutorial/todolist.mkd +36 -2
- data/examples/{auth → app/auth}/auth.rb +0 -0
- data/examples/{auth → app/auth}/template/layout.haml +0 -0
- data/examples/{auth → app/auth}/template/login.haml +0 -0
- data/examples/{blog → app/blog}/README +0 -0
- data/examples/{blog → app/blog}/controller/main.rb +1 -1
- data/examples/{blog → app/blog}/model/entry.rb +1 -1
- data/examples/{blog → app/blog}/public/styles/blog.css +0 -0
- data/examples/{blog → app/blog}/spec/blog.rb +2 -2
- data/examples/{blog → app/blog}/start.rb +0 -0
- data/examples/{blog → app/blog}/view/edit.xhtml +0 -0
- data/examples/{blog → app/blog}/view/index.xhtml +0 -0
- data/examples/{blog → app/blog}/view/layout.xhtml +0 -0
- data/examples/{blog → app/blog}/view/new.xhtml +0 -0
- data/examples/app/chat/model/history.rb +36 -0
- data/examples/app/chat/model/message.rb +7 -0
- data/examples/app/chat/public/css/chat.css +13 -0
- data/examples/app/chat/public/js/chat.js +22 -0
- data/examples/app/chat/public/js/jquery.js +3436 -0
- data/examples/app/chat/start.rb +40 -0
- data/examples/app/chat/view/chat.xhtml +9 -0
- data/examples/app/chat/view/index.xhtml +7 -0
- data/examples/app/chat/view/layout.xhtml +13 -0
- data/examples/app/localization/start.rb +35 -0
- data/examples/{rammit → app/rammit}/spec/rammit.rb +2 -1
- data/examples/{rammit → app/rammit}/src/controller/main.rb +0 -0
- data/examples/{rammit → app/rammit}/src/controller/page.rb +0 -0
- data/examples/{rammit → app/rammit}/src/model.rb +0 -0
- data/examples/{rammit → app/rammit}/start.rb +0 -0
- data/examples/{rammit → app/rammit}/template/index.xhtml +0 -0
- data/examples/{rammit → app/rammit}/template/page/view.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/Rakefile +0 -1
- data/examples/{rapaste → app/rapaste}/controller/paste.rb +3 -3
- data/examples/{rapaste → app/rapaste}/model/paste.rb +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/active4d.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/all_hallows_eve.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/amy.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/blackboard.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/brilliance_black.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/brilliance_dull.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/cobalt.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/dawn.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/display.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/eiffel.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/espresso_libre.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/idle.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/iplastic.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/lazy.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/mac_classic.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/magicwb_amiga.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/pastels_on_dark.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/slush_poppies.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/spacecadet.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/sunburst.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/twilight.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/zenburnesque.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/js/jquery.js +0 -0
- data/examples/{rapaste → app/rapaste}/spec/rapaste.rb +2 -2
- data/examples/{rapaste → app/rapaste}/start.rb +0 -0
- data/examples/{rapaste → app/rapaste}/view/copy.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/index.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/layout.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/list.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/search.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/view.xhtml +0 -0
- data/examples/{sourceview → app/sourceview}/public/coderay.css +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/file.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/folder.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-collapsable-last.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-collapsable.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-expandable-last.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-expandable.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-item-last.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-item.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/jquery.js +0 -0
- data/examples/{sourceview → app/sourceview}/public/jquery.treeview.css +0 -0
- data/examples/{sourceview → app/sourceview}/public/jquery.treeview.js +0 -0
- data/examples/{sourceview → app/sourceview}/public/sourceview.js +0 -0
- data/examples/{sourceview → app/sourceview}/sourceview.rb +1 -1
- data/examples/{sourceview → app/sourceview}/template/index.haml +0 -0
- data/examples/{todolist → app/todolist}/README +0 -0
- data/examples/{todolist → app/todolist}/public/favicon.ico +0 -0
- data/examples/{todolist → app/todolist}/public/js/jquery.js +0 -0
- data/examples/{todolist → app/todolist}/public/ramaze.png +0 -0
- data/examples/{todolist → app/todolist}/spec/todolist.rb +2 -2
- data/examples/{todolist → app/todolist}/src/controller/main.rb +0 -0
- data/examples/{todolist → app/todolist}/src/element/page.rb +0 -0
- data/examples/{todolist → app/todolist}/src/model.rb +0 -0
- data/examples/{todolist → app/todolist}/start.rb +0 -0
- data/examples/{todolist → app/todolist}/template/index.xhtml +0 -0
- data/examples/{todolist → app/todolist}/template/new.xhtml +0 -0
- data/examples/{upload → app/upload}/start.rb +0 -0
- data/examples/{upload → app/upload}/view/index.xhtml +0 -0
- data/examples/{whywiki → app/whywiki}/spec/whywiki.rb +3 -3
- data/examples/{whywiki → app/whywiki}/start.rb +0 -0
- data/examples/{whywiki → app/whywiki}/template/edit.xhtml +0 -0
- data/examples/{whywiki → app/whywiki}/template/show.xhtml +0 -0
- data/examples/{wikore → app/wikore}/spec/wikore.rb +2 -2
- data/examples/{wikore → app/wikore}/src/controller.rb +0 -0
- data/examples/{wikore → app/wikore}/src/model.rb +0 -0
- data/examples/{wikore → app/wikore}/start.rb +0 -0
- data/examples/{wikore → app/wikore}/template/index.xhtml +0 -0
- data/examples/{wiktacular → app/wiktacular}/README +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/link/2007-07-20_19-45-51.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/link/current.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_16-31-33.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_19-21-12.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_19-23-10.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_19-45-07.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/current.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/markdown/current.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-20_16-43-46.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-20_19-43-50.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-46-01.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-46-32.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-47-08.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-47-54.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/current.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/public/favicon.ico +0 -0
- data/examples/{wiktacular → app/wiktacular}/public/screen.css +0 -0
- data/examples/{wiktacular → app/wiktacular}/spec/wiktacular.rb +4 -5
- data/examples/{wiktacular → app/wiktacular}/src/controller.rb +0 -0
- data/examples/{wiktacular → app/wiktacular}/src/model.rb +0 -0
- data/examples/{wiktacular → app/wiktacular}/start.rb +0 -0
- data/examples/{wiktacular → app/wiktacular}/template/edit.xhtml +0 -0
- data/examples/{wiktacular → app/wiktacular}/template/html_layout.xhtml +0 -0
- data/examples/{wiktacular → app/wiktacular}/template/index.xhtml +0 -0
- data/examples/{wiktacular → app/wiktacular}/template/new.xhtml +0 -0
- data/examples/{element.rb → basic/element.rb} +0 -0
- data/examples/basic/gestalt.rb +27 -0
- data/examples/{hello.rb → basic/hello.rb} +0 -0
- data/examples/{layout.rb → basic/layout.rb} +0 -0
- data/examples/{linking.rb → basic/linking.rb} +0 -0
- data/examples/{simple.rb → basic/simple.rb} +3 -3
- data/examples/{caching.rb → helpers/cache.rb} +0 -0
- data/examples/helpers/form_with_sequel.rb +24 -0
- data/examples/helpers/httpdigest.rb +50 -0
- data/examples/{identity.rb → helpers/identity.rb} +0 -0
- data/examples/{nitro_form.rb → helpers/nitro_form.rb} +0 -0
- data/examples/helpers/provide.rb +23 -0
- data/examples/helpers/rest.rb +28 -0
- data/examples/helpers/simple_captcha.rb +29 -0
- data/examples/{css.rb → misc/css.rb} +0 -0
- data/examples/{facebook.rb → misc/facebook.rb} +0 -0
- data/examples/{memleak_detector.rb → misc/memleak_detector.rb} +0 -0
- data/examples/misc/nagoro_element.rb +43 -0
- data/examples/{ramaise.rb → misc/ramaise.rb} +0 -0
- data/examples/misc/rapp.rb +45 -0
- data/examples/misc/sequel_scaffolding.rb +34 -0
- data/examples/{simple_auth.rb → misc/simple_auth.rb} +0 -0
- data/examples/templates/template_amrita2.rb +1 -1
- data/examples/templates/template_erubis.rb +2 -2
- data/examples/templates/template_ezamar.rb +1 -1
- data/examples/templates/template_haml.rb +2 -2
- data/examples/templates/template_liquid.rb +2 -2
- data/examples/templates/template_markaby.rb +1 -1
- data/examples/templates/template_nagoro.rb +1 -1
- data/examples/templates/template_redcloth.rb +2 -2
- data/examples/templates/template_remarkably.rb +1 -1
- data/examples/templates/template_tenjin.rb +5 -9
- data/examples/templates/template_xslt.rb +1 -1
- data/lib/proto/public/dispatch.fcgi +0 -0
- data/lib/proto/public/js/jquery.js +750 -577
- data/lib/proto/spec/main.rb +1 -1
- data/lib/proto/start.ru +8 -0
- data/lib/proto/view/page.xhtml +13 -1
- data/lib/ramaze.rb +32 -15
- data/lib/ramaze/action.rb +18 -1
- data/lib/ramaze/action/render.rb +45 -17
- data/lib/ramaze/adapter.rb +8 -7
- data/lib/ramaze/adapter/base.rb +79 -13
- data/lib/ramaze/adapter/cgi.rb +5 -10
- data/lib/ramaze/adapter/ebb.rb +6 -20
- data/lib/ramaze/adapter/fake.rb +12 -0
- data/lib/ramaze/adapter/fcgi.rb +5 -11
- data/lib/ramaze/adapter/lsws.rb +5 -9
- data/lib/ramaze/adapter/mongrel.rb +5 -9
- data/lib/ramaze/adapter/scgi.rb +4 -8
- data/lib/ramaze/adapter/thin.rb +6 -11
- data/lib/ramaze/adapter/webrick.rb +13 -22
- data/lib/ramaze/cache.rb +36 -10
- data/lib/ramaze/cache/memcached.rb +3 -2
- data/lib/ramaze/contrib.rb +1 -1
- data/lib/ramaze/contrib/email.rb +1 -1
- data/lib/ramaze/contrib/file_cache.rb +1 -1
- data/lib/ramaze/contrib/gems.rb +79 -0
- data/lib/ramaze/contrib/gettext/po.rb +0 -0
- data/lib/ramaze/contrib/profiling.rb +1 -1
- data/lib/ramaze/contrib/rest.rb +14 -0
- data/lib/ramaze/controller.rb +45 -12
- data/lib/ramaze/controller/error.rb +4 -4
- data/lib/ramaze/controller/resolve.rb +61 -42
- data/lib/ramaze/current.rb +2 -2
- data/lib/ramaze/current/request.rb +25 -2
- data/lib/ramaze/current/response.rb +8 -0
- data/lib/ramaze/current/session.rb +64 -36
- data/lib/ramaze/current/session/flash.rb +14 -2
- data/lib/ramaze/current/session/hash.rb +3 -2
- data/lib/ramaze/dispatcher.rb +25 -12
- data/lib/ramaze/dispatcher/action.rb +12 -3
- data/lib/ramaze/dispatcher/directory.rb +4 -1
- data/lib/ramaze/dispatcher/error.rb +3 -3
- data/lib/ramaze/dispatcher/file.rb +11 -3
- data/lib/ramaze/gestalt.rb +1 -1
- data/lib/ramaze/helper.rb +17 -21
- data/lib/ramaze/helper/aspect.rb +20 -14
- data/lib/ramaze/helper/auth.rb +1 -1
- data/lib/ramaze/helper/cache.rb +3 -6
- data/lib/ramaze/helper/cgi.rb +6 -2
- data/lib/ramaze/helper/flash.rb +7 -7
- data/lib/ramaze/helper/form.rb +281 -0
- data/lib/ramaze/helper/formatting.rb +76 -0
- data/lib/ramaze/helper/gestalt.rb +15 -0
- data/lib/ramaze/helper/gravatar.rb +15 -0
- data/lib/ramaze/helper/httpdigest.rb +48 -0
- data/lib/ramaze/helper/identity.rb +87 -62
- data/lib/ramaze/helper/partial.rb +11 -2
- data/lib/ramaze/helper/redirect.rb +12 -3
- data/lib/ramaze/helper/rest.rb +43 -0
- data/lib/ramaze/helper/sendfile.rb +1 -3
- data/lib/ramaze/helper/sequel.rb +3 -0
- data/lib/ramaze/helper/simple_captcha.rb +31 -0
- data/lib/ramaze/helper/stack.rb +14 -5
- data/lib/ramaze/helper/user.rb +86 -34
- data/lib/ramaze/helper/xhtml.rb +23 -0
- data/lib/ramaze/log.rb +1 -2
- data/lib/ramaze/log/analogger.rb +24 -19
- data/lib/ramaze/log/growl.rb +24 -19
- data/lib/ramaze/log/hub.rb +25 -22
- data/lib/ramaze/log/informer.rb +104 -99
- data/lib/ramaze/log/knotify.rb +17 -12
- data/lib/ramaze/log/logger.rb +14 -8
- data/lib/ramaze/log/logging.rb +63 -60
- data/lib/ramaze/log/syslog.rb +24 -19
- data/lib/ramaze/log/xosd.rb +77 -71
- data/lib/ramaze/option.rb +153 -0
- data/lib/ramaze/option/dsl.rb +45 -0
- data/lib/ramaze/option/holder.rb +153 -0
- data/lib/ramaze/option/merger.rb +108 -0
- data/lib/ramaze/route.rb +15 -2
- data/lib/ramaze/setup.rb +50 -0
- data/lib/ramaze/snippets/binding/locals.rb +1 -1
- data/lib/ramaze/snippets/dictionary.rb +3 -3
- data/lib/ramaze/snippets/divide.rb +7 -7
- data/lib/ramaze/snippets/kernel/__dir__.rb +1 -1
- data/lib/ramaze/snippets/kernel/acquire.rb +0 -5
- data/lib/ramaze/snippets/metaid.rb +1 -1
- data/lib/ramaze/snippets/numeric/filesize_format.rb +11 -5
- data/lib/ramaze/snippets/object/instance_variable_defined.rb +8 -0
- data/lib/ramaze/snippets/object/scope.rb +1 -1
- data/lib/ramaze/snippets/object/thread_accessor.rb +1 -1
- data/lib/ramaze/snippets/ordered_set.rb +5 -1
- data/lib/ramaze/snippets/ramaze/deprecated.rb +7 -0
- data/lib/ramaze/snippets/ramaze/thread_accessor.rb +15 -1
- data/lib/ramaze/snippets/string/esc.rb +2 -2
- data/lib/ramaze/snippets/string/start_with.rb +1 -0
- data/lib/ramaze/snippets/string/unindent.rb +9 -1
- data/lib/ramaze/snippets/struct/values_at.rb +17 -1
- data/lib/ramaze/snippets/thread/into.rb +1 -1
- data/lib/ramaze/sourcereload.rb +83 -76
- data/lib/ramaze/spec/helper.rb +39 -26
- data/lib/ramaze/spec/helper/bacon.rb +5 -5
- data/lib/ramaze/spec/helper/mock_http.rb +1 -7
- data/lib/ramaze/spec/helper/pretty_output.rb +10 -2
- data/lib/ramaze/spec/helper/requester.rb +14 -0
- data/lib/ramaze/template.rb +6 -3
- data/lib/ramaze/template/amrita2.rb +1 -0
- data/lib/ramaze/template/erubis.rb +7 -1
- data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
- data/lib/ramaze/template/nagoro.rb +1 -0
- data/lib/ramaze/template/redcloth.rb +1 -0
- data/lib/ramaze/template/tagz.rb +8 -8
- data/lib/ramaze/template/tenjin.rb +42 -2
- data/lib/ramaze/template/xslt.rb +4 -0
- data/lib/ramaze/tool/daemonize.rb +37 -0
- data/lib/ramaze/tool/localize.rb +142 -106
- data/lib/ramaze/version.rb +2 -10
- data/rake_tasks/conf.rake +11 -13
- data/rake_tasks/gem.rake +59 -37
- data/rake_tasks/git.rake +41 -0
- data/rake_tasks/maintenance.rake +263 -299
- data/rake_tasks/release.rake +63 -0
- data/rake_tasks/spec.rake +1 -1
- data/ramaze.gemspec +731 -0
- data/spec/contrib/profiling.rb +5 -2
- data/spec/examples/caching.rb +1 -1
- data/spec/examples/css.rb +1 -1
- data/spec/examples/element.rb +1 -1
- data/spec/examples/hello.rb +1 -1
- data/spec/examples/linking.rb +1 -1
- data/spec/examples/simple.rb +1 -1
- data/spec/examples/simple_auth.rb +1 -1
- data/spec/ramaze/action/cache.rb +58 -14
- data/spec/ramaze/action/file_cache.rb +48 -0
- data/spec/ramaze/action/layout.rb +2 -2
- data/spec/ramaze/action/render.rb +1 -2
- data/spec/ramaze/action/{template → view}/bar.xhtml +0 -0
- data/spec/ramaze/action/{template → view}/instancevars/layout.xhtml +0 -0
- data/spec/ramaze/action/{template → view}/other_wrapper.xhtml +0 -0
- data/spec/ramaze/action/{template → view}/single_wrapper.xhtml +0 -0
- data/spec/ramaze/action/{template → view}/sub/sub_wrapper.xhtml +0 -0
- data/spec/ramaze/adapter.rb +29 -2
- data/spec/ramaze/adapter/ebb.rb +12 -0
- data/spec/ramaze/cache.rb +82 -15
- data/spec/ramaze/controller.rb +6 -3
- data/spec/ramaze/controller/actionless_templates.rb +2 -2
- data/spec/ramaze/controller/resolve.rb +1 -1
- data/spec/ramaze/controller/template_resolving.rb +4 -6
- data/spec/ramaze/controller/{template → view}/greet.xhtml +0 -0
- data/spec/ramaze/controller/{template → view}/list.xhtml +0 -0
- data/spec/ramaze/controller/{template → view}/other/greet/other.xhtml +0 -0
- data/spec/ramaze/controller/{template → view}/other_wrapper.xhtml +0 -0
- data/spec/ramaze/error.rb +1 -1
- data/spec/ramaze/helper/aspect.rb +4 -4
- data/spec/ramaze/helper/cache.rb +56 -39
- data/spec/ramaze/helper/flash.rb +14 -1
- data/spec/ramaze/helper/form.rb +118 -0
- data/spec/ramaze/helper/formatting.rb +21 -0
- data/spec/ramaze/helper/link.rb +2 -2
- data/spec/ramaze/helper/pager.rb +2 -2
- data/spec/ramaze/helper/partial.rb +13 -1
- data/spec/ramaze/helper/simple_captcha.rb +22 -0
- data/spec/ramaze/helper/user.rb +7 -10
- data/spec/ramaze/helper/{template → view}/locals.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/loop.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/num.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/partial.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/recursive.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/recursive_local_ivars.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/recursive_locals.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/test_template.xhtml +0 -0
- data/spec/ramaze/localize.rb +22 -0
- data/spec/ramaze/log/informer.rb +10 -10
- data/spec/ramaze/log/syslog.rb +1 -1
- data/spec/ramaze/request.rb +13 -1
- data/spec/ramaze/request/ebb.rb +9 -0
- data/spec/ramaze/rewrite.rb +36 -0
- data/spec/ramaze/rewrite/file.css +1 -0
- data/spec/ramaze/route.rb +1 -0
- data/spec/ramaze/template.rb +5 -5
- data/spec/ramaze/template/amrita2.rb +1 -1
- data/spec/ramaze/template/builder.rb +18 -22
- data/spec/ramaze/template/erubis.rb +1 -1
- data/spec/ramaze/template/ezamar.rb +1 -1
- data/spec/ramaze/template/haml.rb +2 -2
- data/spec/ramaze/template/liquid.rb +1 -1
- data/spec/ramaze/template/markaby.rb +1 -1
- data/spec/ramaze/template/nagoro.rb +1 -1
- data/spec/ramaze/template/redcloth.rb +1 -1
- data/spec/ramaze/template/remarkably.rb +1 -1
- data/spec/ramaze/template/sass.rb +1 -1
- data/spec/ramaze/template/tagz.rb +1 -1
- data/spec/ramaze/template/tenjin.rb +4 -6
- data/spec/ramaze/template/xslt.rb +1 -1
- data/spec/snippets/string/unindent.rb +6 -0
- data/spec/snippets/struct/values_at.rb +8 -0
- metadata +522 -487
- data/doc/ProjectInfo +0 -53
- data/doc/migrate/1110_to_1111.txt +0 -131
- data/lib/ramaze/contrib/route.rb +0 -22
- data/lib/ramaze/global.rb +0 -116
- data/lib/ramaze/global/dsl.rb +0 -39
- data/lib/ramaze/global/globalstruct.rb +0 -147
- data/lib/ramaze/helper/inform.rb +0 -40
- data/lib/ramaze/inform.rb +0 -4
- data/lib/ramaze/snippets/kernel/aquire.rb +0 -1
- data/lib/vendor/bacon.rb +0 -323
- data/rake_tasks/darcs.rake +0 -5
- data/spec/contrib/route.rb +0 -36
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'ramaze'
|
3
3
|
|
4
4
|
class MainController < Ramaze::Controller
|
5
|
-
|
5
|
+
view_root __DIR__/:template
|
6
6
|
engine :RedCloth
|
7
7
|
layout :layout
|
8
8
|
|
@@ -56,4 +56,4 @@ __HTML__
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
Ramaze.start
|
59
|
+
Ramaze.start
|
@@ -2,7 +2,7 @@ require "rubygems"
|
|
2
2
|
require "ramaze"
|
3
3
|
|
4
4
|
class MainController < Ramaze::Controller
|
5
|
-
|
5
|
+
view_root __DIR__/:template
|
6
6
|
engine :Tenjin
|
7
7
|
|
8
8
|
def index
|
@@ -10,10 +10,8 @@ class MainController < Ramaze::Controller
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def internal(*args)
|
13
|
-
@
|
14
|
-
|
15
|
-
:place => :internal
|
16
|
-
}
|
13
|
+
@args = args
|
14
|
+
@place = :internal
|
17
15
|
<<'__TENJIN__'
|
18
16
|
<html>
|
19
17
|
<head>
|
@@ -47,10 +45,8 @@ __TENJIN__
|
|
47
45
|
end
|
48
46
|
|
49
47
|
def external(*args)
|
50
|
-
@
|
51
|
-
|
52
|
-
:place => :external
|
53
|
-
}
|
48
|
+
@args = args
|
49
|
+
@place = :external
|
54
50
|
end
|
55
51
|
end
|
56
52
|
|
File without changes
|
@@ -1,37 +1,34 @@
|
|
1
1
|
(function(){
|
2
2
|
/*
|
3
|
-
* jQuery 1.2.
|
3
|
+
* jQuery 1.2.6 - New Wave Javascript
|
4
4
|
*
|
5
|
-
* Copyright (c)
|
5
|
+
* Copyright (c) 2008 John Resig (jquery.com)
|
6
6
|
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
7
7
|
* and GPL (GPL-LICENSE.txt) licenses.
|
8
8
|
*
|
9
|
-
* $Date: 2008-
|
10
|
-
* $Rev:
|
9
|
+
* $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
|
10
|
+
* $Rev: 5685 $
|
11
11
|
*/
|
12
12
|
|
13
13
|
// Map over jQuery in case of overwrite
|
14
|
-
|
15
|
-
|
14
|
+
var _jQuery = window.jQuery,
|
15
|
+
// Map over the $ in case of overwrite
|
16
|
+
_$ = window.$;
|
16
17
|
|
17
|
-
var jQuery = window.jQuery = function( selector, context ) {
|
18
|
+
var jQuery = window.jQuery = window.$ = function( selector, context ) {
|
18
19
|
// The jQuery object is actually just the init constructor 'enhanced'
|
19
|
-
return new jQuery.
|
20
|
+
return new jQuery.fn.init( selector, context );
|
20
21
|
};
|
21
22
|
|
22
|
-
// Map over the $ in case of overwrite
|
23
|
-
if ( window.$ )
|
24
|
-
var _$ = window.$;
|
25
|
-
|
26
|
-
// Map the jQuery namespace to the '$' one
|
27
|
-
window.$ = jQuery;
|
28
|
-
|
29
23
|
// A simple way to check for HTML strings or ID strings
|
30
24
|
// (both of which we optimize for)
|
31
|
-
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)
|
25
|
+
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
|
32
26
|
|
33
27
|
// Is it a simple selector
|
34
|
-
|
28
|
+
isSimple = /^.[^:#\[\.]*$/,
|
29
|
+
|
30
|
+
// Will speed up references to undefined, and allows munging its name.
|
31
|
+
undefined;
|
35
32
|
|
36
33
|
jQuery.fn = jQuery.prototype = {
|
37
34
|
init: function( selector, context ) {
|
@@ -43,9 +40,9 @@ jQuery.fn = jQuery.prototype = {
|
|
43
40
|
this[0] = selector;
|
44
41
|
this.length = 1;
|
45
42
|
return this;
|
46
|
-
|
43
|
+
}
|
47
44
|
// Handle HTML strings
|
48
|
-
|
45
|
+
if ( typeof selector == "string" ) {
|
49
46
|
// Are we dealing with HTML string or an ID?
|
50
47
|
var match = quickExpr.exec( selector );
|
51
48
|
|
@@ -61,53 +58,39 @@ jQuery.fn = jQuery.prototype = {
|
|
61
58
|
var elem = document.getElementById( match[3] );
|
62
59
|
|
63
60
|
// Make sure an element was located
|
64
|
-
if ( elem )
|
61
|
+
if ( elem ){
|
65
62
|
// Handle the case where IE and Opera return items
|
66
63
|
// by name instead of ID
|
67
64
|
if ( elem.id != match[3] )
|
68
65
|
return jQuery().find( selector );
|
69
66
|
|
70
67
|
// Otherwise, we inject the element directly into the jQuery object
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
return this;
|
75
|
-
}
|
76
|
-
|
77
|
-
else
|
78
|
-
selector = [];
|
68
|
+
return jQuery( elem );
|
69
|
+
}
|
70
|
+
selector = [];
|
79
71
|
}
|
80
72
|
|
81
73
|
// HANDLE: $(expr, [context])
|
82
74
|
// (which is just equivalent to: $(content).find(expr)
|
83
75
|
} else
|
84
|
-
return
|
76
|
+
return jQuery( context ).find( selector );
|
85
77
|
|
86
78
|
// HANDLE: $(function)
|
87
79
|
// Shortcut for document ready
|
88
80
|
} else if ( jQuery.isFunction( selector ) )
|
89
|
-
return
|
90
|
-
|
91
|
-
return this.setArray(
|
92
|
-
// HANDLE: $(array)
|
93
|
-
selector.constructor == Array && selector ||
|
94
|
-
|
95
|
-
// HANDLE: $(arraylike)
|
96
|
-
// Watch for when an array-like object, contains DOM nodes, is passed in as the selector
|
97
|
-
(selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
|
81
|
+
return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
|
98
82
|
|
99
|
-
|
100
|
-
[ selector ] );
|
83
|
+
return this.setArray(jQuery.makeArray(selector));
|
101
84
|
},
|
102
|
-
|
85
|
+
|
103
86
|
// The current version of jQuery being used
|
104
|
-
jquery: "1.2.
|
87
|
+
jquery: "1.2.6",
|
105
88
|
|
106
89
|
// The number of elements contained in the matched element set
|
107
90
|
size: function() {
|
108
91
|
return this.length;
|
109
92
|
},
|
110
|
-
|
93
|
+
|
111
94
|
// The number of elements contained in the matched element set
|
112
95
|
length: 0,
|
113
96
|
|
@@ -122,7 +105,7 @@ jQuery.fn = jQuery.prototype = {
|
|
122
105
|
// Return just the object
|
123
106
|
this[ num ];
|
124
107
|
},
|
125
|
-
|
108
|
+
|
126
109
|
// Take an array of elements and push it onto the stack
|
127
110
|
// (returning the new matched element set)
|
128
111
|
pushStack: function( elems ) {
|
@@ -135,7 +118,7 @@ jQuery.fn = jQuery.prototype = {
|
|
135
118
|
// Return the newly-formed element set
|
136
119
|
return ret;
|
137
120
|
},
|
138
|
-
|
121
|
+
|
139
122
|
// Force the current matched set of elements to become
|
140
123
|
// the specified array of elements (destroying the stack in the process)
|
141
124
|
// You should use pushStack() in order to do this, but maintain the stack
|
@@ -144,7 +127,7 @@ jQuery.fn = jQuery.prototype = {
|
|
144
127
|
// is a super-fast way to populate an object with array-like properties
|
145
128
|
this.length = 0;
|
146
129
|
Array.prototype.push.apply( this, elems );
|
147
|
-
|
130
|
+
|
148
131
|
return this;
|
149
132
|
},
|
150
133
|
|
@@ -155,33 +138,31 @@ jQuery.fn = jQuery.prototype = {
|
|
155
138
|
return jQuery.each( this, callback, args );
|
156
139
|
},
|
157
140
|
|
158
|
-
// Determine the position of an element within
|
141
|
+
// Determine the position of an element within
|
159
142
|
// the matched set of elements
|
160
143
|
index: function( elem ) {
|
161
144
|
var ret = -1;
|
162
145
|
|
163
146
|
// Locate the position of the desired element
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
return ret;
|
147
|
+
return jQuery.inArray(
|
148
|
+
// If it receives a jQuery object, the first element is used
|
149
|
+
elem && elem.jquery ? elem[0] : elem
|
150
|
+
, this );
|
170
151
|
},
|
171
152
|
|
172
153
|
attr: function( name, value, type ) {
|
173
154
|
var options = name;
|
174
|
-
|
155
|
+
|
175
156
|
// Look for the case where we're accessing a style value
|
176
157
|
if ( name.constructor == String )
|
177
|
-
if ( value
|
178
|
-
return this
|
158
|
+
if ( value === undefined )
|
159
|
+
return this[0] && jQuery[ type || "attr" ]( this[0], name );
|
179
160
|
|
180
161
|
else {
|
181
162
|
options = {};
|
182
163
|
options[ name ] = value;
|
183
164
|
}
|
184
|
-
|
165
|
+
|
185
166
|
// Check to see if we're setting style values
|
186
167
|
return this.each(function(i){
|
187
168
|
// Set all the styles
|
@@ -264,7 +245,7 @@ jQuery.fn = jQuery.prototype = {
|
|
264
245
|
this.insertBefore( elem, this.firstChild );
|
265
246
|
});
|
266
247
|
},
|
267
|
-
|
248
|
+
|
268
249
|
before: function() {
|
269
250
|
return this.domManip(arguments, false, false, function(elem){
|
270
251
|
this.parentNode.insertBefore( elem, this );
|
@@ -299,8 +280,8 @@ jQuery.fn = jQuery.prototype = {
|
|
299
280
|
// using cloneNode. Calling detachEvent on the
|
300
281
|
// clone will also remove the events from the orignal
|
301
282
|
// In order to get around this, we use innerHTML.
|
302
|
-
// Unfortunately, this means some modifications to
|
303
|
-
// attributes in IE that are actually only stored
|
283
|
+
// Unfortunately, this means some modifications to
|
284
|
+
// attributes in IE that are actually only stored
|
304
285
|
// as properties will not be copied (such as the
|
305
286
|
// the name attribute on an input).
|
306
287
|
var clone = this.cloneNode(true),
|
@@ -318,7 +299,7 @@ jQuery.fn = jQuery.prototype = {
|
|
318
299
|
if ( this[ expando ] != undefined )
|
319
300
|
this[ expando ] = null;
|
320
301
|
});
|
321
|
-
|
302
|
+
|
322
303
|
// Copy the events from the original to the clone
|
323
304
|
if ( events === true )
|
324
305
|
this.find("*").andSelf().each(function(i){
|
@@ -360,24 +341,22 @@ jQuery.fn = jQuery.prototype = {
|
|
360
341
|
},
|
361
342
|
|
362
343
|
add: function( selector ) {
|
363
|
-
return
|
344
|
+
return this.pushStack( jQuery.unique( jQuery.merge(
|
364
345
|
this.get(),
|
365
|
-
selector
|
366
|
-
jQuery( selector )
|
367
|
-
|
368
|
-
|
346
|
+
typeof selector == 'string' ?
|
347
|
+
jQuery( selector ) :
|
348
|
+
jQuery.makeArray( selector )
|
349
|
+
)));
|
369
350
|
},
|
370
351
|
|
371
352
|
is: function( selector ) {
|
372
|
-
return selector
|
373
|
-
jQuery.multiFilter( selector, this ).length > 0 :
|
374
|
-
false;
|
353
|
+
return !!selector && jQuery.multiFilter( selector, this ).length > 0;
|
375
354
|
},
|
376
355
|
|
377
356
|
hasClass: function( selector ) {
|
378
357
|
return this.is( "." + selector );
|
379
358
|
},
|
380
|
-
|
359
|
+
|
381
360
|
val: function( value ) {
|
382
361
|
if ( value == undefined ) {
|
383
362
|
|
@@ -390,7 +369,7 @@ jQuery.fn = jQuery.prototype = {
|
|
390
369
|
values = [],
|
391
370
|
options = elem.options,
|
392
371
|
one = elem.type == "select-one";
|
393
|
-
|
372
|
+
|
394
373
|
// Nothing was selected
|
395
374
|
if ( index < 0 )
|
396
375
|
return null;
|
@@ -402,18 +381,18 @@ jQuery.fn = jQuery.prototype = {
|
|
402
381
|
if ( option.selected ) {
|
403
382
|
// Get the specifc value for the option
|
404
383
|
value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
|
405
|
-
|
384
|
+
|
406
385
|
// We don't need an array for one selects
|
407
386
|
if ( one )
|
408
387
|
return value;
|
409
|
-
|
388
|
+
|
410
389
|
// Multi-Selects return an array
|
411
390
|
values.push( value );
|
412
391
|
}
|
413
392
|
}
|
414
|
-
|
393
|
+
|
415
394
|
return values;
|
416
|
-
|
395
|
+
|
417
396
|
// Everything else, we just grab the value
|
418
397
|
} else
|
419
398
|
return (this[0].value || "").replace(/\r/g, "");
|
@@ -423,6 +402,9 @@ jQuery.fn = jQuery.prototype = {
|
|
423
402
|
return undefined;
|
424
403
|
}
|
425
404
|
|
405
|
+
if( value.constructor == Number )
|
406
|
+
value += '';
|
407
|
+
|
426
408
|
return this.each(function(){
|
427
409
|
if ( this.nodeType != 1 )
|
428
410
|
return;
|
@@ -432,9 +414,7 @@ jQuery.fn = jQuery.prototype = {
|
|
432
414
|
jQuery.inArray(this.name, value) >= 0);
|
433
415
|
|
434
416
|
else if ( jQuery.nodeName( this, "select" ) ) {
|
435
|
-
var values = value
|
436
|
-
value :
|
437
|
-
[ value ];
|
417
|
+
var values = jQuery.makeArray(value);
|
438
418
|
|
439
419
|
jQuery( "option", this ).each(function(){
|
440
420
|
this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
|
@@ -448,10 +428,10 @@ jQuery.fn = jQuery.prototype = {
|
|
448
428
|
this.value = value;
|
449
429
|
});
|
450
430
|
},
|
451
|
-
|
431
|
+
|
452
432
|
html: function( value ) {
|
453
433
|
return value == undefined ?
|
454
|
-
(this
|
434
|
+
(this[0] ?
|
455
435
|
this[0].innerHTML :
|
456
436
|
null) :
|
457
437
|
this.empty().append( value );
|
@@ -478,9 +458,34 @@ jQuery.fn = jQuery.prototype = {
|
|
478
458
|
andSelf: function() {
|
479
459
|
return this.add( this.prevObject );
|
480
460
|
},
|
481
|
-
|
461
|
+
|
462
|
+
data: function( key, value ){
|
463
|
+
var parts = key.split(".");
|
464
|
+
parts[1] = parts[1] ? "." + parts[1] : "";
|
465
|
+
|
466
|
+
if ( value === undefined ) {
|
467
|
+
var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
|
468
|
+
|
469
|
+
if ( data === undefined && this.length )
|
470
|
+
data = jQuery.data( this[0], key );
|
471
|
+
|
472
|
+
return data === undefined && parts[1] ?
|
473
|
+
this.data( parts[0] ) :
|
474
|
+
data;
|
475
|
+
} else
|
476
|
+
return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
|
477
|
+
jQuery.data( this, key, value );
|
478
|
+
});
|
479
|
+
},
|
480
|
+
|
481
|
+
removeData: function( key ){
|
482
|
+
return this.each(function(){
|
483
|
+
jQuery.removeData( this, key );
|
484
|
+
});
|
485
|
+
},
|
486
|
+
|
482
487
|
domManip: function( args, table, reverse, callback ) {
|
483
|
-
var clone = this.length > 1, elems;
|
488
|
+
var clone = this.length > 1, elems;
|
484
489
|
|
485
490
|
return this.each(function(){
|
486
491
|
if ( !elems ) {
|
@@ -503,9 +508,9 @@ jQuery.fn = jQuery.prototype = {
|
|
503
508
|
this;
|
504
509
|
|
505
510
|
// execute all scripts after the elements have been injected
|
506
|
-
if ( jQuery.nodeName( elem, "script" ) )
|
511
|
+
if ( jQuery.nodeName( elem, "script" ) )
|
507
512
|
scripts = scripts.add( elem );
|
508
|
-
|
513
|
+
else {
|
509
514
|
// Remove any inner scripts for later evaluation
|
510
515
|
if ( elem.nodeType == 1 )
|
511
516
|
scripts = scripts.add( jQuery( "script", elem ).remove() );
|
@@ -521,7 +526,7 @@ jQuery.fn = jQuery.prototype = {
|
|
521
526
|
};
|
522
527
|
|
523
528
|
// Give the init function the jQuery prototype for later instantiation
|
524
|
-
jQuery.
|
529
|
+
jQuery.fn.init.prototype = jQuery.fn;
|
525
530
|
|
526
531
|
function evalScript( i, elem ) {
|
527
532
|
if ( elem.src )
|
@@ -538,6 +543,10 @@ function evalScript( i, elem ) {
|
|
538
543
|
elem.parentNode.removeChild( elem );
|
539
544
|
}
|
540
545
|
|
546
|
+
function now(){
|
547
|
+
return +new Date;
|
548
|
+
}
|
549
|
+
|
541
550
|
jQuery.extend = jQuery.fn.extend = function() {
|
542
551
|
// copy reference to target object
|
543
552
|
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
|
@@ -555,9 +564,9 @@ jQuery.extend = jQuery.fn.extend = function() {
|
|
555
564
|
target = {};
|
556
565
|
|
557
566
|
// extend jQuery itself if only one argument is passed
|
558
|
-
if ( length ==
|
567
|
+
if ( length == i ) {
|
559
568
|
target = this;
|
560
|
-
i
|
569
|
+
--i;
|
561
570
|
}
|
562
571
|
|
563
572
|
for ( ; i < length; i++ )
|
@@ -565,17 +574,22 @@ jQuery.extend = jQuery.fn.extend = function() {
|
|
565
574
|
if ( (options = arguments[ i ]) != null )
|
566
575
|
// Extend the base object
|
567
576
|
for ( var name in options ) {
|
577
|
+
var src = target[ name ], copy = options[ name ];
|
578
|
+
|
568
579
|
// Prevent never-ending loop
|
569
|
-
if ( target ===
|
580
|
+
if ( target === copy )
|
570
581
|
continue;
|
571
582
|
|
572
583
|
// Recurse if we're merging object values
|
573
|
-
if ( deep &&
|
574
|
-
target[ name ] = jQuery.extend(
|
584
|
+
if ( deep && copy && typeof copy == "object" && !copy.nodeType )
|
585
|
+
target[ name ] = jQuery.extend( deep,
|
586
|
+
// Never move original objects, clone them
|
587
|
+
src || ( copy.length != null ? [ ] : { } )
|
588
|
+
, copy );
|
575
589
|
|
576
590
|
// Don't bring in undefined values
|
577
|
-
else if (
|
578
|
-
target[ name ] =
|
591
|
+
else if ( copy !== undefined )
|
592
|
+
target[ name ] = copy;
|
579
593
|
|
580
594
|
}
|
581
595
|
|
@@ -583,10 +597,11 @@ jQuery.extend = jQuery.fn.extend = function() {
|
|
583
597
|
return target;
|
584
598
|
};
|
585
599
|
|
586
|
-
var expando = "jQuery" + (
|
587
|
-
|
588
|
-
|
589
|
-
|
600
|
+
var expando = "jQuery" + now(), uuid = 0, windowData = {},
|
601
|
+
// exclude the following css properties to add px
|
602
|
+
exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
|
603
|
+
// cache defaultView
|
604
|
+
defaultView = document.defaultView || {};
|
590
605
|
|
591
606
|
jQuery.extend({
|
592
607
|
noConflict: function( deep ) {
|
@@ -600,10 +615,10 @@ jQuery.extend({
|
|
600
615
|
|
601
616
|
// See test/unit/core.js for details concerning this function.
|
602
617
|
isFunction: function( fn ) {
|
603
|
-
return !!fn && typeof fn != "string" && !fn.nodeName &&
|
604
|
-
fn.constructor != Array &&
|
618
|
+
return !!fn && typeof fn != "string" && !fn.nodeName &&
|
619
|
+
fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
|
605
620
|
},
|
606
|
-
|
621
|
+
|
607
622
|
// check if an element is in a (or is an) XML document
|
608
623
|
isXMLDoc: function( elem ) {
|
609
624
|
return elem.documentElement && !elem.body ||
|
@@ -626,7 +641,9 @@ jQuery.extend({
|
|
626
641
|
else
|
627
642
|
script.appendChild( document.createTextNode( data ) );
|
628
643
|
|
629
|
-
|
644
|
+
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
645
|
+
// This arises when a base node is used (#2709).
|
646
|
+
head.insertBefore( script, head.firstChild );
|
630
647
|
head.removeChild( script );
|
631
648
|
}
|
632
649
|
},
|
@@ -634,9 +651,9 @@ jQuery.extend({
|
|
634
651
|
nodeName: function( elem, name ) {
|
635
652
|
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
|
636
653
|
},
|
637
|
-
|
654
|
+
|
638
655
|
cache: {},
|
639
|
-
|
656
|
+
|
640
657
|
data: function( elem, name, data ) {
|
641
658
|
elem = elem == window ?
|
642
659
|
windowData :
|
@@ -645,24 +662,24 @@ jQuery.extend({
|
|
645
662
|
var id = elem[ expando ];
|
646
663
|
|
647
664
|
// Compute a unique ID for the element
|
648
|
-
if ( !id )
|
665
|
+
if ( !id )
|
649
666
|
id = elem[ expando ] = ++uuid;
|
650
667
|
|
651
668
|
// Only generate the data cache if we're
|
652
669
|
// trying to access or manipulate it
|
653
670
|
if ( name && !jQuery.cache[ id ] )
|
654
671
|
jQuery.cache[ id ] = {};
|
655
|
-
|
672
|
+
|
656
673
|
// Prevent overriding the named cache with undefined values
|
657
|
-
if ( data
|
674
|
+
if ( data !== undefined )
|
658
675
|
jQuery.cache[ id ][ name ] = data;
|
659
|
-
|
660
|
-
// Return the named cache data, or the ID for the element
|
676
|
+
|
677
|
+
// Return the named cache data, or the ID for the element
|
661
678
|
return name ?
|
662
679
|
jQuery.cache[ id ][ name ] :
|
663
680
|
id;
|
664
681
|
},
|
665
|
-
|
682
|
+
|
666
683
|
removeData: function( elem, name ) {
|
667
684
|
elem = elem == window ?
|
668
685
|
windowData :
|
@@ -705,39 +722,41 @@ jQuery.extend({
|
|
705
722
|
|
706
723
|
// args is for internal usage only
|
707
724
|
each: function( object, callback, args ) {
|
725
|
+
var name, i = 0, length = object.length;
|
726
|
+
|
708
727
|
if ( args ) {
|
709
|
-
if (
|
710
|
-
for (
|
728
|
+
if ( length == undefined ) {
|
729
|
+
for ( name in object )
|
711
730
|
if ( callback.apply( object[ name ], args ) === false )
|
712
731
|
break;
|
713
732
|
} else
|
714
|
-
for (
|
715
|
-
if ( callback.apply( object[ i ], args ) === false )
|
733
|
+
for ( ; i < length; )
|
734
|
+
if ( callback.apply( object[ i++ ], args ) === false )
|
716
735
|
break;
|
717
736
|
|
718
737
|
// A special, fast, case for the most common use of each
|
719
738
|
} else {
|
720
|
-
if (
|
721
|
-
for (
|
739
|
+
if ( length == undefined ) {
|
740
|
+
for ( name in object )
|
722
741
|
if ( callback.call( object[ name ], name, object[ name ] ) === false )
|
723
742
|
break;
|
724
743
|
} else
|
725
|
-
for ( var
|
744
|
+
for ( var value = object[0];
|
726
745
|
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
|
727
746
|
}
|
728
747
|
|
729
748
|
return object;
|
730
749
|
},
|
731
|
-
|
750
|
+
|
732
751
|
prop: function( elem, value, type, i, name ) {
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
752
|
+
// Handle executable functions
|
753
|
+
if ( jQuery.isFunction( value ) )
|
754
|
+
value = value.call( elem, i );
|
755
|
+
|
756
|
+
// Handle passing in a number to a CSS property
|
757
|
+
return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
|
758
|
+
value + "px" :
|
759
|
+
value;
|
741
760
|
},
|
742
761
|
|
743
762
|
className: {
|
@@ -754,12 +773,12 @@ jQuery.extend({
|
|
754
773
|
if (elem.nodeType == 1)
|
755
774
|
elem.className = classNames != undefined ?
|
756
775
|
jQuery.grep(elem.className.split(/\s+/), function(className){
|
757
|
-
return !jQuery.className.has( classNames, className );
|
776
|
+
return !jQuery.className.has( classNames, className );
|
758
777
|
}).join(" ") :
|
759
778
|
"";
|
760
779
|
},
|
761
780
|
|
762
|
-
// internal only, use
|
781
|
+
// internal only, use hasClass("class")
|
763
782
|
has: function( elem, className ) {
|
764
783
|
return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
|
765
784
|
}
|
@@ -784,7 +803,7 @@ jQuery.extend({
|
|
784
803
|
css: function( elem, name, force ) {
|
785
804
|
if ( name == "width" || name == "height" ) {
|
786
805
|
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
|
787
|
-
|
806
|
+
|
788
807
|
function getWH() {
|
789
808
|
val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
|
790
809
|
var padding = 0, border = 0;
|
@@ -794,33 +813,34 @@ jQuery.extend({
|
|
794
813
|
});
|
795
814
|
val -= Math.round(padding + border);
|
796
815
|
}
|
797
|
-
|
816
|
+
|
798
817
|
if ( jQuery(elem).is(":visible") )
|
799
818
|
getWH();
|
800
819
|
else
|
801
820
|
jQuery.swap( elem, props, getWH );
|
802
|
-
|
821
|
+
|
803
822
|
return Math.max(0, val);
|
804
823
|
}
|
805
|
-
|
824
|
+
|
806
825
|
return jQuery.curCSS( elem, name, force );
|
807
826
|
},
|
808
827
|
|
809
828
|
curCSS: function( elem, name, force ) {
|
810
|
-
var ret;
|
829
|
+
var ret, style = elem.style;
|
811
830
|
|
812
831
|
// A helper method for determining if an element's values are broken
|
813
832
|
function color( elem ) {
|
814
833
|
if ( !jQuery.browser.safari )
|
815
834
|
return false;
|
816
835
|
|
817
|
-
|
836
|
+
// defaultView is cached
|
837
|
+
var ret = defaultView.getComputedStyle( elem, null );
|
818
838
|
return !ret || ret.getPropertyValue("color") == "";
|
819
839
|
}
|
820
840
|
|
821
841
|
// We need to handle opacity special in IE
|
822
842
|
if ( name == "opacity" && jQuery.browser.msie ) {
|
823
|
-
ret = jQuery.attr(
|
843
|
+
ret = jQuery.attr( style, "opacity" );
|
824
844
|
|
825
845
|
return ret == "" ?
|
826
846
|
"1" :
|
@@ -828,19 +848,19 @@ jQuery.extend({
|
|
828
848
|
}
|
829
849
|
// Opera sometimes will give the wrong display answer, this fixes it, see #2037
|
830
850
|
if ( jQuery.browser.opera && name == "display" ) {
|
831
|
-
var save =
|
832
|
-
|
833
|
-
|
851
|
+
var save = style.outline;
|
852
|
+
style.outline = "0 solid black";
|
853
|
+
style.outline = save;
|
834
854
|
}
|
835
|
-
|
855
|
+
|
836
856
|
// Make sure we're using the right name for getting the float value
|
837
857
|
if ( name.match( /float/i ) )
|
838
858
|
name = styleFloat;
|
839
859
|
|
840
|
-
if ( !force &&
|
841
|
-
ret =
|
860
|
+
if ( !force && style && style[ name ] )
|
861
|
+
ret = style[ name ];
|
842
862
|
|
843
|
-
else if (
|
863
|
+
else if ( defaultView.getComputedStyle ) {
|
844
864
|
|
845
865
|
// Only "float" is needed here
|
846
866
|
if ( name.match( /float/i ) )
|
@@ -848,23 +868,23 @@ jQuery.extend({
|
|
848
868
|
|
849
869
|
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
|
850
870
|
|
851
|
-
var
|
871
|
+
var computedStyle = defaultView.getComputedStyle( elem, null );
|
852
872
|
|
853
|
-
if (
|
854
|
-
ret =
|
873
|
+
if ( computedStyle && !color( elem ) )
|
874
|
+
ret = computedStyle.getPropertyValue( name );
|
855
875
|
|
856
876
|
// If the element isn't reporting its values properly in Safari
|
857
877
|
// then some display: none elements are involved
|
858
878
|
else {
|
859
|
-
var swap = [], stack = [];
|
879
|
+
var swap = [], stack = [], a = elem, i = 0;
|
860
880
|
|
861
881
|
// Locate all of the parent display: none elements
|
862
|
-
for (
|
882
|
+
for ( ; a && color(a); a = a.parentNode )
|
863
883
|
stack.unshift(a);
|
864
884
|
|
865
885
|
// Go through and make them visible, but in reverse
|
866
886
|
// (It would be better if we knew the exact display type that they had)
|
867
|
-
for (
|
887
|
+
for ( ; i < stack.length; i++ )
|
868
888
|
if ( color( stack[ i ] ) ) {
|
869
889
|
swap[ i ] = stack[ i ].style.display;
|
870
890
|
stack[ i ].style.display = "block";
|
@@ -874,10 +894,10 @@ jQuery.extend({
|
|
874
894
|
// one special, otherwise get the value
|
875
895
|
ret = name == "display" && swap[ stack.length - 1 ] != null ?
|
876
896
|
"none" :
|
877
|
-
(
|
897
|
+
( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
|
878
898
|
|
879
899
|
// Finally, revert the display styles back
|
880
|
-
for (
|
900
|
+
for ( i = 0; i < swap.length; i++ )
|
881
901
|
if ( swap[ i ] != null )
|
882
902
|
stack[ i ].style.display = swap[ i ];
|
883
903
|
}
|
@@ -900,27 +920,27 @@ jQuery.extend({
|
|
900
920
|
// but a number that has a weird ending, we need to convert it to pixels
|
901
921
|
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
|
902
922
|
// Remember the original values
|
903
|
-
var
|
923
|
+
var left = style.left, rsLeft = elem.runtimeStyle.left;
|
904
924
|
|
905
925
|
// Put in the new values to get a computed value out
|
906
926
|
elem.runtimeStyle.left = elem.currentStyle.left;
|
907
|
-
|
908
|
-
ret =
|
927
|
+
style.left = ret || 0;
|
928
|
+
ret = style.pixelLeft + "px";
|
909
929
|
|
910
930
|
// Revert the changed values
|
911
|
-
|
912
|
-
elem.runtimeStyle.left =
|
931
|
+
style.left = left;
|
932
|
+
elem.runtimeStyle.left = rsLeft;
|
913
933
|
}
|
914
934
|
}
|
915
935
|
|
916
936
|
return ret;
|
917
937
|
},
|
918
|
-
|
938
|
+
|
919
939
|
clean: function( elems, context ) {
|
920
940
|
var ret = [];
|
921
941
|
context = context || document;
|
922
942
|
// !context.createElement fails in IE with an error but returns typeof 'object'
|
923
|
-
if (typeof context.createElement == 'undefined')
|
943
|
+
if (typeof context.createElement == 'undefined')
|
924
944
|
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
|
925
945
|
|
926
946
|
jQuery.each(elems, function(i, elem){
|
@@ -928,8 +948,8 @@ jQuery.extend({
|
|
928
948
|
return;
|
929
949
|
|
930
950
|
if ( elem.constructor == Number )
|
931
|
-
elem
|
932
|
-
|
951
|
+
elem += '';
|
952
|
+
|
933
953
|
// Convert html string into DOM nodes
|
934
954
|
if ( typeof elem == "string" ) {
|
935
955
|
// Fix "XHTML"-style tags in all browsers
|
@@ -946,58 +966,58 @@ jQuery.extend({
|
|
946
966
|
// option or optgroup
|
947
967
|
!tags.indexOf("<opt") &&
|
948
968
|
[ 1, "<select multiple='multiple'>", "</select>" ] ||
|
949
|
-
|
969
|
+
|
950
970
|
!tags.indexOf("<leg") &&
|
951
971
|
[ 1, "<fieldset>", "</fieldset>" ] ||
|
952
|
-
|
972
|
+
|
953
973
|
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
|
954
974
|
[ 1, "<table>", "</table>" ] ||
|
955
|
-
|
975
|
+
|
956
976
|
!tags.indexOf("<tr") &&
|
957
977
|
[ 2, "<table><tbody>", "</tbody></table>" ] ||
|
958
|
-
|
978
|
+
|
959
979
|
// <thead> matched above
|
960
980
|
(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
|
961
981
|
[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
|
962
|
-
|
982
|
+
|
963
983
|
!tags.indexOf("<col") &&
|
964
984
|
[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
|
965
985
|
|
966
986
|
// IE can't serialize <link> and <script> tags normally
|
967
987
|
jQuery.browser.msie &&
|
968
988
|
[ 1, "div<div>", "</div>" ] ||
|
969
|
-
|
989
|
+
|
970
990
|
[ 0, "", "" ];
|
971
991
|
|
972
992
|
// Go to html and back, then peel off extra wrappers
|
973
993
|
div.innerHTML = wrap[1] + elem + wrap[2];
|
974
|
-
|
994
|
+
|
975
995
|
// Move to the right depth
|
976
996
|
while ( wrap[0]-- )
|
977
997
|
div = div.lastChild;
|
978
|
-
|
998
|
+
|
979
999
|
// Remove IE's autoinserted <tbody> from table fragments
|
980
1000
|
if ( jQuery.browser.msie ) {
|
981
|
-
|
1001
|
+
|
982
1002
|
// String was a <table>, *may* have spurious <tbody>
|
983
1003
|
var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
|
984
1004
|
div.firstChild && div.firstChild.childNodes :
|
985
|
-
|
1005
|
+
|
986
1006
|
// String was a bare <thead> or <tfoot>
|
987
1007
|
wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
|
988
1008
|
div.childNodes :
|
989
1009
|
[];
|
990
|
-
|
1010
|
+
|
991
1011
|
for ( var j = tbody.length - 1; j >= 0 ; --j )
|
992
1012
|
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
|
993
1013
|
tbody[ j ].parentNode.removeChild( tbody[ j ] );
|
994
|
-
|
995
|
-
// IE completely kills leading whitespace when innerHTML is used
|
996
|
-
if ( /^\s/.test( elem ) )
|
1014
|
+
|
1015
|
+
// IE completely kills leading whitespace when innerHTML is used
|
1016
|
+
if ( /^\s/.test( elem ) )
|
997
1017
|
div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
|
998
|
-
|
1018
|
+
|
999
1019
|
}
|
1000
|
-
|
1020
|
+
|
1001
1021
|
elem = jQuery.makeArray( div.childNodes );
|
1002
1022
|
}
|
1003
1023
|
|
@@ -1014,81 +1034,94 @@ jQuery.extend({
|
|
1014
1034
|
|
1015
1035
|
return ret;
|
1016
1036
|
},
|
1017
|
-
|
1037
|
+
|
1018
1038
|
attr: function( elem, name, value ) {
|
1019
1039
|
// don't set attributes on text and comment nodes
|
1020
1040
|
if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
|
1021
1041
|
return undefined;
|
1022
1042
|
|
1023
|
-
var
|
1024
|
-
|
1025
|
-
|
1043
|
+
var notxml = !jQuery.isXMLDoc( elem ),
|
1044
|
+
// Whether we are setting (or getting)
|
1045
|
+
set = value !== undefined,
|
1046
|
+
msie = jQuery.browser.msie;
|
1047
|
+
|
1048
|
+
// Try to normalize/fix the name
|
1049
|
+
name = notxml && jQuery.props[ name ] || name;
|
1026
1050
|
|
1027
|
-
//
|
1028
|
-
//
|
1029
|
-
if (
|
1030
|
-
elem.parentNode.selectedIndex;
|
1031
|
-
|
1032
|
-
// Certain attributes only work when accessed via the old DOM 0 way
|
1033
|
-
if ( fix[ name ] ) {
|
1034
|
-
if ( value != undefined )
|
1035
|
-
elem[ fix[ name ] ] = value;
|
1051
|
+
// Only do all the following if this is a node (faster for style)
|
1052
|
+
// IE elem.getAttribute passes even for style
|
1053
|
+
if ( elem.tagName ) {
|
1036
1054
|
|
1037
|
-
|
1055
|
+
// These attributes require special treatment
|
1056
|
+
var special = /href|src|style/.test( name );
|
1038
1057
|
|
1039
|
-
|
1040
|
-
|
1058
|
+
// Safari mis-reports the default selected property of a hidden option
|
1059
|
+
// Accessing the parent's selectedIndex property fixes it
|
1060
|
+
if ( name == "selected" && jQuery.browser.safari )
|
1061
|
+
elem.parentNode.selectedIndex;
|
1041
1062
|
|
1042
|
-
|
1043
|
-
|
1063
|
+
// If applicable, access the attribute via the DOM 0 way
|
1064
|
+
if ( name in elem && notxml && !special ) {
|
1065
|
+
if ( set ){
|
1066
|
+
// We can't allow the type property to be changed (since it causes problems in IE)
|
1067
|
+
if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
|
1068
|
+
throw "type property can't be changed";
|
1044
1069
|
|
1045
|
-
|
1046
|
-
|
1070
|
+
elem[ name ] = value;
|
1071
|
+
}
|
1047
1072
|
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
throw "type property can't be changed";
|
1073
|
+
// browsers index elements by id/name on forms, give priority to attributes.
|
1074
|
+
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
|
1075
|
+
return elem.getAttributeNode( name ).nodeValue;
|
1052
1076
|
|
1077
|
+
return elem[ name ];
|
1078
|
+
}
|
1079
|
+
|
1080
|
+
if ( msie && notxml && name == "style" )
|
1081
|
+
return jQuery.attr( elem.style, "cssText", value );
|
1082
|
+
|
1083
|
+
if ( set )
|
1053
1084
|
// convert the value to a string (all browsers do this but IE) see #1070
|
1054
1085
|
elem.setAttribute( name, "" + value );
|
1055
|
-
}
|
1056
1086
|
|
1057
|
-
|
1058
|
-
|
1087
|
+
var attr = msie && notxml && special
|
1088
|
+
// Some attributes require a special call on IE
|
1089
|
+
? elem.getAttribute( name, 2 )
|
1090
|
+
: elem.getAttribute( name );
|
1059
1091
|
|
1060
|
-
return
|
1092
|
+
// Non-existent attributes return null, we normalize to undefined
|
1093
|
+
return attr === null ? undefined : attr;
|
1094
|
+
}
|
1061
1095
|
|
1062
1096
|
// elem is actually elem.style ... set the style
|
1063
|
-
} else {
|
1064
|
-
// IE actually uses filters for opacity
|
1065
|
-
if ( name == "opacity" && jQuery.browser.msie ) {
|
1066
|
-
if ( value != undefined ) {
|
1067
|
-
// IE has trouble with opacity if it does not have layout
|
1068
|
-
// Force it by setting the zoom level
|
1069
|
-
elem.zoom = 1;
|
1070
|
-
|
1071
|
-
// Set the alpha filter to set the opacity
|
1072
|
-
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
|
1073
|
-
(parseFloat( value ).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
|
1074
|
-
}
|
1075
|
-
|
1076
|
-
return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
|
1077
|
-
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() :
|
1078
|
-
"";
|
1079
|
-
}
|
1080
1097
|
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1098
|
+
// IE uses filters for opacity
|
1099
|
+
if ( msie && name == "opacity" ) {
|
1100
|
+
if ( set ) {
|
1101
|
+
// IE has trouble with opacity if it does not have layout
|
1102
|
+
// Force it by setting the zoom level
|
1103
|
+
elem.zoom = 1;
|
1084
1104
|
|
1085
|
-
|
1086
|
-
elem
|
1105
|
+
// Set the alpha filter to set the opacity
|
1106
|
+
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
|
1107
|
+
(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
|
1108
|
+
}
|
1087
1109
|
|
1088
|
-
return elem
|
1110
|
+
return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
|
1111
|
+
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
|
1112
|
+
"";
|
1089
1113
|
}
|
1114
|
+
|
1115
|
+
name = name.replace(/-([a-z])/ig, function(all, letter){
|
1116
|
+
return letter.toUpperCase();
|
1117
|
+
});
|
1118
|
+
|
1119
|
+
if ( set )
|
1120
|
+
elem[ name ] = value;
|
1121
|
+
|
1122
|
+
return elem[ name ];
|
1090
1123
|
},
|
1091
|
-
|
1124
|
+
|
1092
1125
|
trim: function( text ) {
|
1093
1126
|
return (text || "").replace( /^\s+|\s+$/g, "" );
|
1094
1127
|
},
|
@@ -1096,19 +1129,23 @@ jQuery.extend({
|
|
1096
1129
|
makeArray: function( array ) {
|
1097
1130
|
var ret = [];
|
1098
1131
|
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1132
|
+
if( array != null ){
|
1133
|
+
var i = array.length;
|
1134
|
+
//the window, strings and functions also have 'length'
|
1135
|
+
if( i == null || array.split || array.setInterval || array.call )
|
1136
|
+
ret[0] = array;
|
1137
|
+
else
|
1138
|
+
while( i )
|
1139
|
+
ret[--i] = array[i];
|
1140
|
+
}
|
1105
1141
|
|
1106
1142
|
return ret;
|
1107
1143
|
},
|
1108
1144
|
|
1109
1145
|
inArray: function( elem, array ) {
|
1110
1146
|
for ( var i = 0, length = array.length; i < length; i++ )
|
1111
|
-
|
1147
|
+
// Use === because on IE, window == document
|
1148
|
+
if ( array[ i ] === elem )
|
1112
1149
|
return i;
|
1113
1150
|
|
1114
1151
|
return -1;
|
@@ -1117,17 +1154,17 @@ jQuery.extend({
|
|
1117
1154
|
merge: function( first, second ) {
|
1118
1155
|
// We have to loop this way because IE & Opera overwrite the length
|
1119
1156
|
// expando of getElementsByTagName
|
1120
|
-
|
1157
|
+
var i = 0, elem, pos = first.length;
|
1121
1158
|
// Also, we need to make sure that the correct elements are being returned
|
1122
1159
|
// (IE returns comment nodes in a '*' query)
|
1123
1160
|
if ( jQuery.browser.msie ) {
|
1124
|
-
|
1125
|
-
if (
|
1126
|
-
first
|
1161
|
+
while ( elem = second[ i++ ] )
|
1162
|
+
if ( elem.nodeType != 8 )
|
1163
|
+
first[ pos++ ] = elem;
|
1127
1164
|
|
1128
1165
|
} else
|
1129
|
-
|
1130
|
-
first
|
1166
|
+
while ( elem = second[ i++ ] )
|
1167
|
+
first[ pos++ ] = elem;
|
1131
1168
|
|
1132
1169
|
return first;
|
1133
1170
|
},
|
@@ -1159,7 +1196,7 @@ jQuery.extend({
|
|
1159
1196
|
// Go through the array, only saving the items
|
1160
1197
|
// that pass the validator function
|
1161
1198
|
for ( var i = 0, length = elems.length; i < length; i++ )
|
1162
|
-
if ( !inv
|
1199
|
+
if ( !inv != !callback( elems[ i ], i ) )
|
1163
1200
|
ret.push( elems[ i ] );
|
1164
1201
|
|
1165
1202
|
return ret;
|
@@ -1173,15 +1210,11 @@ jQuery.extend({
|
|
1173
1210
|
for ( var i = 0, length = elems.length; i < length; i++ ) {
|
1174
1211
|
var value = callback( elems[ i ], i );
|
1175
1212
|
|
1176
|
-
if ( value
|
1177
|
-
|
1178
|
-
value = [ value ];
|
1179
|
-
|
1180
|
-
ret = ret.concat( value );
|
1181
|
-
}
|
1213
|
+
if ( value != null )
|
1214
|
+
ret[ ret.length ] = value;
|
1182
1215
|
}
|
1183
1216
|
|
1184
|
-
return ret;
|
1217
|
+
return ret.concat.apply( [], ret );
|
1185
1218
|
}
|
1186
1219
|
});
|
1187
1220
|
|
@@ -1199,29 +1232,20 @@ jQuery.browser = {
|
|
1199
1232
|
var styleFloat = jQuery.browser.msie ?
|
1200
1233
|
"styleFloat" :
|
1201
1234
|
"cssFloat";
|
1202
|
-
|
1235
|
+
|
1203
1236
|
jQuery.extend({
|
1204
1237
|
// Check to see if the W3C box model is being used
|
1205
1238
|
boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
|
1206
|
-
|
1239
|
+
|
1207
1240
|
props: {
|
1208
1241
|
"for": "htmlFor",
|
1209
1242
|
"class": "className",
|
1210
1243
|
"float": styleFloat,
|
1211
1244
|
cssFloat: styleFloat,
|
1212
1245
|
styleFloat: styleFloat,
|
1213
|
-
innerHTML: "innerHTML",
|
1214
|
-
className: "className",
|
1215
|
-
value: "value",
|
1216
|
-
disabled: "disabled",
|
1217
|
-
checked: "checked",
|
1218
1246
|
readonly: "readOnly",
|
1219
|
-
selected: "selected",
|
1220
1247
|
maxlength: "maxLength",
|
1221
|
-
|
1222
|
-
defaultValue: "defaultValue",
|
1223
|
-
tagName: "tagName",
|
1224
|
-
nodeName: "nodeName"
|
1248
|
+
cellspacing: "cellSpacing"
|
1225
1249
|
}
|
1226
1250
|
});
|
1227
1251
|
|
@@ -1266,7 +1290,7 @@ jQuery.each({
|
|
1266
1290
|
jQuery.each({
|
1267
1291
|
removeAttr: function( name ) {
|
1268
1292
|
jQuery.attr( this, name, "" );
|
1269
|
-
if (this.nodeType == 1)
|
1293
|
+
if (this.nodeType == 1)
|
1270
1294
|
this.removeAttribute( name );
|
1271
1295
|
},
|
1272
1296
|
|
@@ -1297,7 +1321,7 @@ jQuery.each({
|
|
1297
1321
|
empty: function() {
|
1298
1322
|
// Remove element nodes and prevent memory leaks
|
1299
1323
|
jQuery( ">*", this ).remove();
|
1300
|
-
|
1324
|
+
|
1301
1325
|
// Remove any remaining nodes
|
1302
1326
|
while ( this.firstChild )
|
1303
1327
|
this.removeChild( this.firstChild );
|
@@ -1310,25 +1334,25 @@ jQuery.each({
|
|
1310
1334
|
|
1311
1335
|
jQuery.each([ "Height", "Width" ], function(i, name){
|
1312
1336
|
var type = name.toLowerCase();
|
1313
|
-
|
1337
|
+
|
1314
1338
|
jQuery.fn[ type ] = function( size ) {
|
1315
1339
|
// Get window width or height
|
1316
1340
|
return this[0] == window ?
|
1317
1341
|
// Opera reports document.body.client[Width/Height] properly in both quirks and standards
|
1318
|
-
jQuery.browser.opera && document.body[ "client" + name ] ||
|
1319
|
-
|
1342
|
+
jQuery.browser.opera && document.body[ "client" + name ] ||
|
1343
|
+
|
1320
1344
|
// Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
|
1321
1345
|
jQuery.browser.safari && window[ "inner" + name ] ||
|
1322
|
-
|
1346
|
+
|
1323
1347
|
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
|
1324
1348
|
document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
|
1325
|
-
|
1349
|
+
|
1326
1350
|
// Get document width or height
|
1327
1351
|
this[0] == document ?
|
1328
1352
|
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
|
1329
|
-
Math.max(
|
1330
|
-
Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
|
1331
|
-
Math.max(document.body["offset" + name], document.documentElement["offset" + name])
|
1353
|
+
Math.max(
|
1354
|
+
Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
|
1355
|
+
Math.max(document.body["offset" + name], document.documentElement["offset" + name])
|
1332
1356
|
) :
|
1333
1357
|
|
1334
1358
|
// Get or set width or height on the element
|
@@ -1341,7 +1365,10 @@ jQuery.each([ "Height", "Width" ], function(i, name){
|
|
1341
1365
|
};
|
1342
1366
|
});
|
1343
1367
|
|
1344
|
-
|
1368
|
+
// Helper function used by the dimensions and offset modules
|
1369
|
+
function num(elem, prop) {
|
1370
|
+
return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
|
1371
|
+
}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
|
1345
1372
|
"(?:[\\w*_-]|\\\\.)" :
|
1346
1373
|
"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
|
1347
1374
|
quickChild = new RegExp("^>\\s*(" + chars + "+)"),
|
@@ -1407,7 +1434,7 @@ jQuery.extend({
|
|
1407
1434
|
animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
|
1408
1435
|
}
|
1409
1436
|
},
|
1410
|
-
|
1437
|
+
|
1411
1438
|
// The regular expressions that power the parsing engine
|
1412
1439
|
parse: [
|
1413
1440
|
// Match: [@value='test'], [@foo]
|
@@ -1416,7 +1443,7 @@ jQuery.extend({
|
|
1416
1443
|
// Match: :contains('foo')
|
1417
1444
|
/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
|
1418
1445
|
|
1419
|
-
// Match: :even, :last-
|
1446
|
+
// Match: :even, :last-child, #id, .class
|
1420
1447
|
new RegExp("^([:.#]*)(" + chars + "+)")
|
1421
1448
|
],
|
1422
1449
|
|
@@ -1456,12 +1483,13 @@ jQuery.extend({
|
|
1456
1483
|
|
1457
1484
|
t = jQuery.trim(t);
|
1458
1485
|
|
1459
|
-
var foundToken = false
|
1486
|
+
var foundToken = false,
|
1460
1487
|
|
1461
1488
|
// An attempt at speeding up child selectors that
|
1462
1489
|
// point to a specific element tag
|
1463
|
-
|
1464
|
-
|
1490
|
+
re = quickChild,
|
1491
|
+
|
1492
|
+
m = re.exec(t);
|
1465
1493
|
|
1466
1494
|
if ( m ) {
|
1467
1495
|
nodeName = m[1].toUpperCase();
|
@@ -1493,12 +1521,12 @@ jQuery.extend({
|
|
1493
1521
|
var id = jQuery.data(n);
|
1494
1522
|
|
1495
1523
|
if ( m == "~" && merge[id] ) break;
|
1496
|
-
|
1524
|
+
|
1497
1525
|
if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
|
1498
1526
|
if ( m == "~" ) merge[id] = true;
|
1499
1527
|
r.push( n );
|
1500
1528
|
}
|
1501
|
-
|
1529
|
+
|
1502
1530
|
if ( m == "+" ) break;
|
1503
1531
|
}
|
1504
1532
|
}
|
@@ -1532,7 +1560,7 @@ jQuery.extend({
|
|
1532
1560
|
// Optimize for the case nodeName#idName
|
1533
1561
|
var re2 = quickID;
|
1534
1562
|
var m = re2.exec(t);
|
1535
|
-
|
1563
|
+
|
1536
1564
|
// Re-organize the results, so that they're consistent
|
1537
1565
|
if ( m ) {
|
1538
1566
|
m = [ 0, m[2], m[3], m[1] ];
|
@@ -1552,7 +1580,7 @@ jQuery.extend({
|
|
1552
1580
|
if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
|
1553
1581
|
// Optimization for HTML document case
|
1554
1582
|
var oid = elem.getElementById(m[2]);
|
1555
|
-
|
1583
|
+
|
1556
1584
|
// Do a quick check for the existence of the actual ID attribute
|
1557
1585
|
// to avoid selecting by the name attribute in IE
|
1558
1586
|
// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
|
@@ -1674,10 +1702,10 @@ jQuery.extend({
|
|
1674
1702
|
|
1675
1703
|
else if ( m[1] == "[" ) {
|
1676
1704
|
var tmp = [], type = m[3];
|
1677
|
-
|
1705
|
+
|
1678
1706
|
for ( var i = 0, rl = r.length; i < rl; i++ ) {
|
1679
1707
|
var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
|
1680
|
-
|
1708
|
+
|
1681
1709
|
if ( z == null || /href|src|selected/.test(m[2]) )
|
1682
1710
|
z = jQuery.attr(a,m[2]) || '';
|
1683
1711
|
|
@@ -1689,7 +1717,7 @@ jQuery.extend({
|
|
1689
1717
|
(type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
|
1690
1718
|
tmp.push( a );
|
1691
1719
|
}
|
1692
|
-
|
1720
|
+
|
1693
1721
|
r = tmp;
|
1694
1722
|
|
1695
1723
|
// We can get a speed boost by handling nth-child here
|
@@ -1701,7 +1729,7 @@ jQuery.extend({
|
|
1701
1729
|
!/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
|
1702
1730
|
// calculate the numbers (first)n+(last) including if they are negative
|
1703
1731
|
first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
|
1704
|
-
|
1732
|
+
|
1705
1733
|
// loop through all the elements left in the jQuery object
|
1706
1734
|
for ( var i = 0, rl = r.length; i < rl; i++ ) {
|
1707
1735
|
var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
|
@@ -1752,8 +1780,8 @@ jQuery.extend({
|
|
1752
1780
|
},
|
1753
1781
|
|
1754
1782
|
dir: function( elem, dir ){
|
1755
|
-
var matched = []
|
1756
|
-
|
1783
|
+
var matched = [],
|
1784
|
+
cur = elem[dir];
|
1757
1785
|
while ( cur && cur != document ) {
|
1758
1786
|
if ( cur.nodeType == 1 )
|
1759
1787
|
matched.push( cur );
|
@@ -1761,7 +1789,7 @@ jQuery.extend({
|
|
1761
1789
|
}
|
1762
1790
|
return matched;
|
1763
1791
|
},
|
1764
|
-
|
1792
|
+
|
1765
1793
|
nth: function(cur,result,dir,elem){
|
1766
1794
|
result = result || 1;
|
1767
1795
|
var num = 0;
|
@@ -1772,22 +1800,21 @@ jQuery.extend({
|
|
1772
1800
|
|
1773
1801
|
return cur;
|
1774
1802
|
},
|
1775
|
-
|
1803
|
+
|
1776
1804
|
sibling: function( n, elem ) {
|
1777
1805
|
var r = [];
|
1778
1806
|
|
1779
1807
|
for ( ; n; n = n.nextSibling ) {
|
1780
|
-
if ( n.nodeType == 1 &&
|
1808
|
+
if ( n.nodeType == 1 && n != elem )
|
1781
1809
|
r.push( n );
|
1782
1810
|
}
|
1783
1811
|
|
1784
1812
|
return r;
|
1785
1813
|
}
|
1786
1814
|
});
|
1787
|
-
|
1788
1815
|
/*
|
1789
1816
|
* A number of helper functions used for managing events.
|
1790
|
-
* Many of the ideas behind this code orignated from
|
1817
|
+
* Many of the ideas behind this code orignated from
|
1791
1818
|
* Dean Edwards' addEvent library.
|
1792
1819
|
*/
|
1793
1820
|
jQuery.event = {
|
@@ -1800,85 +1827,75 @@ jQuery.event = {
|
|
1800
1827
|
|
1801
1828
|
// For whatever reason, IE has trouble passing the window object
|
1802
1829
|
// around, causing it to be cloned in the process
|
1803
|
-
if ( jQuery.browser.msie && elem.setInterval
|
1830
|
+
if ( jQuery.browser.msie && elem.setInterval )
|
1804
1831
|
elem = window;
|
1805
1832
|
|
1806
1833
|
// Make sure that the function being executed has a unique ID
|
1807
1834
|
if ( !handler.guid )
|
1808
1835
|
handler.guid = this.guid++;
|
1809
|
-
|
1810
|
-
// if data is passed, bind to handler
|
1811
|
-
if( data != undefined ) {
|
1812
|
-
// Create temporary function pointer to original handler
|
1813
|
-
var fn = handler;
|
1814
|
-
|
1815
|
-
// Create unique handler function, wrapped around original handler
|
1816
|
-
handler = function() {
|
1817
|
-
// Pass arguments and context to original handler
|
1818
|
-
return fn.apply(this, arguments);
|
1819
|
-
};
|
1820
1836
|
|
1821
|
-
|
1822
|
-
|
1837
|
+
// if data is passed, bind to handler
|
1838
|
+
if( data != undefined ) {
|
1839
|
+
// Create temporary function pointer to original handler
|
1840
|
+
var fn = handler;
|
1823
1841
|
|
1824
|
-
//
|
1825
|
-
handler
|
1842
|
+
// Create unique handler function, wrapped around original handler
|
1843
|
+
handler = this.proxy( fn, function() {
|
1844
|
+
// Pass arguments and context to original handler
|
1845
|
+
return fn.apply(this, arguments);
|
1846
|
+
});
|
1847
|
+
|
1848
|
+
// Store data in unique handler
|
1849
|
+
handler.data = data;
|
1826
1850
|
}
|
1827
1851
|
|
1828
1852
|
// Init the element's event structure
|
1829
1853
|
var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
|
1830
1854
|
handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
|
1831
|
-
// returned undefined or false
|
1832
|
-
var val;
|
1833
|
-
|
1834
1855
|
// Handle the second event of a trigger and when
|
1835
1856
|
// an event is called after a page has unloaded
|
1836
|
-
if ( typeof jQuery
|
1837
|
-
return
|
1838
|
-
|
1839
|
-
val = jQuery.event.handle.apply(arguments.callee.elem, arguments);
|
1840
|
-
|
1841
|
-
return val;
|
1857
|
+
if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
|
1858
|
+
return jQuery.event.handle.apply(arguments.callee.elem, arguments);
|
1842
1859
|
});
|
1843
1860
|
// Add elem as a property of the handle function
|
1844
1861
|
// This is to prevent a memory leak with non-native
|
1845
1862
|
// event in IE.
|
1846
1863
|
handle.elem = elem;
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
}
|
1864
|
+
|
1865
|
+
// Handle multiple events separated by a space
|
1866
|
+
// jQuery(...).bind("mouseover mouseout", fn);
|
1867
|
+
jQuery.each(types.split(/\s+/), function(index, type) {
|
1868
|
+
// Namespaced event handlers
|
1869
|
+
var parts = type.split(".");
|
1870
|
+
type = parts[0];
|
1871
|
+
handler.type = parts[1];
|
1872
|
+
|
1873
|
+
// Get the current list of functions bound to this event
|
1874
|
+
var handlers = events[type];
|
1875
|
+
|
1876
|
+
// Init the event handler queue
|
1877
|
+
if (!handlers) {
|
1878
|
+
handlers = events[type] = {};
|
1879
|
+
|
1880
|
+
// Check for a special event handler
|
1881
|
+
// Only use addEventListener/attachEvent if the special
|
1882
|
+
// events handler returns false
|
1883
|
+
if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
|
1884
|
+
// Bind the global event handler to the element
|
1885
|
+
if (elem.addEventListener)
|
1886
|
+
elem.addEventListener(type, handle, false);
|
1887
|
+
else if (elem.attachEvent)
|
1888
|
+
elem.attachEvent("on" + type, handle);
|
1873
1889
|
}
|
1890
|
+
}
|
1874
1891
|
|
1875
|
-
|
1876
|
-
|
1892
|
+
// Add the function to the element's handler list
|
1893
|
+
handlers[handler.guid] = handler;
|
1894
|
+
|
1895
|
+
// Keep track of which events have been used, for global triggering
|
1896
|
+
jQuery.event.global[type] = true;
|
1897
|
+
});
|
1877
1898
|
|
1878
|
-
// Keep track of which events have been used, for global triggering
|
1879
|
-
jQuery.event.global[type] = true;
|
1880
|
-
});
|
1881
|
-
|
1882
1899
|
// Nullify elem to prevent memory leaks in IE
|
1883
1900
|
elem = null;
|
1884
1901
|
},
|
@@ -1896,28 +1913,28 @@ jQuery.event = {
|
|
1896
1913
|
|
1897
1914
|
if ( events ) {
|
1898
1915
|
// Unbind all events for the element
|
1899
|
-
if ( types == undefined )
|
1916
|
+
if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
|
1900
1917
|
for ( var type in events )
|
1901
|
-
this.remove( elem, type );
|
1918
|
+
this.remove( elem, type + (types || "") );
|
1902
1919
|
else {
|
1903
1920
|
// types is actually an event object here
|
1904
1921
|
if ( types.type ) {
|
1905
1922
|
handler = types.handler;
|
1906
1923
|
types = types.type;
|
1907
1924
|
}
|
1908
|
-
|
1925
|
+
|
1909
1926
|
// Handle multiple events seperated by a space
|
1910
1927
|
// jQuery(...).unbind("mouseover mouseout", fn);
|
1911
1928
|
jQuery.each(types.split(/\s+/), function(index, type){
|
1912
1929
|
// Namespaced event handlers
|
1913
1930
|
var parts = type.split(".");
|
1914
1931
|
type = parts[0];
|
1915
|
-
|
1932
|
+
|
1916
1933
|
if ( events[type] ) {
|
1917
1934
|
// remove the given handler for the given type
|
1918
1935
|
if ( handler )
|
1919
1936
|
delete events[type][handler.guid];
|
1920
|
-
|
1937
|
+
|
1921
1938
|
// remove all handlers for the given type
|
1922
1939
|
else
|
1923
1940
|
for ( handler in events[type] )
|
@@ -1954,7 +1971,12 @@ jQuery.event = {
|
|
1954
1971
|
|
1955
1972
|
trigger: function(type, data, elem, donative, extra) {
|
1956
1973
|
// Clone the incoming data, if any
|
1957
|
-
data = jQuery.makeArray(data
|
1974
|
+
data = jQuery.makeArray(data);
|
1975
|
+
|
1976
|
+
if ( type.indexOf("!") >= 0 ) {
|
1977
|
+
type = type.slice(0, -1);
|
1978
|
+
var exclusive = true;
|
1979
|
+
}
|
1958
1980
|
|
1959
1981
|
// Handle a global trigger
|
1960
1982
|
if ( !elem ) {
|
@@ -1971,20 +1993,31 @@ jQuery.event = {
|
|
1971
1993
|
var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
|
1972
1994
|
// Check to see if we need to provide a fake event, or not
|
1973
1995
|
event = !data[0] || !data[0].preventDefault;
|
1974
|
-
|
1996
|
+
|
1975
1997
|
// Pass along a fake event
|
1976
|
-
if ( event )
|
1977
|
-
data.unshift(
|
1998
|
+
if ( event ) {
|
1999
|
+
data.unshift({
|
2000
|
+
type: type,
|
2001
|
+
target: elem,
|
2002
|
+
preventDefault: function(){},
|
2003
|
+
stopPropagation: function(){},
|
2004
|
+
timeStamp: now()
|
2005
|
+
});
|
2006
|
+
data[0][expando] = true; // no need to fix fake event
|
2007
|
+
}
|
1978
2008
|
|
1979
2009
|
// Enforce the right trigger type
|
1980
2010
|
data[0].type = type;
|
2011
|
+
if ( exclusive )
|
2012
|
+
data[0].exclusive = true;
|
1981
2013
|
|
1982
|
-
// Trigger the event
|
1983
|
-
|
1984
|
-
|
2014
|
+
// Trigger the event, it is assumed that "handle" is a function
|
2015
|
+
var handle = jQuery.data(elem, "handle");
|
2016
|
+
if ( handle )
|
2017
|
+
val = handle.apply( elem, data );
|
1985
2018
|
|
1986
|
-
// Handle triggering native .onfoo handlers
|
1987
|
-
if ( !fn && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
|
2019
|
+
// Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
|
2020
|
+
if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
|
1988
2021
|
val = false;
|
1989
2022
|
|
1990
2023
|
// Extra functions don't get the custom event object
|
@@ -2017,28 +2050,30 @@ jQuery.event = {
|
|
2017
2050
|
|
2018
2051
|
handle: function(event) {
|
2019
2052
|
// returned undefined or false
|
2020
|
-
var val;
|
2053
|
+
var val, ret, namespace, all, handlers;
|
2021
2054
|
|
2022
|
-
|
2023
|
-
event = jQuery.event.fix( event || window.event || {} );
|
2055
|
+
event = arguments[0] = jQuery.event.fix( event || window.event );
|
2024
2056
|
|
2025
2057
|
// Namespaced event handlers
|
2026
|
-
|
2027
|
-
event.type =
|
2058
|
+
namespace = event.type.split(".");
|
2059
|
+
event.type = namespace[0];
|
2060
|
+
namespace = namespace[1];
|
2061
|
+
// Cache this now, all = true means, any handler
|
2062
|
+
all = !namespace && !event.exclusive;
|
2028
2063
|
|
2029
|
-
|
2030
|
-
args.unshift( event );
|
2064
|
+
handlers = ( jQuery.data(this, "events") || {} )[event.type];
|
2031
2065
|
|
2032
2066
|
for ( var j in handlers ) {
|
2033
2067
|
var handler = handlers[j];
|
2034
|
-
// Pass in a reference to the handler function itself
|
2035
|
-
// So that we can later remove it
|
2036
|
-
args[0].handler = handler;
|
2037
|
-
args[0].data = handler.data;
|
2038
2068
|
|
2039
2069
|
// Filter the functions by class
|
2040
|
-
if (
|
2041
|
-
|
2070
|
+
if ( all || handler.type == namespace ) {
|
2071
|
+
// Pass in a reference to the handler function itself
|
2072
|
+
// So that we can later remove it
|
2073
|
+
event.handler = handler;
|
2074
|
+
event.data = handler.data;
|
2075
|
+
|
2076
|
+
ret = handler.apply( this, arguments );
|
2042
2077
|
|
2043
2078
|
if ( val !== false )
|
2044
2079
|
val = ret;
|
@@ -2050,21 +2085,25 @@ jQuery.event = {
|
|
2050
2085
|
}
|
2051
2086
|
}
|
2052
2087
|
|
2053
|
-
// Clean up added properties in IE to prevent memory leak
|
2054
|
-
if (jQuery.browser.msie)
|
2055
|
-
event.target = event.preventDefault = event.stopPropagation =
|
2056
|
-
event.handler = event.data = null;
|
2057
|
-
|
2058
2088
|
return val;
|
2059
2089
|
},
|
2060
2090
|
|
2061
2091
|
fix: function(event) {
|
2062
|
-
|
2063
|
-
|
2092
|
+
if ( event[expando] == true )
|
2093
|
+
return event;
|
2094
|
+
|
2095
|
+
// store a copy of the original event object
|
2096
|
+
// and "clone" to set read-only properties
|
2064
2097
|
var originalEvent = event;
|
2065
|
-
event =
|
2066
|
-
|
2067
|
-
|
2098
|
+
event = { originalEvent: originalEvent };
|
2099
|
+
var 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 timeStamp toElement type view wheelDelta which".split(" ");
|
2100
|
+
for ( var i=props.length; i; i-- )
|
2101
|
+
event[ props[i] ] = originalEvent[ props[i] ];
|
2102
|
+
|
2103
|
+
// Mark it as fixed
|
2104
|
+
event[expando] = true;
|
2105
|
+
|
2106
|
+
// add preventDefault and stopPropagation since
|
2068
2107
|
// they will not work on the clone
|
2069
2108
|
event.preventDefault = function() {
|
2070
2109
|
// if preventDefault exists run it on the original event
|
@@ -2080,14 +2119,17 @@ jQuery.event = {
|
|
2080
2119
|
// otherwise set the cancelBubble property of the original event to true (IE)
|
2081
2120
|
originalEvent.cancelBubble = true;
|
2082
2121
|
};
|
2083
|
-
|
2122
|
+
|
2123
|
+
// Fix timeStamp
|
2124
|
+
event.timeStamp = event.timeStamp || now();
|
2125
|
+
|
2084
2126
|
// Fix target property, if necessary
|
2085
2127
|
if ( !event.target )
|
2086
2128
|
event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
|
2087
|
-
|
2129
|
+
|
2088
2130
|
// check if target is a textnode (safari)
|
2089
2131
|
if ( event.target.nodeType == 3 )
|
2090
|
-
event.target =
|
2132
|
+
event.target = event.target.parentNode;
|
2091
2133
|
|
2092
2134
|
// Add relatedTarget, if necessary
|
2093
2135
|
if ( !event.relatedTarget && event.fromElement )
|
@@ -2099,11 +2141,11 @@ jQuery.event = {
|
|
2099
2141
|
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
|
2100
2142
|
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
|
2101
2143
|
}
|
2102
|
-
|
2144
|
+
|
2103
2145
|
// Add which for key events
|
2104
2146
|
if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
|
2105
2147
|
event.which = event.charCode || event.keyCode;
|
2106
|
-
|
2148
|
+
|
2107
2149
|
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
|
2108
2150
|
if ( !event.metaKey && event.ctrlKey )
|
2109
2151
|
event.metaKey = event.ctrlKey;
|
@@ -2112,10 +2154,17 @@ jQuery.event = {
|
|
2112
2154
|
// Note: button is not normalized, so don't use it
|
2113
2155
|
if ( !event.which && event.button )
|
2114
2156
|
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
|
2115
|
-
|
2157
|
+
|
2116
2158
|
return event;
|
2117
2159
|
},
|
2118
|
-
|
2160
|
+
|
2161
|
+
proxy: function( fn, proxy ){
|
2162
|
+
// Set the guid of unique handler to the same of original handler, so it can be removed
|
2163
|
+
proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
|
2164
|
+
// So proxy can be declared as an argument
|
2165
|
+
return proxy;
|
2166
|
+
},
|
2167
|
+
|
2119
2168
|
special: {
|
2120
2169
|
ready: {
|
2121
2170
|
setup: function() {
|
@@ -2123,50 +2172,50 @@ jQuery.event = {
|
|
2123
2172
|
bindReady();
|
2124
2173
|
return;
|
2125
2174
|
},
|
2126
|
-
|
2175
|
+
|
2127
2176
|
teardown: function() { return; }
|
2128
2177
|
},
|
2129
|
-
|
2178
|
+
|
2130
2179
|
mouseenter: {
|
2131
2180
|
setup: function() {
|
2132
2181
|
if ( jQuery.browser.msie ) return false;
|
2133
2182
|
jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
|
2134
2183
|
return true;
|
2135
2184
|
},
|
2136
|
-
|
2185
|
+
|
2137
2186
|
teardown: function() {
|
2138
2187
|
if ( jQuery.browser.msie ) return false;
|
2139
2188
|
jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
|
2140
2189
|
return true;
|
2141
2190
|
},
|
2142
|
-
|
2191
|
+
|
2143
2192
|
handler: function(event) {
|
2144
2193
|
// If we actually just moused on to a sub-element, ignore it
|
2145
2194
|
if ( withinElement(event, this) ) return true;
|
2146
2195
|
// Execute the right handlers by setting the event type to mouseenter
|
2147
|
-
|
2196
|
+
event.type = "mouseenter";
|
2148
2197
|
return jQuery.event.handle.apply(this, arguments);
|
2149
2198
|
}
|
2150
2199
|
},
|
2151
|
-
|
2200
|
+
|
2152
2201
|
mouseleave: {
|
2153
2202
|
setup: function() {
|
2154
2203
|
if ( jQuery.browser.msie ) return false;
|
2155
2204
|
jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
|
2156
2205
|
return true;
|
2157
2206
|
},
|
2158
|
-
|
2207
|
+
|
2159
2208
|
teardown: function() {
|
2160
2209
|
if ( jQuery.browser.msie ) return false;
|
2161
2210
|
jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
|
2162
2211
|
return true;
|
2163
2212
|
},
|
2164
|
-
|
2213
|
+
|
2165
2214
|
handler: function(event) {
|
2166
2215
|
// If we actually just moused on to a sub-element, ignore it
|
2167
2216
|
if ( withinElement(event, this) ) return true;
|
2168
2217
|
// Execute the right handlers by setting the event type to mouseleave
|
2169
|
-
|
2218
|
+
event.type = "mouseleave";
|
2170
2219
|
return jQuery.event.handle.apply(this, arguments);
|
2171
2220
|
}
|
2172
2221
|
}
|
@@ -2179,13 +2228,14 @@ jQuery.fn.extend({
|
|
2179
2228
|
jQuery.event.add( this, type, fn || data, fn && data );
|
2180
2229
|
});
|
2181
2230
|
},
|
2182
|
-
|
2231
|
+
|
2183
2232
|
one: function( type, data, fn ) {
|
2233
|
+
var one = jQuery.event.proxy( fn || data, function(event) {
|
2234
|
+
jQuery(this).unbind(event, one);
|
2235
|
+
return (fn || data).apply( this, arguments );
|
2236
|
+
});
|
2184
2237
|
return this.each(function(){
|
2185
|
-
jQuery.event.add( this, type,
|
2186
|
-
jQuery(this).unbind(event);
|
2187
|
-
return (fn || data).apply( this, arguments);
|
2188
|
-
}, fn && data);
|
2238
|
+
jQuery.event.add( this, type, one, fn && data);
|
2189
2239
|
});
|
2190
2240
|
},
|
2191
2241
|
|
@@ -2202,31 +2252,33 @@ jQuery.fn.extend({
|
|
2202
2252
|
},
|
2203
2253
|
|
2204
2254
|
triggerHandler: function( type, data, fn ) {
|
2205
|
-
|
2206
|
-
return jQuery.event.trigger( type, data, this[0], false, fn );
|
2207
|
-
return undefined;
|
2255
|
+
return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
|
2208
2256
|
},
|
2209
2257
|
|
2210
|
-
toggle: function() {
|
2258
|
+
toggle: function( fn ) {
|
2211
2259
|
// Save reference to arguments for access in closure
|
2212
|
-
var args = arguments;
|
2260
|
+
var args = arguments, i = 1;
|
2261
|
+
|
2262
|
+
// link all the functions, so any of them can unbind this click handler
|
2263
|
+
while( i < args.length )
|
2264
|
+
jQuery.event.proxy( fn, args[i++] );
|
2213
2265
|
|
2214
|
-
return this.click(function(event) {
|
2266
|
+
return this.click( jQuery.event.proxy( fn, function(event) {
|
2215
2267
|
// Figure out which function to execute
|
2216
|
-
this.lastToggle =
|
2217
|
-
|
2268
|
+
this.lastToggle = ( this.lastToggle || 0 ) % i;
|
2269
|
+
|
2218
2270
|
// Make sure that clicks stop
|
2219
2271
|
event.preventDefault();
|
2220
|
-
|
2272
|
+
|
2221
2273
|
// and execute the function
|
2222
|
-
return args[this.lastToggle].apply( this, arguments ) || false;
|
2223
|
-
});
|
2274
|
+
return args[ this.lastToggle++ ].apply( this, arguments ) || false;
|
2275
|
+
}));
|
2224
2276
|
},
|
2225
2277
|
|
2226
2278
|
hover: function(fnOver, fnOut) {
|
2227
2279
|
return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
|
2228
2280
|
},
|
2229
|
-
|
2281
|
+
|
2230
2282
|
ready: function(fn) {
|
2231
2283
|
// Attach the listeners
|
2232
2284
|
bindReady();
|
@@ -2235,12 +2287,12 @@ jQuery.fn.extend({
|
|
2235
2287
|
if ( jQuery.isReady )
|
2236
2288
|
// Execute the function immediately
|
2237
2289
|
fn.call( document, jQuery );
|
2238
|
-
|
2290
|
+
|
2239
2291
|
// Otherwise, remember the function for later
|
2240
2292
|
else
|
2241
2293
|
// Add the function to the wait list
|
2242
2294
|
jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
|
2243
|
-
|
2295
|
+
|
2244
2296
|
return this;
|
2245
2297
|
}
|
2246
2298
|
});
|
@@ -2254,18 +2306,18 @@ jQuery.extend({
|
|
2254
2306
|
if ( !jQuery.isReady ) {
|
2255
2307
|
// Remember that the DOM is ready
|
2256
2308
|
jQuery.isReady = true;
|
2257
|
-
|
2309
|
+
|
2258
2310
|
// If there are functions bound, to execute
|
2259
2311
|
if ( jQuery.readyList ) {
|
2260
2312
|
// Execute all of them
|
2261
2313
|
jQuery.each( jQuery.readyList, function(){
|
2262
|
-
this.
|
2314
|
+
this.call( document );
|
2263
2315
|
});
|
2264
|
-
|
2316
|
+
|
2265
2317
|
// Reset the list of functions
|
2266
2318
|
jQuery.readyList = null;
|
2267
2319
|
}
|
2268
|
-
|
2320
|
+
|
2269
2321
|
// Trigger any bound ready events
|
2270
2322
|
jQuery(document).triggerHandler("ready");
|
2271
2323
|
}
|
@@ -2282,7 +2334,7 @@ function bindReady(){
|
|
2282
2334
|
if ( document.addEventListener && !jQuery.browser.opera)
|
2283
2335
|
// Use the handy event callback
|
2284
2336
|
document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
|
2285
|
-
|
2337
|
+
|
2286
2338
|
// If IE is used and is not in a frame
|
2287
2339
|
// Continually check to see if the document is ready
|
2288
2340
|
if ( jQuery.browser.msie && window == top ) (function(){
|
@@ -2335,9 +2387,9 @@ function bindReady(){
|
|
2335
2387
|
}
|
2336
2388
|
|
2337
2389
|
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
|
2338
|
-
"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
|
2390
|
+
"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
|
2339
2391
|
"submit,keydown,keypress,keyup,error").split(","), function(i, name){
|
2340
|
-
|
2392
|
+
|
2341
2393
|
// Handle event binding
|
2342
2394
|
jQuery.fn[name] = function(fn){
|
2343
2395
|
return fn ? this.bind(name, fn) : this.trigger(name);
|
@@ -2362,9 +2414,12 @@ jQuery(window).bind("unload", function() {
|
|
2362
2414
|
jQuery("*").add(document).unbind();
|
2363
2415
|
});
|
2364
2416
|
jQuery.fn.extend({
|
2417
|
+
// Keep a copy of the old load
|
2418
|
+
_load: jQuery.fn.load,
|
2419
|
+
|
2365
2420
|
load: function( url, params, callback ) {
|
2366
|
-
if (
|
2367
|
-
return this.
|
2421
|
+
if ( typeof url != 'string' )
|
2422
|
+
return this._load( url );
|
2368
2423
|
|
2369
2424
|
var off = url.indexOf(" ");
|
2370
2425
|
if ( off >= 0 ) {
|
@@ -2431,8 +2486,8 @@ jQuery.fn.extend({
|
|
2431
2486
|
jQuery.makeArray(this.elements) : this;
|
2432
2487
|
})
|
2433
2488
|
.filter(function(){
|
2434
|
-
return this.name && !this.disabled &&
|
2435
|
-
(this.checked || /select|textarea/i.test(this.nodeName) ||
|
2489
|
+
return this.name && !this.disabled &&
|
2490
|
+
(this.checked || /select|textarea/i.test(this.nodeName) ||
|
2436
2491
|
/text|hidden|password/i.test(this.type));
|
2437
2492
|
})
|
2438
2493
|
.map(function(i, elem){
|
@@ -2454,7 +2509,7 @@ jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".sp
|
|
2454
2509
|
};
|
2455
2510
|
});
|
2456
2511
|
|
2457
|
-
var jsc = (
|
2512
|
+
var jsc = now();
|
2458
2513
|
|
2459
2514
|
jQuery.extend({
|
2460
2515
|
get: function( url, data, callback, type ) {
|
@@ -2463,7 +2518,7 @@ jQuery.extend({
|
|
2463
2518
|
callback = data;
|
2464
2519
|
data = null;
|
2465
2520
|
}
|
2466
|
-
|
2521
|
+
|
2467
2522
|
return jQuery.ajax({
|
2468
2523
|
type: "GET",
|
2469
2524
|
url: url,
|
@@ -2501,6 +2556,7 @@ jQuery.extend({
|
|
2501
2556
|
},
|
2502
2557
|
|
2503
2558
|
ajaxSettings: {
|
2559
|
+
url: location.href,
|
2504
2560
|
global: true,
|
2505
2561
|
type: "GET",
|
2506
2562
|
timeout: 0,
|
@@ -2519,24 +2575,25 @@ jQuery.extend({
|
|
2519
2575
|
_default: "*/*"
|
2520
2576
|
}
|
2521
2577
|
},
|
2522
|
-
|
2578
|
+
|
2523
2579
|
// Last-Modified header cache for next request
|
2524
2580
|
lastModified: {},
|
2525
2581
|
|
2526
2582
|
ajax: function( s ) {
|
2527
|
-
var jsonp, jsre = /=\?(&|$)/g, status, data;
|
2528
|
-
|
2529
2583
|
// Extend the settings, but re-extend 's' so that it can be
|
2530
2584
|
// checked again later (in the test suite, specifically)
|
2531
2585
|
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
|
2532
2586
|
|
2587
|
+
var jsonp, jsre = /=\?(&|$)/g, status, data,
|
2588
|
+
type = s.type.toUpperCase();
|
2589
|
+
|
2533
2590
|
// convert data if not already a string
|
2534
2591
|
if ( s.data && s.processData && typeof s.data != "string" )
|
2535
2592
|
s.data = jQuery.param(s.data);
|
2536
2593
|
|
2537
2594
|
// Handle JSONP Parameter Callbacks
|
2538
2595
|
if ( s.dataType == "jsonp" ) {
|
2539
|
-
if (
|
2596
|
+
if ( type == "GET" ) {
|
2540
2597
|
if ( !s.url.match(jsre) )
|
2541
2598
|
s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
|
2542
2599
|
} else if ( !s.data || !s.data.match(jsre) )
|
@@ -2573,8 +2630,8 @@ jQuery.extend({
|
|
2573
2630
|
if ( s.dataType == "script" && s.cache == null )
|
2574
2631
|
s.cache = false;
|
2575
2632
|
|
2576
|
-
if ( s.cache === false &&
|
2577
|
-
var ts = (
|
2633
|
+
if ( s.cache === false && type == "GET" ) {
|
2634
|
+
var ts = now();
|
2578
2635
|
// try replacing _= if it is there
|
2579
2636
|
var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
|
2580
2637
|
// if nothing was replaced, add timestamp to the end
|
@@ -2582,7 +2639,7 @@ jQuery.extend({
|
|
2582
2639
|
}
|
2583
2640
|
|
2584
2641
|
// If data is available, append data to url for get requests
|
2585
|
-
if ( s.data &&
|
2642
|
+
if ( s.data && type == "GET" ) {
|
2586
2643
|
s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
|
2587
2644
|
|
2588
2645
|
// IE likes to send both get and post data, prevent this
|
@@ -2593,9 +2650,13 @@ jQuery.extend({
|
|
2593
2650
|
if ( s.global && ! jQuery.active++ )
|
2594
2651
|
jQuery.event.trigger( "ajaxStart" );
|
2595
2652
|
|
2653
|
+
// Matches an absolute URL, and saves the domain
|
2654
|
+
var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
|
2655
|
+
|
2596
2656
|
// If we're requesting a remote document
|
2597
2657
|
// and trying to load JSON or Script with a GET
|
2598
|
-
if (
|
2658
|
+
if ( s.dataType == "script" && type == "GET"
|
2659
|
+
&& remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
|
2599
2660
|
var head = document.getElementsByTagName("head")[0];
|
2600
2661
|
var script = document.createElement("script");
|
2601
2662
|
script.src = s.url;
|
@@ -2608,7 +2669,7 @@ jQuery.extend({
|
|
2608
2669
|
|
2609
2670
|
// Attach handlers for all browsers
|
2610
2671
|
script.onload = script.onreadystatechange = function(){
|
2611
|
-
if ( !done && (!this.readyState ||
|
2672
|
+
if ( !done && (!this.readyState ||
|
2612
2673
|
this.readyState == "loaded" || this.readyState == "complete") ) {
|
2613
2674
|
done = true;
|
2614
2675
|
success();
|
@@ -2628,60 +2689,69 @@ jQuery.extend({
|
|
2628
2689
|
|
2629
2690
|
// Create the request object; Microsoft failed to properly
|
2630
2691
|
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
|
2631
|
-
var
|
2692
|
+
var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
|
2632
2693
|
|
2633
2694
|
// Open the socket
|
2634
|
-
|
2695
|
+
// Passing null username, generates a login popup on Opera (#2865)
|
2696
|
+
if( s.username )
|
2697
|
+
xhr.open(type, s.url, s.async, s.username, s.password);
|
2698
|
+
else
|
2699
|
+
xhr.open(type, s.url, s.async);
|
2635
2700
|
|
2636
2701
|
// Need an extra try/catch for cross domain requests in Firefox 3
|
2637
2702
|
try {
|
2638
2703
|
// Set the correct header, if data is being sent
|
2639
2704
|
if ( s.data )
|
2640
|
-
|
2705
|
+
xhr.setRequestHeader("Content-Type", s.contentType);
|
2641
2706
|
|
2642
2707
|
// Set the If-Modified-Since header, if ifModified mode.
|
2643
2708
|
if ( s.ifModified )
|
2644
|
-
|
2709
|
+
xhr.setRequestHeader("If-Modified-Since",
|
2645
2710
|
jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
|
2646
2711
|
|
2647
2712
|
// Set header so the called script knows that it's an XMLHttpRequest
|
2648
|
-
|
2713
|
+
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
2649
2714
|
|
2650
2715
|
// Set the Accepts header for the server, depending on the dataType
|
2651
|
-
|
2716
|
+
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
|
2652
2717
|
s.accepts[ s.dataType ] + ", */*" :
|
2653
2718
|
s.accepts._default );
|
2654
2719
|
} catch(e){}
|
2655
2720
|
|
2656
2721
|
// Allow custom headers/mimetypes
|
2657
|
-
if ( s.beforeSend )
|
2658
|
-
|
2659
|
-
|
2722
|
+
if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
|
2723
|
+
// cleanup active request counter
|
2724
|
+
s.global && jQuery.active--;
|
2725
|
+
// close opended socket
|
2726
|
+
xhr.abort();
|
2727
|
+
return false;
|
2728
|
+
}
|
2729
|
+
|
2660
2730
|
if ( s.global )
|
2661
|
-
jQuery.event.trigger("ajaxSend", [
|
2731
|
+
jQuery.event.trigger("ajaxSend", [xhr, s]);
|
2662
2732
|
|
2663
2733
|
// Wait for a response to come back
|
2664
2734
|
var onreadystatechange = function(isTimeout){
|
2665
2735
|
// The transfer is complete and the data is available, or the request timed out
|
2666
|
-
if ( !requestDone &&
|
2736
|
+
if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
|
2667
2737
|
requestDone = true;
|
2668
|
-
|
2738
|
+
|
2669
2739
|
// clear poll interval
|
2670
2740
|
if (ival) {
|
2671
2741
|
clearInterval(ival);
|
2672
2742
|
ival = null;
|
2673
2743
|
}
|
2674
|
-
|
2744
|
+
|
2675
2745
|
status = isTimeout == "timeout" && "timeout" ||
|
2676
|
-
!jQuery.httpSuccess(
|
2677
|
-
s.ifModified && jQuery.httpNotModified(
|
2746
|
+
!jQuery.httpSuccess( xhr ) && "error" ||
|
2747
|
+
s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
|
2678
2748
|
"success";
|
2679
2749
|
|
2680
2750
|
if ( status == "success" ) {
|
2681
2751
|
// Watch for, and catch, XML document parse errors
|
2682
2752
|
try {
|
2683
2753
|
// process the data (runs the xml through httpData regardless of callback)
|
2684
|
-
data = jQuery.httpData(
|
2754
|
+
data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
|
2685
2755
|
} catch(e) {
|
2686
2756
|
status = "parsererror";
|
2687
2757
|
}
|
@@ -2692,52 +2762,52 @@ jQuery.extend({
|
|
2692
2762
|
// Cache Last-Modified header, if ifModified mode.
|
2693
2763
|
var modRes;
|
2694
2764
|
try {
|
2695
|
-
modRes =
|
2765
|
+
modRes = xhr.getResponseHeader("Last-Modified");
|
2696
2766
|
} catch(e) {} // swallow exception thrown by FF if header is not available
|
2697
|
-
|
2767
|
+
|
2698
2768
|
if ( s.ifModified && modRes )
|
2699
2769
|
jQuery.lastModified[s.url] = modRes;
|
2700
2770
|
|
2701
2771
|
// JSONP handles its own success callback
|
2702
2772
|
if ( !jsonp )
|
2703
|
-
success();
|
2773
|
+
success();
|
2704
2774
|
} else
|
2705
|
-
jQuery.handleError(s,
|
2775
|
+
jQuery.handleError(s, xhr, status);
|
2706
2776
|
|
2707
2777
|
// Fire the complete handlers
|
2708
2778
|
complete();
|
2709
2779
|
|
2710
2780
|
// Stop memory leaks
|
2711
2781
|
if ( s.async )
|
2712
|
-
|
2782
|
+
xhr = null;
|
2713
2783
|
}
|
2714
2784
|
};
|
2715
|
-
|
2785
|
+
|
2716
2786
|
if ( s.async ) {
|
2717
2787
|
// don't attach the handler to the request, just poll it instead
|
2718
|
-
var ival = setInterval(onreadystatechange, 13);
|
2788
|
+
var ival = setInterval(onreadystatechange, 13);
|
2719
2789
|
|
2720
2790
|
// Timeout checker
|
2721
2791
|
if ( s.timeout > 0 )
|
2722
2792
|
setTimeout(function(){
|
2723
2793
|
// Check to see if the request is still happening
|
2724
|
-
if (
|
2794
|
+
if ( xhr ) {
|
2725
2795
|
// Cancel the request
|
2726
|
-
|
2727
|
-
|
2796
|
+
xhr.abort();
|
2797
|
+
|
2728
2798
|
if( !requestDone )
|
2729
2799
|
onreadystatechange( "timeout" );
|
2730
2800
|
}
|
2731
2801
|
}, s.timeout);
|
2732
2802
|
}
|
2733
|
-
|
2803
|
+
|
2734
2804
|
// Send the data
|
2735
2805
|
try {
|
2736
|
-
|
2806
|
+
xhr.send(s.data);
|
2737
2807
|
} catch(e) {
|
2738
|
-
jQuery.handleError(s,
|
2808
|
+
jQuery.handleError(s, xhr, null, e);
|
2739
2809
|
}
|
2740
|
-
|
2810
|
+
|
2741
2811
|
// firefox 1.5 doesn't fire statechange for sync requests
|
2742
2812
|
if ( !s.async )
|
2743
2813
|
onreadystatechange();
|
@@ -2749,69 +2819,73 @@ jQuery.extend({
|
|
2749
2819
|
|
2750
2820
|
// Fire the global callback
|
2751
2821
|
if ( s.global )
|
2752
|
-
jQuery.event.trigger( "ajaxSuccess", [
|
2822
|
+
jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
|
2753
2823
|
}
|
2754
2824
|
|
2755
2825
|
function complete(){
|
2756
2826
|
// Process result
|
2757
2827
|
if ( s.complete )
|
2758
|
-
s.complete(
|
2828
|
+
s.complete(xhr, status);
|
2759
2829
|
|
2760
2830
|
// The request was completed
|
2761
2831
|
if ( s.global )
|
2762
|
-
jQuery.event.trigger( "ajaxComplete", [
|
2832
|
+
jQuery.event.trigger( "ajaxComplete", [xhr, s] );
|
2763
2833
|
|
2764
2834
|
// Handle the global AJAX counter
|
2765
2835
|
if ( s.global && ! --jQuery.active )
|
2766
2836
|
jQuery.event.trigger( "ajaxStop" );
|
2767
2837
|
}
|
2768
|
-
|
2838
|
+
|
2769
2839
|
// return XMLHttpRequest to allow aborting the request etc.
|
2770
|
-
return
|
2840
|
+
return xhr;
|
2771
2841
|
},
|
2772
2842
|
|
2773
|
-
handleError: function( s,
|
2843
|
+
handleError: function( s, xhr, status, e ) {
|
2774
2844
|
// If a local callback was specified, fire it
|
2775
|
-
if ( s.error ) s.error(
|
2845
|
+
if ( s.error ) s.error( xhr, status, e );
|
2776
2846
|
|
2777
2847
|
// Fire the global callback
|
2778
2848
|
if ( s.global )
|
2779
|
-
jQuery.event.trigger( "ajaxError", [
|
2849
|
+
jQuery.event.trigger( "ajaxError", [xhr, s, e] );
|
2780
2850
|
},
|
2781
2851
|
|
2782
2852
|
// Counter for holding the number of active queries
|
2783
2853
|
active: 0,
|
2784
2854
|
|
2785
2855
|
// Determines if an XMLHttpRequest was successful or not
|
2786
|
-
httpSuccess: function(
|
2856
|
+
httpSuccess: function( xhr ) {
|
2787
2857
|
try {
|
2788
2858
|
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
|
2789
|
-
return !
|
2790
|
-
(
|
2791
|
-
jQuery.browser.safari &&
|
2859
|
+
return !xhr.status && location.protocol == "file:" ||
|
2860
|
+
( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||
|
2861
|
+
jQuery.browser.safari && xhr.status == undefined;
|
2792
2862
|
} catch(e){}
|
2793
2863
|
return false;
|
2794
2864
|
},
|
2795
2865
|
|
2796
2866
|
// Determines if an XMLHttpRequest returns NotModified
|
2797
|
-
httpNotModified: function(
|
2867
|
+
httpNotModified: function( xhr, url ) {
|
2798
2868
|
try {
|
2799
|
-
var
|
2869
|
+
var xhrRes = xhr.getResponseHeader("Last-Modified");
|
2800
2870
|
|
2801
2871
|
// Firefox always returns 200. check Last-Modified date
|
2802
|
-
return
|
2803
|
-
jQuery.browser.safari &&
|
2872
|
+
return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
|
2873
|
+
jQuery.browser.safari && xhr.status == undefined;
|
2804
2874
|
} catch(e){}
|
2805
2875
|
return false;
|
2806
2876
|
},
|
2807
2877
|
|
2808
|
-
httpData: function(
|
2809
|
-
var ct =
|
2810
|
-
|
2811
|
-
|
2878
|
+
httpData: function( xhr, type, filter ) {
|
2879
|
+
var ct = xhr.getResponseHeader("content-type"),
|
2880
|
+
xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
|
2881
|
+
data = xml ? xhr.responseXML : xhr.responseText;
|
2812
2882
|
|
2813
2883
|
if ( xml && data.documentElement.tagName == "parsererror" )
|
2814
2884
|
throw "parsererror";
|
2885
|
+
|
2886
|
+
// Allow a pre-filtering function to sanitize the response
|
2887
|
+
if( filter )
|
2888
|
+
data = filter( data, type );
|
2815
2889
|
|
2816
2890
|
// If the type is "script", eval it in global context
|
2817
2891
|
if ( type == "script" )
|
@@ -2847,7 +2921,7 @@ jQuery.extend({
|
|
2847
2921
|
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
|
2848
2922
|
});
|
2849
2923
|
else
|
2850
|
-
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
|
2924
|
+
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
|
2851
2925
|
|
2852
2926
|
// Return the resulting serialization
|
2853
2927
|
return s.join("&").replace(/%20/g, "+");
|
@@ -2860,7 +2934,7 @@ jQuery.fn.extend({
|
|
2860
2934
|
this.animate({
|
2861
2935
|
height: "show", width: "show", opacity: "show"
|
2862
2936
|
}, speed, callback) :
|
2863
|
-
|
2937
|
+
|
2864
2938
|
this.filter(":hidden").each(function(){
|
2865
2939
|
this.style.display = this.oldblock || "";
|
2866
2940
|
if ( jQuery.css(this,"display") == "none" ) {
|
@@ -2873,13 +2947,13 @@ jQuery.fn.extend({
|
|
2873
2947
|
}
|
2874
2948
|
}).end();
|
2875
2949
|
},
|
2876
|
-
|
2950
|
+
|
2877
2951
|
hide: function(speed,callback){
|
2878
2952
|
return speed ?
|
2879
2953
|
this.animate({
|
2880
2954
|
height: "hide", width: "hide", opacity: "hide"
|
2881
2955
|
}, speed, callback) :
|
2882
|
-
|
2956
|
+
|
2883
2957
|
this.filter(":visible").each(function(){
|
2884
2958
|
this.oldblock = this.oldblock || jQuery.css(this,"display");
|
2885
2959
|
this.style.display = "none";
|
@@ -2888,10 +2962,10 @@ jQuery.fn.extend({
|
|
2888
2962
|
|
2889
2963
|
// Save the old toggle function
|
2890
2964
|
_toggle: jQuery.fn.toggle,
|
2891
|
-
|
2965
|
+
|
2892
2966
|
toggle: function( fn, fn2 ){
|
2893
2967
|
return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
|
2894
|
-
this._toggle(
|
2968
|
+
this._toggle.apply( this, arguments ) :
|
2895
2969
|
fn ?
|
2896
2970
|
this.animate({
|
2897
2971
|
height: "toggle", width: "toggle", opacity: "toggle"
|
@@ -2900,11 +2974,11 @@ jQuery.fn.extend({
|
|
2900
2974
|
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
|
2901
2975
|
});
|
2902
2976
|
},
|
2903
|
-
|
2977
|
+
|
2904
2978
|
slideDown: function(speed,callback){
|
2905
2979
|
return this.animate({height: "show"}, speed, callback);
|
2906
2980
|
},
|
2907
|
-
|
2981
|
+
|
2908
2982
|
slideUp: function(speed,callback){
|
2909
2983
|
return this.animate({height: "hide"}, speed, callback);
|
2910
2984
|
},
|
@@ -2912,19 +2986,19 @@ jQuery.fn.extend({
|
|
2912
2986
|
slideToggle: function(speed, callback){
|
2913
2987
|
return this.animate({height: "toggle"}, speed, callback);
|
2914
2988
|
},
|
2915
|
-
|
2989
|
+
|
2916
2990
|
fadeIn: function(speed, callback){
|
2917
2991
|
return this.animate({opacity: "show"}, speed, callback);
|
2918
2992
|
},
|
2919
|
-
|
2993
|
+
|
2920
2994
|
fadeOut: function(speed, callback){
|
2921
2995
|
return this.animate({opacity: "hide"}, speed, callback);
|
2922
2996
|
},
|
2923
|
-
|
2997
|
+
|
2924
2998
|
fadeTo: function(speed,to,callback){
|
2925
2999
|
return this.animate({opacity: to}, speed, callback);
|
2926
3000
|
},
|
2927
|
-
|
3001
|
+
|
2928
3002
|
animate: function( prop, speed, easing, callback ) {
|
2929
3003
|
var optall = jQuery.speed(speed, easing, callback);
|
2930
3004
|
|
@@ -2932,12 +3006,12 @@ jQuery.fn.extend({
|
|
2932
3006
|
if ( this.nodeType != 1)
|
2933
3007
|
return false;
|
2934
3008
|
|
2935
|
-
var opt = jQuery.extend({}, optall)
|
2936
|
-
|
2937
|
-
|
2938
|
-
for (
|
3009
|
+
var opt = jQuery.extend({}, optall), p,
|
3010
|
+
hidden = jQuery(this).is(":hidden"), self = this;
|
3011
|
+
|
3012
|
+
for ( p in prop ) {
|
2939
3013
|
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
|
2940
|
-
return
|
3014
|
+
return opt.complete.call(this);
|
2941
3015
|
|
2942
3016
|
if ( p == "height" || p == "width" ) {
|
2943
3017
|
// Store display property
|
@@ -2952,7 +3026,7 @@ jQuery.fn.extend({
|
|
2952
3026
|
this.style.overflow = "hidden";
|
2953
3027
|
|
2954
3028
|
opt.curAnim = jQuery.extend({}, prop);
|
2955
|
-
|
3029
|
+
|
2956
3030
|
jQuery.each( prop, function(name, val){
|
2957
3031
|
var e = new jQuery.fx( self, opt, name );
|
2958
3032
|
|
@@ -2987,7 +3061,7 @@ jQuery.fn.extend({
|
|
2987
3061
|
return true;
|
2988
3062
|
});
|
2989
3063
|
},
|
2990
|
-
|
3064
|
+
|
2991
3065
|
queue: function(type, fn){
|
2992
3066
|
if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
|
2993
3067
|
fn = type;
|
@@ -3002,9 +3076,9 @@ jQuery.fn.extend({
|
|
3002
3076
|
queue(this, type, fn);
|
3003
3077
|
else {
|
3004
3078
|
queue(this, type).push( fn );
|
3005
|
-
|
3079
|
+
|
3006
3080
|
if ( queue(this, type).length == 1 )
|
3007
|
-
fn.
|
3081
|
+
fn.call(this);
|
3008
3082
|
}
|
3009
3083
|
});
|
3010
3084
|
},
|
@@ -3036,17 +3110,16 @@ jQuery.fn.extend({
|
|
3036
3110
|
});
|
3037
3111
|
|
3038
3112
|
var queue = function( elem, type, array ) {
|
3039
|
-
if (
|
3040
|
-
return undefined;
|
3113
|
+
if ( elem ){
|
3041
3114
|
|
3042
|
-
|
3115
|
+
type = type || "fx";
|
3043
3116
|
|
3044
|
-
|
3117
|
+
var q = jQuery.data( elem, type + "queue" );
|
3045
3118
|
|
3046
|
-
|
3047
|
-
|
3048
|
-
array ? jQuery.makeArray(array) : [] );
|
3119
|
+
if ( !q || array )
|
3120
|
+
q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
|
3049
3121
|
|
3122
|
+
}
|
3050
3123
|
return q;
|
3051
3124
|
};
|
3052
3125
|
|
@@ -3059,36 +3132,36 @@ jQuery.fn.dequeue = function(type){
|
|
3059
3132
|
q.shift();
|
3060
3133
|
|
3061
3134
|
if ( q.length )
|
3062
|
-
q[0].
|
3135
|
+
q[0].call( this );
|
3063
3136
|
});
|
3064
3137
|
};
|
3065
3138
|
|
3066
3139
|
jQuery.extend({
|
3067
|
-
|
3140
|
+
|
3068
3141
|
speed: function(speed, easing, fn) {
|
3069
3142
|
var opt = speed && speed.constructor == Object ? speed : {
|
3070
|
-
complete: fn || !fn && easing ||
|
3143
|
+
complete: fn || !fn && easing ||
|
3071
3144
|
jQuery.isFunction( speed ) && speed,
|
3072
3145
|
duration: speed,
|
3073
3146
|
easing: fn && easing || easing && easing.constructor != Function && easing
|
3074
3147
|
};
|
3075
3148
|
|
3076
|
-
opt.duration = (opt.duration && opt.duration.constructor == Number ?
|
3077
|
-
opt.duration :
|
3078
|
-
|
3079
|
-
|
3149
|
+
opt.duration = (opt.duration && opt.duration.constructor == Number ?
|
3150
|
+
opt.duration :
|
3151
|
+
jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
|
3152
|
+
|
3080
3153
|
// Queueing
|
3081
3154
|
opt.old = opt.complete;
|
3082
3155
|
opt.complete = function(){
|
3083
3156
|
if ( opt.queue !== false )
|
3084
3157
|
jQuery(this).dequeue();
|
3085
3158
|
if ( jQuery.isFunction( opt.old ) )
|
3086
|
-
opt.old.
|
3159
|
+
opt.old.call( this );
|
3087
3160
|
};
|
3088
|
-
|
3161
|
+
|
3089
3162
|
return opt;
|
3090
3163
|
},
|
3091
|
-
|
3164
|
+
|
3092
3165
|
easing: {
|
3093
3166
|
linear: function( p, n, firstNum, diff ) {
|
3094
3167
|
return firstNum + diff * p;
|
@@ -3097,7 +3170,7 @@ jQuery.extend({
|
|
3097
3170
|
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
|
3098
3171
|
}
|
3099
3172
|
},
|
3100
|
-
|
3173
|
+
|
3101
3174
|
timers: [],
|
3102
3175
|
timerId: null,
|
3103
3176
|
|
@@ -3117,7 +3190,7 @@ jQuery.fx.prototype = {
|
|
3117
3190
|
// Simple function for setting a style value
|
3118
3191
|
update: function(){
|
3119
3192
|
if ( this.options.step )
|
3120
|
-
this.options.step.
|
3193
|
+
this.options.step.call( this.elem, this.now, this );
|
3121
3194
|
|
3122
3195
|
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
|
3123
3196
|
|
@@ -3137,7 +3210,7 @@ jQuery.fx.prototype = {
|
|
3137
3210
|
|
3138
3211
|
// Start an animation from one number to another
|
3139
3212
|
custom: function(from, to, unit){
|
3140
|
-
this.startTime = (
|
3213
|
+
this.startTime = now();
|
3141
3214
|
this.start = from;
|
3142
3215
|
this.end = to;
|
3143
3216
|
this.unit = unit || this.unit || "px";
|
@@ -3157,7 +3230,7 @@ jQuery.fx.prototype = {
|
|
3157
3230
|
if ( jQuery.timerId == null ) {
|
3158
3231
|
jQuery.timerId = setInterval(function(){
|
3159
3232
|
var timers = jQuery.timers;
|
3160
|
-
|
3233
|
+
|
3161
3234
|
for ( var i = 0; i < timers.length; i++ )
|
3162
3235
|
if ( !timers[i]() )
|
3163
3236
|
timers.splice(i--, 1);
|
@@ -3183,7 +3256,7 @@ jQuery.fx.prototype = {
|
|
3183
3256
|
// flash of content
|
3184
3257
|
if ( this.prop == "width" || this.prop == "height" )
|
3185
3258
|
this.elem.style[this.prop] = "1px";
|
3186
|
-
|
3259
|
+
|
3187
3260
|
// Start by showing the element
|
3188
3261
|
jQuery(this.elem).show();
|
3189
3262
|
},
|
@@ -3200,7 +3273,7 @@ jQuery.fx.prototype = {
|
|
3200
3273
|
|
3201
3274
|
// Each step of an animation
|
3202
3275
|
step: function(gotoEnd){
|
3203
|
-
var t = (
|
3276
|
+
var t = now();
|
3204
3277
|
|
3205
3278
|
if ( gotoEnd || t > this.options.duration + this.startTime ) {
|
3206
3279
|
this.now = this.end;
|
@@ -3218,7 +3291,7 @@ jQuery.fx.prototype = {
|
|
3218
3291
|
if ( this.options.display != null ) {
|
3219
3292
|
// Reset the overflow
|
3220
3293
|
this.elem.style.overflow = this.options.overflow;
|
3221
|
-
|
3294
|
+
|
3222
3295
|
// Reset the display
|
3223
3296
|
this.elem.style.display = this.options.display;
|
3224
3297
|
if ( jQuery.css(this.elem, "display") == "none" )
|
@@ -3235,10 +3308,9 @@ jQuery.fx.prototype = {
|
|
3235
3308
|
jQuery.attr(this.elem.style, p, this.options.orig[p]);
|
3236
3309
|
}
|
3237
3310
|
|
3238
|
-
|
3239
|
-
if ( done && jQuery.isFunction( this.options.complete ) )
|
3311
|
+
if ( done )
|
3240
3312
|
// Execute the complete function
|
3241
|
-
this.options.complete.
|
3313
|
+
this.options.complete.call( this.elem );
|
3242
3314
|
|
3243
3315
|
return false;
|
3244
3316
|
} else {
|
@@ -3258,45 +3330,54 @@ jQuery.fx.prototype = {
|
|
3258
3330
|
|
3259
3331
|
};
|
3260
3332
|
|
3261
|
-
jQuery.fx
|
3262
|
-
|
3263
|
-
|
3333
|
+
jQuery.extend( jQuery.fx, {
|
3334
|
+
speeds:{
|
3335
|
+
slow: 600,
|
3336
|
+
fast: 200,
|
3337
|
+
// Default speed
|
3338
|
+
def: 400
|
3264
3339
|
},
|
3340
|
+
step: {
|
3341
|
+
scrollLeft: function(fx){
|
3342
|
+
fx.elem.scrollLeft = fx.now;
|
3343
|
+
},
|
3265
3344
|
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3345
|
+
scrollTop: function(fx){
|
3346
|
+
fx.elem.scrollTop = fx.now;
|
3347
|
+
},
|
3269
3348
|
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3349
|
+
opacity: function(fx){
|
3350
|
+
jQuery.attr(fx.elem.style, "opacity", fx.now);
|
3351
|
+
},
|
3273
3352
|
|
3274
|
-
|
3275
|
-
|
3353
|
+
_default: function(fx){
|
3354
|
+
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
|
3355
|
+
}
|
3276
3356
|
}
|
3277
|
-
};
|
3357
|
+
});
|
3278
3358
|
// The Offset Method
|
3279
3359
|
// Originally By Brandon Aaron, part of the Dimension Plugin
|
3280
3360
|
// http://jquery.com/plugins/project/dimensions
|
3281
3361
|
jQuery.fn.offset = function() {
|
3282
3362
|
var left = 0, top = 0, elem = this[0], results;
|
3283
|
-
|
3363
|
+
|
3284
3364
|
if ( elem ) with ( jQuery.browser ) {
|
3285
|
-
var parent = elem.parentNode,
|
3365
|
+
var parent = elem.parentNode,
|
3286
3366
|
offsetChild = elem,
|
3287
|
-
offsetParent = elem.offsetParent,
|
3367
|
+
offsetParent = elem.offsetParent,
|
3288
3368
|
doc = elem.ownerDocument,
|
3289
|
-
safari2 = safari && parseInt(version) < 522,
|
3290
|
-
|
3291
|
-
|
3369
|
+
safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
|
3370
|
+
css = jQuery.curCSS,
|
3371
|
+
fixed = css(elem, "position") == "fixed";
|
3372
|
+
|
3292
3373
|
// Use getBoundingClientRect if available
|
3293
3374
|
if ( elem.getBoundingClientRect ) {
|
3294
3375
|
var box = elem.getBoundingClientRect();
|
3295
|
-
|
3376
|
+
|
3296
3377
|
// Add the document scroll offsets
|
3297
3378
|
add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
|
3298
3379
|
box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
|
3299
|
-
|
3380
|
+
|
3300
3381
|
// IE adds the HTML element's border, by default it is medium which is 2px
|
3301
3382
|
// IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
|
3302
3383
|
// IE 7 standards mode, the border is always 2px
|
@@ -3304,54 +3385,54 @@ jQuery.fn.offset = function() {
|
|
3304
3385
|
// However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
|
3305
3386
|
// Therefore this method will be off by 2px in IE while in quirksmode
|
3306
3387
|
add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
|
3307
|
-
|
3388
|
+
|
3308
3389
|
// Otherwise loop through the offsetParents and parentNodes
|
3309
3390
|
} else {
|
3310
|
-
|
3391
|
+
|
3311
3392
|
// Initial element offsets
|
3312
3393
|
add( elem.offsetLeft, elem.offsetTop );
|
3313
|
-
|
3394
|
+
|
3314
3395
|
// Get parent offsets
|
3315
3396
|
while ( offsetParent ) {
|
3316
3397
|
// Add offsetParent offsets
|
3317
3398
|
add( offsetParent.offsetLeft, offsetParent.offsetTop );
|
3318
|
-
|
3399
|
+
|
3319
3400
|
// Mozilla and Safari > 2 does not include the border on offset parents
|
3320
3401
|
// However Mozilla adds the border for table or table cells
|
3321
3402
|
if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
|
3322
3403
|
border( offsetParent );
|
3323
|
-
|
3404
|
+
|
3324
3405
|
// Add the document scroll offsets if position is fixed on any offsetParent
|
3325
|
-
if ( !fixed &&
|
3406
|
+
if ( !fixed && css(offsetParent, "position") == "fixed" )
|
3326
3407
|
fixed = true;
|
3327
|
-
|
3408
|
+
|
3328
3409
|
// Set offsetChild to previous offsetParent unless it is the body element
|
3329
3410
|
offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
|
3330
3411
|
// Get next offsetParent
|
3331
3412
|
offsetParent = offsetParent.offsetParent;
|
3332
3413
|
}
|
3333
|
-
|
3414
|
+
|
3334
3415
|
// Get parent scroll offsets
|
3335
3416
|
while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
|
3336
3417
|
// Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
|
3337
|
-
if ( !/^inline|table.*$/i.test(
|
3418
|
+
if ( !/^inline|table.*$/i.test(css(parent, "display")) )
|
3338
3419
|
// Subtract parent scroll offsets
|
3339
3420
|
add( -parent.scrollLeft, -parent.scrollTop );
|
3340
|
-
|
3421
|
+
|
3341
3422
|
// Mozilla does not add the border for a parent that has overflow != visible
|
3342
|
-
if ( mozilla &&
|
3423
|
+
if ( mozilla && css(parent, "overflow") != "visible" )
|
3343
3424
|
border( parent );
|
3344
|
-
|
3425
|
+
|
3345
3426
|
// Get next parent
|
3346
3427
|
parent = parent.parentNode;
|
3347
3428
|
}
|
3348
|
-
|
3429
|
+
|
3349
3430
|
// Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
|
3350
3431
|
// Mozilla doubles body offsets with a non-absolutely positioned offsetChild
|
3351
|
-
if ( (safari2 && (fixed ||
|
3352
|
-
(mozilla &&
|
3432
|
+
if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
|
3433
|
+
(mozilla && css(offsetChild, "position") != "absolute") )
|
3353
3434
|
add( -doc.body.offsetLeft, -doc.body.offsetTop );
|
3354
|
-
|
3435
|
+
|
3355
3436
|
// Add the document scroll offsets if position is fixed
|
3356
3437
|
if ( fixed )
|
3357
3438
|
add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
|
@@ -3367,10 +3448,102 @@ jQuery.fn.offset = function() {
|
|
3367
3448
|
}
|
3368
3449
|
|
3369
3450
|
function add(l, t) {
|
3370
|
-
left += parseInt(l) || 0;
|
3371
|
-
top += parseInt(t) || 0;
|
3451
|
+
left += parseInt(l, 10) || 0;
|
3452
|
+
top += parseInt(t, 10) || 0;
|
3372
3453
|
}
|
3373
3454
|
|
3374
3455
|
return results;
|
3375
3456
|
};
|
3376
|
-
|
3457
|
+
|
3458
|
+
|
3459
|
+
jQuery.fn.extend({
|
3460
|
+
position: function() {
|
3461
|
+
var left = 0, top = 0, results;
|
3462
|
+
|
3463
|
+
if ( this[0] ) {
|
3464
|
+
// Get *real* offsetParent
|
3465
|
+
var offsetParent = this.offsetParent(),
|
3466
|
+
|
3467
|
+
// Get correct offsets
|
3468
|
+
offset = this.offset(),
|
3469
|
+
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
|
3470
|
+
|
3471
|
+
// Subtract element margins
|
3472
|
+
// note: when an element has margin: auto the offsetLeft and marginLeft
|
3473
|
+
// are the same in Safari causing offset.left to incorrectly be 0
|
3474
|
+
offset.top -= num( this, 'marginTop' );
|
3475
|
+
offset.left -= num( this, 'marginLeft' );
|
3476
|
+
|
3477
|
+
// Add offsetParent borders
|
3478
|
+
parentOffset.top += num( offsetParent, 'borderTopWidth' );
|
3479
|
+
parentOffset.left += num( offsetParent, 'borderLeftWidth' );
|
3480
|
+
|
3481
|
+
// Subtract the two offsets
|
3482
|
+
results = {
|
3483
|
+
top: offset.top - parentOffset.top,
|
3484
|
+
left: offset.left - parentOffset.left
|
3485
|
+
};
|
3486
|
+
}
|
3487
|
+
|
3488
|
+
return results;
|
3489
|
+
},
|
3490
|
+
|
3491
|
+
offsetParent: function() {
|
3492
|
+
var offsetParent = this[0].offsetParent;
|
3493
|
+
while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
|
3494
|
+
offsetParent = offsetParent.offsetParent;
|
3495
|
+
return jQuery(offsetParent);
|
3496
|
+
}
|
3497
|
+
});
|
3498
|
+
|
3499
|
+
|
3500
|
+
// Create scrollLeft and scrollTop methods
|
3501
|
+
jQuery.each( ['Left', 'Top'], function(i, name) {
|
3502
|
+
var method = 'scroll' + name;
|
3503
|
+
|
3504
|
+
jQuery.fn[ method ] = function(val) {
|
3505
|
+
if (!this[0]) return;
|
3506
|
+
|
3507
|
+
return val != undefined ?
|
3508
|
+
|
3509
|
+
// Set the scroll offset
|
3510
|
+
this.each(function() {
|
3511
|
+
this == window || this == document ?
|
3512
|
+
window.scrollTo(
|
3513
|
+
!i ? val : jQuery(window).scrollLeft(),
|
3514
|
+
i ? val : jQuery(window).scrollTop()
|
3515
|
+
) :
|
3516
|
+
this[ method ] = val;
|
3517
|
+
}) :
|
3518
|
+
|
3519
|
+
// Return the scroll offset
|
3520
|
+
this[0] == window || this[0] == document ?
|
3521
|
+
self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
|
3522
|
+
jQuery.boxModel && document.documentElement[ method ] ||
|
3523
|
+
document.body[ method ] :
|
3524
|
+
this[0][ method ];
|
3525
|
+
};
|
3526
|
+
});
|
3527
|
+
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
|
3528
|
+
jQuery.each([ "Height", "Width" ], function(i, name){
|
3529
|
+
|
3530
|
+
var tl = i ? "Left" : "Top", // top or left
|
3531
|
+
br = i ? "Right" : "Bottom"; // bottom or right
|
3532
|
+
|
3533
|
+
// innerHeight and innerWidth
|
3534
|
+
jQuery.fn["inner" + name] = function(){
|
3535
|
+
return this[ name.toLowerCase() ]() +
|
3536
|
+
num(this, "padding" + tl) +
|
3537
|
+
num(this, "padding" + br);
|
3538
|
+
};
|
3539
|
+
|
3540
|
+
// outerHeight and outerWidth
|
3541
|
+
jQuery.fn["outer" + name] = function(margin) {
|
3542
|
+
return this["inner" + name]() +
|
3543
|
+
num(this, "border" + tl + "Width") +
|
3544
|
+
num(this, "border" + br + "Width") +
|
3545
|
+
(margin ?
|
3546
|
+
num(this, "margin" + tl) + num(this, "margin" + br) : 0);
|
3547
|
+
};
|
3548
|
+
|
3549
|
+
});})();
|