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

H萌娘,万物皆可H的百科全书!
跳到导航 跳到搜索
imported>=海豚=
(清空页面)
imported>=海豚=
(撤销=海豚=讨论)的版本112124)
 
第1行: 第1行:
// <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: "<center>",
               post: "</center>"
             }
           }
         },
         '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>

2021年11月13日 (六) 21:50的最新版本

// <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: "<center>",
                            post: "</center>"
                        }
                    }
                },

                '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>