Greasemonkey test style

If you install this and all text turns red, Greasemonkey (or equivalent) is working.

当前为 2014-02-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Greasemonkey test style
  3. // @namespace https://greasyfork.org/scripts/1
  4. // @description If you install this and all text turns red, Greasemonkey (or equivalent) is working.
  5. // @author JasonBarnabe
  6. // @homepage http://greasyfork.org/scripts/1
  7. // @run-at document-start
  8. // @version 1.20140224015303
  9. // @updateURL https://greasyfork.org/scripts/1/code.meta.js
  10. // @downloadURL https://greasyfork.org/scripts/1/code.user.js
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. var css = "*{ color: #F00 !important; }";
  15. if (typeof GM_addStyle != "undefined") {
  16. GM_addStyle(css);
  17. } else if (typeof PRO_addStyle != "undefined") {
  18. PRO_addStyle(css);
  19. } else if (typeof addStyle != "undefined") {
  20. addStyle(css);
  21. } else {
  22. var node = document.createElement("style");
  23. node.type = "text/css";
  24. node.appendChild(document.createTextNode(css));
  25. var heads = document.getElementsByTagName("head");
  26. if (heads.length > 0) {
  27. heads[0].appendChild(node);
  28. } else {
  29. // no head yet, stick it whereever
  30. document.documentElement.appendChild(node);
  31. }
  32. }
  33. })();