_create: function () {
var $controlbar = this.element,
- $navbtns = $controlbar.find( "a" ),
- iconpos = $navbtns.filter( ":jqmData(icon)" ).length ?
+ $ctrlbtns = $controlbar.find( "a" ),
+ iconpos = $ctrlbtns.filter( ":jqmData(icon)" ).length ?
this.options.iconpos : undefined,
+ textpos = $ctrlbtns.html().length ? true : false,
theme = $.mobile.listview.prototype.options.theme, /* Get current theme */
- style = $controlbar.attr( "data-style" ),
ww = window.innerWidth || $( window ).width(),
wh = window.innerHeight || $( window ).height(),
isLandscape;
$controlbar.removeClass( "ui-landscape-controlbar" ).addClass( "ui-portrait-controlbar" );
}
- if ( style === "left" || style === "right" ) {
- $controlbar
- .parents( ".ui-content" )
- .css( 'padding', '0' );
- } else {
+
+/*
$controlbar
.addClass( "ui-navbar" )
.attr( "role", "navigation" )
.find( "ul" )
+
.grid( { grid: this.options.grid } );
+*/
+ $controlbar.addClass( "ui-navbar" )
+ .find( "ul" )
+ .grid( { grid: this.options.grid } );
+ if ( $controlbar.parents( ".ui-footer" ).length ) {
+ $controlbar.find( "li" ).addClass( "ui-ctrl-btn-style" );
+ }
+
+
+ /* title controlbar */
+ if ( $controlbar.siblings( ".ui-title" ).length ) {
+ $controlbar.parents( ".ui-header" ).addClass( "ui-title-controlbar" );
}
if ( !iconpos ) {
- $controlbar.addClass( "ui-navbar-noicons" );
+ $controlbar.addClass( "ui-controlbar-noicons" );
+ }
+ if ( !textpos ) {
+ $controlbar.addClass( "ui-controlbar-notext" );
+ }
+ if ( textpos && iconpos ) {
+ $controlbar.parents( ".ui-header" ).addClass( "ui-title-controlbar-multiline" );
}
- $navbtns.buttonMarkup({
+ $ctrlbtns.buttonMarkup({
corners: false,
shadow: false,
iconpos: iconpos
});
+ if ( $controlbar.find( ".ui-state-persist" ).length ) {
+ $controlbar.addClass( "ui-controlbar-persist" );
+ }
+
$controlbar.delegate( "a", "vclick", function ( event ) {
- $navbtns.not( ".ui-state-persist" ).removeClass( $.mobile.activeBtnClass );
+ $ctrlbtns.not( ".ui-state-persist" ).removeClass( $.mobile.activeBtnClass );
$( this ).addClass( $.mobile.activeBtnClass );
});
- if ( style === "tabbar" || style === "toolbar" ) {
$controlbar
- .addClass( "ui-controlbar-" + theme )
- .addClass( "ui-" + style + "-" + theme );
- } else {
- $controlbar
- .addClass( "ui-controlbar-" + style )
- .end();
- }
+ .addClass( "ui-controlbar");
+
$( document ).bind( "pagebeforeshow", function ( event, ui ) {
var footer_filter = $( event.target ).find( ":jqmData(role='footer')" ),
controlbar_filter = footer_filter.find( ":jqmData(role='controlbar')" ),
- style = controlbar_filter.jqmData( "style" );
+ $elFooterMore = controlbar_filter.siblings( ":jqmData(icon='naviframe-more')" ),
+ $elFooterBack = controlbar_filter.siblings( ".ui-btn-back" );
- if ( style == "toolbar" || style == "tabbar" ) {
- /* Need to add text only style */
+/*
if ( !(controlbar_filter.find(".ui-btn-inner").children().is(".ui-icon")) ) {
controlbar_filter.find( ".ui-btn-inner" ).addClass( "ui-navbar-textonly" );
} else {
controlbar_filter.find( ".ui-btn" ).addClass( "ui-ctrlbar-icononly" );
}
}
+ */
footer_filter
.css( "position", "fixed" )
.css( "bottom", 0 )
.css( "height", controlbar_filter.height() );
- if ( style == "toolbar" ) {
- controlbar_filter
- .css( "width", window.innerWidth - controlbar_filter.siblings(".ui-btn").width() - parseInt(controlbar_filter.siblings(".ui-btn").css("right"), 10) * 2 );
- }
- }
+ if ( $elFooterMore.length )
+ controlbar_filter.addClass( "ui-controlbar-margin-more" );
+ if ( $elFooterBack.length )
+ controlbar_filter.addClass( "ui-controlbar-margin-back" );
+
+
});
$( document ).bind( "pageshow", function ( e, ui ) {
controlbar_filter.find( "div" ).css( "left", controlbar_filter.find( ".ui-btn-active" ).parent( "li" ).index() * controlbar_filter.width() / element_count );
}
- /* Increase Content size with dummy <div> because of footer height */
- if ( controlbar_filter.length != 0 && $( ".ui-page-active" ).find( ".dummy-div" ).length == 0 && $( ".ui-page-active" ).find( ":jqmData(role='footer')" ).find( ":jqmData(role='controlbar')" ).length != 0 ) {
- $( ".ui-page-active" ).find( ":jqmData(role='content')" ).append( '<div class="dummy-div"></div>' );
- $( ".ui-page-active" ).find( ".dummy-div" )
- .css( "width", controlbar_filter.width() )
- .css( "height", controlbar_filter.height() );
- }
-
if ( controlbar_filter.length ) {
element_width = controlbar_filter.find("li:first").width();
controlbar_filter.find("li:last").width( controlbar_filter.width() - element_width * ( element_count - 1 ) );
var $controlbar = this.element;
$( window ).bind( "orientationchange", function ( e, ui ) {
- ww = window.innerWidth || $( window ).width();
- wh = window.innerHeight || $( window ).height();
-
- isLandscape = ww > wh && ( ww - wh );
+ var ww = window.innerWidth || $( window ).width(),
+ wh = window.innerHeight || $( window ).height(),
+ isLandscape = ww > wh && ( ww - wh );
if ( isLandscape ) {
$controlbar.removeClass( "ui-portrait-controlbar" ).addClass( "ui-landscape-controlbar" );
} else {
$controlbar.removeClass( "ui-landscape-controlbar" ).addClass( "ui-portrait-controlbar" );
}
- })
+ });
},