Difference between revisions of "MediaWiki:Common.js"
m (Drop button) |
m (experimental new terminal boilerplate) |
||
| Line 11: | Line 11: | ||
document.getElementById( 'wpMinoredit' ).checked = true; | document.getElementById( 'wpMinoredit' ).checked = true; | ||
} | } | ||
| + | }); | ||
| + | |||
| + | /* | ||
| + | * Add a button to insert new terminal page boilerplate. | ||
| + | */ | ||
| + | mw.loader.using(['jquery.wikiEditor'], function() { | ||
| + | $(function() { | ||
| + | $('#wpTextbox1').on('wikiEditor-toolbar-doneInitialSections', function() { | ||
| + | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
| + | section: 'main', | ||
| + | group: 'insert', | ||
| + | tools: { | ||
| + | 'boilerplate': { | ||
| + | label: 'New Terminal', | ||
| + | type: 'button', | ||
| + | icon: 'reference', | ||
| + | action: { | ||
| + | type: 'encapsulate', | ||
| + | options: { | ||
| + | pre: '{{your boilerplate text here}}' | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | }); | ||
| + | }); | ||
| + | }); | ||
}); | }); | ||
Revision as of 01:19, 22 March 2026
/* Any JavaScript here will be loaded for all users on every page load. */
/**
* Automatically tick the minor edit check box
*
* @source: http://www.mediawiki.org/wiki/Snippets/Mark_minor_edit
* @rev: 2
*/
jQuery( document ).ready( function( $ ) {
if( mw.config.get( 'wgAction' ) === 'edit' ) {
document.getElementById( 'wpMinoredit' ).checked = true;
}
});
/*
* Add a button to insert new terminal page boilerplate.
*/
mw.loader.using(['jquery.wikiEditor'], function() {
$(function() {
$('#wpTextbox1').on('wikiEditor-toolbar-doneInitialSections', function() {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'insert',
tools: {
'boilerplate': {
label: 'New Terminal',
type: 'button',
icon: 'reference',
action: {
type: 'encapsulate',
options: {
pre: '{{your boilerplate text here}}'
}
}
}
}
});
});
});
});