MediaWiki:Gadget-Edittools-vector.js:修订间差异

H萌娘,万物皆可H的百科全书!
跳到导航 跳到搜索
imported>=海豚=
无编辑摘要
imported>=海豚=
无编辑摘要
第24行: 第24行:
            label: '分类',
            label: '分类',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/0/0c/VisualEditor_-_Icon_-_Tag.svg/24px-VisualEditor_-_Icon_-_Tag.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/0/0c/VisualEditor_-_Icon_-_Tag.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
              options: {
              options: {
                pre: "[\[Category:",
                pre: "[\[ 分类:",
                post: "]]"
                post: "]]"
              }
              }
第35行: 第35行:
        }
        }
      } );
      } );
      this.wikiEditor('addToToolbar', {
      this.wikiEditor('addToToolbar', {
        'section': 'advanced',
        'section': 'advanced',
        'group': 'format',
        'group': 'format',
        'tools': {
        'tools': {
         'bolditalic': {
           label: '粗斜体',
           type: 'button',
           icon: '//upload.wikimedia.org/wikipedia/commons/b/be/Toolbaricon_bolditalic_A.png',
           action: {
             type: 'encapsulate',
             options: {
               pre: "'''''",
               periMsg: '粗斜体文字',
               post: "'''''"
             }
           }
         },
          'strikethrough': {
          'strikethrough': {
            label: '删除线',
            label: '删除线',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/7/72/VisualEditor_-_Icon_-_Strikethrough-s.svg/24px-VisualEditor_-_Icon_-_Strikethrough-s.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/7/72/VisualEditor_-_Icon_-_Strikethrough-s.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
第70行: 第55行:
            label: '下划线',
            label: '下划线',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a9/VisualEditor_-_Icon_-_Underline-u.svg/24px-VisualEditor_-_Icon_-_Underline-u.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/a/a9/VisualEditor_-_Icon_-_Underline-u.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
第79行: 第64行:
            }
            }
          },
          },
          'quote': {
 
            label: ' 引用',
          'source': {
            label: ' 模板 引用',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/d/d8/VisualEditor_-_Icon_-_Block-quote.svg/24px-VisualEditor_-_Icon_-_Block-quote.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/2/2c/VisualEditor_-_Icon_-_Source.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
              options: {
              options: {
                pre: "<blockquote>",
                pre: "{{",
                post: "</blockquote>"
                post: '}}'
              }
              }
            }
            }
第95行: 第81行:
            label: '左对齐',
            label: '左对齐',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/7/7f/OOjs_UI_icon_alignLeft.svg/24px-OOjs_UI_icon_alignLeft.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/7/7f/OOjs_UI_icon_alignLeft.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
第108行: 第94行:
            label: '居中',
            label: '居中',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/ba/OOjs_UI_icon_alignCenter.svg/24px-OOjs_UI_icon_alignCenter.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/b/ba/OOjs_UI_icon_alignCenter.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
第121行: 第107行:
            label: '右对齐',
            label: '右对齐',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/1/13/OOjs_UI_icon_alignRight.svg/24px-OOjs_UI_icon_alignRight.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/1/13/OOjs_UI_icon_alignRight.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
第127行: 第113行:
                pre: "<div style=\"text-align: right;\">",
                pre: "<div style=\"text-align: right;\">",
                post: "</div>"
                post: "</div>"
             }
           }
         },
         'source': {
           label: '源代码',
           type: 'button',
           icon: '//upload.wikimedia.org/wikipedia/commons/thumb/2/2c/VisualEditor_-_Icon_-_Source.svg/24px-VisualEditor_-_Icon_-_Source.svg.png',
           action: {
             type: 'encapsulate',
             options: {
               pre: "<syntaxhighlight lang=\"text\">",
               post: '</syntaxhighlight>'
              }
              }
            }
            }
