Force Full Editor

Forces WYSIWYG editors to always use the full editor if possible

  1. // ==UserScript==
  2. // @name Force Full Editor
  3. // @description Forces WYSIWYG editors to always use the full editor if possible
  4. // @author qsniyg
  5. // @version 0.2
  6. // @namespace Violentmonkey Scripts
  7. // @include *
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. var ck;
  14. Object.defineProperty(window, "CKEDITOR", {
  15. get: function() {
  16. if (ck && ck.replace && !ck.replace.injected) {
  17. var oldreplace = ck.replace;
  18. oldreplace.injected = true;
  19. ck.replace = function() {
  20. if (arguments.length >= 2) {
  21. if (typeof arguments[1] === "object") {
  22. delete arguments[1]["toolbarGroups"];
  23. delete arguments[1]["toolbar"];
  24. delete arguments[1]["removeButtons"];
  25. }
  26. }
  27. return oldreplace.apply(this, arguments);
  28. };
  29. }
  30. return ck;
  31. },
  32. set: function(x) {
  33. ck = x;
  34. }
  35. });
  36. var jq = null;
  37. Object.defineProperty(window, "jQuery", {
  38. get: function() {
  39. return jq;
  40. },
  41. set: function(x) {
  42. jq = x;
  43. if (jq && jq.fn) {
  44. var kendo;
  45. Object.defineProperty(jq.fn, "kendoEditor", {
  46. get: function() {
  47. if (kendo) {
  48. var oldkendo = kendo;
  49. kendo = function() {
  50. if (arguments.length >= 1 && typeof arguments[0] === "object") {
  51. if (!arguments[0].tools) {
  52. arguments[0].tools = [];
  53. }
  54. var tools = [
  55. "bold", "italic", "underline", "strikethrough", "subscript", "superscript",
  56. "fontName", "fontSize", "foreColor", "backColor",
  57. "justifyLeft", "justifyCenter", "justifyRight", "justifyFull",
  58. "insertUnorderedList", "insertOrderedList", "indent", "outdent",
  59. "createLink", "unlink", "insertImage", "insertFile",
  60. "tableWizard", "createTable", "addColumnLeft", "addColumnRight", "addRowAbove", "addRowBelow", "deleteRow", "deleteColumn",
  61. "formatting", "cleanFormatting",
  62. "insertHtml", "viewHtml",
  63. "print", "pdf"
  64. ];
  65. for (var i = 0; i < tools.length; i++) {
  66. var tool = tools[i];
  67. var in_array = false;
  68. for (var j = 0; j < arguments[0].tools.length; j++) {
  69. var atool = arguments[0].tools[j];
  70. if (typeof atool === "string") {
  71. if (atool === tool) {
  72. in_array = true;
  73. break;
  74. }
  75. } else {
  76. if (atool.name === tool) {
  77. in_array = true;
  78. break;
  79. }
  80. }
  81. }
  82. if (in_array)
  83. continue;
  84. arguments[0].tools.push(tool);
  85. }
  86. }
  87. return oldkendo.apply(this, arguments);
  88. }
  89. }
  90. return kendo;
  91. },
  92. set: function(x) {
  93. kendo = x;
  94. }
  95. })
  96. }
  97. }
  98. });
  99. })();

QingJ © 2025

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