mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-14 01:23:10 +00:00
added ajaxEnabled option. ajaxLinksEnabled and ajaxFormsEnabled are deprecated and will be removed by 1.0. Fixes #851
This commit is contained in:
parent
2ebf659fbd
commit
2e6a396278
3 changed files with 26 additions and 11 deletions
|
|
@ -80,11 +80,14 @@ $(document).bind("mobileinit", function(){
|
|||
|
||||
<dt>activeBtnClass (<em>string</em>, default: "ui-page-active"):</dt>
|
||||
<dd>The class used for "active" button state, from CSS framework.</dd>
|
||||
|
||||
<dt>ajaxEnabled (<em>boolean</em>, default: true):</dt>
|
||||
<dd>jQuery Mobile will automatically handle link clicks and form submissions through Ajax, when possible. If false, url hash listening will be disabled as well, and urls will load as regular http requests.</dd>
|
||||
|
||||
<dt>ajaxLinksEnabled (<em>boolean</em>, default: true):</dt>
|
||||
<dt>ajaxLinksEnabled (<strong>deprecated</strong> <em>boolean</em>, default: true):</dt>
|
||||
<dd>jQuery Mobile will automatically handle link clicks through Ajax, when possible.</dd>
|
||||
|
||||
<dt>ajaxFormsEnabled (<em>boolean</em>, default: true):</dt>
|
||||
<dt>ajaxFormsEnabled (<strong>deprecated</strong> <em>boolean</em>, default: true):</dt>
|
||||
<dd>jQuery Mobile will automatically handle form submissions through Ajax, when possible.</dd>
|
||||
|
||||
<dt>defaultTransition (<em>string</em>, default: 'slide'):</dt>
|
||||
|
|
|
|||
|
|
@ -27,11 +27,16 @@
|
|||
//class used for "active" button state, from CSS framework
|
||||
activeBtnClass: 'ui-btn-active',
|
||||
|
||||
//automatically handle link clicks through Ajax, when possible
|
||||
ajaxLinksEnabled: true,
|
||||
//automatically handle clicks and form submissions through Ajax, when same-domain
|
||||
ajaxEnabled: true,
|
||||
|
||||
// TODO: deprecated - remove at 1.0
|
||||
//automatically handle link clicks through Ajax, when possible
|
||||
ajaxLinksEnabled: true,
|
||||
|
||||
//automatically handle form submissions through Ajax, when possible
|
||||
ajaxFormsEnabled: true,
|
||||
// TODO: deprecated - remove at 1.0
|
||||
//automatically handle form submissions through Ajax, when possible
|
||||
ajaxFormsEnabled: true,
|
||||
|
||||
//set default transition - 'none' for no transitions
|
||||
defaultTransition: 'slide',
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@
|
|||
/* exposed $.mobile methods */
|
||||
|
||||
//update location.hash, with or without triggering hashchange event
|
||||
//TODO - deprecate this one
|
||||
//TODO - deprecate this one at 1.0
|
||||
$.mobile.updateHash = path.set;
|
||||
|
||||
//expose path object on $.mobile
|
||||
|
|
@ -229,7 +229,7 @@
|
|||
$.mobile.base = base;
|
||||
|
||||
//url stack, useful when plugins need to be aware of previous pages viewed
|
||||
//TODO: deprecate this one
|
||||
//TODO: deprecate this one at 1.0
|
||||
$.mobile.urlstack = urlHistory.stack;
|
||||
|
||||
//history stack
|
||||
|
|
@ -509,7 +509,9 @@
|
|||
|
||||
//bind to form submit events, handle with Ajax
|
||||
$( "form[data-ajax!='false']" ).live('submit', function(event){
|
||||
if( !$.mobile.ajaxFormsEnabled ){ return; }
|
||||
if( !$.mobile.ajaxEnabled ||
|
||||
//TODO: deprecated - remove at 1.0
|
||||
!$.mobile.ajaxFormsEnabled ){ return; }
|
||||
|
||||
var type = $(this).attr("method"),
|
||||
url = path.clean( $(this).attr( "action" ) );
|
||||
|
|
@ -558,7 +560,9 @@
|
|||
|
||||
$activeClickedLink = $this.closest( ".ui-btn" ).addClass( $.mobile.activeBtnClass );
|
||||
|
||||
if( isExternal || hasTarget || !$.mobile.ajaxLinksEnabled ){
|
||||
if( isExternal || hasTarget || !$.mobile.ajaxEnabled ||
|
||||
// TODO: deprecated - remove at 1.0
|
||||
!$.mobile.ajaxLinksEnabled ){
|
||||
//remove active link class if external (then it won't be there if you come back)
|
||||
removeActiveLinkClass(true);
|
||||
|
||||
|
|
@ -596,7 +600,10 @@
|
|||
|
||||
//hashchange event handler
|
||||
$window.bind( "hashchange", function(e, triggered) {
|
||||
if( !urlHistory.listeningEnabled ){
|
||||
if( !urlHistory.listeningEnabled || !$.mobile.ajaxEnabled ||
|
||||
// TODO: deprecated - remove at 1.0
|
||||
// only links need to be checked here, as forms don't trigger a hashchange event (they just silently update the hash)
|
||||
( !$.mobile.ajaxLinksEnabled ) ){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue