in fauxton-visual-guide/js/main.js [83:144]
function changeHashOnScroll() {
//http://stackoverflow.com/questions/5315659/jquery-change-hash-fragment-identifier-while-scrolling-down-page
var timer = null;
$(window).scroll(function (e) {
$('div.chapter').each(function () {
if (
$(this).offset().top < window.pageYOffset + 10
//begins before top
&& $(this).offset().top + $(this).height() > window.pageYOffset + 10
//but ends in visible area
//+ 20 allows you to change hash before it hits the top border
){
history.replaceState(null, null, "#" + $(this).attr('id'));
highlightFauxtonNavigation();
if ($('#_all_dbs').visible(true)) {
clear();
$('#_all_dbs-sub').css({
'color': 'black',
'font-weight': 'bold'
});
}
if ($('#_all_docs').visible(true)) {
clear();
$('#_all_docs-sub').css({
'color': 'black',
'font-weight': 'bold'
});
return;
}
if ($('#editor').visible(true)) {
clear();
$('#editor-sub').css({
'color': 'black',
'font-weight': 'bold'
});
return;
}
if ($('#db-action').visible(true)) {
clear();
$('#db-actions-sub').css({
'color': 'black',
'font-weight': 'bold'
});
}
}
});
});
function clear () {
$('#db-actions-sub, #_all_docs-sub, #editor-sub, #_all_dbs-sub').css({
'color': '',
'font-weight': ''
});
}
}