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

Commit

Permalink
Merge branch 'master' into collapsible-widget-review
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Jul 11, 2013
2 parents cac6aaf + 2ef0b6f commit 2efcb7a
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 121 deletions.
2 changes: 1 addition & 1 deletion js/events/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"

$this.bind( touchMoveEvent, moveHandler )
.one( touchStopEvent, function() {
emitted = false;
emitted = true;
});
});
},
Expand Down
3 changes: 3 additions & 0 deletions js/requirejs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ requirejs.config({
"jquery.ui.widget": {
deps: [ "jquery" ],
exports: "$.widget"
},
"widgets/jquery.ui.tabs": {
deps: [ "jquery.ui.widget" ]
}
}
});
240 changes: 120 additions & 120 deletions js/widgets/toolbar.js
Original file line number Diff line number Diff line change
@@ -1,120 +1,120 @@
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Behavior for "fixed" headers and footers - be sure to also include the item 'Browser specific workarounds for "fixed" headers and footers' when supporting Android 2.x or iOS 5
//>>label: Toolbars: Fixed
//>>group: Widgets
//>>css.structure: ../css/structure/jquery.mobile.fixedToolbar.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css

define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jquery.mobile.navigation", "./page", "../jquery.mobile.zoom" ], function( jQuery ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {


$.widget( "mobile.toolbar", {
options: {
theme: null,
addBackBtn: false,
backBtnTheme: null,
backBtnText: "Back"
},

_create: function() {
var leftbtn, rightbtn, backBtn,
role = this.element.is( ":jqmData(role='header')" ) ? "header" : "footer",
page = this.element.closest( ".ui-page" );
if ( page.length === 0 ){
page = false;
this._on( $.mobile.document, {
"pageshow": "refresh"
});
}
$.extend( this, {
role: role,
page: page,
leftbtn: leftbtn,
rightbtn: rightbtn,
backBtn: backBtn
});
this.element.attr( "role", role === "header" ? "banner" : "contentinfo" ).addClass( "ui-" + role );
this.refresh();
this._setOptions( this.options );
},
_setOptions: function( o ) {
if ( o.addBackBtn !== undefined ) {
if ( this.options.addBackBtn &&
this.role === "header" &&
$( ".ui-page" ).length > 1 &&
this.page[ 0 ].getAttribute( "data-" + $.mobile.ns + "url" ) !== $.mobile.path.stripHash( location.hash ) &&
!this.leftbtn ) {
this._addBackButton();
} else {
this.element.find( ".ui-toolbar-back-btn" ).remove();
}
}
if ( o.backBtnTheme !== undefined ) {
this.element.find( ".ui-toolbar-back-btn" ).attr( "data-" + $.mobile.ns + "theme", o.backBtnTheme ).buttonMarkup({ theme: o.backBtnTheme });
}
if ( o.backBtnText !== undefined ) {
this.element.find( ".ui-toolbar-back-btn .ui-btn-text" ).text( o.backBtnText );
}
if ( o.theme !== undefined ) {
var currentTheme = this.options.theme ? this.options.theme : "inherit",
newTheme = o.theme ? o.theme : "inherit";

this.element.removeClass( "ui-bar-" + currentTheme ).addClass( "ui-bar-" + newTheme );
}

this._super( o );
},
refresh: function() {
if ( this.role === "header" ) {
this._addHeaderButtonClasses();
}
if ( !this.page ) {
$( "[data-"+ $.mobile.ns +"role='page']" ).css({"position":"relative"});
if ( this.role === "footer" ) {
this.element.appendTo( "body" );
}
}
this._addHeadingClasses();
this._btnMarkup();
},
// Deprecated in 1.4. As from 1.5 data-role="button" has to be present in the markup.
_btnMarkup: function() {
this.element.children( "a" ).attr( "data-" + $.mobile.ns + "role", "button" );
this.element.trigger( "create" );
},
_addHeaderButtonClasses: function() {
var $headeranchors = this.element.children( "a, button" );
this.leftbtn = $headeranchors.hasClass( "ui-btn-left" );
this.rightbtn = $headeranchors.hasClass( "ui-btn-right" );

this.leftbtn = this.leftbtn || $headeranchors.eq( 0 ).not( ".ui-btn-right" ).addClass( "ui-btn-left" ).length;

this.rightbtn = this.rightbtn || $headeranchors.eq( 1 ).addClass( "ui-btn-right" ).length;

},
_addBackButton:function() {
this.backBtn = $( "<a href='javascript:void(0);' class='ui-btn-left ui-toolbar-back-btn' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "icon='arrow-l'>" + this.options.backBtnText + "</a>" )
// If theme is provided, override default inheritance
.attr( "data-" + $.mobile.ns + "theme", this.options.backBtnTheme || this.options.theme )
.prependTo( this.element );
},
_addHeadingClasses: function() {
this.element.children( "h1, h2, h3, h4, h5, h6" )
.addClass( "ui-title" )
// Regardless of h element number in src, it becomes h1 for the enhanced page
.attr({
"role": "heading",
"aria-level": "1"
});
}
});
$.mobile.toolbar.initSelector = ":jqmData(role='footer'), :jqmData(role='header')";

$.mobile._enhancer.add( "mobile.toolbar" );

})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
//>>excludeEnd("jqmBuildExclude");
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Behavior for "fixed" headers and footers - be sure to also include the item 'Browser specific workarounds for "fixed" headers and footers' when supporting Android 2.x or iOS 5
//>>label: Toolbars: Fixed
//>>group: Widgets
//>>css.structure: ../css/structure/jquery.mobile.fixedToolbar.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css

