| function prefix() { |
| var tmp = document.getElementById("prefixcontent").innerHTML; |
| var data = tmp.split("END"); |
| var odd = "odd"; |
| |
| for (var i in data) { |
| // Parse the JSON data. |
| var obj = jQuery.parseJSON(data[i]); |
| |
| if (i % 2 == 0) { |
| odd = ""; |
| } else { |
| odd = "odd"; |
| } |
| |
| // Create the HTML for each prefix. |
| var output = '<tr class="' + odd + '">\n'; |
| |
| output += '<td rowspan="' + obj.prefixes.length + '">' + obj.router + '</td>'; |
| |
| |
| for (var i in obj.prefixes) { |
| output += '<td class="' + odd + '">' + obj.prefixes[i].timestamp + '</td>'; |
| output += '<td class="' + odd + '">' + obj.prefixes[i].prefix + '</td>'; |
| |
| if (obj.prefixes[i].status == "notintopology") { |
| output += '<td id="' + obj.prefixes[i].status + '">NPT</td>'; |
| } else { |
| output += '<td id="' + obj.prefixes[i].status + '">' + obj.prefixes[i].status + '</td>'; |
| } |
| |
| output += '</tr>'; |
| } |
| |
| // Append the data to the prefix table. |
| $('.one > tbody:last').append(output); |
| } |
| } |
| |
| function link() { |
| var tmp = document.getElementById("linkcontent").innerHTML; |
| var data = tmp.split("END"); |
| var odd = "odd"; |
| |
| for (var i in data) { |
| // Parse the JSON data. |
| var obj = jQuery.parseJSON(data[i]); |
| |
| if (i % 2 == 0) { |
| odd = ""; |
| } else { |
| odd = "odd"; |
| } |
| |
| // Create the HTML for each prefix. |
| var output = '<tr class="' + odd + '">\n'; |
| |
| output += '<td rowspan="' + obj.links.length + '">' + obj.router + '</td>'; |
| output += '<td rowspan="' + obj.links.length + '">' + obj.timestamp + '</td>'; |
| |
| for (var i in obj.links) { |
| output += '<td id="' + obj.links[i].status + '">' + obj.links[i].link + '</td>'; |
| |
| if (obj.links[i].status == "notintopology") { |
| output += '<td id="' + obj.links[i].status + '">NPT</td>'; |
| } else { |
| output += '<td id="' + obj.links[i].status + '">' + obj.links[i].status + '</td>'; |
| } |
| |
| output += '</tr>'; |
| } |
| |
| // Append the data to the prefix table. |
| $('.two > tbody:last').append(output); |
| } |
| } |
| |