Skip to content

Commit

Permalink
Fix for overzealous resizing, JS redundancies
Browse files Browse the repository at this point in the history
  • Loading branch information
johndmulhausen committed Mar 2, 2017
1 parent 5c03cf4 commit 3e12e75
Showing 1 changed file with 6 additions and 40 deletions.
46 changes: 6 additions & 40 deletions js/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ function checkNavSizes()
if (footerTop < sidebarBottom || (sidebarBottom < footerTop && sidebarBottom < $(window).height()))
{
// the footer is overlapping the sidebar
document.getElementsByClassName("sidebar")[0].style.height = (footerTop - headerOffset) + "px";
document.getElementsByClassName("toc-nav")[0].style.height = (footerTop) + "px";
var sidebarHeight = ((footerTop - headerOffset) < $(window).height()) ? (footerTop - headerOffset) : $(window).height();
var tocNavHeight = (footerTop < $(window).height()) ? footerTop : $(window).height();
document.getElementsByClassName("sidebar")[0].style.height = sidebarHeight + "px";
document.getElementsByClassName("toc-nav")[0].style.height = footerTop + "px";
highlightRightNav(currentHeading);
}
}
Expand Down Expand Up @@ -142,53 +144,17 @@ function readCookie(name) {
function eraseCookie(name) {
createCookie(name,"",-1);
}
/*
if (readCookie("night") == "true") {
document.getElementById('pagestyle').setAttribute('href', '/css/style-alt.css');
$('#switch-style').prop('checked', true);
} else {
document.getElementById('pagestyle').setAttribute('href', '/css/style.css');
$('#switch-style').prop('checked', false);
}
*/


/*
*
* swapStyleSheet*********************************************************************
*
*/

// Cookie functions
function createCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

function eraseCookie(name) {
createCookie(name,"",-1);
}
if (readCookie("night") == "true") {
document.getElementById('pagestyle').setAttribute('href', '/css/style-alt.css');
$('#switch-style').prop('checked', true);
} else {
document.getElementById('pagestyle').setAttribute('href', '/css/style.css');
$('#switch-style').prop('checked', false);
}
/*
*
* toggle menu *********************************************************************
Expand Down

0 comments on commit 3e12e75

Please sign in to comment.