Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

Committer:
aymangrais
Date:
Mon Sep 28 03:38:43 2015 +0000
Revision:
42:8ffb253b09e7
Parent:
13:2b51f5267c92
increase ota timeout to be 5 seconds (instead of 1.5 sec)

Who changed what in which revision?

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