“MediaWiki:Common.js”的版本间差异
本页内容
无编辑摘要 |
无编辑摘要 |
||
第195行: | 第195行: | ||
if(window.location.search.length){ | if(window.location.search.length){ | ||
$('.bd-links').animate({ | $('.bd-links').animate({ | ||
scrollTop: $('.mb-1 a[href="'+'/index.php'+window.location.search+'"').offset().top- | scrollTop: $('.mb-1 a[href="'+'/index.php'+window.location.search+'"').offset().top-$('#bd-docs-nav')[0].clientHeight/2 | ||
}, 1000); | }, 1000); | ||
} | } |
2022年8月26日 (五) 17:47的最新版本
/* 这里的任何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);
}
});