Skip to content

Commit

Permalink
Added semi colons everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Miskovic authored and Ivan Miskovic committed Jan 14, 2012
1 parent dadce0a commit 4ffc4eb
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions resources/app.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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));
});
});

0 comments on commit 4ffc4eb

Please sign in to comment.