注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
/* 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/thumb/0/00/Structure_du_site_ic%C3%B4ne.svg/23px-Structure_du_site_ic%C3%B4ne.svg.png', action: { type: 'encapsulate', options: { pre: "[\[Category:", post: "]]" } } } } } ); this.wikiEditor('addToToolbar', { 'section': 'advanced', 'group': 'format', 'tools': { 'bolditalic': { label: '粗斜体', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/b/be/Toolbaricon_bolditalic_A.png', action: { type: 'encapsulate', options: { pre: "'''''", periMsg: '粗斜体文字', post: "'''''" } } }, 'red': { label: '红字', type: 'button', icon: '//www.eu4cn.com/images/7/7e/Toolbaricon_red.png', action: { type: 'encapsulate', options: { pre: "{\{red|", periMsg: '红色加粗字体', post: "}}" } } }, 'green': { label: '绿字', type: 'button', icon: '//www.eu4cn.com/images/8/8e/Toolbaricon_green.png', action: { type: 'encapsulate', options: { pre: "{\{green|", periMsg: '绿色加粗字体', post: "}}" } } }, 'strikethrough': { label: '删除线', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/1/1a/Toolbaricon_strike.png', action: { type: 'encapsulate', options: { pre: "<s>", post: "</s>" } } }, 'underline': { label: '下划线', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/thumb/9/99/Gnome-format-text-underline.svg/22px-Gnome-format-text-underline.svg.png', action: { type: 'encapsulate', options: { pre: "<u>", post: "</u>" } } }, 'source': { label: '源代码', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Toolbaricon_source.svg/22px-Toolbaricon_source.svg.png', action: { type: 'encapsulate', options: { pre: "<source lang=\"text\">", post: '</source>' } } } } } ); this.wikiEditor('addToToolbar', { 'section': 'advanced', 'group': 'insert', 'tools': { 'math': { label: '数学公式', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/thumb/c/c2/Nuvola_apps_edu_mathematics-p.svg/22px-Nuvola_apps_edu_mathematics-p.svg.png', action: { type: 'encapsulate', options: { pre: "<math>", periMsg: '插入数学公式', post: "</math>" } } }, 'flag': { label: '国旗', type: 'button', icon: '//www.eu4cn.com/images/thumb/2/25/Legitimacy.png/22px-Legitimacy.png', action: { type: 'encapsulate', options: { pre: "{\{flag|", periMsg: '国家名称', post: "}}" } } }, 'flagicon': { label: '仅国旗(无国家名称)', type: 'button', icon: '//www.eu4cn.com/images/thumb/4/4d/Flagicon.png/22px-Flagicon.png', action: { type: 'encapsulate', options: { pre: "{\{flagicon|", periMsg: '国家名称', post: "}}" } } }, 'Version': { label: '版本', type: 'button', icon: '//www.eu4cn.com/images/thumb/5/50/Administrative_tech.png/22px-Administrative_tech.png', action: { type: 'encapsulate', options: { pre: "{\{Version|", periMsg: '游戏版本', post: "}}" } } }, 'hidden': { label: '注释或隐藏文字', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/1/11/Toolbaricon_hiddencomment.png', action: { type: 'encapsulate', options: { pre: "<!-- ", post: " -->" } } }, 'hans-hant': { label: '繁简转换', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/9/9d/Toolbaricon_sr.png', action: { type: 'encapsulate', options: { pre: "-{", periMsg: '转换文字', post: "}-" } } }, 'references': { label: '参考资料区', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/8/8d/Wikieditor-references.png', action: { type: 'encapsulate', options: { pre: "\n==参考资料==\n<references />\n", } } } } } ); } ); }