Greasemonkey test style2

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

当前为 2017-01-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Greasemonkey test style2
  3. // @namespace http://userstyles.org
  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 0.0.1.20170129205943
  9. // ==/UserScript==
  10. (function() {
  11. var css = "*{ color: #F00 !important; }";
  12. if (typeof GM_addStyle != "undefined") {
  13. GM_addStyle(css);
  14. } else if (typeof PRO_addStyle != "undefined") {
  15. PRO_addStyle(css);
  16. } else if (typeof addStyle != "undefined") {
  17. addStyle(css);
  18. } else {
  19. var node = document.createElement("style");
  20. node.type = "text/css";
  21. node.appendChild(document.createTextNode(css));
  22. var heads = document.getElementsByTagName("head");
  23. if (heads.length > 0) {
  24. heads[0].appendChild(node);
  25. } else {
  26. // no head yet, stick it whereever
  27. document.documentElement.appendChild(node);
  28. }
  29. }
  30. })();