MediaWiki:Common.js
本页内容
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- 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。
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Comment',
type: 'button',
icon: 'https://www.gongjumi.com/icon.php?w=CT',
action: {
type: 'encapsulate',
options: {
pre: "<!-- ",
post: " -->"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Comment',
type: 'button',
icon: 'https://www.gongjumi.com/icon.php?w=HL',
action: {
type: 'encapsulate',
options: {
pre: "<syntaxhighlight lang=\"python\" line>\n",
post: "\n</syntaxhighlight>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"backquote": {
label: 'backquote',
type: 'button',
icon: 'https://www.gongjumi.com/icon.php?w=BK',
action: {
type: 'encapsulate',
options: {
pre: "<blockquote>\n",
post: "\n</blockquote>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"html": {
label: 'html',
type: 'button',
icon: 'https://www.gongjumi.com/icon.php?w=HT',
action: {
type: 'encapsulate',
options: {
pre: "<html>\n",
post: "\n</html>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"run": {
label: 'run',
type: 'button',
icon: 'https://www.gongjumi.com/icon.php?w=R',
action: {
type: 'encapsulate',
options: {
pre: "<run name='s'>\n",
post: "\n</run>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"sample": {
label: 'sample',
type: 'button',
icon: 'https://www.gongjumi.com/icon.php?w=S',
action: {
type: 'encapsulate',
options: {
pre: '<sample title="" desc="" hererun="s">'+"\n",
post: "\n</sample>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"sample": {
label: 'kbd',
type: 'button',
icon: 'https://www.gongjumi.com/icon.php?w=KB',
action: {
type: 'encapsulate',
options: {
pre: '<kbd>',
post: "</kbd>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'snippets': {
'type': 'booklet',
'label': 'Useful Snippets',
'pages': {
'section-xml': {
'label': 'XML Tags',
'layout': 'characters',
'characters': [
'<references/>',
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '<ref>',
'peri': '',
'post': '</ref>'
}
},
'label': '<ref></ref>'
}
]
},
'section-links': {
'label': 'Wikilinks',
'layout': 'characters',
'characters': [
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '[[Category:',
'peri': '',
'post': ']]'
}
},
'label': '[[Category:]]'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '[[File:',
'peri': '',
'post': ']]'
}
},
'label': '[[File:]]'
}
]
}
}
}
}
} );
} );
$(function(){
if(window.location.search.length){
$('.bd-links').animate({
scrollTop: $('.mb-1 a[href="'+'/index.php'+window.location.search+'"').offset().top-$('#bd-docs-nav')[0].clientHeight/2
}, 1000);
}
});