Skip to content

Instantly share code, notes, and snippets.

@drmohundro
Created January 24, 2016 18:52
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 drmohundro/eef967b2d64c46088fb1 to your computer and use it in GitHub Desktop.
Save drmohundro/eef967b2d64c46088fb1 to your computer and use it in GitHub Desktop.
Bookmarklet to hide rows on various source hosting sites
var url = window.location.href;
var searchTextToIgnore = prompt('Enter text to ignore:');
if (url.match(/bitbucket/)) {
$('h1:contains(' + searchTextToIgnore + ')').closest('section').hide();
} else if (url.match(/gitlab/)) {
$('.diff-header span:contains(' + searchTextToIgnore + ')').parent().parent().hide();
} else {
alert(url + " doesn't match any known sites.");
}
@drmohundro
Copy link
Author

This is just a simple script that can hide sections within a pull request on (currently) GitLab or Bitbucket. As an example, if there is generated code that is checked in, it might be useful to ignore that while reviewing the pull request. This script prompts the user for a partial string match so that it can hide those sections.

It currently assumes jQuery is loaded, but it wouldn't be hard to remove that dependency.

I used this Bookmarklet Creator to convert this into a bookmarklet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment