bugfix: markdown text was visible before page load

This commit is contained in:
Christian Mueller
2014-01-03 22:47:39 +01:00
parent 22409a1341
commit 876faa9da1
3 changed files with 26 additions and 24 deletions
+3
View File
@@ -33,6 +33,7 @@ var updatePreview = function(){
}, delay); }, delay);
}; };
function loadPage() {
if($action){ if($action){
if($action.value == "update") updatePreview(); else $draft.value = ""; if($action.value == "update") updatePreview(); else $draft.value = "";
$draft.onkeyup = updatePreview; $draft.onkeyup = updatePreview;
@@ -47,4 +48,6 @@ if($action){
var mdDocs = document.getElementsByClassName("markdown"); var mdDocs = document.getElementsByClassName("markdown");
for(var i = 0; i < mdDocs.length; i++){ for(var i = 0; i < mdDocs.length; i++){
mdDocs[i].innerHTML = marked(mdDocs[i].innerHTML); mdDocs[i].innerHTML = marked(mdDocs[i].innerHTML);
show(mdDocs[i]);
}
} }
+1 -1
View File
@@ -143,7 +143,7 @@ textarea {
font-size: 1em; font-size: 1em;
height: 500px; height: 500px;
} }
.hidden { .hidden, .markdown {
display: none; display: none;
} }
h1 { h1 {
+4 -5
View File
@@ -40,10 +40,6 @@
:rel "stylesheet" :rel "stylesheet"
:type "text/css"}] :type "text/css"}]
[:link {:rel "stylesheet/less" :type "text/css" :href "/style.less"}] [:link {:rel "stylesheet/less" :type "text/css" :href "/style.less"}]
; google analytics code should appear in prod mode only
(if-not (dev-mode?) (include-js "/js/google-analytics.js"))]
[:body content
; we only need JS during a new note creation, so don't render it otherwise
(html (html
(include-js "/js/less.js") (include-js "/js/less.js")
(include-js "/js/md5.js") (include-js "/js/md5.js")
@@ -57,7 +53,10 @@
'@foreground_halftone': themes['" theme "'].foreground.halftone, '@foreground_halftone': themes['" theme "'].foreground.halftone,
'@link_fresh': themes['" theme "'].link.fresh, '@link_fresh': themes['" theme "'].link.fresh,
'@link_visited': themes['" theme "'].link.visited, '@link_visited': themes['" theme "'].link.visited,
'@link_hover': themes['" theme "'].link.hover});")))]))) '@link_hover': themes['" theme "'].link.hover});")))
; google analytics code should appear in prod mode only
(if-not (dev-mode?) (include-js "/js/google-analytics.js"))]
[:body {:onload "loadPage()"} content])))
(defn layout (defn layout
"Generates the main html layout" "Generates the main html layout"