FRDM K64F Metronome

Committer:
ram54288
Date:
Sun May 14 18:35:07 2017 +0000
Revision:
0:a2cb7295a1f7
Initial commit

Who changed what in which revision?

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