mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
77 lines
2.1 KiB
HTML
77 lines
2.1 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<style type="text/css" media="screen">
|
|
@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);
|
|
text|p {
|
|
display: block;
|
|
border: 1px solid black;
|
|
padding: 3px;
|
|
margin: 3px;
|
|
}
|
|
text|p[text|style-name='list.start'] {
|
|
color: red;
|
|
}
|
|
</style>
|
|
<script src="zip.js" type="text/javascript" charset="utf-8"></script>
|
|
<script src="base64.js" type="text/javascript" charset="utf-8"></script>
|
|
<script src="bytearray.js" type="text/javascript" charset="utf-8"></script>
|
|
<script src="rawinflate.js" type="text/javascript" charset="utf-8"></script>
|
|
<script type="text/javascript" charset="utf-8">
|
|
function init() {
|
|
var location = new String(document.location);
|
|
var pos = location.indexOf('#');
|
|
if (pos != -1) {
|
|
location = location.substr(pos+1);
|
|
}
|
|
document.body.innerHTML = location;
|
|
try {
|
|
loadFile(location);
|
|
} catch(e) {
|
|
document.body.innerHTML = e;
|
|
}
|
|
}
|
|
function clear() {
|
|
while (document.body.firstChild) {
|
|
document.body.removeChild(document.body.firstChild);
|
|
}
|
|
}
|
|
|
|
function loadFile(url) {
|
|
clear();
|
|
|
|
var ziplist = document.body;
|
|
var zip;
|
|
try {
|
|
zip = new jsodfkit.Zip(url);
|
|
} catch (e) {
|
|
ziplist.innerHTML = e;
|
|
return;
|
|
}
|
|
var xmldata = zip.load('content.xml');
|
|
if (!xmldata || xmldata.length == 0) {
|
|
throw "Cannot read content.xml";
|
|
}
|
|
var contentxml = document.createElement('div');
|
|
contentxml.id = 'contentxml';
|
|
var parser = new DOMParser();
|
|
var content = parser.parseFromString(xmldata, 'text/xml');
|
|
if (content && content.firstChild) {
|
|
content = document.importNode(content.firstChild, true);
|
|
contentxml.appendChild(content);
|
|
}
|
|
document.body.appendChild(contentxml);
|
|
}
|
|
</script>
|
|
|
|
<title></title>
|
|
</head>
|
|
|
|
<body onload='init()'>
|
|
<div id='contentxml'></div>
|
|
<div id='stylesxml'></div>
|
|
<div id='metaxml'></div>
|
|
</body>
|
|
</html>
|