Skip to content

Commit

Permalink
Toolbar: Add classes option
Browse files Browse the repository at this point in the history
remove deprecated code

Fixes jquery-archivegh-7687
  • Loading branch information
cgack committed Oct 23, 2014
1 parent c290839 commit ded0a85
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 59 deletions.
23 changes: 2 additions & 21 deletions js/widgets/fixedToolbar.js
Expand Up @@ -20,7 +20,6 @@ define( [ "jquery", "../widget", "../core", "../animationComplete", "../navigati
tapToggleBlacklist: "a, button, input, select, textarea, .ui-header-fixed, .ui-footer-fixed, .ui-flipswitch, .ui-popup, .ui-panel, .ui-panel-dismiss-open",
hideDuringFocus: "input, textarea, select",
updatePagePadding: true,
trackPersistentToolbars: true,

// Browser detection! Weeee, here we go...
// Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately.
Expand Down Expand Up @@ -122,33 +121,15 @@ define( [ "jquery", "../widget", "../core", "../animationComplete", "../navigati
}
},

_handlePageBeforeHide: function( e, ui ) {
var o = this.options,
thisFooter, thisHeader, nextFooter, nextHeader;
_handlePageBeforeHide: function() {
var o = this.options;

if ( o.disablePageZoom ) {
$.mobile.zoom.enable( true );
}
if ( o.updatePagePadding ) {
this._off( this.window, "throttledresize" );
}

if ( o.trackPersistentToolbars ) {
thisFooter = $( ".ui-footer-fixed:jqmData(id)", this.page );
thisHeader = $( ".ui-header-fixed:jqmData(id)", this.page );
nextFooter = thisFooter.length && ui.nextPage && $( ".ui-footer-fixed:jqmData(id='" + thisFooter.jqmData( "id" ) + "')", ui.nextPage ) || $();
nextHeader = thisHeader.length && ui.nextPage && $( ".ui-header-fixed:jqmData(id='" + thisHeader.jqmData( "id" ) + "')", ui.nextPage ) || $();

if ( nextFooter.length || nextHeader.length ) {

nextFooter.add( nextHeader ).appendTo( $.mobile.pageContainer );

ui.nextPage.one( "pageshow", function() {
nextHeader.prependTo( this );
nextFooter.appendTo( this );
});
}
}
},

_visible: true,
Expand Down
9 changes: 2 additions & 7 deletions js/widgets/fixedToolbar.workarounds.js
Expand Up @@ -23,18 +23,13 @@ define( [ "jquery", "../widget", "../core", "../navigation", "./page", "../zoom"
os = null,
self = this;
//set the os we are working in if it dosent match one with workarounds return
if ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) {
os = "ios";
} else if ( ua.indexOf( "Android" ) > -1 ) {
if ( ua.indexOf( "Android" ) > -1 ) {
os = "android";
} else {
return;
}
//check os version if it dosent match one with workarounds return
if ( os === "ios" ) {
//iOS workarounds
self._bindScrollWorkaround();
} else if ( os === "android" && wkversion && wkversion < 534 ) {
if ( os === "android" && wkversion && wkversion < 534 ) {
//Android 2.3 run all Android 2.3 workaround
self._bindScrollWorkaround();
self._bindListThumbWorkaround();
Expand Down
31 changes: 0 additions & 31 deletions js/widgets/toolbar.js
Expand Up @@ -66,9 +66,6 @@ define( [
this._super( o );
},
refresh: function() {
if ( this.role === "header" ) {
this._addHeaderButtonClasses();
}
if ( !this.page ) {
this._setRelative();
if ( this.role === "footer" ) {
Expand All @@ -78,41 +75,13 @@ define( [
}
}
this._addHeadingClasses();
this._btnMarkup();
},

//we only want this to run on non fixed toolbars so make it easy to override
_setRelative: function() {
$( "[data-"+ $.mobile.ns + "role='page']" ).css({ "position": "relative" });
},

// Deprecated in 1.4. As from 1.5 button classes have to be present in the markup.
_btnMarkup: function() {
this.element
.children( "a" )
.filter( ":not([data-" + $.mobile.ns + "role='none'])" )
.attr( "data-" + $.mobile.ns + "role", "button" );
this.element.trigger( "create" );
},
// Deprecated in 1.4. As from 1.5 ui-btn-left/right classes have to be present in the markup.
_addHeaderButtonClasses: function() {
var headerAnchors = this.element.children( "a, button" );

// Do not mistake a back button for a left toolbar button
this.leftbtn = headerAnchors.hasClass( "ui-btn-left" ) &&
!headerAnchors.hasClass( "ui-toolbar-back-btn" );

this.rightbtn = headerAnchors.hasClass( "ui-btn-right" );

// Filter out right buttons and back buttons
this.leftbtn = this.leftbtn ||
headerAnchors.eq( 0 )
.not( ".ui-btn-right,.ui-toolbar-back-btn" )
.addClass( "ui-btn-left" )
.length;

this.rightbtn = this.rightbtn || headerAnchors.eq( 1 ).addClass( "ui-btn-right" ).length;
},
_updateBackButton: function() {
var backButton,
options = this.options,
Expand Down

0 comments on commit ded0a85

Please sign in to comment.