Browse Source

start time imrpovements; removing local js files

master
Christian Müller 11 years ago
parent
commit
b918f97d17
  1. 17
      resources/public/js/less.js
  2. 2
      resources/public/js/main.js
  3. 1272
      resources/public/js/marked.js
  4. 32
      resources/public/js/themes.js
  5. 4
      resources/public/styles/main.less
  6. 5
      src/notehub/views.clj

17
resources/public/js/less.js

File diff suppressed because one or more lines are too long

2
resources/public/js/main.js

@ -38,5 +38,5 @@ function onLoad() { @@ -38,5 +38,5 @@ function onLoad() {
}
if(iosDetected) $note.className += " ui-border"; else $note.focus();
}
showFooter();
showPage();
}

1272
resources/public/js/marked.js

File diff suppressed because it is too large Load Diff

32
resources/public/js/themes.js

@ -75,13 +75,13 @@ if (location.search.length > 0) { @@ -75,13 +75,13 @@ if (location.search.length > 0) {
}
var vars = {
'@background': themes[ui.theme].background.normal,
'@background_halftone': themes[ui.theme].background.halftone,
'@foreground': themes[ui.theme].foreground.normal,
'@foreground_halftone': themes[ui.theme].foreground.halftone,
'@link_fresh': themes[ui.theme].link.fresh,
'@link_visited': themes[ui.theme].link.visited,
'@link_hover': themes[ui.theme].link.hover
'background': themes[ui.theme].background.normal,
'background_halftone': themes[ui.theme].background.halftone,
'foreground': themes[ui.theme].foreground.normal,
'foreground_halftone': themes[ui.theme].foreground.halftone,
'link_fresh': themes[ui.theme].link.fresh,
'link_visited': themes[ui.theme].link.visited,
'link_hover': themes[ui.theme].link.hover
};
var fontURL = "https://fonts.googleapis.com/" +
@ -92,7 +92,7 @@ var fontURL = "https://fonts.googleapis.com/" + @@ -92,7 +92,7 @@ var fontURL = "https://fonts.googleapis.com/" +
if(ui["header-font"] || ui["text-font"]) {
injection = ["header-font", "text-font"].reduce(function(acc, font){
if(ui[font]) {
vars['@' + font.replace(/-/, "_")] = ui[font].replace(/\+/g," ");
vars[font.replace(/-/, "_")] = ui[font].replace(/\+/g," ");
return acc + "|" + ui[font];
} else return acc;
}, "");
@ -108,17 +108,25 @@ fileref.setAttribute("type", "text/css") @@ -108,17 +108,25 @@ fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", fontURL)
document.getElementsByTagName("head")[0].appendChild(fileref)
less.modifyVars(vars);
function showPage() {
less = {
modifyVars: vars
};
putFooter();
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "//cdnjs.cloudflare.com/ajax/libs/less.js/2.1.0/less.min.js";
document.head.appendChild(script);
}
function showFooter(){
function putFooter(){
var elem = $("footer");
if(!elem) return;
if(window.innerHeight * 0.85 >= document.body.clientHeight) {
elem.style.position = "fixed";
elem.style.bottom = 0;
}
show(elem);
}
// for the case if main.js is not loaded
var onLoad = showFooter;
var onLoad = showPage;

4
resources/public/styles/main.less

@ -88,7 +88,6 @@ a:visited { @@ -88,7 +88,6 @@ a:visited {
font-size: 0.8em;
padding-bottom: 1em;
text-align: center;
display: none;
@media screen and (max-width: 767px) {
font-size: 0.4em;
}
@ -101,6 +100,7 @@ html, body { @@ -101,6 +100,7 @@ html, body {
color: @foreground;
margin: 0;
padding: 0;
display: block !important;
}
#hero {
padding-top: 5em;
@ -179,7 +179,7 @@ textarea { @@ -179,7 +179,7 @@ textarea {
font-size: 1em;
height: 500px;
}
.hidden, #links {
.hidden {
display: none;
}
#dashed-line {

5
src/notehub/views.clj

@ -27,14 +27,13 @@ @@ -27,14 +27,13 @@
[:meta {:name "viewport" :content "width=device-width, initial-scale=1.0"}]
[:link {:rel "stylesheet/less" :type "text/css" :href "/styles/main.less"}]
(html
(include-js "/js/less.js")
(include-js "/js/themes.js"))
(when (= :js js?)
(html
(include-js "//cdnjs.cloudflare.com/ajax/libs/marked/0.3.2/marked.min.js")
(include-js "/js/md5.js")
(include-js "/js/marked.js")
(include-js "/js/main.js")))]
[:body {:onload "onLoad()"} content]))
[:body {:style "display: none;" :onload "onLoad()"} content]))
(defn- sanitize
"Breakes all usages of <script> & <iframe>"

Loading…
Cancel
Save