1$.fn.extend({ 2 treed: function (o) { 3 4 var openedClass = 'glyphicon-minus-sign'; 5 var closedClass = 'glyphicon-plus-sign'; 6 7 if (typeof o != 'undefined'){ 8 if (typeof o.openedClass != 'undefined'){ 9 openedClass = o.openedClass; 10 } 11 if (typeof o.closedClass != 'undefined'){ 12 closedClass = o.closedClass; 13 } 14 }; 15 16 //initialize each of the top levels 17 var tree = $(this); 18 tree.addClass("tree"); 19 tree.find('li').has("ul").each(function () { 20 var branch = $(this); //li with children ul 21 branch.prepend("<i class='indicator glyphicon " + closedClass + "'></i>"); 22 branch.addClass('branch'); 23 branch.on('click', function (e) { 24 if (this == e.target) { 25 var icon = $(this).children('i:first'); 26 icon.toggleClass(openedClass + " " + closedClass); 27 $(this).children().children().toggle(); 28 } 29 }) 30 branch.children().children().toggle(); 31 }); 32 //fire event from the dynamically added icon 33 tree.find('.branch .indicator').each(function(){ 34 $(this).on('click', function () { 35 $(this).closest('li').click(); 36 }); 37 }); 38 39 if(tree.data('class') && tree.data('class') == 'no-click') { 40 //fire event to open branch if the li contains an anchor instead of text 41 tree.find('.branch>a').each(function () { 42 $(this).on('click', function (e) { 43 $(this).closest('li').click(); 44 e.preventDefault(); 45 }); 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}); 57 58//Initialization of treeviews 59 60$('#tree1').treed(); 61$('#tree1').show(); 62 63$('#tree2').treed({openedClass:'glyphicon-folder-open', closedClass:'glyphicon-folder-close'}); 64 65$('#tree3').treed({openedClass:'glyphicon-chevron-right', closedClass:'glyphicon-chevron-down'});
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.