|
|
|
var code_resize = function() {
|
|
var sheet = window.document.styleSheets[0];
|
|
var leftbar = document.querySelector('.left-bar');
|
|
var style = getComputedStyle(leftbar).getPropertyValue('display');
|
|
if (style == "none") {
|
|
var width = screen.width - 180;
|
|
} else {
|
|
var width = screen.width - 460;
|
|
}
|
|
sheet.insertRule('pre { max-width: ' + width + 'px; }', sheet.cssRules.length);
|
|
sheet.insertRule('.command-line { max-width: ' + (width + 50) + 'px; }', sheet.cssRules.length);
|
|
}
|
|
|
|
window.onload = function() {
|
|
code_resize();
|
|
window.onresize = code_resize;
|
|
(function() {
|
|
var hamburger = {
|
|
navToggle: document.querySelector('.nav-toggle'),
|
|
nav: document.querySelector('.links'),
|
|
doToggle: function(e) {
|
|
e.preventDefault();
|
|
this.navToggle.classList.toggle('expanded');
|
|
this.nav.classList.toggle('expanded');
|
|
}
|
|
};
|
|
document.addEventListener('click', function(e) {
|
|
if (e.target.className.includes("nav-toggle")) {
|
|
hamburger.doToggle(e);
|
|
} else {
|
|
hamburger.navToggle.classList.remove('expanded');
|
|
hamburger.nav.classList.remove('expanded');
|
|
}
|
|
});
|
|
}());
|
|
}
|