OLD | NEW |
1 var console = null; | 1 var consoleDiv = null; |
2 function getVideoURI(baseFileName) | 2 function getVideoURI(baseFileName) |
3 { | 3 { |
4 var fileExtension = | 4 var fileExtension = |
5 (document.createElement("video"). | 5 (document.createElement("video"). |
6 canPlayType('video/ogg; codecs="theora"') == "") ? "mp4" : "ogv"; | 6 canPlayType('video/ogg; codecs="theora"') == "") ? "mp4" : "ogv"; |
7 return "./content/" + baseFileName + "." + fileExtension; | 7 return "./content/" + baseFileName + "." + fileExtension; |
8 } | 8 } |
9 | 9 |
10 function consoleWrite(text) | 10 function consoleWrite(text) |
11 { | 11 { |
12 if (!console && document.body) | 12 if (!consoleDiv && document.body) |
13 { | 13 { |
14 console = document.createElement('div'); | 14 consoleDiv = document.createElement('div'); |
15 document.body.appendChild(console); | 15 document.body.appendChild(consoleDiv); |
16 } | 16 } |
17 var span = document.createElement("span"); | 17 var span = document.createElement("span"); |
18 span.appendChild(document.createTextNode(text)); | 18 span.appendChild(document.createTextNode(text)); |
19 span.appendChild(document.createElement('br')); | 19 span.appendChild(document.createElement('br')); |
20 console.appendChild(span); | 20 consoleDiv.appendChild(span); |
21 } | 21 } |
22 | 22 |
23 function waitForEventAndRunStep(eventName, element, func, stepTest) | 23 function waitForEventAndRunStep(eventName, element, func, stepTest) |
24 { | 24 { |
25 var eventCallback = function(event) | 25 var eventCallback = function(event) |
26 { | 26 { |
27 consoleWrite("EVENT(" + eventName + ")"); | 27 consoleWrite("EVENT(" + eventName + ")"); |
28 if (func) | 28 if (func) |
29 func(event); | 29 func(event); |
30 } | 30 } |
31 if (stepTest) | 31 if (stepTest) |
32 eventCallback = stepTest.step_func(eventCallback); | 32 eventCallback = stepTest.step_func(eventCallback); |
33 | 33 |
34 element.addEventListener(eventName, eventCallback, true); | 34 element.addEventListener(eventName, eventCallback, true); |
35 } | 35 } |
OLD | NEW |