" ).html( $this.clone() ).html(),
- // In IE browsers, the type sometimes doesn't exist in the cloned markup, so we replace the closing tag instead
- hasType = html.indexOf( " type=" ) > -1,
- findstr = hasType ? /\s+type=["']?\w+['"]?/ : /\/?>/,
- repstr = " type=\"" + optType + "\" data-" + $.mobile.ns + "type=\"" + type + "\"" + ( hasType ? "" : ">" );
-
- $this.replaceWith( html.replace( findstr, repstr ) );
- }
- });
-
-});
-
-})( jQuery );/*
-* "dialog" plugin.
-*/
-
-(function( $, window, undefined ) {
-
-$.widget( "mobile.dialog", $.mobile.widget, {
- options: {
- closeBtnText : "Close",
- overlayTheme : "a",
- initSelector : ":jqmData(role='dialog')"
- },
- _create: function() {
- var self = this,
- $el = this.element,
- headerCloseButton = $( "
"+ this.options.closeBtnText + "" );
-
- $el.addClass( "ui-overlay-" + this.options.overlayTheme );
-
- // Class the markup for dialog styling
- // Set aria role
- $el.attr( "role", "dialog" )
- .addClass( "ui-dialog" )
- .find( ":jqmData(role='header')" )
- .addClass( "ui-corner-top ui-overlay-shadow" )
- .prepend( headerCloseButton )
- .end()
- .find( ":jqmData(role='content'),:jqmData(role='footer')" )
- .addClass( "ui-overlay-shadow" )
- .last()
- .addClass( "ui-corner-bottom" );
-
- // this must be an anonymous function so that select menu dialogs can replace
- // the close method. This is a change from previously just defining data-rel=back
- // on the button and letting nav handle it
- //
- // Use click rather than vclick in order to prevent the possibility of unintentionally
- // reopening the dialog if the dialog opening item was directly under the close button.
- headerCloseButton.bind( "click", function() {
- self.close();
- });
-
- /* bind events
- - clicks and submits should use the closing transition that the dialog opened with
- unless a data-transition is specified on the link/form
- - if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally
- */
- $el.bind( "vclick submit", function( event ) {
- var $target = $( event.target ).closest( event.type === "vclick" ? "a" : "form" ),
- active;
-
- if ( $target.length && !$target.jqmData( "transition" ) ) {
-
- active = $.mobile.urlHistory.getActive() || {};
-
- $target.attr( "data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) )
- .attr( "data-" + $.mobile.ns + "direction", "reverse" );
- }
- })
- .bind( "pagehide", function() {
- $( this ).find( "." + $.mobile.activeBtnClass ).removeClass( $.mobile.activeBtnClass );
- });
- },
-
- // Close method goes back in history
- close: function() {
- window.history.back();
- }
-});
-
-//auto self-init widgets
-$( document ).delegate( $.mobile.dialog.prototype.options.initSelector, "pagecreate", function(){
- $( this ).dialog();
-});
-
-})( jQuery, this );
-/*
-* This plugin handles theming and layout of headers, footers, and content areas
-*/
-
-(function( $, undefined ) {
-
-$.mobile.page.prototype.options.backBtnText = "Back";
-$.mobile.page.prototype.options.addBackBtn = false;
-$.mobile.page.prototype.options.backBtnTheme = null;
-$.mobile.page.prototype.options.headerTheme = "a";
-$.mobile.page.prototype.options.footerTheme = "a";
-$.mobile.page.prototype.options.contentTheme = null;
-
-$( document ).delegate( ":jqmData(role='page'), :jqmData(role='dialog')", "pagecreate", function( e ) {
-
- var $page = $( this ),
- o = $page.data( "page" ).options,
- pageRole = $page.jqmData( "role" ),
- pageTheme = o.theme;
-
- $( ":jqmData(role='header'), :jqmData(role='footer'), :jqmData(role='content')", this ).each(function() {
- var $this = $( this ),
- role = $this.jqmData( "role" ),
- theme = $this.jqmData( "theme" ),
- contentTheme = theme || o.contentTheme || ( pageRole === "dialog" && pageTheme ),
- $headeranchors,
- leftbtn,
- rightbtn,
- backBtn;
-
- $this.addClass( "ui-" + role );
-
- //apply theming and markup modifications to page,header,content,footer
- if ( role === "header" || role === "footer" ) {
-
- var thisTheme = theme || ( role === "header" ? o.headerTheme : o.footerTheme ) || pageTheme;
-
- $this
- //add theme class
- .addClass( "ui-bar-" + thisTheme )
- // Add ARIA role
- .attr( "role", role === "header" ? "banner" : "contentinfo" );
-
- // Right,left buttons
- $headeranchors = $this.children( "a" );
- leftbtn = $headeranchors.hasClass( "ui-btn-left" );
- rightbtn = $headeranchors.hasClass( "ui-btn-right" );
-
- leftbtn = leftbtn || $headeranchors.eq( 0 ).not( ".ui-btn-right" ).addClass( "ui-btn-left" ).length;
-
- rightbtn = rightbtn || $headeranchors.eq( 1 ).addClass( "ui-btn-right" ).length;
-
- // Auto-add back btn on pages beyond first view
- if ( o.addBackBtn &&
- role === "header" &&
- $( ".ui-page" ).length > 1 &&
- $this.jqmData( "url" ) !== $.mobile.path.stripHash( location.hash ) &&
- !leftbtn ) {
-
- backBtn = $( "
"+ o.backBtnText +"" )
- // If theme is provided, override default inheritance
- .attr( "data-"+ $.mobile.ns +"theme", o.backBtnTheme || thisTheme )
- .prependTo( $this );
- }
-
- // Page title
- $this.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({
- "tabindex": "0",
- "role": "heading",
- "aria-level": "1"
- });
-
- } else if ( role === "content" ) {
- if ( contentTheme ) {
- $this.addClass( "ui-body-" + ( contentTheme ) );
- }
-
- // Add ARIA role
- $this.attr( "role", "main" );
- }
- });
-});
-
-})( jQuery );/*
-* "collapsible" plugin
-*/
-
-(function( $, undefined ) {
-
-$.widget( "mobile.collapsible", $.mobile.widget, {
- options: {
- expandCueText: " click to expand contents",
- collapseCueText: " click to collapse contents",
- collapsed: true,
- heading: "h1,h2,h3,h4,h5,h6,legend",
- theme: null,
- contentTheme: null,
- iconTheme: "d",
- initSelector: ":jqmData(role='collapsible')"
- },
- _create: function() {
-
- var $el = this.element,
- o = this.options,
- collapsible = $el.addClass( "ui-collapsible" ),
- collapsibleHeading = $el.children( o.heading ).first(),
- collapsibleContent = collapsible.wrapInner( "
" ).find( ".ui-collapsible-content" ),
- collapsibleSet = $el.closest( ":jqmData(role='collapsible-set')" ).addClass( "ui-collapsible-set" );
-
- // Replace collapsibleHeading if it's a legend
- if ( collapsibleHeading.is( "legend" ) ) {
- collapsibleHeading = $( "
"+ collapsibleHeading.html() +"
" ).insertBefore( collapsibleHeading );
- collapsibleHeading.next().remove();
- }
-
- // If we are in a collapsible set
- if ( collapsibleSet.length ) {
- // Inherit the theme from collapsible-set
- if ( !o.theme ) {
- o.theme = collapsibleSet.jqmData( "theme" );
- }
- // Inherit the content-theme from collapsible-set
- if ( !o.contentTheme ) {
- o.contentTheme = collapsibleSet.jqmData( "content-theme" );
- }
- }
-
- collapsibleContent.addClass( ( o.contentTheme ) ? ( "ui-body-" + o.contentTheme ) : "");
-
- collapsibleHeading
- //drop heading in before content
- .insertBefore( collapsibleContent )
- //modify markup & attributes
- .addClass( "ui-collapsible-heading" )
- .append( "
" )
- .wrapInner( "
" )
- .find( "a" )
- .first()
- .buttonMarkup({
- shadow: false,
- corners: false,
- iconPos: "left",
- icon: "plus",
- theme: o.theme
- })
- .add( ".ui-btn-inner" )
- .addClass( "ui-corner-top ui-corner-bottom" );
-
- //events
- collapsible
- .bind( "expand collapse", function( event ) {
- if ( !event.isDefaultPrevented() ) {
-
- event.preventDefault();
-
- var $this = $( this ),
- isCollapse = ( event.type === "collapse" ),
- contentTheme = o.contentTheme;
-
- collapsibleHeading
- .toggleClass( "ui-collapsible-heading-collapsed", isCollapse)
- .find( ".ui-collapsible-heading-status" )
- .text( isCollapse ? o.expandCueText : o.collapseCueText )
- .end()
- .find( ".ui-icon" )
- .toggleClass( "ui-icon-minus", !isCollapse )
- .toggleClass( "ui-icon-plus", isCollapse );
-
- $this.toggleClass( "ui-collapsible-collapsed", isCollapse );
- collapsibleContent.toggleClass( "ui-collapsible-content-collapsed", isCollapse ).attr( "aria-hidden", isCollapse );
-
- if ( contentTheme && ( !collapsibleSet.length || collapsible.jqmData( "collapsible-last" ) ) ) {
- collapsibleHeading
- .find( "a" ).first().add( collapsibleHeading.find( ".ui-btn-inner" ) )
- .toggleClass( "ui-corner-bottom", isCollapse );
- collapsibleContent.toggleClass( "ui-corner-bottom", !isCollapse );
- }
- collapsibleContent.trigger( "updatelayout" );
- }
- })
- .trigger( o.collapsed ? "collapse" : "expand" );
-
- collapsibleHeading
- .bind( "click", function( event ) {
-
- var type = collapsibleHeading.is( ".ui-collapsible-heading-collapsed" ) ?
- "expand" : "collapse";
-
- collapsible.trigger( type );
-
- event.preventDefault();
- });
- }
-});
-
-//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
- $( $.mobile.collapsible.prototype.options.initSelector, e.target ).collapsible();
-});
-
-})( jQuery );
-/*
-* "collapsibleset" plugin
-*/
-
-(function( $, undefined ) {
-
-$.widget( "mobile.collapsibleset", $.mobile.widget, {
- options: {
- initSelector: ":jqmData(role='collapsible-set')"
- },
- _create: function() {
- var $el = this.element.addClass( "ui-collapsible-set" ),
- o = this.options,
- collapsiblesInSet = $el.children( ":jqmData(role='collapsible')" );
-
- // Inherit the theme from collapsible-set
- if ( !o.theme ) {
- o.theme = $el.jqmData( "theme" );
- }
- // Inherit the content-theme from collapsible-set
- if ( !o.contentTheme ) {
- o.contentTheme = $el.jqmData( "content-theme" );
- }
-
- // Initialize the collapsible set if it's not already initialized
- if ( !$el.jqmData( "collapsiblebound" ) ) {
-
- $el
- .jqmData( "collapsiblebound", true )
- .bind( "expand collapse", function( event ) {
- var isCollapse = ( event.type === "collapse" ),
- collapsible = $( event.target ).closest( ".ui-collapsible" ),
- widget = collapsible.data( "collapsible" ),
- contentTheme = widget.options.contentTheme;
- if ( contentTheme && collapsible.jqmData( "collapsible-last" ) ) {
- collapsible.find( widget.options.heading ).first()
- .find( "a" ).first()
- .add( ".ui-btn-inner" )
- .toggleClass( "ui-corner-bottom", isCollapse );
- collapsible.find( ".ui-collapsible-content" ).toggleClass( "ui-corner-bottom", !isCollapse );
- }
- })
- .bind( "expand", function( event ) {
- $( event.target )
- .closest( ".ui-collapsible" )
- .siblings( ".ui-collapsible" )
- .trigger( "collapse" );
-
- });
-
- // clean up borders
- collapsiblesInSet.each( function() {
- $( this ).find( $.mobile.collapsible.prototype.options.heading )
- .find( "a" ).first()
- .add( ".ui-btn-inner" )
- .removeClass( "ui-corner-top ui-corner-bottom" );
- });
-
- collapsiblesInSet.first()
- .find( "a" )
- .first()
- .addClass( "ui-corner-top" )
- .find( ".ui-btn-inner" )
- .addClass( "ui-corner-top" );
-
- collapsiblesInSet.last()
- .jqmData( "collapsible-last", true )
- .find( "a" )
- .first()
- .addClass( "ui-corner-bottom" )
- .find( ".ui-btn-inner" )
- .addClass( "ui-corner-bottom" );
- }
- }
-});
-
-//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
- $( $.mobile.collapsibleset.prototype.options.initSelector, e.target ).collapsibleset();
-});
-
-})( jQuery );
-/*
-* "fieldcontain" plugin - simple class additions to make form row separators
-*/
-
-(function( $, undefined ) {
-
-$.fn.fieldcontain = function( options ) {
- return this.addClass( "ui-field-contain ui-body ui-br" );
-};
-
-//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
- $( ":jqmData(role='fieldcontain')", e.target ).fieldcontain();
-});
-
-})( jQuery );/*
-* plugin for creating CSS grids
-*/
-
-(function( $, undefined ) {
-
-$.fn.grid = function( options ) {
- return this.each(function() {
-
- var $this = $( this ),
- o = $.extend({
- grid: null
- },options),
- $kids = $this.children(),
- gridCols = {solo:1, a:2, b:3, c:4, d:5},
- grid = o.grid,
- iterator;
-
- if ( !grid ) {
- if ( $kids.length <= 5 ) {
- for ( var letter in gridCols ) {
- if ( gridCols[ letter ] === $kids.length ) {
- grid = letter;
- }
- }
- } else {
- grid = "a";
- }
- }
- iterator = gridCols[grid];
-
- $this.addClass( "ui-grid-" + grid );
-
- $kids.filter( ":nth-child(" + iterator + "n+1)" ).addClass( "ui-block-a" );
-
- if ( iterator > 1 ) {
- $kids.filter( ":nth-child(" + iterator + "n+2)" ).addClass( "ui-block-b" );
- }
- if ( iterator > 2 ) {
- $kids.filter( ":nth-child(3n+3)" ).addClass( "ui-block-c" );
- }
- if ( iterator > 3 ) {
- $kids.filter( ":nth-child(4n+4)" ).addClass( "ui-block-d" );
- }
- if ( iterator > 4 ) {
- $kids.filter( ":nth-child(5n+5)" ).addClass( "ui-block-e" );
- }
- });
-};
-})( jQuery );/*
-* "navbar" plugin
-*/
-
-(function( $, undefined ) {
-
-$.widget( "mobile.navbar", $.mobile.widget, {
- options: {
- iconpos: "top",
- grid: null,
- initSelector: ":jqmData(role='navbar')"
- },
-
- _create: function(){
-
- var $navbar = this.element,
- $navbtns = $navbar.find( "a" ),
- iconpos = $navbtns.filter( ":jqmData(icon)" ).length ?
- this.options.iconpos : undefined;
-
- $navbar.addClass( "ui-navbar" )
- .attr( "role","navigation" )
- .find( "ul" )
- .grid({ grid: this.options.grid });
-
- if ( !iconpos ) {
- $navbar.addClass( "ui-navbar-noicons" );
- }
-
- $navbtns.buttonMarkup({
- corners: false,
- shadow: false,
- iconpos: iconpos
- });
-
- $navbar.delegate( "a", "vclick", function( event ) {
- if( !$(event.target).hasClass("ui-disabled") ) {
- $navbtns.not( ".ui-state-persist" ).removeClass( $.mobile.activeBtnClass );
- $( this ).addClass( $.mobile.activeBtnClass );
- }
- });
- }
-});
-
-//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
- $( $.mobile.navbar.prototype.options.initSelector, e.target ).navbar();
-});
-
-})( jQuery );
-/*
-* "listview" plugin
-*/
-
-(function( $, undefined ) {
-
-//Keeps track of the number of lists per page UID
-//This allows support for multiple nested list in the same page
-//https://github.com/jquery/jquery-mobile/issues/1617
-var listCountPerPage = {};
-
-$.widget( "mobile.listview", $.mobile.widget, {
- options: {
- theme: null,
- countTheme: "c",
- headerTheme: "b",
- dividerTheme: "b",
- splitIcon: "arrow-r",
- splitTheme: "b",
- inset: false,
- initSelector: ":jqmData(role='listview')"
- },
-
- _create: function() {
- var t = this;
-
- // create listview markup
- t.element.addClass(function( i, orig ) {
- return orig + " ui-listview " + ( t.options.inset ? " ui-listview-inset ui-corner-all ui-shadow " : "" );
- });
-
- t.refresh( true );
- },
-
- _removeCorners: function( li, which ) {
- var top = "ui-corner-top ui-corner-tr ui-corner-tl",
- bot = "ui-corner-bottom ui-corner-br ui-corner-bl";
-
- li = li.add( li.find( ".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb" ) );
-
- if ( which === "top" ) {
- li.removeClass( top );
- } else if ( which === "bottom" ) {
- li.removeClass( bot );
- } else {
- li.removeClass( top + " " + bot );
- }
- },
-
- _refreshCorners: function( create ) {
- var $li,
- $visibleli,
- $topli,
- $bottomli;
-
- if ( this.options.inset ) {
- $li = this.element.children( "li" );
- // at create time the li are not visible yet so we need to rely on .ui-screen-hidden
- $visibleli = create?$li.not( ".ui-screen-hidden" ):$li.filter( ":visible" );
-
- this._removeCorners( $li );
-
- // Select the first visible li element
- $topli = $visibleli.first()
- .addClass( "ui-corner-top" );
-
- $topli.add( $topli.find( ".ui-btn-inner" )
- .not( ".ui-li-link-alt span:first-child" ) )
- .addClass( "ui-corner-top" )
- .end()
- .find( ".ui-li-link-alt, .ui-li-link-alt span:first-child" )
- .addClass( "ui-corner-tr" )
- .end()
- .find( ".ui-li-thumb" )
- .not(".ui-li-icon")
- .addClass( "ui-corner-tl" );
-
- // Select the last visible li element
- $bottomli = $visibleli.last()
- .addClass( "ui-corner-bottom" );
-
- $bottomli.add( $bottomli.find( ".ui-btn-inner" ) )
- .find( ".ui-li-link-alt" )
- .addClass( "ui-corner-br" )
- .end()
- .find( ".ui-li-thumb" )
- .not(".ui-li-icon")
- .addClass( "ui-corner-bl" );
- }
- if ( !create ) {
- this.element.trigger( "updatelayout" );
- }
- },
-
- // This is a generic utility method for finding the first
- // node with a given nodeName. It uses basic DOM traversal
- // to be fast and is meant to be a substitute for simple
- // $.fn.closest() and $.fn.children() calls on a single
- // element. Note that callers must pass both the lowerCase
- // and upperCase version of the nodeName they are looking for.
- // The main reason for this is that this function will be
- // called many times and we want to avoid having to lowercase
- // the nodeName from the element every time to ensure we have
- // a match. Note that this function lives here for now, but may
- // be moved into $.mobile if other components need a similar method.
- _findFirstElementByTagName: function( ele, nextProp, lcName, ucName )
- {
- var dict = {};
- dict[ lcName ] = dict[ ucName ] = true;
- while ( ele ) {
- if ( dict[ ele.nodeName ] ) {
- return ele;
- }
- ele = ele[ nextProp ];
- }
- return null;
- },
- _getChildrenByTagName: function( ele, lcName, ucName )
- {
- var results = [],
- dict = {};
- dict[ lcName ] = dict[ ucName ] = true;
- ele = ele.firstChild;
- while ( ele ) {
- if ( dict[ ele.nodeName ] ) {
- results.push( ele );
- }
- ele = ele.nextSibling;
- }
- return $( results );
- },
-
- _addThumbClasses: function( containers )
- {
- var i, img, len = containers.length;
- for ( i = 0; i < len; i++ ) {
- img = $( this._findFirstElementByTagName( containers[ i ].firstChild, "nextSibling", "img", "IMG" ) );
- if ( img.length ) {
- img.addClass( "ui-li-thumb" );
- $( this._findFirstElementByTagName( img[ 0 ].parentNode, "parentNode", "li", "LI" ) ).addClass( img.is( ".ui-li-icon" ) ? "ui-li-has-icon" : "ui-li-has-thumb" );
- }
- }
- },
-
- refresh: function( create ) {
- this.parentPage = this.element.closest( ".ui-page" );
- this._createSubPages();
-
- var o = this.options,
- $list = this.element,
- self = this,
- dividertheme = $list.jqmData( "dividertheme" ) || o.dividerTheme,
- listsplittheme = $list.jqmData( "splittheme" ),
- listspliticon = $list.jqmData( "spliticon" ),
- li = this._getChildrenByTagName( $list[ 0 ], "li", "LI" ),
- counter = $.support.cssPseudoElement || !$.nodeName( $list[ 0 ], "ol" ) ? 0 : 1,
- itemClassDict = {},
- item, itemClass, itemTheme,
- a, last, splittheme, countParent, icon, imgParents, img;
-
- if ( counter ) {
- $list.find( ".ui-li-dec" ).remove();
- }
-
- if ( !o.theme ) {
- o.theme = $.mobile.getInheritedTheme( this.element, "c" );
- }
-
- for ( var pos = 0, numli = li.length; pos < numli; pos++ ) {
- item = li.eq( pos );
- itemClass = "ui-li";
-
- // If we're creating the element, we update it regardless
- if ( create || !item.hasClass( "ui-li" ) ) {
- itemTheme = item.jqmData("theme") || o.theme;
- a = this._getChildrenByTagName( item[ 0 ], "a", "A" );
-
- if ( a.length ) {
- icon = item.jqmData("icon");
-
- item.buttonMarkup({
- wrapperEls: "div",
- shadow: false,
- corners: false,
- iconpos: "right",
- icon: a.length > 1 || icon === false ? false : icon || "arrow-r",
- theme: itemTheme
- });
-
- if ( ( icon != false ) && ( a.length == 1 ) ) {
- item.addClass( "ui-li-has-arrow" );
- }
-
- a.first().addClass( "ui-link-inherit" );
-
- if ( a.length > 1 ) {
- itemClass += " ui-li-has-alt";
-
- last = a.last();
- splittheme = listsplittheme || last.jqmData( "theme" ) || o.splitTheme;
-
- last.appendTo(item)
- .attr( "title", last.getEncodedText() )
- .addClass( "ui-li-link-alt" )
- .empty()
- .buttonMarkup({
- shadow: false,
- corners: false,
- theme: itemTheme,
- icon: false,
- iconpos: false
- })
- .find( ".ui-btn-inner" )
- .append(
- $( document.createElement( "span" ) ).buttonMarkup({
- shadow: true,
- corners: true,
- theme: splittheme,
- iconpos: "notext",
- icon: listspliticon || last.jqmData( "icon" ) || o.splitIcon
- })
- );
- }
- } else if ( item.jqmData( "role" ) === "list-divider" ) {
-
- itemClass += " ui-li-divider ui-btn ui-bar-" + dividertheme;
- item.attr( "role", "heading" );
-
- //reset counter when a divider heading is encountered
- if ( counter ) {
- counter = 1;
- }
-
- } else {
- itemClass += " ui-li-static ui-body-" + itemTheme;
- }
- }
-
- if ( counter && itemClass.indexOf( "ui-li-divider" ) < 0 ) {
- countParent = item.is( ".ui-li-static:first" ) ? item : item.find( ".ui-link-inherit" );
-
- countParent.addClass( "ui-li-jsnumbering" )
- .prepend( "
" + (counter++) + ". " );
- }
-
- // Instead of setting item class directly on the list item and its
- // btn-inner at this point in time, push the item into a dictionary
- // that tells us what class to set on it so we can do this after this
- // processing loop is finished.
-
- if ( !itemClassDict[ itemClass ] ) {
- itemClassDict[ itemClass ] = [];
- }
-
- itemClassDict[ itemClass ].push( item[ 0 ] );
- }
-
- // Set the appropriate listview item classes on each list item
- // and their btn-inner elements. The main reason we didn't do this
- // in the for-loop above is because we can eliminate per-item function overhead
- // by calling addClass() and children() once or twice afterwards. This
- // can give us a significant boost on platforms like WP7.5.
-
- for ( itemClass in itemClassDict ) {
- $( itemClassDict[ itemClass ] ).addClass( itemClass ).children( ".ui-btn-inner" ).addClass( itemClass );
- }
-
- $list.find( "h1, h2, h3, h4, h5, h6" ).addClass( "ui-li-heading" )
- .end()
-
- .find( "p, dl" ).addClass( "ui-li-desc" )
- .end()
-
- .find( ".ui-li-aside" ).each(function() {
- var $this = $(this);
- $this.prependTo( $this.parent() ); //shift aside to front for css float
- })
- .end()
-
- .find( ".ui-li-count" ).each( function() {
- $( this ).closest( "li" ).addClass( "ui-li-has-count" );
- }).addClass( "ui-btn-up-" + ( $list.jqmData( "counttheme" ) || this.options.countTheme) + " ui-btn-corner-all" );
-
- // The idea here is to look at the first image in the list item
- // itself, and any .ui-link-inherit element it may contain, so we
- // can place the appropriate classes on the image and list item.
- // Note that we used to use something like:
- //
- // li.find(">img:eq(0), .ui-link-inherit>img:eq(0)").each( ... );
- //
- // But executing a find() like that on Windows Phone 7.5 took a
- // really long time. Walking things manually with the code below
- // allows the 400 listview item page to load in about 3 seconds as
- // opposed to 30 seconds.
-
- this._addThumbClasses( li );
- this._addThumbClasses( $list.find( ".ui-link-inherit" ) );
-
- this._refreshCorners( create );
- },
-
- //create a string for ID/subpage url creation
- _idStringEscape: function( str ) {
- return str.replace(/[^a-zA-Z0-9]/g, '-');
- },
-
- _createSubPages: function() {
- var parentList = this.element,
- parentPage = parentList.closest( ".ui-page" ),
- parentUrl = parentPage.jqmData( "url" ),
- parentId = parentUrl || parentPage[ 0 ][ $.expando ],
- parentListId = parentList.attr( "id" ),
- o = this.options,
- dns = "data-" + $.mobile.ns,
- self = this,
- persistentFooterID = parentPage.find( ":jqmData(role='footer')" ).jqmData( "id" ),
- hasSubPages;
-
- if ( typeof listCountPerPage[ parentId ] === "undefined" ) {
- listCountPerPage[ parentId ] = -1;
- }
-
- parentListId = parentListId || ++listCountPerPage[ parentId ];
-
- $( parentList.find( "li>ul, li>ol" ).toArray().reverse() ).each(function( i ) {
- var self = this,
- list = $( this ),
- listId = list.attr( "id" ) || parentListId + "-" + i,
- parent = list.parent(),
- nodeEls = $( list.prevAll().toArray().reverse() ),
- nodeEls = nodeEls.length ? nodeEls : $( "
" + $.trim(parent.contents()[ 0 ].nodeValue) + "" ),
- title = nodeEls.first().getEncodedText(),//url limits to first 30 chars of text
- id = ( parentUrl || "" ) + "&" + $.mobile.subPageUrlKey + "=" + listId,
- theme = list.jqmData( "theme" ) || o.theme,
- countTheme = list.jqmData( "counttheme" ) || parentList.jqmData( "counttheme" ) || o.countTheme,
- newPage, anchor;
-
- //define hasSubPages for use in later removal
- hasSubPages = true;
-
- newPage = list.detach()
- .wrap( "
" )
- .parent()
- .before( "
" )
- .after( persistentFooterID ? $( "
") : "" )
- .parent()
- .appendTo( $.mobile.pageContainer );
-
- newPage.page();
-
- anchor = parent.find('a:first');
-
- if ( !anchor.length ) {
- anchor = $( "
" ).html( nodeEls || title ).prependTo( parent.empty() );
- }
-
- anchor.attr( "href", "#" + id );
-
- }).listview();
-
- // on pagehide, remove any nested pages along with the parent page, as long as they aren't active
- // and aren't embedded
- if( hasSubPages &&
- parentPage.is( ":jqmData(external-page='true')" ) &&
- parentPage.data("page").options.domCache === false ) {
-
- var newRemove = function( e, ui ){
- var nextPage = ui.nextPage, npURL;
-
- if( ui.nextPage ){
- npURL = nextPage.jqmData( "url" );
- if( npURL.indexOf( parentUrl + "&" + $.mobile.subPageUrlKey ) !== 0 ){
- self.childPages().remove();
- parentPage.remove();
- }
- }
- };
-
- // unbind the original page remove and replace with our specialized version
- parentPage
- .unbind( "pagehide.remove" )
- .bind( "pagehide.remove", newRemove);
- }
- },
-
- // TODO sort out a better way to track sub pages of the listview this is brittle
- childPages: function(){
- var parentUrl = this.parentPage.jqmData( "url" );
-
- return $( ":jqmData(url^='"+ parentUrl + "&" + $.mobile.subPageUrlKey +"')");
- }
-});
-
-//auto self-init widgets
-$( document ).bind( "pagecreate create", function( e ){
- $( $.mobile.listview.prototype.options.initSelector, e.target ).listview();
-});
-
-})( jQuery );
-/*
-* "listview" filter extension
-*/
-
-(function( $, undefined ) {
-
-$.mobile.listview.prototype.options.filter = false;
-$.mobile.listview.prototype.options.filterPlaceholder = "Filter items...";
-$.mobile.listview.prototype.options.filterTheme = "c";
-$.mobile.listview.prototype.options.filterCallback = function( text, searchValue ){
- return text.toLowerCase().indexOf( searchValue ) === -1;
-};
-
-$( document ).delegate( ":jqmData(role='listview')", "listviewcreate", function() {
-
- var list = $( this ),
- listview = list.data( "listview" );
-
- if ( !listview.options.filter ) {
- return;
- }
-
- var wrapper = $( "