Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Continue to call pageLoading when autoInitialize is false. #956

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
131cc10
Added ability to control if $.mobile will automatically load first pa…
Feb 2, 2011
6ffb003
Merge remote branch 'upstream/master'
toreym Feb 2, 2011
672df3e
Merge branch 'master' of https://github.com/jquery/jquery-mobile
toreym Feb 2, 2011
d7e2d40
When autoInitialize is false continue to call pageLoading.
toreym Feb 2, 2011
d3f2fe0
pageLoading should work without pageContainer set. Append loader to …
toreym Feb 2, 2011
db88c4f
externalize $.mobile.urlHistory.clear function
ajkovar Feb 2, 2011
49d2344
remove extra timeout
ajkovar Feb 2, 2011
a61ade5
fixed base undefined error in firefox
ajkovar Feb 2, 2011
5a92146
property should not be defined in $.mobile.
Feb 3, 2011
87b3a52
whitespace in core tests
johnbender Feb 2, 2011
ae52fe7
added autoInitialize documentation
johnbender Feb 3, 2011
5bc25f5
added step tests for keypress, removed data-step attribute check in f…
johnbender Feb 3, 2011
da96718
In android 2.1 and 1.6, the split button anchor needed to be a siblin…
Feb 3, 2011
6d23d64
added data-rel back attrs to dialog sample buttons
Feb 3, 2011
82fb3ae
Fixed broken footer example, added a few more color variations.
toddparker Feb 3, 2011
eabb937
Added firefox mobile to the list of supported browers for alpha 3.
toddparker Feb 3, 2011
5437c14
Added h2 to intro page
toddparker Feb 3, 2011
f0398de
Removie site AI, not needed in Git.
toddparker Feb 3, 2011
c0c9a05
Added new home and search icons to sprite.
toddparker Feb 3, 2011
b005ace
Added new home and search icon classes. Re-named the ui-icon-search u…
toddparker Feb 3, 2011
3977b26
Re-named the ui-icon-search used on search inputs to ui-icon-searchin…
toddparker Feb 3, 2011
6f79ddb
Created demo buttons for the new home and search icons
toddparker Feb 3, 2011
b9bc511
Updated Valencia with new icons
toddparker Feb 3, 2011
8b5ab45
Alpha 3 flag
toddparker Feb 3, 2011
81f4fcb
New high-res logo with better compression
toddparker Feb 3, 2011
25dae13
Icon source PSD
toddparker Feb 3, 2011
64281bf
Added 1px extra padding to icon only buttons. Adjusted offset for cle…
toddparker Feb 3, 2011
012fbbf
Updated sample page templates and docs to mobile a3 and jquery 1.5
toddparker Feb 3, 2011
51c7200
Removed experimental section with API browser because it's outdated
toddparker Feb 3, 2011
4091963
Upgraded YUI Compressor to 2.4.4.
jeresig Feb 3, 2011
f1078e0
Page min-height was being calculated with JS and it was far too tall.…
Feb 3, 2011
9958fb7
Added a home link to all pages and changed the header bar theme swatc…
toddparker Feb 3, 2011
6094345
Device image
toddparker Feb 3, 2011
dbfb314
typo in code example. Fixes #966
Feb 3, 2011
f484a5b
fixed a regression in some android 2.2 devices where checkboxes were …
Feb 3, 2011
54366c4
home button fixes
toddparker Feb 3, 2011
73a02b2
Added bg color for demo pages
toddparker Feb 3, 2011
c106521
Tagging the 1.0a3 release.
jeresig Feb 3, 2011
8d698ec
Make some tweaks to the deploy script.
jeresig Feb 3, 2011
0f0cc98
Added ability to control if $.mobile will automatically load first pa…
Feb 2, 2011
d8f3932
When autoInitialize is false continue to call pageLoading.
toreym Feb 2, 2011
2ae6542
pageLoading should work without pageContainer set. Append loader to …
toreym Feb 2, 2011
25c428d
Merge branch 'master' of https://github.com/jquery/jquery-mobile
toreym Feb 4, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions js/jquery.mobile.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
return $.support.mediaquery;
},

//automatically initialize first pages or not.
autoInitialize: true,

//TODO might be useful upstream in jquery itself ?
keyCode: {
ALT: 18,
Expand Down Expand Up @@ -144,7 +141,7 @@
var activeBtn =$( "." + $.mobile.activeBtnClass ).first();

$loader
.appendTo( $.mobile.pageContainer )
.appendTo( 'body' )
//position at y center (if scrollTop supported), above the activeBtn (if defined), or just 100px from top
.css( {
top: $.support.scrollTop && $(window).scrollTop() + $(window).height() / 2 ||
Expand Down Expand Up @@ -174,40 +171,43 @@

// find and enhance the pages in the dom and transition to the first page.
initializePage: function(){
//find present pages
var $pages = $( "[data-role='page']" );

//add dialogs, set data-url attrs
$pages.add( "[data-role='dialog']" ).each(function(){
$(this).attr( "data-url", $(this).attr( "id" ));
});
// when dom-ready
$(function(){
//find present pages
var $pages = $( "[data-role='page']" );

//define first page in dom case one backs out to the directory root (not always the first page visited, but defined as fallback)
$.mobile.firstPage = $pages.first();
//add dialogs, set data-url attrs
$pages.add( "[data-role='dialog']" ).each(function(){
$(this).attr( "data-url", $(this).attr( "id" ));
});

//define page container
$.mobile.pageContainer = $pages.first().parent().addClass( "ui-mobile-viewport" );
//define first page in dom case one backs out to the directory root (not always the first page visited, but defined as fallback)
$.mobile.firstPage = $pages.first();

//cue page loading message
$.mobile.pageLoading();
//define page container
$.mobile.pageContainer = $pages.first().parent().addClass( "ui-mobile-viewport" );

// if hashchange listening is disabled or there's no hash deeplink, change to the first page in the DOM
if( !$.mobile.hashListeningEnabled || !$.mobile.path.stripHash( location.hash ) ){
$.mobile.changePage( $.mobile.firstPage, false, true, false, true );
}
// otherwise, trigger a hashchange to load a deeplink
else {
$window.trigger( "hashchange", [ true ] );
}
// if hashchange listening is disabled or there's no hash deeplink, change to the first page in the DOM
if( !$.mobile.hashListeningEnabled || !$.mobile.path.stripHash( location.hash ) ){
$.mobile.changePage( $.mobile.firstPage, false, true, false, true );
}
// otherwise, trigger a hashchange to load a deeplink
else {
$window.trigger( "hashchange", [ true ] );
}
});
}
});

//dom-ready inits
if($.mobile.autoInitialize){
$($.mobile.initializePage);
// make sure pageLoading is called with false (not done)
$(function(){
$.mobile.pageLoading( false );
});
if( $.mobile.autoInitialize ){
$.mobile.initializePage();
}


//window load event
//hide iOS browser chrome on load
$window.load( $.mobile.silentScroll );
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,11 @@
$.testHelper.reloadLib(libName);

ok($("html").hasClass("ui-mobile-rendering"), "Still in rendering state after library load.");
ok($("html").hasClass("ui-loading"), "pageLoading executed successfully");
ok($(".ui-loader").length, "loader is present");
$.mobile.initializePage();
ok(!$("html").hasClass("ui-mobile-rendering"), "Rendered ok after call to initializePage");
ok(!$("html").hasClass("ui-loading"), "pageLoading removed loading class");
});
});
})(jQuery);