Mercurial > hg > webaudioevaluationtool
annotate js/loader.js @ 3141:335bc77627e0 tip
fixing discrete interface to allow labels to display
author | Dave Moffat <me@davemoffat.com> |
---|---|
date | Mon, 26 Jul 2021 12:15:24 +0100 |
parents | 15104a43089d |
children |
rev | line source |
---|---|
nicholas@2384 | 1 // Script to load the relevant JS files if the system supports it |
nicholas@2683 | 2 /*globals window, document */ |
nicholas@2538 | 3 window.onload = function () { |
nicholas@2384 | 4 // First check if the Web Audio API is supported |
nicholas@2683 | 5 if (window.AudioContext === undefined && window.webkitAudioContext === undefined) { |
nicholas@2384 | 6 // Display unsuported error message |
nicholas@2384 | 7 var body = document.getElementsByTagName("body")[0]; |
nicholas@2384 | 8 body.innerHTML = "<h1>Sorry! Your browser is not supported :(</h1><p>Your browser does not support the HTML5 Web Audio API. Please use one of the following supported browsers instead.<p>"; |
nicholas@2384 | 9 var table = document.createElement("table"); |
nicholas@2384 | 10 table.border = "0"; |
nicholas@2384 | 11 table.innerHTML = "<tr><td>Chrome</td><td>v10 or newer</td></tr>"; |
nicholas@2384 | 12 table.innerHTML += "<tr><td>Firefox</td><td>v25 or newer</td></tr><tr><td>Safari (OSX)</td><td> v6 or newer, OSX only</td></tr>"; |
nicholas@2384 | 13 table.innerHTML += "<tr><td>Safari (iOS)</td><td>iOS 6.1 or newer</td></tr>"; |
nicholas@2384 | 14 table.innerHTML += "<tr><td>Edge</td><td>12 or newer</td></tr>"; |
nicholas@2384 | 15 body.appendChild(table); |
nicholas@2384 | 16 } else { |
nicholas@2384 | 17 var head = document.getElementsByTagName("head")[0]; |
nicholas@2384 | 18 var src_list = ['js/specification.js', 'js/core.js', 'js/loudness.js', 'js/xmllint.js', 'js/WAVE.js']; |
nicholas@2538 | 19 for (var i = 0; i < src_list.length; i++) { |
nicholas@2384 | 20 var src = src_list[i]; |
nicholas@2384 | 21 var script = document.createElement("script"); |
nicholas@2384 | 22 script.type = "text/javascript"; |
nicholas@2384 | 23 script.async = false; |
nicholas@2384 | 24 script.defer = true; |
nicholas@2384 | 25 script.src = src; |
nicholas@2384 | 26 head.appendChild(script); |
nicholas@2384 | 27 } |
nicholas@2384 | 28 } |
nicholas@2683 | 29 }; |