Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Coding standards: liberal spacing, functions go snug to front if it's…

… the only argument.
  • Loading branch information...
commit 4b9588381b1a1d33e2d6b1d7434bcfaaf32ce9c1 1 parent 01ad182
@jaspermdegroot jaspermdegroot authored
View
8 js/jquery.mobile.buttonMarkup.js
@@ -7,7 +7,7 @@
define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.vmouse" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
-( function( $, undefined ) {
+(function( $, undefined ) {
$.fn.buttonMarkup = function( options ) {
var $workingSet = this,
@@ -233,10 +233,10 @@ var attachEvents = function() {
}
}
},
- "focusin focus": function( event ){
+ "focusin focus": function( event ) {
$( closestEnabledButton( event.target ) ).addClass( $.mobile.focusClass );
},
- "focusout blur": function( event ){
+ "focusout blur": function( event ) {
$( closestEnabledButton( event.target ) ).removeClass( $.mobile.focusClass );
}
});
@@ -246,7 +246,7 @@ var attachEvents = function() {
//links in bars, or those with data-role become buttons
//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
+$( document ).bind( "pagecreate create", function( e ) {
$( ":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a, .ui-bar > :jqmData(role='controlgroup') > a", e.target )
.not( "button, input, .ui-btn, :jqmData(role='none'), :jqmData(role='nojs')" )
View
4 js/jquery.mobile.controlGroup.js
@@ -33,13 +33,13 @@ $.fn.controlgroup = function( options ) {
// Replace legend with more stylable replacement div
if ( groupheading.length ) {
- $( "<div role='heading' class='ui-controlgroup-label'>" + groupheading.html() + "</div>" ).insertBefore( $el.children(0) );
+ $( "<div role='heading' class='ui-controlgroup-label'>" + groupheading.html() + "</div>" ).insertBefore( $el.children( 0 ) );
groupheading.remove();
}
$el.addClass( "ui-corner-all ui-controlgroup ui-controlgroup-" + o.direction );
- flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ).not('.ui-slider-handle'), flCorners );
+ flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ).not( '.ui-slider-handle' ), flCorners );
flipClasses( $el.find( ".ui-btn-inner" ), flCorners );
if ( o.shadow ) {
View
22 js/jquery.mobile.core.js
@@ -125,12 +125,12 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
// prevent scrollstart and scrollstop events
$.event.special.scrollstart.enabled = false;
- setTimeout(function() {
+ setTimeout( function() {
window.scrollTo( 0, ypos );
$( document ).trigger( "silentscroll", { x: 0, y: ypos });
}, 20 );
- setTimeout(function() {
+ setTimeout( function() {
$.event.special.scrollstart.enabled = true;
}, 150 );
},
@@ -185,8 +185,8 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
// doing a similar parent node traversal to the one found in the inherited theme code above
closestPageData: function( $target ) {
return $target
- .closest(':jqmData(role="page"), :jqmData(role="dialog")')
- .data("page");
+ .closest( ':jqmData(role="page"), :jqmData(role="dialog")' )
+ .data( "page" );
},
enhanceable: function( $set ) {
@@ -198,7 +198,7 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
},
haveParents: function( $set, attr ) {
- if( !$.mobile.ignoreContentEnabled ){
+ if ( !$.mobile.ignoreContentEnabled ) {
return $set;
}
@@ -230,7 +230,7 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
return $newSet;
},
- getScreenHeight: function(){
+ getScreenHeight: function() {
// Native innerHeight returns more accurate value for this across platforms,
// jQuery version is here as a normalized fallback for platforms like Symbian
return window.innerHeight || $( window ).height();
@@ -273,25 +273,25 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
$.removeWithDependents = function( elem ) {
var $elem = $( elem );
- ( $elem.jqmData('dependents') || $() ).remove();
+ ( $elem.jqmData( 'dependents' ) || $() ).remove();
$elem.remove();
};
$.fn.addDependents = function( newDependents ) {
- $.addDependents( $(this), newDependents );
+ $.addDependents( $( this ), newDependents );
};
$.addDependents = function( elem, newDependents ) {
- var dependents = $(elem).jqmData( 'dependents' ) || $();
+ var dependents = $( elem ).jqmData( 'dependents' ) || $();
- $(elem).jqmData( 'dependents', $.merge(dependents, newDependents) );
+ $( elem ).jqmData( 'dependents', $.merge( dependents, newDependents ) );
};
// note that this helper doesn't attempt to handle the callback
// or setting of an html elements text, its only purpose is
// to return the html encoded version of the text in all cases. (thus the name)
$.fn.getEncodedText = function() {
- return $( "<div/>" ).text( $(this).text() ).html();
+ return $( "<div/>" ).text( $( this ).text() ).html();
};
// fluent helper function for the mobile namespaced equivalent
View
2  js/jquery.mobile.define.js
@@ -1,5 +1,5 @@
// creates the define method on window, only used where async loading
// is not desired in the docs and experiments
-window.define = function(){
+window.define = function() {
Array.prototype.slice.call( arguments ).pop()( window.jQuery );
};
View
6 js/jquery.mobile.degradeInputs.js
@@ -26,11 +26,11 @@ $.mobile.page.prototype.options.degradeInputs = {
//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
+$( document ).bind( "pagecreate create", function( e ) {
- var page = $.mobile.closestPageData($(e.target)), options;
+ var page = $.mobile.closestPageData( $( e.target ) ), options;
- if( !page ) {
+ if ( !page ) {
return;
}
View
2  js/jquery.mobile.fieldContain.js
@@ -19,7 +19,7 @@ $.fn.fieldcontain = function( options ) {
};
//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
+$( document ).bind( "pagecreate create", function( e ) {
$( ":jqmData(role='fieldcontain')", e.target ).jqmEnhanceable().fieldcontain();
});
View
4 js/jquery.mobile.grid.js
@@ -15,9 +15,9 @@ $.fn.grid = function( options ) {
var $this = $( this ),
o = $.extend({
grid: null
- },options),
+ }, options ),
$kids = $this.children(),
- gridCols = {solo:1, a:2, b:3, c:4, d:5},
+ gridCols = { solo:1, a:2, b:3, c:4, d:5 },
grid = o.grid,
iterator;
View
16 js/jquery.mobile.init.js
@@ -7,13 +7,13 @@
define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery.mobile.navigation",
"./jquery.mobile.navigation.pushstate", "./widgets/loader", "./jquery.mobile.vmouse", "depend!./jquery.hashchange[jquery]" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
-( function( $, window, undefined ) {
+(function( $, window, undefined ) {
var $html = $( "html" ),
$head = $( "head" ),
$window = $( window );
//remove initial build class (only present on first pageshow)
- function hideRenderingClass(){
+ function hideRenderingClass() {
$html.removeClass( "ui-mobile-rendering" );
}
@@ -40,7 +40,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
// this ensures the rendering class is removed after 5 seconds, so content is visible and accessible
setTimeout( hideRenderingClass, 5000 );
- $.extend($.mobile, {
+ $.extend( $.mobile, {
// find and enhance the pages in the dom and transition to the first page.
initializePage: function() {
// find present pages
@@ -53,10 +53,10 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
// add dialogs, set data-url attrs
$pages.each(function() {
- var $this = $(this);
+ var $this = $( this );
// unless the data url is already set set it to the pathname
- if ( !$this.jqmData("url") ) {
+ if ( !$this.jqmData( "url" ) ) {
$this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname + location.search );
}
});
@@ -106,13 +106,13 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
// if defaultHomeScroll hasn't been set yet, see if scrollTop is 1
// it should be 1 in most browsers, but android treats 1 as 0 (for hiding addr bar)
// so if it's 1, use 0 from now on
- $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $(window).scrollTop() === 1 ) ? 0 : 1;
+ $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $( window ).scrollTop() === 1 ) ? 0 : 1;
// TODO: Implement a proper registration mechanism with dependency handling in order to not have exceptions like the one below
//auto self-init widgets for those widgets that have a soft dependency on others
if ( $.fn.controlgroup ) {
- $( document ).bind( "pagecreate create", function( e ){
+ $( document ).bind( "pagecreate create", function( e ) {
$( ":jqmData(role='controlgroup')", e.target )
.jqmEnhanceable()
.controlgroup({ excludeInvisible: false });
@@ -120,7 +120,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
}
//dom-ready inits
- if( $.mobile.autoInitializePage ){
+ if ( $.mobile.autoInitializePage ) {
$.mobile.initializePage();
}
View
2  js/jquery.mobile.links.js
@@ -8,7 +8,7 @@ define( [ "jquery" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
-$( document ).bind( "pagecreate create", function( e ){
+$( document ).bind( "pagecreate create", function( e ) {
//links within content areas, tests included with page
$( e.target )
View
2  js/jquery.mobile.media.js
@@ -32,7 +32,7 @@ $.mobile.media = (function() {
//must set type for IE!
styleBlock.type = "text/css";
- if ( styleBlock.styleSheet ){
+ if ( styleBlock.styleSheet ) {
styleBlock.styleSheet.cssText = cssrule;
} else {
styleBlock.appendChild( document.createTextNode(cssrule) );
View
142 js/jquery.mobile.navigation.js
@@ -12,7 +12,7 @@ define( [
"./widgets/page",
"./jquery.mobile.transition" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
-( function( $, undefined ) {
+(function( $, undefined ) {
//define vars for interal use
var $window = $( window ),
@@ -179,7 +179,7 @@ define( [
//get path from current hash, or from a file path
get: function( newPath ) {
- if( newPath === undefined ) {
+ if ( newPath === undefined ) {
newPath = location.hash;
}
return path.stripHash( newPath ).replace( /[^\/]*\.[^\/*]+$/, '' );
@@ -218,7 +218,7 @@ define( [
},
isHashValid: function( hash ) {
- return (/^#[^#]+$/).test(hash);
+ return ( /^#[^#]+$/ ).test( hash );
},
//check whether a url is referencing the same domain, or an external domain or different protocol
@@ -263,7 +263,7 @@ define( [
if ( u.protocol !== "" ) {
return ( u.hash && ( u.hrefNoHash === documentUrl.hrefNoHash || ( documentBaseDiffers && u.hrefNoHash === documentBase.hrefNoHash ) ) );
}
- return (/^#/).test( u.href );
+ return ( /^#/ ).test( u.href );
},
@@ -309,7 +309,7 @@ define( [
// addNew is used whenever a new page is added
addNew: function( url, transition, title, pageUrl, role ) {
//if there's forward history, wipe it
- if( urlHistory.getNext() ) {
+ if ( urlHistory.getNext() ) {
urlHistory.clearForward();
}
@@ -330,7 +330,7 @@ define( [
$.each( urlHistory.stack, function( i, historyEntry ) {
//if the url is in the stack, it's a forward or a back
- if( opts.currentUrl === historyEntry.url ) {
+ if ( opts.currentUrl === historyEntry.url ) {
//define back and forward by whether url is older or newer than current page
back = i < urlHistory.activeIndex;
forward = !back;
@@ -341,9 +341,9 @@ define( [
// save new page index, null check to prevent falsey 0 result
this.activeIndex = newActiveIndex !== undefined ? newActiveIndex : this.activeIndex;
- if( back ) {
+ if ( back ) {
( opts.either || opts.isBack )( true );
- } else if( forward ) {
+ } else if ( forward ) {
( opts.either || opts.isForward )( false );
}
},
@@ -405,15 +405,15 @@ define( [
//direct focus to the page title, or otherwise first focusable element
$.mobile.focusPage = function ( page ) {
- var autofocus = page.find("[autofocus]"),
+ var autofocus = page.find( "[autofocus]" ),
pageTitle = page.find( ".ui-title:eq(0)" );
- if( autofocus.length ) {
+ if ( autofocus.length ) {
autofocus.focus();
return;
}
- if( pageTitle.length ) {
+ if ( pageTitle.length ) {
pageTitle.focus();
} else{
page.focus();
@@ -422,7 +422,7 @@ define( [
//remove active classes after page transition or error
function removeActiveLinkClass( forceRemoval ) {
- if( !!$activeClickedLink && ( !$activeClickedLink.closest( "." + $.mobile.activePageClass ).length || forceRemoval ) ) {
+ if ( !!$activeClickedLink && ( !$activeClickedLink.closest( "." + $.mobile.activePageClass ).length || forceRemoval ) ) {
$activeClickedLink.removeClass( $.mobile.activeBtnClass );
}
$activeClickedLink = null;
@@ -430,7 +430,7 @@ define( [
function releasePageTransitionLock() {
isPageTransitioning = false;
- if( pageTransitionQueue.length > 0 ) {
+ if ( pageTransitionQueue.length > 0 ) {
$.mobile.changePage.apply( null, pageTransitionQueue.pop() );
}
}
@@ -442,13 +442,13 @@ define( [
setLastScroll = function() {
// this barrier prevents setting the scroll value based on the browser
// scrolling the window based on a hashchange
- if( !setLastScrollEnabled ) {
+ if ( !setLastScrollEnabled ) {
return;
}
var active = $.mobile.urlHistory.getActive();
- if( active ) {
+ if ( active ) {
var lastScroll = $window.scrollTop();
// Set active page's lastScroll prop.
@@ -478,7 +478,7 @@ define( [
});
// wait until the mobile page container has been determined to bind to pagechange
- $window.one( "pagecontainercreate", function(){
+ $window.one( "pagecontainercreate", function() {
// once the page has changed, re-enable the scroll recording
$.mobile.pageContainer.bind( "pagechange", function() {
@@ -506,7 +506,7 @@ define( [
//function for transitioning between two existing pages
function transitionPages( toPage, fromPage, transition, reverse ) {
- if( fromPage ) {
+ if ( fromPage ) {
//trigger before show/hide events
fromPage.data( "page" )._trigger( "beforehide", null, { nextPage: toPage } );
}
@@ -527,7 +527,7 @@ define( [
promise.done(function() {
//trigger show/hide events
- if( fromPage ) {
+ if ( fromPage ) {
fromPage.data( "page" )._trigger( "hide", null, { nextPage: toPage } );
}
@@ -539,7 +539,7 @@ define( [
}
//simply set the active page's minimum height to screen height, depending on orientation
- function resetActivePageHeight(){
+ function resetActivePageHeight() {
var aPage = $( "." + $.mobile.activePageClass ),
aPagePadT = parseFloat( aPage.css( "padding-top" ) ),
aPagePadB = parseFloat( aPage.css( "padding-bottom" ) ),
@@ -553,7 +553,7 @@ define( [
function enhancePage( $page, role ) {
// If a role was specified, make sure the data-role attribute
// on the page element is in sync.
- if( role ) {
+ if ( role ) {
$page.attr( "data-" + $.mobile.ns + "role", role );
}
@@ -565,7 +565,7 @@ define( [
//animation complete callback
$.fn.animationComplete = function( callback ) {
- if( $.support.cssTransitions ) {
+ if ( $.support.cssTransitions ) {
return $( this ).one( 'webkitAnimationEnd animationend', callback );
}
else{
@@ -592,21 +592,21 @@ define( [
$.mobile.allowCrossDomainPages = false;
//return the original document url
- $.mobile.getDocumentUrl = function(asParsedObject) {
+ $.mobile.getDocumentUrl = function( asParsedObject ) {
return asParsedObject ? $.extend( {}, documentUrl ) : documentUrl.href;
};
//return the original document base url
- $.mobile.getDocumentBase = function(asParsedObject) {
+ $.mobile.getDocumentBase = function( asParsedObject ) {
return asParsedObject ? $.extend( {}, documentBase ) : documentBase.href;
};
$.mobile._bindPageRemove = function() {
- var page = $(this);
+ var page = $( this );
// when dom caching is not enabled or the page is embedded bind to remove the page on hide
- if( !page.data("page").options.domCache &&
- page.is(":jqmData(external-page='true')") ) {
+ if ( !page.data( "page" ).options.domCache &&
+ page.is( ":jqmData(external-page='true')" ) ) {
page.bind( 'pagehide.remove', function() {
var $this = $( this ),
@@ -614,7 +614,7 @@ define( [
$this.trigger( prEvent );
- if( !prEvent.isDefaultPrevented() ){
+ if ( !prEvent.isDefaultPrevented() ) {
$this.removeWithDependents();
}
});
@@ -641,7 +641,7 @@ define( [
dupCachedPage = null,
// determine the current base url
- findBaseWithDefault = function(){
+ findBaseWithDefault = function() {
var closestBase = ( $.mobile.activePage && getClosestBaseUrl( $.mobile.activePage ) );
return closestBase || documentBase.hrefNoHash;
},
@@ -659,7 +659,7 @@ define( [
}
// If the caller is using a "post" request, reloadPage must be true
- if( settings.data && settings.type === "post" ){
+ if ( settings.data && settings.type === "post" ) {
settings.reloadPage = true;
}
@@ -738,19 +738,19 @@ define( [
mpc.trigger( pblEvent, triggerData );
// If the default behavior is prevented, stop here!
- if( pblEvent.isDefaultPrevented() ){
+ if ( pblEvent.isDefaultPrevented() ) {
return deferred.promise();
}
if ( settings.showLoadMsg ) {
// This configurable timeout allows cached pages a brief delay to load without showing a message
- var loadMsgDelay = setTimeout(function(){
+ var loadMsgDelay = setTimeout(function() {
$.mobile.showPageLoadingMsg();
}, settings.loadMsgDelay ),
// Shared logic for clearing timeout and removing message.
- hideMsg = function(){
+ hideMsg = function() {
// Stop message show timer
clearTimeout( loadMsgDelay );
@@ -784,7 +784,7 @@ define( [
// data-url must be provided for the base tag so resource requests can be directed to the
// correct url. loading into a temprorary element makes these requests immediately
- if( pageElemRegex.test( html ) &&
+ if ( pageElemRegex.test( html ) &&
RegExp.$1 &&
dataUrlRegex.test( RegExp.$1 ) &&
RegExp.$1 ) {
@@ -800,7 +800,7 @@ define( [
page = all.find( ":jqmData(role='page'), :jqmData(role='dialog')" ).first();
//if page elem couldn't be found, create one and insert the body element's contents
- if( !page.length ){
+ if ( !page.length ) {
page = $( "<div data-" + $.mobile.ns + "role='page'>" + html.split( /<\/?body[^>]*>/gmi )[1] + "</div>" );
}
@@ -812,11 +812,11 @@ define( [
}
//rewrite src and href attrs to use a base url
- if( !$.support.dynamicBaseTag ) {
+ if ( !$.support.dynamicBaseTag ) {
var newPath = path.get( fileUrl );
page.find( "[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]" ).each(function() {
var thisAttr = $( this ).is( '[href]' ) ? 'href' :
- $(this).is('[src]') ? 'src' : 'action',
+ $( this ).is( '[src]' ) ? 'src' : 'action',
thisUrl = $( this ).attr( thisAttr );
// XXX_jblas: We need to fix this so that it removes the document
@@ -824,7 +824,7 @@ define( [
//if full path exists and is same, chop it - helps IE out
thisUrl = thisUrl.replace( location.protocol + '//' + location.host + location.pathname, '' );
- if( !/^(\w+:|#|\/)/.test( thisUrl ) ) {
+ if ( !/^(\w+:|#|\/)/.test( thisUrl ) ) {
$( this ).attr( thisAttr, newPath + thisUrl );
}
});
@@ -870,7 +870,7 @@ define( [
},
error: function( xhr, textStatus, errorThrown ) {
//set base back to current path
- if( base ) {
+ if ( base ) {
base.set( path.get() );
}
@@ -888,7 +888,7 @@ define( [
// Note that it is the responsibility of the listener/handler
// that called preventDefault(), to resolve/reject the
// deferred object within the triggerData.
- if( plfEvent.isDefaultPrevented() ){
+ if ( plfEvent.isDefaultPrevented() ) {
return;
}
@@ -928,7 +928,7 @@ define( [
// 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.
- if( isPageTransitioning ) {
+ if ( isPageTransitioning ) {
pageTransitionQueue.unshift( arguments );
return;
}
@@ -949,7 +949,7 @@ define( [
mpc.trigger( pbcEvent, triggerData );
// If the default behavior is prevented, stop here!
- if( pbcEvent.isDefaultPrevented() ){
+ if ( pbcEvent.isDefaultPrevented() ) {
return;
}
@@ -1019,12 +1019,12 @@ define( [
// It is up to the developer that turns on the allowSamePageTransitiona option
// to either turn off transition animations, or make sure that an appropriate
// animation transition is used.
- if( fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition ) {
+ if ( fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition ) {
isPageTransitioning = false;
mpc.trigger( "pagechange", triggerData );
// Even if there is no page change to be done, we should keep the urlHistory in sync with the hash changes
- if( settings.fromHashChange ) {
+ if ( settings.fromHashChange ) {
urlHistory.directHashChange({
currentUrl: url,
isBack: function() {},
@@ -1041,7 +1041,7 @@ define( [
// If the changePage request was sent from a hashChange event, check to see if the
// page is already within the urlHistory stack. If so, we'll assume the user hit
// the forward/back button and will try to match the transition accordingly.
- if( settings.fromHashChange ) {
+ if ( settings.fromHashChange ) {
urlHistory.directHashChange({
currentUrl: url,
isBack: function() { historyDir = -1; },
@@ -1056,12 +1056,12 @@ define( [
// Wrap this in a try/catch block since IE9 throw "Unspecified error" if document.activeElement
// is undefined when we are in an IFrame.
try {
- if(document.activeElement && document.activeElement.nodeName.toLowerCase() !== 'body') {
- $(document.activeElement).blur();
+ if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== 'body' ) {
+ $( document.activeElement ).blur();
} else {
$( "input:focus, textarea:focus, select:focus" ).blur();
}
- } catch(e) {}
+ } catch( e ) {}
// Record whether we are at a place in history where a dialog used to be - if so, do not add a new history entry and do not change the hash either
var alreadyThere = false;
@@ -1095,7 +1095,7 @@ define( [
}
// Set the location hash.
- if( settings.changeHash !== false && url ) {
+ if ( settings.changeHash !== false && url ) {
//disable hash listening temporarily
urlHistory.ignoreNextHashChange = true;
//update hash and history
@@ -1104,8 +1104,8 @@ define( [
// if title element wasn't found, try the page div data attr too
// If this is a deep-link or a reload ( active === undefined ) then just use pageTitle
- var newPageTitle = ( !active )? pageTitle : toPage.jqmData( "title" ) || toPage.children(":jqmData(role='header')").find(".ui-title" ).getEncodedText();
- if( !!newPageTitle && pageTitle === document.title ) {
+ var newPageTitle = ( !active )? pageTitle : toPage.jqmData( "title" ) || toPage.children( ":jqmData(role='header')" ).find( ".ui-title" ).getEncodedText();
+ if ( !!newPageTitle && pageTitle === document.title ) {
pageTitle = newPageTitle;
}
if ( !toPage.jqmData( "title" ) ) {
@@ -1118,7 +1118,7 @@ define( [
( isDialog ? $.mobile.defaultDialogTransition : $.mobile.defaultPageTransition );
//add page to history stack if it's not back or forward
- if( !historyDir && !alreadyThere ) {
+ if ( !historyDir && !alreadyThere ) {
urlHistory.addNew( url, settings.transition, pageTitle, pageUrl, settings.role );
}
@@ -1144,7 +1144,7 @@ define( [
// itself to avoid ie bug that reports offsetWidth as > 0 (core check for visibility)
// despite visibility: hidden addresses issue #2965
// https://github.com/jquery/jquery-mobile/issues/2965
- if( !alreadyFocused ){
+ if ( !alreadyFocused ) {
$.mobile.focusPage( toPage );
}
@@ -1205,14 +1205,14 @@ define( [
//The following event bindings should be bound after mobileinit has been triggered
//the following deferred is resolved in the init file
$.mobile.navreadyDeferred = $.Deferred();
- $.mobile.navreadyDeferred.done( function(){
+ $.mobile.navreadyDeferred.done(function() {
//bind to form submit events, handle with Ajax
$( document ).delegate( "form", "submit", function( event ) {
var $this = $( this );
- if( !$.mobile.ajaxEnabled ||
+ if ( !$.mobile.ajaxEnabled ||
// test that the form is, itself, ajax false
- $this.is(":jqmData(ajax='false')") ||
+ $this.is( ":jqmData(ajax='false')" ) ||
// test that $.mobile.ignoreContentEnabled is set and
// the form or one of it's parents is ajax=false
!$this.jqmHijackable().length ) {
@@ -1240,9 +1240,9 @@ define( [
}
}
- url = path.makeUrlAbsolute( url, getClosestBaseUrl($this) );
+ url = path.makeUrlAbsolute( url, getClosestBaseUrl( $this ) );
- if(( path.isExternal( url ) && !path.isPermittedCrossDomainRequest(documentUrl, url)) || target ) {
+ if ( ( path.isExternal( url ) && !path.isPermittedCrossDomainRequest( documentUrl, url ) ) || target ) {
return;
}
@@ -1272,7 +1272,7 @@ define( [
// split from the previous return logic to avoid find closest where possible
// TODO teach $.mobile.hijackable to operate on raw dom elements so the link wrapping
// can be avoided
- if ( !$(link).jqmHijackable().length ) {
+ if ( !$( link ).jqmHijackable().length ) {
return;
}
@@ -1287,7 +1287,7 @@ define( [
// click routing - direct to HTTP or Ajax, accordingly
$( document ).bind( "click", function( event ) {
- if( !$.mobile.linkBindingEnabled ){
+ if ( !$.mobile.linkBindingEnabled ) {
return;
}
@@ -1302,12 +1302,12 @@ define( [
}
//remove active link class if external (then it won't be there if you come back)
- httpCleanup = function(){
- window.setTimeout( function() { removeActiveLinkClass( true ); }, 200 );
+ httpCleanup = function() {
+ window.setTimeout(function() { removeActiveLinkClass( true ); }, 200 );
};
//if there's a data-rel=back attr, go back in history
- if( $link.is( ":jqmData(rel='back')" ) ) {
+ if ( $link.is( ":jqmData(rel='back')" ) ) {
window.history.back();
return false;
}
@@ -1318,7 +1318,7 @@ define( [
href = path.makeUrlAbsolute( $link.attr( "href" ) || "#", baseUrl );
//if ajax is disabled, exit early
- if( !$.mobile.ajaxEnabled && !path.isEmbeddedPage( href ) ){
+ if ( !$.mobile.ajaxEnabled && !path.isEmbeddedPage( href ) ) {
httpCleanup();
//use default click handling
return;
@@ -1362,9 +1362,9 @@ define( [
//check for protocol or rel and its not an embedded page
//TODO overlap in logic from isExternal, rel=external check should be
// moved into more comprehensive isExternalLink
- isExternal = useDefaultUrlHandling || ( path.isExternal( href ) && !path.isPermittedCrossDomainRequest(documentUrl, href) );
+ isExternal = useDefaultUrlHandling || ( path.isExternal( href ) && !path.isPermittedCrossDomainRequest( documentUrl, href ) );
- if( isExternal ) {
+ if ( isExternal ) {
httpCleanup();
//use default click handling
return;
@@ -1391,14 +1391,14 @@ define( [
//prefetch pages when anchors with data-prefetch are encountered
$( document ).delegate( ".ui-page", "pageshow.prefetch", function() {
var urls = [];
- $( this ).find( "a:jqmData(prefetch)" ).each(function(){
- var $link = $(this),
+ $( this ).find( "a:jqmData(prefetch)" ).each(function() {
+ var $link = $( this ),
url = $link.attr( "href" );
if ( url && $.inArray( url, urls ) === -1 ) {
urls.push( url );
- $.mobile.loadPage( url, {role: $link.attr("data-" + $.mobile.ns + "rel")} );
+ $.mobile.loadPage( url, { role: $link.attr( "data-" + $.mobile.ns + "rel" ) } );
}
});
});
@@ -1422,17 +1422,17 @@ define( [
}
//if listening is disabled (either globally or temporarily), or it's a dialog hash
- if( !$.mobile.hashListeningEnabled || urlHistory.ignoreNextHashChange ) {
+ if ( !$.mobile.hashListeningEnabled || urlHistory.ignoreNextHashChange ) {
urlHistory.ignoreNextHashChange = false;
return;
}
// special case for dialogs
- if( urlHistory.stack.length > 1 && to.indexOf( dialogHashKey ) > -1 && urlHistory.initialDst !== to ) {
+ if ( urlHistory.stack.length > 1 && to.indexOf( dialogHashKey ) > -1 && urlHistory.initialDst !== to ) {
// If current active page is not a dialog skip the dialog and continue
// in the same direction
- if(!$.mobile.activePage.is( ".ui-dialog" )) {
+ if ( !$.mobile.activePage.is( ".ui-dialog" ) ) {
//determine if we're heading forward or backward and continue accordingly past
//the current dialog
urlHistory.directHashChange({
View
16 js/jquery.mobile.navigation.pushstate.js
@@ -5,7 +5,7 @@
define( [ "jquery", "./jquery.mobile.navigation", "depend!./jquery.hashchange[jquery]" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
-( function( $, window ) {
+(function( $, window ) {
// For now, let's Monkeypatch this onto the end of $.mobile._registerInternalEvents
// Scope self to pushStateHandler so we can reference it sanely within the
// methods handed off as event handlers
@@ -47,9 +47,9 @@ define( [ "jquery", "./jquery.mobile.navigation", "depend!./jquery.hashchange[jq
subkey = "&" + $.mobile.subPageUrlKey,
dialogIndex = url.indexOf( dialog );
- if( dialogIndex > -1 ) {
+ if ( dialogIndex > -1 ) {
url = url.slice( 0, dialogIndex ) + "#" + url.slice( dialogIndex );
- } else if( url.indexOf( subkey ) > -1 ) {
+ } else if ( url.indexOf( subkey ) > -1 ) {
url = url.split( subkey ).join( "#" + subkey );
}
@@ -67,7 +67,7 @@ define( [ "jquery", "./jquery.mobile.navigation", "depend!./jquery.hashchange[jq
// handling has taken place and set the state of the DOM
onHashChange: function( e ) {
// disable this hash change
- if( self.onHashChangeDisabled ){
+ if ( self.onHashChangeDisabled ) {
return;
}
@@ -109,7 +109,7 @@ define( [ "jquery", "./jquery.mobile.navigation", "depend!./jquery.hashchange[jq
fromHash, toHash, hashChanged;
// if there's no state its not a popstate we care about, eg chrome's initial popstate
- if( poppedState ) {
+ if ( poppedState ) {
// if we get two pop states in under this.hashChangeTimeout
// make sure to clear any timer set for the previous change
clearTimeout( self.hashChangeEnableTimer );
@@ -127,7 +127,7 @@ define( [ "jquery", "./jquery.mobile.navigation", "depend!./jquery.hashchange[jq
// change event that comes on all popstates courtesy of browsers like Android
self.hashChangeEnableTimer = setTimeout( function() {
self.nextHashChangePrevented( false );
- }, self.hashChangeTimeout);
+ }, self.hashChangeTimeout );
}
},
@@ -145,8 +145,8 @@ define( [ "jquery", "./jquery.mobile.navigation", "depend!./jquery.hashchange[jq
});
// We need to init when "mobileinit", "domready", and "navready" have all happened
- $.when( domreadyDeferred, mobileinitDeferred, $.mobile.navreadyDeferred ).done( function() {
- if( $.mobile.pushStateEnabled && $.support.pushState ){
+ $.when( domreadyDeferred, mobileinitDeferred, $.mobile.navreadyDeferred ).done(function() {
+ if ( $.mobile.pushStateEnabled && $.support.pushState ) {
pushStateHandler.init();
}
});
View
2  js/jquery.mobile.nojs.js
@@ -7,7 +7,7 @@ define( [ "jquery" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
-$( document ).bind( "pagecreate create", function( e ){
+$( document ).bind( "pagecreate create", function( e ) {
$( ":jqmData(role='nojs')", e.target ).addClass( "ui-nojs" );
});
View
20 js/jquery.mobile.support.js
@@ -19,7 +19,7 @@ function propExists( prop ) {
var uc_prop = prop.charAt( 0 ).toUpperCase() + prop.substr( 1 ),
props = ( prop + " " + vendors.join( uc_prop + " " ) + uc_prop ).split( " " );
- for ( var v in props ){
+ for ( var v in props ) {
if ( fbCSS[ props[ v ] ] !== undefined ) {
return true;
}
@@ -27,7 +27,7 @@ function propExists( prop ) {
}
function validStyle( prop, value, check_vend ) {
- var div = document.createElement('div'),
+ var div = document.createElement( 'div' ),
uc = function( txt ) {
return txt.charAt( 0 ).toUpperCase() + txt.substr( 1 );
},
@@ -41,7 +41,7 @@ function validStyle( prop, value, check_vend ) {
div.setAttribute( "style", vend_prop );
- if( !!div.style[ propStyle ] ) {
+ if ( !!div.style[ propStyle ] ) {
ret = true;
}
},
@@ -86,22 +86,22 @@ function baseTagTest() {
// Thanks Modernizr
function cssPointerEventsTest() {
- var element = document.createElement('x'),
+ var element = document.createElement( 'x' ),
documentElement = document.documentElement,
getComputedStyle = window.getComputedStyle,
supports;
- if( !( 'pointerEvents' in element.style ) ){
+ if ( !( 'pointerEvents' in element.style ) ) {
return false;
}
element.style.pointerEvents = 'auto';
element.style.pointerEvents = 'x';
- documentElement.appendChild(element);
+ documentElement.appendChild( element );
supports = getComputedStyle &&
- getComputedStyle( element, '' ).pointerEvents === 'auto';
+ getComputedStyle( element, '' ).pointerEvents === 'auto';
documentElement.removeChild( element );
- return !!supports;
+ return !!supports;
}
@@ -141,7 +141,7 @@ fakeBody.remove();
// or that generally work better browsing in regular http for full page refreshes (Opera Mini)
// Note: This detection below is used as a last resort.
// We recommend only using these detection methods when all other more reliable/forward-looking approaches are not possible
-var nokiaLTE7_3 = (function(){
+var nokiaLTE7_3 = (function() {
var ua = window.navigator.userAgent;
@@ -154,7 +154,7 @@ var nokiaLTE7_3 = (function(){
// Support conditions that must be met in order to proceed
// default enhanced qualifications are media query support OR IE 7+
-$.mobile.gradeA = function(){
+$.mobile.gradeA = function() {
return $.support.mediaquery || $.mobile.browser.ie && $.mobile.browser.ie >= 7;
};
View
36 js/jquery.mobile.transition.js
@@ -10,10 +10,10 @@ define( [ "jquery", "./jquery.mobile.core" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, window, undefined ) {
-var createHandler = function( sequential ){
+var createHandler = function( sequential ) {
// Default to sequential
- if( sequential === undefined ){
+ if ( sequential === undefined ) {
sequential = true;
}
@@ -27,10 +27,10 @@ var createHandler = function( sequential ){
maxTransitionOverride = $.mobile.maxTransitionWidth !== false && $( window ).width() > $.mobile.maxTransitionWidth,
none = !$.support.cssTransitions || maxTransitionOverride || !name || name === "none" || Math.max( $( window ).scrollTop(), toScroll ) > $.mobile.getMaxScrollForTransition(),
toPreClass = " ui-page-pre-in",
- toggleViewportClass = function(){
+ toggleViewportClass = function() {
$.mobile.pageContainer.toggleClass( "ui-mobile-viewport-transitioning viewport-" + name );
},
- scrollPage = function(){
+ scrollPage = function() {
// By using scrollTo instead of silentScroll, we can keep things better in order
// Just to be precautios, disable scrollstart listening like silentScroll would
$.event.special.scrollstart.enabled = false;
@@ -38,18 +38,18 @@ var createHandler = function( sequential ){
window.scrollTo( 0, toScroll );
// reenable scrollstart listening like silentScroll would
- setTimeout(function() {
+ setTimeout( function() {
$.event.special.scrollstart.enabled = true;
}, 150 );
},
- cleanFrom = function(){
+ cleanFrom = function() {
$from
.removeClass( $.mobile.activePageClass + " out in reverse " + name )
.height( "" );
},
- startOut = function(){
+ startOut = function() {
// if it's not sequential, call the doneOut transition to start the TO page animating in simultaneously
- if( !sequential ){
+ if ( !sequential ) {
doneOut();
}
else {
@@ -59,7 +59,7 @@ var createHandler = function( sequential ){
// Set the from page's height and start it transitioning out
// Note: setting an explicit height helps eliminate tiling in the transitions
$from
- .height( screenHeight + $(window ).scrollTop() )
+ .height( screenHeight + $( window ).scrollTop() )
.addClass( name + " out" + reverseClass );
},
@@ -72,10 +72,10 @@ var createHandler = function( sequential ){
startIn();
},
- startIn = function(){
+ startIn = function() {
// Prevent flickering in phonegap container: see comments at #4024 regarding iOS
- $to.css("z-index", -10);
+ $to.css( "z-index", -10 );
$to.addClass( $.mobile.activePageClass + toPreClass );
@@ -87,10 +87,10 @@ var createHandler = function( sequential ){
scrollPage();
- // Restores visibility of the new page: added together with $to.css("z-index", -10);
- $to.css("z-index", "");
+ // Restores visibility of the new page: added together with $to.css( "z-index", -10 );
+ $to.css( "z-index", "" );
- if( !none ){
+ if ( !none ) {
$to.animationComplete( doneIn );
}
@@ -98,7 +98,7 @@ var createHandler = function( sequential ){
.removeClass( toPreClass )
.addClass( name + " in" + reverseClass );
- if( none ){
+ if ( none ) {
doneIn();
}
@@ -108,7 +108,7 @@ var createHandler = function( sequential ){
if ( !sequential ) {
- if( $from ){
+ if ( $from ) {
cleanFrom();
}
}
@@ -121,7 +121,7 @@ var createHandler = function( sequential ){
// In some browsers (iOS5), 3D transitions block the ability to scroll to the desired location during transition
// This ensures we jump to that spot after the fact, if we aren't there already.
- if( $( window ).scrollTop() !== toScroll ){
+ if ( $( window ).scrollTop() !== toScroll ) {
scrollPage();
}
@@ -162,7 +162,7 @@ $.mobile.transitionFallbacks = {};
// If transition is defined, check if css 3D transforms are supported, and if not, if a fallback is specified
$.mobile._maybeDegradeTransition = function( transition ) {
- if( transition && !$.support.cssTransform3d && $.mobile.transitionFallbacks[ transition ] ){
+ if ( transition && !$.support.cssTransform3d && $.mobile.transitionFallbacks[ transition ] ) {
transition = $.mobile.transitionFallbacks[ transition ];
}
View
30 js/jquery.mobile.vmouse.js
@@ -61,7 +61,7 @@ function createVirtualEvent( event, eventType ) {
var t = event.type,
oe, props, ne, prop, ct, touch, i, j, len;
- event = $.Event(event);
+ event = $.Event( event );
event.type = eventType;
oe = event.originalEvent;
@@ -85,7 +85,7 @@ function createVirtualEvent( event, eventType ) {
// make sure that if the mouse and click virtual events are generated
// without a .which one is defined
- if ( t.search(/mouse(down|up)|click/) > -1 && !event.which ){
+ if ( t.search(/mouse(down|up)|click/) > -1 && !event.which ) {
event.which = 1;
}
@@ -93,10 +93,10 @@ function createVirtualEvent( event, eventType ) {
ne = getNativeEvent( oe );
t = ne.touches;
ct = ne.changedTouches;
- touch = ( t && t.length ) ? t[0] : ( (ct && ct.length) ? ct[ 0 ] : undefined );
+ touch = ( t && t.length ) ? t[0] : ( ( ct && ct.length ) ? ct[ 0 ] : undefined );
if ( touch ) {
- for ( j = 0, len = touchEventProps.length; j < len; j++){
+ for ( j = 0, len = touchEventProps.length; j < len; j++) {
prop = touchEventProps[ j ];
event[ prop ] = touch[ prop ];
}
@@ -165,14 +165,14 @@ function disableMouseBindings() {
function startResetTimer() {
clearResetTimer();
- resetTimerID = setTimeout(function(){
+ resetTimerID = setTimeout( function() {
resetTimerID = 0;
enableMouseBindings();
}, $.vmouse.resetTimerDuration );
}
function clearResetTimer() {
- if ( resetTimerID ){
+ if ( resetTimerID ) {
clearTimeout( resetTimerID );
resetTimerID = 0;
}
@@ -193,9 +193,9 @@ function triggerVirtualEvent( eventType, event, flags ) {
}
function mouseEventCallback( event ) {
- var touchID = $.data(event.target, touchTargetPropertyName);
+ var touchID = $.data( event.target, touchTargetPropertyName );
- if ( !blockMouseTriggers && ( !lastTouchID || lastTouchID !== touchID ) ){
+ if ( !blockMouseTriggers && ( !lastTouchID || lastTouchID !== touchID ) ) {
var ve = triggerVirtualEvent( "v" + event.type, event );
if ( ve ) {
if ( ve.isDefaultPrevented() ) {
@@ -265,8 +265,8 @@ function handleTouchMove( event ) {
flags = getVirtualBindingFlags( event.target );
didScroll = didScroll ||
- ( Math.abs(t.pageX - startX) > moveThreshold ||
- Math.abs(t.pageY - startY) > moveThreshold );
+ ( Math.abs( t.pageX - startX ) > moveThreshold ||
+ Math.abs( t.pageY - startY ) > moveThreshold );
if ( didScroll && !didCancel ) {
@@ -327,7 +327,7 @@ function hasVirtualBindings( ele ) {
return false;
}
-function dummyMouseHandler(){}
+function dummyMouseHandler() {}
function getSpecialEventObject( eventType ) {
var realType = eventType.substr( 1 );
@@ -338,7 +338,7 @@ function getSpecialEventObject( eventType ) {
// add a bindings object to its data.
if ( !hasVirtualBindings( this ) ) {
- $.data( this, dataPropertyName, {});
+ $.data( this, dataPropertyName, {} );
}
// If setup is called, we know it is the first binding for this
@@ -368,7 +368,7 @@ function getSpecialEventObject( eventType ) {
activeDocHandlers[ "touchstart" ] = ( activeDocHandlers[ "touchstart" ] || 0) + 1;
- if (activeDocHandlers[ "touchstart" ] === 1) {
+ if ( activeDocHandlers[ "touchstart" ] === 1 ) {
$document.bind( "touchstart", handleTouchStart )
.bind( "touchend", handleTouchEnd )
@@ -440,7 +440,7 @@ function getSpecialEventObject( eventType ) {
// Expose our custom events to the jQuery bind/unbind mechanism.
-for ( var i = 0; i < virtualEventNames.length; i++ ){
+for ( var i = 0; i < virtualEventNames.length; i++ ) {
$.event.special[ virtualEventNames[ i ] ] = getSpecialEventObject( virtualEventNames[ i ] );
}
@@ -448,7 +448,7 @@ for ( var i = 0; i < virtualEventNames.length; i++ ){
// Note that we require event capture support for this so if the device
// doesn't support it, we punt for now and rely solely on mouse events.
if ( eventCaptureSupported ) {
- document.addEventListener( "click", function( e ){
+ document.addEventListener( "click", function( e ) {
var cnt = clickBlockList.length,
target = e.target,
x, y, ele, i, o, touchID;
View
2  js/jquery.mobile.widget.js
@@ -56,7 +56,7 @@ $.widget( "mobile.widget", {
// Currently the keepNative value is defined on the page prototype so
// the method is as well
page = $.mobile.closestPageData( $widgetElements );
- keepNative = (page && page.keepNativeSelector()) || "";
+ keepNative = ( page && page.keepNativeSelector()) || "";
$widgetElements = $widgetElements.not( keepNative );
}
View
12 js/jquery.mobile.zoom.iosorientationfix.js
@@ -5,17 +5,17 @@
define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.zoom" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
-( function( $, window ) {
+(function( $, window ) {
// This fix addresses an iOS bug, so return early if the UA claims it's something else.
- if( !(/iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1 ) ){
+ if ( !(/iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1 ) ) {
return;
}
var zoom = $.mobile.zoom,
evt, x, y, z, aig;
- function checkTilt( e ){
+ function checkTilt( e ) {
evt = e.originalEvent;
aig = evt.accelerationIncludingGravity;
@@ -24,11 +24,11 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.zoom" ], function(
z = Math.abs( aig.z );
// If portrait orientation and in one of the danger zones
- if( !window.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ){
- if( zoom.enabled ){
+ if ( !window.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ) {
+ if ( zoom.enabled ) {
zoom.disable();
}
- } else if( !zoom.enabled ){
+ } else if ( !zoom.enabled ) {
zoom.enable();
}
}
View
8 js/jquery.mobile.zoom.js
@@ -5,7 +5,7 @@
define( [ "jquery", "./jquery.mobile.core" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
-( function( $ ) {
+(function( $ ) {
var meta = $( "meta[name=viewport]" ),
initialContent = meta.attr( "content" ),
disabledZoom = initialContent + ",maximum-scale=1, user-scalable=no",
@@ -16,21 +16,21 @@ define( [ "jquery", "./jquery.mobile.core" ], function( $ ) {
enabled: !disabledInitially,
locked: false,
disable: function( lock ) {
- if( !disabledInitially && !$.mobile.zoom.locked ){
+ if ( !disabledInitially && !$.mobile.zoom.locked ) {
meta.attr( "content", disabledZoom );
$.mobile.zoom.enabled = false;
$.mobile.zoom.locked = lock || false;
}
},
enable: function( unlock ) {
- if( !disabledInitially && ( !$.mobile.zoom.locked || unlock === true ) ){
+ if ( !disabledInitially && ( !$.mobile.zoom.locked || unlock === true ) ) {
meta.attr( "content", enabledZoom );
$.mobile.zoom.enabled = true;
$.mobile.zoom.locked = false;
}
},
restore: function() {
- if( !disabledInitially ){
+ if ( !disabledInitially ) {
meta.attr( "content", initialContent );
$.mobile.zoom.enabled = true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.