مستخدم:Sakiv/AutoEd.js

من ويكيبيديا، الموسوعة الحرة

ملاحظة: بعد الحفظ، قد يلزمك إفراغ الكاش لرؤية التغييرات.

//[[وب:إضافة أدوات تحرير]]
    (function (mw, $, undefined) {
        var customizeBetaToolbar = function () {
                $("#wpTextbox1").wikiEditor("addToToolbar", {
                    section: "main",
                    group: "format",
                    tools: {
                        layoutstub: {
                            label: "stub",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/3/33/Toolbar_welcome.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "\'\'\'",
                                    peri: "\{\{نسخ:اسم_الصفحة_الأساسي\}\}",
                                    post: "\'\'\' <ref>[[\n</ref>\n\n==انظر أيضا==\n*[[\n\n==مراجع==\n{{مراجع}}\n\n{{بذرة}}\n\n[[تصنيف:مصطلحات عربية]]"
                                }
                            }
                        },
                        internallink: {
                            label: "brackets",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/d/d6/WikiText.svg",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "[[",
                                    post: "]]",
                                }
                            }
                        },
                        internallink2: {
                            label: "Stick",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/3/32/Toolbaricon_vertical_bar.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "|",
                                    post: "",
                                }
                            }
                        },
                        template: {
                            label: "توضيح",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/4/47/Button_arabic.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "{{",
                                    peri: "توضيح",
                                    post: "}}",
                                }
                            }
                        },
                        ref: {
                            label: "مرجع",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/9/9f/Button_nowiki_symbol.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "<ref>",
                                    post: "</ref>",
                                }
                            }
                        },
                        externallink: {
                            label: "Bracket-1",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/5/53/Button_ext_link.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "[",
                                    post: "]",
                                }
                            }
                        },
                        seealso: {
                            label: "انظر",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/e/ed/Bouton_sourcer.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "== انظر أيضا ==\n* [[",
                                    post: "",
                                }
                            }
                        },
                        references: {
                            label: "refs",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/3/34/Toolbar_references.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "==مراجع==\n{{مراجع}}",
                                }
                            }
                        },
                        xls: {
                            label: "xls",
                            type: "button",
                            icon: "https://upload.wikimedia.org/wikipedia/commons/1/14/Symbol_el.JPG",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "==",
                                    peri: "وصلات خارجية",
                                    post: "==",
                                }
                            }
                        },
                        category: {
                            label: "cat",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/c/c4/Toolbar_category.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "[[تصنيف:",
                                    post: "",
                                }
                            }
                        },
                        red: {
                            label: "redirect",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/7/76/Insert_redirect.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "#تحويل [[",
                                    peri: "",
                                    post: "]]",
                                }
                            }
                        },
                        code: {
                            label: "code",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/6/62/Toolbar_code.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: '<code dir=ltr><nowiki>',
                                    post: "</nowiki></code>",
                                }
                            }
                        },
                        sig: {
                            label: "sig",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/7/79/Insert-signature.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "--~~\~~",
                                }
                            }
                        },
                        sig2: {
                            label: "sig2",
                            type: "button",
                            icon: "//upload.wikimedia.org/wikipedia/commons/3/34/Toolbar_miss_signature.png",
                            action: {
                                type: "encapsulate",
                                options: {
                                    pre: "",
                                    post: "--[[user talk:BAB ZAA|Zack]] &rlm;~~\~\~~&rlm;"
                                }
                            }
                        }
                    }
                })
            };
        if ($.inArray(mw.config.get("wgAction"), ["edit", "submit"]) !== -1) {
            mw.loader.using("user.options", function () {
                if (mw.user.options.get("usebetatoolbar")) {
                    mw.loader.using("ext.wikiEditor", function () {
                        $(customizeBetaToolbar)
                    })
                } else {
                    $(customizeOrigToolbar)
                }
            })
        }
    })(mediaWiki, jQuery);