Greasy Fork is available in English.

Github Rawgit Button

An userscript to add "Rawgit" button on github.

Fra 10.10.2014. Se den seneste versjonen.

  1. // ==UserScript==
  2. // @name Github Rawgit Button
  3. // @namespace eight04.blogspot.com
  4. // @description An userscript to add "Rawgit" button on github.
  5. // @include https://github.com/*
  6. // @version 1.1
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. "use strict";
  11.  
  12. function replace(){
  13. var btn = document.querySelector("#raw-url");
  14. if (!btn || btn.classList.contains("rawgit")) {
  15. return;
  16. }
  17. var url = location.href.replace("github.com", "rawgit.com");
  18. url = url.replace("/blob/", "/");
  19. var newBtn = document.createElement("a");
  20. newBtn.href = url;
  21. newBtn.className = "minibutton";
  22. newBtn.textContent = "Rawgit";
  23. btn.parentNode.insertBefore(newBtn, btn.nextSibling);
  24. btn.classList.add("rawgit");
  25. }
  26.  
  27. var container = document.querySelector("#js-repo-pjax-container");
  28. if (container) {
  29. new MutationObserver(function(e){
  30. replace();
  31. }).observe(container, {childList: true, subtree: true});
  32. }
  33.  
  34. replace();