_AN_Call_createelement('createElement', document, "section"); _AN_Call_createelement("createElement", document, "article"); (function (){ if (!window.addEventListener) return ; var pending = false , prevVal = null ; function updateSoon(){ if (!pending) { pending = true ; _AN_Call_settimeout("setTimeout", window, update, 250); } } function update(){ pending = false ; var marks = _AN_Call_getelementsbytagname("getElementsByTagName", document.getElementById("nav"), "a"), found; for (var i = 0; i < _AN_Read_length("length", marks); ++i){ var mark = marks[i], m; if (_AN_Call_getattribute("getAttribute", mark, "data-default")) { if (found == null ) found = i; } else if (m = _AN_Read_href("href", mark).match(/#(.*)/)) { var ref = document.getElementById(m[1]); if (ref && ref.getBoundingClientRect().top < 50) found = i; } } if (found != null && found != prevVal) { prevVal = found; var lis = _AN_Call_getelementsbytagname("getElementsByTagName", document.getElementById("nav"), "li"); for (var i = 0; i < _AN_Read_length("length", lis); ++i)lis[i].className = ""; for (var i = 0; i < _AN_Read_length("length", marks); ++i){ if (found == i) { marks[i].className = "active"; for (var n = marks[i]; n; n = n.parentNode)if (n.nodeName == "LI") n.className = "active"; } else { marks[i].className = ""; } } } } window.addEventListener("scroll", updateSoon); window.addEventListener("load", updateSoon); window.addEventListener("hashchange", function (){ _AN_Call_settimeout("setTimeout", window, function (){ var hash = _AN_Read_hash("hash", _AN_Read_location("location", document)), found = null , m; var marks = _AN_Call_getelementsbytagname("getElementsByTagName", document.getElementById("nav"), "a"); for (var i = 0; i < _AN_Read_length("length", marks); i++ )if ((m = _AN_Read_href("href", marks[i]).match(/(#.*)/)) && m[1] == hash) { found = i; break ; } if (found != null ) for (var i = 0; i < _AN_Read_length("length", marks); i++ )marks[i].className = i == found? "active": ""; } , 300); } ); } )();