Mercurial > hg > webaudioevaluationtool
comparison core.js @ 2170:4f769a43d8ed
Moved returnDateNode() into interfaceContext. returnDateNode no longer uses deprecated Attribute Objects.
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Mon, 21 Mar 2016 15:15:40 +0000 |
parents | b1675f657e3c |
children | ff7d0fb646f1 |
comparison
equal
deleted
inserted
replaced
2169:b1675f657e3c | 2170:4f769a43d8ed |
---|---|
1763 console.log(inputSequenceClone.toString()); // print original array to console | 1763 console.log(inputSequenceClone.toString()); // print original array to console |
1764 console.log(outputSequence.toString()); // print randomised array to console | 1764 console.log(outputSequence.toString()); // print randomised array to console |
1765 return holdArr; | 1765 return holdArr; |
1766 } | 1766 } |
1767 | 1767 |
1768 function returnDateNode() | |
1769 { | |
1770 // Create an XML Node for the Date and Time a test was conducted | |
1771 // Structure is | |
1772 // <datetime> | |
1773 // <date year="##" month="##" day="##">DD/MM/YY</date> | |
1774 // <time hour="##" minute="##" sec="##">HH:MM:SS</time> | |
1775 // </datetime> | |
1776 var dateTime = new Date(); | |
1777 var year = document.createAttribute('year'); | |
1778 var month = document.createAttribute('month'); | |
1779 var day = document.createAttribute('day'); | |
1780 var hour = document.createAttribute('hour'); | |
1781 var minute = document.createAttribute('minute'); | |
1782 var secs = document.createAttribute('secs'); | |
1783 | |
1784 year.nodeValue = dateTime.getFullYear(); | |
1785 month.nodeValue = dateTime.getMonth()+1; | |
1786 day.nodeValue = dateTime.getDate(); | |
1787 hour.nodeValue = dateTime.getHours(); | |
1788 minute.nodeValue = dateTime.getMinutes(); | |
1789 secs.nodeValue = dateTime.getSeconds(); | |
1790 | |
1791 var hold = document.createElement("datetime"); | |
1792 var date = document.createElement("date"); | |
1793 date.textContent = year.nodeValue+'/'+month.nodeValue+'/'+day.nodeValue; | |
1794 var time = document.createElement("time"); | |
1795 time.textContent = hour.nodeValue+':'+minute.nodeValue+':'+secs.nodeValue; | |
1796 | |
1797 date.setAttributeNode(year); | |
1798 date.setAttributeNode(month); | |
1799 date.setAttributeNode(day); | |
1800 time.setAttributeNode(hour); | |
1801 time.setAttributeNode(minute); | |
1802 time.setAttributeNode(secs); | |
1803 | |
1804 hold.appendChild(date); | |
1805 hold.appendChild(time); | |
1806 return hold; | |
1807 | |
1808 } | |
1809 | |
1810 function Specification() { | 1768 function Specification() { |
1811 // Handles the decoding of the project specification XML into a simple JavaScript Object. | 1769 // Handles the decoding of the project specification XML into a simple JavaScript Object. |
1812 | 1770 |
1813 this.interface = null; | 1771 this.interface = null; |
1814 this.projectReturn = "null"; | 1772 this.projectReturn = "null"; |
2487 node.appendChild(vendor); | 2445 node.appendChild(vendor); |
2488 node.appendChild(userAgent); | 2446 node.appendChild(userAgent); |
2489 node.appendChild(screen); | 2447 node.appendChild(screen); |
2490 return node; | 2448 return node; |
2491 }; | 2449 }; |
2450 | |
2451 this.returnDateNode = function() | |
2452 { | |
2453 // Create an XML Node for the Date and Time a test was conducted | |
2454 // Structure is | |
2455 // <datetime> | |
2456 // <date year="##" month="##" day="##">DD/MM/YY</date> | |
2457 // <time hour="##" minute="##" sec="##">HH:MM:SS</time> | |
2458 // </datetime> | |
2459 var dateTime = new Date(); | |
2460 var hold = storage.document.createElement("datetime"); | |
2461 var date = storage.document.createElement("date"); | |
2462 var time = storage.document.createElement("time"); | |
2463 date.setAttribute('year',dateTime.getFullYear()); | |
2464 date.setAttribute('month',dateTime.getMonth()+1); | |
2465 date.setAttribute('day',dateTime.getDate()); | |
2466 time.setAttribute('hour',dateTime.getHours()); | |
2467 time.setAttribute('minute',dateTime.getMinutes); | |
2468 time.setAttribute('secs',dateTime.getSeconds()); | |
2469 | |
2470 hold.appendChild(date); | |
2471 hold.appendChild(time); | |
2472 return hold; | |
2473 | |
2474 } | |
2492 | 2475 |
2493 this.commentBoxes = new function() { | 2476 this.commentBoxes = new function() { |
2494 this.boxes = []; | 2477 this.boxes = []; |
2495 this.injectPoint = null; | 2478 this.injectPoint = null; |
2496 this.elementCommentBox = function(audioObject) { | 2479 this.elementCommentBox = function(audioObject) { |
3187 this.document = document.implementation.createDocument(null,"waetresult"); | 3170 this.document = document.implementation.createDocument(null,"waetresult"); |
3188 this.root = this.document.childNodes[0]; | 3171 this.root = this.document.childNodes[0]; |
3189 var projectDocument = specification.projectXML; | 3172 var projectDocument = specification.projectXML; |
3190 projectDocument.setAttribute('file-name',url); | 3173 projectDocument.setAttribute('file-name',url); |
3191 this.root.appendChild(projectDocument); | 3174 this.root.appendChild(projectDocument); |
3192 this.root.appendChild(returnDateNode()); | 3175 this.root.appendChild(interfaceContext.returnDateNode()); |
3193 this.root.appendChild(interfaceContext.returnNavigator()); | 3176 this.root.appendChild(interfaceContext.returnNavigator()); |
3194 } else { | 3177 } else { |
3195 this.document = existingStore; | 3178 this.document = existingStore; |
3196 this.root = existingStore.children[0]; | 3179 this.root = existingStore.children[0]; |
3197 this.SessionKey.key = this.root.getAttribute("key"); | 3180 this.SessionKey.key = this.root.getAttribute("key"); |