Chromium Code Reviews| Index: visual_studio/NativeClientVSAddIn/InstallerResources/examples/hello_nacl/hello_nacl/index.html |
| diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/examples/hello_nacl/hello_nacl/index.html b/visual_studio/NativeClientVSAddIn/InstallerResources/examples/hello_nacl/hello_nacl/index.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ecebf9bd3cff0e05d65f9c3c0a9037d2277629a1 |
| --- /dev/null |
| +++ b/visual_studio/NativeClientVSAddIn/InstallerResources/examples/hello_nacl/hello_nacl/index.html |
| @@ -0,0 +1,71 @@ |
| +<!DOCTYPE html> |
| +<html> |
| + <!-- |
| + Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| + Use of this source code is governed by a BSD-style license that can be |
| + found in the LICENSE file. |
| + --> |
| +<head> |
| + <meta http-equiv="Pragma" content="no-cache"> |
| + <meta http-equiv="Expires" content="-1"> |
| + <script type="text/javascript"> |
| + function pageDidLoad() { |
|
binji
2012/10/15 22:15:46
indent 2
Sam Clegg
2012/10/15 22:54:52
Done.
|
| + appendStatus('Page loaded'); |
| + } |
| + |
| + var forceRedraw = function (element) { |
|
binji
2012/10/15 22:15:46
kill this function
Sam Clegg
2012/10/15 22:54:52
I'd rather leave that to Mark. He seems to think
Sam Clegg
2012/10/15 22:54:52
Done.
|
| + |
| + if (!element) { return; } |
| + |
| + var n = document.createTextNode(' '); |
| + var disp = element.style.display; // don't worry about previous display style |
| + |
| + element.appendChild(n); |
| + element.style.display = 'none'; |
| + |
| + setTimeout(function () { |
| + element.style.display = disp; |
| + n.parentNode.removeChild(n); |
| + }, 50); |
| + } |
| + |
| + function appendStatus(opt_message) { |
|
binji
2012/10/15 22:15:46
replace this with implementation from SDK examples
|
| + var statusField = document.getElementById('statusField'); |
| + console.log("hi"); |
| + if (statusField) { |
| + var newElt = document.createElement("opt_message"); |
| + newElt.innerHTML = "<br>" + opt_message; |
| + statusField.appendChild(newElt); |
| + forceRedraw(newElt); |
| + } |
| + } |
| + |
|
binji
2012/10/15 22:15:46
remove all extra newlines
Sam Clegg
2012/10/15 22:54:52
Done.
|
| + |
| + |
| + function handleMessage(message_event) { |
| + appendStatus(message_event.data); |
| + |
| + } |
| + |
| + </script> |
| +</head> |
| +<body onload="pageDidLoad()"> |
| + <div id="listener"> |
| + <script type="text/javascript"> |
| + var listener = document.getElementById('listener'); |
| + listener.addEventListener('message', handleMessage, true); |
| + </script> |
| + <h2>NaCl Module</h2> |
| + <embed name="nacl_module" |
| + id="nacl_module" |
| + style="border-style: solid;" |
| + width=200 |
| + height=200 |
| + src="hello_nacl.nmf" |
| + type="application/x-nacl"/> |
| + </div> |
| + <div> |
| + <h2>Messages: <code id="statusField"></code></h2> |
| + </div> |
| +</body> |
| +</html> |