/**
* jQuery Mobile Menu
* Turn unordered list menu into dropdown select menu
* version 1.0(31-OCT-2011)
*
* Built on top of the jQuery library
* http://jquery.com
*
* Documentation
* http://github.com/mambows/mobilemenu
*/
(function($){
$.fn.mobileMenu = function(options) {
var defaults = {
defaultText: 'Navigate to...',
className: 'select-menu',
subMenuClass: 'sub-menu',
subMenuDash: '–'
},
settings = $.extend( defaults, options ),
el = $(this);
$("head").append('')
this.each(function(){
// ad class to submenu list
el.find('ul').addClass(settings.subMenuClass);
// Create base menu
$('',{'class':settings.className}).insertAfter(el);
// Create default option
$('', {"value":'#', "text":settings.defaultText}).appendTo( '.' + settings.className );
// Create select option from menu
el.find('a,.separator').each(function(){
var $this = $(this),
optText = $this.context.firstChild.textContent,
optSub = $this.parents( '.' + settings.subMenuClass ),
len = optSub.length,
dash;
// if menu has sub menu
if( $this.parents('ul').hasClass( settings.subMenuClass ) ) {
dash = Array( len+1 ).join( settings.subMenuDash );
optText = dash + optText;
}
if($this.is('span')){
// Now build menu and append it
$('', {"label":optText,}).appendTo('.' + settings.className);
}else{
// Now build menu and append it
$('', {"value":this.href, "html":optText, "selected":(this.href == window.location.href)}).appendTo( '.' + settings.className );
}
}); // End el.find('a').each
// Change event on select element
$('.' + settings.className).change(function(){
var locations = $(this).val();
if( locations !== '#' ) {
window.location.href = $(this).val();
}
});
}); // End this.each
return this;
};
})(jQuery);
/*
playback timings (ms):
LoadShardBlock: 29.219 (3)
esindex: 0.01
captures_list: 49.183
CDXLines.iter: 11.63 (3)
PetaboxLoader3.datanode: 50.475 (5)
exclusion.robots.fetch: 0.218 (2)
exclusion.robots: 0.957
exclusion.robots.policy: 0.341
RedisCDXSource: 3.843
PetaboxLoader3.resolve: 86.759 (2)
load_resource: 187.073
*/