MediaWiki:Gadget-Edittools.js
阅读:104 更新:2022-10-1
来自柯南百科
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
window.customizeToolbar = function (customizer) {
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'));
});
});
}
}
};
customizeToolbar(function () {
this.wikiEditor('addToToolbar', {
'section': 'advanced',
'groups': {
'btnExt': {
}
}
});
this.wikiEditor('addToToolbar', {
'section': 'advanced',
'group': 'btnExt',
'tools': {
'languages': {
label: '语言工具',
type: 'select',
list: {
'ja': {
label: '日语',
action: {
type: 'encapsulate',
options: {
pre: '{{jp|',
periMsg: '日语文本',
post: '}}'
}
}
},
'lang': {
label: '其他语言',
action: {
type: 'encapsulate',
options: {
pre: '{{lang|语言代码|',
periMsg: '其他语言文本',
post: '}}'
}
}
},
'ruby': {
label: '注音',
action: {
type: 'encapsulate',
options: {
pre: '{{ruby|',
periMsg: '原文本',
post: '|注音文本}}'
}
}
},
'jaRuby': {
label: '日语注音',
action: {
type: 'encapsulate',
options: {
pre: '{{ruby|',
periMsg: '原文本',
post: '|注音文本|jp}}'
}
}
},
'noConv': {
label: '取消繁简转换',
action: {
type: 'encapsulate',
options: {
pre: '-{',
periMsg: '不转换内容',
post: '}-'
}
}
},
'mConv': {
label: '手动繁简转换',
action: {
type: 'encapsulate',
options: {
pre: '{{st|',
periMsg: '正确的简体',
post: '|正確的繁體}}'
}
}
}
}
},
'text': {
label: '文本样式',
type: 'select',
list: {
'red': {
label: '红色文字',
action: {
type: 'encapsulate',
options: {
pre: '{{color|red|',
periMsg: '红色文字',
post: '}}'
}
}
},
'darkRed': {
label: '暗红色文字',
action: {
type: 'encapsulate',
options: {
pre: '{{color|#a52a2a|',
periMsg: '红色文字',
post: '}}'
}
}
},
'boldItalic': {
label: '斜粗体文字',
action: {
type: 'encapsulate',
options: {
pre: '\'\'\'\'\'',
periMsg: '斜粗体文字',
post: '\'\'\'\'\''
}
}
},
'del': {
label: '删除线',
action: {
type: 'encapsulate',
options: {
pre: '<del>',
periMsg: '文字',
post: '</del>'
}
}
},
'dead': {
label: '示亡号',
action: {
type: 'encapsulate',
options: {
pre: '{{示亡号|',
periMsg: '逝者姓名',
post: '}}'
}
}
},
'span': {
label: '手动样式span',
action: {
type: 'encapsulate',
options: {
pre: '<span style="在此处编写CSS">',
periMsg: '文字',
post: '</span>'
}
}
},
'div': {
label: '手动样式div',
action: {
type: 'encapsulate',
options: {
pre: '<div style="在此处编写CSS">',
periMsg: '文字',
post: '</div>'
}
}
}
}
},
'punc': {
label: '标点符号',
type: 'select',
list: {
'jaQuote': {
label: '直角引号',
action: {
type: 'encapsulate',
options: {
pre: '「',
post: '」'
}
}
},
'jaDQuote': {
label: '空心直角引号',
action: {
type: 'encapsulate',
options: {
pre: '『',
post: '』'
}
}
},
'singleTitle': {
label: '单书名号',
action: {
type: 'encapsulate',
options: {
pre: '〈',
post: '〉'
}
}
},
'red': {
label: '空心方头括号',
action: {
type: 'encapsulate',
options: {
pre: '〖',
post: '〗'
}
}
}
}
},
'dev': {
label: '模板与嵌入',
type: 'select',
list: {
'comment': {
label: 'HTML注释',
action: {
type: 'encapsulate',
options: {
pre: '<!-- ',
periMsg: '注释',
post: ' -->'
}
}
},
'code': {
label: '代码',
action: {
type: 'encapsulate',
options: {
pre: '<code>',
periMsg: 'Hello World!',
post: '</code>'
}
}
},
'codeNowiki': {
label: '非wiki格式与代码',
action: {
type: 'encapsulate',
options: {
pre: '<code><nowiki>',
periMsg: 'Hello World!',
post: '</nowiki></code>'
}
}
},
'codeHighlight': {
label: '语法高亮',
action: {
type: 'encapsulate',
options: {
pre: '<\syntaxhighlight lang=\"代码语言\">',
periMsg: 'Hello World!',
post: '<\/syntaxhighlight>'
}
}
},
'noinclude': {
label: '<noinclude>',
action: {
type: 'encapsulate',
options: {
pre: '<noinclude>',
periMsg: 'noinclude标签内的内容不会被嵌入到目标页面',
post: '</noinclude>'
}
}
},
'includeonly': {
label: '<includeonly>',
action: {
type: 'encapsulate',
options: {
pre: '<includeonly>',
periMsg: 'includeonly标签内的内容只会在目标页面显示',
post: '</includeonly>'
}
}
},
'onlyinclude': {
label: '<onlyinclude>',
action: {
type: 'encapsulate',
options: {
pre: '<onlyinclude>',
periMsg: '只有在onlyinclude标签内的内容才会显示在目标页面',
post: '</onlyinclude>'
}
}
},
'subst': {
label: '替换引用',
action: {
type: 'encapsulate',
options: {
pre: '{{subst:',
periMsg: '替换引用',
post: '}}'
}
}
},
'templatestyle': {
label: '模板样式',
action: {
type: 'encapsulate',
options: {
pre: '<t\emplatestyles src=\"',
periMsg: 'CSS位置',
post: '\" />'
}
}
}
}
}
}
});
});