1/* CUSTOMIZED */ 2/*! http://tinynav.viljamis.com v1.03 by @viljamis */ 3(function ($, window, i) { 4 $.fn.tinyNav = function (options) { 5 6 // Default settings 7 var settings = $.extend({ 8 'active':'selected', // String: Set the "active" class 9 'header':true // Boolean: Show header instead of the active item 10 }, options); 11 12 return this.each(function () { 13 // Used for namespacing 14 i++; 15 var $nav = $(this); 16 var namespace = 'tinynav' 17 var namespace_i = namespace + i; 18 var l_namespace_i = '.l_' + namespace_i; 19 var $select = $('<select/>').addClass(namespace + ' ' + namespace_i); 20 21 if ($nav.is('ul,ol')) { 22 23 if (settings.header) { 24 $select.append($('<option/>').text('Navegar ...')); 25 } 26 27 // Build options 28 var options = ''; 29 $nav.addClass('l_' + namespace_i).find('a').each(function () { 30 var indent = getItemIndent($(this)); 31 options += '<option value="' + $(this).attr('href') + '">' + indent + $(this).text() + '</option>'; 32 }); 33 34 // Append options into a select 35 $select.append(options); 36 37 // Select the active item 38 if (!settings.header) { 39 $select.find(':eq(' + $(l_namespace_i + ' li') 40 .index($(l_namespace_i + ' li.' + settings.active)) + ')') 41 .attr('selected', true); 42 } 43 44 // Change window location 45 $select.change(function () { 46 window.location.href = $(this).val(); 47 }); 48 49 // Inject select 50 $(l_namespace_i).after($select); 51 52 } 53 54 }); 55 56 function getItemIndent(item) { 57 var i=0; 58 var indent = ''; 59 while (item) { 60 if(i==50){ 61 break; 62 } 63 var tagName = item.prop("nodeName").toUpperCase(); 64 if (tagName == 'NAV') { 65 break; 66 } else if ((tagName == 'UL') || (tagName == 'OL')) { 67 indent += ' - '; 68 } 69 item = item.parent(); 70 i++; 71 } 72 return indent; 73 } 74 75 }; 76})(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.