Mercurial > hg > webaudioevaluationtool
comparison python/comment_parser.html @ 2604:8188efa9415d
Merge branch 'vnext' into Dev_main
# Conflicts:
# css/core.css
# interfaces/ape.js
# js/specification.js
# tests/examples/APE_example.xml
# tests/examples/mushra_example.xml
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Mon, 14 Nov 2016 14:49:57 +0000 |
parents | 464c6c6692d6 |
children |
comparison
equal
deleted
inserted
replaced
2601:2577d983f291 | 2604:8188efa9415d |
---|---|
1 <html lang="en"> | 1 <html lang="en"> |
2 <head> | 2 |
3 <meta charset="utf-8" /> | 3 <head> |
4 <script type="text/javascript"> | 4 <meta charset="utf-8" /> |
5 function getXML() | 5 <script type="text/javascript"> |
6 { | 6 function getXML() { |
7 var XMLHttp = new XMLHttpRequest(); | 7 var XMLHttp = new XMLHttpRequest(); |
8 XMLHttp.open("GET","comment_parser.php?format=XML",true); | 8 XMLHttp.open("GET", "comment_parser.php?format=XML", true); |
9 XMLHttp.onload = function() { | 9 XMLHttp.onload = function() { |
10 // Now we have the XML data, extract | 10 // Now we have the XML data, extract |
11 var parse = new DOMParser(); | 11 var parse = new DOMParser(); |
12 var ajax = parse.parseFromString(XMLHttp.response,'text/xml'); | 12 var ajax = parse.parseFromString(XMLHttp.response, 'text/xml'); |
13 | 13 |
14 var parent = document.createElement("div"); | 14 var parent = document.createElement("div"); |
15 parent.appendChild(ajax.children[0]); | 15 parent.appendChild(ajax.children[0]); |
16 var file = [parent.innerHTML]; | 16 var file = [parent.innerHTML]; |
17 var bb = new Blob(file,{type : 'application/xml'}); | 17 var bb = new Blob(file, { |
18 generateLink(bb,".xml"); | 18 type: 'application/xml' |
19 } | 19 }); |
20 XMLHttp.send(); | 20 generateLink(bb, ".xml"); |
21 } | 21 } |
22 | 22 XMLHttp.send(); |
23 function getJSON() | 23 } |
24 { | 24 |
25 var XMLHttp = new XMLHttpRequest(); | 25 function getJSON() { |
26 XMLHttp.open("GET","comment_parser.php?format=JSON",true); | 26 var XMLHttp = new XMLHttpRequest(); |
27 XMLHttp.onload = function() { | 27 XMLHttp.open("GET", "comment_parser.php?format=JSON", true); |
28 // Now we have the XML data, extract | 28 XMLHttp.onload = function() { |
29 var file = [XMLHttp.response]; | 29 // Now we have the XML data, extract |
30 var bb = new Blob(file,{type : 'application/json'}); | 30 var file = [XMLHttp.response]; |
31 generateLink(bb,".json"); | 31 var bb = new Blob(file, { |
32 } | 32 type: 'application/json' |
33 XMLHttp.send(); | 33 }); |
34 generateLink(bb, ".json"); | |
34 } | 35 } |
35 | 36 XMLHttp.send(); |
36 function getCSV() | 37 } |
37 { | 38 |
38 var XMLHttp = new XMLHttpRequest(); | 39 function getCSV() { |
39 XMLHttp.open("GET","comment_parser.php?format=CSV",true); | 40 var XMLHttp = new XMLHttpRequest(); |
40 XMLHttp.onload = function() { | 41 XMLHttp.open("GET", "comment_parser.php?format=CSV", true); |
41 // Now we have the XML data, extract | 42 XMLHttp.onload = function() { |
42 var file = [XMLHttp.response]; | 43 // Now we have the XML data, extract |
43 var bb = new Blob(file,{type : 'text/csv'}); | 44 var file = [XMLHttp.response]; |
44 generateLink(bb,".csv"); | 45 var bb = new Blob(file, { |
45 } | 46 type: 'text/csv' |
46 XMLHttp.send(); | 47 }); |
48 generateLink(bb, ".csv"); | |
47 } | 49 } |
48 | 50 XMLHttp.send(); |
49 function generateLink(blobfile,fmt) | 51 } |
50 { | 52 |
51 var dnlk = window.URL.createObjectURL(blobfile); | 53 function generateLink(blobfile, fmt) { |
52 var a = document.createElement("a"); | 54 var dnlk = window.URL.createObjectURL(blobfile); |
53 a.hidden = ''; | 55 var a = document.createElement("a"); |
54 a.href = dnlk; | 56 a.hidden = ''; |
55 a.download = "save"+fmt; | 57 a.href = dnlk; |
56 a.textContent = "Save File"; | 58 a.download = "save" + fmt; |
57 document.getElementById("download").appendChild(a); | 59 a.textContent = "Save File"; |
58 } | 60 document.getElementById("download").appendChild(a); |
59 </script> | 61 } |
60 </head> | 62 |
61 <body> | 63 </script> |
62 <h1>WAET Test Results Analysis</h1> | 64 </head> |
63 <h2>Comment Extraction</h2> | 65 |
64 <p>All of the XMLs in the server 'saves/' directory are automatically parsed and downloaded, extracting only the comments. Simply select the comments you wish to extract below and your desired data format.</p> | 66 <body> |
65 <div id="download"></div> | 67 <h1>WAET Test Results Analysis</h1> |
66 <div> | 68 <h2>Comment Extraction</h2> |
67 <button onclick="getXML();">XML</button> | 69 <p>All of the XMLs in the server 'saves/' directory are automatically parsed and downloaded, extracting only the comments. Simply select the comments you wish to extract below and your desired data format.</p> |
68 <button onclick="getJSON();">JSON</button> | 70 <div id="download"></div> |
69 <button onclick="getCSV();">CSV</button> | 71 <div> |
70 </div> | 72 <button onclick="getXML();">XML</button> |
71 </body> | 73 <button onclick="getJSON();">JSON</button> |
74 <button onclick="getCSV();">CSV</button> | |
75 </div> | |
76 </body> | |
77 | |
72 </html> | 78 </html> |