From 17b9f93e65373450d30b1e294d4016c4e5524eb0 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 7 Nov 2012 01:57:48 +0100 Subject: [PATCH] Remove JavaScriptMVC app, replaced by CanJS --- .../javascriptmvc/jquery/README | 24 - .../javascriptmvc/jquery/build.js | 153 - .../javascriptmvc/jquery/buildAll.js | 105 - .../javascriptmvc/jquery/class/class.html | 109 - .../javascriptmvc/jquery/class/class.js | 695 - .../javascriptmvc/jquery/class/class_test.js | 206 - .../javascriptmvc/jquery/class/qunit.html | 15 - .../jquery/controller/controller.html | 89 - .../jquery/controller/controller.js | 905 - .../jquery/controller/controller_test.js | 239 - .../jquery/controller/history/history.html | 126 - .../jquery/controller/history/history.js | 187 - .../jquery/controller/history/html5/html5.js | 31 - .../controller/history/html5/qunit.html | 21 - .../controller/history/html5/qunit/qunit.js | 82 - .../jquery/controller/history/qunit.html | 21 - .../jquery/controller/history/qunit/qunit.js | 38 - .../jquery/controller/pages/document.js | 65 - .../jquery/controller/pages/listening.js | 192 - .../jquery/controller/pages/plugin.js | 104 - .../jquery/controller/qunit.html | 21 - .../jquery/controller/subscribe/funcunit.html | 21 - .../controller/subscribe/subscribe.html | 56 - .../jquery/controller/subscribe/subscribe.js | 53 - .../jquery/controller/view/qunit.html | 21 - .../view/test/qunit/controller_view_test.js | 22 - .../controller/view/test/qunit/qunit.js | 6 - .../view/test/qunit/views/init.micro | 1 - .../jquery/controller/view/view.js | 110 - .../jquery/dom/closest/closest.js | 47 - .../jquery/dom/compare/compare.html | 88 - .../jquery/dom/compare/compare.js | 81 - .../jquery/dom/compare/compare_test.js | 25 - .../jquery/dom/compare/qunit.html | 20 - .../javascriptmvc/jquery/dom/cookie/cookie.js | 119 - .../jquery/dom/cur_styles/cur_styles.html | 71 - .../jquery/dom/cur_styles/cur_styles.js | 117 - .../jquery/dom/cur_styles/cur_styles_test.js | 29 - .../jquery/dom/cur_styles/qunit.html | 22 - .../dom/cur_styles/test/curStyles.micro | 3 - .../jquery/dom/dimensions/dimensions.html | 132 - .../jquery/dom/dimensions/dimensions.js | 140 - .../jquery/dom/dimensions/qunit.html | 22 - .../dom/dimensions/test/qunit/curStyles.micro | 3 - .../dimensions/test/qunit/dimensions_test.js | 8 - .../dom/dimensions/test/qunit/outer.micro | 0 .../jquery/dom/dimensions/test/qunit/qunit.js | 4 - .../javascriptmvc/jquery/dom/dom.js | 73 - .../jquery/dom/fixture/fixture.html | 143 - .../jquery/dom/fixture/fixture.js | 800 - .../jquery/dom/fixture/fixture_test.js | 170 - .../jquery/dom/fixture/fixtures/foo.json | 1 - .../jquery/dom/fixture/fixtures/foobar.json | 3 - .../jquery/dom/fixture/fixtures/messages.html | 31 - .../jquery/dom/fixture/fixtures/test.json | 3 - .../jquery/dom/fixture/qunit.html | 22 - .../jquery/dom/form_params/form_params.html | 58 - .../jquery/dom/form_params/form_params.js | 111 - .../jquery/dom/form_params/qunit.html | 22 - .../dom/form_params/test/qunit/basics.micro | 27 - .../dom/form_params/test/qunit/checkbox.micro | 20 - .../test/qunit/form_params_test.js | 43 - .../dom/form_params/test/qunit/qunit.js | 4 - .../dom/form_params/test/qunit/truthy.micro | 8 - .../javascriptmvc/jquery/dom/range/qunit.html | 20 - .../javascriptmvc/jquery/dom/range/range.html | 62 - .../javascriptmvc/jquery/dom/range/range.js | 523 - .../jquery/dom/range/range_test.js | 0 .../jquery/dom/selection/qunit.html | 20 - .../jquery/dom/selection/selection.html | 78 - .../jquery/dom/selection/selection.js | 236 - .../jquery/dom/selection/selection_test.js | 40 - .../javascriptmvc/jquery/dom/within/within.js | 71 - .../javascriptmvc/jquery/download/btn.png | Bin 786 -> 0 bytes .../jquery/download/download.css | 88 - .../jquery/download/download.html | 418 - .../javascriptmvc/jquery/download/download.js | 102 - .../jquery/download/test/controllerpage.html | 15 - .../jquery/download/test/jquery-1.4.3.js | 6883 ----- .../javascriptmvc/jquery/download/test/run.js | 16 - .../jquery/event/default/default.html | 85 - .../jquery/event/default/default.js | 220 - .../event/default/default_pause_test.html | 22 - .../event/default/default_pause_test.js | 98 - .../jquery/event/default/default_test.js | 131 - .../jquery/event/default/defaultjquery.html | 117 - .../jquery/event/default/qunit.html | 22 - .../jquery/event/destroyed/destroyed.html | 24 - .../jquery/event/destroyed/destroyed.js | 40 - .../event/destroyed/destroyed_menu.html | 96 - .../jquery/event/destroyed/qunit.html | 21 - .../destroyed/test/qunit/destroyed_test.js | 12 - .../event/destroyed/test/qunit/qunit.js | 6 - .../javascriptmvc/jquery/event/drag/drag.html | 120 - .../javascriptmvc/jquery/event/drag/drag.js | 573 - .../jquery/event/drag/drag_test.js | 236 - .../jquery/event/drag/limit/limit.html | 76 - .../jquery/event/drag/limit/limit.js | 69 - .../jquery/event/drag/qunit.html | 16 - .../jquery/event/drag/scroll/scroll.js | 122 - .../jquery/event/drag/step/step.html | 68 - .../jquery/event/drag/step/step.js | 77 - .../javascriptmvc/jquery/event/drop/drop.html | 74 - .../javascriptmvc/jquery/event/drop/drop.js | 424 - .../jquery/event/drop/drop_test.js | 41 - .../javascriptmvc/jquery/event/event.js | 40 - .../jquery/event/handle/handle.js | 85 - .../jquery/event/hashchange/hashchange.js | 245 - .../jquery/event/hover/hover.html | 62 - .../javascriptmvc/jquery/event/hover/hover.js | 251 - .../jquery/event/hover/qunit.html | 16 - .../event/hover/test/qunit/hover_test.js | 55 - .../jquery/event/hover/test/qunit/qunit.js | 4 - .../javascriptmvc/jquery/event/key/key.html | 32 - .../javascriptmvc/jquery/event/key/key.js | 160 - .../jquery/event/key/key_test.js | 26 - .../javascriptmvc/jquery/event/key/qunit.html | 16 - .../jquery/event/livehack/livehack.js | 167 - .../jquery/event/pause/pause.html | 216 - .../javascriptmvc/jquery/event/pause/pause.js | 227 - .../jquery/event/pause/pause_test.js | 51 - .../jquery/event/pause/qunit.html | 20 - .../jquery/event/resize/demo.html | 149 - .../jquery/event/resize/qunit.html | 17 - .../jquery/event/resize/resize.html | 47 - .../jquery/event/resize/resize.js | 159 - .../jquery/event/resize/resize_test.js | 69 - .../jquery/event/selection/qunit.html | 20 - .../jquery/event/selection/selection.html | 101 - .../jquery/event/selection/selection.js | 96 - .../jquery/event/selection/selection_test.js | 40 - .../jquery/event/swipe/qunit.html | 20 - .../jquery/event/swipe/swipe.html | 52 - .../javascriptmvc/jquery/event/swipe/swipe.js | 101 - .../jquery/event/swipe/swipe_test.js | 110 - .../javascriptmvc/jquery/generate/app | 21 - .../javascriptmvc/jquery/generate/controller | 35 - .../javascriptmvc/jquery/generate/model | 26 - .../javascriptmvc/jquery/generate/page | 21 - .../javascriptmvc/jquery/generate/plugin | 20 - .../javascriptmvc/jquery/generate/scaffold | 50 - .../templates/app/(application_name).css.ejs | 2 - .../templates/app/(application_name).html.ejs | 17 - .../templates/app/(application_name).js.ejs | 18 - .../templates/app/controllers/.ignore | 0 .../generate/templates/app/docs/.ignore | 0 .../generate/templates/app/fixtures/.ignore | 0 .../generate/templates/app/funcunit.html.ejs | 14 - .../generate/templates/app/models/.ignore | 0 .../generate/templates/app/qunit.html.ejs | 20 - .../generate/templates/app/resources/.ignore | 0 .../templates/app/scripts/build.html.ejs | 21 - .../templates/app/scripts/build.js.ejs | 6 - .../templates/app/scripts/clean.js.ejs | 17 - .../templates/app/scripts/docs.js.ejs | 6 - .../funcunit/(application_name)_test.js.ejs | 9 - .../app/test/funcunit/funcunit.js.ejs | 3 - .../test/qunit/(application_name)_test.js.ejs | 5 - .../templates/app/test/qunit/qunit.js.ejs | 3 - .../generate/templates/app/views/.ignore | 0 .../controller/(underscore).html.ejs | 23 - .../templates/controller/(underscore).js.ejs | 20 - .../controller/(underscore)_test.js.ejs | 14 - .../templates/controller/funcunit.html.ejs | 15 - .../templates/controller/views/.ignore | 0 .../generate/templates/model/fixtures.link | 1 - .../generate/templates/model/models.link | 1 - .../generate/templates/model/test/qunit.link | 1 - .../jquery/generate/templates/page.ejs | 23 - .../plugin/(application_name).html.ejs | 23 - .../plugin/(application_name).js.ejs | 3 - .../templates/plugin/fixtures/.ignore | 0 .../templates/plugin/funcunit.html.ejs | 15 - .../generate/templates/plugin/qunit.html.ejs | 20 - .../templates/plugin/resources/.ignore | 0 .../generate/templates/plugin/scripts.link | 1 - .../generate/templates/plugin/test.link | 1 - .../generate/templates/plugin/views/.ignore | 0 .../(underscore)_controller.js.ejs | 98 - .../scaffold/fixtures/(plural).json.get.ejs | 3 - .../scaffold/models/(underscore).js.ejs | 82 - .../(underscore)_controller_test.js.ejs | 61 - .../test/qunit/(underscore)_test.js.ejs | 45 - .../scaffold/views/(underscore)/edit.ejs.ejs | 10 - .../scaffold/views/(underscore)/init.ejs.ejs | 26 - .../scaffold/views/(underscore)/list.ejs.ejs | 5 - .../scaffold/views/(underscore)/show.ejs.ejs | 10 - .../test/app_plugin_model_controller.js | 61 - .../javascriptmvc/jquery/generate/test/run.js | 3 - .../jquery/generate/test/scaffold.js | 87 - .../javascriptmvc/jquery/jquery.js | 8936 ------ .../jquery/lang/deparam/deparam.js | 68 - .../jquery/lang/deparam/deparam_test.js | 33 - .../jquery/lang/deparam/qunit.html | 17 - .../javascriptmvc/jquery/lang/json/json.js | 201 - .../javascriptmvc/jquery/lang/lang.html | 27 - .../javascriptmvc/jquery/lang/lang.js | 160 - .../javascriptmvc/jquery/lang/lang_test.js | 34 - .../jquery/lang/openajax/openajax.html | 24 - .../jquery/lang/openajax/openajax.js | 202 - .../javascriptmvc/jquery/lang/qunit.html | 17 - .../jquery/lang/rsplit/rsplit.js | 35 - .../jquery/lang/vector/vector.js | 154 - .../model/associations/associations.html | 113 - .../jquery/model/associations/associations.js | 191 - .../jquery/model/associations/qunit.html | 21 - .../test/qunit/associations_test.js | 51 - .../model/associations/test/qunit/qunit.js | 9 - .../jquery/model/backup/backup.html | 126 - .../jquery/model/backup/backup.js | 142 - .../jquery/model/backup/qunit.html | 21 - .../jquery/model/backup/qunit/qunit.js | 100 - .../jquery/model/demo-convert.html | 73 - .../javascriptmvc/jquery/model/demo-dom.html | 96 - .../jquery/model/demo-encapsulate.html | 159 - .../jquery/model/demo-events.html | 179 - .../jquery/model/demo-setter.html | 77 - .../jquery/model/fixtures/school.json | 4 - .../jquery/model/fixtures/schools.json | 4 - .../jquery/model/guesstype/guesstype.js | 37 - .../jquery/model/guesstype/guesstype_test.js | 12 - .../jquery/model/list/cookie/cookie.html | 117 - .../jquery/model/list/cookie/cookie.js | 91 - .../jquery/model/list/cookie/qunit.html | 21 - .../jquery/model/list/cookie/qunit/qunit.js | 27 - .../jquery/model/list/list-insert.html | 134 - .../javascriptmvc/jquery/model/list/list.html | 129 - .../javascriptmvc/jquery/model/list/list.js | 423 - .../jquery/model/list/local/local.js | 41 - .../jquery/model/list/memory.html | 93 - .../jquery/model/list/qunit.html | 16 - .../jquery/model/list/test/qunit/list_test.js | 101 - .../jquery/model/list/test/qunit/qunit.js | 6 - .../javascriptmvc/jquery/model/model.js | 1648 - .../jquery/model/modelBinder.html | 92 - .../jquery/model/pages/deferreds.js | 51 - .../jquery/model/pages/encapsulate.js | 190 - .../jquery/model/pages/events.js | 78 - .../jquery/model/pages/typeconversion.js | 64 - .../javascriptmvc/jquery/model/qunit.html | 17 - .../model/service/json_rest/json_rest.js | 109 - .../jquery/model/service/service.js | 30 - .../jquery/model/service/twitter/twitter.html | 31 - .../jquery/model/service/twitter/twitter.js | 43 - .../jquery/model/service/yql/yql.html | 27 - .../jquery/model/service/yql/yql.js | 66 - .../javascriptmvc/jquery/model/test/4.json | 4 - .../jquery/model/test/create.json | 4 - .../jquery/model/test/people.json | 4 - .../jquery/model/test/person.json | 4 - .../jquery/model/test/qunit/findAll.json | 4 - .../jquery/model/test/qunit/model_test.js | 390 - .../jquery/model/test/qunit/qunit.js | 10 - .../jquery/model/test/schools.json | 4 - .../jquery/model/test/update4.json | 4 - .../jquery/model/validations/qunit.html | 17 - .../validations/qunit/validations_test.js | 151 - .../jquery/model/validations/validations.html | 132 - .../jquery/model/validations/validations.js | 178 - .../javascriptmvc/jquery/qunit.html | 15 - .../jquery/test/qunit/integration.js | 69 - .../javascriptmvc/jquery/test/qunit/qunit.js | 36 - .../javascriptmvc/jquery/test/run.js | 8 - .../javascriptmvc/jquery/test/template.ejs | 1 - .../javascriptmvc/jquery/test/thing.json | 4 - .../javascriptmvc/jquery/tie/qunit.html | 20 - .../javascriptmvc/jquery/tie/tie.html | 117 - .../javascriptmvc/jquery/tie/tie.js | 93 - .../javascriptmvc/jquery/tie/tie_test.js | 125 - .../javascriptmvc/jquery/update | 5 - .../javascriptmvc/jquery/view/compress.js | 7 - .../javascriptmvc/jquery/view/ejs/ejs.html | 25 - .../javascriptmvc/jquery/view/ejs/ejs.js | 523 - .../jquery/view/ejs/funcunit.html | 21 - .../javascriptmvc/jquery/view/ejs/other.js | 47 - .../javascriptmvc/jquery/view/ejs/qunit.html | 21 - .../jquery/view/ejs/test/qunit/ejs_test.js | 74 - .../jquery/view/ejs/test/qunit/qunit.js | 6 - .../javascriptmvc/jquery/view/fulljslint.js | 3774 --- .../jquery/view/helpers/helpers.js | 348 - .../javascriptmvc/jquery/view/jaml/jaml.js | 372 - .../javascriptmvc/jquery/view/micro/micro.js | 81 - .../javascriptmvc/jquery/view/qunit.html | 16 - .../view/test/compression/compression.html | 12 - .../view/test/compression/compression.js | 11 - .../jquery/view/test/compression/run.js | 49 - .../view/test/compression/views/keep.me | 0 .../jquery/view/test/qunit/deferred.ejs | 1 - .../jquery/view/test/qunit/deferreds.ejs | 1 - .../jquery/view/test/qunit/hookup.ejs | 1 - .../jquery/view/test/qunit/large.ejs | 373 - .../jquery/view/test/qunit/nested_plugin.ejs | 1 - .../jquery/view/test/qunit/plugin.ejs | 1 - .../jquery/view/test/qunit/qunit.js | 9 - .../jquery/view/test/qunit/temp.ejs | 1 - .../jquery/view/test/qunit/template.ejs | 1 - .../jquery/view/test/qunit/template.jaml | 3 - .../jquery/view/test/qunit/template.micro | 1 - .../jquery/view/test/qunit/template.tmpl | 1 - .../jquery/view/test/qunit/view_test.js | 150 - .../javascriptmvc/jquery/view/tmpl/test.tmpl | 1 - .../javascriptmvc/jquery/view/tmpl/tmpl.js | 523 - .../jquery/view/tmpl/tmpl_test.js | 11 - .../javascriptmvc/jquery/view/view.html | 80 - .../javascriptmvc/jquery/view/view.js | 668 - .../javascriptmvc/readme.md | 117 - .../javascriptmvc/steal/README | 29 - .../javascriptmvc/steal/buildjs | 19 - .../javascriptmvc/steal/clean/beautify.js | 1116 - .../javascriptmvc/steal/clean/clean.js | 182 - .../javascriptmvc/steal/clean/jslint.js | 5665 ---- .../steal/clean/test/clean_test.js | 27 - .../javascriptmvc/steal/clean/test/test.js | 7 - .../javascriptmvc/steal/clean/test/testEnd.js | 5 - .../javascriptmvc/steal/cleanjs | 5 - .../steal/coffee/coffee-script.js | 9 - .../javascriptmvc/steal/coffee/coffee.js | 62 - .../javascriptmvc/steal/dev/dev.js | 95 - .../javascriptmvc/steal/end.js | 1 - .../javascriptmvc/steal/generate/app | 21 - .../javascriptmvc/steal/generate/ejs.js | 531 - .../javascriptmvc/steal/generate/generate.js | 218 - .../javascriptmvc/steal/generate/inflector.js | 108 - .../javascriptmvc/steal/generate/system.js | 32 - .../templates/app/(application_name).css.ejs | 10 - .../templates/app/(application_name).html.ejs | 18 - .../templates/app/(application_name).js.ejs | 10 - .../steal/generate/templates/app/docs/.ignore | 0 .../generate/templates/app/resources/.ignore | 0 .../app/resources/example.coffee.ejs | 5 - .../templates/app/resources/example.js.ejs | 13 - .../templates/app/resources/example.less.ejs | 9 - .../templates/app/scripts/build.html.ejs | 21 - .../templates/app/scripts/build.js.ejs | 6 - .../templates/app/scripts/clean.js.ejs | 6 - .../steal/generate/templates/app/test/.ignore | 0 .../steal/generate/templates/page.ejs | 23 - .../javascriptmvc/steal/generate/test/run.js | 28 - .../javascriptmvc/steal/get/basic.js | 26 - .../javascriptmvc/steal/get/dummysteal.js | 54 - .../javascriptmvc/steal/get/get.js | 514 - .../javascriptmvc/steal/get/gets.json | 15 - .../javascriptmvc/steal/get/git.js | 100 - .../javascriptmvc/steal/get/json.js | 172 - .../javascriptmvc/steal/get/test/.gitignore | 5 - .../javascriptmvc/steal/get/test/.gitmodules | 4 - .../javascriptmvc/steal/get/test/README | 17 - .../javascriptmvc/steal/get/test/get_test.js | 163 - .../steal/get/test/stealCode1.js | 10 - .../javascriptmvc/steal/getjs | 5 - .../javascriptmvc/steal/js | 67 - .../javascriptmvc/steal/js.bat | 68 - .../javascriptmvc/steal/less/less.js | 123 - .../javascriptmvc/steal/less/less.less | 5 - .../javascriptmvc/steal/less/less_engine.js | 2613 -- .../javascriptmvc/steal/less/less_test.js | 17 - .../javascriptmvc/steal/less/qunit.html | 22 - .../javascriptmvc/steal/make.js | 5 - .../javascriptmvc/steal/parse/parse.js | 233 - .../javascriptmvc/steal/parse/parse_test.js | 76 - .../steal/parse/test/stealCode1.js | 10 - .../steal/parse/test/testCode.js | 17 - .../javascriptmvc/steal/parse/tokens.js | 349 - .../javascriptmvc/steal/patchfile | 43 - .../javascriptmvc/steal/pluginifyjs | 8 - .../javascriptmvc/steal/rhino/blank.html | 6 - .../javascriptmvc/steal/rhino/build.js | 30 - .../javascriptmvc/steal/rhino/docs.js | 68 - .../javascriptmvc/steal/rhino/empty.html | 12 - .../javascriptmvc/steal/rhino/env.js | 25391 ---------------- .../javascriptmvc/steal/rhino/file.js | 333 - .../javascriptmvc/steal/rhino/loader | 28 - .../javascriptmvc/steal/rhino/loader.bat | 45 - .../javascriptmvc/steal/rhino/loader.js | 14 - .../javascriptmvc/steal/rhino/prompt.js | 48 - .../javascriptmvc/steal/rhino/steal.js | 136 - .../javascriptmvc/steal/rhino/test.js | 16 - .../javascriptmvc/steal/rhino/utils.js | 39 - .../javascriptmvc/steal/steal.js | 1376 - .../javascriptmvc/steal/steal.production.js | 23 - .../javascriptmvc/steal/test/absoluteurl.html | 7 - .../steal/test/absoluteurl/absoluteurl.js | 1 - .../steal/test/absoluteurl/alert.js | 1 - .../javascriptmvc/steal/test/another/two.js | 2 - .../javascriptmvc/steal/test/funcunit.html | 14 - .../steal/test/funcunit/funcunit.js | 3 - .../steal/test/funcunit/steal_test.js | 6 - .../javascriptmvc/steal/test/one/four.js | 1 - .../javascriptmvc/steal/test/one/one.js | 6 - .../javascriptmvc/steal/test/qunit.html | 22 - .../javascriptmvc/steal/test/qunit/one.css | 4 - .../javascriptmvc/steal/test/qunit/qunit.js | 5 - .../steal/test/qunit/steal_test.js | 216 - .../javascriptmvc/steal/test/run.js | 13 - .../javascriptmvc/steal/test/steal.html | 37 - .../javascriptmvc/steal/test/test.js | 112 - .../javascriptmvc/steal/test/three.js | 3 - .../javascriptmvc/steal/test/two.css | 4 - .../javascriptmvc/steal/update | 5 - .../javascriptmvc/todo/todo/destroy.png | Bin 1222 -> 0 bytes .../javascriptmvc/todo/todo/funcunit.html | 15 - .../javascriptmvc/todo/todo/index.html | 59 - .../javascriptmvc/todo/todo/production.css | 1 - .../javascriptmvc/todo/todo/production.js | 267 - .../javascriptmvc/todo/todo/qunit.html | 20 - .../todo/todo/scripts/build.html | 21 - .../javascriptmvc/todo/todo/scripts/build.js | 6 - .../javascriptmvc/todo/todo/scripts/clean.js | 17 - .../javascriptmvc/todo/todo/scripts/docs.js | 6 - .../todo/todo/test/funcunit/funcunit.js | 3 - .../todo/todo/test/funcunit/todo_test.js | 13 - .../todo/todo/test/qunit/qunit.js | 3 - .../todo/todo/test/qunit/todo_test.js | 5 - .../javascriptmvc/todo/todo/todo.css | 165 - .../javascriptmvc/todo/todo/todo.html | 51 - .../javascriptmvc/todo/todo/todo.js | 254 - 416 files changed, 86823 deletions(-) delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/README delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/build.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/buildAll.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/class/class.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/class/class.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/class/class_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/class/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/controller.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/controller.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/controller_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/history/history.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/history/history.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/html5.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/qunit.html delete mode 100755 labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/history/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/history/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/pages/document.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/pages/listening.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/pages/plugin.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/funcunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/subscribe.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/subscribe.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/view/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/controller_view_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/views/init.micro delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/controller/view/view.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/closest/closest.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/compare/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/cookie/cookie.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/test/curStyles.micro delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/dimensions.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/dimensions.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/curStyles.micro delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/dimensions_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/outer.micro delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/dom.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/foo.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/foobar.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/messages.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/test.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/fixture/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/form_params/form_params.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/form_params/form_params.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/form_params/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/basics.micro delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/checkbox.micro delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/form_params_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/truthy.micro delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/range/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/range/range.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/range/range.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/range/range_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/selection/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/dom/within/within.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/download/btn.png delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/download/download.css delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/download/download.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/download/download.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/download/test/controllerpage.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/download/test/jquery-1.4.3.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/download/test/run.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/default/default.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/default/default.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/default/default_pause_test.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/default/default_pause_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/default/default_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/default/defaultjquery.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/default/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed_menu.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/destroyed/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/destroyed/test/qunit/destroyed_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/destroyed/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drag/drag.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drag/drag.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drag/drag_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drag/limit/limit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drag/limit/limit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drag/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drag/scroll/scroll.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drag/step/step.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drag/step/step.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drop/drop.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drop/drop.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/drop/drop_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/event.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/handle/handle.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/hashchange/hashchange.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/hover/hover.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/hover/hover.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/hover/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/hover/test/qunit/hover_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/hover/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/key/key.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/key/key.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/key/key_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/key/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/livehack/livehack.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/pause/pause.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/pause/pause.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/pause/pause_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/pause/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/resize/demo.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/resize/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/resize/resize.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/resize/resize.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/resize/resize_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/selection/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/selection/selection.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/selection/selection.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/selection/selection_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/swipe/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/swipe/swipe.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/swipe/swipe.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/event/swipe/swipe_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/app delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/controller delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/model delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/page delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/plugin delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/scaffold delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/(application_name).css.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/(application_name).html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/(application_name).js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/controllers/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/docs/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/fixtures/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/funcunit.html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/models/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/qunit.html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/resources/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/scripts/build.html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/scripts/build.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/scripts/clean.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/scripts/docs.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/test/funcunit/(application_name)_test.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/test/funcunit/funcunit.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/test/qunit/(application_name)_test.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/test/qunit/qunit.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/app/views/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/controller/(underscore).html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/controller/(underscore).js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/controller/(underscore)_test.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/controller/funcunit.html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/controller/views/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/model/fixtures.link delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/model/models.link delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/model/test/qunit.link delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/page.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/plugin/(application_name).html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/plugin/(application_name).js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/plugin/fixtures/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/plugin/funcunit.html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/plugin/qunit.html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/plugin/resources/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/plugin/scripts.link delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/plugin/test.link delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/plugin/views/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/scaffold/controllers/(underscore)_controller.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/scaffold/fixtures/(plural).json.get.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/scaffold/models/(underscore).js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/scaffold/test/funcunit/(underscore)_controller_test.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/scaffold/test/qunit/(underscore)_test.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/edit.ejs.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/init.ejs.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/list.ejs.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/show.ejs.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/test/app_plugin_model_controller.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/test/run.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/generate/test/scaffold.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/jquery.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/deparam/deparam.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/deparam/deparam_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/deparam/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/json/json.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/lang.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/lang.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/lang_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/openajax/openajax.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/openajax/openajax.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/rsplit/rsplit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/lang/vector/vector.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/associations/associations.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/associations/associations.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/associations/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/associations/test/qunit/associations_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/associations/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/backup/backup.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/backup/backup.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/backup/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/backup/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/demo-convert.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/demo-dom.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/demo-encapsulate.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/demo-events.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/demo-setter.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/fixtures/school.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/fixtures/schools.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/guesstype/guesstype.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/guesstype/guesstype_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/cookie/cookie.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/cookie/cookie.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/cookie/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/cookie/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/list-insert.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/list.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/list.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/local/local.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/memory.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/test/qunit/list_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/list/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/model.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/modelBinder.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/pages/deferreds.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/pages/encapsulate.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/pages/events.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/pages/typeconversion.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/service/json_rest/json_rest.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/service/service.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/service/twitter/twitter.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/service/twitter/twitter.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/service/yql/yql.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/service/yql/yql.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/test/4.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/test/create.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/test/people.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/test/person.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/test/qunit/findAll.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/test/qunit/model_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/test/schools.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/test/update4.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/validations/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/validations/qunit/validations_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/validations/validations.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/model/validations/validations.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/test/qunit/integration.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/test/run.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/test/template.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/test/thing.json delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/tie/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/tie/tie.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/tie/tie.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/tie/tie_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/update delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/compress.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/ejs/ejs.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/ejs/ejs.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/ejs/funcunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/ejs/other.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/ejs/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/ejs/test/qunit/ejs_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/ejs/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/fulljslint.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/helpers/helpers.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/jaml/jaml.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/micro/micro.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/compression/compression.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/compression/compression.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/compression/run.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/compression/views/keep.me delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/deferred.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/deferreds.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/hookup.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/large.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/nested_plugin.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/plugin.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/temp.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/template.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/template.jaml delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/template.micro delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/template.tmpl delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/test/qunit/view_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/tmpl/test.tmpl delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/tmpl/tmpl.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/tmpl/tmpl_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/view.html delete mode 100644 labs/architecture-examples/javascriptmvc/jquery/view/view.js delete mode 100644 labs/architecture-examples/javascriptmvc/readme.md delete mode 100644 labs/architecture-examples/javascriptmvc/steal/README delete mode 100644 labs/architecture-examples/javascriptmvc/steal/buildjs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/clean/beautify.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/clean/clean.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/clean/jslint.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/clean/test/clean_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/clean/test/test.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/clean/test/testEnd.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/cleanjs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/coffee/coffee-script.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/coffee/coffee.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/dev/dev.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/end.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/app delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/ejs.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/generate.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/inflector.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/system.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/(application_name).css.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/(application_name).html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/(application_name).js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/docs/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/resources/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/resources/example.coffee.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/resources/example.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/resources/example.less.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/scripts/build.html.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/scripts/build.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/scripts/clean.js.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/app/test/.ignore delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/templates/page.ejs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/generate/test/run.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/basic.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/dummysteal.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/get.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/gets.json delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/git.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/json.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/test/.gitignore delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/test/.gitmodules delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/test/README delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/test/get_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/get/test/stealCode1.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/getjs delete mode 100755 labs/architecture-examples/javascriptmvc/steal/js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/js.bat delete mode 100644 labs/architecture-examples/javascriptmvc/steal/less/less.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/less/less.less delete mode 100644 labs/architecture-examples/javascriptmvc/steal/less/less_engine.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/less/less_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/less/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/steal/make.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/parse/parse.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/parse/parse_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/parse/test/stealCode1.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/parse/test/testCode.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/parse/tokens.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/patchfile delete mode 100644 labs/architecture-examples/javascriptmvc/steal/pluginifyjs delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/blank.html delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/build.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/docs.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/empty.html delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/env.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/file.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/loader delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/loader.bat delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/loader.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/prompt.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/steal.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/test.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/rhino/utils.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/steal.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/steal.production.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/absoluteurl.html delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/absoluteurl/absoluteurl.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/absoluteurl/alert.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/another/two.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/funcunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/funcunit/funcunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/funcunit/steal_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/one/four.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/one/one.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/qunit/one.css delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/qunit/steal_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/run.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/steal.html delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/test.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/three.js delete mode 100644 labs/architecture-examples/javascriptmvc/steal/test/two.css delete mode 100644 labs/architecture-examples/javascriptmvc/steal/update delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/destroy.png delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/funcunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/index.html delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/production.css delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/production.js delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/qunit.html delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/scripts/build.html delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/scripts/build.js delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/scripts/clean.js delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/scripts/docs.js delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/test/funcunit/funcunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/test/funcunit/todo_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/test/qunit/qunit.js delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/test/qunit/todo_test.js delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/todo.css delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/todo.html delete mode 100644 labs/architecture-examples/javascriptmvc/todo/todo/todo.js diff --git a/labs/architecture-examples/javascriptmvc/jquery/README b/labs/architecture-examples/javascriptmvc/jquery/README deleted file mode 100644 index 12846a1783..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/README +++ /dev/null @@ -1,24 +0,0 @@ -TOC: - A. How to get (and contribute) to JMVC - - -A. How to get (and contribute) JMVC - - 1. Start a new project in git. - - 2. Fork .... - http://github.com/jupiterjs/steal and - http://github.com/jupiterjs/jquerymx - - 3. Add steal and javascriptmvc as submodules of your project... - git submodule add git@github.com:_YOU_/steal.git steal - git submodule add git@github.com:_YOU_/jquerymx.git jquery - - * Notice javascriptmvc is under the jquery folder - - 4. Learn a little more about submodules ... - http://johnleach.co.uk/words/archives/2008/10/12/323/git-submodules-in-n-easy-steps - - 5. Make changes in steal or jmvc, and push them back to your fork. - - 6. Make a pull request to your fork. diff --git a/labs/architecture-examples/javascriptmvc/jquery/build.js b/labs/architecture-examples/javascriptmvc/jquery/build.js deleted file mode 100644 index 60652aa3f0..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/build.js +++ /dev/null @@ -1,153 +0,0 @@ -// load('jquery/build.js') - -load('steal/rhino/steal.js') - -var i, fileName, cmd, - plugins = [ - "class" , - "controller", - { - plugin: "controller/subscribe", - exclude: ["jquery/controller/controller.js", - "jquery/class/class.js", - "jquery/lang/lang.js", - "jquery/event/destroyed/destroyed.js", - "jquery/controller/controller.js"]}, - "event/default", - "event/destroyed", - "event/drag", - "event/pause", - "event/resize", - { - plugin: "event/drag/limit", - exclude: ["jquery/lang/vector/vector.js", "jquery/event/livehack/livehack.js", "jquery/event/drag/drag.js"]}, - { - plugin: "event/drag/scroll", - exclude: ["jquery/dom/within/within.js", "jquery/dom/compare/compare.js", "jquery/event/drop/drop.js","jquery/lang/vector/vector.js", "jquery/event/livehack/livehack.js", "jquery/event/drag/drag.js"]}, - { - plugin: "event/drop", - exclude: ["jquery/lang/vector/vector.js", "jquery/event/livehack/livehack.js", "jquery/event/drag/drag.js"]}, - "event/hover", - "view/ejs", - "dom/closest", - "dom/compare", - { - plugin: "dom/dimensions", - fileName: "jquery.dimensions.etc.js" - }, - "dom/fixture", - "dom/form_params", - "dom/within", - "dom/cur_styles", - "model", - { - plugin: "model/associations", - exclude: ["jquery/class/class.js", - "jquery/lang/lang.js", - "jquery/event/destroyed/destroyed.js", - "jquery/lang/openajax/openajax.js", - "jquery/model/model.js"] - }, - { - plugin: "model/backup", - exclude: ["jquery/class/class.js", - "jquery/lang/lang.js", - "jquery/event/destroyed/destroyed.js", - "jquery/lang/openajax/openajax.js", - "jquery/model/model.js"] - }, - { - plugin: "model/list", - exclude: ["jquery/class/class.js", - "jquery/lang/lang.js", - "jquery/event/destroyed/destroyed.js", - "jquery/lang/openajax/openajax.js", - "jquery/model/model.js"] - }, - { - plugin: "model/list/cookie", - exclude: ["jquery/class/class.js", - "jquery/lang/lang.js", - "jquery/event/destroyed/destroyed.js", - "jquery/lang/openajax/openajax.js", - "jquery/model/model.js", - "jquery/model/list/list.js"] - }, - { - plugin: "model/list/local", - exclude: ["jquery/class/class.js", - "jquery/lang/lang.js", - "jquery/event/destroyed/destroyed.js", - "jquery/lang/openajax/openajax.js", - "jquery/model/model.js", - "jquery/model/list/list.js"] - }, - { - plugin: "model/validations", - exclude: ["jquery/class/class.js", - "jquery/lang/lang.js", - "jquery/event/destroyed/destroyed.js", - "jquery/lang/openajax/openajax.js", - "jquery/model/model.js"] - }, - "view", - "view/ejs", - "view/jaml", - "view/micro", - "view/tmpl" -] - - -steal.plugins('steal/build/pluginify').then( function(s){ -var plugin, exclude, fileDest, fileName; - for(i=0; i - - - jQuery.Class Demo - - - -

jQuery.Class Demo shows a tabs controller extended to work with history.

-
-

Basic Tabs

- -
Tab 1 Content
-
Tab 2 Content
-
Tab 3 Content
-

History Tabs

- -
Tab 4 Content
-
Tab 5 Content
-
Tab 6 Content
-
- - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/class/class.js b/labs/architecture-examples/javascriptmvc/jquery/class/class.js deleted file mode 100644 index 9433e9b770..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/class/class.js +++ /dev/null @@ -1,695 +0,0 @@ -//jQuery.Class -// This is a modified version of John Resig's class -// http://ejohn.org/blog/simple-javascript-inheritance/ -// It provides class level inheritance and callbacks. -//@steal-clean -steal.plugins("jquery","jquery/lang").then(function( $ ) { - - // if we are initializing a new class - var initializing = false, - makeArray = $.makeArray, - isFunction = $.isFunction, - isArray = $.isArray, - extend = $.extend, - concatArgs = function(arr, args){ - return arr.concat(makeArray(args)); - }, - // tests if we can get super in .toString() - fnTest = /xyz/.test(function() { - xyz; - }) ? /\b_super\b/ : /.*/, - // overwrites an object with methods, sets up _super - // newProps - new properties - // oldProps - where the old properties might be - // addTo - what we are adding to - inheritProps = function( newProps, oldProps, addTo ) { - addTo = addTo || newProps - for ( var name in newProps ) { - // Check if we're overwriting an existing function - addTo[name] = isFunction(newProps[name]) && - isFunction(oldProps[name]) && - fnTest.test(newProps[name]) ? (function( name, fn ) { - return function() { - var tmp = this._super, - ret; - - // Add a new ._super() method that is the same method - // but on the super-class - this._super = oldProps[name]; - - // The method only need to be bound temporarily, so we - // remove it when we're done executing - ret = fn.apply(this, arguments); - this._super = tmp; - return ret; - }; - })(name, newProps[name]) : newProps[name]; - } - }, - - - /** - * @class jQuery.Class - * @plugin jquery/class - * @tag core - * @download dist/jquery/jquery.class.js - * @test jquery/class/qunit.html - * - * Class provides simulated inheritance in JavaScript. Use clss to bridge the gap between - * jQuery's functional programming style and Object Oriented Programming. It - * is based off John Resig's [http://ejohn.org/blog/simple-javascript-inheritance/|Simple Class] - * Inheritance library. Besides prototypal inheritance, it includes a few important features: - * - * - Static inheritance - * - Introspection - * - Namespaces - * - Setup and initialization methods - * - Easy callback function creation - * - * - * ## Static v. Prototype - * - * Before learning about Class, it's important to - * understand the difference between - * a class's __static__ and __prototype__ properties. - * - * //STATIC - * MyClass.staticProperty //shared property - * - * //PROTOTYPE - * myclass = new MyClass() - * myclass.prototypeMethod() //instance method - * - * A static (or class) property is on the Class constructor - * function itself - * and can be thought of being shared by all instances of the - * Class. Prototype propertes are available only on instances of the Class. - * - * ## A Basic Class - * - * The following creates a Monster class with a - * name (for introspection), static, and prototype members. - * Every time a monster instance is created, the static - * count is incremented. - * - * @codestart - * $.Class.extend('Monster', - * /* @static *| - * { - * count: 0 - * }, - * /* @prototype *| - * { - * init: function( name ) { - * - * // saves name on the monster instance - * this.name = name; - * - * // sets the health - * this.health = 10; - * - * // increments count - * this.Class.count++; - * }, - * eat: function( smallChildren ){ - * this.health += smallChildren; - * }, - * fight: function() { - * this.health -= 2; - * } - * }); - * - * hydra = new Monster('hydra'); - * - * dragon = new Monster('dragon'); - * - * hydra.name // -> hydra - * Monster.count // -> 2 - * Monster.shortName // -> 'Monster' - * - * hydra.eat(2); // health = 12 - * - * dragon.fight(); // health = 8 - * - * @codeend - * - * - * Notice that the prototype init function is called when a new instance of Monster is created. - * - * - * ## Inheritance - * - * When a class is extended, all static and prototype properties are available on the new class. - * If you overwrite a function, you can call the base class's function by calling - * this._super. Lets create a SeaMonster class. SeaMonsters are less - * efficient at eating small children, but more powerful fighters. - * - * - * Monster.extend("SeaMonster",{ - * eat: function( smallChildren ) { - * this._super(smallChildren / 2); - * }, - * fight: function() { - * this.health -= 1; - * } - * }); - * - * lockNess = new SeaMonster('Lock Ness'); - * lockNess.eat(4); //health = 12 - * lockNess.fight(); //health = 11 - * - * ### Static property inheritance - * - * You can also inherit static properties in the same way: - * - * $.Class.extend("First", - * { - * staticMethod: function() { return 1;} - * },{}) - * - * First.extend("Second",{ - * staticMethod: function() { return this._super()+1;} - * },{}) - * - * Second.staticMethod() // -> 2 - * - * ## Namespaces - * - * Namespaces are a good idea! We encourage you to namespace all of your code. - * It makes it possible to drop your code into another app without problems. - * Making a namespaced class is easy: - * - * @codestart - * $.Class.extend("MyNamespace.MyClass",{},{}); - * - * new MyNamespace.MyClass() - * @codeend - *

