Force Full Editor

Forces WYSIWYG editors to always use the full editor if possible

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name Force Full Editor
// @description Forces WYSIWYG editors to always use the full editor if possible
// @author qsniyg
// @version 0.2
// @namespace Violentmonkey Scripts
// @include *
// @grant none
// @run-at document-start
// ==/UserScript==

(function() {
    var ck;
    Object.defineProperty(window, "CKEDITOR", {
        get: function() {
            if (ck && ck.replace && !ck.replace.injected) {
                var oldreplace = ck.replace;
                oldreplace.injected = true;
                ck.replace = function() {
                    if (arguments.length >= 2) {
                        if (typeof arguments[1] === "object") {
                            delete arguments[1]["toolbarGroups"];
                            delete arguments[1]["toolbar"];
                            delete arguments[1]["removeButtons"];
                        }
                    }
                    return oldreplace.apply(this, arguments);
                };
            }
            return ck;
        },
        set: function(x) {
            ck = x;
        }
    });
    var jq = null;
    Object.defineProperty(window, "jQuery", {
        get: function() {
            return jq;
        },
        set: function(x) {
            jq = x;
            if (jq && jq.fn) {
                var kendo;
                Object.defineProperty(jq.fn, "kendoEditor", {
                    get: function() {
                        if (kendo) {
                            var oldkendo = kendo;
                            kendo = function() {
                                if (arguments.length >= 1 && typeof arguments[0] === "object") {
                                    if (!arguments[0].tools) {
                                        arguments[0].tools = [];
                                    }
                                    
                                    var tools = [
                                        "bold", "italic", "underline", "strikethrough", "subscript", "superscript",
                                        "fontName", "fontSize", "foreColor", "backColor",
                                        "justifyLeft", "justifyCenter", "justifyRight", "justifyFull",
                                        "insertUnorderedList", "insertOrderedList", "indent", "outdent",
                                        "createLink", "unlink", "insertImage", "insertFile",
                                        "tableWizard", "createTable", "addColumnLeft", "addColumnRight", "addRowAbove", "addRowBelow", "deleteRow", "deleteColumn",
                                        "formatting", "cleanFormatting",
                                        "insertHtml", "viewHtml",
                                        "print", "pdf"
                                    ];
                                    
                                    for (var i = 0; i < tools.length; i++) {
                                        var tool = tools[i];
                                        
                                        var in_array = false;
                                        for (var j = 0; j < arguments[0].tools.length; j++) {
                                            var atool = arguments[0].tools[j];
                                            if (typeof atool === "string") {
                                                if (atool === tool) {
                                                    in_array = true;
                                                    break;
                                                }
                                            } else {
                                                if (atool.name === tool) {
                                                    in_array = true;
                                                    break;
                                                }
                                            }
                                        }
                                        
                                        if (in_array)
                                            continue;
                                        
                                        arguments[0].tools.push(tool);
                                    }
                                }
                                return oldkendo.apply(this, arguments);
                            }
                        }
                        return kendo;
                    },
                    set: function(x) {
                        kendo = x;
                    }
                })
            }
        }
    });
})();