lady_josephine 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +32 -0
- data/app/assets/fonts/lady_josephine/icons/icons.eot +0 -0
- data/app/assets/fonts/lady_josephine/icons/icons.svg +215 -0
- data/app/assets/fonts/lady_josephine/icons/icons.ttf +0 -0
- data/app/assets/fonts/lady_josephine/icons/icons.woff +0 -0
- data/app/assets/javascripts/lady_josephine/blocks/facebook.js +25 -0
- data/app/assets/javascripts/lady_josephine/blocks/instagram.js +22 -0
- data/app/assets/javascripts/lady_josephine/blocks/soundcloud.js +24 -0
- data/app/assets/javascripts/lady_josephine/blocks/twitter.js +25 -0
- data/app/assets/javascripts/lady_josephine/blocks/vimeo.js +55 -0
- data/app/assets/javascripts/lady_josephine/blocks/youtube.js +64 -0
- data/app/assets/javascripts/lady_josephine/editor.js +40 -0
- data/app/assets/javascripts/lady_josephine/lady_josephine.js +4 -0
- data/app/assets/javascripts/lady_josephine/lady_josephine_view.js +6 -0
- data/app/assets/stylesheets/lady_josephine/content.sass +33 -0
- data/app/assets/stylesheets/lady_josephine/icons.sass +175 -0
- data/app/assets/stylesheets/lady_josephine/lady_josephine.sass +6 -0
- data/app/assets/stylesheets/lady_josephine/sir_trevor.sass +619 -0
- data/app/assets/stylesheets/lady_josephine/vars.sass +36 -0
- data/app/controllers/lady_josephine/application_controller.rb +4 -0
- data/app/controllers/lady_josephine/editor_controller.rb +40 -0
- data/app/controllers/lady_josephine/images_controller.rb +26 -0
- data/app/helpers/lady_josephine/helper.rb +25 -0
- data/app/helpers/lady_josephine/sir_trevor_helper.rb +172 -0
- data/app/models/lady_josephine/concerns/model.rb +29 -0
- data/app/models/lady_josephine/concerns/pingable.rb +28 -0
- data/app/models/lady_josephine/concerns/server_uuid.rb +24 -0
- data/app/models/lady_josephine/concerns/sir_trevor_images.rb +38 -0
- data/app/models/lady_josephine/image.rb +41 -0
- data/app/uploader/lady_josephine/base_uploader.rb +47 -0
- data/app/uploader/lady_josephine/image_uploader.rb +149 -0
- data/app/views/lady_josephine/blocks/_audio_block.haml +2 -0
- data/app/views/lady_josephine/blocks/_definition_block.haml +4 -0
- data/app/views/lady_josephine/blocks/_divider_block.haml +2 -0
- data/app/views/lady_josephine/blocks/_extended_image_block.haml +63 -0
- data/app/views/lady_josephine/blocks/_extended_quote_block.haml +5 -0
- data/app/views/lady_josephine/blocks/_extended_tweet_block.haml +2 -0
- data/app/views/lady_josephine/blocks/_facebook_post_block.haml +2 -0
- data/app/views/lady_josephine/blocks/_heading_block.haml +2 -0
- data/app/views/lady_josephine/blocks/_html_block.haml +1 -0
- data/app/views/lady_josephine/blocks/_instagram_block.haml +2 -0
- data/app/views/lady_josephine/blocks/_list_block.haml +3 -0
- data/app/views/lady_josephine/blocks/_quote_block.haml +5 -0
- data/app/views/lady_josephine/blocks/_text_block.html.haml +2 -0
- data/app/views/lady_josephine/blocks/_video_block.haml +9 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20160222151500_lady_josephine_image.rb +18 -0
- data/lib/generators/lady_josephine_migration/USAGE +9 -0
- data/lib/generators/lady_josephine_migration/lady_josephine_migration_generator.rb +17 -0
- data/lib/generators/lady_josephine_migration/templates/migration.rb +9 -0
- data/lib/lady_josephine.rb +18 -0
- data/lib/lady_josephine/engine.rb +18 -0
- data/lib/lady_josephine/redcarpet/custom_markdown_formatter.rb +63 -0
- data/lib/lady_josephine/renderer/sir_trevor_renderer.rb +16 -0
- data/lib/lady_josephine/version.rb +3 -0
- data/lib/lady_josephine/whitelist.rb +26 -0
- data/lib/tasks/lady_josephine_tasks.rake +4 -0
- data/spec/controllers/lady_josephine/editor_controller_spec.rb +58 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +26 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +16 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/bla +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/spec_helper.rb +17 -0
- data/vendor/assets/components/Eventable/README.md +12 -0
- data/vendor/assets/components/Eventable/bower.json +10 -0
- data/vendor/assets/components/Eventable/component.json +11 -0
- data/vendor/assets/components/Eventable/eventable.js +207 -0
- data/vendor/assets/components/Eventable/package.json +15 -0
- data/vendor/assets/components/jquery-autosize/bower.json +30 -0
- data/vendor/assets/components/jquery-autosize/demo.html +36 -0
- data/vendor/assets/components/jquery-autosize/jquery.autosize.js +273 -0
- data/vendor/assets/components/jquery-autosize/jquery.autosize.min.js +6 -0
- data/vendor/assets/components/jquery-autosize/package.json +32 -0
- data/vendor/assets/components/jquery-autosize/readme.md +216 -0
- data/vendor/assets/components/jquery/AUTHORS.txt +163 -0
- data/vendor/assets/components/jquery/CONTRIBUTING.md +216 -0
- data/vendor/assets/components/jquery/Gruntfile.js +496 -0
- data/vendor/assets/components/jquery/MIT-LICENSE.txt +21 -0
- data/vendor/assets/components/jquery/README.md +415 -0
- data/vendor/assets/components/jquery/build/release-notes.js +59 -0
- data/vendor/assets/components/jquery/build/release.js +246 -0
- data/vendor/assets/components/jquery/component.json +13 -0
- data/vendor/assets/components/jquery/composer.json +35 -0
- data/vendor/assets/components/jquery/jquery-migrate.js +496 -0
- data/vendor/assets/components/jquery/jquery-migrate.min.js +3 -0
- data/vendor/assets/components/jquery/jquery.js +9597 -0
- data/vendor/assets/components/jquery/jquery.min.js +5 -0
- data/vendor/assets/components/jquery/jquery.min.map +1 -0
- data/vendor/assets/components/jquery/package.json +39 -0
- data/vendor/assets/components/jquery/speed/benchmark.js +15 -0
- data/vendor/assets/components/jquery/speed/benchmarker.css +65 -0
- data/vendor/assets/components/jquery/speed/benchmarker.js +181 -0
- data/vendor/assets/components/jquery/speed/closest.html +39 -0
- data/vendor/assets/components/jquery/speed/css.html +82 -0
- data/vendor/assets/components/jquery/speed/event.html +58 -0
- data/vendor/assets/components/jquery/speed/filter.html +183 -0
- data/vendor/assets/components/jquery/speed/find.html +179 -0
- data/vendor/assets/components/jquery/speed/index.html +72 -0
- data/vendor/assets/components/jquery/speed/jquery-basis.js +6238 -0
- data/vendor/assets/components/jquery/speed/slice.vs.concat.html +47 -0
- data/vendor/assets/components/jquery/src/ajax.js +851 -0
- data/vendor/assets/components/jquery/src/ajax/jsonp.js +80 -0
- data/vendor/assets/components/jquery/src/ajax/script.js +86 -0
- data/vendor/assets/components/jquery/src/ajax/xhr.js +207 -0
- data/vendor/assets/components/jquery/src/attributes.js +661 -0
- data/vendor/assets/components/jquery/src/callbacks.js +196 -0
- data/vendor/assets/components/jquery/src/core.js +949 -0
- data/vendor/assets/components/jquery/src/css.js +679 -0
- data/vendor/assets/components/jquery/src/data.js +340 -0
- data/vendor/assets/components/jquery/src/deferred.js +141 -0
- data/vendor/assets/components/jquery/src/deprecated.js +4 -0
- data/vendor/assets/components/jquery/src/dimensions.js +41 -0
- data/vendor/assets/components/jquery/src/effects.js +730 -0
- data/vendor/assets/components/jquery/src/event-alias.js +15 -0
- data/vendor/assets/components/jquery/src/event.js +991 -0
- data/vendor/assets/components/jquery/src/exports.js +18 -0
- data/vendor/assets/components/jquery/src/intro.js +20 -0
- data/vendor/assets/components/jquery/src/manipulation.js +796 -0
- data/vendor/assets/components/jquery/src/offset.js +169 -0
- data/vendor/assets/components/jquery/src/outro.js +2 -0
- data/vendor/assets/components/jquery/src/queue.js +147 -0
- data/vendor/assets/components/jquery/src/serialize.js +99 -0
- data/vendor/assets/components/jquery/src/sizzle-jquery.js +9 -0
- data/vendor/assets/components/jquery/src/support.js +241 -0
- data/vendor/assets/components/jquery/src/traversing.js +275 -0
- data/vendor/assets/components/jquery/test/csp.php +16 -0
- data/vendor/assets/components/jquery/test/data/1x1.jpg +0 -0
- data/vendor/assets/components/jquery/test/data/ajax/unreleasedXHR.html +25 -0
- data/vendor/assets/components/jquery/test/data/atom+xml.php +4 -0
- data/vendor/assets/components/jquery/test/data/badcall.js +1 -0
- data/vendor/assets/components/jquery/test/data/badjson.js +1 -0
- data/vendor/assets/components/jquery/test/data/cleanScript.html +10 -0
- data/vendor/assets/components/jquery/test/data/core/cc_on.html +22 -0
- data/vendor/assets/components/jquery/test/data/dashboard.xml +11 -0
- data/vendor/assets/components/jquery/test/data/dimensions/documentLarge.html +17 -0
- data/vendor/assets/components/jquery/test/data/dimensions/documentSmall.html +21 -0
- data/vendor/assets/components/jquery/test/data/echoData.php +1 -0
- data/vendor/assets/components/jquery/test/data/echoQuery.php +1 -0
- data/vendor/assets/components/jquery/test/data/errorWithText.php +5 -0
- data/vendor/assets/components/jquery/test/data/etag.php +21 -0
- data/vendor/assets/components/jquery/test/data/evalScript.php +1 -0
- data/vendor/assets/components/jquery/test/data/event/longLoadScript.php +4 -0
- data/vendor/assets/components/jquery/test/data/event/promiseReady.html +17 -0
- data/vendor/assets/components/jquery/test/data/event/syncReady.html +23 -0
- data/vendor/assets/components/jquery/test/data/headers.php +18 -0
- data/vendor/assets/components/jquery/test/data/if_modified_since.php +20 -0
- data/vendor/assets/components/jquery/test/data/iframe.html +8 -0
- data/vendor/assets/components/jquery/test/data/jquery-1.8.2.ajax_xhr.min.js +2 -0
- data/vendor/assets/components/jquery/test/data/json.php +13 -0
- data/vendor/assets/components/jquery/test/data/json_obj.js +1 -0
- data/vendor/assets/components/jquery/test/data/jsonp.php +14 -0
- data/vendor/assets/components/jquery/test/data/manipulation/iframe-denied.html +36 -0
- data/vendor/assets/components/jquery/test/data/name.html +1 -0
- data/vendor/assets/components/jquery/test/data/name.php +24 -0
- data/vendor/assets/components/jquery/test/data/nocontent.php +5 -0
- data/vendor/assets/components/jquery/test/data/offset/absolute.html +41 -0
- data/vendor/assets/components/jquery/test/data/offset/body.html +26 -0
- data/vendor/assets/components/jquery/test/data/offset/fixed.html +34 -0
- data/vendor/assets/components/jquery/test/data/offset/relative.html +31 -0
- data/vendor/assets/components/jquery/test/data/offset/scroll.html +39 -0
- data/vendor/assets/components/jquery/test/data/offset/static.html +31 -0
- data/vendor/assets/components/jquery/test/data/offset/table.html +43 -0
- data/vendor/assets/components/jquery/test/data/params_html.php +12 -0
- data/vendor/assets/components/jquery/test/data/readywaitasset.js +1 -0
- data/vendor/assets/components/jquery/test/data/readywaitloader.js +25 -0
- data/vendor/assets/components/jquery/test/data/script.php +11 -0
- data/vendor/assets/components/jquery/test/data/selector/html5_selector.html +114 -0
- data/vendor/assets/components/jquery/test/data/selector/sizzle_cache.html +21 -0
- data/vendor/assets/components/jquery/test/data/statusText.php +5 -0
- data/vendor/assets/components/jquery/test/data/support/bodyBackground.html +28 -0
- data/vendor/assets/components/jquery/test/data/support/shrinkWrapBlocks.html +23 -0
- data/vendor/assets/components/jquery/test/data/support/testElementCrash.html +17 -0
- data/vendor/assets/components/jquery/test/data/test.html +7 -0
- data/vendor/assets/components/jquery/test/data/test.js +3 -0
- data/vendor/assets/components/jquery/test/data/test.php +7 -0
- data/vendor/assets/components/jquery/test/data/test2.html +5 -0
- data/vendor/assets/components/jquery/test/data/test3.html +3 -0
- data/vendor/assets/components/jquery/test/data/testinit.js +269 -0
- data/vendor/assets/components/jquery/test/data/testrunner.js +368 -0
- data/vendor/assets/components/jquery/test/data/testsuite.css +155 -0
- data/vendor/assets/components/jquery/test/data/text.php +12 -0
- data/vendor/assets/components/jquery/test/data/ua.txt +272 -0
- data/vendor/assets/components/jquery/test/data/with_fries.xml +25 -0
- data/vendor/assets/components/jquery/test/data/with_fries_over_jsonp.php +7 -0
- data/vendor/assets/components/jquery/test/delegatetest.html +228 -0
- data/vendor/assets/components/jquery/test/hovertest.html +158 -0
- data/vendor/assets/components/jquery/test/index.html +330 -0
- data/vendor/assets/components/jquery/test/localfile.html +75 -0
- data/vendor/assets/components/jquery/test/networkerror.html +84 -0
- data/vendor/assets/components/jquery/test/polluted.php +110 -0
- data/vendor/assets/components/jquery/test/readywait.html +70 -0
- data/vendor/assets/components/jquery/test/unit/ajax.js +1971 -0
- data/vendor/assets/components/jquery/test/unit/attributes.js +1332 -0
- data/vendor/assets/components/jquery/test/unit/callbacks.js +326 -0
- data/vendor/assets/components/jquery/test/unit/core.js +1332 -0
- data/vendor/assets/components/jquery/test/unit/css.js +1036 -0
- data/vendor/assets/components/jquery/test/unit/data.js +636 -0
- data/vendor/assets/components/jquery/test/unit/deferred.js +440 -0
- data/vendor/assets/components/jquery/test/unit/deprecated.js +1 -0
- data/vendor/assets/components/jquery/test/unit/dimensions.js +461 -0
- data/vendor/assets/components/jquery/test/unit/effects.js +2050 -0
- data/vendor/assets/components/jquery/test/unit/event.js +2690 -0
- data/vendor/assets/components/jquery/test/unit/exports.js +7 -0
- data/vendor/assets/components/jquery/test/unit/manipulation.js +2242 -0
- data/vendor/assets/components/jquery/test/unit/offset.js +549 -0
- data/vendor/assets/components/jquery/test/unit/queue.js +316 -0
- data/vendor/assets/components/jquery/test/unit/selector.js +185 -0
- data/vendor/assets/components/jquery/test/unit/serialize.js +146 -0
- data/vendor/assets/components/jquery/test/unit/support.js +384 -0
- data/vendor/assets/components/jquery/test/unit/traversing.js +667 -0
- data/vendor/assets/components/jquery/test/xhtml.php +5 -0
- data/vendor/assets/components/sir-trevor-js/CHANGELOG.md +44 -0
- data/vendor/assets/components/sir-trevor-js/Gemfile +3 -0
- data/vendor/assets/components/sir-trevor-js/Gemfile.lock +10 -0
- data/vendor/assets/components/sir-trevor-js/Gruntfile.js +109 -0
- data/vendor/assets/components/sir-trevor-js/MIT-LICENCE +20 -0
- data/vendor/assets/components/sir-trevor-js/Readme.md +84 -0
- data/vendor/assets/components/sir-trevor-js/bower.json +21 -0
- data/vendor/assets/components/sir-trevor-js/component.json +42 -0
- data/vendor/assets/components/sir-trevor-js/contributing.md +74 -0
- data/vendor/assets/components/sir-trevor-js/examples-component/component.json +14 -0
- data/vendor/assets/components/sir-trevor-js/examples-component/index.html +33 -0
- data/vendor/assets/components/sir-trevor-js/examples-component/index.js +29 -0
- data/vendor/assets/components/sir-trevor-js/examples-component/javascript/example_block.js +203 -0
- data/vendor/assets/components/sir-trevor-js/examples-component/javascript/limit_chars.js +46 -0
- data/vendor/assets/components/sir-trevor-js/examples-component/sir-trevor.gif +0 -0
- data/vendor/assets/components/sir-trevor-js/locales/cn.js +51 -0
- data/vendor/assets/components/sir-trevor-js/locales/de.js +51 -0
- data/vendor/assets/components/sir-trevor-js/locales/es.js +51 -0
- data/vendor/assets/components/sir-trevor-js/locales/fi.js +51 -0
- data/vendor/assets/components/sir-trevor-js/locales/fr.js +51 -0
- data/vendor/assets/components/sir-trevor-js/locales/pt.js +52 -0
- data/vendor/assets/components/sir-trevor-js/package.json +23 -0
- data/vendor/assets/components/sir-trevor-js/sir-trevor-icons.css +6 -0
- data/vendor/assets/components/sir-trevor-js/sir-trevor.css +393 -0
- data/vendor/assets/components/sir-trevor-js/sir-trevor.css.map +7 -0
- data/vendor/assets/components/sir-trevor-js/sir-trevor.js +5481 -0
- data/vendor/assets/components/sir-trevor-js/sir-trevor.min.js +13 -0
- data/vendor/assets/components/underscore/CNAME +1 -0
- data/vendor/assets/components/underscore/CONTRIBUTING.md +9 -0
- data/vendor/assets/components/underscore/LICENSE +22 -0
- data/vendor/assets/components/underscore/README.md +19 -0
- data/vendor/assets/components/underscore/Rakefile +10 -0
- data/vendor/assets/components/underscore/docs/docco.css +192 -0
- data/vendor/assets/components/underscore/docs/favicon.ico +0 -0
- data/vendor/assets/components/underscore/docs/images/background.png +0 -0
- data/vendor/assets/components/underscore/docs/images/underscore.png +0 -0
- data/vendor/assets/components/underscore/docs/underscore.html +823 -0
- data/vendor/assets/components/underscore/favicon.ico +0 -0
- data/vendor/assets/components/underscore/index.html +2467 -0
- data/vendor/assets/components/underscore/index.js +1 -0
- data/vendor/assets/components/underscore/package.json +16 -0
- data/vendor/assets/components/underscore/test/arrays.js +200 -0
- data/vendor/assets/components/underscore/test/chaining.js +59 -0
- data/vendor/assets/components/underscore/test/collections.js +453 -0
- data/vendor/assets/components/underscore/test/functions.js +265 -0
- data/vendor/assets/components/underscore/test/index.html +44 -0
- data/vendor/assets/components/underscore/test/objects.js +570 -0
- data/vendor/assets/components/underscore/test/speed.js +75 -0
- data/vendor/assets/components/underscore/test/utility.js +266 -0
- data/vendor/assets/components/underscore/test/vendor/jquery.js +9404 -0
- data/vendor/assets/components/underscore/test/vendor/jslitmus.js +670 -0
- data/vendor/assets/components/underscore/test/vendor/qunit.css +235 -0
- data/vendor/assets/components/underscore/test/vendor/qunit.js +1977 -0
- data/vendor/assets/components/underscore/test/vendor/runner.js +98 -0
- data/vendor/assets/components/underscore/underscore-min.js +1 -0
- data/vendor/assets/components/underscore/underscore.js +1226 -0
- metadata +473 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
var oldCallbacks = [],
|
2
|
+
rjsonp = /(=)\?(?=&|$)|\?\?/;
|
3
|
+
|
4
|
+
// Default jsonp settings
|
5
|
+
jQuery.ajaxSetup({
|
6
|
+
jsonp: "callback",
|
7
|
+
jsonpCallback: function() {
|
8
|
+
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
|
9
|
+
this[ callback ] = true;
|
10
|
+
return callback;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
// Detect, normalize options and install callbacks for jsonp requests
|
15
|
+
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
|
16
|
+
|
17
|
+
var callbackName, overwritten, responseContainer,
|
18
|
+
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
|
19
|
+
"url" :
|
20
|
+
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
|
21
|
+
);
|
22
|
+
|
23
|
+
// Handle iff the expected data type is "jsonp" or we have a parameter to set
|
24
|
+
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
|
25
|
+
|
26
|
+
// Get callback name, remembering preexisting value associated with it
|
27
|
+
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
|
28
|
+
s.jsonpCallback() :
|
29
|
+
s.jsonpCallback;
|
30
|
+
|
31
|
+
// Insert callback into url or form data
|
32
|
+
if ( jsonProp ) {
|
33
|
+
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
|
34
|
+
} else if ( s.jsonp !== false ) {
|
35
|
+
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Use data converter to retrieve json after script execution
|
39
|
+
s.converters["script json"] = function() {
|
40
|
+
if ( !responseContainer ) {
|
41
|
+
jQuery.error( callbackName + " was not called" );
|
42
|
+
}
|
43
|
+
return responseContainer[ 0 ];
|
44
|
+
};
|
45
|
+
|
46
|
+
// force json dataType
|
47
|
+
s.dataTypes[ 0 ] = "json";
|
48
|
+
|
49
|
+
// Install callback
|
50
|
+
overwritten = window[ callbackName ];
|
51
|
+
window[ callbackName ] = function() {
|
52
|
+
responseContainer = arguments;
|
53
|
+
};
|
54
|
+
|
55
|
+
// Clean-up function (fires after converters)
|
56
|
+
jqXHR.always(function() {
|
57
|
+
// Restore preexisting value
|
58
|
+
window[ callbackName ] = overwritten;
|
59
|
+
|
60
|
+
// Save back as free
|
61
|
+
if ( s[ callbackName ] ) {
|
62
|
+
// make sure that re-using the options doesn't screw things around
|
63
|
+
s.jsonpCallback = originalSettings.jsonpCallback;
|
64
|
+
|
65
|
+
// save the callback name for future use
|
66
|
+
oldCallbacks.push( callbackName );
|
67
|
+
}
|
68
|
+
|
69
|
+
// Call if it was a function and we have a response
|
70
|
+
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
|
71
|
+
overwritten( responseContainer[ 0 ] );
|
72
|
+
}
|
73
|
+
|
74
|
+
responseContainer = overwritten = undefined;
|
75
|
+
});
|
76
|
+
|
77
|
+
// Delegate to script
|
78
|
+
return "script";
|
79
|
+
}
|
80
|
+
});
|
@@ -0,0 +1,86 @@
|
|
1
|
+
// Install script dataType
|
2
|
+
jQuery.ajaxSetup({
|
3
|
+
accepts: {
|
4
|
+
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
|
5
|
+
},
|
6
|
+
contents: {
|
7
|
+
script: /(?:java|ecma)script/
|
8
|
+
},
|
9
|
+
converters: {
|
10
|
+
"text script": function( text ) {
|
11
|
+
jQuery.globalEval( text );
|
12
|
+
return text;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
});
|
16
|
+
|
17
|
+
// Handle cache's special case and global
|
18
|
+
jQuery.ajaxPrefilter( "script", function( s ) {
|
19
|
+
if ( s.cache === undefined ) {
|
20
|
+
s.cache = false;
|
21
|
+
}
|
22
|
+
if ( s.crossDomain ) {
|
23
|
+
s.type = "GET";
|
24
|
+
s.global = false;
|
25
|
+
}
|
26
|
+
});
|
27
|
+
|
28
|
+
// Bind script tag hack transport
|
29
|
+
jQuery.ajaxTransport( "script", function(s) {
|
30
|
+
|
31
|
+
// This transport only deals with cross domain requests
|
32
|
+
if ( s.crossDomain ) {
|
33
|
+
|
34
|
+
var script,
|
35
|
+
head = document.head || jQuery("head")[0] || document.documentElement;
|
36
|
+
|
37
|
+
return {
|
38
|
+
|
39
|
+
send: function( _, callback ) {
|
40
|
+
|
41
|
+
script = document.createElement("script");
|
42
|
+
|
43
|
+
script.async = true;
|
44
|
+
|
45
|
+
if ( s.scriptCharset ) {
|
46
|
+
script.charset = s.scriptCharset;
|
47
|
+
}
|
48
|
+
|
49
|
+
script.src = s.url;
|
50
|
+
|
51
|
+
// Attach handlers for all browsers
|
52
|
+
script.onload = script.onreadystatechange = function( _, isAbort ) {
|
53
|
+
|
54
|
+
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
|
55
|
+
|
56
|
+
// Handle memory leak in IE
|
57
|
+
script.onload = script.onreadystatechange = null;
|
58
|
+
|
59
|
+
// Remove the script
|
60
|
+
if ( script.parentNode ) {
|
61
|
+
script.parentNode.removeChild( script );
|
62
|
+
}
|
63
|
+
|
64
|
+
// Dereference the script
|
65
|
+
script = null;
|
66
|
+
|
67
|
+
// Callback if not abort
|
68
|
+
if ( !isAbort ) {
|
69
|
+
callback( 200, "success" );
|
70
|
+
}
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
|
75
|
+
// Use native DOM manipulation to avoid our domManip AJAX trickery
|
76
|
+
head.insertBefore( script, head.firstChild );
|
77
|
+
},
|
78
|
+
|
79
|
+
abort: function() {
|
80
|
+
if ( script ) {
|
81
|
+
script.onload( undefined, true );
|
82
|
+
}
|
83
|
+
}
|
84
|
+
};
|
85
|
+
}
|
86
|
+
});
|
@@ -0,0 +1,207 @@
|
|
1
|
+
var xhrCallbacks, xhrSupported,
|
2
|
+
xhrId = 0,
|
3
|
+
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
|
4
|
+
xhrOnUnloadAbort = window.ActiveXObject && function() {
|
5
|
+
// Abort all pending requests
|
6
|
+
var key;
|
7
|
+
for ( key in xhrCallbacks ) {
|
8
|
+
xhrCallbacks[ key ]( undefined, true );
|
9
|
+
}
|
10
|
+
};
|
11
|
+
|
12
|
+
// Functions to create xhrs
|
13
|
+
function createStandardXHR() {
|
14
|
+
try {
|
15
|
+
return new window.XMLHttpRequest();
|
16
|
+
} catch( e ) {}
|
17
|
+
}
|
18
|
+
|
19
|
+
function createActiveXHR() {
|
20
|
+
try {
|
21
|
+
return new window.ActiveXObject("Microsoft.XMLHTTP");
|
22
|
+
} catch( e ) {}
|
23
|
+
}
|
24
|
+
|
25
|
+
// Create the request object
|
26
|
+
// (This is still attached to ajaxSettings for backward compatibility)
|
27
|
+
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
|
28
|
+
/* Microsoft failed to properly
|
29
|
+
* implement the XMLHttpRequest in IE7 (can't request local files),
|
30
|
+
* so we use the ActiveXObject when it is available
|
31
|
+
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
|
32
|
+
* we need a fallback.
|
33
|
+
*/
|
34
|
+
function() {
|
35
|
+
return !this.isLocal && createStandardXHR() || createActiveXHR();
|
36
|
+
} :
|
37
|
+
// For all other browsers, use the standard XMLHttpRequest object
|
38
|
+
createStandardXHR;
|
39
|
+
|
40
|
+
// Determine support properties
|
41
|
+
xhrSupported = jQuery.ajaxSettings.xhr();
|
42
|
+
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
43
|
+
xhrSupported = jQuery.support.ajax = !!xhrSupported;
|
44
|
+
|
45
|
+
// Create transport if the browser can provide an xhr
|
46
|
+
if ( xhrSupported ) {
|
47
|
+
|
48
|
+
jQuery.ajaxTransport(function( s ) {
|
49
|
+
// Cross domain only allowed if supported through XMLHttpRequest
|
50
|
+
if ( !s.crossDomain || jQuery.support.cors ) {
|
51
|
+
|
52
|
+
var callback;
|
53
|
+
|
54
|
+
return {
|
55
|
+
send: function( headers, complete ) {
|
56
|
+
|
57
|
+
// Get a new xhr
|
58
|
+
var handle, i,
|
59
|
+
xhr = s.xhr();
|
60
|
+
|
61
|
+
// Open the socket
|
62
|
+
// Passing null username, generates a login popup on Opera (#2865)
|
63
|
+
if ( s.username ) {
|
64
|
+
xhr.open( s.type, s.url, s.async, s.username, s.password );
|
65
|
+
} else {
|
66
|
+
xhr.open( s.type, s.url, s.async );
|
67
|
+
}
|
68
|
+
|
69
|
+
// Apply custom fields if provided
|
70
|
+
if ( s.xhrFields ) {
|
71
|
+
for ( i in s.xhrFields ) {
|
72
|
+
xhr[ i ] = s.xhrFields[ i ];
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
// Override mime type if needed
|
77
|
+
if ( s.mimeType && xhr.overrideMimeType ) {
|
78
|
+
xhr.overrideMimeType( s.mimeType );
|
79
|
+
}
|
80
|
+
|
81
|
+
// X-Requested-With header
|
82
|
+
// For cross-domain requests, seeing as conditions for a preflight are
|
83
|
+
// akin to a jigsaw puzzle, we simply never set it to be sure.
|
84
|
+
// (it can always be set on a per-request basis or even using ajaxSetup)
|
85
|
+
// For same-domain requests, won't change header if already provided.
|
86
|
+
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
|
87
|
+
headers["X-Requested-With"] = "XMLHttpRequest";
|
88
|
+
}
|
89
|
+
|
90
|
+
// Need an extra try/catch for cross domain requests in Firefox 3
|
91
|
+
try {
|
92
|
+
for ( i in headers ) {
|
93
|
+
xhr.setRequestHeader( i, headers[ i ] );
|
94
|
+
}
|
95
|
+
} catch( err ) {}
|
96
|
+
|
97
|
+
// Do send the request
|
98
|
+
// This may raise an exception which is actually
|
99
|
+
// handled in jQuery.ajax (so no try/catch here)
|
100
|
+
xhr.send( ( s.hasContent && s.data ) || null );
|
101
|
+
|
102
|
+
// Listener
|
103
|
+
callback = function( _, isAbort ) {
|
104
|
+
var status, responseHeaders, statusText, responses;
|
105
|
+
|
106
|
+
// Firefox throws exceptions when accessing properties
|
107
|
+
// of an xhr when a network error occurred
|
108
|
+
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
|
109
|
+
try {
|
110
|
+
|
111
|
+
// Was never called and is aborted or complete
|
112
|
+
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
|
113
|
+
|
114
|
+
// Only called once
|
115
|
+
callback = undefined;
|
116
|
+
|
117
|
+
// Do not keep as active anymore
|
118
|
+
if ( handle ) {
|
119
|
+
xhr.onreadystatechange = jQuery.noop;
|
120
|
+
if ( xhrOnUnloadAbort ) {
|
121
|
+
delete xhrCallbacks[ handle ];
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
// If it's an abort
|
126
|
+
if ( isAbort ) {
|
127
|
+
// Abort it manually if needed
|
128
|
+
if ( xhr.readyState !== 4 ) {
|
129
|
+
xhr.abort();
|
130
|
+
}
|
131
|
+
} else {
|
132
|
+
responses = {};
|
133
|
+
status = xhr.status;
|
134
|
+
responseHeaders = xhr.getAllResponseHeaders();
|
135
|
+
|
136
|
+
// When requesting binary data, IE6-9 will throw an exception
|
137
|
+
// on any attempt to access responseText (#11426)
|
138
|
+
if ( typeof xhr.responseText === "string" ) {
|
139
|
+
responses.text = xhr.responseText;
|
140
|
+
}
|
141
|
+
|
142
|
+
// Firefox throws an exception when accessing
|
143
|
+
// statusText for faulty cross-domain requests
|
144
|
+
try {
|
145
|
+
statusText = xhr.statusText;
|
146
|
+
} catch( e ) {
|
147
|
+
// We normalize with Webkit giving an empty statusText
|
148
|
+
statusText = "";
|
149
|
+
}
|
150
|
+
|
151
|
+
// Filter status for non standard behaviors
|
152
|
+
|
153
|
+
// If the request is local and we have data: assume a success
|
154
|
+
// (success with no data won't get notified, that's the best we
|
155
|
+
// can do given current implementations)
|
156
|
+
if ( !status && s.isLocal && !s.crossDomain ) {
|
157
|
+
status = responses.text ? 200 : 404;
|
158
|
+
// IE - #1450: sometimes returns 1223 when it should be 204
|
159
|
+
} else if ( status === 1223 ) {
|
160
|
+
status = 204;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
} catch( firefoxAccessException ) {
|
165
|
+
if ( !isAbort ) {
|
166
|
+
complete( -1, firefoxAccessException );
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
// Call complete if needed
|
171
|
+
if ( responses ) {
|
172
|
+
complete( status, statusText, responses, responseHeaders );
|
173
|
+
}
|
174
|
+
};
|
175
|
+
|
176
|
+
if ( !s.async ) {
|
177
|
+
// if we're in sync mode we fire the callback
|
178
|
+
callback();
|
179
|
+
} else if ( xhr.readyState === 4 ) {
|
180
|
+
// (IE6 & IE7) if it's in cache and has been
|
181
|
+
// retrieved directly we need to fire the callback
|
182
|
+
setTimeout( callback );
|
183
|
+
} else {
|
184
|
+
handle = ++xhrId;
|
185
|
+
if ( xhrOnUnloadAbort ) {
|
186
|
+
// Create the active xhrs callbacks list if needed
|
187
|
+
// and attach the unload handler
|
188
|
+
if ( !xhrCallbacks ) {
|
189
|
+
xhrCallbacks = {};
|
190
|
+
jQuery( window ).unload( xhrOnUnloadAbort );
|
191
|
+
}
|
192
|
+
// Add to list of active xhrs callbacks
|
193
|
+
xhrCallbacks[ handle ] = callback;
|
194
|
+
}
|
195
|
+
xhr.onreadystatechange = callback;
|
196
|
+
}
|
197
|
+
},
|
198
|
+
|
199
|
+
abort: function() {
|
200
|
+
if ( callback ) {
|
201
|
+
callback( undefined, true );
|
202
|
+
}
|
203
|
+
}
|
204
|
+
};
|
205
|
+
}
|
206
|
+
});
|
207
|
+
}
|
@@ -0,0 +1,661 @@
|
|
1
|
+
var nodeHook, boolHook,
|
2
|
+
rclass = /[\t\r\n]/g,
|
3
|
+
rreturn = /\r/g,
|
4
|
+
rfocusable = /^(?:input|select|textarea|button|object)$/i,
|
5
|
+
rclickable = /^(?:a|area)$/i,
|
6
|
+
rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
|
7
|
+
ruseDefault = /^(?:checked|selected)$/i,
|
8
|
+
getSetAttribute = jQuery.support.getSetAttribute,
|
9
|
+
getSetInput = jQuery.support.input;
|
10
|
+
|
11
|
+
jQuery.fn.extend({
|
12
|
+
attr: function( name, value ) {
|
13
|
+
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
|
14
|
+
},
|
15
|
+
|
16
|
+
removeAttr: function( name ) {
|
17
|
+
return this.each(function() {
|
18
|
+
jQuery.removeAttr( this, name );
|
19
|
+
});
|
20
|
+
},
|
21
|
+
|
22
|
+
prop: function( name, value ) {
|
23
|
+
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
|
24
|
+
},
|
25
|
+
|
26
|
+
removeProp: function( name ) {
|
27
|
+
name = jQuery.propFix[ name ] || name;
|
28
|
+
return this.each(function() {
|
29
|
+
// try/catch handles cases where IE balks (such as removing a property on window)
|
30
|
+
try {
|
31
|
+
this[ name ] = undefined;
|
32
|
+
delete this[ name ];
|
33
|
+
} catch( e ) {}
|
34
|
+
});
|
35
|
+
},
|
36
|
+
|
37
|
+
addClass: function( value ) {
|
38
|
+
var classes, elem, cur, clazz, j,
|
39
|
+
i = 0,
|
40
|
+
len = this.length,
|
41
|
+
proceed = typeof value === "string" && value;
|
42
|
+
|
43
|
+
if ( jQuery.isFunction( value ) ) {
|
44
|
+
return this.each(function( j ) {
|
45
|
+
jQuery( this ).addClass( value.call( this, j, this.className ) );
|
46
|
+
});
|
47
|
+
}
|
48
|
+
|
49
|
+
if ( proceed ) {
|
50
|
+
// The disjunction here is for better compressibility (see removeClass)
|
51
|
+
classes = ( value || "" ).match( core_rnotwhite ) || [];
|
52
|
+
|
53
|
+
for ( ; i < len; i++ ) {
|
54
|
+
elem = this[ i ];
|
55
|
+
cur = elem.nodeType === 1 && ( elem.className ?
|
56
|
+
( " " + elem.className + " " ).replace( rclass, " " ) :
|
57
|
+
" "
|
58
|
+
);
|
59
|
+
|
60
|
+
if ( cur ) {
|
61
|
+
j = 0;
|
62
|
+
while ( (clazz = classes[j++]) ) {
|
63
|
+
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
|
64
|
+
cur += clazz + " ";
|
65
|
+
}
|
66
|
+
}
|
67
|
+
elem.className = jQuery.trim( cur );
|
68
|
+
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
return this;
|
74
|
+
},
|
75
|
+
|
76
|
+
removeClass: function( value ) {
|
77
|
+
var classes, elem, cur, clazz, j,
|
78
|
+
i = 0,
|
79
|
+
len = this.length,
|
80
|
+
proceed = arguments.length === 0 || typeof value === "string" && value;
|
81
|
+
|
82
|
+
if ( jQuery.isFunction( value ) ) {
|
83
|
+
return this.each(function( j ) {
|
84
|
+
jQuery( this ).removeClass( value.call( this, j, this.className ) );
|
85
|
+
});
|
86
|
+
}
|
87
|
+
if ( proceed ) {
|
88
|
+
classes = ( value || "" ).match( core_rnotwhite ) || [];
|
89
|
+
|
90
|
+
for ( ; i < len; i++ ) {
|
91
|
+
elem = this[ i ];
|
92
|
+
// This expression is here for better compressibility (see addClass)
|
93
|
+
cur = elem.nodeType === 1 && ( elem.className ?
|
94
|
+
( " " + elem.className + " " ).replace( rclass, " " ) :
|
95
|
+
""
|
96
|
+
);
|
97
|
+
|
98
|
+
if ( cur ) {
|
99
|
+
j = 0;
|
100
|
+
while ( (clazz = classes[j++]) ) {
|
101
|
+
// Remove *all* instances
|
102
|
+
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
|
103
|
+
cur = cur.replace( " " + clazz + " ", " " );
|
104
|
+
}
|
105
|
+
}
|
106
|
+
elem.className = value ? jQuery.trim( cur ) : "";
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
return this;
|
112
|
+
},
|
113
|
+
|
114
|
+
toggleClass: function( value, stateVal ) {
|
115
|
+
var type = typeof value,
|
116
|
+
isBool = typeof stateVal === "boolean";
|
117
|
+
|
118
|
+
if ( jQuery.isFunction( value ) ) {
|
119
|
+
return this.each(function( i ) {
|
120
|
+
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
|
121
|
+
});
|
122
|
+
}
|
123
|
+
|
124
|
+
return this.each(function() {
|
125
|
+
if ( type === "string" ) {
|
126
|
+
// toggle individual class names
|
127
|
+
var className,
|
128
|
+
i = 0,
|
129
|
+
self = jQuery( this ),
|
130
|
+
state = stateVal,
|
131
|
+
classNames = value.match( core_rnotwhite ) || [];
|
132
|
+
|
133
|
+
while ( (className = classNames[ i++ ]) ) {
|
134
|
+
// check each className given, space separated list
|
135
|
+
state = isBool ? state : !self.hasClass( className );
|
136
|
+
self[ state ? "addClass" : "removeClass" ]( className );
|
137
|
+
}
|
138
|
+
|
139
|
+
// Toggle whole class name
|
140
|
+
} else if ( type === core_strundefined || type === "boolean" ) {
|
141
|
+
if ( this.className ) {
|
142
|
+
// store className if set
|
143
|
+
jQuery._data( this, "__className__", this.className );
|
144
|
+
}
|
145
|
+
|
146
|
+
// If the element has a class name or if we're passed "false",
|
147
|
+
// then remove the whole classname (if there was one, the above saved it).
|
148
|
+
// Otherwise bring back whatever was previously saved (if anything),
|
149
|
+
// falling back to the empty string if nothing was stored.
|
150
|
+
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
|
151
|
+
}
|
152
|
+
});
|
153
|
+
},
|
154
|
+
|
155
|
+
hasClass: function( selector ) {
|
156
|
+
var className = " " + selector + " ",
|
157
|
+
i = 0,
|
158
|
+
l = this.length;
|
159
|
+
for ( ; i < l; i++ ) {
|
160
|
+
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
|
161
|
+
return true;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
return false;
|
166
|
+
},
|
167
|
+
|
168
|
+
val: function( value ) {
|
169
|
+
var ret, hooks, isFunction,
|
170
|
+
elem = this[0];
|
171
|
+
|
172
|
+
if ( !arguments.length ) {
|
173
|
+
if ( elem ) {
|
174
|
+
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
175
|
+
|
176
|
+
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
|
177
|
+
return ret;
|
178
|
+
}
|
179
|
+
|
180
|
+
ret = elem.value;
|
181
|
+
|
182
|
+
return typeof ret === "string" ?
|
183
|
+
// handle most common string cases
|
184
|
+
ret.replace(rreturn, "") :
|
185
|
+
// handle cases where value is null/undef or number
|
186
|
+
ret == null ? "" : ret;
|
187
|
+
}
|
188
|
+
|
189
|
+
return;
|
190
|
+
}
|
191
|
+
|
192
|
+
isFunction = jQuery.isFunction( value );
|
193
|
+
|
194
|
+
return this.each(function( i ) {
|
195
|
+
var val,
|
196
|
+
self = jQuery(this);
|
197
|
+
|
198
|
+
if ( this.nodeType !== 1 ) {
|
199
|
+
return;
|
200
|
+
}
|
201
|
+
|
202
|
+
if ( isFunction ) {
|
203
|
+
val = value.call( this, i, self.val() );
|
204
|
+
} else {
|
205
|
+
val = value;
|
206
|
+
}
|
207
|
+
|
208
|
+
// Treat null/undefined as ""; convert numbers to string
|
209
|
+
if ( val == null ) {
|
210
|
+
val = "";
|
211
|
+
} else if ( typeof val === "number" ) {
|
212
|
+
val += "";
|
213
|
+
} else if ( jQuery.isArray( val ) ) {
|
214
|
+
val = jQuery.map(val, function ( value ) {
|
215
|
+
return value == null ? "" : value + "";
|
216
|
+
});
|
217
|
+
}
|
218
|
+
|
219
|
+
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
220
|
+
|
221
|
+
// If set returns undefined, fall back to normal setting
|
222
|
+
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
|
223
|
+
this.value = val;
|
224
|
+
}
|
225
|
+
});
|
226
|
+
}
|
227
|
+
});
|
228
|
+
|
229
|
+
jQuery.extend({
|
230
|
+
valHooks: {
|
231
|
+
option: {
|
232
|
+
get: function( elem ) {
|
233
|
+
// attributes.value is undefined in Blackberry 4.7 but
|
234
|
+
// uses .value. See #6932
|
235
|
+
var val = elem.attributes.value;
|
236
|
+
return !val || val.specified ? elem.value : elem.text;
|
237
|
+
}
|
238
|
+
},
|
239
|
+
select: {
|
240
|
+
get: function( elem ) {
|
241
|
+
var value, option,
|
242
|
+
options = elem.options,
|
243
|
+
index = elem.selectedIndex,
|
244
|
+
one = elem.type === "select-one" || index < 0,
|
245
|
+
values = one ? null : [],
|
246
|
+
max = one ? index + 1 : options.length,
|
247
|
+
i = index < 0 ?
|
248
|
+
max :
|
249
|
+
one ? index : 0;
|
250
|
+
|
251
|
+
// Loop through all the selected options
|
252
|
+
for ( ; i < max; i++ ) {
|
253
|
+
option = options[ i ];
|
254
|
+
|
255
|
+
// oldIE doesn't update selected after form reset (#2551)
|
256
|
+
if ( ( option.selected || i === index ) &&
|
257
|
+
// Don't return options that are disabled or in a disabled optgroup
|
258
|
+
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
|
259
|
+
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
260
|
+
|
261
|
+
// Get the specific value for the option
|
262
|
+
value = jQuery( option ).val();
|
263
|
+
|
264
|
+
// We don't need an array for one selects
|
265
|
+
if ( one ) {
|
266
|
+
return value;
|
267
|
+
}
|
268
|
+
|
269
|
+
// Multi-Selects return an array
|
270
|
+
values.push( value );
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
return values;
|
275
|
+
},
|
276
|
+
|
277
|
+
set: function( elem, value ) {
|
278
|
+
var values = jQuery.makeArray( value );
|
279
|
+
|
280
|
+
jQuery(elem).find("option").each(function() {
|
281
|
+
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
|
282
|
+
});
|
283
|
+
|
284
|
+
if ( !values.length ) {
|
285
|
+
elem.selectedIndex = -1;
|
286
|
+
}
|
287
|
+
return values;
|
288
|
+
}
|
289
|
+
}
|
290
|
+
},
|
291
|
+
|
292
|
+
attr: function( elem, name, value ) {
|
293
|
+
var hooks, notxml, ret,
|
294
|
+
nType = elem.nodeType;
|
295
|
+
|
296
|
+
// don't get/set attributes on text, comment and attribute nodes
|
297
|
+
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
298
|
+
return;
|
299
|
+
}
|
300
|
+
|
301
|
+
// Fallback to prop when attributes are not supported
|
302
|
+
if ( typeof elem.getAttribute === core_strundefined ) {
|
303
|
+
return jQuery.prop( elem, name, value );
|
304
|
+
}
|
305
|
+
|
306
|
+
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
307
|
+
|
308
|
+
// All attributes are lowercase
|
309
|
+
// Grab necessary hook if one is defined
|
310
|
+
if ( notxml ) {
|
311
|
+
name = name.toLowerCase();
|
312
|
+
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
|
313
|
+
}
|
314
|
+
|
315
|
+
if ( value !== undefined ) {
|
316
|
+
|
317
|
+
if ( value === null ) {
|
318
|
+
jQuery.removeAttr( elem, name );
|
319
|
+
|
320
|
+
} else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
321
|
+
return ret;
|
322
|
+
|
323
|
+
} else {
|
324
|
+
elem.setAttribute( name, value + "" );
|
325
|
+
return value;
|
326
|
+
}
|
327
|
+
|
328
|
+
} else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
|
329
|
+
return ret;
|
330
|
+
|
331
|
+
} else {
|
332
|
+
|
333
|
+
// In IE9+, Flash objects don't have .getAttribute (#12945)
|
334
|
+
// Support: IE9+
|
335
|
+
if ( typeof elem.getAttribute !== core_strundefined ) {
|
336
|
+
ret = elem.getAttribute( name );
|
337
|
+
}
|
338
|
+
|
339
|
+
// Non-existent attributes return null, we normalize to undefined
|
340
|
+
return ret == null ?
|
341
|
+
undefined :
|
342
|
+
ret;
|
343
|
+
}
|
344
|
+
},
|
345
|
+
|
346
|
+
removeAttr: function( elem, value ) {
|
347
|
+
var name, propName,
|
348
|
+
i = 0,
|
349
|
+
attrNames = value && value.match( core_rnotwhite );
|
350
|
+
|
351
|
+
if ( attrNames && elem.nodeType === 1 ) {
|
352
|
+
while ( (name = attrNames[i++]) ) {
|
353
|
+
propName = jQuery.propFix[ name ] || name;
|
354
|
+
|
355
|
+
// Boolean attributes get special treatment (#10870)
|
356
|
+
if ( rboolean.test( name ) ) {
|
357
|
+
// Set corresponding property to false for boolean attributes
|
358
|
+
// Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
|
359
|
+
if ( !getSetAttribute && ruseDefault.test( name ) ) {
|
360
|
+
elem[ jQuery.camelCase( "default-" + name ) ] =
|
361
|
+
elem[ propName ] = false;
|
362
|
+
} else {
|
363
|
+
elem[ propName ] = false;
|
364
|
+
}
|
365
|
+
|
366
|
+
// See #9699 for explanation of this approach (setting first, then removal)
|
367
|
+
} else {
|
368
|
+
jQuery.attr( elem, name, "" );
|
369
|
+
}
|
370
|
+
|
371
|
+
elem.removeAttribute( getSetAttribute ? name : propName );
|
372
|
+
}
|
373
|
+
}
|
374
|
+
},
|
375
|
+
|
376
|
+
attrHooks: {
|
377
|
+
type: {
|
378
|
+
set: function( elem, value ) {
|
379
|
+
if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
|
380
|
+
// Setting the type on a radio button after the value resets the value in IE6-9
|
381
|
+
// Reset value to default in case type is set after value during creation
|
382
|
+
var val = elem.value;
|
383
|
+
elem.setAttribute( "type", value );
|
384
|
+
if ( val ) {
|
385
|
+
elem.value = val;
|
386
|
+
}
|
387
|
+
return value;
|
388
|
+
}
|
389
|
+
}
|
390
|
+
}
|
391
|
+
},
|
392
|
+
|
393
|
+
propFix: {
|
394
|
+
tabindex: "tabIndex",
|
395
|
+
readonly: "readOnly",
|
396
|
+
"for": "htmlFor",
|
397
|
+
"class": "className",
|
398
|
+
maxlength: "maxLength",
|
399
|
+
cellspacing: "cellSpacing",
|
400
|
+
cellpadding: "cellPadding",
|
401
|
+
rowspan: "rowSpan",
|
402
|
+
colspan: "colSpan",
|
403
|
+
usemap: "useMap",
|
404
|
+
frameborder: "frameBorder",
|
405
|
+
contenteditable: "contentEditable"
|
406
|
+
},
|
407
|
+
|
408
|
+
prop: function( elem, name, value ) {
|
409
|
+
var ret, hooks, notxml,
|
410
|
+
nType = elem.nodeType;
|
411
|
+
|
412
|
+
// don't get/set properties on text, comment and attribute nodes
|
413
|
+
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
414
|
+
return;
|
415
|
+
}
|
416
|
+
|
417
|
+
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
418
|
+
|
419
|
+
if ( notxml ) {
|
420
|
+
// Fix name and attach hooks
|
421
|
+
name = jQuery.propFix[ name ] || name;
|
422
|
+
hooks = jQuery.propHooks[ name ];
|
423
|
+
}
|
424
|
+
|
425
|
+
if ( value !== undefined ) {
|
426
|
+
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
427
|
+
return ret;
|
428
|
+
|
429
|
+
} else {
|
430
|
+
return ( elem[ name ] = value );
|
431
|
+
}
|
432
|
+
|
433
|
+
} else {
|
434
|
+
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
|
435
|
+
return ret;
|
436
|
+
|
437
|
+
} else {
|
438
|
+
return elem[ name ];
|
439
|
+
}
|
440
|
+
}
|
441
|
+
},
|
442
|
+
|
443
|
+
propHooks: {
|
444
|
+
tabIndex: {
|
445
|
+
get: function( elem ) {
|
446
|
+
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
447
|
+
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
448
|
+
var attributeNode = elem.getAttributeNode("tabindex");
|
449
|
+
|
450
|
+
return attributeNode && attributeNode.specified ?
|
451
|
+
parseInt( attributeNode.value, 10 ) :
|
452
|
+
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
453
|
+
0 :
|
454
|
+
undefined;
|
455
|
+
}
|
456
|
+
}
|
457
|
+
}
|
458
|
+
});
|
459
|
+
|
460
|
+
// Hook for boolean attributes
|
461
|
+
boolHook = {
|
462
|
+
get: function( elem, name ) {
|
463
|
+
var
|
464
|
+
// Use .prop to determine if this attribute is understood as boolean
|
465
|
+
prop = jQuery.prop( elem, name ),
|
466
|
+
|
467
|
+
// Fetch it accordingly
|
468
|
+
attr = typeof prop === "boolean" && elem.getAttribute( name ),
|
469
|
+
detail = typeof prop === "boolean" ?
|
470
|
+
|
471
|
+
getSetInput && getSetAttribute ?
|
472
|
+
attr != null :
|
473
|
+
// oldIE fabricates an empty string for missing boolean attributes
|
474
|
+
// and conflates checked/selected into attroperties
|
475
|
+
ruseDefault.test( name ) ?
|
476
|
+
elem[ jQuery.camelCase( "default-" + name ) ] :
|
477
|
+
!!attr :
|
478
|
+
|
479
|
+
// fetch an attribute node for properties not recognized as boolean
|
480
|
+
elem.getAttributeNode( name );
|
481
|
+
|
482
|
+
return detail && detail.value !== false ?
|
483
|
+
name.toLowerCase() :
|
484
|
+
undefined;
|
485
|
+
},
|
486
|
+
set: function( elem, value, name ) {
|
487
|
+
if ( value === false ) {
|
488
|
+
// Remove boolean attributes when set to false
|
489
|
+
jQuery.removeAttr( elem, name );
|
490
|
+
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
|
491
|
+
// IE<8 needs the *property* name
|
492
|
+
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
|
493
|
+
|
494
|
+
// Use defaultChecked and defaultSelected for oldIE
|
495
|
+
} else {
|
496
|
+
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
|
497
|
+
}
|
498
|
+
|
499
|
+
return name;
|
500
|
+
}
|
501
|
+
};
|
502
|
+
|
503
|
+
// fix oldIE value attroperty
|
504
|
+
if ( !getSetInput || !getSetAttribute ) {
|
505
|
+
jQuery.attrHooks.value = {
|
506
|
+
get: function( elem, name ) {
|
507
|
+
var ret = elem.getAttributeNode( name );
|
508
|
+
return jQuery.nodeName( elem, "input" ) ?
|
509
|
+
|
510
|
+
// Ignore the value *property* by using defaultValue
|
511
|
+
elem.defaultValue :
|
512
|
+
|
513
|
+
ret && ret.specified ? ret.value : undefined;
|
514
|
+
},
|
515
|
+
set: function( elem, value, name ) {
|
516
|
+
if ( jQuery.nodeName( elem, "input" ) ) {
|
517
|
+
// Does not return so that setAttribute is also used
|
518
|
+
elem.defaultValue = value;
|
519
|
+
} else {
|
520
|
+
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
|
521
|
+
return nodeHook && nodeHook.set( elem, value, name );
|
522
|
+
}
|
523
|
+
}
|
524
|
+
};
|
525
|
+
}
|
526
|
+
|
527
|
+
// IE6/7 do not support getting/setting some attributes with get/setAttribute
|
528
|
+
if ( !getSetAttribute ) {
|
529
|
+
|
530
|
+
// Use this for any attribute in IE6/7
|
531
|
+
// This fixes almost every IE6/7 issue
|
532
|
+
nodeHook = jQuery.valHooks.button = {
|
533
|
+
get: function( elem, name ) {
|
534
|
+
var ret = elem.getAttributeNode( name );
|
535
|
+
return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
|
536
|
+
ret.value :
|
537
|
+
undefined;
|
538
|
+
},
|
539
|
+
set: function( elem, value, name ) {
|
540
|
+
// Set the existing or create a new attribute node
|
541
|
+
var ret = elem.getAttributeNode( name );
|
542
|
+
if ( !ret ) {
|
543
|
+
elem.setAttributeNode(
|
544
|
+
(ret = elem.ownerDocument.createAttribute( name ))
|
545
|
+
);
|
546
|
+
}
|
547
|
+
|
548
|
+
ret.value = value += "";
|
549
|
+
|
550
|
+
// Break association with cloned elements by also using setAttribute (#9646)
|
551
|
+
return name === "value" || value === elem.getAttribute( name ) ?
|
552
|
+
value :
|
553
|
+
undefined;
|
554
|
+
}
|
555
|
+
};
|
556
|
+
|
557
|
+
// Set contenteditable to false on removals(#10429)
|
558
|
+
// Setting to empty string throws an error as an invalid value
|
559
|
+
jQuery.attrHooks.contenteditable = {
|
560
|
+
get: nodeHook.get,
|
561
|
+
set: function( elem, value, name ) {
|
562
|
+
nodeHook.set( elem, value === "" ? false : value, name );
|
563
|
+
}
|
564
|
+
};
|
565
|
+
|
566
|
+
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
|
567
|
+
// This is for removals
|
568
|
+
jQuery.each([ "width", "height" ], function( i, name ) {
|
569
|
+
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
|
570
|
+
set: function( elem, value ) {
|
571
|
+
if ( value === "" ) {
|
572
|
+
elem.setAttribute( name, "auto" );
|
573
|
+
return value;
|
574
|
+
}
|
575
|
+
}
|
576
|
+
});
|
577
|
+
});
|
578
|
+
}
|
579
|
+
|
580
|
+
|
581
|
+
// Some attributes require a special call on IE
|
582
|
+
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
|
583
|
+
if ( !jQuery.support.hrefNormalized ) {
|
584
|
+
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
|
585
|
+
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
|
586
|
+
get: function( elem ) {
|
587
|
+
var ret = elem.getAttribute( name, 2 );
|
588
|
+
return ret == null ? undefined : ret;
|
589
|
+
}
|
590
|
+
});
|
591
|
+
});
|
592
|
+
|
593
|
+
// href/src property should get the full normalized URL (#10299/#12915)
|
594
|
+
jQuery.each([ "href", "src" ], function( i, name ) {
|
595
|
+
jQuery.propHooks[ name ] = {
|
596
|
+
get: function( elem ) {
|
597
|
+
return elem.getAttribute( name, 4 );
|
598
|
+
}
|
599
|
+
};
|
600
|
+
});
|
601
|
+
}
|
602
|
+
|
603
|
+
if ( !jQuery.support.style ) {
|
604
|
+
jQuery.attrHooks.style = {
|
605
|
+
get: function( elem ) {
|
606
|
+
// Return undefined in the case of empty string
|
607
|
+
// Note: IE uppercases css property names, but if we were to .toLowerCase()
|
608
|
+
// .cssText, that would destroy case senstitivity in URL's, like in "background"
|
609
|
+
return elem.style.cssText || undefined;
|
610
|
+
},
|
611
|
+
set: function( elem, value ) {
|
612
|
+
return ( elem.style.cssText = value + "" );
|
613
|
+
}
|
614
|
+
};
|
615
|
+
}
|
616
|
+
|
617
|
+
// Safari mis-reports the default selected property of an option
|
618
|
+
// Accessing the parent's selectedIndex property fixes it
|
619
|
+
if ( !jQuery.support.optSelected ) {
|
620
|
+
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
|
621
|
+
get: function( elem ) {
|
622
|
+
var parent = elem.parentNode;
|
623
|
+
|
624
|
+
if ( parent ) {
|
625
|
+
parent.selectedIndex;
|
626
|
+
|
627
|
+
// Make sure that it also works with optgroups, see #5701
|
628
|
+
if ( parent.parentNode ) {
|
629
|
+
parent.parentNode.selectedIndex;
|
630
|
+
}
|
631
|
+
}
|
632
|
+
return null;
|
633
|
+
}
|
634
|
+
});
|
635
|
+
}
|
636
|
+
|
637
|
+
// IE6/7 call enctype encoding
|
638
|
+
if ( !jQuery.support.enctype ) {
|
639
|
+
jQuery.propFix.enctype = "encoding";
|
640
|
+
}
|
641
|
+
|
642
|
+
// Radios and checkboxes getter/setter
|
643
|
+
if ( !jQuery.support.checkOn ) {
|
644
|
+
jQuery.each([ "radio", "checkbox" ], function() {
|
645
|
+
jQuery.valHooks[ this ] = {
|
646
|
+
get: function( elem ) {
|
647
|
+
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
|
648
|
+
return elem.getAttribute("value") === null ? "on" : elem.value;
|
649
|
+
}
|
650
|
+
};
|
651
|
+
});
|
652
|
+
}
|
653
|
+
jQuery.each([ "radio", "checkbox" ], function() {
|
654
|
+
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
|
655
|
+
set: function( elem, value ) {
|
656
|
+
if ( jQuery.isArray( value ) ) {
|
657
|
+
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
|
658
|
+
}
|
659
|
+
}
|
660
|
+
});
|
661
|
+
});
|