GitHub - Open Source Report Card

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

目前為 2014-02-27 提交的版本,檢視 最新版本

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

QingJ © 2025

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