Added semi colons everywhere
This commit is contained in:
parent
dadce0a94c
commit
4ffc4eba5b
1 changed files with 23 additions and 22 deletions
|
@ -1,6 +1,7 @@
|
||||||
SyntaxHighlighter.defaults['gutter'] = false
|
SyntaxHighlighter.defaults['gutter'] = false;
|
||||||
SyntaxHighlighter.all()
|
SyntaxHighlighter.all();
|
||||||
|
|
||||||
|
// hackity hack
|
||||||
$(window).load(function() {
|
$(window).load(function() {
|
||||||
var ft = $("#floating-toc");
|
var ft = $("#floating-toc");
|
||||||
var ul = ft.find('ul');
|
var ul = ft.find('ul');
|
||||||
|
@ -27,50 +28,50 @@ $(window).load(function() {
|
||||||
|
|
||||||
var calcNsPositions = function() {
|
var calcNsPositions = function() {
|
||||||
var hheight = $('.docs-header').first().height();
|
var hheight = $('.docs-header').first().height();
|
||||||
var nss = []
|
var nss = [];
|
||||||
var anchors = []
|
var anchors = [];
|
||||||
var positions = []
|
var positions = [];
|
||||||
$.each(lis, function(i, el) {
|
$.each(lis, function(i, el) {
|
||||||
var ns = $(el).attr('id').split('_')[1]
|
var ns = $(el).attr('id').split('_')[1];
|
||||||
nss.push(ns)
|
nss.push(ns);
|
||||||
var a = $("a[name='"+ns+"']")
|
var a = $("a[name='"+ns+"']");
|
||||||
anchors.push(a)
|
anchors.push(a);
|
||||||
positions.push(a.offset().top - hheight)
|
positions.push(a.offset().top - hheight);
|
||||||
// console.log(a.offset().top)
|
// console.log(a.offset().top)
|
||||||
});
|
});
|
||||||
|
|
||||||
return {nss: nss, positions: positions}
|
return {nss: nss, positions: positions};
|
||||||
}
|
}
|
||||||
|
|
||||||
var nsPositions = calcNsPositions()
|
var nsPositions = calcNsPositions();
|
||||||
// console.log(nsPositions)
|
// console.log(nsPositions)
|
||||||
var lastNsIndex = -1
|
var lastNsIndex = -1;
|
||||||
var $window = $(window);
|
var $window = $(window);
|
||||||
|
|
||||||
var currentSection = function(nsp) {
|
var currentSection = function(nsp) {
|
||||||
var ps = nsp.positions
|
var ps = nsp.positions;
|
||||||
var scroll = $window.scrollTop()
|
var scroll = $window.scrollTop();
|
||||||
var nsIndex = -1
|
var nsIndex = -1;
|
||||||
|
|
||||||
for(var i = 0, length = ps.length; i < length; i++) {
|
for(var i = 0, length = ps.length; i < length; i++) {
|
||||||
if(ps[i] >= scroll) {
|
if(ps[i] >= scroll) {
|
||||||
nsIndex = i-1
|
nsIndex = i-1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nsIndex == -1) {
|
if(nsIndex == -1) {
|
||||||
if(scroll >= ps[0]) {
|
if(scroll >= ps[0]) {
|
||||||
nsIndex = ps.length - 1
|
nsIndex = ps.length - 1;
|
||||||
} else {
|
} else {
|
||||||
nsIndex = 0;
|
nsIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nsp.nss[nsIndex]
|
return nsp.nss[nsIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
$(window).scroll(function(e) {
|
$(window).scroll(function(e) {
|
||||||
showNs(currentSection(nsPositions))
|
showNs(currentSection(nsPositions));
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
Loading…
Reference in a new issue