MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m 1 revision imported: Local to remote transfer. |
(No difference)
| |
Latest revision as of 22:31, 6 October 2025
/* Any JavaScript here will be loaded for all users on every page load. */
// Check if we're editing a page. https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization#Basic_setup https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization/Library
if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) {
// Add a hook handler.
mw.hook('wikiEditor.toolbarReady').add(function($textarea) {
// Configure a new toolbar entry on the given $textarea jQuery object.
// Strike through text
$textarea.wikiEditor('addToToolbar', {
section: 'main',
group: 'format',
tools: {
"strikethrough": {
label: 'Strike',
type: 'button',
oouiIcon: 'strikethrough',
action: {
type: 'encapsulate',
options: {
pre: "<s>",
post: "</s>"
}
}
}
}
});
// no include
$textarea.wikiEditor('addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"noinclude": {
label: 'NoInclude',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/OOjs_UI_icon_eyeClosed.svg/20px-OOjs_UI_icon_eyeClosed.svg.png',
//filters: ['body.ns-10'],
action: {
type: 'encapsulate',
options: {
pre: "<noinclude>",
post: "</noinclude>"
}
}
},
"includeonly": {
label: 'IncludeOnly',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/OOjs_UI_icon_eye.svg/20px-OOjs_UI_icon_eye.svg.png',
//filters: ['body.ns-10'],
action: {
type: 'encapsulate',
options: {
pre: "<includeonly>",
post: "</includeonly>"
}
}
},
"insertcategory": {
label: 'Category',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/OOjs_UI_icon_wikiText.svg/20px-OOjs_UI_icon_wikiText.svg.png',
//filters: ['body.ns-10'],
action: {
type: 'encapsulate',
options: {
pre: "[[Category:",
post: "]]"
}
}
}
}
});
});
}