1 <!DOCTYPE html> 2 <!-- much of this is stolen from omahaproxy.appspot.com/viewer --> 3 <html> 4 <head> 5 <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> 6 <title>NaCl SDK Manifest Viewer</title> 7 </head> 8 <style type="text/css" media="screen"> 9 body { 10 font-family: monospace; 11 font-size: 10pt; 12 } 13 14 table { 15 border-collapse: collapse; 16 border-color: rgb(100, 100, 100); 17 border-style: solid; 18 border-width: 1px 0px 1px 0px; 19 } 20 21 table td { 22 padding: 3px; 23 border-color: rgb(100, 100, 100); 24 border-style: solid; 25 border-width: 0px 1px 0px 1px; 26 } 27 28 thead { 29 background-color: lightblue; 30 font-weight: bold; 31 border-style: solid; 32 border-color: rgb(100, 100, 100); 33 border-width: 0px 0px 2px 0px; 34 text-align: center; 35 } 36 37 tbody tr:nth-child(odd) { 38 background-color: rgb(230, 230, 230); 39 } 40 41 tbody tr:hover { 42 background-color: orange; 43 } 44 45 td a { 46 padding: 3px; 47 } 48 </style> 49 <body> 50 <h1>NaCl SDK Manifest Viewer</h1> 51 <table> 52 <thead id="columns"> 53 </thead> 54 <tbody id="rows"> 55 </tbody> 56 </table> 57 <h2>Most recent upload log:</h2> 58 <pre id="log"> 59 </pre> 60 <script type="application/javascript"> 61 function loadText(url, callback) { 62 var xhr = new XMLHttpRequest(); 63 xhr.open('GET', url, true); 64 xhr.onreadystatechange = function (e) { 65 if (xhr.readyState == 4) { 66 if (xhr.status == 200) { 67 callback(xhr.responseText); 68 } else { 69 alert("Failed to load: error " + xhr.status); 70 } 71 } 72 } 73 xhr.send(null); 74 } 75 76 function loadJson(url, callback) { 77 loadText(url, function (text) { 78 callback(JSON.parse(text)); 79 }); 80 } 81 82 function removeAllChildren(elm) { 83 while (elm.childNodes.length) { 84 elm.removeChild(elm.firstChild); 85 } 86 } 87 88 function display(data) { 89 data = data.bundles; 90 91 var columnsElm = document.getElementById('columns'); 92 var rowsElm = document.getElementById('rows'); 93 removeAllChildren(columnsElm); 94 removeAllChildren(rowsElm); 95 96 // Create the column headers. 97 var tr = document.createElement('tr'); 98 var columns = [ 99 'name', 'version', 'revision', 'win', 'mac', 'linux', 'all' 100 ]; 101 for (var i = 0; i < columns.length; ++i) { 102 var td = document.createElement('td'); 103 var text = document.createTextNode(columns[i]); 104 td.appendChild(text); 105 tr.appendChild(td); 106 } 107 columnsElm.appendChild(tr); 108 109 var platforms = ['win', 'mac', 'linux', 'all']; 110 111 for (var i = 0; i < data.length; ++i) { 112 var tr = document.createElement('tr'); 113 for (var j = 0; j < columns.length; ++j) { 114 var td = document.createElement('td'); 115 var node; 116 if (platforms.indexOf(columns[j]) != -1) { 117 var archives = data[i].archives; 118 for (var k = 0; k < archives.length; ++k) { 119 if (columns[j] == archives[k].host_os) { 120 var url = archives[k].url; 121 var lastSlash = url.lastIndexOf('/'); 122 var nextDot = url.indexOf('.', lastSlash); 123 name = url.substr(lastSlash + 1, nextDot - lastSlash - 1); 124 node = document.createElement('a'); 125 node.setAttribute('href', url); 126 node.appendChild(document.createTextNode(name)); 127 td.appendChild(node); 128 } 129 } 130 } else { 131 node = document.createTextNode(data[i][columns[j]]); 132 td.appendChild(node); 133 } 134 tr.appendChild(td); 135 } 136 rowsElm.appendChild(tr); 137 } 138 } 139 140 function displayLog(text) { 141 document.getElementById('log').textContent = text; 142 } 143 144 loadJson('naclsdk_manifest2.json', display); 145 loadText('naclsdk_manifest2.json.log', displayLog); 146 </script> 147 </body> 148 </html> 149