User:Crowley666/common.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
importScript('User:Crowley666/js/vote.js');//半自動投票模板。
importScript('User:Crowley666/js/TranslationHelper.js');//翻译助手
//mw.loader.load('//en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/Replace?action=raw&ctype=text/javascript');
importScript('User:Crowley666/js/layout.js');
// MediaWiki:Gadget-Edittools-vector.js
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' ) );
} );
} );
}
}
};
// 参考MediaWiki:Gadget-Edittools-vplus.js MediaWiki:Gadget-EditToolbarThunks.js
// https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization
// https://github.com/wikimedia/mediawiki-extensions-WikiEditor/blob/master/modules/jquery.wikiEditor.toolbar.config.js
addOnloadHook( function () { if (document.forms.editform) {
customizeToolbar( function() {
this.wikiEditor('addToToolbar', {
'section': 'advanced',
'group': 'search',
'tools': {
'support': {
label: '支持',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/22px-Symbol_support_vote.svg.png',
action: {
type: 'callback',
execute: function () { console.log('123'); }
/*
type: 'encapsulate',
options: {
pre: "{{Support}}",
periMsg: '填写理由',
post: '--~~\~~'
}
*/
}
}
}
} );
} );
} } );