Greasy Fork镜像 支持简体中文。

GitHub - Open Source Report Card

Add link to The Open Source Report Card http://osrc.dfm.io/

  1. /* This program is free software. It comes without any warranty, to
  2. * the extent permitted by applicable law. You can redistribute it
  3. * and/or modify it under the terms of the Do What The Fuck You Want
  4. * To Public License, Version 2, as published by Sam Hocevar. See
  5. * http://www.wtfpl.net/ for more details. */
  6.  
  7. // ==UserScript==
  8. // @name GitHub - Open Source Report Card
  9. // @namespace https://userscripts.org/users/12
  10. // @description Add link to The Open Source Report Card http://osrc.dfm.io/
  11. // @version 2.2
  12. // @author LouCypher
  13. // @license WTFPL
  14. // @contributor Custom Icon Design http://www.iconarchive.com/show/pretty-office-8-icons-by-custom-icon-design.html
  15. // @icon https://raw.github.com/LouCypher/userscripts/master/github/open-source-report-card/icon48.png
  16. // @icon64URL https://raw.github.com/LouCypher/userscripts/master/github/open-source-report-card/icon64.png
  17. // @screenshot https://raw.github.com/LouCypher/userscripts/master/github/open-source-report-card/screenshot.png
  18. // @contributionURL http://loucypher.github.io/userscripts/donate.html?GitHub+Open+Source+Report+Card
  19. // @homepageURL https://gf.qytechs.cn/scripts/4
  20. // @supportURL https://gf.qytechs.cn/scripts/4
  21. // @resource CHANGELOG https://raw.github.com/LouCypher/userscripts/master/github/open-source-report-card/CHANGELOG.txt
  22. // @resource LICENSE https://raw.github.com/LouCypher/userscripts/master/licenses/WTFPL/LICENSE.txt
  23. // @include https://github.com/*
  24. // @grant none
  25. // ==/UserScript==
  26.  
  27. function $(aSelector, aNode) {
  28. return (aNode || document).querySelector(aSelector);
  29. }
  30.  
  31. function addReportLink() {
  32. var username = $(".vcard-username");
  33. var details = $(".vcard-details");
  34. if (username && details) {
  35. var list = document.createElement("li");
  36. list.className = "vcard-detail";
  37. list.innerHTML = '<span class="octicon octicon-graph osrc"></span>'
  38. + '<a href="http://osrc.dfm.io/' + username.textContent
  39. + '?ref=userscript">Open Source Report Card</a>';
  40. details.appendChild(list);
  41. }
  42. }
  43.  
  44. var siteContainer = $("#site-container");
  45. var vcards = $(".vcard-details");
  46.  
  47. if (siteContainer && vcards) {
  48. addReportLink();
  49.  
  50. if ("MutationObserver" in window || "WebKitMutationObserver" in window) {
  51. new (MutationObserver ? MutationObserver : WebKitMutationObserver)(function(aMutations) {
  52. aMutations.forEach(function(aMutation) {
  53. if (aMutation.removedNodes.length)
  54. if (!$(".vcard-detail .osrc"))
  55. addReportLink();
  56. });
  57. }).observe(siteContainer, {childList:true});
  58. }
  59. }
  60.  
  61. else
  62. console.log("GitHub - Open Source Report Card user script: Sam Ting Wen Wong!");

QingJ © 2025

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