define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jquery.mobile.navigation", "./page", "../jquery.mobile.zoom" ], function( jQuery ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {


$.widget( "mobile.toolbar", {
options: {
theme: null,
addBackBtn: false,
backBtnTheme: null,
backBtnText: "Back"
},

_create: function() {
var leftbtn, rightbtn, backBtn,
role = this.element.is( ":jqmData(role='header')" ) ? "header" : "footer",
page = this.element.closest( ".ui-page" );
if ( page.length === 0 ){
page = false;
this._on( $.mobile.document, {
"pageshow": "refresh"
});
}
$.extend( this, {
role: role,
page: page,
leftbtn: leftbtn,
rightbtn: rightbtn,
backBtn: backBtn
});
this.element.attr( "role", role === "header" ? "banner" : "contentinfo" ).addClass( "ui-" + role );
this.refresh();
this._setOptions( this.options );
},
_setOptions: function( o ) {
if ( o.addBackBtn !== undefined ) {
if ( this.options.addBackBtn &&
this.role === "header" &&
$( ".ui-page" ).length > 1 &&
this.page[ 0 ].getAttribute( "data-" + $.mobile.ns + "url" ) !== $.mobile.path.stripHash( location.hash ) &&
!this.leftbtn ) {
this._addBackButton();
} else {
this.element.find( ".ui-toolbar-back-btn" ).remove();
}
}
if ( o.backBtnTheme !== undefined ) {
this.element.find( ".ui-toolbar-back-btn" ).attr( "data-" + $.mobile.ns + "theme", o.backBtnTheme ).buttonMarkup({ theme: o.backBtnTheme });
}
if ( o.backBtnText !== undefined ) {
this.element.find( ".ui-toolbar-back-btn .ui-btn-text" ).text( o.backBtnText );
}
if ( o.theme !== undefined ) {
var currentTheme = this.options.theme ? this.options.theme : "inherit",
newTheme = o.theme ? o.theme : "inherit";

this.element.removeClass( "ui-bar-" + currentTheme ).addClass( "ui-bar-" + newTheme );
}

this._super( o );
},
refresh: function() {
if ( this.role === "header" ) {
this._addHeaderButtonClasses();
}
if ( !this.page ) {
$( "[data-"+ $.mobile.ns +"role='page']" ).css({"position":"relative"});
if ( this.role === "footer" ) {
this.element.appendTo( "body" );
}
}
this._addHeadingClasses();
this._btnMarkup();
},
// Deprecated in 1.4. As from 1.5 data-role="button" has to be present in the markup.
_btnMarkup: function() {
this.element.children( "a" ).attr( "data-" + $.mobile.ns + "role", "button" );
this.element.trigger( "create" );
},
_addHeaderButtonClasses: function() {
var $headeranchors = this.element.children( "a, button" );
this.leftbtn = $headeranchors.hasClass( "ui-btn-left" );
this.rightbtn = $headeranchors.hasClass( "ui-btn-right" );

this.leftbtn = this.leftbtn || $headeranchors.eq( 0 ).not( ".ui-btn-right" ).addClass( "ui-btn-left" ).length;

this.rightbtn = this.rightbtn || $headeranchors.eq( 1 ).addClass( "ui-btn-right" ).length;

},
_addBackButton:function() {
this.backBtn = $( "<a href='javascript:void(0);' class='ui-btn-left ui-toolbar-back-btn' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "icon='arrow-l'>" + this.options.backBtnText + "</a>" )
// If theme is provided, override default inheritance
.attr( "data-" + $.mobile.ns + "theme", this.options.backBtnTheme || this.options.theme )
.prependTo( this.element );
},
_addHeadingClasses: function() {
this.element.children( "h1, h2, h3, h4, h5, h6" )
.addClass( "ui-title" )
// Regardless of h element number in src, it becomes h1 for the enhanced page
.attr({
"role": "heading",
"aria-level": "1"
});
}
});
$.mobile.toolbar.initSelector = ":jqmData(role='footer'), :jqmData(role='header')";

$.mobile._enhancer.add( "mobile.toolbar" );

})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
//>>excludeEnd("jqmBuildExclude");

0 comments on commit 2efcb7a

Please sign in to comment.