From 23b776517be35f5c2b247dfbfa58a505612ae289 Mon Sep 17 00:00:00 2001 From: Praveen Date: Mon, 20 Jun 2011 02:00:25 -0700 Subject: [PATCH 1/2] Navbar: data-iconpos is ignored Issue #1797 Fixed issue --- js/jquery.mobile.navbar.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) mode change 100755 => 100644 js/jquery.mobile.navbar.js diff --git a/js/jquery.mobile.navbar.js b/js/jquery.mobile.navbar.js old mode 100755 new mode 100644 index 15b90f10370..5697f331381 --- a/js/jquery.mobile.navbar.js +++ b/js/jquery.mobile.navbar.js @@ -1,4 +1,3 @@ -/* * jQuery Mobile Framework : "navbar" plugin * Copyright (c) jQuery Project * Dual licensed under the MIT or GPL Version 2 licenses. @@ -7,24 +6,28 @@ (function($, undefined ) { $.widget( "mobile.navbar", $.mobile.widget, { options: { - iconpos: 'top', + iconpos:"top", grid: null }, _create: function(){ + var icon=this.element.find("a").attr("data-iconpos").length ? this.element.find("a").attr("data-iconpos"):this.options.iconpos; var $navbar = this.element, $navbtns = $navbar.find("a"), - iconpos = $navbtns.filter( ":jqmData(icon)").length ? this.options.iconpos : undefined; - + iconpos = $navbtns.filter( ":jqmData(icon)").length ? icon : undefined; + $navbar .addClass('ui-navbar') .attr("role","navigation") .find("ul") .grid({grid: this.options.grid }); - if( !iconpos ){ + if( !iconpos){ $navbar.addClass("ui-navbar-noicons"); } - + if(icon=="notext") { + iconpos="top" + $navbtns = $navbar.find("a").text(""); + } $navbtns .buttonMarkup({ corners: false, @@ -38,4 +41,4 @@ $.widget( "mobile.navbar", $.mobile.widget, { }); } }); -})( jQuery ); +})( jQuery ); \ No newline at end of file From 41781802cf720eb8eb742b15c6183bde2a950ecd Mon Sep 17 00:00:00 2001 From: Praveen Date: Mon, 20 Jun 2011 03:14:02 -0700 Subject: [PATCH 2/2] Navbar: data-iconpos is ignored #1797 Issue fixed --- js/jquery.mobile.navbar.js | 40 ++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/js/jquery.mobile.navbar.js b/js/jquery.mobile.navbar.js index 5697f331381..b228c56a355 100644 --- a/js/jquery.mobile.navbar.js +++ b/js/jquery.mobile.navbar.js @@ -1,3 +1,4 @@ +/* * jQuery Mobile Framework : "navbar" plugin * Copyright (c) jQuery Project * Dual licensed under the MIT or GPL Version 2 licenses. @@ -6,35 +7,40 @@ (function($, undefined ) { $.widget( "mobile.navbar", $.mobile.widget, { options: { - iconpos:"top", + iconpos: 'top', grid: null }, _create: function(){ - var icon=this.element.find("a").attr("data-iconpos").length ? this.element.find("a").attr("data-iconpos"):this.options.iconpos; var $navbar = this.element, - $navbtns = $navbar.find("a"), - iconpos = $navbtns.filter( ":jqmData(icon)").length ? icon : undefined; - - $navbar + $navbtns = $navbar.find("a") + i=0, + j=0; + $navbar .addClass('ui-navbar') .attr("role","navigation") .find("ul") - .grid({grid: this.options.grid }); - - if( !iconpos){ - $navbar.addClass("ui-navbar-noicons"); - } - if(icon=="notext") { - iconpos="top" - $navbtns = $navbar.find("a").text(""); - } - $navbtns + .grid({grid: this.options.grid }); + $navbtns.each(function(){ + var icon= $(this).attr("data-iconpos") ? $(this).attr("data-iconpos") : "top", + iconpos =$(this).filter( ":jqmData(icon)").length ? icon: undefined, + notext=$(this).filter(":jqmData(iconpos='notext')"); + if( !iconpos ){ + i++; + } + if(iconpos=="notext") { + iconpos="top"; + notext.text(""); + } + $(this) .buttonMarkup({ corners: false, shadow: false, iconpos: iconpos }); - + j++; + }); + if(i==j) + $navbar.addClass("ui-navbar-noicons"); $navbar.delegate("a", "vclick",function(event){ $navbtns.not( ".ui-state-persist" ).removeClass( $.mobile.activeBtnClass ); $( this ).addClass( $.mobile.activeBtnClass );