updated both plugins to use the new nested hash URL scheme for deep-linking.

This commit is contained in:
scottjehl 2010-09-20 18:22:19 -04:00
parent af585dc8c7
commit 5ca0d616ad
2 changed files with 8 additions and 6 deletions

View file

@ -15,11 +15,11 @@ $.fn.globalnav = function(settings){
var o = $.extend({
fixedAs: 'footer',
moreText: 'More...',
thisId: $(this).parents('.ui-page').attr('id') + '-nav'
thisId: $(this).parents('.ui-page').attr('id')
},settings);
$(this)
.attr('id', o.thisId)
.attr('id', o.thisId + '-globalnav')
.wrapInner('<div class="ui-bar-a ' + (o.fixedAs == 'footer' ? 'ui-footer' : 'ui-header') + '"><div class="ui-globalnav"></div></div>');
//wrap it with footer classes
@ -31,7 +31,7 @@ $.fn.globalnav = function(settings){
.grid({grid: numTabs > 2 ? 'b' : 'a'})
if(numTabs > 3 ){
var moreId = o.thisId + '-more',
var moreId = o.thisId + "&" + jQuery.mobile.subPageUrlKey + "=globalnav",
$navToggle = $('<a href="#'+ moreId +'" data-transition="slideup">' + o.moreText + '</a>'),
$truncatedLis = $globalnav.find('li:gt(2)'),
$newPage = $('<div id="'+ moreId +'" class="ui-page ui-globalnav-expanded ui-body-a"><div class="ui-header"><h1>' + o.moreText + '</h1></div><div class="ui-content"></div></div>'),

View file

@ -8,7 +8,8 @@
$.fn.listview = function( options ) {
return this.each(function() {
var $this = $( this );
var $this = $( this ),
parentID = $this.closest('.ui-page').attr('id')
function data( type, defaultValue ) {
var attr = "data-" + type,
@ -31,6 +32,7 @@ $.fn.listview = function( options ) {
//if it's a nested list, chunk it into ui-page items, recurse through them and call listview on each individual ul
$( $this.find( "ul" ).get().reverse() ).each(function( i ) {
var list = $( this ),
id = parentID + "&" + jQuery.mobile.subPageUrlKey + "=listview-" + i,
parent = list.parent(),
title = parent.contents()[ 0 ].nodeValue,
theme = list.attr( "data-theme" ) !== undefined ?
@ -46,7 +48,7 @@ $.fn.listview = function( options ) {
title + "</h1><a href='#' class='ui-back' data-icon='arrow-l'>Back</a></div>" )
.parent()
.attr({
id: "ui-listview-" + i,
id: id,
"data-theme": theme,
"data-count-theme": countTheme
})
@ -59,7 +61,7 @@ $.fn.listview = function( options ) {
return false;
});
parent.html( "<a href='#ui-listview-" + i + "'>" + title + "</a>" );
parent.html( "<a href='#" + id + "'>" + title + "</a>" );
}).listview();
//create listview markup