User:AngeCI/common.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
//<nowiki>
//[[Wikipedia:維基百科工具/強迫更新/purge.js]]
$(function () {
var hist; var url;
if (!(hist = document.getElementById('ca-history') )) return;
if (!(url = hist.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
wgULS('清除缓存','清除快取'), 'ca-purge', wgULS('清理服务器缓存','清理伺服器快取'), 'p');
});
//自订编輯工具栏
mw.loader.using(['ext.gadget.Edittools-vector'], function () {
$(document).ready(function(){
customizeToolbar( function() {
this.wikiEditor('addToToolbar', {
'section': 'main',
'group': 'format',
'tools': {
'bolditalic': {
label: '粗斜体',
type: 'button',
icon: '/media/wikipedia/commons/b/be/Toolbaricon_bolditalic_A.png',
action: {
type: 'encapsulate',
options: {
pre: "'''''",
periMsg: wgULS("粗斜体文字","粗斜體文字"),
post: "'''''"
}
}
},
'strikethrough': {
label: '删除线',
type: 'button',
icon: '/media/wikipedia/commons/1/1a/Toolbaricon_strike.png',
action: {
type: 'encapsulate',
options: {
pre: "<s>",
post: "</s>"
}
}
},
'underline': {
label: '下划线',
type: 'button',
icon: '/media/wikipedia/commons/thumb/9/99/Gnome-format-text-underline.svg/22px-Gnome-format-text-underline.svg.png',
action: {
options: {
pre: "<u>",
post: "</u>"
}
}
}
}
});
this.wikiEditor('addToToolbar', {
'section': 'advanced',
'group': 'insert',
'tools': {
'category': {
label: '分类',
type: 'button',
icon: '/media/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: "]]"
}
}
},
'source': {
label: '源代码',
type: 'button',
icon: '/media/wikipedia/commons/thumb/1/1b/Toolbaricon_source.svg/22px-Toolbaricon_source.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "<source lang=\"text\">",
post: '</source>'
}
}
},
'math': {
label: '数学公式',
type: 'button',
icon: '/media/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: '/media/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: '/media/wikipedia/commons/1/11/Toolbaricon_hiddencomment.png',
action: {
type: 'encapsulate',
options: {
pre: "<!-- ",
post: " -->"
}
}
},
'hline': {
label: '水平线',
type: 'button',
icon: '/media/wikipedia/commons/2/2c/Norwegian_ndash_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "----",
ownline: true
}
}
},
'hans-hant': {
label: '繁简转换',
type: 'button',
icon: '/media/wikipedia/commons/9/9d/Toolbaricon_sr.png',
action: {
type: 'encapsulate',
options: {
pre: "-{",
periMsg: '转换文字',
post: "}-"
}
}
},
}
});
});
});
});
//</nowiki>