MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
label: 'Test' | label: 'Test' | ||
// or labelMsg: 'section-emoticons-label' for a localized label | // or labelMsg: 'section-emoticons-label' for a localized label | ||
} | |||
} | |||
} ); | |||
$textarea.wikiEditor( 'addToToolbar', { | |||
section: 'testsection', | |||
pages: { | |||
emoticons: { | |||
layout: 'characters', | |||
label: 'Emoticons', | |||
characters: [ ':)', ':))', ':(', '<3', ';)' ] | |||
} | } | ||
} | } |
Revision as of 00:51, 27 February 2023
/* Any JavaScript here will be loaded for all users on every page load. */
// Test
// Check if we're editing a page.
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.
$textarea.wikiEditor( 'addToToolbar', {
sections: {
testsection: {
type: 'toolbar', // Can also be 'booklet',
label: 'Test'
// or labelMsg: 'section-emoticons-label' for a localized label
}
}
} );
$textarea.wikiEditor( 'addToToolbar', {
section: 'testsection',
pages: {
emoticons: {
layout: 'characters',
label: 'Emoticons',
characters: [ ':)', ':))', ':(', '<3', ';)' ]
}
}
} );
} );
}
/* Include in the wiki the following JavaScript pages */
// MediaWiki:jCarousel.js
mw.loader.load( '/w/index.php?title=MediaWiki:JCarousel.js&action=raw&ctype=text/javascript' );
// MediaWiki:Sandbox.js
mw.loader.load( '/w/index.php?title=MediaWiki:Sandbox.js&action=raw&ctype=text/javascript' );
/*
// MediaWiki:Countdown.js
mw.loader.load( '/w/index.php?title=MediaWiki:Countdown.js&action=raw&ctype=text/javascript' );
*/
// Widget:Rescue Password Generator/script.js
mw.loader.load( '/w/index.php?title=Widget:Rescue_Password_Generator/script.js&action=raw&ctype=text/javascript' );
/* Mass Move Pages Tool
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Plastikspork/massmove.js&action=raw&ctype=text/javascript' ); //[[User:Plastikspork/massmove.js]]
mw.util.addPortletLink("p-tb", "//en.wikipedia.org/wiki/Special:Massmove", "Mass move", "p-massmove", "Mass move");
*/