/* * jQuery Mobile Framework : "selectmenu" plugin * Copyright (c) jQuery Project * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. * Note: Code is in draft form and is subject to change */ (function($, undefined ) { $.widget( "mobile.selectmenu", $.mobile.widget, { options: { theme: null, disabled: false, icon: 'arrow-d', iconpos: 'right', inline: null, corners: true, shadow: true, iconshadow: true, menuPageTheme: 'b', overlayTheme: 'a' }, _create: function(){ var self = this, o = this.options, select = this.element .attr( "tabindex", "-1" ) .wrap( "
" ), selectID = select.attr( "id" ), label = $( "label[for="+ selectID +"]" ).addClass( "ui-select" ), buttonId = selectID + "-button", menuId = selectID + "-menu", thisPage = select.closest( ".ui-page" ), button = $( "", { "href": "#", "role": "button", "id": buttonId, "aria-haspopup": "true", "aria-owns": menuId }) .text( $( select[0].options.item(select[0].selectedIndex) ).text() ) .insertBefore( select ) .buttonMarkup({ theme: o.theme, icon: o.icon, iconpos: o.iconpos, inline: o.inline, corners: o.corners, shadow: o.shadow, iconshadow: o.iconshadow }), theme = /ui-btn-up-([a-z])/.exec( button.attr("class") )[1], menuPage = $( "
" + "
" + "
" + label.text() + "
"+ "
"+ "
"+ "
" ) .appendTo( $.pageContainer ) .page(), menuPageContent = menuPage.find( ".ui-content" ), screen = $( "
", {"class": "ui-listbox-screen ui-overlay ui-screen-hidden fade"}) .appendTo( thisPage ), listbox = $( "
", { "class": "ui-listbox ui-listbox-hidden ui-overlay-shadow ui-corner-all pop ui-body-" + o.overlayTheme } ) .insertAfter(screen), list = $( "