Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created January 6, 2010 17:38
Show Gist options
  • Save paulirish/270445 to your computer and use it in GitHub Desktop.
Save paulirish/270445 to your computer and use it in GitHub Desktop.
// A bookmarklet to add search ability to any github.com repo.
// Note: Disable Chrome Frame in IE to use this bookmarklet as github.com supports Chrome Frame
// @author John-David Dalton (http://www.twitter.com/jdalton)
javascript:void(function(){var a='';if(!$('.subnav-bar').length){a=$('form#search-form input[name=q]').val();$('.big-search').remove();$('.tabs').after('<div class="subnav-bar"></div>')}else{$('#repo-search-form').remove()}$('.subnav-bar').append('<ul style="float:right;margin-left:10px;"><li><a class="dropdown" href="#">Search by&hellip;</a><ul><li><a href="#" onclick="$(\'#choice\').val(\'code\');return false;">Code</a></li><li><a href="#" onclick="$(\'#choice\').val(\'grep\');return false;">Commit Messages</a></li><li><a href="#" onclick="$(\'#choice\').val(\'author\');return false;">Author</a></li><li><a href="#" onclick="$(\'#choice\').val(\'committer\');return false;">Committer</a></li></ul></li></ul><form id="repo-search-form" action="'+$('.pagehead.repohead h1 a')[1].href+'/search"><input name="q" value="'+a+'" type="text" class="search notnative"><input id="choice" name="choice" value="code" type="hidden"><input id="lang-value" name="langOverride" value="" type="hidden"><input id="start-value" name="start" value="" type="hidden"></form>')}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment