excluded heavy js where not necessary
This commit is contained in:
@@ -38,14 +38,5 @@ function onLoad() {
|
|||||||
}
|
}
|
||||||
if(iosDetected) $note.className += " ui-border"; else $note.focus();
|
if(iosDetected) $note.className += " ui-border"; else $note.focus();
|
||||||
}
|
}
|
||||||
|
showLinks();
|
||||||
var links = $("links");
|
|
||||||
if(links){
|
|
||||||
if(window.innerHeight * 0.85 >= document.body.clientHeight) {
|
|
||||||
links.style.position = "fixed";
|
|
||||||
links.style.bottom = 0;
|
|
||||||
}
|
|
||||||
show(links);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
var $ = function(id){ return document.getElementById(id); }
|
||||||
|
var show = function(elem) { elem.style.display = "block" }
|
||||||
|
|
||||||
var themes = {
|
var themes = {
|
||||||
"dark": {
|
"dark": {
|
||||||
background: {
|
background: {
|
||||||
@@ -102,4 +105,18 @@ fileref.setAttribute("type", "text/css")
|
|||||||
fileref.setAttribute("href", fontURL)
|
fileref.setAttribute("href", fontURL)
|
||||||
document.getElementsByTagName("head")[0].appendChild(fileref)
|
document.getElementsByTagName("head")[0].appendChild(fileref)
|
||||||
|
|
||||||
less.modifyVars(vars);
|
less.modifyVars(vars);
|
||||||
|
|
||||||
|
function showLinks(){
|
||||||
|
var links = $("links");
|
||||||
|
if(links){
|
||||||
|
if(window.innerHeight * 0.85 >= document.body.clientHeight) {
|
||||||
|
links.style.position = "fixed";
|
||||||
|
links.style.bottom = 0;
|
||||||
|
}
|
||||||
|
show(links);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// for the case if main.js is not loaded
|
||||||
|
var onLoad = showLinks;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
[code]
|
[code]
|
||||||
{:status code
|
{:status code
|
||||||
:body (let [message (get-message (keyword (str "status-" code)))]
|
:body (let [message (get-message (keyword (str "status-" code)))]
|
||||||
(layout message
|
(layout :no-js message
|
||||||
[:article [:h1 message]]))})
|
[:article [:h1 message]]))})
|
||||||
|
|
||||||
(defn redirect [url]
|
(defn redirect [url]
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
(generate-string (api/version-manager api/update-note params))))
|
(generate-string (api/version-manager api/update-note params))))
|
||||||
|
|
||||||
(defroutes app-routes
|
(defroutes app-routes
|
||||||
(GET "/api" [] (layout (get-message :api-title)
|
(GET "/api" [] (layout :no-js (get-message :api-title)
|
||||||
[:article (md/to-html (slurp "API.md"))]))
|
[:article (md/to-html (slurp "API.md"))]))
|
||||||
|
|
||||||
(context "/api" []
|
(context "/api" []
|
||||||
|
|||||||
+11
-9
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
; Creates the main html layout
|
; Creates the main html layout
|
||||||
(defn layout
|
(defn layout
|
||||||
[title & content]
|
[js? title & content]
|
||||||
(html5
|
(html5
|
||||||
[:head
|
[:head
|
||||||
[:title (print-str (get-message :name) "—" title)]
|
[:title (print-str (get-message :name) "—" title)]
|
||||||
@@ -25,10 +25,12 @@
|
|||||||
[:link {:rel "stylesheet/less" :type "text/css" :href "/styles/main.less"}]
|
[:link {:rel "stylesheet/less" :type "text/css" :href "/styles/main.less"}]
|
||||||
(html
|
(html
|
||||||
(include-js "/js/less.js")
|
(include-js "/js/less.js")
|
||||||
(include-js "/js/themes.js")
|
(include-js "/js/themes.js"))
|
||||||
(include-js "/js/md5.js")
|
(when (= :js js?)
|
||||||
(include-js "/js/marked.js")
|
(html
|
||||||
(include-js "/js/main.js"))
|
(include-js "/js/md5.js")
|
||||||
|
(include-js "/js/marked.js")
|
||||||
|
(include-js "/js/main.js")))
|
||||||
; google analytics code should appear in prod mode only
|
; google analytics code should appear in prod mode only
|
||||||
(if-not (get-setting :dev-mode) (include-js "/js/google-analytics.js"))]
|
(if-not (get-setting :dev-mode) (include-js "/js/google-analytics.js"))]
|
||||||
[:body {:onload "onLoad()"} content]))
|
[:body {:onload "onLoad()"} content]))
|
||||||
@@ -41,7 +43,7 @@
|
|||||||
; input form for the markdown text with a preview area
|
; input form for the markdown text with a preview area
|
||||||
(defn- input-form [form-url command fields content passwd-msg]
|
(defn- input-form [form-url command fields content passwd-msg]
|
||||||
(let [css-class (when (= :publish command) :hidden)]
|
(let [css-class (when (= :publish command) :hidden)]
|
||||||
(layout (get-message :new-note)
|
(layout :js (get-message :new-page)
|
||||||
[:article#preview ""]
|
[:article#preview ""]
|
||||||
[:div#dashed-line {:class css-class}]
|
[:div#dashed-line {:class css-class}]
|
||||||
[:div.central-element.helvetica {:style "margin-bottom: 3em"}
|
[:div.central-element.helvetica {:style "margin-bottom: 3em"}
|
||||||
@@ -58,7 +60,7 @@
|
|||||||
:id :publish-button} (get-message command))])])))
|
:id :publish-button} (get-message command))])])))
|
||||||
|
|
||||||
(def landing-page
|
(def landing-page
|
||||||
(layout (get-message :page-title)
|
(layout :no-js (get-message :page-title)
|
||||||
[:div#hero
|
[:div#hero
|
||||||
[:h1 (get-message :name)]
|
[:h1 (get-message :name)]
|
||||||
[:h2 (get-message :title)]
|
[:h2 (get-message :title)]
|
||||||
@@ -74,7 +76,7 @@
|
|||||||
(defn statistics-page [resp]
|
(defn statistics-page [resp]
|
||||||
(let [stats (:statistics resp)
|
(let [stats (:statistics resp)
|
||||||
title (get-message :statistics)]
|
title (get-message :statistics)]
|
||||||
(layout title
|
(layout :no-js title
|
||||||
[:h2.central-element (api/derive-title (:note resp))]
|
[:h2.central-element (api/derive-title (:note resp))]
|
||||||
[:h3.central-element.helvetica title]
|
[:h3.central-element.helvetica title]
|
||||||
[:table#stats.helvetica.central-element
|
[:table#stats.helvetica.central-element
|
||||||
@@ -101,7 +103,7 @@
|
|||||||
(defn note-page [note-id short-url]
|
(defn note-page [note-id short-url]
|
||||||
(let [note (api/get-note {:noteID note-id})
|
(let [note (api/get-note {:noteID note-id})
|
||||||
sanitized-note (sanitize (:note note))]
|
sanitized-note (sanitize (:note note))]
|
||||||
(layout (:title note)
|
(layout :no-js (:title note)
|
||||||
[:article.bottom-space (md/to-html sanitized-note)]
|
[:article.bottom-space (md/to-html sanitized-note)]
|
||||||
(let [urls {:short-url (api/url short-url)
|
(let [urls {:short-url (api/url short-url)
|
||||||
:notehub "/"}
|
:notehub "/"}
|
||||||
|
|||||||
Reference in New Issue
Block a user