-
-
Save singingwolfboy/575f7d005146ba3b235f to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name Github Expand All Comments | |
// @namespace http://www.edx.org/developers | |
// @version 0.1 | |
// @description Help manage github pull request comments | |
// @match *://github.com/*/pull/* | |
// @copyright 2014+, Gabe Mulley | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js | |
// ==/UserScript== | |
menuobj = document.createElement('div'); | |
menuobj.style.position = 'fixed'; | |
menuobj.style.top = '10px'; | |
menuobj.style.left = '10px'; | |
menuobj.style.backgroundColor = '#ffffff00'; | |
menuobj.innerHTML = '<input id="toggle-all-comments" type="button" value="Show All Comments" />'; | |
body = document.getElementsByTagName('body')[0]; | |
body.appendChild(menuobj); | |
$('#toggle-all-comments').click(function(e) { | |
$('.discussion-item-toggle-closed').each(function (i, el) { | |
var evt = document.createEvent("MouseEvents"); | |
evt.initEvent("click", true, true); | |
el.dispatchEvent(evt); | |
}); | |
button = $( this ) | |
if (button.prop('value') == 'Show All Comments') { | |
button.prop('value', 'Hide All Comments'); | |
} else { | |
button.prop('value', 'Show All Comments'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment