self-conscious-design
clone your own copy | download snapshot

Snapshots | iceberg

No images in this repository’s iceberg at this time

Inside this repository

self-conscious-test.xhtml
application/xhtml+xml

Download raw (2.7 KB)

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:epub="http://www.idpf.org/2007/ops">
    <head>
        <meta charset="utf-8">
        </meta>
        <title>self-conscious.epub</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
	<section id="Test">
		<h1>
			Self-conscious epub test.
		</h1>
		<p id="document">
			Document object: <span id="documentStatus">Unavailable</span>
		</p>
		<p id="navigator">
			Navigator object: <span id="navigatorStatus">Unavailable</span>
		</p>
		<p id="readingSystem">
			Reading-system object: <span id="readingSystemStatus">Unavailable</span><br />
			<span id="readingSystemProperties"></span>
		</p>
		<p id="readingSystemNameWrapper">
			Reading-system name: <span id="readingSystemName">Unknown</span>
		</p>
	</section>
        <script type="text/javascript">
        <![CDATA[
            var listProperties = function (object) {
		var proplist = ''
		
		for (prop in object) {
			if (typeof (object[prop]) == 'object') {
				proplist += '<li>' + prop + ': ' + object[prop]  + ':' + listProperties (object[prop]) + '</li>\n';
			} else if (typeof (object[prop]) == 'function') {
				proplist += '<li>' + prop + ': function() </li>\n';
			} else {
				proplist += '<li>' + prop + ': ' + object[prop]  + '</li>\n';
			}
		}
		
		return '<ul>' + proplist + '</ul>\n';
            }
        
            var adaptTextToReader = function() {
                var intro = document.getElementById("intro");
                intro.innerHTML = intro.innerHTML.replace("{{ navigator.epubReadingSystem.name }}", navigator.epubReadingSystem.name);
            };

            // if the Reading System knows about itself:
            if (document) {
		document.getElementById("documentStatus").innerHTML = "Available";
            }
            
            if (navigator) {
		document.getElementById("navigatorStatus").innerHTML = "Available";
            }
            
            if (navigator && navigator.hasOwnProperty('epubReadingSystem')) {
                // launch scripts:
                document.getElementById("readingSystemStatus").innerHTML = "Available";
                
                document.getElementById("readingSystemProperties").innerHTML = listProperties (navigator.epubReadingSystem);
            }
            
            if (navigator && navigator.hasOwnProperty('epubReadingSystem')) {
                // launch scripts:
                document.getElementById("readingSystemName").innerHTML = navigator.epubReadingSystem.name;
            }
        ]]>
        </script>
    </body>
</html>