User:Yangfl/customEdittools.js

维基百科,自由的百科全书

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。

//if ( mw.config.get( 'wgNamespaceNumber' ) == 0 ) {
if ( 1 == 1 ) {
    customizeToolbar( function() {
        this.wikiEditor('addToToolbar', {
            'sections': {
                'translations': {
                    'type': 'toolbar',
                    'label': '翻译'
                }
            }
        } );

        // To add a group to an existing toolbar section:
        this.wikiEditor('addToToolbar', {
            'section': 'translations',
            'groups': {
                'translation': {
                }
            }
        } );
        this.wikiEditor('addToToolbar', {
            'section': 'translations',
            'group': 'translation',
            'tools': {
                'requesttranslation': {
                    label: '请求翻译',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Symbol_question_vote_3.svg/22px-Symbol_question_vote_3.svg.png',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "{{Request translation}}",
                            periMsg: '', 
                            post: ''
                        }
                    }
                },
            }
        } );
        this.wikiEditor('addToToolbar', {
            'section': 'translations',
            'group': 'translation',
            'tools': {
                'translated': {
                    label: '已翻译',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Symbol_kept_vote.svg/22px-Symbol_kept_vote.svg.png',
                    action: {
                        type: 'encapsulate',
                        options: {
                            pre: "{{translated|en|",
                            periMsg: '条目名', 
                            post: '}}'
                        }
                    }
                },
            }
        } );
    } );
}