Mercurial > hg > webaudioevaluationtool
changeset 951:55bf2500f278
Popup now in core.js, universal to interface.
author | Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk> |
---|---|
date | Tue, 26 May 2015 11:40:17 +0100 |
parents | 05e7edb032b9 |
children | c3a66f0b33cc |
files | ape.js core.js index.html |
diffstat | 3 files changed, 41 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/ape.js Mon May 25 11:14:12 2015 +0100 +++ b/ape.js Tue May 26 11:40:17 2015 +0100 @@ -222,18 +222,6 @@ insertPoint.innerHTML = null; // Clear the current schema // Create pre and post test questions - var blank = document.createElement('div'); - blank.className = 'testHalt'; - - var popupHolder = document.createElement('div'); - popupHolder.id = 'popupHolder'; - popupHolder.className = 'popupHolder'; - popupHolder.style.position = 'absolute'; - popupHolder.style.left = (window.innerWidth/2)-250 + 'px'; - popupHolder.style.top = (window.innerHeight/2)-125 + 'px'; - insertPoint.appendChild(popupHolder); - insertPoint.appendChild(blank); - hidePopup(); var preTest = xmlSetup.find('PreTest'); var postTest = xmlSetup.find('PostTest'); @@ -640,26 +628,6 @@ } } -function showPopup() -{ - var popupHolder = document.getElementById('popupHolder'); - popupHolder.style.zIndex = 3; - popupHolder.style.visibility = 'visible'; - var blank = document.getElementsByClassName('testHalt')[0]; - blank.style.zIndex = 2; - blank.style.visibility = 'visible'; -} - -function hidePopup() -{ - var popupHolder = document.getElementById('popupHolder'); - popupHolder.style.zIndex = -1; - popupHolder.style.visibility = 'hidden'; - var blank = document.getElementsByClassName('testHalt')[0]; - blank.style.zIndex = -2; - blank.style.visibility = 'hidden'; -} - function dragEnd(ev) { // Function call when a div has been dropped var slider = document.getElementById('slider');
--- a/core.js Mon May 25 11:14:12 2015 +0100 +++ b/core.js Tue May 26 11:40:17 2015 +0100 @@ -34,6 +34,46 @@ audioEngineContext = new AudioEngine(); }; +function createPopup() { + // Create popup window interface + var insertPoint = document.getElementById("topLevelBody"); + var blank = document.createElement('div'); + blank.className = 'testHalt'; + + var popupHolder = document.createElement('div'); + popupHolder.id = 'popupHolder'; + popupHolder.className = 'popupHolder'; + popupHolder.style.position = 'absolute'; + popupHolder.style.left = (window.innerWidth/2)-250 + 'px'; + popupHolder.style.top = (window.innerHeight/2)-125 + 'px'; + insertPoint.appendChild(popupHolder); + insertPoint.appendChild(blank); +} + +function showPopup() +{ + var popupHolder = document.getElementById('popupHolder'); + if (popupHolder == null || popupHolder == undefined) { + createPopup(); + popupHolder = document.getElementById('popupHolder'); + } + popupHolder.style.zIndex = 3; + popupHolder.style.visibility = 'visible'; + var blank = document.getElementsByClassName('testHalt')[0]; + blank.style.zIndex = 2; + blank.style.visibility = 'visible'; +} + +function hidePopup() +{ + var popupHolder = document.getElementById('popupHolder'); + popupHolder.style.zIndex = -1; + popupHolder.style.visibility = 'hidden'; + var blank = document.getElementsByClassName('testHalt')[0]; + blank.style.zIndex = -2; + blank.style.visibility = 'hidden'; +} + function loadProjectSpec(url) { // Load the project document from the given URL, decode the XML and instruct audioEngine to get audio data // If url is null, request client to upload project XML document
--- a/index.html Mon May 25 11:14:12 2015 +0100 +++ b/index.html Tue May 26 11:40:17 2015 +0100 @@ -26,7 +26,7 @@ </script> <!-- Uncomment the following script for automatic loading of projects --> <script> - url = 'PXL_test/brecht.xml'; //Project XML document location + url = 'example_eval/project.xml'; //Project XML document location loadProjectSpec(url); </script>