github first commit

github第一个commit

  1. // ==UserScript==
  2. // @name github first commit
  3. // @license MIT
  4. // @namespace http://tampermonkey.net/fuckkkkker
  5. // @version 2024-08-16
  6. // @description github第一个commit
  7. // @author fuckkkkker
  8. // @match https://github.com/*/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. function first() {
  16. var latestCommit = document.querySelector('[data-hovercard-url].Link--secondary[data-pjax]').href.split('/').slice(-1)[0]
  17. var commitTotalCount = parseInt(document.querySelector('span.fgColor-default').innerText.replace('Commits', '').replace(',', ''))
  18. var currentBranchName = document.querySelector('.Box-sc-g0xbh4-0.bmcJak.prc-Text-Text-0ima0').innerText.trim()
  19.  
  20. var url = `https://github.com/${location.href.split('.com')[1]}/commits/${currentBranchName}?after=${latestCommit}+${commitTotalCount - 10}`
  21.  
  22. var ulElement = document.querySelectorAll('.pagehead-actions.flex-shrink-0.d-none.d-md-inline')[0]
  23.  
  24. var li = document.createElement('li')
  25. li.style = `
  26. height: 100%;
  27. width: 100px;
  28. display: flex;
  29. justify-content: center;
  30. align-items: center;
  31. `
  32.  
  33. var a1 = document.createElement('a')
  34. a1.innerText = '最后一个commit'
  35. a1.href = url
  36. a1.target = '_blank'
  37.  
  38. li.appendChild(a1)
  39. ulElement.insertBefore(li, ulElement.firstChild)
  40. }
  41.  
  42. window.onload = function () {
  43. setTimeout(first, 2000)
  44. }
  45. })();

QingJ © 2025

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