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
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()
# 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 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
your NaCl toolchain.
@code
<!DOCTYPE html>
<html>
<head>
<title>Magnum NaCl Application</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="NaClApplication.css" />
</head>
<body>
<h1>Magnum NaCl Application</h1>
<div id="listener">
<script type="text/javascript" src="NaClApplication.js"></script>
<embed id="module" type="application/x-nacl" src="application.nmf" />
<div id="status">Initialization...</div>
<div id="statusDescription"></div>
</div>
</body>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Magnum NaCl Application</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="WebApplication.css" />
</head>
<body>
<h1>Magnum NaCl Application</h1>
<div id="listener">
<embed id="module" type="application/x-nacl" src="application.nmf" />
<div id="status">Initialization...</div>
<div id="statusDescription" />
<script src="NaClApplication.js"></script>
</div>
</body>
</html>
@endcode

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

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

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

Loading…
Cancel
Save