Skip to content

Commit

Permalink
added loadingMessage to $.mobile hash, for i18n. Defaults to "loading…
Browse files Browse the repository at this point in the history
…". If set to false, loading message whill not appear during ajax requests, but ui-loading class will still apply to html element.
  • Loading branch information
scottjehl committed Nov 6, 2010
1 parent c707f63 commit f4b785a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions js/jquery.mobile.js
Expand Up @@ -6,7 +6,7 @@
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/

(function( $, window, undefined ) {

//define jQuery.mobile hash
Expand All @@ -31,6 +31,10 @@
//set default transition
defaultTransition: 'slide',

//show loading message during Ajax requests
//if false, message will not appear, but loading classes will still be toggled on html el
loadingMessage: "loading",

//support conditions that must be met in order to proceed
gradeA: function(){
return jQuery.support.mediaquery;
Expand All @@ -48,7 +52,12 @@
$html = jQuery('html'),
$head = jQuery('head'),
$body,
$loader = jQuery('<div class="ui-loader ui-body-a ui-corner-all"><span class="ui-icon ui-icon-loading spin"></span><h1>loading</h1></div>'),
$loader = $.mobile.loadingMessage ?
jQuery('<div class="ui-loader ui-body-a ui-corner-all">'+
'<span class="ui-icon ui-icon-loading spin"></span>'+
'<h1>'+ $.mobile.loadingMessage +'</h1>'+
'</div>')
: undefined,
$startPage,
$pageContainer,
activeClickedLink = null,
Expand Down Expand Up @@ -174,7 +183,10 @@
if ( done ) {
$html.removeClass( "ui-loading" );
} else {
$loader.appendTo($pageContainer).css({top: $(window).scrollTop() + 75});

if( $.mobile.loadingMessage ){
$loader.appendTo($pageContainer).css({top: $(window).scrollTop() + 75});
}
$html.addClass( "ui-loading" );
}
};
Expand Down

0 comments on commit f4b785a

Please sign in to comment.