第150行: 第123行:
        'group': 'insert',
        'group': 'insert',
        'tools': {
        'tools': {
         'math': {
           label: '数学公式',
           type: 'button',
           icon: '//upload.wikimedia.org/wikipedia/commons/thumb/3/30/VisualEditor_-_Icon_-_Equation.svg/24px-VisualEditor_-_Icon_-_Equation.svg.png',
           action: {
             type: 'encapsulate',
             options: {
               pre: "<math>",
               periMsg: '插入数学公式',
               post: "</math>"
             }
           }
         },


          'hidden': {
          'hidden': {
            label: '注释或隐藏文字',
            label: '注释或隐藏文字',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/d/d1/VisualEditor_-_Icon_-_Comment.svg/24px-VisualEditor_-_Icon_-_Comment.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/d/d1/VisualEditor_-_Icon_-_Comment.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
第180行: 第140行:
            label: '水平线',
            label: '水平线',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/0/0e/VisualEditor_-_Icon_-_Remove-item.svg/24px-VisualEditor_-_Icon_-_Remove-item.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/0/0e/VisualEditor_-_Icon_-_Remove-item.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
第186行: 第146行:
                pre: "----",
                pre: "----",
                ownline: true
                ownline: true
             }
           }
         },
         'hans-hant': {
           label: '繁简转换',
           type: 'button',
           icon: '//upload.wikimedia.org/wikipedia/commons/thumb/6/6a/Chinese_conversion_black.svg/24px-Chinese_conversion_black.svg.png',
           action: {
             type: 'encapsulate',
             options: {
               pre: "-{",
               periMsg: '转换文字',
               post: "}-"
              }
              }
            }
            }
第207行: 第153行:
            label: '参考文献区',
            label: '参考文献区',
            type: 'button',
            type: 'button',
            icon: '//upload.wikimedia.org/wikipedia/commons/thumb/f/f9/VisualEditor_-_Icon_-_References.svg/24px-VisualEditor_-_Icon_-_References.svg.png',
            icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/VisualEditor_-_Icon_-_References.svg',
            action: {
            action: {
              type: 'encapsulate',
              type: 'encapsulate',
              options: {
              options: {
                pre: "\n== 参考文献==\n{\{reflist}}\n",
                pre: "\n\n== 注释与外部链接==\n<references/>\n\n",
              }
              }
            }
            }

2021年5月9日 (日) 09:43的版本

// <nowiki>
/* Generic code */
window.customizeToolbar = function( customizer ) {
        /* Check if we are in edit mode and the required modules are available and then customize the toolbar */
        if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
                if ( mw.user.options.get('usebetatoolbar') ) {
                        mw.loader.using( 'ext.wikiEditor', function () {
                                $(document).ready( function() {
                                        customizer.call( $( '#wpTextbox1' ) );
                                } );
                        } );
                }
        }
}

/* If the user manually chose this gadget */
if ( mw.user.options.get('gadget-Edittools-vector') ) {
    customizeToolbar( function() {
        this.wikiEditor('addToToolbar', {
            'section': 'main',
            'group': 'insert',
            'tools': {
                'category': {
                    label: '分类',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/0/0c/VisualEditor_-_Icon_-_Tag.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "[\[分类:",
                            post: "]]"
                        }
                    }
                }
            }
        } );
        this.wikiEditor('addToToolbar', {
            'section': 'advanced',
            'group': 'format',
            'tools': {
                'strikethrough': {
                    label: '删除线',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/7/72/VisualEditor_-_Icon_-_Strikethrough-s.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "<s>",
                            post: "</s>"
                        }
                    }
                },

                'underline': {
                    label: '下划线',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/a/a9/VisualEditor_-_Icon_-_Underline-u.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "<u>",
                            post: "</u>"
                        }
                    }
                },

                'source': {
                    label: '模板引用',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/2/2c/VisualEditor_-_Icon_-_Source.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "{{",
                            post: '}}'
                        }
                    }
                },

                'justify-left': {
                    label: '左对齐',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/7/7f/OOjs_UI_icon_alignLeft.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "<div style=\"text-align: left;\">",
                            post: "</div>"
                        }
                    }
                },

                'justify-center': {
                    label: '居中',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/b/ba/OOjs_UI_icon_alignCenter.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "<div style=\"text-align: center;\">",
                            post: "</div>"
                        }
                    }
                },

                'justify-right': {
                    label: '右对齐',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/1/13/OOjs_UI_icon_alignRight.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "<div style=\"text-align: right;\">",
                            post: "</div>"
                        }
                    }
                }
            }
        } );

        this.wikiEditor('addToToolbar', {
            'section': 'advanced',
            'group': 'insert',
            'tools': {

                'hidden': {
                    label: '注释或隐藏文字',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/d/d1/VisualEditor_-_Icon_-_Comment.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "<!-- ",
                            post: " -->"
                        }
                    }
                },

                'hline': {
                    label: '水平线',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/0/0e/VisualEditor_-_Icon_-_Remove-item.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "----",
                            ownline: true
                        }
                    }
                },

                'references': {
                    label: '参考文献区',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/VisualEditor_-_Icon_-_References.svg',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "\n\n==注释与外部链接==\n<references/>\n\n",
                        }
                    }
                }
            }
        } );
    } );
}

// </nowiki>