Introspection

- * Often, it's nice to create classes whose name helps determine functionality. Ruby on - * Rails's [http://api.rubyonrails.org/classes/ActiveRecord/Base.html|ActiveRecord] ORM class - * is a great example of this. Unfortunately, JavaScript doesn't have a way of determining - * an object's name, so the developer must provide a name. Class fixes this by taking a String name for the class. - * @codestart - * $.Class.extend("MyOrg.MyClass",{},{}) - * MyOrg.MyClass.shortName //-> 'MyClass' - * MyOrg.MyClass.fullName //-> 'MyOrg.MyClass' - * @codeend - * The fullName (with namespaces) and the shortName (without namespaces) are added to the Class's - * static properties. - * - * - *

Setup and initialization methods

- *

- * Class provides static and prototype initialization functions. - * These come in two flavors - setup and init. - * Setup is called before init and - * can be used to 'normalize' init's arguments. - *

- *
PRO TIP: Typically, you don't need setup methods in your classes. Use Init instead. - * Reserve setup methods for when you need to do complex pre-processing of your class before init is called. - * - *
- * @codestart - * $.Class.extend("MyClass", - * { - * setup: function() {} //static setup - * init: function() {} //static constructor - * }, - * { - * setup: function() {} //prototype setup - * init: function() {} //prototype constructor - * }) - * @codeend - * - *

Setup

- *

Setup functions are called before init functions. Static setup functions are passed - * the base class followed by arguments passed to the extend function. - * Prototype static functions are passed the Class constructor function arguments.

- *

If a setup function returns an array, that array will be used as the arguments - * for the following init method. This provides setup functions the ability to normalize - * arguments passed to the init constructors. They are also excellent places - * to put setup code you want to almost always run.

- *

- * The following is similar to how [jQuery.Controller.prototype.setup] - * makes sure init is always called with a jQuery element and merged options - * even if it is passed a raw - * HTMLElement and no second parameter. - *

- * @codestart - * $.Class.extend("jQuery.Controller",{ - * ... - * },{ - * setup: function( el, options ) { - * ... - * return [$(el), - * $.extend(true, - * this.Class.defaults, - * options || {} ) ] - * } - * }) - * @codeend - * Typically, you won't need to make or overwrite setup functions. - *

Init

- * - *

Init functions are called after setup functions. - * Typically, they receive the same arguments - * as their preceding setup function. The Foo class's init method - * gets called in the following example: - *

- * @codestart - * $.Class.Extend("Foo", { - * init: function( arg1, arg2, arg3 ) { - * this.sum = arg1+arg2+arg3; - * } - * }) - * var foo = new Foo(1,2,3); - * foo.sum //-> 6 - * @codeend - *

Callbacks

- *

Similar to jQuery's proxy method, Class provides a - * [jQuery.Class.static.callback callback] - * function that returns a callback to a method that will always - * have - * this set to the class or instance of the class. - *

- * The following example uses this.callback to make sure - * this.name is available in show. - * @codestart - * $.Class.extend("Todo",{ - * init: function( name ) { this.name = name } - * get: function() { - * $.get("/stuff",this.callback('show')) - * }, - * show: function( txt ) { - * alert(this.name+txt) - * } - * }) - * new Todo("Trash").get() - * @codeend - *

Callback is available as a static and prototype method.

- *

Demo

- * @demo jquery/class/class.html - * - * @constructor Creating a new instance of an object that has extended jQuery.Class - * calls the init prototype function and returns a new instance of the class. - * - */ - - clss = $.Class = function() { - if (arguments.length) { - clss.extend.apply(clss, arguments); - } - }; - - /* @Static*/ - extend(clss, { - /** - * @function callback - * Returns a callback function for a function on this Class. - * The callback function ensures that 'this' is set appropriately. - * @codestart - * $.Class.extend("MyClass",{ - * getData: function() { - * this.showing = null; - * $.get("data.json",this.callback('gotData'),'json') - * }, - * gotData: function( data ) { - * this.showing = data; - * } - * },{}); - * MyClass.showData(); - * @codeend - *

Currying Arguments

- * Additional arguments to callback will fill in arguments on the returning function. - * @codestart - * $.Class.extend("MyClass",{ - * getData: function( callback ) { - * $.get("data.json",this.callback('process',callback),'json'); - * }, - * process: function( callback, jsonData ) { //callback is added as first argument - * jsonData.processed = true; - * callback(jsonData); - * } - * },{}); - * MyClass.getData(showDataFunc) - * @codeend - *

Nesting Functions

- * Callback can take an array of functions to call as the first argument. When the returned callback function - * is called each function in the array is passed the return value of the prior function. This is often used - * to eliminate currying initial arguments. - * @codestart - * $.Class.extend("MyClass",{ - * getData: function( callback ) { - * //calls process, then callback with value from process - * $.get("data.json",this.callback(['process2',callback]),'json') - * }, - * process2: function( type,jsonData ) { - * jsonData.processed = true; - * return [jsonData]; - * } - * },{}); - * MyClass.getData(showDataFunc); - * @codeend - * @param {String|Array} fname If a string, it represents the function to be called. - * If it is an array, it will call each function in order and pass the return value of the prior function to the - * next function. - * @return {Function} the callback function. - */ - callback: function( funcs ) { - - //args that should be curried - var args = makeArray(arguments), - self; - - funcs = args.shift(); - - if (!isArray(funcs) ) { - funcs = [funcs]; - } - - self = this; - //@steal-remove-start - for( var i =0; i< funcs.length;i++ ) { - if(typeof funcs[i] == "string" && !isFunction(this[funcs[i]])){ - throw ("class.js "+( this.fullName || this.Class.fullName)+" does not have a "+funcs[i]+"method!"); - } - } - //@steal-remove-end - return function class_cb() { - var cur = concatArgs(args, arguments), - isString, - length = funcs.length, - f = 0, - func; - - for (; f < length; f++ ) { - func = funcs[f]; - if (!func ) { - continue; - } - - isString = typeof func == "string"; - if ( isString && self._set_called ) { - self.called = func; - } - cur = (isString ? self[func] : func).apply(self, cur || []); - if ( f < length - 1 ) { - cur = !isArray(cur) || cur._use_call ? [cur] : cur - } - } - return cur; - } - }, - /** - * @function getObject - * Gets an object from a String. - * If the object or namespaces the string represent do not - * exist it will create them. - * @codestart - * Foo = {Bar: {Zar: {"Ted"}}} - * $.Class.getobject("Foo.Bar.Zar") //-> "Ted" - * @codeend - * @param {String} objectName the object you want to get - * @param {Object} [current=window] the object you want to look in. - * @return {Object} the object you are looking for. - */ - getObject: $.String.getObject, - /** - * @function newInstance - * Creates a new instance of the class. This method is useful for creating new instances - * with arbitrary parameters. - *

Example

- * @codestart - * $.Class.extend("MyClass",{},{}) - * var mc = MyClass.newInstance.apply(null, new Array(parseInt(Math.random()*10,10)) - * @codeend - * @return {class} instance of the class - */ - newInstance: function() { - var inst = this.rawInstance(), - args; - if ( inst.setup ) { - args = inst.setup.apply(inst, arguments); - } - if ( inst.init ) { - inst.init.apply(inst, isArray(args) ? args : arguments); - } - return inst; - }, - /** - * Setup gets called on the inherting class with the base class followed by the - * inheriting class's raw properties. - * - * Setup will deeply extend a static defaults property on the base class with - * properties on the base class. For example: - * - * $.Class("MyBase",{ - * defaults : { - * foo: 'bar' - * } - * },{}) - * - * MyBase("Inheriting",{ - * defaults : { - * newProp : 'newVal' - * } - * },{} - * - * Inheriting.defaults -> {foo: 'bar', 'newProp': 'newVal'} - * - * @param {Object} baseClass the base class that is being inherited from - * @param {String} fullName the name of the new class - * @param {Object} staticProps the static properties of the new class - * @param {Object} protoProps the prototype properties of the new class - */ - setup: function( baseClass, fullName ) { - this.defaults = extend(true, {}, baseClass.defaults, this.defaults); - return arguments; - }, - rawInstance: function() { - initializing = true; - var inst = new this(); - initializing = false; - return inst; - }, - /** - * Extends a class with new static and prototype functions. There are a variety of ways - * to use extend: - * @codestart - * //with className, static and prototype functions - * $.Class.extend('Task',{ STATIC },{ PROTOTYPE }) - * //with just classname and prototype functions - * $.Class.extend('Task',{ PROTOTYPE }) - * //With just a className - * $.Class.extend('Task') - * @codeend - * @param {String} [fullName] the classes name (used for classes w/ introspection) - * @param {Object} [klass] the new classes static/class functions - * @param {Object} [proto] the new classes prototype functions - * @return {jQuery.Class} returns the new class - */ - extend: function( fullName, klass, proto ) { - // figure out what was passed - if ( typeof fullName != 'string' ) { - proto = klass; - klass = fullName; - fullName = null; - } - if (!proto ) { - proto = klass; - klass = null; - } - - proto = proto || {}; - var _super_class = this, - _super = this.prototype, - name, shortName, namespace, prototype; - - // Instantiate a base class (but only create the instance, - // don't run the init constructor) - initializing = true; - prototype = new this(); - initializing = false; - // Copy the properties over onto the new prototype - inheritProps(proto, _super, prototype); - - // The dummy class constructor - - function Class() { - // All construction is actually done in the init method - if ( initializing ) return; - - if ( this.constructor !== Class && arguments.length ) { //we are being called w/o new - return arguments.callee.extend.apply(arguments.callee, arguments) - } else { //we are being called w/ new - return this.Class.newInstance.apply(this.Class, arguments) - } - } - // Copy old stuff onto class - for ( name in this ) { - if ( this.hasOwnProperty(name) ) { - Class[name] = this[name]; - } - } - - // copy new props on class - inheritProps(klass, this, Class); - - // do namespace stuff - if ( fullName ) { - - var parts = fullName.split(/\./), - shortName = parts.pop(), - current = clss.getObject(parts.join('.'), window, true), - namespace = current; - - //@steal-remove-start - if (!Class.nameOk ) { - //steal.dev.isHappyName(fullName) - } - if(current[shortName]){ - steal.dev.warn("class.js There's already something called "+fullName) - } - //@steal-remove-end - current[shortName] = Class; - } - - // set things that can't be overwritten - extend(Class, { - prototype: prototype, - namespace: namespace, - shortName: shortName, - constructor: Class, - fullName: fullName - }); - - //make sure our prototype looks nice - Class.prototype.Class = Class.prototype.constructor = Class; - - - /** - * @attribute fullName - * The full name of the class, including namespace, provided for introspection purposes. - * @codestart - * $.Class.extend("MyOrg.MyClass",{},{}) - * MyOrg.MyClass.shortName //-> 'MyClass' - * MyOrg.MyClass.fullName //-> 'MyOrg.MyClass' - * @codeend - */ - - var args = Class.setup.apply(Class, concatArgs([_super_class],arguments)); - - if ( Class.init ) { - Class.init.apply(Class, args || []); - } - - /* @Prototype*/ - return Class; - /** - * @function setup - * If a setup method is provided, it is called when a new - * instances is created. It gets passed the same arguments that - * were given to the Class constructor function ( new Class( arguments ... )). - * - * $.Class("MyClass", - * { - * setup: function( val ) { - * this.val = val; - * } - * }) - * var mc = new MyClass("Check Check") - * mc.val //-> 'Check Check' - * - * Setup is called before [jQuery.Class.prototype.init init]. If setup - * return an array, those arguments will be used for init. - * - * $.Class("jQuery.Controller",{ - * setup : function(htmlElement, rawOptions){ - * return [$(htmlElement), - * $.extend({}, this.Class.defaults, rawOptions )] - * } - * }) - * - *
PRO TIP: - * Setup functions are used to normalize constructor arguments and provide a place for - * setup code that extending classes don't have to remember to call _super to - * run. - *
- * - * Setup is not defined on $.Class itself, so calling super in inherting classes - * will break. Don't do the following: - * - * $.Class("Thing",{ - * setup : function(){ - * this._super(); // breaks! - * } - * }) - * - * @return {Array|undefined} If an array is return, [jQuery.Class.prototype.init] is - * called with those arguments; otherwise, the original arguments are used. - */ - //break up - /** - * @function init - * If an init method is provided, it gets called when a new instance - * is created. Init gets called after [jQuery.Class.prototype.setup setup], typically with the - * same arguments passed to the Class - * constructor: ( new Class( arguments ... )). - * - * $.Class("MyClass", - * { - * init: function( val ) { - * this.val = val; - * } - * }) - * var mc = new MyClass(1) - * mc.val //-> 1 - * - * [jQuery.Class.prototype.setup Setup] is able to modify the arguments passed to init. Read - * about it there. - * - */ - //Breaks up code - /** - * @attribute Class - * References the static properties of the instance's class. - *

Quick Example

- * @codestart - * // a class with a static classProperty property - * $.Class.extend("MyClass", {classProperty : true}, {}); - * - * // a new instance of myClass - * var mc1 = new MyClass(); - * - * // - * mc1.Class.classProperty = false; - * - * // creates a new MyClass - * var mc2 = new mc.Class(); - * @codeend - * Getting static properties via the Class property, such as it's - * [jQuery.Class.static.fullName fullName] is very common. - */ - } - - }) - - - - - - clss.prototype. - /** - * @function callback - * Returns a callback function. This does the same thing as and is described better in [jQuery.Class.static.callback]. - * The only difference is this callback works - * on a instance instead of a class. - * @param {String|Array} fname If a string, it represents the function to be called. - * If it is an array, it will call each function in order and pass the return value of the prior function to the - * next function. - * @return {Function} the callback function - */ - callback = clss.callback; - - -})(); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/class/class_test.js b/labs/architecture-examples/javascriptmvc/jquery/class/class_test.js deleted file mode 100644 index 89dc0495b1..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/class/class_test.js +++ /dev/null @@ -1,206 +0,0 @@ -steal - .plugins("jquery/class") //load your app - .plugins('funcunit/qunit').then(function(){ - -module("jquery/class"); - -test("Creating", function(){ - - jQuery.Class.extend("Animal", - { - count: 0, - test: function() { - return this.match ? true : false - } - }, - { - init: function() { - this.Class.count++; - this.eyes = false; - } - } - ); - Animal.extend("Dog", - { - match : /abc/ - }, - { - init: function() { - this._super(); - }, - talk: function() { - return "Woof"; - } - }); - Dog.extend("Ajax", - { - count : 0 - }, - { - init: function( hairs ) { - this._super(); - this.hairs = hairs; - this.setEyes(); - - }, - setEyes: function() { - this.eyes = true; - } - }); - new Dog(); - new Animal(); - new Animal(); - var ajax = new Ajax(1000); - - equals(2, Animal.count, "right number of animals"); - equals(1, Dog.count, "right number of animals") - ok(Dog.match, "right number of animals") - ok(!Animal.match, "right number of animals") - ok(Dog.test(), "right number of animals") - ok(!Animal.test(), "right number of animals") - equals(1, Ajax.count, "right number of animals") - equals(2, Animal.count, "right number of animals"); - equals(true, ajax.eyes, "right number of animals"); - equals(1000, ajax.hairs, "right number of animals"); -}) - - -test("new instance",function(){ - var d = Ajax.newInstance(6); - equals(6, d.hairs); -}) - - -test("namespaces",function(){ - var fb = $.Class.extend("Foo.Bar") - ok(Foo.Bar === fb, "returns class") - equals(fb.shortName, "Bar", "short name is right"); - equals(fb.fullName, "Foo.Bar","fullName is right") - -}) - -test("setups", function(){ - var order = 0, - staticSetup, - staticSetupArgs, - staticInit, - staticInitArgs, - protoSetup, - protoInitArgs, - protoInit, - staticProps = { - setup: function() { - staticSetup = ++order; - staticSetupArgs = arguments; - return ["something"] - }, - init: function() { - staticInit = ++order; - staticInitArgs = arguments; - } - }, - protoProps = { - setup: function( name ) { - protoSetup = ++order; - return ["Ford: "+name]; - }, - init: function() { - protoInit = ++order; - protoInitArgs = arguments; - } - } - $.Class.extend("Car",staticProps,protoProps); - - var geo = new Car("geo"); - equals(staticSetup, 1); - equals(staticInit, 2); - equals(protoSetup, 3); - equals(protoInit, 4); - - same($.makeArray(staticInitArgs), ["something"] ) - same($.makeArray(protoInitArgs),["Ford: geo"] ) - - same($.makeArray(staticSetupArgs),[$.Class, "Car",staticProps, protoProps] ,"static construct"); - - - //now see if staticSetup gets called again ... - Car.extend("Truck"); - equals(staticSetup, 5, "Static setup is called if overwriting"); - -}); - -test("callback", function(){ - var curVal = 0; - $.Class.extend("Car",{ - show: function( value ) { - equals(curVal, value) - } - },{ - show: function( value ) { - - } - }) - var cb = Car.callback('show'); - curVal = 1; - cb(1) - - curVal = 2; - var cb2 = Car.callback('show',2) - cb2(); -}); - -test("callback error", 1,function(){ - $.Class.extend("Car",{ - show: function( value ) { - equals(curVal, value) - } - },{ - show: function( value ) { - - } - }) - try{ - Car.callback('huh'); - ok(false, "I should have errored") - }catch(e){ - ok(true, "Error was thrown") - } -}) - -test("Creating without extend", function(){ - $.Class("Bar",{ - ok : function(){ - ok(true, "ok called") - } - }); - new Bar().ok(); - - Bar("Foo",{ - dude : function(){ - ok(true, "dude called") - } - }); - new Foo().dude(true); -}) - - -/* Not sure I want to fix this yet. -test("Super in derived when parent doesn't have init", function(){ - $.Class("Parent",{ - }); - - Parent("Derived",{ - init : function(){ - this._super(); - } - }); - - try { - new Derived(); - ok(true, "Can call super in init safely") - } catch (e) { - ok(false, "Failed to call super in init with error: " + e) - } -})*/ - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/class/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/class/qunit.html deleted file mode 100644 index 503f699fd1..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/class/qunit.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - -

Class Test Suite

-

-
-

-
    -
    - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/controller.html b/labs/architecture-examples/javascriptmvc/jquery/controller/controller.html deleted file mode 100644 index 43604741f1..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/controller.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - Controller Example - - - -
    - -
    Tab 1 Content
    -
    Tab 2 Content
    -
    Tab 3 Content
    -
    - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/controller.js b/labs/architecture-examples/javascriptmvc/jquery/controller/controller.js deleted file mode 100644 index 3aac62d8d4..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/controller.js +++ /dev/null @@ -1,905 +0,0 @@ -steal.plugins('jquery/class', 'jquery/lang', 'jquery/event/destroyed').then(function( $ ) { - - // ------- helpers ------ - // Binds an element, returns a function that unbinds - var bind = function( el, ev, callback ) { - var wrappedCallback, - binder = el.bind && el.unbind ? el : $(isFunction(el) ? [el] : el); - //this is for events like >click. - if ( ev.indexOf(">") === 0 ) { - ev = ev.substr(1); - wrappedCallback = function( event ) { - if ( event.target === el ) { - callback.apply(this, arguments); - } - }; - } - binder.bind(ev, wrappedCallback || callback); - // if ev name has >, change the name and bind - // in the wrapped callback, check that the element matches the actual element - return function() { - binder.unbind(ev, wrappedCallback || callback); - el = ev = callback = wrappedCallback = null; - }; - }, - makeArray = $.makeArray, - isArray = $.isArray, - isFunction = $.isFunction, - extend = $.extend, - Str = $.String, - // Binds an element, returns a function that unbinds - delegate = function( el, selector, ev, callback ) { - $(el).delegate(selector, ev, callback); - return function() { - $(el).undelegate(selector, ev, callback); - el = ev = callback = selector = null; - }; - }, - binder = function( el, ev, callback, selector ) { - return selector ? delegate(el, selector, ev, callback) : bind(el, ev, callback); - }, - /** - * moves 'this' to the first argument - */ - shifter = function shifter(cb) { - return function() { - return cb.apply(null, [this.nodeName ? $(this) : this].concat(Array.prototype.slice.call(arguments, 0))); - }; - }, - // matches dots - dotsReg = /\./g, - // matches controller - controllersReg = /_?controllers?/ig, - //used to remove the controller from the name - underscoreAndRemoveController = function( className ) { - return Str.underscore(className.replace("jQuery.", "").replace(dotsReg, '_').replace(controllersReg, "")); - }, - // checks if it looks like an action - actionMatcher = /[^\w]/, - // handles parameterized action names - parameterReplacer = /\{([^\}]+)\}/g, - breaker = /^(?:(.*?)\s)?([\w\.\:>]+)$/, - basicProcessor, - data = function(el, data){ - return $.data(el, "controllers", data) - }; - /** - * @class jQuery.Controller - * @tag core - * @plugin jquery/controller - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/controller/controller.js - * @test jquery/controller/qunit.html - * - * Controllers organize event handlers using event delegation. - * If something happens in your application (a user click or a [jQuery.Model|Model] instance being updated), - * a controller should respond to it. - * - * Controllers make your code deterministic, reusable, organized and can tear themselves - * down auto-magically. Read about [http://jupiterjs.com/news/writing-the-perfect-jquery-plugin - * the theory behind controller] and - * a [http://jupiterjs.com/news/organize-jquery-widgets-with-jquery-controller walkthrough of its features] - * on Jupiter's blog. - * - * - * ## Basic Example - * - * Instead of - * - * @codestart - * $(function(){ - * $('#tabs').click(someCallbackFunction1) - * $('#tabs .tab').click(someCallbackFunction2) - * $('#tabs .delete click').click(someCallbackFunction3) - * }); - * @codeend - * - * do this - * - * @codestart - * $.Controller('Tabs',{ - * click: function() {...}, - * '.tab click' : function() {...}, - * '.delete click' : function() {...} - * }) - * $('#tabs').tabs(); - * @codeend - * - * ## Tabs Example - * - * @demo jquery/controller/controller.html - * - * - * ## Using Controller - * - * Controller helps you build and organize jQuery plugins. It can be used - * to build simple widgets, like a slider, or organize multiple - * widgets into something greater. - * - * To understand how to use Controller, you need to understand - * the typical lifecycle of a jQuery widget and how that maps to - * controller's functionality: - * - * ### A controller class is created. - * - * $.Controller("MyWidget", - * { - * defaults : { - * message : "Remove Me" - * } - * }, - * { - * init : function(rawEl, rawOptions){ - * this.element.append( - * "
    "+this.options.message+"
    " - * ); - * }, - * "div click" : function(div, ev){ - * div.remove(); - * } - * }) - * - * This creates a $.fn.my_widget [jquery.controller.plugin jQuery helper function] - * that can be used to create a new controller instance on an element. - * - * ### An instance of controller is created on an element - * - * $('.thing').my_widget(options) // calls new MyWidget(el, options) - * - * This calls new MyWidget(el, options) on - * each '.thing' element. - * - * When a new [jQuery.Class Class] instance is created, it calls the class's - * prototype setup and init methods. Controller's [jQuery.Controller.prototype.setup setup] - * method: - * - * - Sets [jQuery.Controller.prototype.element this.element] and adds the controller's name to element's className. - * - Merges passed in options with defaults object and sets it as [jQuery.Controller.prototype.options this.options] - * - Saves a reference to the controller in $.data. - * - [jquery.controller.listening Binds all event handler methods]. - * - * - * ### The controller responds to events - * - * Typically, Controller event handlers are automatically bound. However, there are - * multiple ways to [jquery.controller.listening listen to events] with a controller. - * - * Once an event does happen, the callback function is always called with 'this' - * referencing the controller instance. This makes it easy to use helper functions and - * save state on the controller. - * - * - * ### The widget is destroyed - * - * If the element is removed from the page, the - * controller's [jQuery.Controller.prototype.destroy] method is called. - * This is a great place to put any additional teardown functionality. - * - * You can also teardown a controller programatically like: - * - * $('.thing').my_widget('destroy'); - * - * ## Todos Example - * - * Lets look at a very basic example - - * a list of todos and a button you want to click to create a new todo. - * Your HTML might look like: - * - * @codestart html - * <div id='todos'> - * <ol> - * <li class="todo">Laundry</li> - * <li class="todo">Dishes</li> - * <li class="todo">Walk Dog</li> - * </ol> - * <a class="create">Create</a> - * </div> - * @codeend - * - * To add a mousover effect and create todos, your controller might look like: - * - * @codestart - * $.Controller.extend('Todos',{ - * ".todo mouseover" : function( el, ev ) { - * el.css("backgroundColor","red") - * }, - * ".todo mouseout" : function( el, ev ) { - * el.css("backgroundColor","") - * }, - * ".create click" : function() { - * this.find("ol").append("<li class='todo'>New Todo</li>"); - * } - * }) - * @codeend - * - * Now that you've created the controller class, you've must attach the event handlers on the '#todos' div by - * creating [jQuery.Controller.prototype.setup|a new controller instance]. There are 2 ways of doing this. - * - * @codestart - * //1. Create a new controller directly: - * new Todos($('#todos')); - * //2. Use jQuery function - * $('#todos').todos(); - * @codeend - * - * ## Controller Initialization - * - * It can be extremely useful to add an init method with - * setup functionality for your widget. - * - * In the following example, I create a controller that when created, will put a message as the content of the element: - * - * @codestart - * $.Controller.extend("SpecialController", - * { - * init: function( el, message ) { - * this.element.html(message) - * } - * }) - * $(".special").special("Hello World") - * @codeend - * - * ## Removing Controllers - * - * Controller removal is built into jQuery. So to remove a controller, you just have to remove its element: - * - * @codestart - * $(".special_controller").remove() - * $("#containsControllers").html("") - * @codeend - * - * It's important to note that if you use raw DOM methods (innerHTML, removeChild), the controllers won't be destroyed. - * - * If you just want to remove controller functionality, call destroy on the controller instance: - * - * @codestart - * $(".special_controller").controller().destroy() - * @codeend - * - * ## Accessing Controllers - * - * Often you need to get a reference to a controller, there are a few ways of doing that. For the - * following example, we assume there are 2 elements with className="special". - * - * @codestart - * //creates 2 foo controllers - * $(".special").foo() - * - * //creates 2 bar controllers - * $(".special").bar() - * - * //gets all controllers on all elements: - * $(".special").controllers() //-> [foo, bar, foo, bar] - * - * //gets only foo controllers - * $(".special").controllers(FooController) //-> [foo, foo] - * - * //gets all bar controllers - * $(".special").controllers(BarController) //-> [bar, bar] - * - * //gets first controller - * $(".special").controller() //-> foo - * - * //gets foo controller via data - * $(".special").data("controllers")["FooController"] //-> foo - * @codeend - * - * ## Calling methods on Controllers - * - * Once you have a reference to an element, you can call methods on it. However, Controller has - * a few shortcuts: - * - * @codestart - * //creates foo controller - * $(".special").foo({name: "value"}) - * - * //calls FooController.prototype.update - * $(".special").foo({name: "value2"}) - * - * //calls FooController.prototype.bar - * $(".special").foo("bar","something I want to pass") - * @codeend - */ - $.Class("jQuery.Controller", - /** - * @Static - */ - { - /** - * Does 3 things: - *
      - *
    1. Creates a jQuery helper for this controller.
    2. - *
    3. Calculates and caches which functions listen for events.
    4. - *
    5. and attaches this element to the documentElement if onDocument is true.
    6. - *
    - *

    jQuery Helper Naming Examples

    - * @codestart - * "TaskController" -> $().task_controller() - * "Controllers.Task" -> $().controllers_task() - * @codeend - */ - init: function() { - // if you didn't provide a name, or are controller, don't do anything - if (!this.shortName || this.fullName == "jQuery.Controller" ) { - return; - } - // cache the underscored names - this._fullName = underscoreAndRemoveController(this.fullName); - this._shortName = underscoreAndRemoveController(this.shortName); - - var controller = this, - pluginname = this.pluginName || this._fullName, - funcName, forLint; - - // create jQuery plugin - if (!$.fn[pluginname] ) { - $.fn[pluginname] = function( options ) { - - var args = makeArray(arguments), - //if the arg is a method on this controller - isMethod = typeof options == "string" && isFunction(controller.prototype[options]), - meth = args[0]; - return this.each(function() { - //check if created - var controllers = data(this), - //plugin is actually the controller instance - plugin = controllers && controllers[pluginname]; - - if ( plugin ) { - if ( isMethod ) { - // call a method on the controller with the remaining args - plugin[meth].apply(plugin, args.slice(1)); - } else { - // call the plugin's update method - plugin.update.apply(plugin, args); - } - - } else { - //create a new controller instance - controller.newInstance.apply(controller, [this].concat(args)); - } - }); - }; - } - - // make sure listensTo is an array - //@steal-remove-start - if (!isArray(this.listensTo) ) { - throw "listensTo is not an array in " + this.fullName; - } - //@steal-remove-end - // calculate and cache actions - this.actions = {}; - - for ( funcName in this.prototype ) { - if (funcName == 'constructor' || !isFunction(this.prototype[funcName]) ) { - continue; - } - if ( this._isAction(funcName) ) { - this.actions[funcName] = this._action(funcName); - } - } - - /** - * @attribute onDocument - * Set to true if you want to automatically attach this element to the documentElement. - */ - if ( this.onDocument ) { - forLint = new controller(document.documentElement); - } - }, - hookup: function( el ) { - return new this(el); - }, - - /** - * @hide - * @param {String} methodName a prototype function - * @return {Boolean} truthy if an action or not - */ - _isAction: function( methodName ) { - if ( actionMatcher.test(methodName) ) { - return true; - } else { - return $.inArray(methodName, this.listensTo) > -1 || $.event.special[methodName] || processors[methodName]; - } - - }, - /** - * @hide - * @param {Object} methodName the method that will be bound - * @param {Object} [options] first param merged with class default options - * @return {Object} null or the processor and pre-split parts. - * The processor is what does the binding/subscribing. - */ - _action: function( methodName, options ) { - //if we don't have a controller instance, we'll break this guy up later - parameterReplacer.lastIndex = 0; - if (!options && parameterReplacer.test(methodName) ) { - return null; - } - var convertedName = options ? Str.sub(methodName, [options, window]) : methodName, - arr = isArray(convertedName), - parts = (arr ? convertedName[1] : convertedName).match(breaker), - event = parts[2], - processor = processors[event] || basicProcessor; - return { - processor: processor, - parts: parts, - delegate : arr ? convertedName[0] : undefined - }; - }, - /** - * @attribute processors - * An object of {eventName : function} pairs that Controller uses to hook up events - * auto-magically. A processor function looks like: - * - * jQuery.Controller.processors. - * myprocessor = function( el, event, selector, cb, controller ) { - * //el - the controller's element - * //event - the event (myprocessor) - * //selector - the left of the selector - * //cb - the function to call - * //controller - the binding controller - * }; - * - * This would bind anything like: "foo~3242 myprocessor". - * - * The processor must return a function that when called, - * unbinds the event handler. - * - * Controller already has processors for the following events: - * - * - change - * - click - * - contextmenu - * - dblclick - * - focusin - * - focusout - * - keydown - * - keyup - * - keypress - * - mousedown - * - mouseenter - * - mouseleave - * - mousemove - * - mouseout - * - mouseover - * - mouseup - * - reset - * - resize - * - scroll - * - select - * - submit - * - * The following processors always listen on the window or document: - * - * - windowresize - * - windowscroll - * - load - * - unload - * - hashchange - * - ready - * - * Which means anytime the window is resized, the following controller will listen to it: - * - * $.Controller('Sized',{ - * windowresize : function(){ - * this.element.width(this.element.parent().width() / 2); - * } - * }); - * - * $('.foo').sized(); - */ - processors: {}, - /** - * @attribute listensTo - * A list of special events this controller listens too. You only need to add event names that - * are whole words (ie have no special characters). - * - * $.Controller('TabPanel',{ - * listensTo : ['show'] - * },{ - * 'show' : function(){ - * this.element.show(); - * } - * }) - * - * $('.foo').tab_panel().trigger("show"); - */ - listensTo: [], - /** - * @attribute defaults - * A object of name-value pairs that act as default values for a controller's - * [jQuery.Controller.prototype.options options]. - * - * $.Controller("Message", - * { - * defaults : { - * message : "Hello World" - * } - * },{ - * init : function(){ - * this.element.text(this.options.message); - * } - * }) - * - * $("#el1").message(); //writes "Hello World" - * $("#el12").message({message: "hi"}); //writes hi - */ - defaults: {} - }, - /** - * @Prototype - */ - { - /** - * Setup is where most of controller's magic happens. It does the following: - * - * ### Sets this.element - * - * The first parameter passed to new Controller(el, options) is expected to be - * an element. This gets converted to a jQuery wrapped element and set as - * [jQuery.Controller.prototype.element this.element]. - * - * ### Adds the controller's name to the element's className. - * - * Controller adds it's plugin name to the element's className for easier - * debugging. For example, if your Controller is named "Foo.Bar", it adds - * "foo_bar" to the className. - * - * ### Saves the controller in $.data - * - * A reference to the controller instance is saved in $.data. You can find - * instances of "Foo.Bar" like: - * - * $("#el").data("controllers")['foo_bar']. - * - * ### Binds event handlers - * - * Setup does the event binding described in [jquery.controller.listening Listening To Events]. - * - * ## API - * @param {HTMLElement} element the element this instance operates on. - * @param {Object} [options] option values for the controller. These get added to - * this.options. - */ - setup: function( element, options ) { - var funcName, ready, cls = this.Class; - - //want the raw element here - element = element.jquery ? element[0] : element; - - //set element and className on element - this.element = $(element).addClass(cls._fullName); - - //set in data - (data(element) || data(element, {}))[cls._fullName] = this; - - //adds bindings - this._bindings = []; - /** - * @attribute options - * Options is [jQuery.Controller.static.defaults] merged with the 2nd argument - * passed to a controller (or the first argument passed to the - * [jquery.controller.plugin controller's jQuery plugin]). - * - * For example: - * - * $.Controller("Tabs", - * { - * defaults : { - * activeClass: "ui-active-state" - * } - * }, - * { - * init : function(){ - * this.element.addClass(this.options.activeClass); - * } - * }) - * - * $("#tabs1").tabs() // adds 'ui-active-state' - * $("#tabs2").tabs({activeClass : 'active'}) // adds 'active' - * - * - */ - this.options = extend( extend(true, {}, cls.defaults), options); - - //go through the cached list of actions and use the processor to bind - for ( funcName in cls.actions ) { - if ( cls.actions.hasOwnProperty(funcName) ) { - ready = cls.actions[funcName] || cls._action(funcName, this.options); - this._bindings.push( - ready.processor(ready.delegate || element, ready.parts[2], ready.parts[1], this.callback(funcName), this)); - } - } - - - /** - * @attribute called - * String name of current function being called on controller instance. This is - * used for picking the right view in render. - * @hide - */ - this.called = "init"; - - //setup to be destroyed ... don't bind b/c we don't want to remove it - //this.element.bind('destroyed', this.callback('destroy')) - var destroyCB = shifter(this.callback("destroy")); - this.element.bind("destroyed", destroyCB); - this._bindings.push(function( el ) { - //destroyCB.removed = true; - $(element).unbind("destroyed", destroyCB); - }); - - /** - * @attribute element - * The controller instance's delegated element. This - * is set by [jQuery.Controller.prototype.setup setup]. It - * is a jQuery wrapped element. - * - * For example, if I add MyWidget to a '#myelement' element like: - * - * $.Controller("MyWidget",{ - * init : function(){ - * this.element.css("color","red") - * } - * }) - * - * $("#myelement").my_widget() - * - * MyWidget will turn #myelement's font color red. - * - * ## Using a different element. - * - * Sometimes, you want a different element to be this.element. A - * very common example is making progressively enhanced form widgets. - * - * To change this.element, overwrite Controller's setup method like: - * - * $.Controller("Combobox",{ - * setup : function(el, options){ - * this.oldElement = $(el); - * var newEl = $('
    '); - * this.oldElement.wrap(newEl); - * this._super(newEl, options); - * }, - * init : function(){ - * this.element //-> the div - * }, - * ".option click" : function(){ - * // event handler bound on the div - * }, - * destroy : function(){ - * var div = this.element; //save reference - * this._super(); - * div.replaceWith(this.oldElement); - * } - * } - */ - return this.element; - }, - /** - * Bind attaches event handlers that will be removed when the controller is removed. - * This is a good way to attach to an element not in the controller's element. - *
    - *

    Examples:

    - * @codestart - * init: function() { - * // calls somethingClicked(el,ev) - * this.bind('click','somethingClicked') - * - * // calls function when the window is clicked - * this.bind(window, 'click', function(ev){ - * //do something - * }) - * }, - * somethingClicked: function( el, ev ) { - * - * } - * @codeend - * @param {HTMLElement|jQuery.fn} [el=this.element] The element to be bound - * @param {String} eventName The event to listen for. - * @param {Function|String} func A callback function or the String name of a controller function. If a controller - * function name is given, the controller function is called back with the bound element and event as the first - * and second parameter. Otherwise the function is called back like a normal bind. - * @return {Integer} The id of the binding in this._bindings - */ - bind: function( el, eventName, func ) { - if ( typeof el == 'string' ) { - func = eventName; - eventName = el; - el = this.element; - } - return this._binder(el, eventName, func); - }, - _binder: function( el, eventName, func, selector ) { - if ( typeof func == 'string' ) { - func = shifter(this.callback(func)); - } - this._bindings.push(binder(el, eventName, func, selector)); - return this._bindings.length; - }, - /** - * Delegate will delegate on an elememt and will be undelegated when the controller is removed. - * This is a good way to delegate on elements not in a controller's element.
    - *

    Example:

    - * @codestart - * // calls function when the any 'a.foo' is clicked. - * this.delegate(document.documentElement,'a.foo', 'click', function(ev){ - * //do something - * }) - * @codeend - * @param {HTMLElement|jQuery.fn} [element=this.element] the element to delegate from - * @param {String} selector the css selector - * @param {String} eventName the event to bind to - * @param {Function|String} func A callback function or the String name of a controller function. If a controller - * function name is given, the controller function is called back with the bound element and event as the first - * and second parameter. Otherwise the function is called back like a normal bind. - * @return {Integer} The id of the binding in this._bindings - */ - delegate: function( element, selector, eventName, func ) { - if ( typeof element == 'string' ) { - func = eventName; - eventName = selector; - selector = element; - element = this.element; - } - return this._binder(element, eventName, func, selector); - }, - /** - * Called if an controller's [jquery.controller.plugin jQuery helper] is called on an element that already has a controller instance - * of the same type. Extends [jQuery.Controller.prototype.options this.options] with the options passed in. If you overwrite this, you might want to call - * this._super. - *

    Examples

    - * @codestart - * $.Controller.extend("Thing",{ - * init: function( el, options ) { - * alert('init') - * }, - * update: function( options ) { - * this._super(options); - * alert('update') - * } - * }); - * $('#myel').thing(); // alerts init - * $('#myel').thing(); // alerts update - * @codeend - * @param {Object} options - */ - update: function( options ) { - extend(this.options, options); - }, - /** - * Destroy unbinds and undelegates all event handlers on this controller, - * and prevents memory leaks. This is called automatically - * if the element is removed. You can overwrite it to add your own - * teardown functionality: - * - * $.Controller("ChangeText",{ - * init : function(){ - * this.oldText = this.element.text(); - * this.element.text("Changed!!!") - * }, - * destroy : function(){ - * this.element.text(this.oldText); - * this._super(); //Always call this! - * }) - * - * You could call destroy manually on an element with ChangeText - * added like: - * - * $("#changed").change_text("destroy"); - * - * ### API - */ - destroy: function() { - if ( this._destroyed ) { - throw this.Class.shortName + " controller instance has been deleted"; - } - var self = this, - fname = this.Class._fullName, - controllers; - this._destroyed = true; - this.element.removeClass(fname); - - $.each(this._bindings, function( key, value ) { - value(self.element[0]); - }); - - delete this._actions; - - delete this.element.data("controllers")[fname]; - - $(this).triggerHandler("destroyed"); //in case we want to know if the controller is removed - this.element = null; - }, - /** - * Queries from the controller's element. - * @codestart - * ".destroy_all click" : function() { - * this.find(".todos").remove(); - * } - * @codeend - * @param {String} selector selection string - * @return {jQuery.fn} returns the matched elements - */ - find: function( selector ) { - return this.element.find(selector); - }, - //tells callback to set called on this. I hate this. - _set_called: true - }); - - var processors = $.Controller.processors, - - //------------- PROCESSSORS ----------------------------- - //processors do the binding. They return a function that - //unbinds when called. - //the basic processor that binds events - basicProcessor = function( el, event, selector, cb, controller ) { - var c = controller.Class; - - // document controllers use their name as an ID prefix. - if ( c.onDocument && !/^Main(Controller)?$/.test(c.shortName) && el === controller.element[0]) { //prepend underscore name if necessary - selector = selector ? "#" + c._shortName + " " + selector : "#" + c._shortName; - } - return binder(el, event, shifter(cb), selector); - }; - - - - - //set commong events to be processed as a basicProcessor - $.each("change click contextmenu dblclick keydown keyup keypress mousedown mousemove mouseout mouseover mouseup reset resize scroll select submit focusin focusout mouseenter mouseleave".split(" "), function( i, v ) { - processors[v] = basicProcessor; - }); - /** - * @add jQuery.fn - */ - - //used to determine if a controller instance is one of controllers - //controllers can be strings or classes - var i, isAControllerOf = function( instance, controllers ) { - for ( i = 0; i < controllers.length; i++ ) { - if ( typeof controllers[i] == 'string' ? instance.Class._shortName == controllers[i] : instance instanceof controllers[i] ) { - return true; - } - } - return false; - }; - - /** - * @function controllers - * Gets all controllers in the jQuery element. - * @return {Array} an array of controller instances. - */ - $.fn.controllers = function() { - var controllerNames = makeArray(arguments), - instances = [], - controllers, c, cname; - //check if arguments - this.each(function() { - - controllers = $.data(this, "controllers"); - for ( cname in controllers ) { - if ( controllers.hasOwnProperty(cname) ) { - c = controllers[cname]; - if (!controllerNames.length || isAControllerOf(c, controllerNames) ) { - instances.push(c); - } - } - } - }); - return instances; - }; - /** - * @function controller - * Gets a controller in the jQuery element. With no arguments, returns the first one found. - * @param {Object} controller (optional) if exists, the first controller instance with this class type will be returned. - * @return {jQuery.Controller} the first controller. - */ - $.fn.controller = function( controller ) { - return this.controllers.apply(this, arguments)[0]; - }; - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/controller_test.js b/labs/architecture-examples/javascriptmvc/jquery/controller/controller_test.js deleted file mode 100644 index ffbfa087b1..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/controller_test.js +++ /dev/null @@ -1,239 +0,0 @@ -steal - .plugins("jquery/controller",'jquery/controller/subscribe') //load your app - .plugins('funcunit/qunit') //load qunit - .then(function(){ - -module("jquery/controller") -test("subscribe testing works", function(){ - - var ta = $("
    ").appendTo( $("#qunit-test-area") ) - - ta.html("click here") - - var clicks = 0, destroys = 0; - var subscribes = 0; - $.Controller.extend("MyTest",{ - click: function() { - clicks++ - }, - "a.b subscribe" : function() { - subscribes++ - }, - destroy: function() { - - this._super() - destroys++; - } - }) - ta.my_test(); - ta.trigger("click") - equals(clicks,1, "can listen to clicks") - - OpenAjax.hub.publish("a.b",{}) - equals(subscribes,1, "can subscribe") - var controllerInstance = ta.controller('my_test') - ok( controllerInstance.Class == MyTest, "can get controller" ) - controllerInstance.destroy() - - equals(destroys,1, "destroy called once") - ok(!ta.controller(), "controller is removed") - - OpenAjax.hub.publish("a.b",{}) - equals(subscribes,1, "subscription is torn down") - ta.trigger("click") - equals(clicks,1, "No longer listening") - - - - ta.my_test(); - ta.trigger("click") - OpenAjax.hub.publish("a.b",{}) - equals(clicks,2, "can listen again to clicks") - equals(subscribes,2, "can listen again to subscription") - - ta.remove(); - - ta.trigger("click") - OpenAjax.hub.publish("a.b",{}) - equals(clicks,2, "Clicks stopped") - equals(subscribes,2, "Subscribes stopped") -}) - - -test("document and main controllers", function(){ - var a = $("
    ").appendTo($("#qunit-test-area")), - a_inner = a.find('span'), - b = $("
    ").appendTo($("#qunit-test-area")), - b_inner = b.find('span'), - doc_outer_clicks = 0, - doc_inner_clicks = 0, - main_outer_clicks = 0, - main_inner_clicks = 0; - - $.Controller.extend("TestController", { onDocument: true }, { - click: function() { - doc_outer_clicks++; - }, - "span click" : function() { - doc_inner_clicks++; - } - }) - - a_inner.trigger("click"); - equals(doc_outer_clicks,1,"document controller handled (no-selector) click inside listening element"); - equals(doc_inner_clicks,1,"document controller handled (selector) click inside listening element"); - - b_inner.trigger("click"); - equals(doc_outer_clicks,1,"document controller ignored (no-selector) click outside listening element"); - equals(doc_inner_clicks,1,"document controller ignored (selector) click outside listening element"); - - $(document.documentElement).controller('test').destroy(); - - $.Controller.extend("MainController", { onDocument: true }, { - click: function() { - main_outer_clicks++; - }, - "span click" : function() { - main_inner_clicks++; - } - }) - - b_inner.trigger("click"); - equals(main_outer_clicks,1,"main controller handled (no-selector) click"); - equals(main_inner_clicks,1,"main controller handled (selector) click"); - - $(document.documentElement).controller('main').destroy(); - - a.remove(); - b.remove(); -}) - - -test("bind to any special", function(){ - jQuery.event.special.crazyEvent = { - - } - var called = false; - jQuery.Controller.extend("WeirdBind",{ - crazyEvent: function() { - called = true; - } - }) - var a = $("
    ").appendTo($("#qunit-test-area")) - a.weird_bind(); - a.trigger("crazyEvent") - ok(called, "heard the trigger"); - - $("#qunit-test-area").html("") - -}) - -test("parameterized actions", function(){ - var called = false; - jQuery.Controller.extend("WeirderBind",{ - "{parameterized}" : function() { - called = true; - } - }) - var a = $("
    ").appendTo($("#qunit-test-area")) - a.weirder_bind({parameterized: "sillyEvent"}); - a.trigger("sillyEvent") - ok(called, "heard the trigger") - - $("#qunit-test-area").html("") -}) - -test("windowresize", function(){ - var called = false; - jQuery.Controller.extend("WindowBind",{ - "{window} resize" : function() { - called = true; - } - }) - $("#qunit-test-area").html("
    ") - $("#weird").window_bind(); - $(window).trigger('resize') - ok(called,"got window resize event"); - - $("#qunit-test-area").html("") -}) - -// this.delegate(this.cached.header.find('tr'), "th", "mousemove", "th_mousemove"); -test("delegate", function(){ - var called = false; - jQuery.Controller.extend("DelegateTest",{ - click: function() {} - }) - var els = $("").appendTo($("#qunit-test-area")) - var c = els.delegate_test(); - c.controller().delegate(els.find("span"), "a", "click", function(){ - called = true; - }) - els.find("a").trigger('click') - ok(called, "delegate works") - $("#qunit-test-area").html("") -}) - -test("inherit", function(){ - var called = false; - $.Controller.extend( "Parent", { - click: function(){ - called = true; - } - }) - Parent.extend( "Child", { - - }) - var els = $("").appendTo($("#qunit-test-area")) - els.child(); - els.find("a").trigger('click') - ok(called, "inherited the click method") - $("#qunit-test-area").html("") -}); - -test("objects in action", function(){ - $.Controller('Thing',{ - "{item} someEvent" : function(thing, ev){ - ok(true, "called"); - equals(ev.type, "someEvent","correct event") - equals(this.Class.fullName, "Thing", "This is a controller isntance") - equals(thing.name,"Justin","Raw, not jQuery wrapped thing") - } - }); - - var thing1 = {name: "Justin"}; - - var ta = $("
    ").appendTo( $("#qunit-test-area") ) - ta.thing({item : thing1}); - - $(thing1).trigger("someEvent"); - - $("#qunit-test-area").html(""); - -}); - -test("dot",function(){ - $.Controller("Dot",{ - "foo.bar" : function(){ - ok(true,'called') - } - }); - - var ta = $("
    ").appendTo( $("#qunit-test-area") ); - ta.dot().trigger("foo.bar"); - $("#qunit-test-area").html(""); -}) - -// HTMLFormElement[0] breaks -test("the right element", 1, function(){ - $.Controller('FormTester',{ - init : function(){ - equals(this.element[0].nodeName.toLowerCase(), "form" ) - } - }) - $("
    ").appendTo( $("#qunit-test-area") ) - .form_tester(); - $("#qunit-test-area").html("") -}) - -}); diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/history/history.html b/labs/architecture-examples/javascriptmvc/jquery/controller/history/history.html deleted file mode 100644 index 3bc6b0a933..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/history/history.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - hover - - - - - - - - diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/history/history.js b/labs/architecture-examples/javascriptmvc/jquery/controller/history/history.js deleted file mode 100644 index 95befeb1d7..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/history/history.js +++ /dev/null @@ -1,187 +0,0 @@ -steal.plugins('jquery/controller/subscribe', - 'jquery/event/hashchange', - 'jquery/lang/deparam').then(function($){ - -/** - * @page jquery.controller.history History Events - * @parent jQuery.Controller - * @plugin jquery/controller/history - * The jquery/controller/history plugin adds - * browser hash (#) based history support. - * - * It allows you to listen to hashchange events with OpenAjax.hub. - * - * Typically you subscribe to a history event in your controllers: - * - * $.Controller("MyHistory",{ - * "history.pagename subscribe" : function(called, data){ - * //called when hash = #pagename - * } - * }) - * - * ## Event Names - * - * When a history event happens, an OpenAjax message is produced that - * starts with "history.". The remainder of the message name depends on the - * value of the "hash". - * - * The following shows hash values and - * the corresponding published message and data. - * - * "#foo=bar" -> "history.index" {foo: bar} - * "#foo/bar" -> "history.foo.bar" {} - * "#foo&bar=baz" -> "history.foo" {bar: baz} - * - * Essentially, if the hash starts with something like #foo/bar, this gets - * added to the message name as "foo.bar". Once "&" is found, it adds the remainder - * as name-value pairs to the message data. - * - * ## Controller Helper Functions - * - * The methods on the left are added to Controller.prototype and make it easier to - * make changes to history. - * - */ - -var keyBreaker = /([^\[\]]+)|(\[\])/g; - -$.Controller.History = { - /** - * @hide - * returns the pathname part - * - * // if the url is "#foo/bar&foo=bar" - * $.Controller.History.pathname() -> 'foo/bar' - * - */ - pathname : function(path) { - var parts = path.match(/#([^&]*)/); - return parts ? parts[1] : null - }, - /** - * @hide - * returns the search part, but without the first & - * - * // if the url is "#foo/bar&foo=bar" - * $.Controller.History.search() -> 'foo=bar' - */ - search : function(path) { - var parts = path.match(/#[^&]*&(.*)/); - return parts ? parts[1] : null - }, - /** - * @hide - * Returns the data - * @param {Object} path - */ - getData: function(path) { - var search = $.Controller.History.search(path), - digitTest = /^\d+$/; - if(! search || ! search.match(/([^?#]*)(#.*)?$/) ) { - return {}; - } - - // Support the legacy format that used MVC.Object.to_query_string that used %20 for - // spaces and not the '+' sign; - search = search.replace(/\+/g,"%20") - return $.String.deparam(search); - } -}; - - - - - -jQuery(function($) { - $(window).bind('hashchange',function() { - var data = $.Controller.History.getData(location.href), - folders = $.Controller.History.pathname(location.href) || 'index', - hasSlash = (folders.indexOf('/') != -1); - - if( !hasSlash && folders != 'index' ) { - folders += '/index'; - } - - OpenAjax.hub.publish("history."+folders.replace("/","."), data); - }); - - setTimeout(function(){ - $(window).trigger('hashchange') - },1) //immediately after ready -}) -/** - * @add jQuery.Controller.prototype - */ - -$.extend($.Controller.prototype, { - /** - * @parent jquery.controller.history - * Redirects to another page. - * @plugin 'dom/history' - * @param {Object} options an object that will turned into a url like #controller/action¶m1=value1 - */ - redirectTo: function(options){ - var point = this._get_history_point(options); - location.hash = point; - }, - /** - * @parent jquery.controller.history - * Redirects to another page by replacing current URL with the given one. This - * call will not create a new entry in the history. - * @plugin 'dom/history' - * @param {Object} options an object that will turned into a url like #controller/action¶m1=value1 - */ - replaceWith: function(options){ - var point = this._get_history_point(options); - location.replace(location.href.split('#')[0] + point); - }, - /** - * @parent jquery.controller.history - * Adds history point to browser history. - * @plugin 'dom/history' - * @param {Object} options an object that will turned into a url like #controller/action¶m1=value1 - * @param {Object} data extra data saved in history -- NO LONGER SUPPORTED - */ - historyAdd : function(options, data) { - var point = this._get_history_point(options); - location.hash = point; - }, - /** - * @hide - * @parent jquery.controller.history - * Creates a history point from given options. Resultant history point is like #controller/action¶m1=value1 - * @plugin 'dom/history' - * @param {Object} options an object that will turned into history point - */ - _get_history_point: function(options) { - var controller_name = options.controller || this.Class.underscoreName; - var action_name = options.action || 'index'; - - /* Convert the options to parameters (removing controller and action if needed) */ - if(options.controller) - delete options.controller; - if(options.action) - delete options.action; - - var paramString = (options) ? $.param(options) : ''; - if(paramString.length) - paramString = '&' + paramString; - - return '#' + controller_name + '/' + action_name + paramString; - }, - - /** - * @parent jquery.controller.history - * Provides current window.location parameters as object properties. - * @plugin 'dom/history' - */ - pathData :function() { - return $.Controller.History.getData(location.href); - } -}); - - - - - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/html5.js b/labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/html5.js deleted file mode 100644 index c2c9407580..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/html5.js +++ /dev/null @@ -1,31 +0,0 @@ -steal.plugins('jquery/controller/subscribe').then(function($){ - - var hasHistoryManagementSupport = !!(window.history && history.pushState); - - if (hasHistoryManagementSupport) { - steal.dev.log("WARNING: The current browser does not support HTML5 History Management."); - } else { - window.onpopstate = function(event) { - OpenAjax.hub.publish("history."+location.href, (event && event.state) || {}); - }; - - setTimeout(function(){ - window.onpopstate(); - }, 1); // immediately after ready - - $.extend($.Controller.prototype, { - redirectTo: function(url, data, title) { - data = data || {}; - window.history.pushState(data, title, url); - this.publish("history." + url, data); - } - }); - - $.Controller.processors["windowpopstate"] = function(el, event, selector, cb) { - $(window).bind("popstate", cb); - return function(){ - $(window).unbind("popstate", cb); - } - }; - } -}) diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/qunit.html deleted file mode 100644 index 7274e70224..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/qunit.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - -

    HTML5 History Test Suite

    -

    -
    -

    -
    -
      -
      - - diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/qunit/qunit.js b/labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/qunit/qunit.js deleted file mode 100755 index 1687eaefb7..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/history/html5/qunit/qunit.js +++ /dev/null @@ -1,82 +0,0 @@ -steal.plugins("funcunit/qunit", "jquery/controller/history/html5").then(function($){ - -module("jquery/controller/history/html5",{ - setup: function(){ - - } -}) - - -$.Controller.extend("HTML5HistoryTestController", { -}, -{ - "history.** subscribe": function(event_name, params) { - this["gotHistory"](event_name.replace("history.", ""), params); - }, - - gotHistory: $.noop, - - "window windowpopstate": function(ev) { - this["gotPopState"](location.href, (ev.originalEvent && ev.originalEvent.state) || {}); - }, - - gotPopState: $.noop -}); - -var originalLocation = location.href; - -asyncTest("Controller redirect should work", function(){ - expect(1); - var testController = new HTML5HistoryTestController($("
      ").get(0)); - - var testLocation = "/test/location"; - testController["gotHistory"] = function(location, state) { - start(); - equals(location, testLocation); - testController["gotHistory"] = $.noop; - testController.redirectTo(originalLocation); - }; - - stop(); - testController.redirectTo(testLocation); -}); - -asyncTest("State data should persist", function(){ - expect(1); - var testController = new HTML5HistoryTestController($("
      ").get(0)); - - testController["gotHistory"] = function(location, state) { - start(); - equals(state.hi, "mom"); - testController["gotHistory"] = $.noop; - testController.redirectTo(originalLocation); - }; - - stop(); - testController.redirectTo("/test/location", { hi: "mom" }); -}); - -asyncTest("Should listen to windowpopstate", function(){ - expect(2); - var testController = new HTML5HistoryTestController($("
      ").get(0)); - - testController["gotPopState"] = function(location, state) { - start(); - ok(location.indexOf("/test/location") !== -1); - equals(state.hi, "mom"); - testController["gotPopState"] = $.noop; - testController.redirectTo(originalLocation); - }; - - stop(); - testController.redirectTo("/test/location", { hi: "mom" }); - - testController["gotHistory"] = function(location, state) { - testController["gotHistory"] = $.noop; - window.history.back(); - }; - - testController.redirectTo("/test/location2", { hi: "mom2" }); -}); - -}); diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/history/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/controller/history/qunit.html deleted file mode 100644 index d4edfd1ef9..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/history/qunit.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - -

      Model Store Cookie Test Suite

      -

      -
      -

      -
      -
        -
        - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/history/qunit/qunit.js b/labs/architecture-examples/javascriptmvc/jquery/controller/history/qunit/qunit.js deleted file mode 100644 index 9a6d5e7125..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/history/qunit/qunit.js +++ /dev/null @@ -1,38 +0,0 @@ -steal.plugins('funcunit/qunit','jquery/controller/history').then(function($){ - -module("jquery/controller/history",{ - setup: function(){ - - } -}) - -test("Basic getData",function(){ - - var data = $.Controller.History.getData("#foo/bar&a=b"); - equals(data.a,"b") - - var data = $.Controller.History.getData("#foo/bar&a=b&c=d"); - equals(data.a,"b") - equals(data.c,"d") -}) -test("Nested getData",function(){ - - var data = $.Controller.History.getData("#foo/bar&a[b]=1&a[c]=2"); - equals(data.a.b,1) - equals(data.a.c,2) - - var data = $.Controller.History.getData("#foo/bar&a[]=1&a[]=2"); - equals(data.a[0],1) - equals(data.a[1],2) - - var data = $.Controller.History.getData("#foo/bar&a[b][]=1&a[b][]=2"); - equals(data.a.b[0],1) - equals(data.a.b[1],2) - - var data = $.Controller.History.getData("#foo/bar&a[0]=1&a[1]=2"); - equals(data.a[0],1) - equals(data.a[1],2) -}) - - -}) diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/pages/document.js b/labs/architecture-examples/javascriptmvc/jquery/controller/pages/document.js deleted file mode 100644 index fc3fd3285c..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/pages/document.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -@page jquery.controller.documentcontrollers Document Controllers -@parent jQuery.Controller - -Document Controllers delegate on the -documentElement. You don't have to attach an instance as this will be done -for you when the controller class is created. Document Controllers, with the -exception of MainControllers, -add an implicit '#CONTROLLERNAME' before every selector. - -To create a document controller, you just have to set -the controller's [jQuery.Controller.static.onDocument static onDocument] -property to true. - -@codestart -$.Controller.extend('TodosController', -{onDocument: true}, -{ - ".todo mouseover" : function( el, ev ) { //matches #todos .todo - el.css("backgroundColor","red") - }, - ".todo mouseout" : function( el, ev ) { //matches #todos .todo - el.css("backgroundColor","") - }, - ".create click" : function() { //matches #todos .create - this.find("ol").append("<li class='todo'>New Todo</li>"); - } -}) -@codeend - -DocumentControllers should be used sparingly. They are not very reusable. -They should only be used for glueing together other controllers and page -layout. - -Often, a Document Controller's "ready" event will be used to create -necessary Element Controllers. - -@codestart -$.Controller.extend('SidebarController', -{onDocument: true}, -{ - ready : function() { - $(".slider").slider() - }, - "a.tag click" : function() {..} -}) -@codeend - -## MainControllers - -MainControllers are documentControllers that do not add '#CONTROLLERNAME' before every selector. This controller -should only be used for page wide functionality and setup. - -@codestart -$.Controller.extend("MainController",{ - hasActiveElement : document.activeElement || false -},{ - focus : funtion(el){ - if(!this.Class.hasActiveElement) - document.activeElement = el[0] //tracks active element - } -}) -@codeend - */ -// \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/pages/listening.js b/labs/architecture-examples/javascriptmvc/jquery/controller/pages/listening.js deleted file mode 100644 index 054f144030..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/pages/listening.js +++ /dev/null @@ -1,192 +0,0 @@ -/** -@page jquery.controller.listening Listening To Events -@parent jQuery.Controller - -Controllers make creating and tearing down event handlers extremely -easy. The tearingdown of event handlers is especially important -in preventing memory leaks in long lived applications. - -## Automatic Binding - -When a [jQuery.Controller.prototype.setup new controller is created], -contoller checks its prototype methods for functions that are named like -event handlers. It binds these functions to the -controller's [jQuery.Controller.prototype.element element] with -event delegation. When -the controller is destroyed (or it's element is removed from the page), controller -will unbind its event handlers automatically. - -For example, each of the following controller's functions will automatically -bound: - - $.Controller("Crazy",{ - - // listens to all clicks on this element - "click" : function(el, ev){}, - - // listens to all mouseovers on - // li elements withing this controller - "li mouseover" : function(el, ev){} - - // listens to the window being resized - "{window} resize" : function(window, ev){} - }) - -Controller will bind function names with spaces, standard DOM events, and -event names in $.event.special. - -In general, Controller will know automatically when to bind event handler functions except for -one case - event names without selectors that are not in $.event.special. - -But to correct for this, you just need to add the -function to the [jQuery.Controller.static.listensTo listensTo] -property. Here's how: - - $.Controller.extend("MyShow",{ - listensTo: ["show"] - },{ - show: function( el, ev ) { - el.show(); - } - }) - $('.show').my_show().trigger("show"); - -## Callback parameters - -Event handlers bound with controller are called back with the element and the event -as parameters. this refers to the controller instance. For example: - - $.Controller("Tabs",{ - - // li - the list element that was clicked - // ev - the click event - "li click" : function(li, ev){ - this.tab(li).hide() - }, - tab : function(li){ - return $(li.find("a").attr("href")) - } - }) - -## Templated Event Bindings - -One of Controller's most powerful features is templated event -handlers. You can parameterize the event name, -the selector, or event the root element. - -### Templating event names and selectors: - -Often, you want to make a widget's behavior -configurable. A common example is configuring which event -a menu should show a sub-menu (ex: on click or mouseenter). The -following controller lets you configure when a menu should show -sub-menus: - -The following makes two buttons. One says hello on click, -the other on a 'tap' event. - - $.Controller("Menu",{ - "li {showEvent}" : function(el){ - el.children('ul').show() - } - }) - - $("#clickMe").menu({showEvent : "click"}); - $("#touchMe").menu({showEvent : "mouseenter"}); - -$.Controller replaces value in {} with -values in a -controller's [jQuery.Controller.prototype.options options]. This means -we can easily provide a default showEvent value and create -a menu without providing a value like: - - $.Controller("Menu", - { - defaults : { - showEvent : "click" - } - }, - { - "li {showEvent}" : function(el){ - el.children('ul').show() - } - }); - - $("#clickMe").menu(); //defaults to using click - -Sometimes, we might might want to configure our widget to -use different elements. The following makes the menu widget's -button elements configurable: - - $.Controller("Menu",{ - "{button} {showEvent}" : function(el){ - el.children('ul').show() - } - }) - - $('#buttonMenu').menu({button: "button"}); - -### Templating the root element. - -Finally, controller lets you bind to objects outside -of the [jQuery.Controller.prototype.element controller's element]. - -The following listens to clicks on the window: - - $.Controller("HideOnClick",{ - "{window} click" : function(){ - this.element.hide() - } - }) - -The following listens to Todos being created: - - $.Controller("NewTodos",{ - "{App.Models.Todo} created" : function(Todo, ev, newTodo){ - this.element.append("newTodos.ejs", newTodo) - } - }); - -But instead of making NewTodos only work with the Todo model, -we can make it configurable: - - $.Controller("Newbie",{ - "{model} created" : function(Model, ev, newItem){ - this.element.append(this.options.view, newItem) - } - }); - - $('#newItems').newbie({ - model: App.Models.Todo, - view: "newTodos.ejs" - }) - -### How Templated events work - -When looking up a value to replace {}, -controller first looks up the item in the options, then it looks -up the value in the window object. It does not use eval to look up the -object. Instead it uses [jQuery.String.getObject]. - - -## Subscribing to OpenAjax messages and custom bindings - -The jquery/controller/subscribe plugin allows controllers to listen -to OpenAjax.hub messages like: - - $.Controller("Listener",{ - "something.updated subscribe" : function(called, data){ - - } - }) - -You can create your own binders by adding to [jQuery.Controller.static.processors]. - -## Manually binding to events. - -The [jQuery.Controller.prototype.bind] and [jQuery.Controller.prototype.delegate] -methods let you listen to events on other elements. These event handlers will -be unbound when the controller instance is destroyed. - - */ -// \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/pages/plugin.js b/labs/architecture-examples/javascriptmvc/jquery/controller/pages/plugin.js deleted file mode 100644 index 6c21eb1eba..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/pages/plugin.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -@page jquery.controller.plugin The generated jQuery plugin -@parent jQuery.Controller - -When you create a controller, it creates a jQuery plugin that can be -used to: - - - Create controllers on an element or elements - - Call controller methods - - Update a controller - -For example, the following controller: - - $.Controller("My.Widget",{ - say : function(){ - alert(this.options.message); - } - }) - -creates a jQuery.fn.my_widget method that you can use like: - - // create my_widget on each .thing - $(".thing").my_widget({message : "Hello"}) - - // alerts "Hello" - $(".thing").my_widget("say"); - - // updates the message option - $(".thing").my_widget({message : "World"}); - - // alerts "World" - $(".thing").my_widget("say"); - -Note that in every case, the my_widget plugin -returns the original jQuery collection for chaining ($('.thing')). If you want to -get a value from a controller, use the [jQuery.fn.controllers] or [jQuery.fn.controller]. - -## Creating controllers - -When a controller's jQuery plugin helper is used on a jQuery collection, it goes to each -element and tests if it has a controller instance on the element. If it does not, it creates one. - -It calls new YourController with the element and any additional arguments you passed -to the jQuery plugin helper. So for example, say there are 2 elements in $('.thing'). - -This: - - $(".thing").my_widget({message : "Hello"}) - -Does the exact same thing as: - - var things = $('.thing'), - options = {message : "Hello"}; - new My.Widget(things[0],options); - new My.Widget(things[1],options); - -Note, when a new Class is created, it calls your -class's prototype setup and init methods. Read [jQuery.Controller.prototype.setup controller's setup] -for the details on what happens when a new controller is created. - - -## Calling methods on controllers - -Once a Controller is already on an element, you can call methods on it with the same jQuery -helper. The first param to the helper is the name of the method, the following params are -passed to the jQuery function. For example: - - $.Controller("Adder",{ - sum : function(first, second, third){ - this.element.text(first+second+third); - } - }) - - // add an adder to the page - $("#myadder").adder() - - // show the sum of 1+2+3 - $("#myadder").adder("sum",1,2,3); - -## Naming - -By default, a controller's jQuery helper is the controller name: - - - [jQuery.String.underscore underscored] - - "." replaced with "_" - - with Controllers removed. - -Here are some examples: - - $.Controller("Foo") // -> .foo() - $.Controller("Foo.Bar") // -> .foo_bar() - $.Controller("Foo.Controllers.Bar") // -> .foo_bar() - -You can overwrite the Controller's default name by setting a static pluginName property: - - $.Controller("My.Tabs", - { - pluginName: "tabs" - }, - { ... }) - - $("#tabs").tabs() - */ -// \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/controller/qunit.html deleted file mode 100644 index ae8fad54a3..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/qunit.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - -

        Controller Test Suite

        -

        -
        -

        -
        -
          -
          - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/funcunit.html b/labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/funcunit.html deleted file mode 100644 index 48dda42488..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/funcunit.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - -

          subscribe Test Suite

          -

          -
          -

          -
          -
            -
            - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/subscribe.html b/labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/subscribe.html deleted file mode 100644 index fd4dc09039..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/subscribe.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - hover - - - -
            -
            - subscribe me -
            -

            Turn OFF Above

            -
            - - - - - diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/subscribe.js b/labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/subscribe.js deleted file mode 100644 index 29b9b03fa7..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/subscribe/subscribe.js +++ /dev/null @@ -1,53 +0,0 @@ -/*global OpenAjax: true */ -steal.plugins('jquery/controller', 'jquery/lang/openajax').then(function() { - - /** - * @function jQuery.Controller.static.processors.subscribe - * @parent jQuery.Controller.static.processors - * @plugin jquery/controller/subscribe - * Adds OpenAjax.Hub subscribing to controllers. - * - * $.Controller("Subscriber",{ - * "recipe.updated subscribe" : function(called, recipe){ - * - * }, - * "todo.* subscribe" : function(called, todo){ - * - * } - * }) - * - * You should typically be listening to jQuery triggered events when communicating between - * controllers. Subscribe should be used for listening to model changes. - * - * ### API - * - * This is the call signiture for the processor, not the controller subscription callbacks. - * - * @param {HTMLElement} el the element being bound. This isn't used. - * @param {String} event the event type (subscribe). - * @param {String} selector the subscription name - * @param {Function} cb the callback function - */ - jQuery.Controller.processors.subscribe = function( el, event, selector, cb ) { - var subscription = OpenAjax.hub.subscribe(selector, cb); - return function() { - var sub = subscription; - OpenAjax.hub.unsubscribe(sub); - }; - }; - - /** - * @add jQuery.Controller.prototype - */ - //breaker - /** - * @function publish - * @hide - * Publishes a message to OpenAjax.hub. - * @param {String} message Message name, ex: "Something.Happened". - * @param {Object} data The data sent. - */ - jQuery.Controller.prototype.publish = function() { - OpenAjax.hub.publish.apply(OpenAjax.hub, arguments); - }; -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/view/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/controller/view/qunit.html deleted file mode 100644 index cc57a78559..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/view/qunit.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - -

            Controller Test Suite

            -

            -
            -

            -
            -
              -
              - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/controller_view_test.js b/labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/controller_view_test.js deleted file mode 100644 index 82188116c9..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/controller_view_test.js +++ /dev/null @@ -1,22 +0,0 @@ -steal.plugins('jquery/controller/view','jquery/view/micro','funcunit/qunit') //load qunit - .then(function(){ - - module("jquery/controller/view"); - - test("this.view", function(){ - - $.Controller.extend("jquery.Controller.View.Test.Qunit",{ - init: function() { - this.element.html(this.view()) - } - }) - jQuery.View.ext = ".micro"; - $("#qunit-test-area").append("
              "); - - new jquery.Controller.View.Test.Qunit( $('#cont_view') ); - - ok(/Hello World/i.test($('#cont_view').text()),"view rendered") - }); - -}); - diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/qunit.js b/labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/qunit.js deleted file mode 100644 index 38255d8c19..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/qunit.js +++ /dev/null @@ -1,6 +0,0 @@ -//we probably have to have this only describing where the tests are -steal - .plugins('jquery/controller/view','jquery/view/micro') //load your app - .plugins('funcunit/qunit') //load qunit - .then("controller_view_test") - diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/views/init.micro b/labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/views/init.micro deleted file mode 100644 index 9a1eb8d215..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/view/test/qunit/views/init.micro +++ /dev/null @@ -1 +0,0 @@ -

              Hello World

              \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/controller/view/view.js b/labs/architecture-examples/javascriptmvc/jquery/controller/view/view.js deleted file mode 100644 index 8872d138a2..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/controller/view/view.js +++ /dev/null @@ -1,110 +0,0 @@ -steal.plugins('jquery/controller', 'jquery/view').then(function( $ ) { - jQuery.Controller.getFolder = function() { - return jQuery.String.underscore(this.fullName.replace(/\./g, "/")).replace("/Controllers", ""); - }; - - var calculatePosition = function( Class, view, action_name ) { - var slashes = Class.fullName.replace(/\./g, "/"), - hasControllers = slashes.indexOf("/Controllers/" + Class.shortName) != -1, - path = jQuery.String.underscore(slashes.replace("/Controllers/" + Class.shortName, "")), - controller_name = Class._shortName, - suffix = (typeof view == "string" && view.match(/\.[\w\d]+$/)) || jQuery.View.ext; - - //calculate view - if ( typeof view == "string" ) { - if ( view.substr(0, 2) == "//" ) { //leave where it is - } else { - view = "//" + new steal.File('views/' + (view.indexOf('/') !== -1 ? view : (hasControllers ? controller_name + '/' : "") + view)).joinFrom(path) + suffix; - } - } else if (!view ) { - view = "//" + new steal.File('views/' + (hasControllers ? controller_name + '/' : "") + action_name.replace(/\.|#/g, '').replace(/ /g, '_')).joinFrom(path) + suffix; - } - return view; - }; - var calculateHelpers = function( myhelpers ) { - var helpers = {}; - if ( myhelpers ) { - if ( jQuery.isArray(myhelpers) ) { - for ( var h = 0; h < myhelpers.length; h++ ) { - jQuery.extend(helpers, myhelpers[h]); - } - } - else { - jQuery.extend(helpers, myhelpers); - } - } else { - if ( this._default_helpers ) { - helpers = this._default_helpers; - } - //load from name - var current = window; - var parts = this.Class.fullName.split(/\./); - for ( var i = 0; i < parts.length; i++ ) { - if ( typeof current.Helpers == 'object' ) { - jQuery.extend(helpers, current.Helpers); - } - current = current[parts[i]]; - } - if ( typeof current.Helpers == 'object' ) { - jQuery.extend(helpers, current.Helpers); - } - this._default_helpers = helpers; - } - return helpers; - }; - - /** - * @add jQuery.Controller.prototype - */ - - jQuery.Controller.prototype. - /** - * @tag view - * Renders a View template with the controller instance. If the first argument - * is not supplied, - * it looks for a view in /views/controller_name/action_name.ejs. - * If data is not provided, it uses the controller instance as data. - * @codestart - * TasksController = $.Controller.extend('TasksController',{ - * click: function( el ) { - * // renders with views/tasks/click.ejs - * el.html( this.view() ) - * // renders with views/tasks/under.ejs - * el.after( this.view("under", [1,2]) ); - * // renders with views/shared/top.ejs - * el.before( this.view("shared/top", {phrase: "hi"}) ); - * } - * }) - * @codeend - * @plugin controller/view - * @return {String} the rendered result of the view. - * @param {String} [optional1] view The view you are going to render. If a view isn't explicity given - * this function will try to guess at the correct view as show in the example code above. - * @param {Object} [optional2] data data to be provided to the view. If not present, the controller instance - * is used. - * @param {Object} [optional3] myhelpers an object of helpers that will be available in the view. If not present - * this controller class's "Helpers" property will be used. - * - */ - view = function( view, data, myhelpers ) { - //shift args if no view is provided - if ( typeof view != "string" && !myhelpers ) { - myhelpers = data; - data = view; - view = null; - } - //guess from controller name - view = calculatePosition(this.Class, view, this.called); - - //calculate data - data = data || this; - - //calculate helpers - var helpers = calculateHelpers.call(this, myhelpers); - - - return jQuery.View(view, data, helpers); //what about controllers in other folders? - }; - - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/closest/closest.js b/labs/architecture-examples/javascriptmvc/jquery/dom/closest/closest.js deleted file mode 100644 index 906e865cbf..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/closest/closest.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @add jQuery.fn - */ -steal.plugins('jquery/dom').then(function(){ - /** - * @function closest - * @parent dom - * Overwrites closest to allow open > selectors. This allows controller actions such as: - * @codestart - * ">li click" : function( el, ev ) { ... } - * @codeend - */ - var oldClosest = jQuery.fn.closest; - jQuery.fn.closest = function(selectors, context){ - var rooted = {}, res, result, thing, i, j, selector, rootedIsEmpty = true, selector, selectorsArr = selectors; - if(typeof selectors == "string") selectorsArr = [selectors]; - - $.each(selectorsArr, function(i, selector){ - if(selector.indexOf(">") == 0 ){ - if(selector.indexOf(" ") != -1){ - throw " closest does not work with > followed by spaces!" - } - rooted[( selectorsArr[i] = selector.substr(1) )] = selector; - if(typeof selectors == "string") selectors = selector.substr(1); - rootedIsEmpty = false; - } - }) - - res = oldClosest.call(this, selectors, context); - - if(rootedIsEmpty) return res; - i =0; - while(i < res.length){ - result = res[i], selector = result.selector; - if (rooted[selector] !== undefined) { - result.selector = rooted[selector]; - rooted[selector] = false; - if(typeof result.selector !== "string" || result.elem.parentNode !== context ){ - res.splice(i,1); - continue; - } - } - i++; - } - return res; - } -}) \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare.html b/labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare.html deleted file mode 100644 index 4e744c69b8..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - Compare Element Positions - - - -

              Click 2 elements to compare them.

              -
              -$('.red').compare($('.green')) = 
              -
              -
              -
              - A -
              A.1
              -
              A.2
              -
              -
              - B -
              -
              -

              Key

              - - - - - - - - - -
              BitsNumberMeaning
              0000000Elements are identical.
              0000011The nodes are in different documents (or one is outside of a document).
              0000102Node B precedes Node A.
              0001004Node A precedes Node B.
              0010008Node B contains Node A.
              01000016Node A contains Node B.
              - - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare.js b/labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare.js deleted file mode 100644 index a7e80ddf04..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @add jQuery.fn - */ -steal.plugins('jquery/dom').then(function($){ -/** - * @function compare - * @parent dom - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/dom/compare/compare.js - * - * Compares the position of two nodes and returns a bitmask detailing how they are positioned - * relative to each other. - * - * $('#foo').compare($('#bar')) //-> Number - * - * You can expect it to return the same results as - * [http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-compareDocumentPosition | compareDocumentPosition]. - * Parts of this documentation and source come from [http://ejohn.org/blog/comparing-document-position | John Resig]. - * - * ## Demo - * @demo jquery/dom/compare/compare.html - * @test jquery/dom/compare/qunit.html - * @plugin dom/compare - * - * - * @param {HTMLElement|jQuery} element an element or jQuery collection to compare against. - * @return {Number} A bitmap number representing how the elements are positioned from each other. - * - * If the code looks like: - * - * $('#foo').compare($('#bar')) //-> Number - * - * Number is a bitmap with with the following values: - * - * - * - * - * - * - * - * - *
              BitsNumberMeaning
              0000000Elements are identical.
              0000011The nodes are in different - * documents (or one is outside of a document).
              0000102#bar precedes #foo.
              0001004#foo precedes #bar.
              0010008#bar contains #foo.
              01000016#foo contains #bar.
              - */ -jQuery.fn.compare = function(element){ //usually - //element is usually a relatedTarget, but element/c it is we have to avoid a few FF errors - - try{ //FF3 freaks out with XUL - element = element.jquery ? element[0] : element; - }catch(e){ - return null; - } - if (window.HTMLElement) { //make sure we aren't coming from XUL element - var s = HTMLElement.prototype.toString.call(element) - if (s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]') return null; - } - if(this[0].compareDocumentPosition){ - return this[0].compareDocumentPosition(element); - } - if(this[0] == document && element != document) return 8; - var number = (this[0] !== element && this[0].contains(element) && 16) + (this[0] != element && element.contains(this[0]) && 8), - docEl = document.documentElement; - if(this[0].sourceIndex){ - number += (this[0].sourceIndex < element.sourceIndex && 4) - number += (this[0].sourceIndex > element.sourceIndex && 2) - number += (this[0].ownerDocument !== element.ownerDocument || - (this[0] != docEl && this[0].sourceIndex <= 0 ) || - (element != docEl && element.sourceIndex <= 0 )) && 1 - }else{ - var range = document.createRange(), - sourceRange = document.createRange(), - compare; - range.selectNode(this[0]); - sourceRange.selectNode(element); - compare = range.compareBoundaryPoints(Range.START_TO_START, sourceRange); - - } - - return number; -} - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare_test.js b/labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare_test.js deleted file mode 100644 index f005176c32..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/compare/compare_test.js +++ /dev/null @@ -1,25 +0,0 @@ -steal - .plugins("jquery/dom/compare") //load your app - .plugins('funcunit/qunit').then(function(){ - -module("jquery/dom/compare") -test("Compare cases", function(){ - $(document.body).append("
              ") - var outer = $("#outer"), - first= outer.find(".first"), second = outer.find('.second') - equals(outer.compare(outer) , 0, "identical elements") - var outside = document.createElement("div") - ok(outer.compare(outside) & 1, "different documents") - - equals(outer.compare(first), 20, "A container element"); - equals(outer.compare(second), 20, "A container element"); - - equals(first.compare(outer), 10, "A parent element"); - equals(second.compare(outer), 10, "A parent element"); - - equals(first.compare(second), 4, "A sibling elements"); - equals(second.compare(first), 2, "A sibling elements"); - outer.remove() -}); - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/compare/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/dom/compare/qunit.html deleted file mode 100644 index d7c4044202..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/compare/qunit.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - -

              jQuery Dom Compare Test Suite

              -

              -
              -

              -
                - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/cookie/cookie.js b/labs/architecture-examples/javascriptmvc/jquery/dom/cookie/cookie.js deleted file mode 100644 index 38c03e876d..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/cookie/cookie.js +++ /dev/null @@ -1,119 +0,0 @@ -steal.plugins('jquery/lang/json').then(function() { - // break - /** - * @function jQuery.cookie - * @parent dom - * @author Klaus Hartl/klaus.hartl@stilbuero.de - * - *

                Cookie plugin

                - * - * - *

                - * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
                - * Dual licensed under the MIT and GPL licenses:
                - * http://www.opensource.org/licenses/mit-license.php
                - * http://www.gnu.org/licenses/gpl.html - *

                - *

                - * Create a cookie with the given name and value and other optional parameters. - * / Get the value of a cookie with the given name. - *

                - *

                Quick Examples

                - * - * Set the value of a cookie. - * @codestart - * * $.cookie('the_cookie', 'the_value'); - * @codeend - * - * Create a cookie with all available options. - * @codestart - * $.cookie('the_cookie', 'the_value', - * { expires: 7, path: '/', domain: 'jquery.com', secure: true }); - * @codeend - * - * Create a session cookie. - * @codestart - * $.cookie('the_cookie', 'the_value'); - * @codeend - * - * Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain - * used when the cookie was set. - * @codestart - * $.cookie('the_cookie', null); - * @codeend - * - * Get the value of a cookie. - * @codestart - * $.cookie('the_cookie'); - * @codeend - * - * - * @param {String} [name] The name of the cookie. - * @param {String} [value] The value of the cookie. - * @param {Object} [options] An object literal containing key/value pairs to provide optional cookie attributes.
                - * @param {Number|Date} [expires] Either an integer specifying the expiration date from now on in days or a Date object. - * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. - * If set to null or omitted, the cookie will be a session cookie and will not be retained - * when the the browser exits.
                - * @param {String} [path] The value of the path atribute of the cookie (default: path of page that created the cookie).
                - * @param {String} [domain] The value of the domain attribute of the cookie (default: domain of page that created the cookie).
                - * @param {Boolean} secure If true, the secure attribute of the cookie will be set and the cookie transmission will - * require a secure protocol (like HTTPS).
                - * @return {String} or {undefined} when setting the cookie. - */ - jQuery.cookie = function(name, value, options) { - if (typeof value != 'undefined') { // name and value given, set cookie - options = options || - {}; - if (value === null) { - value = ''; - options.expires = -1; - } - if (typeof value == 'object' && jQuery.toJSON) { - value = jQuery.toJSON(value); - } - var expires = ''; - if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { - var date; - if (typeof options.expires == 'number') { - date = new Date(); - date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); - } - else { - date = options.expires; - } - expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE - } - // CAUTION: Needed to parenthesize options.path and options.domain - // in the following expressions, otherwise they evaluate to undefined - // in the packed version for some reason... - var path = options.path ? '; path=' + (options.path) : ''; - var domain = options.domain ? '; domain=' + (options.domain) : ''; - var secure = options.secure ? '; secure' : ''; - document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); - } - else { // only name given, get cookie - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - if (jQuery.evalJSON && cookieValue && cookieValue.match(/^\s*\{/)) { - try { - cookieValue = jQuery.evalJSON(cookieValue); - } - catch (e) { - } - } - return cookieValue; - } - }; - -}); diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles.html b/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles.html deleted file mode 100644 index 51e11c41ad..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - CurStyles Performance Test/Demo - - - -

                CurStyles Performance

                -

                This demo shows how $.curStyles out-performs $.curCSS

                -
                -
                - Click To Run -
                -
                - - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles.js b/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles.js deleted file mode 100644 index b44590e58f..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles.js +++ /dev/null @@ -1,117 +0,0 @@ -steal.plugins('jquery/dom').then(function( $ ) { - - var getComputedStyle = document.defaultView && document.defaultView.getComputedStyle, - rupper = /([A-Z])/g, - rdashAlpha = /-([a-z])/ig, - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - getStyle = function( elem ) { - if ( getComputedStyle ) { - return getComputedStyle(elem, null); - } - else if ( elem.currentStyle ) { - return elem.currentStyle; - } - }, - rfloat = /float/i, - rnumpx = /^-?\d+(?:px)?$/i, - rnum = /^-?\d/; - /** - * @add jQuery - */ - // - /** - * @function curStyles - * @param {HTMLElement} el - * @param {Array} styles An array of style names like ['marginTop','borderLeft'] - * @return {Object} an object of style:value pairs. Style names are camelCase. - */ - $.curStyles = function( el, styles ) { - if (!el ) { - return null; - } - var currentS = getStyle(el), - oldName, val, style = el.style, - results = {}, - i = 0, - left, rsLeft, camelCase, name; - - for (; i < styles.length; i++ ) { - name = styles[i]; - oldName = name.replace(rdashAlpha, fcamelCase); - - if ( rfloat.test(name) ) { - name = jQuery.support.cssFloat ? "float" : "styleFloat"; - oldName = "cssFloat"; - } - - if ( getComputedStyle ) { - name = name.replace(rupper, "-$1").toLowerCase(); - val = currentS.getPropertyValue(name); - if ( name === "opacity" && val === "" ) { - val = "1"; - } - results[oldName] = val; - } else { - camelCase = name.replace(rdashAlpha, fcamelCase); - results[oldName] = currentS[name] || currentS[camelCase]; - - - if (!rnumpx.test(results[oldName]) && rnum.test(results[oldName]) ) { //convert to px - // Remember the original values - left = style.left; - rsLeft = el.runtimeStyle.left; - - // Put in the new values to get a computed value out - el.runtimeStyle.left = el.currentStyle.left; - style.left = camelCase === "fontSize" ? "1em" : (results[oldName] || 0); - results[oldName] = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - el.runtimeStyle.left = rsLeft; - } - - } - } - - return results; - }; - /** - * @add jQuery.fn - */ - - - $.fn - /** - * @parent dom - * @plugin jquery/dom/cur_styles - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/dom/cur_styles/cur_styles.js - * @test jquery/dom/cur_styles/qunit.html - * Use curStyles to rapidly get a bunch of computed styles from an element. - *

                Quick Example

                - * @codestart - * $("#foo").curStyles('float','display') //-> - * // { - * // cssFloat: "left", display: "block" - * // } - * @codeend - *

                Use

                - *

                An element's computed style is the current calculated style of the property. - * This is different than the values on element.style as - * element.style doesn't reflect styles provided by css or the browser's default - * css properties.

                - *

                Getting computed values individually is expensive! This plugin lets you get all - * the style properties you need all at once.

                - *

                Demo

                - *

                The following demo illustrates the performance improvement curStyle provides by providing - * a faster 'height' jQuery function called 'fastHeight'.

                - * @demo jquery/dom/cur_styles/cur_styles.html - * @param {String} style pass style names as arguments - * @return {Object} an object of style:value pairs - */ - .curStyles = function() { - return $.curStyles(this[0], $.makeArray(arguments)); - }; -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles_test.js b/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles_test.js deleted file mode 100644 index e279172acf..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/cur_styles_test.js +++ /dev/null @@ -1,29 +0,0 @@ -steal - .plugins("jquery/dom/dimensions",'jquery/view/micro') //load your app - .plugins('funcunit/qunit').then(function(){ - -module("jquery/dom/curStyles"); - - -test("reading", function(){ - - $("#qunit-test-area").html("//jquery/dom/cur_styles/test/curStyles.micro",{}) - - var res = $.curStyles( $("#styled")[0], - ["padding-left", - 'position', - 'display', - "margin-top", - "borderTopWidth", - "float"] ); - equals(res.borderTopWidth, "2px","border top"); - equals(res.display, "block","display"); - equals(res.cssFloat, "left","float"); - equals(res.marginTop, "10px","margin top"); - equals(res.paddingLeft, "5px","padding left"); - equals(res.position, "relative","position"); - $("#qunit-test-area").html("") -}); - -}) - diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/qunit.html deleted file mode 100644 index 736ae9d64d..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/qunit.html +++ /dev/null @@ -1,22 +0,0 @@ - - - CurStyles Test Suite - - - - - - -

                CurStyles Test Suite

                -

                -
                -

                -
                -
                  -
                  - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/test/curStyles.micro b/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/test/curStyles.micro deleted file mode 100644 index 7c7503ca44..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/cur_styles/test/curStyles.micro +++ /dev/null @@ -1,3 +0,0 @@ -
                  -Here is some content; -
                  \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/dimensions.html b/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/dimensions.html deleted file mode 100644 index 6e2e31502a..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/dimensions.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - Dimensions Demo - - - - - -
                  -

                  Adjust The red box's layout properties.

                  -
                  -
                  -
                  -
                  -
                  -
                  -
                  - -
                  -
                  -
                  - Adjust My Layout Properties -
                  -
                  -
                  -
                  -
                  - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/dimensions.js b/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/dimensions.js deleted file mode 100644 index 2d4b0f17b8..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/dimensions.js +++ /dev/null @@ -1,140 +0,0 @@ - -steal.plugins('jquery/dom/cur_styles').then(function($) { -/** - * @page dimensions dimensions - * @parent dom - *

                  jquery/dom/dimensions Plugin

                  - * The dimensions plugin adds support for setting+animating inner+outer height and widths. - *

                  Quick Examples

                  -@codestart -$('#foo').outerWidth(100).innerHeight(50); -$('#bar').animate({outerWidth: 500}); -@codeend - *

                  Use

                  - *

                  When writing reusable plugins, you often want to - * set or animate an element's width and height that include its padding, - * border, or margin. This is especially important in plugins that - * allow custom styling. - * The dimensions plugin overwrites [jQuery.fn.outerHeight outerHeight], - * [jQuery.fn.outerWidth outerWidth], [jQuery.fn.innerHeight innerHeight] - * and [jQuery.fn.innerWidth innerWidth] - * to let you set and animate these properties. - *

                  - *

                  Demo

                  - * @demo jquery/dom/dimensions/dimensions.html - */ - -var weird = /button|select/i, //margin is inside border - getBoxes = {}, - checks = { - width: ["Left", "Right"], - height: ['Top', 'Bottom'], - oldOuterHeight: $.fn.outerHeight, - oldOuterWidth: $.fn.outerWidth, - oldInnerWidth: $.fn.innerWidth, - oldInnerHeight: $.fn.innerHeight - }; -/** - * @add jQuery.fn - */ -$.each({ - -/* - * @function outerWidth - * @parent dimensions - * Lets you set the outer height on an object - * @param {Number} [height] - * @param {Boolean} [includeMargin] - */ -width: -/* - * @function innerWidth - * @parent dimensions - * Lets you set the inner height of an object - * @param {Number} [height] - */ -"Width", -/* - * @function outerHeight - * @parent dimensions - * Lets you set the outer height of an object where:
                  - * outerHeight = height + padding + border + (margin). - * @codestart - * $("#foo").outerHeight(100); //sets outer height - * $("#foo").outerHeight(100, true); //uses margins - * $("#foo").outerHeight(); //returns outer height - * $("#foo").outerHeight(true); //returns outer height with margins - * @codeend - * When setting the outerHeight, it adjusts the height of the element. - * @param {Number|Boolean} [height] If a number is provided -> sets the outer height of the object.
                  - * If true is given -> returns the outer height and includes margins.
                  - * If no value is given -> returns the outer height without margin. - * @param {Boolean} [includeMargin] Makes setting the outerHeight adjust for margin. - * @return {jQuery|Number} If you are setting the value, returns the jQuery wrapped elements. - * Otherwise, returns outerHeight in pixels. - */ -height: -/* - * @function innerHeight - * @parent dimensions - * Lets you set the outer width on an object - * @param {Number} [height] - */ -"Height" }, function(lower, Upper) { - - //used to get the padding and border for an element in a given direction - getBoxes[lower] = function(el, boxes) { - var val = 0; - if (!weird.test(el.nodeName)) { - //make what to check for .... - var myChecks = []; - $.each(checks[lower], function() { - var direction = this; - $.each(boxes, function(name, val) { - if (val) - myChecks.push(name + direction+ (name == 'border' ? "Width" : "") ); - }) - }) - $.each($.curStyles(el, myChecks), function(name, value) { - val += (parseFloat(value) || 0); - }) - } - return val; - } - - //getter / setter - $.fn["outer" + Upper] = function(v, margin) { - if (typeof v == 'number') { - this[lower](v - getBoxes[lower](this[0], {padding: true, border: true, margin: margin})) - return this; - } else { - return checks["oldOuter" + Upper].call(this, v) - } - } - $.fn["inner" + Upper] = function(v) { - if (typeof v == 'number') { - this[lower](v - getBoxes[lower](this[0], { padding: true })) - return this; - } else { - return checks["oldInner" + Upper].call(this, v) - } - } - //provides animations - var animate = function(boxes){ - return function(fx){ - if (fx.state == 0) { - fx.start = $(fx.elem)[lower](); - fx.end = fx.end - getBoxes[lower](fx.elem,boxes); - } - fx.elem.style[lower] = (fx.pos * (fx.end - fx.start) + fx.start) + "px" - } - } - $.fx.step["outer" + Upper] = animate({padding: true, border: true}) - - $.fx.step["outer" + Upper+"Margin"] = animate({padding: true, border: true, margin: true}) - - $.fx.step["inner" + Upper] = animate({padding: true}) - -}) - -}) diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/qunit.html deleted file mode 100644 index 3636028fb1..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/qunit.html +++ /dev/null @@ -1,22 +0,0 @@ - - - Dimensions Test Suite - - - - - - -

                  Dimensions Test Suite

                  -

                  -
                  -

                  -
                  -
                    -
                    - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/curStyles.micro b/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/curStyles.micro deleted file mode 100644 index 7c7503ca44..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/curStyles.micro +++ /dev/null @@ -1,3 +0,0 @@ -
                    -Here is some content; -
                    \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/dimensions_test.js b/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/dimensions_test.js deleted file mode 100644 index 9d34e7e8f9..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/dimensions_test.js +++ /dev/null @@ -1,8 +0,0 @@ -module("jquery/dom/dimensions"); - - - - -test("outerHeight and width",function(){ - $("#qunit-test-area").html("//jquery/dom/dimensions/test/qunit/curStyles.micro",{}) -}) diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/outer.micro b/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/outer.micro deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/qunit.js b/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/qunit.js deleted file mode 100644 index d842c59654..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/dimensions/test/qunit/qunit.js +++ /dev/null @@ -1,4 +0,0 @@ -steal - .plugins("jquery/dom/dimensions",'jquery/view/micro') //load your app - .plugins('funcunit/qunit') //load qunit - .then("dimensions_test") \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/dom.js b/labs/architecture-examples/javascriptmvc/jquery/dom/dom.js deleted file mode 100644 index e2204e8a69..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/dom.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -@page dom DOM Helpers -@tag core -JavaScriptMVC adds a bunch of useful -jQuery extensions for the dom. Check them out on the left. - -## [dimensions Dimensions] - -Set and animate the inner and outer height and width of elements. - - $('#foo').outerWidth(100); - $('#bar').animate({innerWidth: 500}); - -This is great when you want to include padding and margin in -setting the dimensions of elements. - -## [jQuery.cookie Cookie] - -Set and get cookie values: - - $.cookie('cookie','value'); - -## [jQuery.fixture Fixture] - -Simulate Ajax responses. - - $.fixture("/services/tasks.php','fixtures/tasks.json'); - -Works with jQuery's Ajax converters! - -## [jQuery.fn.compare Compare] - -Compare the location of two elements rapidly. - - $('#foo').compare($('#bar')) & 2 // true if #bar is before #foo - -## [jQuery.fn.curStyles CurStyles] - -Get multiple css properties quickly. - - $('#foo').curStyles('left','top') //-> {left:'20px',top:'10px'} - -## [jQuery.fn.formParams FormParams] - -Serializes a form into a JSON-like object: - - $('form').formParams() //-> {name: 'Justin', favs: ['JS','Ruby']} - -## [jQuery.fn.selection Selection] - -Gets or sets the current text selection. - - // gets selection info - $('pre').selection() //-> {start: 22, end: 57, range: range} - - // sets the selection - $('div').selection(20,22) - -## [jQuery.fn.within Within] - -Returns elements that have a point within their boundaries. - - $('.drop').within(200,200) //-> drops that touch 200,200 - -## [jQuery.Range Range] - -Text range utilities. - - $('#copy').range() //-> text range that has copy selected - - -*/ -steal.plugins('jquery'); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture.html b/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture.html deleted file mode 100644 index 75a7d6de1d..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - Fixture Demo - - - -
                    -
                    -
                    - - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture.js b/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture.js deleted file mode 100644 index f1ceb37a19..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture.js +++ /dev/null @@ -1,800 +0,0 @@ -steal.plugins('jquery/dom').then(function( $ ) { - - // the pre-filter needs to re-route the url - $.ajaxPrefilter( function( settings, originalOptions, jqXHR ) { - // if fixtures are on - if(! $.fixture.on) { - return; - } - - // add the fixture option if programmed in - overwrite(settings); - - // if we don't have a fixture, do nothing - if(!settings.fixture){ - return; - } - - //if referencing something else, update the fixture option - if ( typeof settings.fixture === "string" && $.fixture[settings.fixture] ) { - settings.fixture = $.fixture[settings.fixture]; - } - - // if a string, we just point to the right url - if ( typeof settings.fixture == "string" ) { - var url = settings.fixture; - - if (/^\/\//.test(url) ) { - url = steal.root.join(settings.fixture.substr(2)); - } - //@steal-remove-start - steal.dev.log("looking for fixture in " + url); - //@steal-remove-end - settings.url = url; - settings.data = null; - settings.type = "GET"; - if (!settings.error ) { - settings.error = function( xhr, error, message ) { - throw "fixtures.js Error " + error + " " + message; - }; - } - - }else { - //@steal-remove-start - steal.dev.log("using a dynamic fixture for " + settings.url); - //@steal-remove-end - - //it's a function ... add the fixture datatype so our fixture transport handles it - // TODO: make everything go here for timing and other fun stuff - settings.dataTypes.splice(0,0,"fixture") - } - - }); - - - $.ajaxTransport( "fixture", function( s, original ) { - - // remove the fixture from the datatype - s.dataTypes.shift(); - - //we'll return the result of the next data type - var next = s.dataTypes[0], - timeout; - - return { - - send: function( headers , callback ) { - - // callback after a timeout - timeout = setTimeout(function() { - - // get the callback data from the fixture function - var response = s.fixture(original, s, headers); - - // normalize the fixture data into a response - if(!$.isArray(response)){ - var tmp = [{}]; - tmp[0][next] = response - response = tmp; - } - if(typeof response[0] != 'number'){ - response.unshift(200,"success") - } - - // make sure we provide a response type that matches the first datatype (typically json) - if(!response[2] || !response[2][next]){ - var tmp = {} - tmp[next] = response[2]; - response[2] = tmp; - } - - // pass the fixture data back to $.ajax - callback.apply(null, response ); - }, $.fixture.delay); - }, - - abort: function() { - clearTimeout(timeout) - } - }; - - }); - - - - var typeTest = /^(script|json|test|jsonp)$/, - // a list of 'overwrite' settings object - overwrites = [], - // checks if an overwrite matches ajax settings - isSimilar = function(settings, overwrite, exact){ - - settings = $.extend({}, settings) - - for(var prop in overwrite){ - if(prop === 'fixture'){ - - } else if(overwrite[prop] !== settings[prop]){ - return false; - } - if(exact){ - delete settings[prop] - } - } - if(exact){ - for(var name in settings){ - return false - } - } - return true; - }, - // returns the index of an overwrite function - find = function(settings, exact){ - for(var i =0; i < overwrites.length; i++){ - if(isSimilar(settings, overwrites[i], exact)){ - return i; - } - } - return -1; - }, - // overwrites the settings fixture if an overwrite matches - overwrite = function(settings){ - var index = find(settings); - if(index > -1){ - settings.fixture = overwrites[index].fixture; - } - - }, - /** - * Makes an attempt to guess where the id is at in the url and returns it. - * @param {Object} settings - */ - getId = function(settings){ - var id = settings.data.id; - - if(id === undefined){ - settings.url.replace(/\/(\d+)(\/|$)/g, function(all, num){ - id = num; - }); - } - - if(id === undefined){ - id = settings.url.replace(/\/(\w+)(\/|$)/g, function(all, num){ - if(num != 'update'){ - id = num; - } - }) - } - - if(id === undefined){ // if still not set, guess a random number - id = Math.round(Math.random()*1000) - } - - return id; - }; - - /** - * @class jQuery.fixture - * @plugin jquery/dom/fixture - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/dom/fixture/fixture.js - * @test jquery/dom/fixture/qunit.html - * @parent dom - * - * Fixtures simulate AJAX responses. Instead of making - * a request to a server, fixtures simulate - * the response with a file or function. They are a great technique when you want to develop JavaScript - * independently of the backend. - * - * ### Two Quick Examples - * - * There are two common ways of using fixtures. The first is to - * map Ajax requests to another file or function. The following - * intercepts requests to /tasks.json and directs them - * to fixtures/tasks.json: - * - * $.fixture("/tasks.json","fixtures/tasks.json"); - * - * You can also add a fixture option directly to $.ajax like: - * - * $.ajax({url: "/tasks.json", - * dataType: "json", - * type: "get", - * fixture: "fixtures/tasks.json", - * success: myCallback - * }); - * - * The first technique keeps fixture logic out of your Ajax - * requests. However, if your service urls are changing __a lot__ - * the second technique means you only have to change the service - * url in one spot. - * - * - * - * ## Types of Fixtures - * - * There are 2 types of fixtures: - * - __Static__ - the response is in a file. - * - __Dynamic__ - the response is generated by a function. - * - * There are different ways to lookup static and dynamic fixtures. - * - * ### Static Fixtures - * - * Static fixtures use an alternate url as the response of the Ajax request. - * - * // looks in fixtures/tasks1.json relative to page - * $.fixture("tasks/1", "fixtures/task1.json"); - * - * $.ajax({type:"get", - * url: "tasks/1", - * fixture: "fixtures/task1.json"}) - * - * // looks in fixtures/tasks1.json relative to jmvc root - * // this assumes you are using steal - * $.fixture("tasks/1", "//fixtures/task1.json"); - * - * $.ajax({type:"get", - * url: "tasks/1", - * fixture: "//fixtures/task1.json"})` - * - * ### Dynamic Fixtures - * - * Dynamic Fixtures are functions that return the arguments the $.ajax callbacks - * (beforeSend, success, complete, - * error) expect. - * - * For example, the "success" of a json request is called with - * [data, textStatus, XMLHttpRequest]. - * - * There are 2 ways to lookup dynamic fixtures. They can provided: - * - * //just use a function as the fixture property - * $.ajax({ - * type: "get", - * url: "tasks", - * data: {id: 5}, - * dataType: "json", - * fixture: function( settings, callbackType ) { - * var xhr = {responseText: "{id:"+settings.data.id+"}"} - * switch(callbackType){ - * case "success": - * return [{id: settings.data.id},"success",xhr] - * case "complete": - * return [xhr,"success"] - * } - * } - * }) - * - * Or found by name on $.fixture: - * - * // add your function on $.fixture - * // We use -FUNC by convention - * $.fixture["-myGet"] = function(settings, cbType){...} - * - * // reference it - * $.ajax({ - * type:"get", - * url: "tasks/1", - * dataType: "json", - * fixture: "-myGet"}) - * - *

                    Dynamic fixture functions are called with:

                    - *
                      - *
                    • settings - the settings data passed to $.ajax() - *
                    • calbackType - the type of callback about to be called: - * "beforeSend", "success", "complete", - * "error"
                    • - *
                    - * and should return an array of arguments for the callback.

                    - *
                    PRO TIP: - * Dynamic fixtures are awesome for performance testing. Want to see what - * 10000 files does to your app's performance? Make a fixture that returns 10000 items. - * - * What to see what the app feels like when a request takes 5 seconds to return? Set - * [jQuery.fixture.delay] to 5000. - *
                    - * - * ## Helpers - * - * The fixture plugin comes with a few ready-made dynamic fixtures and - * fixture helpers:

                    - * - *
                      - *
                    • [jQuery.fixture.make] - creates fixtures for findAll, findOne.
                    • - *
                    • [jQuery.fixture.-restCreate] - a fixture for restful creates.
                    • - *
                    • [jQuery.fixture.-restDestroy] - a fixture for restful updates.
                    • - *
                    • [jQuery.fixture.-restUpdate] - a fixture for restful destroys.
                    • - *
                    - * - * @demo jquery/dom/fixture/fixture.html - * @constructor - * Takes an ajax settings and returns a url to look for a fixture. Overwrite this if you want a custom lookup method. - * @param {Object} settings - * @return {String} the url that will be used for the fixture - */ - $.fixture = function( settings , fixture) { - // if we provide a fixture ... - if(fixture !== undefined){ - if(typeof settings == 'string'){ - // handle url strings - settings ={ - url : settings - }; - } - - //handle removing. An exact match if fixture was provided, otherwise, anything similar - var index = find(settings, !!fixture); - if(index >= -1){ - overwrites.splice(index,1) - } - if(fixture == null){ - return - } - - settings.fixture = fixture; - overwrites.push(settings) - } - }; - - $.extend($.fixture, { - /** - * Provides a rest update fixture function - */ - "-restUpdate": function( settings ) { - return [{ - id: getId(settings) - },{ - location: settings.url+"/"+getId(settings) - }]; - }, - - /** - * Provides a rest destroy fixture function - */ - "-restDestroy": function( settings, cbType ) { - return {}; - }, - - /** - * Provides a rest create fixture function - */ - "-restCreate": function( settings, cbType ) { - var id = parseInt(Math.random() * 100000, 10); - return [{ - id: id - },{ - location: settings.url+"/"+id - }]; - }, - - /** - * Used to make fixtures for findAll / findOne style requests. - * @codestart - * //makes a nested list of messages - * $.fixture.make(["messages","message"],1000, function(i, messages){ - * return { - * subject: "This is message "+i, - * body: "Here is some text for this message", - * date: Math.floor( new Date().getTime() ), - * parentId : i < 100 ? null : Math.floor(Math.random()*i) - * } - * }) - * //uses the message fixture to return messages limited by offset, limit, order, etc. - * $.ajax({ - * url: "messages", - * data:{ - * offset: 100, - * limit: 50, - * order: ["date ASC"], - * parentId: 5}, - * }, - * fixture: "-messages", - * success: function( messages ) { ... } - * }); - * @codeend - * @param {Array|String} types An array of the fixture names or the singular fixture name. - * If an array, the first item is the plural fixture name (prefixed with -) and the second - * item is the singular name. If a string, it's assumed to be the singular fixture name. Make - * will simply add s to the end of it for the plural name. - * @param {Number} count the number of items to create - * @param {Function} make a function that will return json data representing the object. The - * make function is called back with the id and the current array of items. - * @param {Function} filter (optional) a function used to further filter results. Used for to simulate - * server params like searchText or startDate. The function should return true if the item passes the filter, - * false otherwise. For example: - * - * @codestart - * function(item, settings){ - if(settings.data.searchText){ - var regex = new RegExp("^"+settings.data.searchText) - return regex.test(item.name); - } - * } - * @codeend - */ - make: function( types, count, make, filter ) { - if(typeof types === "string"){ - types = [types+"s",types ] - } - // make all items - var items = ($.fixture["~" + types[0]] = []), // TODO: change this to a hash - findOne = function(id){ - for ( var i = 0; i < items.length; i++ ) { - if ( id == items[i].id ) { - return items[i]; - } - } - }; - - for ( var i = 0; i < (count); i++ ) { - //call back provided make - var item = make(i, items); - - if (!item.id ) { - item.id = i; - } - items.push(item); - } - //set plural fixture for findAll - $.fixture["-" + types[0]] = function( settings ) { - - //copy array of items - var retArr = items.slice(0); - - //sort using order - //order looks like ["age ASC","gender DESC"] - $.each((settings.data.order || []).slice(0).reverse(), function( i, name ) { - var split = name.split(" "); - retArr = retArr.sort(function( a, b ) { - if ( split[1].toUpperCase() !== "ASC" ) { - if( a[split[0]] < b[split[0]] ) { - return 1; - } else if(a[split[0]] == b[split[0]]){ - return 0 - } else { - return -1; - } - } - else { - if( a[split[0]] < b[split[0]] ) { - return -1; - } else if(a[split[0]] == b[split[0]]){ - return 0 - } else { - return 1; - } - } - }); - }); - - //group is just like a sort - $.each((settings.data.group || []).slice(0).reverse(), function( i, name ) { - var split = name.split(" "); - retArr = retArr.sort(function( a, b ) { - return a[split[0]] > b[split[0]]; - }); - }); - - - var offset = parseInt(settings.data.offset, 10) || 0, - limit = parseInt(settings.data.limit, 10) || (count - offset), - i = 0; - - //filter results if someone added an attr like parentId - for ( var param in settings.data ) { - i=0; - if ( settings.data[param] && // don't do this if the value of the param is null (ignore it) - (param.indexOf("Id") != -1 || param.indexOf("_id") != -1) ) { - while ( i < retArr.length ) { - if ( settings.data[param] != retArr[i][param] ) { - retArr.splice(i, 1); - } else { - i++; - } - } - } - } - - - if( filter ) { - i = 0; - while (i < retArr.length) { - if (!filter(retArr[i], settings)) { - retArr.splice(i, 1); - } else { - i++; - } - } - } - - //return data spliced with limit and offset - return [{ - "count": retArr.length, - "limit": settings.data.limit, - "offset": settings.data.offset, - "data": retArr.slice(offset, offset + limit) - }]; - }; - // findOne - $.fixture["-" + types[1]] = function( settings ) { - return [findOne(settings.data.id)]; - }; - // update - $.fixture["-" + types[1]+"Update"] = function( settings, cbType ) { - var id = getId(settings); - - // TODO: make it work with non-linear ids .. - $.extend(findOne(id), settings.data); - return $.fixture["-restUpdate"](settings, cbType) - }; - $.fixture["-" + types[1]+"Destroy"] = function( settings, cbType ) { - var id = getId(settings); - for(var i = 0; i < items.length; i ++ ){ - if(items[i].id == id){ - items.splice(i, 1); - break; - } - } - - // TODO: make it work with non-linear ids .. - $.extend(findOne(id), settings.data); - return $.fixture["-restDestroy"](settings, cbType) - }; - $.fixture["-" + types[1]+"Create"] = function( settings, cbType ) { - var item = make(items.length, items); - $.extend(item, settings.data); - - if(!item.id){ - item.id = items.length; - } - - items.push(item); - return $.fixture["-restCreate"](settings, cbType) - }; - }, - /** - * Use $.fixture.xhr to create an object that looks like an xhr object. - * - * ## Example - * - * The following example shows how the -restCreate fixture uses xhr to return - * a simulated xhr object: - * @codestart - * "-restCreate" : function( settings, cbType ) { - * switch(cbType){ - * case "success": - * return [ - * {id: parseInt(Math.random()*1000)}, - * "success", - * $.fixture.xhr()]; - * case "complete": - * return [ - * $.fixture.xhr({ - * getResponseHeader: function() { - * return settings.url+"/"+parseInt(Math.random()*1000); - * } - * }), - * "success"]; - * } - * } - * @codeend - * @param {Object} [xhr] properties that you want to overwrite - * @return {Object} an object that looks like a successful XHR object. - */ - xhr: function( xhr ) { - return $.extend({}, { - abort: $.noop, - getAllResponseHeaders: function() { - return ""; - }, - getResponseHeader: function() { - return ""; - }, - open: $.noop, - overrideMimeType: $.noop, - readyState: 4, - responseText: "", - responseXML: null, - send: $.noop, - setRequestHeader: $.noop, - status: 200, - statusText: "OK" - }, xhr); - }, - /** - * @attribute on - * On lets you programatically turn off fixtures. This is mostly used for testing. - * - * $.fixture.on = false - * Task.findAll({}, function(){ - * $.fixture.on = true; - * }) - */ - on : true - }); - /** - * @attribute delay - * Sets the delay in milliseconds between an ajax request is made and - * the success and complete handlers are called. This only sets - * functional fixtures. By default, the delay is 200ms. - * @codestart - * steal.plugins('jquery/dom/fixtures').then(function(){ - * $.fixture.delay = 1000; - * }) - * @codeend - */ - $.fixture.delay = 200; - - $.fixture["-handleFunction"] = function( settings ) { - if ( typeof settings.fixture === "string" && $.fixture[settings.fixture] ) { - settings.fixture = $.fixture[settings.fixture]; - } - if ( typeof settings.fixture == "function" ) { - setTimeout(function() { - if ( settings.success ) { - settings.success.apply(null, settings.fixture(settings, "success")); - } - if ( settings.complete ) { - settings.complete.apply(null, settings.fixture(settings, "complete")); - } - }, $.fixture.delay); - return true; - } - return false; - }; - - /** - * @add jQuery - */ - $. - /** - * Adds a fixture param. - * @param {Object} url - * @param {Object} data - * @param {Object} callback - * @param {Object} type - * @param {Object} fixture - */ - get = function( url, data, callback, type, fixture ) { - // shift arguments if data argument was ommited - if ( jQuery.isFunction(data) ) { - if(!typeTest.test(type||"")){ - fixture = type; - type = callback; - } - callback = data; - data = null; - } - if ( jQuery.isFunction(data) ) { - fixture = type; - type = callback; - callback = data; - data = null; - } - - return jQuery.ajax({ - type: "GET", - url: url, - data: data, - success: callback, - dataType: type, - fixture: fixture - }); - }; - - $. - /** - * Adds a fixture param. - * @param {Object} url - * @param {Object} data - * @param {Object} callback - * @param {Object} type - * @param {Object} fixture - */ - post = function( url, data, callback, type, fixture ) { - if ( jQuery.isFunction(data) ) { - if(!typeTest.test(type||"")){ - fixture = type; - type = callback; - } - callback = data; - data = {}; - } - - return jQuery.ajax({ - type: "POST", - url: url, - data: data, - success: callback, - dataType: type, - fixture: fixture - }); - }; - - /** - * @page jquery.fixture.0organizing Organizing Fixtures - * @parent jQuery.fixture - * - * The __best__ way of organizing fixtures is to have a 'fixtures.js' file that steals - * jquery/dom/fixture and defines all your fixtures. For example, - * if you have a 'todo' application, you might - * have todo/fixtures/fixtures.js look like: - * - * steal({ - * path: '//jquery/dom/fixture.js', - * ignore: true - * }) - * .then(function(){ - * - * $.fixture({ - * type: 'get', - * url: '/services/todos.json' - * }, - * '//todo/fixtures/todos.json'); - * - * $.fixture({ - * type: 'post', - * url: '/services/todos.json' - * }, - * function(settings){ - * return {id: Math.random(), - * name: settings.data.name} - * }); - * - * }) - * - * __Notice__: We used steal's ignore option to prevent - * loading the fixture plugin in production. - * - * Finally, we steal todo/fixtures/fixtures.js in the - * app file (todo/todo.js) like: - * - * - * steal({path: '//todo/fixtures/fixtures.js',ignore: true}); - * - * //start of your app's steals - * steal.plugins( ... ) - * - * We typically keep it a one liner so it's easy to comment out. - * - * ## Switching Between Sets of Fixtures - * - * If you are using fixtures for testing, you often want to use different - * sets of fixtures. You can add something like the following to your fixtures.js file: - * - * if( /fixtureSet1/.test( window.location.search) ){ - * $.fixture("/foo","//foo/fixtures/foo1.json'); - * } else if(/fixtureSet2/.test( window.location.search)){ - * $.fixture("/foo","//foo/fixtures/foo1.json'); - * } else { - * // default fixtures (maybe no fixtures) - * } - * - */ - // - /** - * @add jQuery.fixture - */ - // - /** - * @page jquery.fixture.1errors Simulating Errors - * @parent jQuery.fixture - * - * The following simulates an unauthorized request - * to /foo. - * - * $.fixture("/foo", function(){ - * return [401,"{type: 'unauthorized'}"] - * }); - * - * This could be received by the following Ajax request: - * - * $.ajax({ - * url: '/foo', - * error : function(jqXhr, status, statusText){ - * // status === 'error' - * // statusText === "{type: 'unauthorized'}" - * } - * }) - * - */ -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture_test.js b/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture_test.js deleted file mode 100644 index fb08fe991d..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixture_test.js +++ /dev/null @@ -1,170 +0,0 @@ -steal - .plugins("jquery/dom/fixture", "jquery/model") - .plugins('funcunit/qunit').then(function(){ - -module("jquery/dom/fixture"); - - -test("static fixtures", function(){ - stop(); - $.get("something",function(data){ - equals(data.sweet,"ness","$.get works"); - $.post("something",function(data){ - - equals(data.sweet,"ness","$.post works"); - - $.ajax({ - url: "something", - dataType: "json", - success: function( data ) { - equals(data.sweet,"ness","$.ajax works"); - start(); - }, - fixture: "//jquery/dom/fixture/fixtures/test.json" - }) - - },"json","//jquery/dom/fixture/fixtures/test.json"); - },'json',"//jquery/dom/fixture/fixtures/test.json"); -}) - -test("dynamic fixtures",function(){ - stop(); - $.fixture.delay = 10; - var fix = function(){ - return [{sweet: "ness"}] - } - $.get("something",function(data){ - equals(data.sweet,"ness","$.get works"); - $.post("something",function(data){ - - equals(data.sweet,"ness","$.post works"); - - $.ajax({ - url: "something", - dataType: "json", - success: function( data ) { - equals(data.sweet,"ness","$.ajax works"); - start(); - }, - fixture: fix - }) - - },"json",fix); - },'json',fix); -}); - -test("fixture function", 3, function(){ - - stop(); - var url = steal.root.join("jquery/dom/fixture/fixtures/foo.json"); - $.fixture(url,"//jquery/dom/fixture/fixtures/foobar.json" ); - - $.get(url,function(data){ - equals(data.sweet,"ner","url passed works"); - - $.fixture(url,"//jquery/dom/fixture/fixtures/test.json" ); - - $.get(url,function(data){ - - equals(data.sweet,"ness","replaced"); - - $.fixture(url, null ); - - $.get(url,function(data){ - - equals(data.a,"b","removed"); - - start(); - - },'json') - - - },'json') - - - - },"json"); - -}); - - -test("fixtures with converters", function(){ - - stop(); - $.ajax( { - url : steal.root.join("jquery/dom/fixture/fixtures/foobar.json"), - dataType: "json fooBar", - converters: { - "json fooBar": function( data ) { - // Extract relevant text from the xml document - return "Mr. "+data.name; - } - }, - fixture : function(){ - return { - name : "Justin" - } - }, - success : function(prettyName){ - start(); - equals(prettyName, "Mr. Justin") - } - }); -}) - -test("$.fixture.make fixtures",function(){ - stop(); - $.fixture.make('thing', 1000, function(i){ - return { - id: i, - name: "thing "+i - } - }, - function(item, settings){ - if(settings.data.searchText){ - var regex = new RegExp("^"+settings.data.searchText) - return regex.test(item.name); - } - }) - $.ajax({ - url: "things", - type: "json", - data: { - offset: 100, - limit: 200, - order: ["name ASC"], - searchText: "thing 2" - }, - fixture: "-things", - success: function(things){ - equals(things.data[0].name, "thing 29", "first item is correct") - equals(things.data.length, 11, "there are 11 items") - start(); - } - }) -}); - -test("simulating an error", function(){ - var st = '{type: "unauthorized"}'; - - $.fixture("/foo", function(){ - return [401,st] - }); - stop(); - - $.ajax({ - url : "/foo", - success : function(){ - ok(false, "success called"); - start(); - }, - error : function(jqXHR, status, statusText){ - ok(true, "error called"); - equals(statusText, st); - start(); - } - }) -}) - - -}); diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/foo.json b/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/foo.json deleted file mode 100644 index 9fbc82d018..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/foo.json +++ /dev/null @@ -1 +0,0 @@ -{"a" : "b"} diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/foobar.json b/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/foobar.json deleted file mode 100644 index a50afea1d3..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/foobar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "sweet" :"ner" -} diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/messages.html b/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/messages.html deleted file mode 100644 index 19cf149227..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/messages.html +++ /dev/null @@ -1,31 +0,0 @@ - -

                    Create a Message

                    -

                    Create a message, it will show up in "Get Messages".

                    -
                    - - - - - - - - - - - - - - - - -
                    From:
                    Subject:
                    Body:
                    -
                    -

                    Get Messages

                    -

                    Enter a limit and offset to get a range of messages. -

                    -
                    - Offset - Limit - -
                    -
                    diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/test.json b/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/test.json deleted file mode 100644 index 6be2ce4f6f..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/fixtures/test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "sweet" :"ness" -} diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/qunit.html deleted file mode 100644 index 5207a04ce0..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/fixture/qunit.html +++ /dev/null @@ -1,22 +0,0 @@ - - - Fixtures Test Suite - - - - - - -

                    Fixtures Test Suite

                    -

                    -
                    -

                    -
                    -
                      -
                      - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/form_params.html b/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/form_params.html deleted file mode 100644 index 59b9a754fe..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/form_params.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - Form Params - - - -

                      Change the inputs to change the object

                      -
                      Result = 
                      -
                      -
                      -
                      -
                      -
                      -
                      -
                      - 1 min
                      - 5 min
                      - 10 min
                      - 10 min
                      -
                      -
                      - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/form_params.js b/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/form_params.js deleted file mode 100644 index 1ae3319dc9..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/form_params.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @add jQuery.fn - */ -steal.plugins("jquery/dom").then(function( $ ) { - var radioCheck = /radio|checkbox/i, - keyBreaker = /[^\[\]]+/g, - numberMatcher = /^[\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?$/; - - var isNumber = function( value ) { - if ( typeof value == 'number' ) { - return true; - } - - if ( typeof value != 'string' ) { - return false; - } - - return value.match(numberMatcher); - }; - - $.fn.extend({ - /** - * @parent dom - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/dom/form_params/form_params.js - * @plugin jquery/dom/form_params - * @test jquery/dom/form_params/qunit.html - *

                      Returns an object of name-value pairs that represents values in a form. - * It is able to nest values whose element's name has square brackets.

                      - * Example html: - * @codestart html - * <form> - * <input name="foo[bar]" value='2'/> - * <input name="foo[ced]" value='4'/> - * <form/> - * @codeend - * Example code: - * @codestart - * $('form').formParams() //-> { foo:{bar:2, ced: 4} } - * @codeend - * - * @demo jquery/dom/form_params/form_params.html - * - * @param {Boolean} [convert] True if strings that look like numbers and booleans should be converted. Defaults to true. - * @return {Object} An object of name-value pairs. - */ - formParams: function( convert ) { - if ( this[0].nodeName.toLowerCase() == 'form' && this[0].elements ) { - - return jQuery(jQuery.makeArray(this[0].elements)).getParams(convert); - } - return jQuery("input[name], textarea[name], select[name]", this[0]).getParams(convert); - }, - getParams: function( convert ) { - var data = {}, - current; - - convert = convert === undefined ? true : convert; - - this.each(function() { - var el = this, - type = el.type && el.type.toLowerCase(); - //if we are submit, ignore - if ((type == 'submit') || !el.name ) { - return; - } - - var key = el.name, - value = $.data(el, "value") || $.fn.val.call([el]), - isRadioCheck = radioCheck.test(el.type), - parts = key.match(keyBreaker), - write = !isRadioCheck || !! el.checked, - //make an array of values - lastPart; - - if ( convert ) { - if ( isNumber(value) ) { - value = parseFloat(value); - } else if ( value === 'true' || value === 'false' ) { - value = Boolean(value); - } - - } - - // go through and create nested objects - current = data; - for ( var i = 0; i < parts.length - 1; i++ ) { - if (!current[parts[i]] ) { - current[parts[i]] = {}; - } - current = current[parts[i]]; - } - lastPart = parts[parts.length - 1]; - - //now we are on the last part, set the value - if ( lastPart in current && type === "checkbox" ) { - if (!$.isArray(current[lastPart]) ) { - current[lastPart] = current[lastPart] === undefined ? [] : [current[lastPart]]; - } - if ( write ) { - current[lastPart].push(value); - } - } else if ( write || !current[lastPart] ) { - current[lastPart] = write ? value : undefined; - } - - }); - return data; - } - }); - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/qunit.html deleted file mode 100644 index 1223df9fcd..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/qunit.html +++ /dev/null @@ -1,22 +0,0 @@ - - - Form Params Test Suite - - - - - - -

                      Fixtures Test Suite

                      -

                      -
                      -

                      -
                      -
                        -
                        - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/basics.micro b/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/basics.micro deleted file mode 100644 index 61dea977c9..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/basics.micro +++ /dev/null @@ -1,27 +0,0 @@ -
                        - - - - - - - - - - - - - - - - -
                        \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/checkbox.micro b/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/checkbox.micro deleted file mode 100644 index f421437332..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/checkbox.micro +++ /dev/null @@ -1,20 +0,0 @@ -
                        -
                        -
                        - -
                        - -
                        -
                        -
                        Reference
                        -
                        - -
                        - - - -
                        -
                        - - -
                        \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/form_params_test.js b/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/form_params_test.js deleted file mode 100644 index 18da8cc6c7..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/form_params_test.js +++ /dev/null @@ -1,43 +0,0 @@ -module("jquery/dom/form_params") -test("with a form", function(){ - - $("#qunit-test-area").html("//jquery/dom/form_params/test/qunit/basics.micro",{}) - - var formParams = $("#qunit-test-area form").formParams() ; - ok(formParams.params.one === 1,"one is right"); - ok(formParams.params.two === 2,"two is right"); - ok(formParams.params.three === 3,"three is right"); - same(formParams.params.four,["4","1"],"four is right"); - same(formParams.params.five,[2,3],"five is right"); - - -}); - - -test("with true false", function(){ - $("#qunit-test-area").html("//jquery/dom/form_params/test/qunit/truthy.micro",{}); - - var formParams = $("#qunit-test-area form").formParams(); - ok(formParams.foo === undefined, "foo is undefined") - ok(formParams.bar.abc === true, "form bar is true"); - ok(formParams.bar.def === true, "form def is true"); - ok(formParams.bar.ghi === undefined, "form def is undefined"); - -}); - -test("just strings",function(){ - $("#qunit-test-area").html("//jquery/dom/form_params/test/qunit/basics.micro",{}); - var formParams = $("#qunit-test-area form").formParams(false) ; - ok(formParams.params.one === "1","one is right"); - ok(formParams.params.two === '2',"two is right"); - ok(formParams.params.three === '3',"three is right"); - same(formParams.params.four,["4","1"],"four is right"); - same(formParams.params.five,['2','3'],"five is right"); - $("#qunit-test-area").html('') -}) - -test("missing names",function(){ - $("#qunit-test-area").html("//jquery/dom/form_params/test/qunit/checkbox.micro",{}); - var formParams = $("#qunit-test-area form").formParams() ; - ok(true, "does not break") -}) \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/qunit.js b/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/qunit.js deleted file mode 100644 index 933e2e7cd8..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/qunit.js +++ /dev/null @@ -1,4 +0,0 @@ -steal - .plugins("jquery/dom/form_params") //load your app - .plugins('funcunit/qunit','jquery/view/micro') //load qunit - .then("form_params_test") \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/truthy.micro b/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/truthy.micro deleted file mode 100644 index f45de9a079..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/form_params/test/qunit/truthy.micro +++ /dev/null @@ -1,8 +0,0 @@ -
                        - - - - - - -
                        \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/range/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/dom/range/qunit.html deleted file mode 100644 index c437ef7736..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/range/qunit.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - selection QUnit Test - - - - - -

                        selection Test Suite

                        -

                        -
                        -

                        -
                        -
                          -
                          - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/range/range.html b/labs/architecture-examples/javascriptmvc/jquery/dom/range/range.html deleted file mode 100644 index f076f19651..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/range/range.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - Range - - - -
                          -

                          The Range Plugin

                          -

                          Select a range of text on the page and get useful info about it!

                          -

                          We'll figure out what to do with form elements later.

                          -
                          
                          -		
                          - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/range/range.js b/labs/architecture-examples/javascriptmvc/jquery/dom/range/range.js deleted file mode 100644 index 29307367b1..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/range/range.js +++ /dev/null @@ -1,523 +0,0 @@ -steal.plugins('jquery','jquery/dom/compare').then(function($){ -// TODOS ... -// Ad - -/** - * @function jQuery.fn.range - * - * Returns a jQuery.Range. - */ -$.fn.range = function(){ - return $.Range(this[0]) -} - -var convertType = function(type){ - return type.replace(/([a-z])([a-z]+)/gi, function(all,first, next){ - return first+next.toLowerCase() - }).replace(/_/g,""); -}, -reverse = function(type){ - return type.replace(/^([a-z]+)_TO_([a-z]+)/i, function(all, first, last){ - return last+"_TO_"+first; - }); -}, -getWindow = function( element ) { - return element ? element.ownerDocument.defaultView || element.ownerDocument.parentWindow : window -}, -bisect = function(el, start, end){ - //split the start and end ... figure out who is touching ... - if(end-start == 1){ - return - } -} -/** - * @Class jQuery.Range - * @parent dom - * @tag alpha - * - * Provides text range helpers for creating, moving, and comparing ranges. - * - * @constructor - * - * Returns a jQuery range object. - * - * @param {TextRange|Node|Point} [range] An object specifiying a - * range. Depending on the object, the selected text will be different. $.Range supports the - * following types - * - * - __undefined or null__ - returns a range with nothing selected - * - __Node__ - returns a range with the node's text selected - * - __Point__ - returns a range at the point on the screen. The point can be specified like: - * - * //client coordinates - * {clientX: 200, clientY: 300} - * - * //page coordinates - * {pageX: 200, pageY: 300} - * {top: 200, left: 300} - * - * - __TextRange__ a raw text range object. - */ -$.Range = function(range){ - if(this.constructor !== $.Range){ - return new $.Range(range); - } - if(range && range.jquery){ - range = range[0]; - } - // create one - if(!range || range.nodeType){ - this.win = getWindow(range) - if(this.win.document.createRange){ - this.range = this.win.document.createRange() - }else{ - this.range = this.win.document.body.createTextRange() - } - if(range){ - this.select(range) - } - - } else if (range.clientX || range.pageX || range.left) { - this.rangeFromPoint(range) - } else { - this.range = range; - } -}; -/** - * @static - */ -// -/** - * Gets the current range. - * - * $.Range.current() //-> jquery.range - * - * @param {HTMLElement} [el] an optional element used to get selection for a given window. - * @return {jQuery.Range} a jQuery.Range wrapped range. - */ -$.Range.current = function(el){ - var win = getWindow(el), - selection; - if(win.getSelection){ - selection = win.getSelection() - return new $.Range( selection.rangeCount ? selection.getRangeAt(0) : win.document.createRange()) - }else{ - return new $.Range( win.document.selection.createRange() ); - } -}; - - - - -$.extend($.Range.prototype,{ - rangeFromPoint : function(point){ - var clientX = point.clientX, clientY = point.clientY - if(!clientX){ - var off = scrollOffset(); - clientX = (off.pageX || off.left || 0 ) - off.left; - clientY = (off.pageY || off.top || 0 ) - off.top; - } - - // it's some text node in this range ... - var parent = document.elementFromPoint(clientX, clientY); - - //typically it will be 'on' text - for(var n=0; n < parent.childNodes.length; n++){ - var node = parent.childNodes[n]; - if(node.nodeType === 3 || node.nodeType === 4){ - var range = $.Range(node), - length = range.toString().length; - - - // now lets start moving the end until the boundingRect is within our range - - for(var i = 1; i < length+1; i++){ - var rect = range.end(i).rect(); - if(rect.left <= clientX && rect.left+rect.width >= clientX && - rect.top <= clientY && rect.top+rect.height >= clientY ){ - range.start(i-1); - this.range = range.range; - return; - } - } - } - } - - // if not 'on' text, recursively go through and find out when we shift to next - // 'line' - var previous; - iterate(parent.childNodes, function(textNode){ - var range = $.Range(textNode); - if(range.rect().top > point.clientY){ - return false; - }else{ - previous = range; - } - }); - if(previous){ - previous.start(previous.toString().length); - this.range = previous.range; - }else{ - this.range = $.Range(parent).range - } - - }, - - window : function(){ - return this.win || window; - }, - /** - * Return true if any portion of these two ranges overlap. - * - * var foo = document.getElementById('foo'); - * - * $.Range(foo.childNodes[0]).compare(foo.childNodes[1]) //-> false - * - * @param {jQuery.Range} elRange - * @return {Boolean} true if part of the ranges overlap, false if otherwise. - */ - overlaps : function(elRange){ - if(elRange.nodeType){ - elRange = $.Range(elRange).select(elRange); - } - //if the start is within the element ... - var startToStart = this.compare("START_TO_START", elRange), - endToEnd = this.compare("END_TO_END", elRange) - - // if we wrap elRange - if(startToStart <=0 && endToEnd >=0){ - return true; - } - // if our start is inside of it - if( startToStart >= 0 && - this.compare("START_TO_END", elRange) <= 0 ) { - return true; - } - // if our end is inside of elRange - if(this.compare("END_TO_START", elRange) >= 0 && - endToEnd <= 0 ) { - return true; - } - return false; - }, - /** - * Collapses a range - * - * $('#foo').range().collapse() - * - * @param {Boolean} [toStart] true if to the start of the range, false if to the - * end. Defaults to false. - * @return {Range} returns the range for chaining. - */ - collapse : function(toStart){ - this.range.collapse(toStart === undefined ? true : toStart); - return this; - }, - toString : function(){ - return typeof this.range.text == "string" ? this.range.text : this.range.toString(); - }, - /** - * Gets or sets the start of the range. - * - * If a value is not provided, start returns the range's starting container and offset like: - * - * $('#foo').range().start() //-> {container: fooElement, offset: 0 } - * - * If a set value is provided, it can set the range. The start of the range is set differently - * depending on the type of set value: - * - * - __Object__ - an object with the new starting container and offset is provided like - * - * $.Range().start({container: $('#foo')[0], offset: 20}) - * - * - __Number__ - the new offset value. The container is kept the same. - * - * - __String__ - adjusts the offset by converting the string offset to a number and adding it to the current - * offset. For example, the following moves the offset forward four characters: - * - * $('#foo').range().start("+4") - * - * - * @param {Object|String|Number} [set] a set value if setting the start of the range or nothing if reading it. - * @return {jQuery.Range|Object} if setting the start, the range is returned for chaining, otherwise, the - * start offset and container are returned. - */ - start : function(set){ - if(set === undefined){ - if(this.range.startContainer){ - return { - container : this.range.startContainer, - offset : this.range.startOffset - } - }else{ - var start = this.clone().collapse().parent(); - var startRange = $.Range(start).select(start).collapse(); - startRange.move("END_TO_START", this); - return { - container : start, - offset : startRange.toString().length - } - } - } else { - if (this.range.setStart) { - if(typeof set == 'number'){ - this.range.setStart(this.range.startContainer, set) - } else if(typeof set == 'string') { - this.range.setStart(this.range.startContainer, this.range.startOffset+ parseInt(set,10) ); - } else { - this.range.setStart(set.container, set.offset) - } - } else { - throw 'todo' - } - return this; - } - - - }, - /** - * Sets or gets the end of the range. It takes similar options as [jQuery.Range.prototype.get]. - * @param {Object} [set] - */ - end : function(set){ - if (set === undefined) { - if (this.range.startContainer) { - return { - container: this.range.endContainer, - offset: this.range.endOffset - } - } - else { - var end = this.clone().collapse(false).parent(); - var endRange = $.Range(end).select(end).collapse(); - endRange.move("END_TO_END", this); - return { - container: end, - offset: endRange.toString().length - } - } - } else { - if (this.range.setEnd) { - if(typeof set == 'number'){ - this.range.setEnd(this.range.endContainer, set) - } else { - this.range.setEnd(set.container, set.offset) - } - } else { - throw 'todo' - } - return this; - } - }, - /** - * returns the most common ancestor element of the endpoints in the range. - */ - parent : function(){ - return this.range.parentElement || this.range.commonAncestorContainer - }, - /** - * Returns the bounding rectangle of this range. - * - * @param {String} [from] - where the coordinates should be - * positioned from. By default, coordinates are given from the client viewport. - * But if 'page' is given, they are provided relative to the page. - * - * @return {TextRectangle} - The client rects. - */ - rect : function(from){ - var rect = this.range.getBoundingClientRect() - if(from === 'page'){ - var off = scrollOffset(); - rect = $.extend({}, rect); - rect.top += off.top; - rect.left += off.left; - } - return rect; - }, - /** - * Returns client rects - * @param {String} [from] how the rects coordinates should be given (viewport or page). Provide 'page' for - * rect coordinates from the page. - */ - rects : function(from){ - var rects = $.makeArray( this.range.getClientRects() ).sort(function(rect1, rect2){ - return rect2.width*rect2.height - rect1.width*rect1.height; - }), - i=0,j, - len = rects.length; - //return rects; - //rects are sorted, largest to smallest - while(i < rects.length){ - var cur = rects[i], - found = false; - - j = i+1; - for(j = i+1; j < rects.length; j++){ - if( withinRect(cur, rects[j] ) ) { - found = rects[j]; - break; - } - } - if(found){ - rects.splice(i,1) - }else{ - i++; - } - - - } - // safari will be return overlapping ranges ... - if(from == 'page'){ - var off = scrollOffset(); - return $.map(rects, function(item){ - var i = $.extend({}, item) - i.top += off.top; - i.left += off.left; - return i; - }) - } - - - return rects; - } - -}); -(function(){ - //method branching .... - var fn = $.Range.prototype, - range = $.Range().range; - - /** - * @function compare - * Compares one range to another range. This is different from the spec b/c the spec is confusing. - * - * source.compare("START_TO_END", toRange); - * - * This returns -1 if source's start is before toRange's end. - * @param {Object} type - * @param {Object} range - */ - fn.compare = range.compareBoundaryPoints ? - function(type, range){ - return this.range.compareBoundaryPoints(this.window().Range[reverse( type )], range.range) - }: - function(type, range){ - return this.range.compareEndPoints(convertType(type), range.range) - } - - /** - * @function move - * Move the endpoints of a range - * @param {Object} type - * @param {Object} range - */ - fn.move = range.setStart ? - function(type, range){ - - var rangesRange = range.range; - switch(type){ - case "START_TO_END" : - this.range.setStart(rangesRange.endContainer, rangesRange.endOffset) - break; - case "START_TO_START" : - this.range.setStart(rangesRange.startContainer, rangesRange.startOffset) - break; - case "END_TO_END" : - this.range.setEnd(rangesRange.endContainer, rangesRange.endOffset) - break; - case "END_TO_START" : - this.range.setEnd(rangesRange.startContainer, rangesRange.startOffset) - break; - } - - return this; - }: - function(type, range){ - this.range.setEndPoint(convertType(type), range.range) - return this; - }; - var cloneFunc = range.cloneRange ? "cloneRange" : "duplicate", - selectFunc = range.selectNodeContents ? "selectNodeContents" : "moveToElementText"; - - /** - * Clones the range and returns a new $.Range object. - */ - fn.clone = function(){ - return $.Range( this.range[cloneFunc]() ); - }; - - /** - * Selects an element with this range - * @param {HTMLElement} el - */ - fn.select = function(el){ - this.range[selectFunc](el); - return this; - }; - -})(); - - -// helpers ----------------- - -// iterates through a list of elements, calls cb on every text node -// if cb returns false, exits the iteration -var iterate = function(elems, cb){ - var elem, start; - for (var i = 0; elems[i]; i++) { - elem = elems[i]; - // Get the text from text nodes and CDATA nodes - if (elem.nodeType === 3 || elem.nodeType === 4) { - if (cb(elem) === false) { - return false; - } - // Traverse everything else, except comment nodes - } - else - if (elem.nodeType !== 8) { - if (iterate(elem.childNodes, cb) === false) { - return false; - } - } - } -}, -// if a point is within a rectangle -within = function(rect, point){ - - return rect.left <= point.clientX && rect.left + rect.width >= point.clientX && - rect.top <= point.clientY && - rect.top + rect.height >= point.clientY -}, -// if a rectangle is within another rectangle -withinRect = function(outer, inner){ - return within(outer, { - clientX: inner.left, - clientY: inner.top - }) && //top left - within(outer, { - clientX: inner.left + inner.width, - clientY: inner.top - }) && //top right - within(outer, { - clientX: inner.left, - clientY: inner.top + inner.height - }) && //bottom left - within(outer, { - clientX: inner.left + inner.width, - clientY: inner.top + inner.height - }) //bottom right -}, -// gets the scroll offset from a window -scrollOffset = function( win){ - var win = win ||window; - doc = win.document.documentElement, body = win.document.body; - - return { - left: (doc && doc.scrollLeft || body && body.scrollLeft || 0) + (doc.clientLeft || 0), - top: (doc && doc.scrollTop || body && body.scrollTop || 0) + (doc.clientTop || 0) - }; -}; - - - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/range/range_test.js b/labs/architecture-examples/javascriptmvc/jquery/dom/range/range_test.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/selection/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/dom/selection/qunit.html deleted file mode 100644 index b99867fd67..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/selection/qunit.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - selection QUnit Test - - - - - -

                          selection Test Suite

                          -

                          -
                          -

                          -
                          -
                            -
                            - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection.html b/labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection.html deleted file mode 100644 index 20840c29aa..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - selection - - - - - - - - - - - - - - - - - - - - -
                            Select Textarea
                            Select Input
                            Select Within One Element

                            0123456789

                            Select Across Multiple Elements
                            012
                            345
                            - - -

                            Hello World! how are you today?

                            -

                            I am good, thank you.

                            -
                            - - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection.js b/labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection.js deleted file mode 100644 index 7a224c51f8..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection.js +++ /dev/null @@ -1,236 +0,0 @@ -steal.plugins('jquery','jquery/dom/range').then(function($){ -var convertType = function(type){ - return type.replace(/([a-z])([a-z]+)/gi, function(all,first, next){ - return first+next.toLowerCase() - }).replace(/_/g,""); -}, -reverse = function(type){ - return type.replace(/^([a-z]+)_TO_([a-z]+)/i, function(all, first, last){ - return last+"_TO_"+first; - }); -}, -getWindow = function( element ) { - return element ? element.ownerDocument.defaultView || element.ownerDocument.parentWindow : window -}, -// A helper that uses range to abstract out getting the current start and endPos. -getElementsSelection = function(el, win){ - var current = $.Range.current(el).clone(), - entireElement = $.Range(el).select(el); - if(!current.overlaps(entireElement)){ - return null; - } - // we need to check if it starts before our element ... - if(current.compare("START_TO_START", entireElement) < 1){ - startPos = 0; - // we should move current ... - current.move("START_TO_START",entireElement); - }else{ - fromElementToCurrent =entireElement.clone(); - fromElementToCurrent.move("END_TO_START", current); - startPos = fromElementToCurrent.toString().length - } - - // now we need to make sure current isn't to the right of us ... - if(current.compare("END_TO_END", entireElement) >= 0){ - endPos = entireElement.toString().length - }else{ - endPos = startPos+current.toString().length - } - return { - start: startPos, - end : endPos - }; -}, -getSelection = function(el){ - // use selectionStart if we can. - var win = getWindow(el); - - if (el.selectionStart !== undefined) { - - if(document.activeElement - && document.activeElement != el - && el.selectionStart == el.selectionEnd - && el.selectionStart == 0){ - return {start: el.value.length, end: el.value.length}; - } - return {start: el.selectionStart, end: el.selectionEnd} - } else if(win.getSelection){ - return getElementsSelection(el, win) - } else{ - - try { - //try 2 different methods that work differently - // one should only work for input elements, but sometimes doesn't - // I don't know why this is, or what to detect - if (el.nodeName.toLowerCase() == 'input') { - var real = getWindow(el).document.selection.createRange(), r = el.createTextRange(); - r.setEndPoint("EndToStart", real); - - var start = r.text.length - return { - start: start, - end: start + real.text.length - } - } - else { - var res = getElementsSelection(el,win) - if(!res){ - return res; - } - // we have to clean up for ie's textareas - var current = $.Range.current().clone(), - r2 = current.clone().collapse().range, - r3 = current.clone().collapse(false).range; - - r2.moveStart('character', -1) - r3.moveStart('character', -1) - // if we aren't at the start, but previous is empty, we are at start of newline - if (res.startPos != 0 && r2.text == "") { - res.startPos += 2; - } - // do a similar thing for the end of the textarea - if (res.endPos != 0 && r3.text == "") { - res.endPos += 2; - } - - return res - } - }catch(e){ - return {start: el.value.length, end: el.value.length}; - } - } -}, -select = function( el, start, end ) { - var win = getWindow(el) - if(el.setSelectionRange){ - if(end === undefined){ - el.focus(); - el.setSelectionRange(start, start); - } else { - el.select(); - el.selectionStart = start; - el.selectionEnd = end; - } - } else if (el.createTextRange) { - //el.focus(); - var r = el.createTextRange(); - r.moveStart('character', start); - end = end || start; - r.moveEnd('character', end - el.value.length); - - r.select(); - } else if(win.getSelection){ - var doc = win.document, - sel = win.getSelection(), - range = doc.createRange(), - ranges = [start, end !== undefined ? end : start]; - getCharElement([el],ranges); - range.setStart(ranges[0].el, ranges[0].count); - range.setEnd(ranges[1].el, ranges[1].count); - - // removeAllRanges is suprisingly necessary for webkit ... BOOO! - sel.removeAllRanges(); - sel.addRange(range); - - } else if(win.document.body.createTextRange){ //IE's weirdness - var range = document.body.createTextRange(); - range.moveToElementText(el); - range.collapse() - range.moveStart('character', start) - range.moveEnd('character', end !== undefined ? end : start) - range.select(); - } - -}, -/* - * If one of the range values is within start and len, replace the range - * value with the element and its offset. - */ -replaceWithLess = function(start, len, range, el){ - if(typeof range[0] === 'number' && range[0] < len){ - range[0] = { - el: el, - count: range[0] - start - }; - } - if(typeof range[1] === 'number' && range[1] <= len){ - range[1] = { - el: el, - count: range[1] - start - };; - } -}, -getCharElement = function( elems , range, len ) { - var elem, - start; - - len = len || 0; - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - start = len - len += elem.nodeValue.length; - //check if len is now greater than what's in counts - replaceWithLess(start, len, range, elem ) - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - len = getCharElement( elem.childNodes, range, len ); - } - } - return len; -}; -/** - * @parent dom - * @tag beta - * - * Gets or sets the current text selection. - * - * ## Getting - * - * Gets the current selection in the context of an element. For example: - * - * $('textarea').selection() // -> { .... } - * - * returns an object with: - * - * - __start__ - The number of characters from the start of the element to the start of the selection. - * _ __end__ - The number of characters from teh start of the element to the end of the selection. - * _ __range__ - A [jQuery.Range] that represents the current selection. - * - * This lets you do: - * - * var textarea = $('textarea') - * selection = textarea.selection(), - * selected = textarea.val().substr(selection.start, selection.end); - * - * alert('You selected '+selected+'.'); - * - * Selection works with all elements. If you want to get selection information on the page: - * - * $(document.body).selection(); - * - * ## Setting - * - * By providing a start and end offset, you can select text within a given element. - * - * $('#rte').selection(30, 40) - * - * @param {Number} [start] - Start of the range - * @param {Number} [end] - End of the range - * @return {Object|jQuery} - returns the selection information or the jQuery collection for - * chaining. - */ -$.fn.selection = function(start, end){ - if(start !== undefined){ - return this.each(function(){ - select(this, start, end) - }) - }else{ - return getSelection(this[0]) - } -}; -// for testing -$.fn.selection.getCharElement = getCharElement; - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection_test.js b/labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection_test.js deleted file mode 100644 index d6ccd7472e..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/selection/selection_test.js +++ /dev/null @@ -1,40 +0,0 @@ -steal - .plugins("funcunit/qunit", "jquery/dom/selection").then(function(){ - -module("jquery/dom/selection"); - -test("getCharElement", function(){ - $("#qunit-test-area") - .html(""+ - ""+ - "

                            0123456789

                            "+ - "
                            012
                            345
                            "); - stop(); - setTimeout(function(){ - var types = ['textarea','#inp','#1','#2']; - for(var i =0; i< types.length; i++){ - console.log(types[i]) - $(types[i]).selection(1,5); - } - /* - $('textarea').selection(1,5); - $('input').selection(1,5); - $('#1').selection(1,5); - $('#2').selection(1,5); - */ - var res = []; - for(var i =0; i< types.length; i++){ - res.push( $(types[i]).selection() ); - } - - - - for(var i =0; i< res.length; i++){ - same(res[i],{start: 1, end: 5},types[i]) - } - - start(); - },1000) -}); - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/dom/within/within.js b/labs/architecture-examples/javascriptmvc/jquery/dom/within/within.js deleted file mode 100644 index bea9a8bed1..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/dom/within/within.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @add jQuery.fn - */ -steal.plugins('jquery/dom').then(function($){ - var withinBox = function(x, y, left, top, width, height ){ - return (y >= top && - y < top + height && - x >= left && - x < left + width); - } -/** - * @function within - * @parent dom - * Returns if the elements are within the position - * @param {Number} left the position - * @param {Number} top - * @param {Boolean} [useOffsetCache] - */ -$.fn.within= function(left, top, useOffsetCache) { - var ret = [] - this.each(function(){ - var q = jQuery(this); - - if (this == document.documentElement) { - return ret.push(this); - } - var offset = useOffsetCache ? - jQuery.data(this,"offsetCache") || jQuery.data(this,"offsetCache", q.offset()) : - q.offset(); - - var res = withinBox(left, top, offset.left, offset.top, - this.offsetWidth, this.offsetHeight ); - - if (res) { - ret.push(this); - } - }); - - return this.pushStack( jQuery.unique( ret ), "within", left+","+top ); -} - - -/** - * @function withinBox - * returns if elements are within the box - * @param {Object} left - * @param {Object} top - * @param {Object} width - * @param {Object} height - * @param {Object} cache - */ -$.fn.withinBox = function(left, top, width, height, cache){ - var ret = [] - this.each(function(){ - var q = jQuery(this); - - if(this == document.documentElement) return this.ret.push(this); - - var offset = cache ? jQuery.data(this,"offset", q.offset()) : q.offset(); - - var ew = q.width(), eh = q.height(); - - res = !( (offset.top > top+height) || (offset.top +eh < top) || (offset.left > left+width ) || (offset.left+ew < left)); - - if(res) - ret.push(this); - }); - return this.pushStack( jQuery.unique( ret ), "withinBox", jQuery.makeArray(arguments).join(",") ); -} - -}) \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/download/btn.png b/labs/architecture-examples/javascriptmvc/jquery/download/btn.png deleted file mode 100644 index 316698236f801820c3bd27cfe4bc555e60b74bcb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 786 zcmV+t1MU2YP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01|Wn01|Wo-ewG?Kzj-8}cJ;M71!nts-!{N=>?>!EWRWaS( zP+wo4bI!xIMi0vlJ1Bk|remN-1r>pSy81-QLjJ!uZL1QW>cvtu2fz=X_hz zw}|*`yCo@eD{;o5hV3i1wDB3p3S97N;GFYMNwbpPrkwMzq?P|oRNw-qtczd=ZLioK?vIEO+e5`f zWvrrB!4{W85iyc%PjXvu2}~y2i?;KrZ(=~5_SYqZ3StF_6(Cj+D?qFO zv4U6uVg-m5#0n5AK&&8EfLKAS+yW3QK&&8E;IhOToPdEEs&?65T<7wT0iaHb!`rf? zlq4;&4xr}2CP_<4(mJ;THD3i}dp$|ok+c^P?5(KXzFH)?7ZE!t=e#TFuB7kcEG*P) z1CX?D`=0IH^x@G&bX$#glD2LCX2Rm4|KwL50vtue-0J+;8%dFxonHB-SxFBfV*m7n zC0?9EpeHYj{thDIVM=LBl2+%(j-zaLdg`_sDz5KHdMRnJ_%M&Pa31SvbwGZ!{d9GH zY)g`6mN);#T55KBM?s`XIPL~%m<*KVuvql~ol2MBEmI7DW> QbN~PV07*qoM6N<$g4@GtkpKVy diff --git a/labs/architecture-examples/javascriptmvc/jquery/download/download.css b/labs/architecture-examples/javascriptmvc/jquery/download/download.css deleted file mode 100644 index 4766d66155..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/download/download.css +++ /dev/null @@ -1,88 +0,0 @@ -body { - margin: 0px; padding: 0px; - overflow: hidden; -} -#plugins .dl_btn_container{ - background: url(btn.png); - border: none; - color: #fff; - font-size: 2em; - float: right; - line-height: 56px; - margin: 20px; - height: 55px; - text-align: center; - width: 171px; -} - -#plugins .dl_btn_container:hover{ - color: #bbb; - cursor: pointer -} - -#plugins #pluginForm { - border-top: dotted 1px #000; - padding: 0px; - width: 100%; - overflow: auto; -} - -#plugins .section{ - clear: both; - overflow: auto; - border-bottom: dotted 1px #000; - padding: 16px 16px 18px; - - background: #eee; -} - -#plugins .section .section-desc{ - float: left; - width: 125px; -} - -#plugins .section .section-desc h3{ - font-size: 1.0em; - margin: 0px 0px 6px; -} - -#plugins .section .section-desc p{ - font-size: 0.7em; -} - -#plugins .plugin{ - float: right; - padding: 0px; - overflow: auto; - width: 422px; - -} - -#plugins .plugin input { - float:left; -} - -#plugins .plugin label{ - color: #5387BD; - display: block; - float: left; - font-size: 0.7em; - font-weight: bold; - margin-left: 10px; - width: 175px; - word-wrap: break-word; -} - -#plugins .plugin .desc{ - float: left; - font-size: 0.7em; - margin: 0px 0px 0px 20px; - width: 194px; -} - -#plugins .select-all-container{ - text-align: right; - font-size: 0.7em; - font-weight: bold; - margin: 0px 6px 12px 0px; -} \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/download/download.html b/labs/architecture-examples/javascriptmvc/jquery/download/download.html deleted file mode 100644 index 83f69ac24f..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/download/download.html +++ /dev/null @@ -1,418 +0,0 @@ - - - - Download Builder - - - - - -
                            - - -
                            - - - -
                            - -
                            -

                            Class

                            -
                            - -
                            - - - -
                            Simulated inheritance in JavaScript
                            -
                            - - -
                            - -
                            - -
                            -

                            Controller

                            -

                            jQuery widget factory

                            -
                            - -
                            - - - -
                            Organize event handlers using event delegation
                            -
                            - -
                            - - - -
                            Add page history support to Controller
                            -
                            - -
                            - - - -
                            Add pub/sub support to Controller
                            -
                            - -
                            - - - -
                            Helpers that tie view templates to a controller instance
                            -
                            -
                            - - -
                            - -
                            -

                            Model

                            -

                            Wrap an application's data layer

                            -
                            - -
                            - - - -
                            A basic skeleton to organize pieces of your application's data layer
                            -
                            - -
                            - - - -
                            Get data for related records
                            -
                            - -
                            - - - -
                            Backup and restore instance data
                            -
                            - -
                            - - - -
                            Type of model that provides methods for multiple model instances
                            - -
                            - -
                            - - - -
                            A storeable list of model instances
                            -
                            - - - -
                            - - - -
                            Validate data before sending it to the server
                            -
                            -
                            - - -
                            - -
                            -

                            Event

                            -

                            Helper functions used for managing events

                            -
                            - -
                            - - - -
                            Provides a destroyed event on an element
                            -
                            - -
                            - - - -
                            An event when the browser hash changes (for history management)
                            -
                            - - -
                            - - - -
                            Allows you to perform default actions as a result of an event
                            -
                            - -
                            - - - -
                            Provides drag events as a special events to jQuery
                            -
                            - -
                            - - - -
                            Limits the drag to a containing element
                            -
                            - -
                            - - - -
                            Will scroll elements with a scroll bar as the drag moves to borders
                            -
                            - -
                            - - - -
                            Provides drop events as a special event to jQuery
                            -
                            - -
                            - - - -
                            Drag in defined pixel increments
                            -
                            - -
                            - - - -
                            Provides delegate-able hover events
                            -
                            - -
                            - - - -
                            Normalizes resize events cross browser
                            -
                            - -
                            - - - -
                            Adds pauseable/resumeable events to jQuery
                            -
                            - - -
                            - - -
                            - -
                            -

                            View

                            -

                            Client side template engines with production build support.

                            -
                            - -
                            - - - -
                            A uniform interface for using templates with jQuery
                            -
                            - -
                            - - - -
                            EJS templates
                            -
                            - -
                            - - - -
                            Rails like view helpers
                            -
                            - -
                            - - - -
                            JAML templates
                            -
                            - -
                            - - - -
                            Micro templates
                            -
                            - -
                            - - - -
                            jQuery tmpl templates
                            -
                            - -
                            - - -
                            - -
                            -

                            DOM

                            -

                            Useful jQuery extensions for the DOM

                            -
                            - -
                            - - - -
                            Overwrites closest to allow open > selectors
                            -
                            - -
                            - - - -
                            Compares the position of two nodes
                            -
                            - -
                            - - - -
                            Cookie management helpers
                            -
                            - -
                            - - - -
                            Rapidly get a bunch of computed styles from an element
                            -
                            - -
                            - - - -
                            Support for setting+animating inner+outer height and widths
                            -
                            - -
                            - - - -
                            Simulate AJAX responses
                            -
                            - -
                            - - - -
                            Name-value pairs that represents values in a form
                            -
                            - -
                            - - - -
                            Returns if the elements are within the position
                            -
                            - -
                            - - -
                            - -
                            -

                            Lang

                            -

                            JavaScript language helpers

                            -
                            - -
                            - - - -
                            String helpers
                            -
                            - -
                            - - - -
                            A vector class
                            -
                            - -
                            - - - -
                            Splits a string with a regex correctly cross browser
                            -
                            - -
                            - - -
                            - -
                            -

                            Tie

                            -
                            - -
                            - - - -
                            Bi-direction binding between Controllers and Models.
                            -
                            - - -
                            -
                            - -
                            - -
                            - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/download/download.js b/labs/architecture-examples/javascriptmvc/jquery/download/download.js deleted file mode 100644 index c6e5ef0be3..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/download/download.js +++ /dev/null @@ -1,102 +0,0 @@ -(function(){ - $.Downloader = { - dependencies: [], - pluginData: null, - ready: function(){ - $.getJSON('../dist/standalone/dependencies.json', - function(data){ - $.Downloader.pluginData = data; - }); - $('#pluginForm').delegate("input[type=checkbox]", "change", - $.proxy($.Downloader.changeHandler, $.Downloader)); - - // append css if necessary - if(location.search && /csspath/.test(location.search)){ - var path = location.search.split("=")[1]; - var headID = document.getElementsByTagName("head")[0], - cssNode = document.createElement('link'); - cssNode.type = 'text/css'; - cssNode.rel = 'stylesheet'; - cssNode.href = path; - cssNode.media = 'screen'; - headID.appendChild(cssNode); - } - - $.Downloader.setupWordbreaks(); - }, - // inject characters in labels - setupWordbreaks: function(){ - var text, newText; - $(".plugin label").each(function(i){ - text = $(this).text(); - newText = text.replace(/\//g, "/") - $(this).html(newText); - }) - }, - changeHandler: function(ev){ - var $target = $(ev.target); - // if they unclicked, ignore it - if(!$target.attr('checked')) { - return; - } - this.dependencies = []; - var $form = $target.closest('form'), - params = $form.formParams(), i, queryVal; - for(i=0; i - - Test - - - - - - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/download/test/jquery-1.4.3.js b/labs/architecture-examples/javascriptmvc/jquery/download/test/jquery-1.4.3.js deleted file mode 100644 index ad9a79c433..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/download/test/jquery-1.4.3.js +++ /dev/null @@ -1,6883 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.3 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Thu Oct 14 23:10:06 2010 -0400 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // (both of which we optimize for) - quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, - - // Is it a simple selector - isSimple = /^.[^:#\[\.,]*$/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - rwhite = /\s/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Check for non-word characters - rnonword = /\W/, - - // Check for digits - rdigit = /\d/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // Has the ready events already been bound? - readyBound = false, - - // The functions to execute on DOM ready - readyList = [], - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - init: function( selector, context ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = "body"; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - match = quickExpr.exec( selector ); - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - doc = (context ? context.ownerDocument || context : document); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $("TAG") - } else if ( !context && !rnonword.test( selector ) ) { - this.selector = selector; - this.context = document; - selector = document.getElementsByTagName( selector ); - return jQuery.merge( this, selector ); - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return (context || rootjQuery).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return jQuery( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if (selector.selector !== undefined) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.4.3", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = jQuery(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + (this.selector ? " " : "") + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // If the DOM is already ready - if ( jQuery.isReady ) { - // Execute the function immediately - fn.call( document, jQuery ); - - // Otherwise, remember the function for later - } else if ( readyList ) { - // Add the function to the wait list - readyList.push( fn ); - } - - return this; - }, - - eq: function( i ) { - return i === -1 ? - this.slice( i ) : - this.slice( i, +i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || jQuery(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - // copy reference to target object - var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy, copyIsArray; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - window.$ = _$; - - if ( deep ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Handle when the DOM is ready - ready: function( wait ) { - // A third-party is pushing the ready event forwards - if ( wait === true ) { - jQuery.readyWait--; - } - - // Make sure that the DOM is not already loaded - if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - if ( readyList ) { - // Execute all of them - var fn, i = 0; - while ( (fn = readyList[ i++ ]) ) { - fn.call( document, jQuery ); - } - - // Reset the list of functions - readyList = null; - } - - // Trigger any bound ready events - if ( jQuery.fn.triggerHandler ) { - jQuery( document ).triggerHandler( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyBound ) { - return; - } - - readyBound = true; - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent("onreadystatechange", DOMContentLoaded); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNaN: function( obj ) { - return obj == null || !rdigit.test( obj ) || isNaN( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw msg; - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test(data.replace(rvalidescape, "@") - .replace(rvalidtokens, "]") - .replace(rvalidbraces, "")) ) { - - // Try to use the native JSON parser first - return window.JSON && window.JSON.parse ? - window.JSON.parse( data ) : - (new Function("return " + data))(); - - } else { - jQuery.error( "Invalid JSON: " + data ); - } - }, - - noop: function() {}, - - // Evalulates a script in a global context - globalEval: function( data ) { - if ( data && rnotwhite.test(data) ) { - // Inspired by code by Andrea Giammarchi - // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html - var head = document.getElementsByTagName("head")[0] || document.documentElement, - script = document.createElement("script"); - - script.type = "text/javascript"; - - if ( jQuery.support.scriptEval ) { - script.appendChild( document.createTextNode( data ) ); - } else { - script.text = data; - } - - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709). - head.insertBefore( script, head.firstChild ); - head.removeChild( script ); - } - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction(object); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( var value = object[0]; - i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // The extra typeof function check is to prevent crashes - // in Safari 2 (See: #3039) - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type(array); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var ret = [], value; - - // Go through the array, translating each of the items to their - // new value (or values). - for ( var i = 0, length = elems.length; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - proxy: function( fn, proxy, thisObject ) { - if ( arguments.length === 2 ) { - if ( typeof proxy === "string" ) { - thisObject = fn; - fn = thisObject[ proxy ]; - proxy = undefined; - - } else if ( proxy && !jQuery.isFunction( proxy ) ) { - thisObject = proxy; - proxy = undefined; - } - } - - if ( !proxy && fn ) { - proxy = function() { - return fn.apply( thisObject || this, arguments ); - }; - } - - // Set the guid of unique handler to the same of original handler, so it can be removed - if ( fn ) { - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - } - - // So proxy can be declared as an argument - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can be optionally by executed if its a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return (new Date()).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -if ( indexOf ) { - jQuery.inArray = function( elem, array ) { - return indexOf.call( array, elem ); - }; -} - -// Verify that \s matches non-breaking spaces -// (IE fails on this test) -if ( !rwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -// Expose jQuery to the global object -return (window.jQuery = window.$ = jQuery); - -})(); - - -(function() { - - jQuery.support = {}; - - var root = document.documentElement, - script = document.createElement("script"), - div = document.createElement("div"), - id = "script" + jQuery.now(); - - div.style.display = "none"; - div.innerHTML = "
                            a"; - - var all = div.getElementsByTagName("*"), - a = div.getElementsByTagName("a")[0], - select = document.createElement("select"), - opt = select.appendChild( document.createElement("option") ); - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return; - } - - jQuery.support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: div.firstChild.nodeType === 3, - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText insted) - style: /red/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: a.getAttribute("href") === "/a", - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55$/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: div.getElementsByTagName("input")[0].value === "on", - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Will be defined later - optDisabled: false, - checkClone: false, - scriptEval: false, - noCloneEvent: true, - boxModel: null, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableHiddenOffsets: true - }; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as diabled) - select.disabled = true; - jQuery.support.optDisabled = !opt.disabled; - - script.type = "text/javascript"; - try { - script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); - } catch(e) {} - - root.insertBefore( script, root.firstChild ); - - // Make sure that the execution of code works by injecting a script - // tag with appendChild/createTextNode - // (IE doesn't support this, fails, and uses .text instead) - if ( window[ id ] ) { - jQuery.support.scriptEval = true; - delete window[ id ]; - } - - root.removeChild( script ); - - if ( div.attachEvent && div.fireEvent ) { - div.attachEvent("onclick", function click() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - jQuery.support.noCloneEvent = false; - div.detachEvent("onclick", click); - }); - div.cloneNode(true).fireEvent("onclick"); - } - - div = document.createElement("div"); - div.innerHTML = ""; - - var fragment = document.createDocumentFragment(); - fragment.appendChild( div.firstChild ); - - // WebKit doesn't clone checked state correctly in fragments - jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; - - // Figure out if the W3C box model works as expected - // document.body must exist before we can do this - jQuery(function() { - var div = document.createElement("div"); - div.style.width = div.style.paddingLeft = "1px"; - - document.body.appendChild( div ); - jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; - - if ( "zoom" in div.style ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2; - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
                            "; - jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2; - } - - div.innerHTML = "
                            t
                            "; - var tds = div.getElementsByTagName("td"); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0; - - tds[0].style.display = ""; - tds[1].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE < 8 fail this test) - jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; - div.innerHTML = ""; - - document.body.removeChild( div ).style.display = "none"; - div = tds = null; - }); - - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - var eventSupported = function( eventName ) { - var el = document.createElement("div"); - eventName = "on" + eventName; - - var isSupported = (eventName in el); - if ( !isSupported ) { - el.setAttribute(eventName, "return;"); - isSupported = typeof el[eventName] === "function"; - } - el = null; - - return isSupported; - }; - - jQuery.support.submitBubbles = eventSupported("submit"); - jQuery.support.changeBubbles = eventSupported("change"); - - // release memory in IE - root = script = div = all = a = null; -})(); - -jQuery.props = { - "for": "htmlFor", - "class": "className", - readonly: "readOnly", - maxlength: "maxLength", - cellspacing: "cellSpacing", - rowspan: "rowSpan", - colspan: "colSpan", - tabindex: "tabIndex", - usemap: "useMap", - frameborder: "frameBorder" -}; - - - - -var windowData = {}, - rbrace = /^(?:\{.*\}|\[.*\])$/; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - expando: "jQuery" + jQuery.now(), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - data: function( elem, name, data ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var isNode = elem.nodeType, - id = isNode ? elem[ jQuery.expando ] : null, - cache = jQuery.cache, thisCache; - - if ( isNode && !id && typeof name === "string" && data === undefined ) { - return; - } - - // Get the data from the object directly - if ( !isNode ) { - cache = elem; - - // Compute a unique ID for the element - } else if ( !id ) { - elem[ jQuery.expando ] = id = ++jQuery.uuid; - } - - // Avoid generating a new cache unless none exists and we - // want to manipulate it. - if ( typeof name === "object" ) { - if ( isNode ) { - cache[ id ] = jQuery.extend(cache[ id ], name); - - } else { - jQuery.extend( cache, name ); - } - - } else if ( isNode && !cache[ id ] ) { - cache[ id ] = {}; - } - - thisCache = isNode ? cache[ id ] : cache; - - // Prevent overriding the named cache with undefined values - if ( data !== undefined ) { - thisCache[ name ] = data; - } - - return typeof name === "string" ? thisCache[ name ] : thisCache; - }, - - removeData: function( elem, name ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var isNode = elem.nodeType, - id = isNode ? elem[ jQuery.expando ] : elem, - cache = jQuery.cache, - thisCache = isNode ? cache[ id ] : id; - - // If we want to remove a specific section of the element's data - if ( name ) { - if ( thisCache ) { - // Remove the section of cache data - delete thisCache[ name ]; - - // If we've removed all the data, remove the element's cache - if ( isNode && jQuery.isEmptyObject(thisCache) ) { - jQuery.removeData( elem ); - } - } - - // Otherwise, we want to remove all of the element's data - } else { - if ( isNode && jQuery.support.deleteExpando ) { - delete elem[ jQuery.expando ]; - - } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); - - // Completely remove the data cache - } else if ( isNode ) { - delete cache[ id ]; - - // Remove all fields from the object - } else { - for ( var n in elem ) { - delete elem[ n ]; - } - } - } - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - if ( typeof key === "undefined" ) { - return this.length ? jQuery.data( this[0] ) : null; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - var parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && this[0].nodeType === 1 ) { - data = this[0].getAttribute( "data-" + key ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - !jQuery.isNaN( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - } else { - data = undefined; - } - } - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var $this = jQuery( this ), args = [ parts[0], value ]; - - $this.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - $this.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - - - - -jQuery.extend({ - queue: function( elem, type, data ) { - if ( !elem ) { - return; - } - - type = (type || "fx") + "queue"; - var q = jQuery.data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( !data ) { - return q || []; - } - - if ( !q || jQuery.isArray(data) ) { - q = jQuery.data( elem, type, jQuery.makeArray(data) ); - - } else { - q.push( data ); - } - - return q; - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), fn = queue.shift(); - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift("inprogress"); - } - - fn.call(elem, function() { - jQuery.dequeue(elem, type); - }); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function( i ) { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; - type = type || "fx"; - - return this.queue( type, function() { - var elem = this; - setTimeout(function() { - jQuery.dequeue( elem, type ); - }, time ); - }); - }, - - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - } -}); - - - - -var rclass = /[\n\t]/g, - rspaces = /\s+/, - rreturn = /\r/g, - rspecialurl = /^(?:href|src|style)$/, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rradiocheck = /^(?:radio|checkbox)$/i; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name, fn ) { - return this.each(function(){ - jQuery.attr( this, name, "" ); - if ( this.nodeType === 1 ) { - this.removeAttribute( name ); - } - }); - }, - - addClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.addClass( value.call(this, i, self.attr("class")) ); - }); - } - - if ( value && typeof value === "string" ) { - var classNames = (value || "").split( rspaces ); - - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className ) { - elem.className = value; - - } else { - var className = " " + elem.className + " ", setClass = elem.className; - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { - setClass += " " + classNames[c]; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.removeClass( value.call(this, i, self.attr("class")) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - var classNames = (value || "").split( rspaces ); - - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - var className = (" " + elem.className + " ").replace(rclass, " "); - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[c] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this); - self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, i = 0, self = jQuery(this), - state = stateVal, - classNames = value.split( rspaces ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery.data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " "; - for ( var i = 0, l = this.length; i < l; i++ ) { - if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - if ( !arguments.length ) { - var elem = this[0]; - - if ( elem ) { - if ( jQuery.nodeName( elem, "option" ) ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - - // We need to handle select boxes special - if ( jQuery.nodeName( elem, "select" ) ) { - var index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { - var option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery(option).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - } - - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { - return elem.getAttribute("value") === null ? "on" : elem.value; - } - - - // Everything else, we just grab the value - return (elem.value || "").replace(rreturn, ""); - - } - - return undefined; - } - - var isFunction = jQuery.isFunction(value); - - return this.each(function(i) { - var self = jQuery(this), val = value; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call(this, i, self.val()); - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray(val) ) { - val = jQuery.map(val, function (value) { - return value == null ? "" : value + ""; - }); - } - - if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { - this.checked = jQuery.inArray( self.val(), val ) >= 0; - - } else if ( jQuery.nodeName( this, "select" ) ) { - var values = jQuery.makeArray(val); - - jQuery( "option", this ).each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - this.selectedIndex = -1; - } - - } else { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - // don't set attributes on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery(elem)[name](value); - } - - var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), - // Whether we are setting (or getting) - set = value !== undefined; - - // Try to normalize/fix the name - name = notxml && jQuery.props[ name ] || name; - - // Only do all the following if this is a node (faster for style) - if ( elem.nodeType === 1 ) { - // These attributes require special treatment - var special = rspecialurl.test( name ); - - // Safari mis-reports the default selected property of an option - // Accessing the parent's selectedIndex property fixes it - if ( name === "selected" && !jQuery.support.optSelected ) { - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - - // If applicable, access the attribute via the DOM 0 way - // 'in' checks fail in Blackberry 4.7 #6931 - if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) { - if ( set ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } - - if ( value === null ) { - if ( elem.nodeType === 1 ) { - elem.removeAttribute( name ); - } - - } else { - elem[ name ] = value; - } - } - - // browsers index elements by id/name on forms, give priority to attributes. - if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { - return elem.getAttributeNode( name ).nodeValue; - } - - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - if ( name === "tabIndex" ) { - var attributeNode = elem.getAttributeNode( "tabIndex" ); - - return attributeNode && attributeNode.specified ? - attributeNode.value : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - - return elem[ name ]; - } - - if ( !jQuery.support.style && notxml && name === "style" ) { - if ( set ) { - elem.style.cssText = "" + value; - } - - return elem.style.cssText; - } - - if ( set ) { - // convert the value to a string (all browsers do this but IE) see #1070 - elem.setAttribute( name, "" + value ); - } - - // Ensure that missing attributes return undefined - // Blackberry 4.7 returns "" from getAttribute #6938 - if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) { - return undefined; - } - - var attr = !jQuery.support.hrefNormalized && notxml && special ? - // Some attributes require a special call on IE - elem.getAttribute( name, 2 ) : - elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return attr === null ? undefined : attr; - } - } -}); - - - - -var rnamespaces = /\.(.*)$/, - rformElems = /^(?:textarea|input|select)$/i, - rperiod = /\./g, - rspace = / /g, - rescape = /[^\w\s.|`]/g, - fcleanup = function( nm ) { - return nm.replace(rescape, "\\$&"); - }, - focusCounts = { focusin: 0, focusout: 0 }; - -/* - * A number of helper functions used for managing events. - * Many of the ideas behind this code originated from - * Dean Edwards' addEvent library. - */ -jQuery.event = { - - // Bind an event to an element - // Original by Dean Edwards - add: function( elem, types, handler, data ) { - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // For whatever reason, IE has trouble passing the window object - // around, causing it to be cloned in the process - if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) { - elem = window; - } - - if ( handler === false ) { - handler = returnFalse; - } - - var handleObjIn, handleObj; - - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the function being executed has a unique ID - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure - var elemData = jQuery.data( elem ); - - // If no elemData is found then we must be trying to bind to one of the - // banned noData elements - if ( !elemData ) { - return; - } - - // Use a key less likely to result in collisions for plain JS objects. - // Fixes bug #7150. - var eventKey = elem.nodeType ? "events" : "__events__", - events = elemData[ eventKey ], - eventHandle = elemData.handle; - - if ( typeof events === "function" ) { - // On plain objects events is a fn that holds the the data - // which prevents this data from being JSON serialized - // the function does not need to be called, it just contains the data - eventHandle = events.handle; - events = events.events; - - } else if ( !events ) { - if ( !elem.nodeType ) { - // On plain objects, create a fn that acts as the holder - // of the values to avoid JSON serialization of event data - elemData[ eventKey ] = elemData = function(){}; - } - - elemData.events = events = {}; - } - - if ( !eventHandle ) { - elemData.handle = eventHandle = function() { - // Handle the second event of a trigger and when - // an event is called after a page has unloaded - return typeof jQuery !== "undefined" && !jQuery.event.triggered ? - jQuery.event.handle.apply( eventHandle.elem, arguments ) : - undefined; - }; - } - - // Add elem as a property of the handle function - // This is to prevent a memory leak with non-native events in IE. - eventHandle.elem = elem; - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = types.split(" "); - - var type, i = 0, namespaces; - - while ( (type = types[ i++ ]) ) { - handleObj = handleObjIn ? - jQuery.extend({}, handleObjIn) : - { handler: handler, data: data }; - - // Namespaced event handlers - if ( type.indexOf(".") > -1 ) { - namespaces = type.split("."); - type = namespaces.shift(); - handleObj.namespace = namespaces.slice(0).sort().join("."); - - } else { - namespaces = []; - handleObj.namespace = ""; - } - - handleObj.type = type; - if ( !handleObj.guid ) { - handleObj.guid = handler.guid; - } - - // Get the current list of functions bound to this event - var handlers = events[ type ], - special = jQuery.event.special[ type ] || {}; - - // Init the event handler queue - if ( !handlers ) { - handlers = events[ type ] = []; - - // Check for a special event handler - // Only use addEventListener/attachEvent if the special - // events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add the function to the element's handler list - handlers.push( handleObj ); - - // Keep track of which events have been used, for global triggering - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, pos ) { - // don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - if ( handler === false ) { - handler = returnFalse; - } - - var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, - eventKey = elem.nodeType ? "events" : "__events__", - elemData = jQuery.data( elem ), - events = elemData && elemData[ eventKey ]; - - if ( !elemData || !events ) { - return; - } - - if ( typeof events === "function" ) { - elemData = events; - events = events.events; - } - - // types is actually an event object here - if ( types && types.type ) { - handler = types.handler; - types = types.type; - } - - // Unbind all events for the element - if ( !types || typeof types === "string" && types.charAt(0) === "." ) { - types = types || ""; - - for ( type in events ) { - jQuery.event.remove( elem, type + types ); - } - - return; - } - - // Handle multiple events separated by a space - // jQuery(...).unbind("mouseover mouseout", fn); - types = types.split(" "); - - while ( (type = types[ i++ ]) ) { - origType = type; - handleObj = null; - all = type.indexOf(".") < 0; - namespaces = []; - - if ( !all ) { - // Namespaced event handlers - namespaces = type.split("."); - type = namespaces.shift(); - - namespace = new RegExp("(^|\\.)" + - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - eventType = events[ type ]; - - if ( !eventType ) { - continue; - } - - if ( !handler ) { - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( all || namespace.test( handleObj.namespace ) ) { - jQuery.event.remove( elem, origType, handleObj.handler, j ); - eventType.splice( j--, 1 ); - } - } - - continue; - } - - special = jQuery.event.special[ type ] || {}; - - for ( j = pos || 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( handler.guid === handleObj.guid ) { - // remove the given handler for the given type - if ( all || namespace.test( handleObj.namespace ) ) { - if ( pos == null ) { - eventType.splice( j--, 1 ); - } - - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - - if ( pos != null ) { - break; - } - } - } - - // remove generic event handler if no more handlers exist - if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - ret = null; - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - var handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - delete elemData.events; - delete elemData.handle; - - if ( typeof elemData === "function" ) { - jQuery.removeData( elem, eventKey ); - - } else if ( jQuery.isEmptyObject( elemData ) ) { - jQuery.removeData( elem ); - } - } - }, - - // bubbling is internal - trigger: function( event, data, elem /*, bubbling */ ) { - // Event object or event type - var type = event.type || event, - bubbling = arguments[3]; - - if ( !bubbling ) { - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - jQuery.extend( jQuery.Event(type), event ) : - // Just the event type (string) - jQuery.Event(type); - - if ( type.indexOf("!") >= 0 ) { - event.type = type = type.slice(0, -1); - event.exclusive = true; - } - - // Handle a global trigger - if ( !elem ) { - // Don't bubble custom events when global (to avoid too much overhead) - event.stopPropagation(); - - // Only trigger if we've ever bound an event for it - if ( jQuery.event.global[ type ] ) { - jQuery.each( jQuery.cache, function() { - if ( this.events && this.events[type] ) { - jQuery.event.trigger( event, data, this.handle.elem ); - } - }); - } - } - - // Handle triggering a single element - - // don't do events on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - // Clean up in case it is reused - event.result = undefined; - event.target = elem; - - // Clone the incoming data, if any - data = jQuery.makeArray( data ); - data.unshift( event ); - } - - event.currentTarget = elem; - - // Trigger the event, it is assumed that "handle" is a function - var handle = elem.nodeType ? - jQuery.data( elem, "handle" ) : - (jQuery.data( elem, "__events__" ) || {}).handle; - - if ( handle ) { - handle.apply( elem, data ); - } - - var parent = elem.parentNode || elem.ownerDocument; - - // Trigger an inline bound script - try { - if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { - if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { - event.result = false; - event.preventDefault(); - } - } - - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (inlineError) {} - - if ( !event.isPropagationStopped() && parent ) { - jQuery.event.trigger( event, data, parent, true ); - - } else if ( !event.isDefaultPrevented() ) { - var target = event.target, old, targetType = type.replace(rnamespaces, ""), - isClick = jQuery.nodeName(target, "a") && targetType === "click", - special = jQuery.event.special[ targetType ] || {}; - - if ( (!special._default || special._default.call( elem, event ) === false) && - !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { - - try { - if ( target[ targetType ] ) { - // Make sure that we don't accidentally re-trigger the onFOO events - old = target[ "on" + targetType ]; - - if ( old ) { - target[ "on" + targetType ] = null; - } - - jQuery.event.triggered = true; - target[ targetType ](); - } - - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (triggerError) {} - - if ( old ) { - target[ "on" + targetType ] = old; - } - - jQuery.event.triggered = false; - } - } - }, - - handle: function( event ) { - var all, handlers, namespaces, namespace_sort = [], namespace_re, events, args = jQuery.makeArray( arguments ); - - event = args[0] = jQuery.event.fix( event || window.event ); - event.currentTarget = this; - - // Namespaced event handlers - all = event.type.indexOf(".") < 0 && !event.exclusive; - - if ( !all ) { - namespaces = event.type.split("."); - event.type = namespaces.shift(); - namespace_sort = namespaces.slice(0).sort(); - namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - event.namespace = event.namespace || namespace_sort.join("."); - - events = jQuery.data(this, this.nodeType ? "events" : "__events__"); - - if ( typeof events === "function" ) { - events = events.events; - } - - handlers = (events || {})[ event.type ]; - - if ( events && handlers ) { - // Clone the handlers to prevent manipulation - handlers = handlers.slice(0); - - for ( var j = 0, l = handlers.length; j < l; j++ ) { - var handleObj = handlers[ j ]; - - // Filter the functions by class - if ( all || namespace_re.test( handleObj.namespace ) ) { - // Pass in a reference to the handler function itself - // So that we can later remove it - event.handler = handleObj.handler; - event.data = handleObj.data; - event.handleObj = handleObj; - - var ret = handleObj.handler.apply( this, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - } - - return event.result; - }, - - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // store a copy of the original event object - // and "clone" to set read-only properties - var originalEvent = event; - event = jQuery.Event( originalEvent ); - - for ( var i = this.props.length, prop; i; ) { - prop = this.props[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary - if ( !event.target ) { - event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either - } - - // check if target is a textnode (safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && event.fromElement ) { - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; - } - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && event.clientX != null ) { - var doc = document.documentElement, body = document.body; - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } - - // Add which for key events - if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { - event.which = event.charCode != null ? event.charCode : event.keyCode; - } - - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) - if ( !event.metaKey && event.ctrlKey ) { - event.metaKey = event.ctrlKey; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && event.button !== undefined ) { - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); - } - - return event; - }, - - // Deprecated, use jQuery.guid instead - guid: 1E8, - - // Deprecated, use jQuery.proxy instead - proxy: jQuery.proxy, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady, - teardown: jQuery.noop - }, - - live: { - add: function( handleObj ) { - jQuery.event.add( this, - liveConvert( handleObj.origType, handleObj.selector ), - jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); - }, - - remove: function( handleObj ) { - jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); - } - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src ) { - // Allow instantiation without the 'new' keyword - if ( !this.preventDefault ) { - return new jQuery.Event( src ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - // Event type - } else { - this.type = src; - } - - // timeStamp is buggy for some events on Firefox(#3843) - // So we won't rely on the native value - this.timeStamp = jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Checks if an event happened on an element within another element -// Used in jQuery.event.special.mouseenter and mouseleave handlers -var withinElement = function( event ) { - // Check if mouse(over|out) are still within the same parent element - var parent = event.relatedTarget; - - // Firefox sometimes assigns relatedTarget a XUL element - // which we cannot access the parentNode property of - try { - // Traverse up the tree - while ( parent && parent !== this ) { - parent = parent.parentNode; - } - - if ( parent !== this ) { - // set the correct event type - event.type = event.data; - - // handle event if we actually just moused on to a non sub-element - jQuery.event.handle.apply( this, arguments ); - } - - // assuming we've left the element since we most likely mousedover a xul element - } catch(e) { } -}, - -// In case of event delegation, we only need to rename the event.type, -// liveHandler will take care of the rest. -delegate = function( event ) { - event.type = event.data; - jQuery.event.handle.apply( this, arguments ); -}; - -// Create mouseenter and mouseleave events -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - setup: function( data ) { - jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); - }, - teardown: function( data ) { - jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); - } - }; -}); - -// submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function( data, namespaces ) { - if ( this.nodeName.toLowerCase() !== "form" ) { - jQuery.event.add(this, "click.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; - - if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { - e.liveFired = undefined; - return trigger( "submit", this, arguments ); - } - }); - - jQuery.event.add(this, "keypress.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; - - if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { - e.liveFired = undefined; - return trigger( "submit", this, arguments ); - } - }); - - } else { - return false; - } - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialSubmit" ); - } - }; - -} - -// change delegation, happens here so we have bind. -if ( !jQuery.support.changeBubbles ) { - - var changeFilters, - - getVal = function( elem ) { - var type = elem.type, val = elem.value; - - if ( type === "radio" || type === "checkbox" ) { - val = elem.checked; - - } else if ( type === "select-multiple" ) { - val = elem.selectedIndex > -1 ? - jQuery.map( elem.options, function( elem ) { - return elem.selected; - }).join("-") : - ""; - - } else if ( elem.nodeName.toLowerCase() === "select" ) { - val = elem.selectedIndex; - } - - return val; - }, - - testChange = function testChange( e ) { - var elem = e.target, data, val; - - if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { - return; - } - - data = jQuery.data( elem, "_change_data" ); - val = getVal(elem); - - // the current data will be also retrieved by beforeactivate - if ( e.type !== "focusout" || elem.type !== "radio" ) { - jQuery.data( elem, "_change_data", val ); - } - - if ( data === undefined || val === data ) { - return; - } - - if ( data != null || val ) { - e.type = "change"; - e.liveFired = undefined; - return jQuery.event.trigger( e, arguments[1], elem ); - } - }; - - jQuery.event.special.change = { - filters: { - focusout: testChange, - - beforedeactivate: testChange, - - click: function( e ) { - var elem = e.target, type = elem.type; - - if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { - return testChange.call( this, e ); - } - }, - - // Change has to be called before submit - // Keydown will be called before keypress, which is used in submit-event delegation - keydown: function( e ) { - var elem = e.target, type = elem.type; - - if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || - (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || - type === "select-multiple" ) { - return testChange.call( this, e ); - } - }, - - // Beforeactivate happens also before the previous element is blurred - // with this event you can't trigger a change event, but you can store - // information - beforeactivate: function( e ) { - var elem = e.target; - jQuery.data( elem, "_change_data", getVal(elem) ); - } - }, - - setup: function( data, namespaces ) { - if ( this.type === "file" ) { - return false; - } - - for ( var type in changeFilters ) { - jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); - } - - return rformElems.test( this.nodeName ); - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialChange" ); - - return rformElems.test( this.nodeName ); - } - }; - - changeFilters = jQuery.event.special.change.filters; - - // Handle when the input is .focus()'d - changeFilters.focus = changeFilters.beforeactivate; -} - -function trigger( type, elem, args ) { - args[0].type = type; - return jQuery.event.handle.apply( elem, args ); -} - -// Create "bubbling" focus and blur events -if ( document.addEventListener ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - jQuery.event.special[ fix ] = { - setup: function() { - if ( focusCounts[fix]++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --focusCounts[fix] === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - - function handler( e ) { - e = jQuery.event.fix( e ); - e.type = fix; - return jQuery.event.trigger( e, null, e.target ); - } - }); -} - -jQuery.each(["bind", "one"], function( i, name ) { - jQuery.fn[ name ] = function( type, data, fn ) { - // Handle object literals - if ( typeof type === "object" ) { - for ( var key in type ) { - this[ name ](key, data, type[key], fn); - } - return this; - } - - if ( jQuery.isFunction( data ) || data === false ) { - fn = data; - data = undefined; - } - - var handler = name === "one" ? jQuery.proxy( fn, function( event ) { - jQuery( this ).unbind( event, handler ); - return fn.apply( this, arguments ); - }) : fn; - - if ( type === "unload" && name !== "one" ) { - this.one( type, data, fn ); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.add( this[i], type, handler, data ); - } - } - - return this; - }; -}); - -jQuery.fn.extend({ - unbind: function( type, fn ) { - // Handle object literals - if ( typeof type === "object" && !type.preventDefault ) { - for ( var key in type ) { - this.unbind(key, type[key]); - } - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.remove( this[i], type, fn ); - } - } - - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.live( types, data, fn, selector ); - }, - - undelegate: function( selector, types, fn ) { - if ( arguments.length === 0 ) { - return this.unbind( "live" ); - - } else { - return this.die( types, null, fn, selector ); - } - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - - triggerHandler: function( type, data ) { - if ( this[0] ) { - var event = jQuery.Event( type ); - event.preventDefault(); - event.stopPropagation(); - jQuery.event.trigger( event, data, this[0] ); - return event.result; - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, i = 1; - - // link all the functions, so any of them can unbind this click handler - while ( i < args.length ) { - jQuery.proxy( fn, args[ i++ ] ); - } - - return this.click( jQuery.proxy( fn, function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - })); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -var liveMap = { - focus: "focusin", - blur: "focusout", - mouseenter: "mouseover", - mouseleave: "mouseout" -}; - -jQuery.each(["live", "die"], function( i, name ) { - jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { - var type, i = 0, match, namespaces, preType, - selector = origSelector || this.selector, - context = origSelector ? this : jQuery( this.context ); - - if ( typeof types === "object" && !types.preventDefault ) { - for ( var key in types ) { - context[ name ]( key, data, types[key], selector ); - } - - return this; - } - - if ( jQuery.isFunction( data ) ) { - fn = data; - data = undefined; - } - - types = (types || "").split(" "); - - while ( (type = types[ i++ ]) != null ) { - match = rnamespaces.exec( type ); - namespaces = ""; - - if ( match ) { - namespaces = match[0]; - type = type.replace( rnamespaces, "" ); - } - - if ( type === "hover" ) { - types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); - continue; - } - - preType = type; - - if ( type === "focus" || type === "blur" ) { - types.push( liveMap[ type ] + namespaces ); - type = type + namespaces; - - } else { - type = (liveMap[ type ] || type) + namespaces; - } - - if ( name === "live" ) { - // bind live handler - for ( var j = 0, l = context.length; j < l; j++ ) { - jQuery.event.add( context[j], "live." + liveConvert( type, selector ), - { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); - } - - } else { - // unbind live handler - context.unbind( "live." + liveConvert( type, selector ), fn ); - } - } - - return this; - }; -}); - -function liveHandler( event ) { - var stop, maxLevel, elems = [], selectors = [], - related, match, handleObj, elem, j, i, l, data, close, namespace, ret, - events = jQuery.data( this, this.nodeType ? "events" : "__events__" ); - - if ( typeof events === "function" ) { - events = events.events; - } - - // Make sure we avoid non-left-click bubbling in Firefox (#3861) - if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) { - return; - } - - if ( event.namespace ) { - namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - event.liveFired = this; - - var live = events.live.slice(0); - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { - selectors.push( handleObj.selector ); - - } else { - live.splice( j--, 1 ); - } - } - - match = jQuery( event.target ).closest( selectors, event.currentTarget ); - - for ( i = 0, l = match.length; i < l; i++ ) { - close = match[i]; - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) { - elem = close.elem; - related = null; - - // Those two events require additional checking - if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { - event.type = handleObj.preType; - related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; - } - - if ( !related || related !== elem ) { - elems.push({ elem: elem, handleObj: handleObj, level: close.level }); - } - } - } - } - - for ( i = 0, l = elems.length; i < l; i++ ) { - match = elems[i]; - - if ( maxLevel && match.level > maxLevel ) { - break; - } - - event.currentTarget = match.elem; - event.data = match.handleObj.data; - event.handleObj = match.handleObj; - - ret = match.handleObj.origHandler.apply( match.elem, arguments ); - - if ( ret === false || event.isPropagationStopped() ) { - maxLevel = match.level; - - if ( ret === false ) { - stop = false; - } - } - } - - return stop; -} - -function liveConvert( type, selector ) { - return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&"); -} - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.bind( name, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } -}); - -// Prevent memory leaks in IE -// Window isn't included so as not to unbind existing unload events -// More info: -// - http://isaacschlueter.com/2006/10/msie-memory-leaks/ -if ( window.attachEvent && !window.addEventListener ) { - jQuery(window).bind("unload", function() { - for ( var id in jQuery.cache ) { - if ( jQuery.cache[ id ].handle ) { - // Try/Catch is to handle iframes being unloaded, see #4280 - try { - jQuery.event.remove( jQuery.cache[ id ].handle.elem ); - } catch(e) {} - } - } - }); -} - - -/*! - * Sizzle CSS Selector Engine - v1.0 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function(){ - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function(selector, context, results, seed) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context), - soFar = selector, ret, cur, pop, i; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec(""); - m = chunker.exec(soFar); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set ); - } - } - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray(set); - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function(results){ - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort(sortOrder); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[i-1] ) { - results.splice(i--, 1); - } - } - } - } - - return results; -}; - -Sizzle.matches = function(expr, set){ - return Sizzle(expr, null, null, set); -}; - -Sizzle.matchesSelector = function(node, expr){ - return Sizzle(expr, null, null, [node]).length > 0; -}; - -Sizzle.find = function(expr, context, isXML){ - var set; - - if ( !expr ) { - return []; - } - - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var type = Expr.order[i], match; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; - match.splice(1,1); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace(/\\/g, ""); - set = Expr.find[ type ]( match, context, isXML ); - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = context.getElementsByTagName("*"); - } - - return {set: set, expr: expr}; -}; - -Sizzle.filter = function(expr, set, inplace, not){ - var old = expr, result = [], curLoop = set, match, anyFound, - isXMLFilter = set && set[0] && Sizzle.isXML(set[0]); - - while ( expr && set.length ) { - for ( var type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - var filter = Expr.filter[ type ], found, item, left = match[1]; - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - } else { - curLoop[i] = false; - } - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw "Syntax error, unrecognized expression: " + msg; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - leftMatch: {}, - attrMap: { - "class": "className", - "for": "htmlFor" - }, - attrHandle: { - href: function(elem){ - return elem.getAttribute("href"); - } - }, - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !/\W/.test(part), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - ">": function(checkSet, part){ - var isPartStr = typeof part === "string", - elem, i = 0, l = checkSet.length; - - if ( isPartStr && !/\W/.test(part) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - "": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck, nodeCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); - }, - "~": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck, nodeCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); - } - }, - find: { - ID: function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - NAME: function(match, context){ - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], results = context.getElementsByName(match[1]); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - TAG: function(match, context){ - return context.getElementsByTagName(match[1]); - } - }, - preFilter: { - CLASS: function(match, curLoop, inplace, result, not, isXML){ - match = " " + match[1].replace(/\\/g, "") + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - ID: function(match){ - return match[1].replace(/\\/g, ""); - }, - TAG: function(match, curLoop){ - return match[1].toLowerCase(); - }, - CHILD: function(match){ - if ( match[1] === "nth" ) { - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - ATTR: function(match, curLoop, inplace, result, not, isXML){ - var name = match[1].replace(/\\/g, ""); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - PSEUDO: function(match, curLoop, inplace, result, not){ - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - if ( !inplace ) { - result.push.apply( result, ret ); - } - return false; - } - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - POS: function(match){ - match.unshift( true ); - return match; - } - }, - filters: { - enabled: function(elem){ - return elem.disabled === false && elem.type !== "hidden"; - }, - disabled: function(elem){ - return elem.disabled === true; - }, - checked: function(elem){ - return elem.checked === true; - }, - selected: function(elem){ - // Accessing this property makes selected-by-default - // options in Safari work properly - elem.parentNode.selectedIndex; - return elem.selected === true; - }, - parent: function(elem){ - return !!elem.firstChild; - }, - empty: function(elem){ - return !elem.firstChild; - }, - has: function(elem, i, match){ - return !!Sizzle( match[3], elem ).length; - }, - header: function(elem){ - return (/h\d/i).test( elem.nodeName ); - }, - text: function(elem){ - return "text" === elem.type; - }, - radio: function(elem){ - return "radio" === elem.type; - }, - checkbox: function(elem){ - return "checkbox" === elem.type; - }, - file: function(elem){ - return "file" === elem.type; - }, - password: function(elem){ - return "password" === elem.type; - }, - submit: function(elem){ - return "submit" === elem.type; - }, - image: function(elem){ - return "image" === elem.type; - }, - reset: function(elem){ - return "reset" === elem.type; - }, - button: function(elem){ - return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; - }, - input: function(elem){ - return (/input|select|textarea|button/i).test(elem.nodeName); - } - }, - setFilters: { - first: function(elem, i){ - return i === 0; - }, - last: function(elem, i, match, array){ - return i === array.length - 1; - }, - even: function(elem, i){ - return i % 2 === 0; - }, - odd: function(elem, i){ - return i % 2 === 1; - }, - lt: function(elem, i, match){ - return i < match[3] - 0; - }, - gt: function(elem, i, match){ - return i > match[3] - 0; - }, - nth: function(elem, i, match){ - return match[3] - 0 === i; - }, - eq: function(elem, i, match){ - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function(elem, match, i, array){ - var name = match[1], filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - } else { - Sizzle.error( "Syntax error, unrecognized expression: " + name ); - } - }, - CHILD: function(elem, match){ - var type = match[1], node = elem; - switch (type) { - case 'only': - case 'first': - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - if ( type === "first" ) { - return true; - } - node = elem; - case 'last': - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - return true; - case 'nth': - var first = match[2], last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - var doneName = match[0], - parent = elem.parentNode; - - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - parent.sizcache = doneName; - } - - var diff = elem.nodeIndex - last; - if ( first === 0 ) { - return diff === 0; - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - ID: function(elem, match){ - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - TAG: function(elem, match){ - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; - }, - CLASS: function(elem, match){ - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - ATTR: function(elem, match){ - var name = match[1], - result = Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - POS: function(elem, match, i, array){ - var name = match[2], filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function(array, results) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch(e){ - makeArray = function(array, results) { - var ret = results || [], i = 0; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; -} else { - sortOrder = function( a, b ) { - var ap = [], bp = [], aup = a.parentNode, bup = b.parentNode, - cur = aup, al, bl; - - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // If the nodes are siblings (or identical) we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Utility function for retreiving the text value of an array of DOM nodes -Sizzle.getText = function( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += Sizzle.getText( elem.childNodes ); - } - } - - return ret; -}; - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(); - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - var root = document.documentElement; - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; - } - }; - - Expr.filter.ID = function(elem, match){ - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - root = form = null; // release memory in IE -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function(match, context){ - var results = context.getElementsByTagName(match[1]); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - Expr.attrHandle.href = function(elem){ - return elem.getAttribute("href", 2); - }; - } - - div = null; // release memory in IE -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, div = document.createElement("div"); - div.innerHTML = "

                            "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function(query, context, extra, seed){ - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - if ( context.nodeType === 9 ) { - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var old = context.id, id = context.id = "__sizzle__"; - - try { - return makeArray( context.querySelectorAll( "#" + id + " " + query ), extra ); - - } catch(pseudoError) { - } finally { - if ( old ) { - context.id = old; - - } else { - context.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - div = null; // release memory in IE - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector, - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, ":sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - if ( matches ) { - Sizzle.matchesSelector = function( node, expr ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) ) { - return matches.call( node, expr ); - } - } catch(e) {} - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
                            "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function(match, context, isXML) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - div = null; // release memory in IE -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem.sizcache = doneName; - elem.sizset = i; - } - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -Sizzle.contains = document.documentElement.contains ? function(a, b){ - return a !== b && (a.contains ? a.contains(b) : true); -} : function(a, b){ - return !!(a.compareDocumentPosition(b) & 16); -}; - -Sizzle.isXML = function(elem){ - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function(selector, context){ - var tmpSet = [], later = "", match, - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS; - -jQuery.fn.extend({ - find: function( selector ) { - var ret = this.pushStack( "", "find", selector ), length = 0; - - for ( var i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( var n = length; n < ret.length; n++ ) { - for ( var r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && jQuery.filter( selector, this ).length > 0; - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - if ( jQuery.isArray( selectors ) ) { - var match, matches = {}, selector, level = 1; - - if ( cur && selectors.length ) { - for ( i = 0, l = selectors.length; i < l; i++ ) { - selector = selectors[i]; - - if ( !matches[selector] ) { - matches[selector] = jQuery.expr.match.POS.test( selector ) ? - jQuery( selector, context || this.context ) : - selector; - } - } - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( selector in matches ) { - match = matches[selector]; - - if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { - ret.push({ selector: selector, elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - } - - return ret; - } - - var pos = POS.test( selectors ) ? - jQuery( selectors, context || this.context ) : null; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique(ret) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - if ( !elem || typeof elem === "string" ) { - return jQuery.inArray( this[0], - // If it receives a string, the selector is used - // If it receives nothing, the siblings are used - elem ? jQuery( elem ) : this.parent().children() ); - } - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context || this.context ) : - jQuery.makeArray( selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call(arguments).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], cur = elem[dir]; - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return (elem === qualifier) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return (jQuery.inArray( elem, qualifier ) >= 0) === keep; - }); -} - - - - -var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /\s]+\/)>/g, - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
                            ", "
                            " ], - thead: [ 1, "", "
                            " ], - tr: [ 2, "", "
                            " ], - td: [ 3, "", "
                            " ], - col: [ 2, "", "
                            " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }; - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/default/default.js b/labs/architecture-examples/javascriptmvc/jquery/event/default/default.js deleted file mode 100644 index d87d8606fe..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/default/default.js +++ /dev/null @@ -1,220 +0,0 @@ - -steal.plugins('jquery/event').then(function($){ - -$.fn. -/** - * @function jQuery.fn.triggerAsync - * @plugin jquery/event/default - * @parent jquery.event.pause - * - * Triggers an event and calls success when the event has finished propagating through the DOM and - * preventDefault is not called. - * - * $('#panel').triggerAsync('show', function(){ - * $('#panel').show(); - * }) - * - * You can also provide a callback that gets called if preventDefault was called on the event: - * - * $('#panel').triggerAsync('show', function(){ - * $('#panel').show(); - * },function(){ - * $('#other').addClass('error'); - * }) - * - * triggerAsync is designed to work with the [jquery.event.pause] plugin although it is defined in - * jquery/event/default - * - * ## API - * - * - * @param {String} type The type of event - * @param {Object} data The data for the event - * @param {Function} success(event) a callback function - * @param {Function} prevented(event) called if preventDefault is called on the - */ -triggerAsync = function(type, data, success, prevented){ - if(typeof data == 'function'){ - success = data; - data = undefined; - } - - if ( this[0] ) { - var event = $.Event( type ), - old = event.preventDefault; - - event.preventDefault = function(){ - old.apply(this, arguments); - prevented && prevented(this) - } - //event._success= success; - jQuery.event.trigger( {type: type, _success: success}, data, this[0] ); - } else{ - success.call(this); - } - return this; -} - - - -/** - * @add jQuery.event.special - */ -//cache default types for performance -var types = {}, rnamespaces= /\.(.*)$/, $event = $.event; -/** - * @attribute default - * @parent specialevents - * @plugin jquery/event/default - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/default/default.js - * @test jquery/event/default/qunit.html - * Allows you to perform default actions as a result of an event. - * - * Event based APIs are a powerful way of exposing functionality of your widgets. It also fits in - * quite nicely with how the DOM works. - * - * - * Like default events in normal functions (e.g. submitting a form), synthetic default events run after - * all event handlers have been triggered and no event handler has called - * preventDefault or returned false. - * - * To listen for a default event, just prefix the event with default. - * - * $("div").bind("default.show", function(ev){ ... }); - * $("ul").delegate("li","default.activate", function(ev){ ... }); - * - * - * ## Example - * - * Lets look at how you could build a simple tabs widget with default events. - * First with just jQuery: - * - * Default events are useful in cases where you want to provide an event based - * API for users of your widgets. Users can simply listen to your synthetic events and - * prevent your default functionality by calling preventDefault. - * - * In the example below, the tabs widget provides a show event. Users of the - * tabs widget simply listen for show, and if they wish for some reason, call preventDefault - * to avoid showing the tab. - * - * In this case, the application developer doesn't want to show the second - * tab until the checkbox is checked. - * - * @demo jquery/event/default/defaultjquery.html - * - * Lets see how we would build this with JavaScriptMVC: - * - * @demo jquery/event/default/default.html - */ -$event.special["default"] = { - add: function( handleObj ) { - //save the type - types[handleObj.namespace.replace(rnamespaces,"")] = true; - - //move the handler ... - var origHandler = handleObj.handler; - - handleObj.origHandler = origHandler; - handleObj.handler = function(ev, data){ - if(!ev._defaultActions) ev._defaultActions = []; - ev._defaultActions.push({element: this, handler: origHandler, event: ev, data: data, currentTarget: ev.currentTarget}) - } - }, - setup: function() {return true}, - triggerDefault : function(event, elem){ - - var defaultGetter = jQuery.Event("default."+event.type); - - $.extend(defaultGetter,{ - target: elem, - _defaultActions: event._defaultActions, - exclusive : true - }); - - defaultGetter.stopPropagation(); - - //default events only work on elements - if(elem){ - $event.handle.call(elem, defaultGetter); - } - }, - checkAndRunDefaults : function(event, elem){ - //fire if there are default actions to run && - // we have not prevented default && - // propagation has been stopped or we are at the document element - // we have reached the document - if (!event.isDefaultPrevented() && - (!event.isPaused || !event.isPaused()) && // no paused function or it's not paused - event._defaultActions && - ( ( event.isPropagationStopped() ) || - ( !elem.parentNode && !elem.ownerDocument ) ) - - ) { - - // put event back - event.namespace= event.type; - event.type = "default"; - event.liveFired = null; - - // call each event handler - for(var i = 0 ; i < event._defaultActions.length; i++){ - var a = event._defaultActions[i], - oldHandle = event.handled; - event.currentTarget = a.currentTarget; - a.handler.call(a.element, event, a.data); - event.handled = event.handled === null ? oldHandle : true; - } - - event._defaultActions = null; //set to null so everyone else on this element ignores it - - if(event._success){ - event._success(event); - } - } - } -} - -// overwrite trigger to allow default types -var oldTrigger = $event.trigger, - triggerDefault = $event.special['default'].triggerDefault, - checkAndRunDefaults = $event.special['default'].checkAndRunDefaults, - oldData = jQuery._data; - -$._data = function(elem, name, data){ - // always need to supply a function to call for handle - if(!data && name === "handle"){ - var func = oldData.apply(this, arguments); - return function(e){ - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.handle.apply( this, arguments ) : - undefined; - } - } - return oldData.apply(this, arguments) -} - -$event.trigger = function defaultTriggerer( event, data, elem, onlyHandlers){ - // Event object or event type - var type = event.type || event, - namespaces = [], - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event._defaultActions = []; //set depth for possibly reused events - - oldTrigger.call($.event, event, data, elem, onlyHandlers); -}; - - - - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/default/default_pause_test.html b/labs/architecture-examples/javascriptmvc/jquery/event/default/default_pause_test.html deleted file mode 100644 index dfc3f0a497..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/default/default_pause_test.html +++ /dev/null @@ -1,22 +0,0 @@ - - - Default Test Suite - - - - - - -

                            Default Test Suite

                            -

                            -
                            -

                            -
                            -
                              -
                              - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/default/default_pause_test.js b/labs/architecture-examples/javascriptmvc/jquery/event/default/default_pause_test.js deleted file mode 100644 index 9ffa00f39a..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/default/default_pause_test.js +++ /dev/null @@ -1,98 +0,0 @@ -steal.plugins('funcunit/qunit','jquery/event/default','jquery/event/pause').then(function(){ - -module("jquery/event/default_pause"); - - -test("default and pause with delegate", function(){ - var order = []; - stop(); - $("#qunit-test-area").html("

                              hello

                              ") - - $("#foo").delegate("#bar","default.show", function(){ - order.push("default") - }); - - $("#foo").delegate("#bar","show", function(ev){ - order.push('show') - ev.pause(); - setTimeout(function(){ - ev.resume(); - - setTimeout(function(){ - start(); - same(order,['show','default']) - },30) - - },50) - }); - - - $("#bar").trigger("show") - -}); - -test("default and pause with live", function(){ - $("#qunit-test-area").html("
                              hello
                              ") - - var order = []; - stop(); - - $("#foo").live("default.show", function(){ - order.push("default") - }); - $("#foo").live("show", function(ev){ - order.push('show') - ev.pause(); - setTimeout(function(){ - ev.resume(); - setTimeout(function(){ - start(); - same(order,['show','default']) - $("#foo").die("show"); - $("#foo").die("default.show"); - },30) - },50) - }); - - - $("#foo").trigger("show") - -}); - - -test("triggerAsync", function(){ - $("#qunit-test-area").html("
                              hello
                              ") - - var order = []; - stop(); - - $("#foo").live("default.show", function(){ - order.push("default") - }); - $("#foo").live("show", function(ev){ - order.push('show') - ev.pause(); - setTimeout(function(){ - ev.resume(); - setTimeout(function(){ - start(); - $("#foo").die() - same(order,['show','default','async']) - },30) - },50) - }); - - - $("#foo").triggerAsync("show", function(){ - order.push("async") - }) -}); - -test("triggerAsync with nothing", function(){ - $("#fool").triggerAsync("show", function(){ - ok(true) - }) -}); - - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/default/default_test.js b/labs/architecture-examples/javascriptmvc/jquery/event/default/default_test.js deleted file mode 100644 index 8183ac391b..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/default/default_test.js +++ /dev/null @@ -1,131 +0,0 @@ -steal.plugins('funcunit/qunit','jquery/event/default').then(function(){ - -module("jquery/event/default") -test("namespaced with same function", function(){ - - var count = 0 , func = function(){ - count++; - } - $("#qunit-test-area").html("
                              hey
                              ") - $("#one").bind("foo.bar", func).bind("foo.zar", func) - $("#one").trigger("foo.bar") - equals(1, count,"jquery seems ok") -}) - - -test("triggering defaults", function(){ - - $("#qunit-test-area").html( - - "
                              ClickMe
                              "+ - "
                              ClickMe
                              ") - - - var count1 = 0, defaultNum, touchNum, num = 0;; - $("#wrap1").bind("default.touch", function(){ - count1++; - defaultNum = (++num) - }) - $("#wrap1").bind("touch", function(){ - touchNum = (++num) - }) - $("#touchme1").trigger("touch") - equals(1, count1, "trigger default event") - equals(1, touchNum, "default called second") - equals(2, defaultNum, "default called second") - - - - //now prevent - - $("#bigwrapper").bind("touch", function(e){ e.preventDefault()}) - $("#touchme1").trigger("touch") - equals(1, count1, "default event not called") - equals(3, touchNum, "touch called again") - - var count2 = 0; - $("#wrap2").bind("default.hide.me.a", function(){ - count2++; - }) - $(document.body).bind("hide", function(ev){ - if(ev.target.id == "clickme1"){ - console.log("stopping and preventing") - ev.stopPropagation() - ev.preventDefault() - } - - }) - $(".clickme").click(function(){ - $(this).trigger("hide") - }) - - - $("#qunit-test-area").html("") -}) - - - -test("live on default events", function(){ - - $("#qunit-test-area").html( - - "
                              ClickMe
                              "+ - "
                              ClickMe
                              ") - var bw = $("#bigwrapper"), - count1 = 0, - count2 = 0, - count3 = 0; - var jq = $(); - jq.context = bw[0]; - jq.selector = "#wrap1" - jq.live("default.touch", function(){ - count1++; - }); - - //2nd selector - var jq2 = $(); - jq2.context = bw[0]; - jq2.selector = "#wrap2" - jq2.live("default.touching", function(){ - count2++; - }); - - - bw.delegate("#wrap2","default.somethingElse",function(){ - count3++; - }) - - - $("#touchme1").trigger("touch") - equals(count1,1, "doing touch") - - $("#touchme2").trigger("touching") - equals(count2,1, "doing touching") - - $("#touchme2").trigger("somethingElse") - equals(count3,1, "delegated live somethingElse") - - - $("#qunit-test-area").html("") -}); - - -test("default and live order", function(){ - var order = []; - $("#qunit-test-area").html("
                              ") - - $("#foo").live("default.show", function(){ - order.push("default") - }); - $("#foo").live("show", function(){ - order.push("show") - }); - - $("#foo").trigger("show") - - same(order, ['show','default'],"show then default") - $("#foo").die() -}); - - -}); diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/default/defaultjquery.html b/labs/architecture-examples/javascriptmvc/jquery/event/default/defaultjquery.html deleted file mode 100644 index c102d2ad9e..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/default/defaultjquery.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - Default - - - - -

                              Default Events

                              -

                              A tabs widget that doesn't let you continue until the first part is complete.

                              -
                              -
                              - -
                              - Check to complete this part. -
                              -
                              - You completed part 1 -
                              -
                              -
                              - - - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/default/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/event/default/qunit.html deleted file mode 100644 index 13d292988a..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/default/qunit.html +++ /dev/null @@ -1,22 +0,0 @@ - - - Default Test Suite - - - - - - -

                              Default Test Suite

                              -

                              -
                              -

                              -
                              -
                                -
                                - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed.html b/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed.html deleted file mode 100644 index e486480cbf..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - destroyed demo - - - -
                                -
                                Click Below to destroy me
                                -Click here!
                                -
                                - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed.js b/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed.js deleted file mode 100644 index afd851b0c9..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @add jQuery.event.special - */ -steal.plugins('jquery/event').then(function( $ ) { - /** - * @attribute destroyed - * @parent specialevents - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/dom/destroyed/destroyed.js - * @test jquery/event/destroyed/qunit.html - * Provides a destroyed event on an element. - *

                                - * The destroyed event is called when the element - * is removed as a result of jQuery DOM manipulators like remove, html, - * replaceWith, etc. Destroyed events do not bubble, so make sure you don't use live or delegate with destroyed - * events. - *

                                - *

                                Quick Example

                                - * @codestart - * $(".foo").bind("destroyed", function(){ - * //clean up code - * }) - * @codeend - *

                                Quick Demo

                                - * @demo jquery/event/destroyed/destroyed.html - *

                                More Involved Demo

                                - * @demo jquery/event/destroyed/destroyed_menu.html - */ - - var oldClean = jQuery.cleanData; - - $.cleanData = function( elems ) { - for ( var i = 0, elem; - (elem = elems[i]) !== undefined; i++ ) { - $(elem).triggerHandler("destroyed"); - //$.event.remove( elem, 'destroyed' ); - } - oldClean(elems); - }; - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed_menu.html b/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed_menu.html deleted file mode 100644 index 8d6d7056cf..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/destroyed_menu.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - destroyed demo - - - -

                                This demo creates a single, reusable menu for multiple elements. - Click each "Show Menu" button to see the menu expand. By clicking - the "Remove" button, it removes a "Show Menu". When - all "Show Menu" buttons are gone, the elment is removed. - After removing all the "Show Me" elements, - the menu will be removed completely. This is done with the help of the - destroyed special event. -

                                -
                                -
                                - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/qunit.html deleted file mode 100644 index f16857d89c..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/qunit.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - -

                                destroyed Test Suite

                                -

                                -
                                -

                                -
                                -
                                  -
                                  - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/test/qunit/destroyed_test.js b/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/test/qunit/destroyed_test.js deleted file mode 100644 index 17228983e3..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/test/qunit/destroyed_test.js +++ /dev/null @@ -1,12 +0,0 @@ -module("jquery/event/destroyed") -test("removing an element", function(){ - var div = $("
                                  ").data("testData",5) - div.appendTo($("#qunit-test-area")) - var destroyed = false; - div.bind("destroyed",function(){ - destroyed = true; - equals($(this).data("testData"),5, "other data still exists") - }) - div.remove(); - ok(destroyed, "destroyed called") -}) \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/test/qunit/qunit.js b/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/test/qunit/qunit.js deleted file mode 100644 index 22bc1506de..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/destroyed/test/qunit/qunit.js +++ /dev/null @@ -1,6 +0,0 @@ -//we probably have to have this only describing where the tests are -steal - .plugins("jquery/event/destroyed") //load your app - .plugins('funcunit/qunit') //load qunit - .then("destroyed_test") - diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drag/drag.html b/labs/architecture-examples/javascriptmvc/jquery/event/drag/drag.html deleted file mode 100644 index 1755690993..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drag/drag.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - drag - - - -
                                  -

                                  Drag with bind

                                  -
                                  Drag Me
                                  - -

                                  Delegated Drags

                                  -
                                  -
                                  handle
                                  -
                                  handle
                                  -
                                  - -

                                  Drag Ghost

                                  -
                                  Drag and I get cloned
                                  - -

                                  Drag Revert

                                  -
                                  Drag and let me go
                                  - -

                                  Limit Drag

                                  -
                                  -
                                  drag me out of bounds
                                  -
                                  - -

                                  Drag Representative

                                  -
                                  Drag a Representative
                                  - - -

                                  Drag Horizontal

                                  -
                                  I only move horizontal
                                  - -

                                  Drag Scrolls

                                  -
                                  I move scrollbars
                                  -
                                  -
                                  • 1
                                  • 2
                                  • 3
                                  • -
                                  • 4
                                  • 5
                                  • 6
                                  • -
                                  • 7
                                  • 8
                                  • 9
                                  -
                                  -
                                  -

                                  Allow Text Selection

                                  -
                                  -

                                  I should be able to drag on this

                                  - -
                                  - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drag/drag.js b/labs/architecture-examples/javascriptmvc/jquery/event/drag/drag.js deleted file mode 100644 index 3264540c5e..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drag/drag.js +++ /dev/null @@ -1,573 +0,0 @@ -steal.plugins('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack').then(function( $ ) { - //modify live - //steal the live handler .... - var bind = function( object, method ) { - var args = Array.prototype.slice.call(arguments, 2); - return function() { - var args2 = [this].concat(args, $.makeArray(arguments)); - return method.apply(object, args2); - }; - }, - event = $.event, - clearSelection = window.getSelection ? function(){ - window.getSelection().removeAllRanges() - } : function(){}; - // var handle = event.handle; //unused - /** - * @class jQuery.Drag - * @parent specialevents - * @plugin jquery/event/drag - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/drag/drag.js - * @test jquery/event/drag/qunit.html - * Provides drag events as a special events to jQuery. - * A jQuery.Drag instance is created on a drag and passed - * as a parameter to the drag event callbacks. By calling - * methods on the drag event, you can alter the drag's - * behavior. - * ## Drag Events - * - * The drag plugin allows you to listen to the following events: - * - *
                                    - *
                                  • dragdown - the mouse cursor is pressed down
                                  • - *
                                  • draginit - the drag motion is started
                                  • - *
                                  • dragmove - the drag is moved
                                  • - *
                                  • dragend - the drag has ended
                                  • - *
                                  • dragover - the drag is over a drop point
                                  • - *
                                  • dragout - the drag moved out of a drop point
                                  • - *
                                  - * - * Just by binding or delegating on one of these events, you make - * the element dragable. You can change the behavior of the drag - * by calling methods on the drag object passed to the callback. - * - * ### Example - * - * Here's a quick example: - * - * //makes the drag vertical - * $(".drags").live("draginit", function(event, drag){ - * drag.vertical(); - * }) - * //gets the position of the drag and uses that to set the width - * //of an element - * $(".resize").live("dragmove",function(event, drag){ - * $(this).width(drag.position.left() - $(this).offset().left ) - * }) - * - * ## Drag Object - * - *

                                  The drag object is passed after the event to drag - * event callback functions. By calling methods - * and changing the properties of the drag object, - * you can alter how the drag behaves. - *

                                  - *

                                  The drag properties and methods:

                                  - *
                                    - *
                                  • [jQuery.Drag.prototype.cancel cancel] - stops the drag motion from happening
                                  • - *
                                  • [jQuery.Drag.prototype.ghost ghost] - copys the draggable and drags the cloned element
                                  • - *
                                  • [jQuery.Drag.prototype.horizontal horizontal] - limits the scroll to horizontal movement
                                  • - *
                                  • [jQuery.Drag.prototype.location location] - where the drag should be on the screen
                                  • - *
                                  • [jQuery.Drag.prototype.mouseElementPosition mouseElementPosition] - where the mouse should be on the drag
                                  • - *
                                  • [jQuery.Drag.prototype.only only] - only have drags, no drops
                                  • - *
                                  • [jQuery.Drag.prototype.representative representative] - move another element in place of this element
                                  • - *
                                  • [jQuery.Drag.prototype.revert revert] - animate the drag back to its position
                                  • - *
                                  • [jQuery.Drag.prototype.vertical vertical] - limit the drag to vertical movement
                                  • - *
                                  • [jQuery.Drag.prototype.limit limit] - limit the drag within an element (*limit plugin)
                                  • - *
                                  • [jQuery.Drag.prototype.scrolls scrolls] - scroll scrollable areas when dragging near their boundries (*scroll plugin)
                                  • - *
                                  - *

                                  Demo

                                  - * Now lets see some examples: - * @demo jquery/event/drag/drag.html 1000 - * @constructor - * The constructor is never called directly. - */ - $.Drag = function() {}; - - /** - * @Static - */ - $.extend($.Drag, { - lowerName: "drag", - current: null, - distance: 0, - /** - * Called when someone mouses down on a draggable object. - * Gathers all callback functions and creates a new Draggable. - * @hide - */ - mousedown: function( ev, element ) { - var isLeftButton = ev.button === 0 || ev.button == 1; - if (!isLeftButton || this.current ) { - return; - } //only allows 1 drag at a time, but in future could allow more - //ev.preventDefault(); - //create Drag - var drag = new $.Drag(), - delegate = ev.liveFired || element, - selector = ev.handleObj.selector, - self = this; - this.current = drag; - - drag.setup({ - element: element, - delegate: ev.liveFired || element, - selector: ev.handleObj.selector, - moved: false, - distance: this.distance, - callbacks: { - dragdown: event.find(delegate, ["dragdown"], selector), - draginit: event.find(delegate, ["draginit"], selector), - dragover: event.find(delegate, ["dragover"], selector), - dragmove: event.find(delegate, ["dragmove"], selector), - dragout: event.find(delegate, ["dragout"], selector), - dragend: event.find(delegate, ["dragend"], selector) - }, - destroyed: function() { - self.current = null; - } - }, ev); - } - }); - - /** - * @Prototype - */ - $.extend($.Drag.prototype, { - setup: function( options, ev ) { - $.extend(this, options); - this.element = $(this.element); - this.event = ev; - this.moved = false; - this.allowOtherDrags = false; - var mousemove = bind(this, this.mousemove), - mouseup = bind(this, this.mouseup); - this._mousemove = mousemove; - this._mouseup = mouseup; - this._distance = options.distance ? options.distance : 0; - - $(document).bind('mousemove', mousemove); - $(document).bind('mouseup', mouseup); - - if (!this.callEvents('down', this.element, ev) ) { - this.noSelection(this.delegate); - //this is for firefox - clearSelection(); - } - }, - /** - * Unbinds listeners and allows other drags ... - * @hide - */ - destroy: function() { - $(document).unbind('mousemove', this._mousemove); - $(document).unbind('mouseup', this._mouseup); - if (!this.moved ) { - this.event = this.element = null; - } - - this.selection(this.delegate); - this.destroyed(); - }, - mousemove: function( docEl, ev ) { - if (!this.moved ) { - var dist = Math.pow( ev.pageX - this.event.pageX, 2 ) + Math.pow( ev.pageY - this.event.pageY, 2 ); - if(dist < this._distance){ - return false; - } - - this.init(this.element, ev); - this.moved = true; - } - - var pointer = ev.vector(); - if ( this._start_position && this._start_position.equals(pointer) ) { - return; - } - //e.preventDefault(); - this.draw(pointer, ev); - }, - - mouseup: function( docEl, event ) { - //if there is a current, we should call its dragstop - if ( this.moved ) { - this.end(event); - } - this.destroy(); - }, - - /** - * noSelection method turns off text selection during a drag event. - * This method is called by default unless a event is listening to the 'dragdown' event. - * - * ## Example - * - * $('div.drag').bind('dragdown', function(elm,event,drag){ - * drag.noSelection(); - * }); - * - * @param [elm] an element to prevent selection on. Defaults to the dragable element. - */ - noSelection: function(elm) { - elm = elm || this.delegate - - document.documentElement.onselectstart = function() { - return false; - }; - document.documentElement.unselectable = "on"; - this.selectionDisabled = (this.selectionDisabled ? this.selectionDisabled.add(elm) : $(elm)); - this.selectionDisabled.css('-moz-user-select', '-moz-none'); - }, - - /** - * selection method turns on text selection that was previously turned off during the drag event. - * This method is called by default in 'destroy' unless a event is listening to the 'dragdown' event. - * - * ## Example - * - * $('div.drag').bind('dragdown', function(elm,event,drag){ - * drag.noSelection(); - * }); - */ - selection: function(elm) { - if(this.selectionDisabled){ - document.documentElement.onselectstart = function() {}; - document.documentElement.unselectable = "off"; - this.selectionDisabled.css('-moz-user-select', ''); - } - }, - - init: function( element, event ) { - element = $(element); - var startElement = (this.movingElement = (this.element = $(element))); //the element that has been clicked on - //if a mousemove has come after the click - this._cancelled = false; //if the drag has been cancelled - this.event = event; - this.mouseStartPosition = event.vector(); //where the mouse is located - /** - * @attribute mouseElementPosition - * The position of start of the cursor on the element - */ - this.mouseElementPosition = this.mouseStartPosition.minus(this.element.offsetv()); //where the mouse is on the Element - //this.callStart(element, event); - this.callEvents('init', element, event); - - //Check what they have set and respond accordingly - // if they canceled - if ( this._cancelled === true ) { - return; - } - //if they set something else as the element - this.startPosition = startElement != this.movingElement ? this.movingElement.offsetv() : this.currentDelta(); - - this.makePositioned(this.movingElement); - this.oldZIndex = this.movingElement.css('zIndex'); - this.movingElement.css('zIndex', 1000); - if (!this._only && this.constructor.responder ) { - this.constructor.responder.compile(event, this); - } - }, - makePositioned: function( that ) { - var style, pos = that.css('position'); - - if (!pos || pos == 'static' ) { - style = { - position: 'relative' - }; - - if ( window.opera ) { - style.top = '0px'; - style.left = '0px'; - } - that.css(style); - } - }, - callEvents: function( type, element, event, drop ) { - var i, cbs = this.callbacks[this.constructor.lowerName + type]; - for ( i = 0; i < cbs.length; i++ ) { - cbs[i].call(element, event, this, drop); - } - return cbs.length; - }, - /** - * Returns the position of the movingElement by taking its top and left. - * @hide - * @return {Vector} - */ - currentDelta: function() { - return new $.Vector(parseInt(this.movingElement.css('left'), 10) || 0, parseInt(this.movingElement.css('top'), 10) || 0); - }, - //draws the position of the dragmove object - draw: function( pointer, event ) { - // only drag if we haven't been cancelled; - if ( this._cancelled ) { - return; - } - clearSelection(); - /** - * @attribute location - * The location of where the element should be in the page. This - * takes into account the start position of the cursor on the element. - * - * If the drag is going to be moved to an unacceptable location, you can call preventDefault in - * dragmove to prevent it from being moved there. - * - * $('.mover').bind("dragmove", function(ev, drag){ - * if(drag.location.top() < 100){ - * ev.preventDefault() - * } - * }); - * - * You can also set the location to where it should be on the page. - */ - this.location = pointer.minus(this.mouseElementPosition); // the offset between the mouse pointer and the representative that the user asked for - // position = mouse - (dragOffset - dragTopLeft) - mousePosition - - // call move events - this.move(event); - if ( this._cancelled ) { - return; - } - if (!event.isDefaultPrevented() ) { - this.position(this.location); - } - - //fill in - if (!this._only && this.constructor.responder ) { - this.constructor.responder.show(pointer, this, event); - } - }, - /** - * Sets the position of this drag. - * - * The limit and scroll plugins - * overwrite this to make sure the drag follows a particular path. - * - * @param {jQuery.Vector} newOffsetv the position of the element (not the mouse) - */ - position: function( newOffsetv ) { //should draw it on the page - var style, dragged_element_css_offset = this.currentDelta(), - // the drag element's current left + top css attributes - dragged_element_position_vector = // the vector between the movingElement's page and css positions - this.movingElement.offsetv().minus(dragged_element_css_offset); // this can be thought of as the original offset - this.required_css_position = newOffsetv.minus(dragged_element_position_vector); - - this.offsetv = newOffsetv; - //dragged_element vector can probably be cached. - style = this.movingElement[0].style; - if (!this._cancelled && !this._horizontal ) { - style.top = this.required_css_position.top() + "px"; - } - if (!this._cancelled && !this._vertical ) { - style.left = this.required_css_position.left() + "px"; - } - }, - move: function( event ) { - this.callEvents('move', this.element, event); - }, - over: function( event, drop ) { - this.callEvents('over', this.element, event, drop); - }, - out: function( event, drop ) { - this.callEvents('out', this.element, event, drop); - }, - /** - * Called on drag up - * @hide - * @param {Event} event a mouseup event signalling drag/drop has completed - */ - end: function( event ) { - if ( this._cancelled ) { - return; - } - if (!this._only && this.constructor.responder ) { - this.constructor.responder.end(event, this); - } - - this.callEvents('end', this.element, event); - - if ( this._revert ) { - var self = this; - this.movingElement.animate({ - top: this.startPosition.top() + "px", - left: this.startPosition.left() + "px" - }, function() { - self.cleanup.apply(self, arguments); - }); - } - else { - this.cleanup(); - } - this.event = null; - }, - /** - * Cleans up drag element after drag drop. - * @hide - */ - cleanup: function() { - this.movingElement.css({ - zIndex: this.oldZIndex - }); - if ( this.movingElement[0] !== this.element[0] && - !this.movingElement.has(this.element[0]).length && - !this.element.has(this.movingElement[0]).length ) { - this.movingElement.css({ - display: 'none' - }); - } - if ( this._removeMovingElement ) { - this.movingElement.remove(); - } - - this.movingElement = this.element = this.event = null; - }, - /** - * Stops drag drop from running. - */ - cancel: function() { - this._cancelled = true; - //this.end(this.event); - if (!this._only && this.constructor.responder ) { - this.constructor.responder.clear(this.event.vector(), this, this.event); - } - this.destroy(); - - }, - /** - * Clones the element and uses it as the moving element. - * @return {jQuery.fn} the ghost - */ - ghost: function( loc ) { - // create a ghost by cloning the source element and attach the clone to the dom after the source element - var ghost = this.movingElement.clone().css('position', 'absolute'); - (loc ? $(loc) : this.movingElement).after(ghost); - ghost.width(this.movingElement.width()).height(this.movingElement.height()); - - // store the original element and make the ghost the dragged element - this.movingElement = ghost; - this.noSelection(ghost) - this._removeMovingElement = true; - return ghost; - }, - /** - * Use a representative element, instead of the movingElement. - * @param {HTMLElement} element the element you want to actually drag - * @param {Number} offsetX the x position where you want your mouse on the object - * @param {Number} offsetY the y position where you want your mouse on the object - */ - representative: function( element, offsetX, offsetY ) { - this._offsetX = offsetX || 0; - this._offsetY = offsetY || 0; - - var p = this.mouseStartPosition; - - this.movingElement = $(element); - this.movingElement.css({ - top: (p.y() - this._offsetY) + "px", - left: (p.x() - this._offsetX) + "px", - display: 'block', - position: 'absolute' - }).show(); - this.noSelection(this.movingElement) - this.mouseElementPosition = new $.Vector(this._offsetX, this._offsetY); - }, - /** - * Makes the movingElement go back to its original position after drop. - * @codestart - * ".handle dragend" : function( el, ev, drag ) { - * drag.revert() - * } - * @codeend - * @param {Boolean} [val] optional, set to false if you don't want to revert. - */ - revert: function( val ) { - this._revert = val === undefined ? true : val; - }, - /** - * Isolates the drag to vertical movement. - */ - vertical: function() { - this._vertical = true; - }, - /** - * Isolates the drag to horizontal movement. - */ - horizontal: function() { - this._horizontal = true; - }, - - - /** - * Respondables will not be alerted to this drag. - */ - only: function( only ) { - return (this._only = (only === undefined ? true : only)); - }, - - /** - * Sets the distance from the mouse before the item begins dragging. - * @param {Number} val - */ - distance:function(val){ - if(val !== undefined){ - this._distance = val; - return this; - }else{ - return this._distance - } - } - }); - - /** - * @add jQuery.event.special - */ - event.setupHelper([ - /** - * @attribute dragdown - *

                                  Listens for when a drag movement has started on a mousedown. - * If you listen to this, the mousedown's default event (preventing - * text selection) is not prevented. You are responsible for calling it - * if you want it (you probably do).

                                  - *

                                  Why might you not want it?

                                  - *

                                  You might want it if you want to allow text selection on element - * within the drag element. Typically these are input elements.

                                  - *

                                  Drag events are covered in more detail in [jQuery.Drag].

                                  - * @codestart - * $(".handles").live("dragdown", function(ev, drag){}) - * @codeend - */ - 'dragdown', - /** - * @attribute draginit - * Called when the drag starts. - *

                                  Drag events are covered in more detail in [jQuery.Drag].

                                  - */ - 'draginit', - /** - * @attribute dragover - * Called when the drag is over a drop. - *

                                  Drag events are covered in more detail in [jQuery.Drag].

                                  - */ - 'dragover', - /** - * @attribute dragmove - * Called when the drag is moved. - *

                                  Drag events are covered in more detail in [jQuery.Drag].

                                  - */ - 'dragmove', - /** - * @attribute dragout - * When the drag leaves a drop point. - *

                                  Drag events are covered in more detail in [jQuery.Drag].

                                  - */ - 'dragout', - /** - * @attribute dragend - * Called when the drag is done. - *

                                  Drag events are covered in more detail in [jQuery.Drag].

                                  - */ - 'dragend'], "mousedown", function( e ) { - $.Drag.mousedown.call($.Drag, e, this); - - }); -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drag/drag_test.js b/labs/architecture-examples/javascriptmvc/jquery/event/drag/drag_test.js deleted file mode 100644 index efaf8a7195..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drag/drag_test.js +++ /dev/null @@ -1,236 +0,0 @@ -steal.plugins("jquery/event/drop", - 'funcunit/qunit', - 'funcunit/syn').then("//jquery/event/drop/drop_test",function(){ - -module("jquery/event/drag",{ - makePoints : function(){ - var div = $("
                                  "+ - "
                                  "+ - "
                                  "+ - "
                                  "+ - "
                                  "); - - div.appendTo($("#qunit-test-area")); - var basicCss = { - width: "20px", - height: "20px", - position: "absolute", - border: "solid 1px black" - } - $("#drag").css(basicCss).css({top: "0px", left: "0px", zIndex: 1000, backgroundColor: "red"}) - $("#midpoint").css(basicCss).css({top: "0px", left: "30px"}) - $("#drop").css(basicCss).css({top: "30px", left: "30px"}); - } -}) -test("dragging an element", function(){ - var div = $("
                                  "+ - "
                                  "+ - "
                                  "+ - "
                                  "+ - "
                                  "); - $("#qunit-test-area").html(div); - var basicCss = { - width: "20px", - height: "20px", - position: "absolute", - border: "solid 1px black" - } - $("#drag").css(basicCss).css({top: "0px", left: "0px", zIndex: 1000, backgroundColor: "red"}) - $("#midpoint").css(basicCss).css({top: "0px", left: "30px"}) - $("#drop").css(basicCss).css({top: "30px", left: "30px"}); - - - var drags = {}, drops ={}; - - $('#drag') - .live("dragdown", function(){ - drags.dragdown = true; - }) - .live("draginit", function(){ - drags.draginit = true; - }) - .live("dragmove", function(){ - drags.dragmove = true; - }) - .live("dragend", function(){ - drags.dragend = true; - }) - .live("dragover", function(){ - drags.dragover = true; - }) - .live("dragout", function(){ - drags.dragout = true; - }) - $('#drop') - .live("dropinit", function(){ - drops.dropinit = true; - }) - .live("dropover", function(){ - drops.dropover = true; - }) - .live("dropout", function(){ - drops.dropout = true; - }) - .live("dropmove", function(){ - drops.dropmove = true; - }) - .live("dropon", function(){ - drops.dropon = true; - }) - .live("dropend", function(){ - drops.dropend = true; - }) - - stop(); - - Syn.drag({to: "#midpoint"},"drag", function(){ - ok(drags.dragdown, "dragdown fired correctly") - ok(drags.draginit, "draginit fired correctly") - ok(drags.dragmove, "dragmove fired correctly") - ok(drags.dragend, "dragend fired correctly") - ok(!drags.dragover,"dragover not fired yet") - ok(!drags.dragout, "dragout not fired yet") - //console.log(drags, drags.dragout) - ok(drops.dropinit, "dropinit fired correctly") - ok(!drops.dropover,"dropover fired correctly") - ok(!drops.dropout, "dropout not fired") - ok(!drops.dropmove,"dropmove not fired") - ok(!drops.dropon, "dropon not fired yet") - ok(drops.dropend, "dropend fired") - }).drag({to: "#drop"}, function(){ - ok(drags.dragover,"dragover fired correctly") - ok(drops.dropover, "dropmover fired correctly") - ok(drops.dropmove, "dropmove fired correctly") - ok(drops.dropon, "dropon fired correctly") - }).drag({to: "#midpoint"}, function(){ - ok(drags.dragout, "dragout fired correctly") - - ok(drops.dropout, "dropout fired correctly") - //div.remove(); - start(); - }) - - - - -}) - -test("drag position", function(){ - this.makePoints(); - - - var drags = {}, drops ={}; - - $('#drag').live("draginit", function(){ - drags.draginit = true; - }) - var offset = $('#drag').offset(); - - stop(); - - Syn.drag("+20 +20","drag", function(){ - var offset2 = $('#drag').offset(); - equals(offset.top+20, offset2.top, "top") - equals(offset.left+20, offset2.left, "left") - start(); - }) -}); - -test("dragdown" , function(){ - var div = $("
                                  "+ - "
                                  "+ - "

                                  Place to drag

                                  "+ - ""+ - ""+ - "
                                  "+ - "
                                  "); - - $("#qunit-test-area").html(div); - $("#dragger").css({ - position: "absolute", - backgroundColor : "blue", - border: "solid 1px black", - top: "0px", - left: "0px", - width: "200px", - height: "200px" - }) - var draginpfocused = false, - dragnopreventfocused = false; - - $('#draginp').focus(function(){ - draginpfocused = true; - }) - $('#dragnoprevent').focus(function(){ - dragnopreventfocused = true; - }) - - $('#dragger').bind("dragdown", function(ev, drag){ - if(ev.target.id == 'draginp'){ - drag.cancel(); - }else{ - ev.preventDefault(); - } - }) - var offset = $('#dragger').offset(); - - stop(); - Syn.drag("+20 +20","draginp", function(){ - var offset2 = $('#dragger').offset(); - equals(offset.top, offset2.top, "top") - equals(offset.left, offset2.left, "left") - - }).drag("+20 +20","dragnoprevent", function(){ - var offset2 = $('#dragger').offset(); - equals(offset.top+20, offset2.top, "top") - equals(offset.left+20, offset2.left, "left") - // IE doesn't respect preventDefault on text inputs (http://www.quirksmode.org/dom/events/click.html) - if(!$.browser.msie) - ok(draginpfocused, "First input was allowed to be focused correctly"); - //ok(!dragnopreventfocused, "Second input was not allowed to focus"); - start(); - }) - -}) - -test("dragging child element (a handle)" , function(){ - var div = $("
                                  "+ - "
                                  "+ - "
                                  Place to drag
                                  "+ - "
                                  "+ - "
                                  "); - - $("#qunit-test-area").html(div); - $("#dragger").css({ - position: "absolute", - backgroundColor : "blue", - border: "solid 1px black", - top: "0px", - left: "0px", - width: "200px", - height: "200px" - }); - - var dragged = $('#dragged'); - - $('#dragger').bind("draginit", function(ev, drag){ - drag.only(); - drag.representative(dragged); - }) - - stop(); - - var offset = $('#dragger').offset(); - - Syn.drag("+20 +20","dragged", function() { - var offset2 = $('#dragger').offset(); - equals(offset.top, offset2.top, "top") - equals(offset.left, offset2.left, "left") - - ok(dragged.is(':visible'), "Handle should be visible"); - - start(); - }); -}); - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drag/limit/limit.html b/labs/architecture-examples/javascriptmvc/jquery/event/drag/limit/limit.html deleted file mode 100644 index 19d009b33d..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drag/limit/limit.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - drag - - - -
                                  -
                                  handle
                                  -
                                  handle
                                  -
                                  - -
                                  -
                                  handle
                                  -
                                  handle
                                  -
                                  - - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drag/limit/limit.js b/labs/architecture-examples/javascriptmvc/jquery/event/drag/limit/limit.js deleted file mode 100644 index 40fe874f36..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drag/limit/limit.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @add jQuery.Drag.prototype - */ - -steal.plugins('jquery/event/drag', 'jquery/dom/cur_styles').then(function( $ ) { - - - $.Drag.prototype - /** - * @function limit - * @plugin jquery/event/drag/limit - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/event/drag/limit/limit.js - * limits the drag to a containing element - * @param {jQuery} container - * @param {Object} [center] can set the limit to the center of the object. Can be - * 'x', 'y' or 'both' - * @return {$.Drag} - */ - .limit = function( container, center ) { - //on draws ... make sure this happens - var styles = container.curStyles('borderTopWidth', 'paddingTop', 'borderLeftWidth', 'paddingLeft'), - paddingBorder = new $.Vector( - parseInt(styles.borderLeftWidth, 10) + parseInt(styles.paddingLeft, 10) || 0, parseInt(styles.borderTopWidth, 10) + parseInt(styles.paddingTop, 10) || 0); - - this._limit = { - offset: container.offsetv().plus(paddingBorder), - size: container.dimensionsv(), - center : center - }; - return this; - }; - - var oldPosition = $.Drag.prototype.position; - $.Drag.prototype.position = function( offsetPositionv ) { - //adjust required_css_position accordingly - if ( this._limit ) { - var limit = this._limit, - center = limit.center && limit.center.toLowerCase(), - movingSize = this.movingElement.dimensionsv('outer'), - halfHeight = center && center != 'x' ? movingSize.height() / 2 : 0, - halfWidth = center && center != 'y' ? movingSize.width() / 2 : 0, - lot = limit.offset.top(), - lof = limit.offset.left(), - height = limit.size.height(), - width = limit.size.width(); - - //check if we are out of bounds ... - //above - if ( offsetPositionv.top()+halfHeight < lot ) { - offsetPositionv.top(lot - halfHeight); - } - //below - if ( offsetPositionv.top() + movingSize.height() - halfHeight > lot + height ) { - offsetPositionv.top(lot + height - movingSize.height() + halfHeight); - } - //left - if ( offsetPositionv.left()+halfWidth < lof ) { - offsetPositionv.left(lof - halfWidth); - } - //right - if ( offsetPositionv.left() + movingSize.width() -halfWidth > lof + width ) { - offsetPositionv.left(lof + width - movingSize.left()+halfWidth); - } - } - - oldPosition.call(this, offsetPositionv); - }; - -}); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drag/qunit.html b/labs/architecture-examples/javascriptmvc/jquery/event/drag/qunit.html deleted file mode 100644 index 484912f64d..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drag/qunit.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - -

                                  Drag/Drop Test Suite

                                  -

                                  -
                                  -

                                  -
                                    -
                                    - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drag/scroll/scroll.js b/labs/architecture-examples/javascriptmvc/jquery/event/drag/scroll/scroll.js deleted file mode 100644 index 9282499507..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drag/scroll/scroll.js +++ /dev/null @@ -1,122 +0,0 @@ -steal.plugins("jquery/event/drop").then(function($){ //needs drop to determine if respondable - -/** - * @add jQuery.Drag.prototype - */ -$.Drag.prototype. - /** - * Will scroll elements with a scroll bar as the drag moves to borders. - * @plugin jquery/event/drag/scroll - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/drag/scroll/scroll.js - * @param {jQuery} elements to scroll. The window can be in this array. - */ - scrolls = function(elements){ - var elements = $(elements); - - for(var i = 0 ; i < elements.length; i++){ - this.constructor.responder._elements.push( elements.eq(i).data("_dropData", new $.Scrollable(elements[i]) )[0] ) - } - }, - -$.Scrollable = function(element){ - this.element = jQuery(element); -} -$.extend($.Scrollable.prototype,{ - init: function( element ) { - this.element = jQuery(element); - }, - callHandlers: function( method, el, ev, drag ) { - this[method](el || this.element[0], ev, this, drag) - }, - dropover: function() { - - }, - dropon: function() { - this.clear_timeout(); - }, - dropout: function() { - this.clear_timeout(); - }, - dropinit: function() { - - }, - dropend: function() {}, - clear_timeout: function() { - if(this.interval){ - clearTimeout(this.interval) - this.interval = null; - } - }, - distance: function( diff ) { - return (30 - diff) / 2; - }, - dropmove: function( el, ev, drop, drag ) { - - //if we were about to call a move, clear it. - this.clear_timeout(); - - //position of the mouse - var mouse = ev.vector(), - - //get the object we are going to get the boundries of - location_object = $(el == document.documentElement ? window : el), - - //get the dimension and location of that object - dimensions = location_object.dimensionsv('outer'), - position = location_object.offsetv(), - - //how close our mouse is to the boundries - bottom = position.y()+dimensions.y() - mouse.y(), - top = mouse.y() - position.y(), - right = position.x()+dimensions.x() - mouse.x(), - left = mouse.x() - position.x(), - - //how far we should scroll - dx =0, dy =0; - - - //check if we should scroll - if(bottom < 30) - dy = this.distance(bottom); - else if(top < 30) - dy = -this.distance(top) - if(right < 30) - dx = this.distance(right); - else if(left < 30) - dx = -this.distance(left); - - //if we should scroll - if(dx || dy){ - //set a timeout that will create a mousemove on that object - var self = this; - this.interval = setTimeout( function(){ - self.move($(el), drag.movingElement, dx, dy, ev, ev.clientX, ev.clientY, ev.screenX, ev.screenY) - },15) - } - }, - /** - * Scrolls an element then calls mouse a mousemove in the same location. - * @param {HTMLElement} scroll_element the element to be scrolled - * @param {HTMLElement} drag_element - * @param {Number} dx how far to scroll - * @param {Number} dy how far to scroll - * @param {Number} x the mouse position - * @param {Number} y the mouse position - */ - move: function( scroll_element, drag_element, dx, dy, ev/*, x,y,sx, sy*/ ) { - scroll_element.scrollTop( scroll_element.scrollTop() + dy); - scroll_element.scrollLeft(scroll_element.scrollLeft() + dx); - - drag_element.trigger( - $.event.fix({type: "mousemove", - clientX: ev.clientX, - clientY: ev.clientY, - screenX: ev.screenX, - screenY: ev.screenY, - pageX: ev.pageX, - pageY: ev.pageY})) - //drag_element.synthetic('mousemove',{clientX: x, clientY: y, screenX: sx, screenY: sy}) - } -}) - -}) \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drag/step/step.html b/labs/architecture-examples/javascriptmvc/jquery/event/drag/step/step.html deleted file mode 100644 index e8fbc4dbf7..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drag/step/step.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - drag - - - - -
                                    -
                                    -
                                    top left
                                    -
                                    horizontal
                                    -
                                    vertical
                                    -
                                    horizontal vertical
                                    -
                                    -
                                    - - - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drag/step/step.js b/labs/architecture-examples/javascriptmvc/jquery/event/drag/step/step.js deleted file mode 100644 index 51318548e3..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drag/step/step.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @add jQuery.Drag.prototype - */ - -steal.plugins('jquery/event/drag', 'jquery/dom/cur_styles').then(function( $ ) { - var round = function( x, m ) { - return Math.round(x / m) * m; - } - - $.Drag.prototype. - /** - * @function step - * @plugin jquery/event/drag/step - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/drag/step/step.js - * makes the drag move in steps of amount pixels. - * - * drag.step({x: 5}, $('foo'), "xy") - * - * ## Demo - * - * @demo jquery/event/drag/step/step.html - * - * @param {number|Object} amount make the drag move X amount in pixels from the top-left of container. - * @param {jQuery} [container] the container to move in reference to. If not provided, the document is used. - * @param {String} [center] Indicates how to position the drag element in relationship to the container. - * - * - If nothing is provided, places the top left corner of the drag element at - * 'amount' intervals from the top left corner of the container. - * - If 'x' is provided, it centers the element horizontally on the top-left corner. - * - If 'y' is provided, it centers the element vertically on the top-left corner of the container. - * - If 'xy' is provided, it centers the element on the top-left corner of the container. - * - * @return {jQuery.Drag} the drag object for chaining. - */ - step = function( amount, container, center ) { - //on draws ... make sure this happens - if ( typeof amount == 'number' ) { - amount = { - x: amount, - y: amount - } - } - container = container || $(document.body); - this._step = amount; - - var styles = container.curStyles("borderTopWidth", "paddingTop", "borderLeftWidth", "paddingLeft"); - var top = parseInt(styles.borderTopWidth) + parseInt(styles.paddingTop), - left = parseInt(styles.borderLeftWidth) + parseInt(styles.paddingLeft); - - this._step.offset = container.offsetv().plus(left, top); - this._step.center = center; - return this; - }; - - - var oldPosition = $.Drag.prototype.position; - $.Drag.prototype.position = function( offsetPositionv ) { - //adjust required_css_position accordingly - if ( this._step ) { - var step = this._step, - center = step.center && step.center.toLowerCase(), - movingSize = this.movingElement.dimensionsv('outer'), - lot = step.offset.top()- (center && center != 'x' ? movingSize.height() / 2 : 0), - lof = step.offset.left() - (center && center != 'y' ? movingSize.width() / 2 : 0); - - if ( this._step.x ) { - offsetPositionv.left(Math.round(lof + round(offsetPositionv.left() - lof, this._step.x))) - } - if ( this._step.y ) { - offsetPositionv.top(Math.round(lot + round(offsetPositionv.top() - lot, this._step.y))) - } - } - - oldPosition.call(this, offsetPositionv) - } - -}) \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drop/drop.html b/labs/architecture-examples/javascriptmvc/jquery/event/drop/drop.html deleted file mode 100644 index 9a807aa93b..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drop/drop.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - drop - - - -
                                    - - - - \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/drop/drop.js b/labs/architecture-examples/javascriptmvc/jquery/event/drop/drop.js deleted file mode 100644 index 34c22dfeb2..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/drop/drop.js +++ /dev/null @@ -1,424 +0,0 @@ -steal.plugins('jquery/event/drag','jquery/dom/within','jquery/dom/compare').then(function($){ - var event = $.event, - callHanders = function(){ - - }; - //somehow need to keep track of elements with selectors on them. When element is removed, somehow we need to know that - // - /** - * @add jQuery.event.special - */ - var eventNames = [ - /** - * @attribute dropover - * Called when a drag is first moved over this drop element. - *

                                    Drop events are covered in more detail in [jQuery.Drop].

                                    - */ - "dropover", - /** - * @attribute dropon - * Called when a drag is dropped on a drop element. - *

                                    Drop events are covered in more detail in [jQuery.Drop].

                                    - */ - "dropon", - /** - * @attribute dropout - * Called when a drag is moved out of this drop. - *

                                    Drop events are covered in more detail in [jQuery.Drop].

                                    - */ - "dropout", - /** - * @attribute dropinit - * Called when a drag motion starts and the drop elements are initialized. - *

                                    Drop events are covered in more detail in [jQuery.Drop].

                                    - */ - "dropinit", - /** - * @attribute dropmove - * Called repeatedly when a drag is moved over a drop. - *

                                    Drop events are covered in more detail in [jQuery.Drop].

                                    - */ - "dropmove", - /** - * @attribute dropend - * Called when the drag is done for this drop. - *

                                    Drop events are covered in more detail in [jQuery.Drop].

                                    - */ - "dropend"]; - - - - /** - * @class jQuery.Drop - * @parent specialevents - * @plugin jquery/event/drop - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/drop/drop.js - * @test jquery/event/drag/qunit.html - * - * Provides drop events as a special event to jQuery. - * By binding to a drop event, the your callback functions will be - * called during the corresponding phase of drag. - *

                                    Drop Events

                                    - * All drop events are called with the native event, an instance of drop, and the drag. Here are the available drop - * events: - *
                                      - *
                                    • dropinit - the drag motion is started, drop positions are calculated.
                                    • - *
                                    • dropover - a drag moves over a drop element, called once as the drop is dragged over the element.
                                    • - *
                                    • dropout - a drag moves out of the drop element.
                                    • - *
                                    • dropmove - a drag is moved over a drop element, called repeatedly as the element is moved.
                                    • - *
                                    • dropon - a drag is released over a drop element.
                                    • - *
                                    • dropend - the drag motion has completed.
                                    • - *
                                    - *

                                    Examples

                                    - * Here's how to listen for when a drag moves over a drop: - * @codestart - * $('.drop').live("dropover", function(ev, drop, drag){ - * $(this).addClass("drop-over") - * }) - * @codeend - * A bit more complex example: - * @demo jquery/event/drop/drop.html 1000 - * - * - * - * ## How it works - * - * 1. When you bind on a drop event, it adds that element to the list of rootElements. - * RootElements might be drop points, or might have delegated drop points in them. - * - * 2. When a drag motion is started, each rootElement is queried for the events listening on it. - * These events might be delegated events so we need to query for the drop elements. - * - * 3. With each drop element, we add a Drop object with all the callbacks for that element. - * Each element might have multiple event provided by different rootElements. We merge - * callbacks into the Drop object if there is an existing Drop object. - * - * 4. Once Drop objects have been added to all elements, we go through them and call draginit - * if available. - * - * - * @constructor - * The constructor is never called directly. - */ - $.Drop = function(callbacks, element){ - jQuery.extend(this,callbacks); - this.element = $(element); - } - // add the elements ... - $.each(eventNames, function(){ - event.special[this] = { - add: function( handleObj ) { - //add this element to the compiles list - var el = $(this), current = (el.data("dropEventCount") || 0); - el.data("dropEventCount", current+1 ) - if(current==0){ - $.Drop.addElement(this); - } - }, - remove: function() { - var el = $(this), current = (el.data("dropEventCount") || 0); - el.data("dropEventCount", current-1 ) - if(current<=1){ - $.Drop.removeElement(this); - } - } - } - }); - - $.extend($.Drop,{ - lowerName: "drop", - _rootElements: [], //elements that are listening for drops - _elements: $(), //elements that can be dropped on - last_active: [], - endName: "dropon", - // adds an element as a 'root' element - // this element might have events that we need to respond to - addElement: function( el ) { - //check other elements - for(var i =0; i < this._rootElements.length ; i++ ){ - if(el ==this._rootElements[i]) return; - } - this._rootElements.push(el); - }, - removeElement: function( el ) { - for(var i =0; i < this._rootElements.length ; i++ ){ - if(el == this._rootElements[i]){ - this._rootElements.splice(i,1) - return; - } - } - }, - /** - * @hide - * For a list of affected drops, sorts them by which is deepest in the DOM first. - */ - sortByDeepestChild: function( a, b ) { - var compare = a.element.compare(b.element); - if(compare & 16 || compare & 4) return 1; - if(compare & 8 || compare & 2) return -1; - return 0; - }, - /** - * @hide - * Tests if a drop is within the point. - */ - isAffected: function( point, moveable, responder ) { - return ((responder.element != moveable.element) && (responder.element.within(point[0], point[1], responder._cache).length == 1)); - }, - /** - * @hide - * Calls dropout and sets last active to null - * @param {Object} drop - * @param {Object} drag - * @param {Object} event - */ - deactivate: function( responder, mover, event ) { - mover.out(event, responder) - responder.callHandlers(this.lowerName+'out',responder.element[0], event, mover) - }, - /** - * @hide - * Calls dropover - * @param {Object} drop - * @param {Object} drag - * @param {Object} event - */ - activate: function( responder, mover, event ) { //this is where we should call over - mover.over(event, responder) - //this.last_active = responder; - responder.callHandlers(this.lowerName+'over',responder.element[0], event, mover); - }, - move: function( responder, mover, event ) { - responder.callHandlers(this.lowerName+'move',responder.element[0], event, mover) - }, - /** - * Gets all elements that are droppable and adds them to a list. - * - * This should be called if and when new drops are added to the page - * during the motion of a single drag. - * - * This is called by default when a drag motion starts. - * - * ## Use - * - * After adding an element or drop, call compile. - * - * $("#midpoint").bind("dropover",function(){ - * // when a drop hovers over midpoint, - * // make drop a drop. - * $("#drop").bind("dropover", function(){ - * - * }); - * $.Drop.compile(); - * }); - */ - compile: function( event, drag ) { - // if we called compile w/o a current drag - if(!this.dragging && !drag){ - return; - }else if(!this.dragging){ - this.dragging = drag; - this.last_active = []; - //this._elements = $(); - } - var el, - drops, - selector, - dropResponders, - newEls = [], - dragging = this.dragging; - - // go to each root element and look for drop elements - for(var i=0; i < this._rootElements.length; i++){ //for each element - el = this._rootElements[i] - - // gets something like {"": ["dropinit"], ".foo" : ["dropover","dropmove"] } - var drops = $.event.findBySelector(el, eventNames) - - // get drop elements by selector - for(selector in drops){ - - - dropResponders = selector ? jQuery(selector, el) : [el]; - - // for each drop element - for(var e= 0; e < dropResponders.length; e++){ - - // add the callbacks to the element's Data - // there already might be data, so we merge it - if( this.addCallbacks(dropResponders[e], drops[selector], dragging) ){ - newEls.push(dropResponders[e]) - }; - } - } - } - // once all callbacks are added, call init on everything ... - // todo ... init could be called more than once? - this.add(newEls, event, dragging) - }, - // adds the drag callbacks object to the element or merges other callbacks ... - // returns true or false if the element is new ... - // onlyNew lets only new elements add themselves - addCallbacks : function(el, callbacks, onlyNew){ - - var origData = $.data(el,"_dropData"); - if(!origData){ - $.data(el,"_dropData", new $.Drop(callbacks, el)); - //this._elements.push(el); - return true; - }else if(!onlyNew){ - var origCbs = origData; - // merge data - for(var eventName in callbacks){ - origCbs[eventName] = origCbs[eventName] ? - origCbs[eventName].concat(callbacks[eventName]) : - callbacks[eventName]; - } - return false; - } - }, - // calls init on each element's drags. - // if its cancelled it's removed - // adds to the current elements ... - add: function( newEls, event, drag , dragging) { - var i = 0, - drop; - - while(i < newEls.length){ - drop = $.data(newEls[i],"_dropData"); - drop.callHandlers(this.lowerName+'init', newEls[i], event, drag) - if(drop._canceled){ - newEls.splice(i,1) - }else{ - i++; - } - } - this._elements.push.apply(this._elements, newEls) - }, - show: function( point, moveable, event ) { - var element = moveable.element; - if(!this._elements.length) return; - - var respondable, - affected = [], - propagate = true, - i = 0, - j, - la, - toBeActivated, - aff, - oldLastActive = this.last_active, - responders = [], - self = this, - drag; - - //what's still affected ... we can also move element out here - while( i < this._elements.length){ - drag = $.data(this._elements[i],"_dropData"); - - if (!drag) { - this._elements.splice(i, 1) - } - else { - i++; - if (self.isAffected(point, moveable, drag)) { - affected.push(drag); - } - } - } - - - - affected.sort(this.sortByDeepestChild); //we should only trigger on lowest children - event.stopRespondPropagate = function(){ - propagate = false; - } - - toBeActivated = affected.slice(); - - // all these will be active - this.last_active = affected; - - //deactivate everything in last_active that isn't active - for (j = 0; j < oldLastActive.length; j++) { - la = oldLastActive[j]; - i = 0; - while((aff = toBeActivated[i])){ - if(la == aff){ - toBeActivated.splice(i,1);break; - }else{ - i++; - } - } - if(!aff){ - this.deactivate(la, moveable, event); - } - if(!propagate) return; - } - for(var i =0; i < toBeActivated.length; i++){ - this.activate(toBeActivated[i], moveable, event); - if(!propagate) return; - } - //activate everything in affected that isn't in last_active - - for (i = 0; i < affected.length; i++) { - this.move(affected[i], moveable, event); - - if(!propagate) return; - } - }, - end: function( event, moveable ) { - var responder, la, endName = this.lowerName+'end'; - for(var r =0; r"+ - "
                                    "+ - "
                                    "+ - "
                                    "+ - "
                                    "); - - div.appendTo($("#qunit-test-area")); - var basicCss = { - width: "20px", - height: "20px", - position: "absolute", - border: "solid 1px black" - } - $("#drag").css(basicCss).css({top: "0px", left: "0px", zIndex: 1000, backgroundColor: "red"}) - $("#midpoint").css(basicCss).css({top: "0px", left: "30px"}) - $("#drop").css(basicCss).css({top: "0px", left: "60px"}); - - $('#drag').bind("draginit", function(){}); - - $("#midpoint").bind("dropover",function(){ - ok(true, "midpoint called"); - - $("#drop").bind("dropover", function(){ - ok(true, "drop called"); - }); - $.Drop.compile(); - }); - stop(); - Syn.drag({to: "#drop"},"drag", function(){ - start(); - }); -}); - - - -}) diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/event.js b/labs/architecture-examples/javascriptmvc/jquery/event/event.js deleted file mode 100644 index c355532125..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/event.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @page specialevents Special Events - * @tag core - * JavaScriptMVC provides a bunch of useful special events. Find out more info on the left. The following is a - * brief summary: - * - * ## [jQuery.event.special.default Default Events] - * - * Lets you supply default behavior for an event that is preventable - * with event.preventDefault(). This is extremely useful for providing DOM-like api's for your widgets. - * - * $("#tabs").delegate(".panel","default.open", function(){ - * $(this).show() - * }) - * - * ## [jQuery.event.special.destroyed Destroyed Events] - * - * Know if an element has been removed from the page. - * - * $("#contextMenu").bind("destroyed", function(){ - * // cleanup - * $(document.body).unbind("click.contextMenu"); - * }) - * - * ## [jQuery.Drag Drag] and [jQuery.Drop Drop] Events - * - * Listen to drag-drop events with event delegation. - * - * $(".item").live("dragover", function(ev, drag){ - * // let user know that the item can be dropped - * $(this).addClass("canDrop"); - * }).live("dropover", function(ev, drop, drag){ - * // let user know that the item can be dropped on - * $(this).addClass('drop-able') - * }) - * - * ## - * - */ -steal.plugins('jquery'); \ No newline at end of file diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/handle/handle.js b/labs/architecture-examples/javascriptmvc/jquery/event/handle/handle.js deleted file mode 100644 index d4c2591e04..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/handle/handle.js +++ /dev/null @@ -1,85 +0,0 @@ -steal.plugins("jquery").then(function(){ - -var $event = $.event, - oldTrigger = $event.trigger; -// a copy of $'s handle function that goes until it finds -$.event.handle = function( event ) { - var args = $.makeArray( arguments ); - // Event object or event type - var type = event.type || event, - namespaces = [], - exclusive; - - if ( type.indexOf("!") >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - event.type = type; - event.exclusive = exclusive; - - - event = jQuery.event.fix( event || window.event ); - // Snapshot the handlers list since a called handler may add/remove events. - var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0), - run_all = !event.exclusive && !event.namespace, - args = Array.prototype.slice.call( arguments, 0 ); - - // Use the fix-ed Event rather than the (read-only) native event - args[0] = event; - event.currentTarget = this; - - // JMVC CHANGED - var oldType = type; - if (event.type !== "default" && $event.special['default']) { - $event.special['default'].triggerDefault(event, this); - } - event.type = oldType; - - for ( var j = 0, l = handlers.length; j < l; j++ ) { - var handleObj = handlers[ j ]; - if( event.firstPass ){ - event.firstPass = false; - continue; - } - - // Triggered event must 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event. - if ( run_all || event.namespace_re.test( handleObj.namespace ) ) { - // Pass in a reference to the handler function itself - // So that we can later remove it - event.handler = handleObj.handler; - event.data = handleObj.data; - event.handleObj = handleObj; - - var ret = handleObj.handler.apply( this, args ); - - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - - // JMVC CHANGED - if (event.type !== "default" && $event.special['default']) { - $event.special['default'].checkAndRunDefaults(event, this); - } - return event.result; -} -}) diff --git a/labs/architecture-examples/javascriptmvc/jquery/event/hashchange/hashchange.js b/labs/architecture-examples/javascriptmvc/jquery/event/hashchange/hashchange.js deleted file mode 100644 index fc01306cb2..0000000000 --- a/labs/architecture-examples/javascriptmvc/jquery/event/hashchange/hashchange.js +++ /dev/null @@ -1,245 +0,0 @@ -/*! - * jQuery hashchange event - v1.2 - 2/11/2010 - * http://benalman.com/projects/jquery-hashchange-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ - -// Script: jQuery hashchange event -// -// *Version: 1.2, Last updated: 2/11/2010* -// -// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/ -// GitHub - http://github.com/cowboy/jquery-hashchange/ -// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js -// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (1.1kb) -// -// About: License -// -// Copyright (c) 2010 "Cowboy" Ben Alman, -// Dual licensed under the MIT and GPL licenses. -// http://benalman.com/about/license/ -// -// About: Examples -// -// This working example, complete with fully commented code, illustrate one way -// in which this plugin can be used. -// -// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/ -// -// About: Support and Testing -// -// Information about what version or versions of jQuery this plugin has been -// tested with, what browsers it has been tested in, and where the unit tests -// reside (so you can test it yourself). -// -// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2 -// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.7, Safari 3-4, Chrome, Opera 9.6-10.1. -// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/ -// -// About: Known issues -// -// While this jQuery hashchange event implementation is quite stable and robust, -// there are a few unfortunate browser bugs surrounding expected hashchange -// event-based behaviors, independent of any JavaScript window.onhashchange -// abstraction. See the following examples for more information: -// -// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/ -// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/ -// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/ -// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/ -// -// About: Release History -// -// 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin -// from a page on another domain would cause an error in Safari 4. Also, -// IE6/7 Iframe is now inserted after the body (this actually works), -// which prevents the page from scrolling when the event is first bound. -// Event can also now be bound before DOM ready, but it won't be usable -// before then in IE6/7. -// 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug -// where browser version is incorrectly reported as 8.0, despite -// inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag. -// 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special -// window.onhashchange functionality into a separate plugin for users -// who want just the basic event & back button support, without all the -// extra awesomeness that BBQ provides. This plugin will be included as -// part of jQuery BBQ, but also be available separately. - -(function($,window,undefined){ - '$:nomunge'; // Used by YUI compressor. - - // Method / object references. - var fake_onhashchange, - jq_event_special = $.event.special, - - // Reused strings. - str_location = 'location', - str_hashchange = 'hashchange', - str_href = 'href', - - // IE6/7 specifically need some special love when it comes to back-button - // support, so let's do a little browser sniffing.. - browser = $.browser, - mode = document.documentMode, - is_old_ie = browser.msie && ( mode === undefined || mode < 8 ), - - // Does the browser support window.onhashchange? Test for IE version, since - // IE8 incorrectly reports this when in "IE7" or "IE8 Compatibility View"! - supports_onhashchange = 'on' + str_hashchange in window && !is_old_ie; - - // Get location.hash (or what you'd expect location.hash to be) sans any - // leading #. Thanks for making this necessary, Firefox! - function get_fragment( url ) { - url = url || window[ str_location ][ str_href ]; - return url.replace( /^[^#]*#?(.*)$/, '$1' ); - }; - - // Property: jQuery.hashchangeDelay - // - // The numeric interval (in milliseconds) at which the - // polling loop executes. Defaults to 100. - - $[ str_hashchange + 'Delay' ] = 100; - - // Event: hashchange event - // - // Fired when location.hash changes. In browsers that support it, the native - // window.onhashchange event is used (IE8, FF3.6), otherwise a polling loop is - // initialized, running every milliseconds to see if - // the hash has changed. In IE 6 and 7, a hidden Iframe is created to allow - // the back button and hash-based history to work. - // - // Usage: - // - // > $(window).bind( 'hashchange', function(e) { - // > var hash = location.hash; - // > ... - // > }); - // - // Additional Notes: - // - // * The polling loop and Iframe are not created until at least one callback - // is actually bound to 'hashchange'. - // * If you need the bound callback(s) to execute immediately, in cases where - // the page 'state' exists on page load (via bookmark or page refresh, for - // example) use $(window).trigger( 'hashchange' ); - // * The event can be bound before DOM ready, but since it won't be usable - // before then in IE6/7 (due to the necessary Iframe), recommended usage is - // to bind it inside a $(document).ready() callback. - - jq_event_special[ str_hashchange ] = $.extend( jq_event_special[ str_hashchange ], { - - // Called only when the first 'hashchange' event is bound to window. - setup: function() { - // If window.onhashchange is supported natively, there's nothing to do.. - if ( supports_onhashchange ) { return false; } - - // Otherwise, we need to create our own. And we don't want to call this - // until the user binds to the event, just in case they never do, since it - // will create a polling loop and possibly even a hidden Iframe. - $( fake_onhashchange.start ); - }, - - // Called only when the last 'hashchange' event is unbound from window. - teardown: function() { - // If window.onhashchange is supported natively, there's nothing to do.. - if ( supports_onhashchange ) { return false; } - - // Otherwise, we need to stop ours (if possible). - $( fake_onhashchange.stop ); - } - - }); - - // fake_onhashchange does all the work of triggering the window.onhashchange - // event for browsers that don't natively support it, including creating a - // polling loop to watch for hash changes and in IE 6/7 creating a hidden - // Iframe to enable back and forward. - fake_onhashchange = (function(){ - var self = {}, - timeout_id, - iframe, - set_history, - get_history; - - // Initialize. In IE 6/7, creates a hidden Iframe for history handling. - function init(){ - // Most browsers don't need special methods here.. - set_history = get_history = function(val){ return val; }; - - // But IE6/7 do! - if ( is_old_ie ) { - - // Create hidden Iframe after the end of the body to prevent initial - // page load from scrolling unnecessarily. - iframe = $('