You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

  1. var code_resize = function() {
  2. var sheet = window.document.styleSheets[0];
  3. var leftbar = document.querySelector('.left-bar');
  4. var style = getComputedStyle(leftbar).getPropertyValue('display');
  5. if (style == "none") {
  6. var width = screen.width - 180;
  7. } else {
  8. var width = screen.width - 460;
  9. }
  10. sheet.insertRule('pre { max-width: ' + width + 'px; }', sheet.cssRules.length);
  11. sheet.insertRule('.command-line { max-width: ' + (width + 50) + 'px; }', sheet.cssRules.length);
  12. }
  13. window.onload = function() {
  14. code_resize();
  15. window.onresize = code_resize;
  16. (function() {
  17. var hamburger = {
  18. navToggle: document.querySelector('.nav-toggle'),
  19. nav: document.querySelector('.links'),
  20. doToggle: function(e) {
  21. e.preventDefault();
  22. this.navToggle.classList.toggle('expanded');
  23. this.nav.classList.toggle('expanded');
  24. }
  25. };
  26. document.addEventListener('click', function(e) {
  27. if (e.target.className.includes("nav-toggle")) {
  28. hamburger.doToggle(e);
  29. } else {
  30. hamburger.navToggle.classList.remove('expanded');
  31. hamburger.nav.classList.remove('expanded');
  32. }
  33. });
  34. }());
  35. }