OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* globals zip */ | 7 /* globals zip */ |
8 | 8 |
9 'use strict'; | 9 'use strict'; |
10 | 10 |
11 var PAK_FILE = 'id1/pak0.pak'; | 11 var PAK_FILE = 'id1/pak0.pak'; |
12 | 12 |
13 function updateStatus(message) { | 13 function updateStatus(message) { |
14 document.getElementById('status').innerHTML += message + '<br />'; | 14 document.getElementById('status').innerHTML += message + '<br />'; |
15 } | 15 } |
16 | 16 |
17 /* | 17 /* |
18 * Creates and add to the DOM the NaCl embed tag which | 18 * Creates and add to the DOM the NaCl embed tag which |
19 * in effect launches Quake. | 19 * in effect launches Quake. |
20 */ | 20 */ |
21 function runQuake(pwd) { | 21 function runQuake(pwd) { |
22 var embed = document.createElement('embed'); | 22 var embed = document.createElement('embed'); |
23 embed.width = 800; | 23 embed.width = 800; |
24 embed.height = 600; | 24 embed.height = 600; |
25 embed.type = 'application/x-nacl'; | 25 embed.type = 'application/x-nacl'; |
26 embed.src = 'quakespasm.nmf'; | 26 embed.src = 'quakespasm.nmf'; |
27 if (pwd) | 27 if (pwd) { |
28 embed.setAttribute('PWD', pwd); | 28 embed.setAttribute('PWD', pwd); |
| 29 } |
29 document.getElementById('quake').appendChild(embed); | 30 document.getElementById('quake').appendChild(embed); |
30 } | 31 } |
31 | 32 |
32 function extractNextEntry(entries, i, filesystem, oncomplete) { | 33 function extractNextEntry(entries, i, filesystem, oncomplete) { |
33 if (i === entries.length) { | 34 if (i === entries.length) { |
34 oncomplete(); | 35 oncomplete(); |
35 return; | 36 return; |
36 } | 37 } |
37 | 38 |
38 var entry = entries[i]; | 39 var entry = entries[i]; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 loadFromLocalStorage(); | 135 loadFromLocalStorage(); |
135 } | 136 } |
136 }; | 137 }; |
137 req.open('GET', PAK_FILE); | 138 req.open('GET', PAK_FILE); |
138 req.send(null); | 139 req.send(null); |
139 } | 140 } |
140 | 141 |
141 window.onload = function() { | 142 window.onload = function() { |
142 onLoad(); | 143 onLoad(); |
143 }; | 144 }; |
OLD | NEW |