FRDM K64F Metronome

Committer:
ram54288
Date:
Sun May 14 18:37:05 2017 +0000
Revision:
0:dbad57390bd1
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ram54288 0:dbad57390bd1 1 function toggleVisibility(linkObj)
ram54288 0:dbad57390bd1 2 {
ram54288 0:dbad57390bd1 3 var base = $(linkObj).attr('id');
ram54288 0:dbad57390bd1 4 var summary = $('#'+base+'-summary');
ram54288 0:dbad57390bd1 5 var content = $('#'+base+'-content');
ram54288 0:dbad57390bd1 6 var trigger = $('#'+base+'-trigger');
ram54288 0:dbad57390bd1 7 var src=$(trigger).attr('src');
ram54288 0:dbad57390bd1 8 if (content.is(':visible')===true) {
ram54288 0:dbad57390bd1 9 content.hide();
ram54288 0:dbad57390bd1 10 summary.show();
ram54288 0:dbad57390bd1 11 $(linkObj).addClass('closed').removeClass('opened');
ram54288 0:dbad57390bd1 12 $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
ram54288 0:dbad57390bd1 13 } else {
ram54288 0:dbad57390bd1 14 content.show();
ram54288 0:dbad57390bd1 15 summary.hide();
ram54288 0:dbad57390bd1 16 $(linkObj).removeClass('closed').addClass('opened');
ram54288 0:dbad57390bd1 17 $(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
ram54288 0:dbad57390bd1 18 }
ram54288 0:dbad57390bd1 19 return false;
ram54288 0:dbad57390bd1 20 }
ram54288 0:dbad57390bd1 21
ram54288 0:dbad57390bd1 22 function updateStripes()
ram54288 0:dbad57390bd1 23 {
ram54288 0:dbad57390bd1 24 $('table.directory tr').
ram54288 0:dbad57390bd1 25 removeClass('even').filter(':visible:even').addClass('even');
ram54288 0:dbad57390bd1 26 }
ram54288 0:dbad57390bd1 27
ram54288 0:dbad57390bd1 28 function toggleLevel(level)
ram54288 0:dbad57390bd1 29 {
ram54288 0:dbad57390bd1 30 $('table.directory tr').each(function() {
ram54288 0:dbad57390bd1 31 var l = this.id.split('_').length-1;
ram54288 0:dbad57390bd1 32 var i = $('#img'+this.id.substring(3));
ram54288 0:dbad57390bd1 33 var a = $('#arr'+this.id.substring(3));
ram54288 0:dbad57390bd1 34 if (l<level+1) {
ram54288 0:dbad57390bd1 35 i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
ram54288 0:dbad57390bd1 36 a.html('&#9660;');
ram54288 0:dbad57390bd1 37 $(this).show();
ram54288 0:dbad57390bd1 38 } else if (l==level+1) {
ram54288 0:dbad57390bd1 39 i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
ram54288 0:dbad57390bd1 40 a.html('&#9658;');
ram54288 0:dbad57390bd1 41 $(this).show();
ram54288 0:dbad57390bd1 42 } else {
ram54288 0:dbad57390bd1 43 $(this).hide();
ram54288 0:dbad57390bd1 44 }
ram54288 0:dbad57390bd1 45 });
ram54288 0:dbad57390bd1 46 updateStripes();
ram54288 0:dbad57390bd1 47 }
ram54288 0:dbad57390bd1 48
ram54288 0:dbad57390bd1 49 function toggleFolder(id)
ram54288 0:dbad57390bd1 50 {
ram54288 0:dbad57390bd1 51 // the clicked row
ram54288 0:dbad57390bd1 52 var currentRow = $('#row_'+id);
ram54288 0:dbad57390bd1 53
ram54288 0:dbad57390bd1 54 // all rows after the clicked row
ram54288 0:dbad57390bd1 55 var rows = currentRow.nextAll("tr");
ram54288 0:dbad57390bd1 56
ram54288 0:dbad57390bd1 57 var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
ram54288 0:dbad57390bd1 58
ram54288 0:dbad57390bd1 59 // only match elements AFTER this one (can't hide elements before)
ram54288 0:dbad57390bd1 60 var childRows = rows.filter(function() { return this.id.match(re); });
ram54288 0:dbad57390bd1 61
ram54288 0:dbad57390bd1 62 // first row is visible we are HIDING
ram54288 0:dbad57390bd1 63 if (childRows.filter(':first').is(':visible')===true) {
ram54288 0:dbad57390bd1 64 // replace down arrow by right arrow for current row
ram54288 0:dbad57390bd1 65 var currentRowSpans = currentRow.find("span");
ram54288 0:dbad57390bd1 66 currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
ram54288 0:dbad57390bd1 67 currentRowSpans.filter(".arrow").html('&#9658;');
ram54288 0:dbad57390bd1 68 rows.filter("[id^=row_"+id+"]").hide(); // hide all children
ram54288 0:dbad57390bd1 69 } else { // we are SHOWING
ram54288 0:dbad57390bd1 70 // replace right arrow by down arrow for current row
ram54288 0:dbad57390bd1 71 var currentRowSpans = currentRow.find("span");
ram54288 0:dbad57390bd1 72 currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
ram54288 0:dbad57390bd1 73 currentRowSpans.filter(".arrow").html('&#9660;');
ram54288 0:dbad57390bd1 74 // replace down arrows by right arrows for child rows
ram54288 0:dbad57390bd1 75 var childRowsSpans = childRows.find("span");
ram54288 0:dbad57390bd1 76 childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
ram54288 0:dbad57390bd1 77 childRowsSpans.filter(".arrow").html('&#9658;');
ram54288 0:dbad57390bd1 78 childRows.show(); //show all children
ram54288 0:dbad57390bd1 79 }
ram54288 0:dbad57390bd1 80 updateStripes();
ram54288 0:dbad57390bd1 81 }
ram54288 0:dbad57390bd1 82
ram54288 0:dbad57390bd1 83
ram54288 0:dbad57390bd1 84 function toggleInherit(id)
ram54288 0:dbad57390bd1 85 {
ram54288 0:dbad57390bd1 86 var rows = $('tr.inherit.'+id);
ram54288 0:dbad57390bd1 87 var img = $('tr.inherit_header.'+id+' img');
ram54288 0:dbad57390bd1 88 var src = $(img).attr('src');
ram54288 0:dbad57390bd1 89 if (rows.filter(':first').is(':visible')===true) {
ram54288 0:dbad57390bd1 90 rows.css('display','none');
ram54288 0:dbad57390bd1 91 $(img).attr('src',src.substring(0,src.length-8)+'closed.png');
ram54288 0:dbad57390bd1 92 } else {
ram54288 0:dbad57390bd1 93 rows.css('display','table-row'); // using show() causes jump in firefox
ram54288 0:dbad57390bd1 94 $(img).attr('src',src.substring(0,src.length-10)+'open.png');
ram54288 0:dbad57390bd1 95 }
ram54288 0:dbad57390bd1 96 }
ram54288 0:dbad57390bd1 97