sidepane.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <div class="current-tab"></div>
  2. <div class="tab-set">
  3. <button class="details hbox iconic">{% include 'info-circle.svg' %} <span>Details</span></button>
  4. <button class="help iconic hbox">{% include 'question-circle.svg' %} <span>Help</span></button>
  5. <button class="settings iconic">⚙ Settings</button>
  6. </div>
  7. <style>
  8. button.hbox {
  9. display: flex;
  10. align-items: center;
  11. justify-content: center;
  12. }
  13. .tab-set button.hbox span {
  14. line-height: calc(var(--header-height) - .5rem);
  15. }
  16. .tab-set button.hbox svg {
  17. padding-top: .1em;
  18. }
  19. .tab-set {
  20. position: absolute;
  21. bottom: 0px;
  22. height: calc(var(--header-height) - .5rem);
  23. display: flex;
  24. left: 0px;
  25. right: 0px;
  26. background: var(--button-background);
  27. }
  28. .wide-body .tab-set {
  29. right: 0px;
  30. }
  31. .tab-set button {
  32. transition: box-shadow .2s all;
  33. height: 100%;
  34. width: 100%;
  35. border-top: 1px solid var(--chrome-border);
  36. border-left: 1px solid var(--chrome-border);
  37. border-right: 0px;
  38. border-radius: 0px 0px var(--border-radius) var(--border-radius);
  39. background: var(--button-background);
  40. box-shadow: inset var(--box-shadow);
  41. }
  42. .current-tab {
  43. width: 100%;
  44. overflow: auto;
  45. height: calc(100% - 2em);
  46. border: 1px solid var(--chrome-border);
  47. border-bottom: 0px;
  48. border-right: 0px;
  49. padding: .5rem;
  50. padding-top: 0px;
  51. background: var(--chrome-background);
  52. transition: .3s transform;
  53. position: absolute;
  54. }
  55. .current-tab section {
  56. min-height: 100%;
  57. }
  58. .current-tab > section > *:first-child {
  59. height: 2em;
  60. line-height: 2em;
  61. }
  62. .tab-set button:disabled {
  63. border-top: 0px;
  64. opacity: 1;
  65. background: var(--chrome-background);
  66. color: var(--chrome-color);
  67. box-shadow: 2px 2px var(--shadow-spread) 2px rgba(0,0,0,0);
  68. }
  69. .narrow-body .current-tab.expanded {
  70. transform: translate(0, -60%);
  71. height: calc(200%);
  72. z-index: calc(var(--voice-graph-z-index) + 3);
  73. }
  74. #expand-collapse-button.expanded {
  75. transform: translate(0, -60%);
  76. }
  77. </style>
  78. <script>
  79. let tab = $('.current-tab');
  80. tab.addEventListener('click', evt => {
  81. let bb = tab.getBoundingClientRect();
  82. if (
  83. evt.clientY - bb.top < 20 && document.activeElement != $('#theme-select') &&
  84. evt.clientX - bb.left > (bb.right - bb.left) / 4 &&
  85. evt.clientX - bb.left < 3 * (bb.right - bb.left) / 4
  86. ) {
  87. if (!tab.classList.contains('expanded')) {
  88. tab.classList.add('expanded');
  89. } else {
  90. tab.classList.remove('expanded');
  91. }
  92. }
  93. }, true);
  94. for (let tab of ['settings', 'help', 'details']) {
  95. let tabButton = $('button.' + tab);
  96. tabButton.addEventListener('click', evt => {
  97. for (let sibling of tabButton.parentNode.querySelectorAll('button')) {
  98. sibling.disabled = false;
  99. }
  100. clearSelector('.current-tab > section');
  101. tabButton.disabled = true;
  102. $('aside > .current-tab').appendChild($('section.' + tab));
  103. });
  104. }
  105. </script>