mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
Merge remote branch 'origin/master'
This commit is contained in:
commit
3e2683fe18
11 changed files with 28 additions and 92 deletions
|
|
@ -74,9 +74,9 @@ function showCategory( url, options )
|
|||
}
|
||||
|
||||
|
||||
// Listen for any attempts to call changepage.
|
||||
// Listen for any attempts to call changePage().
|
||||
$(document).bind( "pagebeforechange", function( e, data ) {
|
||||
// We only want to handle changepage calls where the caller is
|
||||
// We only want to handle changePage() calls where the caller is
|
||||
// asking us to load a page by URL.
|
||||
if ( typeof data.toPage === "string" ) {
|
||||
// We are being asked to load a page by URL, but we only
|
||||
|
|
@ -89,7 +89,7 @@ $(document).bind( "pagebeforechange", function( e, data ) {
|
|||
// on the fly based on our in-memory category data structure.
|
||||
showCategory( u.href, data.options );
|
||||
|
||||
// Make sure to tell changepage we've handled this call so it doesn't
|
||||
// Make sure to tell changePage() we've handled this call so it doesn't
|
||||
// have to do anything.
|
||||
e.preventDefault();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,9 +148,9 @@ function showCategory( urlObj, options )
|
|||
}
|
||||
|
||||
|
||||
// Listen for any attempts to call changepage.
|
||||
// Listen for any attempts to call changePage().
|
||||
$(document).bind( "pagebeforechange", function( e, data ) {
|
||||
// We only want to handle changepage calls where the caller is
|
||||
// We only want to handle changePage() calls where the caller is
|
||||
// asking us to load a page by URL.
|
||||
if ( typeof data.toPage === "string" ) {
|
||||
// We are being asked to load a page by URL, but we only
|
||||
|
|
@ -164,7 +164,7 @@ $(document).bind( "pagebeforechange", function( e, data ) {
|
|||
// on the fly based on our in-memory category data structure.
|
||||
showCategory( u, data.options );
|
||||
|
||||
// Make sure to tell changepage we've handled this call so it doesn't
|
||||
// Make sure to tell changePage() we've handled this call so it doesn't
|
||||
// have to do anything.
|
||||
e.preventDefault();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,10 +124,10 @@ var categoryData = {
|
|||
<p>The application was able to insert itself into the changePage() flow by binding to the "pagebeforechange" event at the document level:</p>
|
||||
<pre>
|
||||
<code>
|
||||
// Listen for any attempts to call changepage.
|
||||
// Listen for any attempts to call changePage().
|
||||
$(document).bind( "pagebeforechange", function( e, data ) {
|
||||
|
||||
// We only want to handle changepage calls where the caller is
|
||||
// We only want to handle changePage() calls where the caller is
|
||||
// asking us to load a page by URL.
|
||||
if ( typeof data.toPage === "string" ) {
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ $(document).bind( "pagebeforechange", function( e, data ) {
|
|||
// on the fly based on our in-memory category data structure.
|
||||
showCategory( u, data.options );
|
||||
|
||||
// Make sure to tell changepage we've handled this call so it doesn't
|
||||
// Make sure to tell changePage() we've handled this call so it doesn't
|
||||
// have to do anything.
|
||||
e.preventDefault();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,9 +351,6 @@ $.mobile.fixedToolbars = (function() {
|
|||
};
|
||||
})();
|
||||
|
||||
// TODO - Deprecated namepace on $. Remove in a later release
|
||||
$.fixedToolbars = $.mobile.fixedToolbars;
|
||||
|
||||
//auto self-init widgets
|
||||
$( document ).bind( "pagecreate create", function( event ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -60,15 +60,6 @@
|
|||
$html.removeClass( "ui-loading" );
|
||||
},
|
||||
|
||||
// XXX: deprecate for 1.0
|
||||
pageLoading: function ( done ) {
|
||||
if ( done ) {
|
||||
$.mobile.hidePageLoadingMsg();
|
||||
} else {
|
||||
$.mobile.showPageLoadingMsg();
|
||||
}
|
||||
},
|
||||
|
||||
// find and enhance the pages in the dom and transition to the first page.
|
||||
initializePage: function() {
|
||||
// find present pages
|
||||
|
|
|
|||
|
|
@ -428,8 +428,8 @@
|
|||
})( true );
|
||||
|
||||
// to get last scroll, we need to get scrolltop before the page change
|
||||
// using beforechangepage or popstate/hashchange (whichever comes first)
|
||||
$( document ).bind( "beforechangepage", getLastScroll );
|
||||
// using pagebeforechange or popstate/hashchange (whichever comes first)
|
||||
$( document ).bind( "pagebeforechange", getLastScroll );
|
||||
$( window ).bind( $.support.pushState ? "popstate" : "hashchange", getLastScroll );
|
||||
|
||||
// Make the iOS clock quick-scroll work again if we're using native overflow scrolling
|
||||
|
|
@ -566,20 +566,12 @@
|
|||
}
|
||||
};
|
||||
|
||||
//update location.hash, with or without triggering hashchange event
|
||||
//TODO - deprecate this one at 1.0
|
||||
$.mobile.updateHash = path.set;
|
||||
|
||||
//expose path object on $.mobile
|
||||
$.mobile.path = path;
|
||||
|
||||
//expose base object on $.mobile
|
||||
$.mobile.base = base;
|
||||
|
||||
//url stack, useful when plugins need to be aware of previous pages viewed
|
||||
//TODO: deprecate this one at 1.0
|
||||
$.mobile.urlstack = urlHistory.stack;
|
||||
|
||||
//history stack
|
||||
$.mobile.urlHistory = urlHistory;
|
||||
|
||||
|
|
@ -862,43 +854,6 @@
|
|||
|
||||
// Show a specific page in the page container.
|
||||
$.mobile.changePage = function( toPage, options ) {
|
||||
// XXX: REMOVE_BEFORE_SHIPPING_1.0
|
||||
// This is temporary code that makes changePage() compatible with previous alpha versions.
|
||||
if ( typeof options !== "object" ) {
|
||||
var opts = null;
|
||||
|
||||
// Map old-style call signature for form submit to the new options object format.
|
||||
if ( typeof toPage === "object" && toPage.url && toPage.type ) {
|
||||
opts = {
|
||||
type: toPage.type,
|
||||
data: toPage.data,
|
||||
forcePageLoad: true
|
||||
};
|
||||
toPage = toPage.url;
|
||||
}
|
||||
|
||||
// The arguments passed into the function need to be re-mapped
|
||||
// to the new options object format.
|
||||
var len = arguments.length;
|
||||
if ( len > 1 ) {
|
||||
var argNames = [ "transition", "reverse", "changeHash", "fromHashChange" ], i;
|
||||
for ( i = 1; i < len; i++ ) {
|
||||
var a = arguments[ i ];
|
||||
if ( typeof a !== "undefined" ) {
|
||||
opts = opts || {};
|
||||
opts[ argNames[ i - 1 ] ] = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If an options object was created, then we know changePage() was called
|
||||
// with an old signature.
|
||||
if ( opts ) {
|
||||
return $.mobile.changePage( toPage, opts );
|
||||
}
|
||||
}
|
||||
// XXX: REMOVE_BEFORE_SHIPPING_1.0
|
||||
|
||||
// If we are in the midst of a transition, queue the current request.
|
||||
// We'll call changePage() once we're done with the current transition to
|
||||
// service the request.
|
||||
|
|
@ -922,8 +877,6 @@
|
|||
// Let listeners know we're about to change the current page.
|
||||
mpc.trigger( pbcEvent, triggerData );
|
||||
|
||||
mpc.trigger( "beforechangepage", triggerData ); // XXX: DEPRECATED for 1.0
|
||||
|
||||
// If the default behavior is prevented, stop here!
|
||||
if( pbcEvent.isDefaultPrevented() ){
|
||||
return;
|
||||
|
|
@ -952,7 +905,6 @@
|
|||
$.mobile.changePage( newPage, options );
|
||||
})
|
||||
.fail(function( url, options ) {
|
||||
// XXX_jblas: Fire off changepagefailed notificaiton.
|
||||
isPageTransitioning = false;
|
||||
|
||||
//clear out the active button state
|
||||
|
|
@ -961,7 +913,6 @@
|
|||
//release transition lock so navigation is free again
|
||||
releasePageTransitionLock();
|
||||
settings.pageContainer.trigger( "pagechangefailed", triggerData );
|
||||
settings.pageContainer.trigger( "changepagefailed", triggerData ); // XXX: DEPRECATED for 1.0
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
@ -988,7 +939,6 @@
|
|||
if( fromPage && fromPage[0] === toPage[0] ) {
|
||||
isPageTransitioning = false;
|
||||
mpc.trigger( "pagechange", triggerData );
|
||||
mpc.trigger( "changepage", triggerData ); // XXX: DEPRECATED for 1.0
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1076,8 +1026,6 @@
|
|||
|
||||
// Let listeners know we're all done changing the current page.
|
||||
mpc.trigger( "pagechange", triggerData );
|
||||
|
||||
mpc.trigger( "changepage", triggerData ); // XXX: DEPRECATED for 1.0
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1334,7 +1282,7 @@
|
|||
isForward: function() { window.history.forward(); }
|
||||
});
|
||||
|
||||
// prevent changepage
|
||||
// prevent changePage()
|
||||
return;
|
||||
} else {
|
||||
// if the current active page is a dialog and we're navigating
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
},
|
||||
|
||||
pageSequence: function(fns){
|
||||
this.eventSequence("changepage", fns);
|
||||
this.eventSequence("pagechange", fns);
|
||||
},
|
||||
|
||||
eventSequence: function(event, fns, timedOut){
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
if( fn === undefined ) return;
|
||||
|
||||
// if a changepage or defined event is never triggered
|
||||
// if a pagechange or defined event is never triggered
|
||||
// continue in the sequence to alert possible failures
|
||||
var warnTimer = setTimeout(function(){
|
||||
self.eventSequence(event, fns, true);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
teardown: function(){
|
||||
$.extend = extendFn;
|
||||
|
||||
// NOTE reset for pageLoading tests
|
||||
// NOTE reset for showPageLoadingMsg/hidePageLoadingMsg tests
|
||||
$('.ui-loader').remove();
|
||||
|
||||
// clear the classes added by reloading the init
|
||||
|
|
@ -147,10 +147,10 @@
|
|||
same($("#bar").jqmData('url'), "bak");
|
||||
});
|
||||
|
||||
asyncTest( "pageLoading doesn't add the dialog to the page when loading message is false", function(){
|
||||
asyncTest( "showPageLoadingMsg doesn't add the dialog to the page when loading message is false", function(){
|
||||
expect( 1 );
|
||||
$.mobile.loadingMessage = false;
|
||||
$.mobile.pageLoading(false);
|
||||
$.mobile.showPageLoadingMsg();
|
||||
|
||||
setTimeout(function(){
|
||||
ok(!$(".ui-loader").length, "no ui-loader element");
|
||||
|
|
@ -158,10 +158,10 @@
|
|||
}, 500);
|
||||
});
|
||||
|
||||
asyncTest( "pageLoading doesn't add the dialog to the page when done is passed as true", function(){
|
||||
asyncTest( "hidePageLoadingMsg doesn't add the dialog to the page when loading message is false", function(){
|
||||
expect( 1 );
|
||||
$.mobile.loadingMessage = true;
|
||||
$.mobile.pageLoading(true);
|
||||
$.mobile.hidePageLoadingMsg();
|
||||
|
||||
setTimeout(function(){
|
||||
same($(".ui-loading").length, 0, "page should not be in the loading state");
|
||||
|
|
@ -169,10 +169,10 @@
|
|||
}, 500);
|
||||
});
|
||||
|
||||
asyncTest( "pageLoading adds the dialog to the page when done is true", function(){
|
||||
asyncTest( "showPageLoadingMsg adds the dialog to the page when loadingMessage is true", function(){
|
||||
expect( 1 );
|
||||
$.mobile.loadingMessage = true;
|
||||
$.mobile.pageLoading(false);
|
||||
$.mobile.showPageLoadingMsg();
|
||||
|
||||
setTimeout(function(){
|
||||
same($(".ui-loading").length, 1, "page should be in the loading state");
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
asyncTest( "page loading should contain default loading message", function(){
|
||||
expect( 1 );
|
||||
reloadCoreNSandInit();
|
||||
$.mobile.pageLoading(false);
|
||||
$.mobile.showPageLoadingMsg();
|
||||
|
||||
setTimeout(function(){
|
||||
same($(".ui-loader h1").text(), "loading");
|
||||
|
|
@ -194,7 +194,7 @@
|
|||
asyncTest( "page loading should contain custom loading message", function(){
|
||||
$.mobile.loadingMessage = "foo";
|
||||
$.testHelper.reloadLib(libName);
|
||||
$.mobile.pageLoading(false);
|
||||
$.mobile.showPageLoadingMsg();
|
||||
|
||||
setTimeout(function(){
|
||||
same($(".ui-loader h1").text(), "foo");
|
||||
|
|
@ -204,7 +204,7 @@
|
|||
|
||||
asyncTest( "page loading should contain custom loading message when set during runtime", function(){
|
||||
$.mobile.loadingMessage = "bar";
|
||||
$.mobile.pageLoading(false);
|
||||
$.mobile.showPageLoadingMsg();
|
||||
|
||||
setTimeout(function(){
|
||||
same($(".ui-loader h1").text(), "bar");
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
setup: function(){
|
||||
if ( location.hash ) {
|
||||
stop();
|
||||
$(document).one("changepage", function() {
|
||||
$(document).one("pagechange", function() {
|
||||
start();
|
||||
} );
|
||||
location.hash = "";
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
stop();
|
||||
|
||||
$(document).one( "changepage", function() {
|
||||
$(document).one( "pagechange", function() {
|
||||
start();
|
||||
});
|
||||
|
||||
|
|
@ -197,7 +197,7 @@
|
|||
}], 1000);
|
||||
});
|
||||
|
||||
asyncTest( "forms with data attribute ajax not set or set to anything but false will call changepage", function(){
|
||||
asyncTest( "forms with data attribute ajax not set or set to anything but false will call changePage", function(){
|
||||
var called = 0,
|
||||
newChangePage = function(){
|
||||
called++;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
setup: function(){
|
||||
if ( location.hash ) {
|
||||
stop();
|
||||
$(document).one("changepage", function() {
|
||||
$(document).one("pagechange", function() {
|
||||
start();
|
||||
} );
|
||||
location.hash = "";
|
||||
|
|
|
|||
Loading…
Reference in a new issue