Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

This script forces GitLab's front end to build the entire Git history for a project, then update necessary images, and finally rewrite the page with just the graph so it is suitable for printing.

View GitLab Network Graph Exporter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
(function() {
var $graphWrapper = $('.network-graph');
var lastScrollTop = 0;
$graphWrapper.scrollTop(0);
var dropInImages = function() {
const replaceShots = [
{ // Sam
'old': '/uploads/user/avatar/5/superman-logo-013.png',
'newimg': 'http://localhost:9090/small_sam.png'
},
{ // John
'old': 'http://www.gravatar.com/avatar/a289396a38e2b9457243a16e500d7f73?s=20&d=mm',
'newimg': 'http://localhost:9090/small_john.png'
},
{ // John
'old': 'http://www.gravatar.com/avatar/65f5ee1ec8f4636c6e8dae712d8d6a55?s=20&d=mm',
'newimg': 'http://localhost:9090/small_john.png'
},
{ // Chris
'old': 'http://www.gravatar.com/avatar/ccee736221ce91fd8bc78ac81b59f03c?s=20&d=mm',
'newimg': 'http://localhost:9090/small_chris.png'
},
{ // Sean
'old': 'http://www.gravatar.com/avatar/c17897aa15eda9299917492ea5701ccb?s=20&d=mm',
'newimg': 'http://localhost:9090/small_sean.png'
}
];
$('.network-graph image').each(function() {
var $image = $(this);
var url = $image.attr('href');
replaceShots.forEach(function(object) {
if (url == object.old) {
$image.attr('href',object.newimg);
}
});
});
}
var finalize = function() {
var svg = $('.network-graph').html();
svg = svg.replace('xmlns="http://www.w3.org/2000/svg"','xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"');
document.write(svg);
document.title = 'Git History';
}
var scrollDown = function() {
lastScrollTop = $graphWrapper.scrollTop();
$graphWrapper.scrollTop(lastScrollTop + 300);
if ($graphWrapper.scrollTop() > lastScrollTop) {
setTimeout(scrollDown,500);
} else {
dropInImages();
setTimeout(finalize,1000);
}
}
scrollDown();
return true;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.