-
-
Save wolffan/cddb9c6d6716798b3306 to your computer and use it in GitHub Desktop.
This file contains 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
// Add a button to Collapse or Expand files in a Github PR | |
// | |
// See it in action: http://cl.ly/image/1r3q3d0d3b0p | |
// | |
// Install Tampermonkey and add this as a script | |
// ==UserScript== | |
// @name Github PRs: Collapse/expand file | |
// @namespace https://gist.github.com/micho/855b272d2f408f04729e | |
// @version 0.1 | |
// @description Add a button to expand or collapse files in PRs | |
// @author You | |
// @match https://github.com/*/pull/*/files | |
// @grant none | |
// ==/UserScript== | |
$(function () { | |
$(".js-conduit-openfile-check").remove(); | |
$(".file .actions").prepend(function () { | |
$button = $('<a href="#" class="minibutton">Collapse</a>') | |
$button.click(function (e) { | |
e.preventDefault(); | |
$(this).parents(".file").find(".data").toggle() | |
$(this).text($(this).text() == "Collapse" ? "Expand" : "Collapse"); | |
}); | |
$(this).find(".minibutton").after($button).after(" "); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment