Skip to content

Instantly share code, notes, and snippets.

@electricg
Created March 11, 2016 12:59
Show Gist options
  • Save electricg/f11176adffe52ff042b4 to your computer and use it in GitHub Desktop.
Save electricg/f11176adffe52ff042b4 to your computer and use it in GitHub Desktop.
aglio show and hide all script
(function() {
var show = document.createElement('div');
show.innerHTML = 'show all';
show.setAttribute('onClick', "[].slice.call(document.querySelectorAll('.collapse-button:not(.show)>.open')).forEach(function(el){el.click()})");
var hide = document.createElement('div');
hide.innerHTML = 'hide all';
hide.setAttribute('onClick', "[].slice.call(document.querySelectorAll('.collapse-button.show>.close')).forEach(function(el){el.click()})");
var wrapper = document.createElement('div');
wrapper.style.position = 'fixed';
wrapper.style.top = '0';
wrapper.style.left = '0';
wrapper.style.cursor = 'pointer';
wrapper.appendChild(show);
wrapper.appendChild(hide);
document.body.appendChild(wrapper);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment