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.all()
|
||||
SyntaxHighlighter.defaults['gutter'] = false;
|
||||
SyntaxHighlighter.all();
|
||||
|
||||
// hackity hack
|
||||
$(window).load(function() {
|
||||
var ft = $("#floating-toc");
|
||||
var ul = ft.find('ul');
|
||||
|
@ -27,50 +28,50 @@ $(window).load(function() {
|
|||
|
||||
var calcNsPositions = function() {
|
||||
var hheight = $('.docs-header').first().height();
|
||||
var nss = []
|
||||
var anchors = []
|
||||
var positions = []
|
||||
var nss = [];
|
||||
var anchors = [];
|
||||
var positions = [];
|
||||
$.each(lis, function(i, el) {
|
||||
var ns = $(el).attr('id').split('_')[1]
|
||||
nss.push(ns)
|
||||
var a = $("a[name='"+ns+"']")
|
||||
anchors.push(a)
|
||||
positions.push(a.offset().top - hheight)
|
||||
var ns = $(el).attr('id').split('_')[1];
|
||||
nss.push(ns);
|
||||
var a = $("a[name='"+ns+"']");
|
||||
anchors.push(a);
|
||||
positions.push(a.offset().top - hheight);
|
||||
// console.log(a.offset().top)
|
||||
});
|
||||
|
||||
return {nss: nss, positions: positions}
|
||||
return {nss: nss, positions: positions};
|
||||
}
|
||||
|
||||
var nsPositions = calcNsPositions()
|
||||
var nsPositions = calcNsPositions();
|
||||
// console.log(nsPositions)
|
||||
var lastNsIndex = -1
|
||||
var lastNsIndex = -1;
|
||||
var $window = $(window);
|
||||
|
||||
var currentSection = function(nsp) {
|
||||
var ps = nsp.positions
|
||||
var scroll = $window.scrollTop()
|
||||
var nsIndex = -1
|
||||
var ps = nsp.positions;
|
||||
var scroll = $window.scrollTop();
|
||||
var nsIndex = -1;
|
||||
|
||||
for(var i = 0, length = ps.length; i < length; i++) {
|
||||
if(ps[i] >= scroll) {
|
||||
nsIndex = i-1
|
||||
nsIndex = i-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(nsIndex == -1) {
|
||||
if(scroll >= ps[0]) {
|
||||
nsIndex = ps.length - 1
|
||||
nsIndex = ps.length - 1;
|
||||
} else {
|
||||
nsIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return nsp.nss[nsIndex]
|
||||
return nsp.nss[nsIndex];
|
||||
}
|
||||
|
||||
$(window).scroll(function(e) {
|
||||
showNs(currentSection(nsPositions))
|
||||
})
|
||||
})
|
||||
showNs(currentSection(nsPositions));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue