|
|
| 第1行: |
第1行: |
| $( function () { | | $( function () { |
| mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { | | mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { |
| // 包裹型工具:选中文字→包起来
| | function btn( pre, peri, post, label, cls ) { |
| function wrapTool( pre, peri, post ) { | | return { |
| return { type: 'button', label: '', action: { | | action: { type: 'encapsulate', options: { pre: pre, peri: peri || '', post: post || '' } }, |
| type: 'encapsulate', options: { pre: pre, peri: peri, post: post } } };
| | label: label, |
| | cssClass: cls || '' |
| | }; |
| } | | } |
| // 插入型工具:插入骨架
| |
| function insTool( text ) {
| |
| return { type: 'button', label: '', action: {
| |
| type: 'encapsulate', options: { pre: text } } };
| |
| }
| |
|
| |
| $textarea.wikiEditor( 'addToToolbar', { | | $textarea.wikiEditor( 'addToToolbar', { |
| sections: { | | sections: { |
| noblecraft: { | | noblecraft: { |
| type: 'booklet', | | type: 'booklet', |
| label: 'NobleCraft 格式', | | label: 'Noblecraft 格式', |
| pages: { | | pages: { |
| colors: { | | colors: { layout: 'characters', label: '颜色 / 强调', characters: [ |
| layout: 'characters',
| | btn('{{红|','文字','}}','红','nc-红'), |
| label: '颜色/强调',
| | btn('{{绿|','文字','}}','绿','nc-绿'), |
| characters: [
| | btn('{{蓝|','文字','}}','蓝','nc-蓝'), |
| { action:{type:'encapsulate',options:{pre:'{{红|',peri:'文字',post:'}}'}}, label:'红' },
| | btn('{{橙|','文字','}}','橙','nc-橙'), |
| { action:{type:'encapsulate',options:{pre:'{{绿|',peri:'文字',post:'}}'}}, label:'绿' },
| | btn('{{高亮|','文字','}}','高亮','nc-高亮'), |
| { action:{type:'encapsulate',options:{pre:'{{蓝|',peri:'文字',post:'}}'}}, label:'蓝' },
| | btn('{{提示|','提示内容','}}','提示'), |
| { action:{type:'encapsulate',options:{pre:'{{橙|',peri:'文字',post:'}}'}}, label:'橙' },
| | btn('{{警告|','警告内容','}}','警告'), |
| { action:{type:'encapsulate',options:{pre:'{{高亮|',peri:'文字',post:'}}'}}, label:'高亮' },
| | btn('{{成功|','内容','}}','成功') |
| { 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:'成功' }
| | btn('{{指令|','/命令','}}','指令'), |
| ]
| | btn('{{键|','F3','}}','键'), |
| },
| | btn('{{坐标|x=','0','|y=0|z=0}}','坐标'), |
| game: { | | btn('{{稀有度|','史诗','}}','稀有度'), |
| layout: 'characters',
| | btn('{{评分星|','4','}}','评分星'), |
| label: '游戏元素',
| | btn('{{状态|','可用','}}','状态'), |
| characters: [
| | btn('{{版本|','1.0','}}','版本') |
| { action:{type:'encapsulate',options:{pre:'{{指令|',peri:'/命令',post:'}}'}}, label:'指令' },
| | ] }, |
| { action:{type:'encapsulate',options:{pre:'{{键|',peri:'F3',post:'}}'}}, label:'键' },
| | links: { layout: 'characters', label: '链接 / 剧情', characters: [ |
| { action:{type:'encapsulate',options:{pre:'{{坐标|x=',peri:'0',post:'|y=0|z=0}}'}}, label:'坐标' },
| | btn('{{NPC|','角色名','}}','NPC'), |
| { action:{type:'encapsulate',options:{pre:'{{稀有度|',peri:'史诗',post:'}}'}}, label:'稀有度' },
| | btn('{{地点|','地点名','}}','地点'), |
| { action:{type:'encapsulate',options:{pre:'{{评分星|',peri:'4',post:'}}'}}, label:'评分星' },
| | btn('{{物品|','物品名','}}','物品'), |
| { action:{type:'encapsulate',options:{pre:'{{状态|',peri:'可用',post:'}}'}}, label:'状态' },
| | btn('{{剧透|','剧透内容','}}','剧透'), |
| { action:{type:'encapsulate',options:{pre:'{{版本|',peri:'1.0',post:'}}'}}, label:'版本' }
| | btn('{{对话|角色=角色名|','台词','}}','对话') |
| ]
| | ] }, |
| },
| | blocks: { layout: 'characters', label: '区块 / 标记', characters: [ |
| links: { | | btn('{{折叠|标题=标题|','内容','}}','折叠'), |
| layout: 'characters',
| | btn('{{公告|','公告内容','}}','公告'), |
| label: '链接/剧情',
| | btn('{{待补充}}','','','待补充'), |
| characters: [
| | btn('{{待更新}}','','','待更新'), |
| { action:{type:'encapsulate',options:{pre:'{{NPC|',peri:'角色名',post:'}}'}}, label:'NPC' },
| | btn('{{主条目|','页面名','}}','主条目'), |
| { action:{type:'encapsulate',options:{pre:'{{地点|',peri:'地点名',post:'}}'}}, label:'地点' },
| | btn('{{参见|','页面名','}}','参见') |
| { 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:'参见' }
| |
| ]
| |
| }
| |
| } | | } |
| } | | } |