jquery.mobile.dialog.js: Whitespace changes and string delimiters, bringing this up to jQuery coding standards. Renamed one memory variable for legibility and clarity.

Signed-off-by: Steven Black <steveb@stevenblack.com>
This commit is contained in:
Steven Black 2011-05-26 10:01:39 -04:00
parent a4ee2d5bbb
commit ab76ac33ac

View file

@ -4,57 +4,56 @@
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change * Note: Code is in draft form and is subject to change
*/ */
(function($, undefined ) { ( function( $, undefined ) {
$.widget( "mobile.dialog", $.mobile.widget, { $.widget( "mobile.dialog", $.mobile.widget, {
options: { options: {
closeBtnText: "Close" closeBtnText: "Close"
}, },
_create: function(){ _create: function() {
var self = this, var self = this,
$el = self.element; $el = self.element;
/* class the markup for dialog styling */ /* class the markup for dialog styling */
this.element this.element
//add ARIA role //add ARIA role
.attr("role","dialog") .attr( "role", "dialog" )
.addClass('ui-page ui-dialog ui-body-a') .addClass( "ui-page ui-dialog ui-body-a" )
.find( ":jqmData(role=header)" ) .find( ":jqmData(role=header)" )
.addClass('ui-corner-top ui-overlay-shadow') .addClass( "ui-corner-top ui-overlay-shadow" )
.prepend( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "iconpos='notext'>"+ this.options.closeBtnText +"</a>" ) .prepend( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "iconpos='notext'>"+ this.options.closeBtnText +"</a>" )
.end() .end()
.find('.ui-content:not([class*="ui-body-"])') .find( '.ui-content:not([class*="ui-body-"])' )
.addClass('ui-body-c') .addClass( 'ui-body-c' )
.end() .end()
.find( ".ui-content,:jqmData(role='footer')" ) .find( ".ui-content,:jqmData(role='footer')" )
.last() .last()
.addClass('ui-corner-bottom ui-overlay-shadow'); .addClass( "ui-corner-bottom ui-overlay-shadow" );
/* bind events /* bind events
- clicks and submits should use the closing transition that the dialog opened with - clicks and submits should use the closing transition that the dialog opened with
unless a data-transition is specified on the link/form unless a data-transition is specified on the link/form
- if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally - if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally
*/ */
this.element this.element
.bind( "vclick submit", function(e){ .bind( "vclick submit", function( e ) {
var $targetel; var $target;
if( e.type == "vclick" ){ if( e.type == "vclick" ){
$targetel = $(e.target).closest("a"); $target = $( e.target ).closest( "a" );
} }
else{ else{
$targetel = $(e.target).closest("form"); $target = $( e.target ).closest( "form" );
} }
if( $targetel.length && !$targetel.jqmData("transition") ){ if( $target.length && !$target.jqmData( "transition" ) ){
$targetel $target
.attr("data-" + $.mobile.ns + "transition", $.mobile.urlHistory.getActive().transition ) .attr( "data-" + $.mobile.ns + "transition", $.mobile.urlHistory.getActive().transition )
.attr("data-" + $.mobile.ns + "direction", "reverse"); .attr( "data-" + $.mobile.ns + "direction", "reverse" );
} }
}); });
}, },
//close method goes back in history //close method goes back in history
close: function(){ close: function() {
window.history.back(); window.history.back();
} }
}); });