vendor: 2,373 bytes, lines 1-85
1/*! 2 http://tinynav.viljamis.com v1.1 by @viljamis 3 Licensed under the MIT license 4*/ 5 6(function ($, window, i) { 7 $.fn.tinyNav = function (options) { 8 9 // Default settings 10 var settings = $.extend({ 11 'active' : 'selected', // String: Set the "active" class 12 'header' : '', // String: Specify text for "header" and show header instead of the active item 13 'label' : '' // String: sets the <label> text for the <select> (if not set, no label will be added) 14 }, options); 15 16 return this.each(function () { 17 18 // Used for namespacing 19 i++; 20 21 var $nav = $(this), 22 // Namespacing 23 namespace = 'tinynav', 24 namespace_i = namespace + i, 25 l_namespace_i = '.l_' + namespace_i, 26 $select = $('<select/>').attr("id", namespace_i).addClass(namespace + ' ' + namespace_i); 27 28 if ($nav.is('ul,ol')) { 29 30 if (settings.header !== '') { 31 $select.append( 32 $('<option/>').text(settings.header) 33 ); 34 } 35 36 // Build options 37 var options = ''; 38 39 $nav 40 .addClass('l_' + namespace_i) 41 .find('a') 42 .each(function () { 43 options += '<option value="' + $(this).attr('href') + '">'; 44 var j; 45 for (j = 0; j < $(this).parents('ul, ol').length - 1; j++) { 46 options += '- '; 47 } 48 options += $(this).text() + '</option>'; 49 }); 50 51 // Append options into a select 52 $select.append(options); 53 54 // Select the active item 55 if (!settings.header) { 56 $select 57 .find(':eq(' + $(l_namespace_i + ' li') 58 .index($(l_namespace_i + ' li.' + settings.active)) + ')') 59 .attr('selected', true); 60 } 61 62 // Change window location 63 $select.change(function () { 64 window.location.href = $(this).val(); 65 }); 66 67 // Inject select 68 $(l_namespace_i).after($select); 69 70 // Inject label 71 if (settings.label) { 72 $select.before( 73 $("<label/>") 74 .attr("for", namespace_i) 75 .addClass(namespace + '_label ' + namespace_i + '_label') 76 .append(settings.label) 77 ); 78 } 79 80 } 81 82 }); 83 84 }; 85})(jQuery, this, 0);
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.