Browse Source

Platform: markup improvements for web applications.

Indented and cleaned up cruft from HTML template, renamed
NaClApplication.css to WebApplication.css, as it is universal and not
tied only to NaCl.
pull/23/head
Vladimír Vondruš 13 years ago
parent
commit
15cc649b27
  1. 2
      src/Platform/CMakeLists.txt
  2. 32
      src/Platform/NaClApplication.h
  3. 0
      src/Platform/WebApplication.css
  4. 74
      src/Platform/magnum-info-nacl.html

2
src/Platform/CMakeLists.txt

@ -86,7 +86,7 @@ endif()
# JavaScript and CSS stuff for NaCl # JavaScript and CSS stuff for NaCl
if(WITH_NACLAPPLICATION OR WITH_WINDOWLESSNACLAPPLICATION) if(WITH_NACLAPPLICATION OR WITH_WINDOWLESSNACLAPPLICATION)
install(FILES NaClApplication.js NaClApplication.css DESTINATION ${MAGNUM_DATA_INSTALL_DIR}) install(FILES NaClApplication.js WebApplication.css DESTINATION ${MAGNUM_DATA_INSTALL_DIR})
endif() endif()
# GLX application # GLX application

32
src/Platform/NaClApplication.h

@ -75,26 +75,26 @@ to simplify porting.
You need to provide HTML markup for your application. Template one is below, You need to provide HTML markup for your application. Template one is below,
you can modify it to your liking. The markup references two files, you can modify it to your liking. The markup references two files,
`NaClApplication.js` and `NaClApplication.css`, both are in `Platform/` `NaClApplication.js` and `WebApplication.css`, both are in `Platform/`
directory in the source tree and are also installed into `share/magnum/` inside directory in the source tree and are also installed into `share/magnum/` inside
your NaCl toolchain. your NaCl toolchain.
@code @code
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>Magnum NaCl Application</title> <title>Magnum NaCl Application</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="stylesheet" href="NaClApplication.css" /> <link rel="stylesheet" href="WebApplication.css" />
</head> </head>
<body> <body>
<h1>Magnum NaCl Application</h1> <h1>Magnum NaCl Application</h1>
<div id="listener"> <div id="listener">
<script type="text/javascript" src="NaClApplication.js"></script> <embed id="module" type="application/x-nacl" src="application.nmf" />
<embed id="module" type="application/x-nacl" src="application.nmf" /> <div id="status">Initialization...</div>
<div id="status">Initialization...</div> <div id="statusDescription" />
<div id="statusDescription"></div> <script src="NaClApplication.js"></script>
</div> </div>
</body> </body>
</html> </html>
@endcode @endcode

0
src/Platform/NaClApplication.css → src/Platform/WebApplication.css

74
src/Platform/magnum-info-nacl.html

@ -1,41 +1,41 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>Magnum Info</title> <title>Magnum Info</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="stylesheet" href="NaClApplication.css" /> <link rel="stylesheet" href="WebApplication.css" />
<style type="text/css"> <style type="text/css">
#module { #module {
position: absolute; position: absolute;
visibility: hidden; /* The module doesn't display anything */ visibility: hidden; /* The module doesn't display anything */
} }
#info { #info {
width: 640px; width: 640px;
height: 480px; height: 480px;
overflow: auto; overflow: auto;
font-family: monospace; font-family: monospace;
white-space: pre-wrap; white-space: pre-wrap;
} }
</style> </style>
</head> </head>
<body> <body>
<h1>Magnum Info</h1> <h1>Magnum Info</h1>
<div id="listener"> <div id="listener">
<script type="text/javascript" src="NaClApplication.js"></script> <embed id="module" type="application/x-nacl" src="magnum-info.nmf" />
<script type="text/javascript"> <div id="status">Initialization...</div>
function messageReceived(message) { <div id="statusDescription" />
var info = document.getElementById('info'); <div id="info" />
info.innerHTML += message.data; <script src="NaClApplication.js"></script>
} <script type="text/javascript">
function messageReceived(message) {
var info = document.getElementById('info');
info.innerHTML += message.data;
}
var listener = document.getElementById('listener'); var listener = document.getElementById('listener');
listener.addEventListener('message', messageReceived, true); listener.addEventListener('message', messageReceived, true);
</script> </script>
<embed id="module" type="application/x-nacl" src="magnum-info.nmf" /> </div>
<div id="status">Initialization...</div> </body>
<div id="statusDescription"></div>
<div id="info"></div>
</div>
</body>
</html> </html>

Loading…
Cancel
Save