Put main code in window.load rather than document.ready and at bottom of page to play nice with syntax highlighter

This commit is contained in:
Ivan Miskovic 2012-01-14 22:50:44 +13:00
parent 129e9563a2
commit dadce0a94c
2 changed files with 14 additions and 15 deletions

View file

@ -1,23 +1,26 @@
$(document).ready(function() {
var ft = $("#floating-toc")
var ul = ft.find('ul')
var lis = ft.find('li')
var liHeight = $(lis.first()).height()
SyntaxHighlighter.defaults['gutter'] = false
SyntaxHighlighter.all()
ul.css('margin', '0px')
ft.css('height', liHeight + 'px')
$(window).load(function() {
var ft = $("#floating-toc");
var ul = ft.find('ul');
var lis = ft.find('li');
var liHeight = $(lis.first()).height();
ul.css('margin', '0px');
ft.css('height', liHeight + 'px');
showNs = function(ns) {
var index = 0
var index = 0;
for(i in nsPositions.nss) {
if(ns == nsPositions.nss[i]) index = i
if(ns == nsPositions.nss[i]) index = i;
}
if(index != lastNsIndex) {
lastNsIndex = index;
ul.animate({marginTop: (-1 * liHeight * index) + 'px'},
300)
300);
}
}

View file

@ -352,7 +352,6 @@
[:head
[:meta {:http-equiv "Content-Type" :content "text/html" :charset "utf-8"}]
[:meta {:name "description" :content (:description project-metadata)}]
#_[:script {:type "text/javascript" :src "./../resources/app.js"}]
(inline-css (str *resources* "shCore.css"))
(css
[:.syntaxhighlighter {:overflow "hidden !important"}])
@ -365,7 +364,6 @@
(inline-js (str *resources* "xregexp-min.js"))
(inline-js (str *resources* "shCore.js"))
(inline-js (str *resources* "shBrushClojure.js"))
(inline-js (str *resources* "app.js"))
opt-resources
[:title (:name project-metadata) " -- Marginalia"]]
[:body
@ -381,9 +379,7 @@
[:a {:href "http://alexgorbatchev.com/SyntaxHighlighter/"}
"SyntaxHighlighter"]
floating-toc]
[:script {:type "text/javascript"}
"SyntaxHighlighter.defaults['gutter'] = false;
SyntaxHighlighter.all()"]]]))
(inline-js (str *resources* "app.js"))]]))
;; Syntax highlighting is done a bit differently than docco. Instead of embedding