打开/关闭菜单
Toggle preferences menu
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

MediaWiki:Gadget-custom-toolbar.js:修订间差异

MediaWiki界面页面
无编辑摘要
无编辑摘要
第19行: 第19行:
                                         type: 'encapsulate',
                                         type: 'encapsulate',
                                         options: {
                                         options: {
                                             pre: '{{A型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=',
                                             pre: '{{A型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=\n}}',
                                             post: '\n}}'
                                             post: ''
                                         }
                                         }
                                     }
                                     }
第29行: 第29行:
                                         type: 'encapsulate',
                                         type: 'encapsulate',
                                         options: {
                                         options: {
                                             pre: '{{A2型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=',
                                             pre: '{{A2型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=\n}}',
                                             post: '\n}}'
                                             post: ''
                                         }
                                         }
                                     }
                                     }
第39行: 第39行:
                                         type: 'encapsulate',
                                         type: 'encapsulate',
                                         options: {
                                         options: {
                                             pre: '{{A3型题\n|source=\n|sourceRange=\n|title="",""\n|choices={"A":"","B":"","C":"","D":"","E":""},{"A":"","B":"","C":"","D":"","E":""}\n|answer="",""\n|explain="",""\n|info=',
                                             pre: '{{A3型题\n|source=\n|sourceRange=\n|title="",""\n|choices={"A":"","B":"","C":"","D":"","E":""},{"A":"","B":"","C":"","D":"","E":""}\n|answer="",""\n|explain="",""\n|info=\n}}',
                                             post: '\n}}'
                                             post: ''
                                         }
                                         }
                                     }
                                     }
第49行: 第49行:
                                         type: 'encapsulate',
                                         type: 'encapsulate',
                                         options: {
                                         options: {
                                             pre: '{{B型题\n|source=\n|sourceRange=\n|title="",""\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer="",""\n|explain="",""\n',
                                             pre: '{{B型题\n|source=\n|sourceRange=\n|title="",""\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer="",""\n|explain="",""\n}}',
                                             post: '\n}}'
                                             post: ''
                                         }
                                         }
                                     }
                                     }
第59行: 第59行:
                                         type: 'encapsulate',
                                         type: 'encapsulate',
                                         options: {
                                         options: {
                                             pre: '{{C型题\n|source=\n|sourceRange=\n|title="",""\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer="",""\n|explain="",""\n',
                                             pre: '{{C型题\n|source=\n|sourceRange=\n|title="",""\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer="",""\n|explain="",""\n}}',
                                             post: '\n}}'
                                             post: ''
                                         }
                                         }
                                     }
                                     }
第69行: 第69行:
                                         type: 'encapsulate',
                                         type: 'encapsulate',
                                         options: {
                                         options: {
                                             pre: '{{X型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=',
                                             pre: '{{X型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=\n}}',
                                             post: '\n}}'
                                             post: ''
                                         }
                                         }
                                     }
                                     }

2023年6月3日 (六) 20:30的版本

// Check if we're editing a page.
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	// Add a hook handler.
	mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
		// Configure a new toolbar entry on the given $textarea jQuery object.
		//题库模板的下拉菜单
		$textarea.wikiEditor( 'addToToolbar', {
            section: 'main',
            groups: {
                list: {
                    tools: {
                        templates: {
                            label: '题库模板',
                            type: 'select',
                            list: {
                                'A1-button': {
                                    label: 'A1型题',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{A型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=\n}}',
                                            post: ''
                                        }
                                    }
                                }
                                ,'A2-button': {
                                    label: 'A2型题',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{A2型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=\n}}',
                                            post: ''
                                        }
                                    }
                                }
                                ,'A3-button': {
                                    label: 'A3型题',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{A3型题\n|source=\n|sourceRange=\n|title="",""\n|choices={"A":"","B":"","C":"","D":"","E":""},{"A":"","B":"","C":"","D":"","E":""}\n|answer="",""\n|explain="",""\n|info=\n}}',
                                            post: ''
                                        }
                                    }
                                }
                                ,'B-button': {
                                    label: 'B型题',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{B型题\n|source=\n|sourceRange=\n|title="",""\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer="",""\n|explain="",""\n}}',
                                            post: ''
                                        }
                                    }
                                }
                                ,'C-button': {
                                    label: 'C型题',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{C型题\n|source=\n|sourceRange=\n|title="",""\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer="",""\n|explain="",""\n}}',
                                            post: ''
                                        }
                                    }
                                }
                                ,'X-button': {
                                    label: 'X型题',
                                    action: {
                                        type: 'encapsulate',
                                        options: {
                                            pre: '{{X型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=\n}}',
                                            post: ''
                                        }
                                    }
                                }

                            }
                        }
                    }
                }
            }
        } );
	} );
}