Permalink
Browse files

init whitespace

  • Loading branch information...
1 parent 6f666d5 commit e42b785c48dceeceb8077fcac0c83af95c140e37 @johnbender johnbender committed Mar 7, 2012
Showing with 15 additions and 15 deletions.
  1. +15 −15 js/jquery.mobile.init.js
View
@@ -28,25 +28,25 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
// Add mobile, initial load "rendering" classes to docEl
$html.addClass( "ui-mobile ui-mobile-rendering" );
-
- // This is a fallback. If anything goes wrong (JS errors, etc), or events don't fire,
+
+ // This is a fallback. If anything goes wrong (JS errors, etc), or events don't fire,
// this ensures the rendering class is removed after 5 seconds, so content is visible and accessible
setTimeout( hideRenderingClass, 5000 );
// loading div which appears during Ajax requests
// will not appear if $.mobile.loadingMessage is false
var loaderClass = "ui-loader",
$loader = $( "<div class='" + loaderClass + "'><span class='ui-icon ui-icon-loading'></span><h1></h1></div>" );
-
+
// For non-fixed supportin browsers. Position at y center (if scrollTop supported), above the activeBtn (if defined), or just 100px from top
function fakeFixLoader(){
$loader
.css({
top: $.support.scrollTop && $window.scrollTop() + $window.height() / 2 ||
activeBtn.length && activeBtn.offset().top || 100
- });
+ });
}
-
+
// check position of loader to see if it appears to be "fixed" to center
// if not, use abs positioning
function checkLoaderPosition(){
@@ -58,57 +58,57 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
.bind( "scroll", fakeFixLoader );
}
}
-
+
//remove initial build class (only present on first pageshow)
function hideRenderingClass(){
$html.removeClass( "ui-mobile-rendering" );
}
-
+
$.extend($.mobile, {
// turn on/off page loading message.
showPageLoadingMsg: function( theme, msgText, textonly ) {
$html.addClass( "ui-loading" );
-
+
if ( $.mobile.loadingMessage ) {
var activeBtn = $( "." + $.mobile.activeBtnClass ).first(),
theme = theme || $.mobile.loadingMessageTheme,
// text visibility from argument takes priority
textVisible = textonly || $.mobile.loadingMessageTextVisible;
-
+
$loader
.attr( "class", loaderClass + " ui-corner-all ui-body-" + ( theme || "a" ) + " ui-loader-" + ( textVisible ? "verbose" : "default" ) + ( textonly ? " ui-loader-textonly" : "" ) )
.find( "h1" )
.text( msgText || $.mobile.loadingMessage )
.end()
.appendTo( $.mobile.pageContainer );
-
+
checkLoaderPosition();
$window.bind( "scroll", checkLoaderPosition );
}
},
hidePageLoadingMsg: function() {
$html.removeClass( "ui-loading" );
-
+
if( $.mobile.loadingMessage ){
$loader.removeClass( "ui-loader-fakefix" );
}
-
+
$( window ).unbind( "scroll", fakeFixLoader );
},
// find and enhance the pages in the dom and transition to the first page.
initializePage: function() {
// find present pages
var $pages = $( ":jqmData(role='page'), :jqmData(role='dialog')" );
-
+
// if no pages are found, create one with body's inner html
if ( !$pages.length ) {
$pages = $( "body" ).wrapInner( "<div data-" + $.mobile.ns + "role='page'></div>" ).children( 0 );
}
-
+
// add dialogs, set data-url attrs
$pages.each(function() {
var $this = $(this);
@@ -131,7 +131,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
// cue page loading message
$.mobile.showPageLoadingMsg();
-
+
//remove initial build class (only present on first pageshow)
hideRenderingClass();

0 comments on commit e42b785

Please sign in to comment.