MediaWiki:Common.js
MediaWiki界面页面
更多操作
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5。
$( function () {
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
// 包裹型工具:选中文字→包起来
function wrapTool( pre, peri, post ) {
return { type: 'button', label: '', action: {
type: 'encapsulate', options: { pre: pre, peri: peri, post: post } } };
}
// 插入型工具:插入骨架
function insTool( text ) {
return { type: 'button', label: '', action: {
type: 'encapsulate', options: { pre: text } } };
}
$textarea.wikiEditor( 'addToToolbar', {
sections: {
noblecraft: {
type: 'booklet',
label: 'NobleCraft 格式',
pages: {
colors: {
layout: 'characters',
label: '颜色/强调',
characters: [
{ action:{type:'encapsulate',options:{pre:'{{红|',peri:'文字',post:'}}'}}, label:'红' },
{ action:{type:'encapsulate',options:{pre:'{{绿|',peri:'文字',post:'}}'}}, label:'绿' },
{ action:{type:'encapsulate',options:{pre:'{{蓝|',peri:'文字',post:'}}'}}, label:'蓝' },
{ action:{type:'encapsulate',options:{pre:'{{橙|',peri:'文字',post:'}}'}}, label:'橙' },
{ action:{type:'encapsulate',options:{pre:'{{高亮|',peri:'文字',post:'}}'}}, label:'高亮' },
{ action:{type:'encapsulate',options:{pre:'{{提示|',peri:'提示内容',post:'}}'}}, label:'提示' },
{ action:{type:'encapsulate',options:{pre:'{{警告|',peri:'警告内容',post:'}}'}}, label:'警告' },
{ action:{type:'encapsulate',options:{pre:'{{成功|',peri:'内容',post:'}}'}}, label:'成功' }
]
},
game: {
layout: 'characters',
label: '游戏元素',
characters: [
{ action:{type:'encapsulate',options:{pre:'{{指令|',peri:'/命令',post:'}}'}}, label:'指令' },
{ action:{type:'encapsulate',options:{pre:'{{键|',peri:'F3',post:'}}'}}, label:'键' },
{ action:{type:'encapsulate',options:{pre:'{{坐标|x=',peri:'0',post:'|y=0|z=0}}'}}, label:'坐标' },
{ action:{type:'encapsulate',options:{pre:'{{稀有度|',peri:'史诗',post:'}}'}}, label:'稀有度' },
{ action:{type:'encapsulate',options:{pre:'{{评分星|',peri:'4',post:'}}'}}, label:'评分星' },
{ action:{type:'encapsulate',options:{pre:'{{状态|',peri:'可用',post:'}}'}}, label:'状态' },
{ action:{type:'encapsulate',options:{pre:'{{版本|',peri:'1.0',post:'}}'}}, label:'版本' }
]
},
links: {
layout: 'characters',
label: '链接/剧情',
characters: [
{ action:{type:'encapsulate',options:{pre:'{{NPC|',peri:'角色名',post:'}}'}}, label:'NPC' },
{ action:{type:'encapsulate',options:{pre:'{{地点|',peri:'地点名',post:'}}'}}, label:'地点' },
{ action:{type:'encapsulate',options:{pre:'{{物品|',peri:'物品名',post:'}}'}}, label:'物品' },
{ action:{type:'encapsulate',options:{pre:'{{剧透|',peri:'剧透内容',post:'}}'}}, label:'剧透' },
{ action:{type:'encapsulate',options:{pre:'{{对话|角色=角色名|',peri:'台词',post:'}}'}}, label:'对话' }
]
},
blocks: {
layout: 'characters',
label: '区块/标记',
characters: [
{ action:{type:'encapsulate',options:{pre:'{{折叠|标题=标题|',peri:'内容',post:'}}'}}, label:'折叠' },
{ action:{type:'encapsulate',options:{pre:'{{公告|',peri:'公告内容',post:'}}'}}, label:'公告' },
{ action:{type:'encapsulate',options:{pre:'{{待补充}}'}}, label:'待补充' },
{ action:{type:'encapsulate',options:{pre:'{{待更新}}'}}, label:'待更新' },
{ action:{type:'encapsulate',options:{pre:'{{主条目|',peri:'页面名',post:'}}'}}, label:'主条目' },
{ action:{type:'encapsulate',options:{pre:'{{参见|',peri:'页面名',post:'}}'}}, label:'参见' }
]
}
}
}
}
} );
} );
} );