“MediaWiki:Gadget-Edittools-vector.css”与“MediaWiki:Gadget-Edittools-vector.js”:页面之间的差异
(页面间差异)
跳到导航
跳到搜索
imported>=海豚= (创建页面,内容为“.tool-button { height: 23px !important; margin-bottom: 3px; } #wikiEditor-section-main > div.group.group-insert > a{ background-size: 28px; margin-right: 6px…”) |
imported>=海豚= 无编辑摘要 |
||
第1行: | 第1行: | ||
. | /* Generic code */ | ||
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.toolbar', function () { | |||
$(document).ready( function() { | |||
customizer.call( $( '#wpTextbox1' ) ); | |||
} ); | |||
} ); | |||
} | |||
} | |||
} | } | ||
/* If the user manually chose this gadget */ | |||
if ( mw.user.options.get('gadget-Edittools-vector') ) { | |||
customizeToolbar( function() { | |||
this.wikiEditor('addToToolbar', { | |||
'section': 'main', | |||
} | 'group': 'insert', | ||
'tools': { | |||
'category': { | |||
} | label: '分类', | ||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/0/00/Structure_du_site_ic%C3%B4ne.svg/23px-Structure_du_site_ic%C3%B4ne.svg.png', | |||
} | action: { | ||
type: 'encapsulate', | |||
options: { | |||
pre: "[\[Category:", | |||
post: "]]" | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
} | |||
this.wikiEditor('addToToolbar', { | |||
'section': 'advanced', | |||
'group': 'format', | |||
'tools': { | |||
'bolditalic': { | |||
} | label: '粗斜体', | ||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/b/be/Toolbaricon_bolditalic_A.png', | |||
} | action: { | ||
type: 'encapsulate', | |||
options: { | |||
} | pre: "'''''", | ||
periMsg: '粗斜体文字', | |||
post: "'''''" | |||
} | |||
} | |||
}, | |||
'strikethrough': { | |||
label: '删除线', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/1/1a/Toolbaricon_strike.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<s>", | |||
post: "</s>" | |||
} | |||
} | |||
}, | |||
'underline': { | |||
label: '下划线', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/9/99/Gnome-format-text-underline.svg/22px-Gnome-format-text-underline.svg.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<u>", | |||
post: "</u>" | |||
} | |||
} | |||
}, | |||
'quote': { | |||
label: '块引用', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/2/2f/Toolbaricon_quote_1.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<blockquote>", | |||
post: "</blockquote>" | |||
} | |||
} | |||
}, | |||
'justify-left': { | |||
label: '左对齐', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/8/81/Toolbaricon_justify-left.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<div style=\"text-align: left;\">", | |||
post: "</div>" | |||
} | |||
} | |||
}, | |||
'justify-center': { | |||
label: '居中', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/c/ce/Gnome-format-justify-center.svg/23px-Gnome-format-justify-center.svg.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<div style=\"text-align: center;\">", | |||
post: "</div>" | |||
} | |||
} | |||
}, | |||
'justify-right': { | |||
label: '右对齐', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/f/fb/Gnome-format-justify-right.svg/23px-Gnome-format-justify-right.svg.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<div style=\"text-align: right;\">", | |||
post: "</div>" | |||
} | |||
} | |||
}, | |||
'indent-more': { | |||
label: '定义', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/8/84/Gnome-format-indent-more.svg/23px-Gnome-format-indent-more.svg.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: ";" | |||
} | |||
} | |||
}, | |||
'source': { | |||
label: '源代码', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Toolbaricon_source.svg/22px-Toolbaricon_source.svg.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<source lang=\"text\">", | |||
post: '</source>' | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
this.wikiEditor('addToToolbar', { | |||
'section': 'advanced', | |||
'group': 'insert', | |||
'tools': { | |||
'math': { | |||
label: '数学公式', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/c/c2/Nuvola_apps_edu_mathematics-p.svg/22px-Nuvola_apps_edu_mathematics-p.svg.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<math>", | |||
periMsg: '插入数学公式', | |||
post: "</math>" | |||
} | |||
} | |||
}, | |||
'template': { | |||
label: '模板', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Curly_Brackets.svg/22px-Curly_Brackets.svg.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "{\{", | |||
periMsg: '模板名称', | |||
post: "}}" | |||
} | |||
} | |||
}, | |||
'hidden': { | |||
label: '注释或隐藏文字', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/1/11/Toolbaricon_hiddencomment.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<!-- ", | |||
post: " -->" | |||
} | |||
} | |||
}, | |||
'hline': { | |||
label: '水平线', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/2/2c/Norwegian_ndash_sign.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "----", | |||
ownline: true | |||
} | |||
} | |||
}, | |||
'hans-hant': { | |||
label: '繁简转换', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/9/9d/Toolbaricon_sr.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "-{", | |||
periMsg: '转换文字', | |||
post: "}-" | |||
} | |||
} | |||
}, | |||
'mediafile': { | |||
label: '媒体文件链接', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/6/65/Toolbaricon_media.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "[[Media:", | |||
periMsg: 'Example.ogg', | |||
post: "]]" | |||
} | |||
} | |||
}, | |||
'references': { | |||
label: '参考文献区', | |||
type: 'button', | |||
icon: '//upload.wikimedia.org/wikipedia/commons/8/8d/Wikieditor-references.png', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "\n==参考文献==\n{\{reflist}}\n", | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
} ); | |||
} | } |
2021年5月6日 (四) 21:51的版本
/* Generic code */
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.toolbar', function () {
$(document).ready( function() {
customizer.call( $( '#wpTextbox1' ) );
} );
} );
}
}
}
/* If the user manually chose this gadget */
if ( mw.user.options.get('gadget-Edittools-vector') ) {
customizeToolbar( function() {
this.wikiEditor('addToToolbar', {
'section': 'main',
'group': 'insert',
'tools': {
'category': {
label: '分类',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/0/00/Structure_du_site_ic%C3%B4ne.svg/23px-Structure_du_site_ic%C3%B4ne.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "[\[Category:",
post: "]]"
}
}
}
}
} );
this.wikiEditor('addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {
'bolditalic': {
label: '粗斜体',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/b/be/Toolbaricon_bolditalic_A.png',
action: {
type: 'encapsulate',
options: {
pre: "'''''",
periMsg: '粗斜体文字',
post: "'''''"
}
}
},
'strikethrough': {
label: '删除线',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/1a/Toolbaricon_strike.png',
action: {
type: 'encapsulate',
options: {
pre: "<s>",
post: "</s>"
}
}
},
'underline': {
label: '下划线',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/9/99/Gnome-format-text-underline.svg/22px-Gnome-format-text-underline.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "<u>",
post: "</u>"
}
}
},
'quote': {
label: '块引用',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/2f/Toolbaricon_quote_1.png',
action: {
type: 'encapsulate',
options: {
pre: "<blockquote>",
post: "</blockquote>"
}
}
},
'justify-left': {
label: '左对齐',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/81/Toolbaricon_justify-left.png',
action: {
type: 'encapsulate',
options: {
pre: "<div style=\"text-align: left;\">",
post: "</div>"
}
}
},
'justify-center': {
label: '居中',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/c/ce/Gnome-format-justify-center.svg/23px-Gnome-format-justify-center.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "<div style=\"text-align: center;\">",
post: "</div>"
}
}
},
'justify-right': {
label: '右对齐',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/f/fb/Gnome-format-justify-right.svg/23px-Gnome-format-justify-right.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "<div style=\"text-align: right;\">",
post: "</div>"
}
}
},
'indent-more': {
label: '定义',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/8/84/Gnome-format-indent-more.svg/23px-Gnome-format-indent-more.svg.png',
action: {
type: 'encapsulate',
options: {
pre: ";"
}
}
},
'source': {
label: '源代码',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Toolbaricon_source.svg/22px-Toolbaricon_source.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "<source lang=\"text\">",
post: '</source>'
}
}
}
}
} );
this.wikiEditor('addToToolbar', {
'section': 'advanced',
'group': 'insert',
'tools': {
'math': {
label: '数学公式',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/c/c2/Nuvola_apps_edu_mathematics-p.svg/22px-Nuvola_apps_edu_mathematics-p.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "<math>",
periMsg: '插入数学公式',
post: "</math>"
}
}
},
'template': {
label: '模板',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Curly_Brackets.svg/22px-Curly_Brackets.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "{\{",
periMsg: '模板名称',
post: "}}"
}
}
},
'hidden': {
label: '注释或隐藏文字',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/11/Toolbaricon_hiddencomment.png',
action: {
type: 'encapsulate',
options: {
pre: "<!-- ",
post: " -->"
}
}
},
'hline': {
label: '水平线',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/2c/Norwegian_ndash_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "----",
ownline: true
}
}
},
'hans-hant': {
label: '繁简转换',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/9/9d/Toolbaricon_sr.png',
action: {
type: 'encapsulate',
options: {
pre: "-{",
periMsg: '转换文字',
post: "}-"
}
}
},
'mediafile': {
label: '媒体文件链接',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/6/65/Toolbaricon_media.png',
action: {
type: 'encapsulate',
options: {
pre: "[[Media:",
periMsg: 'Example.ogg',
post: "]]"
}
}
},
'references': {
label: '参考文献区',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/8d/Wikieditor-references.png',
action: {
type: 'encapsulate',
options: {
pre: "\n==参考文献==\n{\{reflist}}\n",
}
}
}
}
} );
} );
}