fix up /render/

pull/1/head
ansuz 8 years ago
parent 168338b898
commit fb21b4e46b

@ -2,7 +2,17 @@ html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
/*background-color: #073642;*/
color: #839496;
font-family: 'PT Sans', sans-serif;
}
body {
background-color: #002b36;
}
a:focus {
outline: thin dotted;
}
@ -39,13 +49,11 @@ table {
border-collapse: collapse;
border-spacing: 0;
}
html {
font-family: 'PT Sans', sans-serif;
}
pre,
code {
font-family: 'Inconsolata', sans-serif;
}
h1,
h2,
h3,
@ -55,18 +63,6 @@ h6 {
font-family: 'PT Sans Narrow', sans-serif;
font-weight: 700;
}
html {
background-color: #073642;
color: #839496;
margin: 1em;
}
body {
background-color: #002b36;
margin: 0 auto;
max-width: 23cm;
border: 1pt solid #586e75;
padding: 1em;
}
code {
background-color: #073642;
padding: 2px;
@ -94,7 +90,6 @@ pre {
background-color: #002b36;
color: #839496;
border: 1pt solid #586e75;
padding: 1em;
box-shadow: 5pt 5pt 8pt #073642;
}
pre code {
@ -118,3 +113,4 @@ h5 {
h6 {
font-size: 1.15em;
}

@ -3,46 +3,32 @@
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/common/render-sd.css"></link>
<link rel="stylesheet" href="/common/render-sd.css" />
<script data-main="main" src="/bower_components/requirejs/require.js"></script>
<style>
html, body {
padding: 0px;
margin: 0px;
box-sizing: border-box;
}
#target {
position: fixed;
padding: 0;
margin: 0;
width: 100%;
max-width: 100%;
min-height: 100%;
}
body { overflow-y: auto; }
#inner {
display: fixed;
width: 95%;
height: 100%;
overflow: auto;
font-size: 15px;
top: 0px;
left: 0px;
}
#inner {
margin: 15px;
}
/* don't show the textarea, it's strictly functional */
textarea {
display: none;
}
/* don't let images overflow*/
img {
max-width: 100%;
}
/* monospace for code */
code {
font-family: monospace;
}
/* bigger text size for difficult to read elements */
blockquote, p, pre, code, li {
font-size: 20px;
margin: 0px auto;
padding: 0px;
}
img { max-width: 100%; }
code { font-family: monospace; }
/* tables */
blockquote, p, pre, code, li { font-size: 20px; }
table, thead, tbody, th, tr, td{
border: 1pt solid #586e75;
background-color: #002b36;
@ -54,6 +40,3 @@
<div id="target">
<div id="inner"></div>
</div>
<textarea></textarea>
</body>
</html>

@ -5,10 +5,9 @@ define([
'/bower_components/marked/marked.min.js',
'/bower_components/hyperjson/hyperjson.js',
'/common/cryptpad-common.js',
//'/common/convert.js',
'/bower_components/jquery/dist/jquery.min.js',
'/bower_components/diff-dom/diffDOM.js',
'/customize/pad.js'
//'/customize/pad.js'
], function (Config, Realtime, Crypto, Marked, Hyperjson, Cryptpad) {
var $ = window.jQuery;
var DiffDom = window.diffDOM;
@ -27,7 +26,6 @@ define([
var config = {
websocketURL: Config.websocketURL,
channel: secret.channel,
//cryptKey: secret.key,
crypto: Crypto.createEncryptor(secret.key)
};
@ -49,7 +47,6 @@ define([
};
}());
var $inner = $('#inner');
var redrawTimeout;
var lazyDraw = function (md) {
if (redrawTimeout) { clearTimeout(redrawTimeout); }
@ -65,11 +62,23 @@ define([
module.realtime = info.realtime;
};
var getContent = function (userDoc) {
try {
var parsed = JSON.parse(userDoc);
if (typeof(parsed.content) !== 'string') {
throw new Error();
}
return parsed.content;
} catch (err) {
return userDoc;
}
};
// when your editor is ready
var onReady = config.onReady = function (info) {
console.log("Realtime is ready!");
var userDoc = module.realtime.getUserDoc();
lazyDraw(userDoc);
lazyDraw(getContent(userDoc));
initializing = false;
};
@ -77,7 +86,7 @@ define([
var onRemote = config.onRemote = function () {
if (initializing) { return; }
var userDoc = module.realtime.getUserDoc();
lazyDraw(userDoc);
lazyDraw(getContent(userDoc));
};
var onLocal = config.onLocal = function () {

Loading…
Cancel
Save