Skip to content

Instantly share code, notes, and snippets.

@Ivanca
Created December 9, 2014 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ivanca/79d3daa0328f0546298c to your computer and use it in GitHub Desktop.
Save Ivanca/79d3daa0328f0546298c to your computer and use it in GitHub Desktop.
Collapse Diffs - Functionality for Github commits (UserScript/Tampermonkey/Greasemonkey)
// ==UserScript==
// @name Collapse diff
// @namespace http://no.one/
// @version 0.2
// @description Enter something useful
// @author You
// @match https://github.com/*
// @grant none
// ==/UserScript==
setInterval(function(){
if (/\/commit\//.test(document.location.href)) {
if ($('.collapse_d').length === 0 && $('.meta').length > 0) {
var html = '<a href="#" class="collapse_d minibutton" rel="nofollow">Collapse</a>';
$('.actions').append(html);
$(document.body).on('click', '.collapse_d', function(){
$(this).closest('.meta').next('.data').toggle();
document.activeElement.blur();
return false;
});
}
}
}, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment