Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 2301:18d390c66b47
Addresses issue #35, though I am not sure if there are any side-effects
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Wed, 27 Apr 2016 20:44:00 +0100 |
parents | a73495c6d604 |
children | f7604317ac27 |
comparison
equal
deleted
inserted
replaced
2299:a73495c6d604 | 2301:18d390c66b47 |
---|---|
2820 request: new XMLHttpRequest(), | 2820 request: new XMLHttpRequest(), |
2821 parent: this, | 2821 parent: this, |
2822 handleEvent: function() { | 2822 handleEvent: function() { |
2823 var parse = new DOMParser(); | 2823 var parse = new DOMParser(); |
2824 var xml = parse.parseFromString(this.request.response,"text/xml"); | 2824 var xml = parse.parseFromString(this.request.response,"text/xml"); |
2825 if (xml.getAllElementsByTagName("state")[0].textContent == "OK") { | 2825 var shouldGenerateKey = true; |
2826 this.key = xml.getAllElementsByTagName("key")[0].textContent; | 2826 if(xml.getAllElementsByTagName("state").length > 0){ |
2827 this.parent.root.setAttribute("key",this.key); | 2827 if (xml.getAllElementsByTagName("state")[0].textContent == "OK") { |
2828 this.parent.root.setAttribute("state","empty"); | 2828 this.key = xml.getAllElementsByTagName("key")[0].textContent; |
2829 } else { | 2829 this.parent.root.setAttribute("key",this.key); |
2830 this.generateKey(); | 2830 this.parent.root.setAttribute("state","empty"); |
2831 } | 2831 shouldGenerateKey = false; |
2832 } | |
2833 } | |
2834 if(shouldGenerateKey === true){ | |
2835 this.generateKey(); | |
2836 } | |
2832 }, | 2837 }, |
2833 generateKey: function() { | 2838 generateKey: function() { |
2834 var temp_key = randomString(32); | 2839 var temp_key = randomString(32); |
2835 this.request.open("GET","php/keygen.php?key="+temp_key,true); | 2840 this.request.open("GET","php/keygen.php?key="+temp_key,true); |
2836 this.request.addEventListener("load",this); | 2841 this.request.addEventListener("load",this); |