1/** 2 * jQuery Mobile Menu 3 * Turn unordered list menu into dropdown select menu 4 * version 1.0(31-OCT-2011) 5 * 6 * Built on top of the jQuery library 7 * http://jquery.com 8 * 9 * Documentation 10 * http://github.com/mambows/mobilemenu 11 */ 12(function($){ 13$.fn.mobileMenu = function(options) { 14 15 var defaults = { 16 defaultText: '', 17 className: 'select-menu', 18 subMenuClass: 'sub-menu', 19 subMenuDash: '– ' 20 }, 21 settings = $.extend( defaults, options ), 22 el = $(this); 23 24 this.each(function(){ 25 // ad class to submenu list 26 el.find('ul').addClass(settings.subMenuClass); 27 28 // Create base menu 29 $('<select />',{ 30 'class' : settings.className 31 }).insertAfter( el ); 32 33 // Create default option 34 $('<option />', { 35 "value" : '#', 36 "text" : settings.defaultText 37 }).appendTo( '.' + settings.className ); 38 39 // Create select option from menu 40 el.find('a').each(function(){ 41 var $this = $(this), 42 optText = ' ' + $this.text(), 43 optSub = $this.parents( '.' + settings.subMenuClass ), 44 len = optSub.length, 45 dash; 46 47 // if menu has sub menu 48 if( $this.parents('ul').hasClass( settings.subMenuClass ) ) { 49 dash = Array( len+1 ).join( settings.subMenuDash ); 50 optText = dash + optText; 51 } 52 53 // Now build menu and append it 54 $('<option />', { 55 "value" : this.href, 56 "html" : optText, 57 "selected" : (this.href == window.location.href) 58 }).appendTo( '.' + settings.className ); 59 60 }); // End el.find('a').each 61 62 // Change event on select element 63 $('.' + settings.className).change(function(){ 64 var locations = $(this).val(); 65 if( locations !== '#' ) { 66 window.location.href = $(this).val(); 67 }; 68 }); 69 70 }); // End this.each 71 72 return this; 73 74}; 75})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.