MaxWidth for WikiPedia

It will set a max width of wikipedia for better readibility.

目前为 2020-01-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MaxWidth for WikiPedia
  3. // @author h.zhuang
  4. // @version 1.1
  5. // @description It will set a max width of wikipedia for better readibility.
  6. // @namespace wikipedia.org
  7. // @include http://wikipedia.org/*
  8. // @include https://wikipedia.org/*
  9. // @include http://*.wikipedia.org/*
  10. // @include https://*.wikipedia.org/*
  11. // @grant GM_addStyle
  12. // @run-at document-start
  13. // ==/UserScript==
  14.  
  15. (function() {var css = "";
  16. css += ["#content,#bodyContent {max-width:760px !important;} \
  17. #mw-content-text {max-width:680px !important;}\
  18. .mw-body {max-width:999px !important;}\
  19. p {max-width:50em !important;}"
  20. ].join("\n");
  21. if (typeof GM_addStyle != "undefined") {
  22. GM_addStyle(css);
  23. } else if (typeof PRO_addStyle != "undefined") {
  24. PRO_addStyle(css);
  25. } else if (typeof addStyle != "undefined") {
  26. addStyle(css);
  27. } else {
  28. var node = document.createElement("style");
  29. node.type = "text/css";
  30. node.appendChild(document.createTextNode(css));
  31. var heads = document.getElementsByTagName("head");
  32. if (heads.length > 0) {
  33. heads[0].appendChild(node);
  34. } else {
  35. // no head yet, stick it whereever
  36. document.documentElement.appendChild(node);
  37. }
  38. }
  39. })();