Created
June 19, 2017 14:25
-
-
Save tb0yd/a8ecc5505e372a47e476a2c1be1608b9 to your computer and use it in GitHub Desktop.
GHOpenAllExpanders.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function simulateClick(el){ | |
var evt = document.createEvent("MouseEvents"); | |
evt.initMouseEvent("click", true, true, window, | |
0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
el.dispatchEvent(evt); | |
} | |
function clickAllExpanders() { | |
var els = document.getElementsByClassName('diff-expander'); | |
for(var i = 0; i < els.length; i++) { | |
simulateClick(els[i]); | |
} | |
setTimeout(function() { | |
if(document.getElementsByClassName('diff-expander').length > 0) { | |
clickAllExpanders(); | |
} | |
}, 100); | |
} | |
clickAllExpanders(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment