Github Pull Request From Link

Make pull request original branch linkable

当前为 2014-05-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Github Pull Request From Link
  3. // @namespace https://github.com/jerone/UserScripts/
  4. // @description Make pull request original branch linkable
  5. // @author jerone
  6. // @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl)
  7. // @license GNU GPLv3
  8. // @homepage https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From
  9. // @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From
  10. // @include *://github.com/*/*/pull/*
  11. // @version 10
  12. // @grant none
  13. // @contribution Changes based on Firefox extension https://github.com/diegocr/GitHubExtIns by https://github.com/diegocr
  14. // ==/UserScript==
  15. (function(){
  16. var targetTreeSpan = document.querySelectorAll('span.commit-ref.current-branch.css-truncate.js-selectable-text.expandable')[1],
  17. branchTree = targetTreeSpan.textContent.trim().split(':'),
  18. userTree = branchTree.shift(),
  19. urlTree = [
  20. '//github.com',
  21. userTree,
  22. document.querySelector('.js-current-repository').textContent,
  23. 'tree',
  24. branchTree.join(':')
  25. ].join('/'),
  26. targetTreeA = document.createElement('a');
  27. targetTreeA.setAttribute('href', urlTree);
  28. targetTreeA.innerHTML = targetTreeSpan.innerHTML;
  29. targetTreeSpan.innerHTML = '';
  30. targetTreeSpan.appendChild(targetTreeA);
  31. })();

QingJ © 2025

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