1(function ($) { 2 $.fn.mobileMenu = function (options) { 3 function isMobile() { 4 return ($('body').width() < settings.mobileWidth); 5 } 6 var defaults = { 7 defaultText: THEMEREX_NAVIGATE_TO, 8 className: 'select-menu', 9 mainMenuSelector: '#mainmenu', 10 mobileWidth: 800 11 }, 12 settings = $.extend(defaults, options), 13 el = $(this), 14 first = settings.defaultText; 15 this.each(function () { 16 var clonedObj = el.clone().removeClass('sf-js-enabled').removeAttr('id').addClass('theme_button'); 17 el.find('a').each(function () { 18 if($(this).text() == "") { 19 return; 20 } 21 if (this.href == window.location.href) 22 first = $(this).text(); 23 }); 24 $('<div class="' + settings.className + '">' 25 + '<a class="' + settings.className + '-button theme_button"><span class="icon"></span>' 26 + '<span class="holder">' + first + '</span></a>' 27 + '</div>').append(clonedObj).insertAfter(el); 28 $('.' + settings.className + ' > ul a').addClass('theme_button'); 29 $('.' + settings.className + ' > ul').hide(); 30 $('.' + settings.className).on('click', '.'+settings.className+'-button', function (e) { 31 $(this).siblings('ul').slideToggle(); 32 e.preventDefault(); 33 return false; 34 }); 35 }); 36 37 function runPlugin() { 38 if (isMobile()) { 39 $('.'+settings.className).show(); 40 $(settings.mainMenuSelector).hide(); 41 $('body').addClass('menu_mobile'); 42 } else { 43 $('.'+settings.className).hide(); 44 $(settings.mainMenuSelector).show(); 45 $('body').removeClass('menu_mobile'); 46 } 47 } 48 runPlugin(); 49 $(window).resize(function () { 50 runPlugin(); 51 }); 52 return this; 53 }; 54})(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.