1$(document).ready(function(){ 2$('#tree').treed(); 3}); 4$.fn.extend({ 5 treed: function (o) { 6 7 var openedClass = 'glyphicon-minus-sign'; 8 var closedClass = 'glyphicon-plus-sign'; 9 10 if (typeof o != 'undefined'){ 11 if (typeof o.openedClass != 'undefined'){ 12 openedClass = o.openedClass; 13 } 14 if (typeof o.closedClass != 'undefined'){ 15 closedClass = o.closedClass; 16 } 17 }; 18 19 //initialize each of the top levels 20 var tree = $(this); 21 tree.addClass("tree"); 22 tree.find('li').has("ul").each(function () { 23 var branch = $(this); //li with children ul 24 branch.prepend("<i class='indicator glyphicon " + closedClass + "'></i>"); 25 branch.addClass('branch'); 26 branch.on('click', function (e) { 27 if (this == e.target) { 28 var icon = $(this).children('i:first'); 29 icon.toggleClass(openedClass + " " + closedClass); 30 $(this).children().children().toggle(); 31 } 32 }) 33 branch.children().children().toggle(); 34 }); 35 //fire event from the dynamically added icon 36 tree.find('.branch .indicator').each(function(){ 37 $(this).on('click', function () { 38 $(this).closest('li').click(); 39 }); 40 }); 41 //fire event to open branch if the li contains an anchor instead of text 42 tree.find('.branch>a').each(function () { 43 $(this).on('click', function (e) { 44 $(this).closest('li').click(); 45 e.preventDefault(); 46 }); 47 }); 48 //fire event to open branch if the li contains a button instead of text 49 tree.find('.branch>button').each(function () { 50 $(this).on('click', function (e) { 51 $(this).closest('li').click(); 52 e.preventDefault(); 53 }); 54 }); 55 } 56});
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.