Find File Shortcut (GitHub)

Adds a keyboard shortcut to use GitHub's find file feature

当前为 2016-02-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Find File Shortcut (GitHub)
  3. // @namespace chriskim06
  4. // @description Adds a keyboard shortcut to use GitHub's find file feature
  5. // @include https://github.com/*/*
  6. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
  7. // @version 1.2
  8. // @grant none
  9. // @locale en
  10. // ==/UserScript==
  11.  
  12. this.$ = this.jQuery = jQuery.noConflict(true);
  13.  
  14. $(function() {
  15.  
  16. $(document).on('keydown', function(e) {
  17. if (e.which === 80 && e.shiftKey && e.target.nodeName !== 'INPUT') {
  18. var url = window.location.href.match(/(https:\/\/github\.com\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-]+)(?:\/tree\/)?([A-Za-z0-9_-]+)?/);
  19. if (url !== null) {
  20. var branch = (y[2]) ? y[2] : 'master';
  21. window.location.href = url[1] + '/find/' + branch;
  22. }
  23. }
  24. });
  25.  
  26. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址