Inital attempt
This commit is contained in:
+23
-1
@@ -125,5 +125,27 @@ function deletePage() {
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
wireDropdown(document.querySelector('[data-action="actions-drop"]'));
|
||||
var panel = document.querySelector('.actions');
|
||||
if (!panel) return;
|
||||
|
||||
var toggle = document.createElement('button');
|
||||
toggle.type = 'button';
|
||||
toggle.className = 'panel-toggle';
|
||||
toggle.textContent = 'Actions';
|
||||
toggle.setAttribute('aria-expanded', 'false');
|
||||
toggle.addEventListener('click', function () {
|
||||
var open = panel.classList.toggle('is-open');
|
||||
toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||
});
|
||||
|
||||
var main = document.querySelector('main');
|
||||
if (!main) return;
|
||||
// Insert at the top of main's parent (right after the header) so the
|
||||
// ACTIONS toggle sits above any toggles other panels may have added.
|
||||
var header = document.querySelector('header');
|
||||
var anchor = header ? header.nextSibling : main.parentNode.firstChild;
|
||||
main.parentNode.insertBefore(toggle, anchor);
|
||||
if (window.matchMedia('(max-width: 1100px)').matches) {
|
||||
main.parentNode.insertBefore(panel, toggle.nextSibling);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user