« MediaWiki:Common.js » : différence entre les versions

De Sur les traces des sondes Voyager
Aller à : navigation, rechercher
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 4 : Ligne 4 :
// Configure a new toolbar entry on the given $textarea jQuery object.
// Configure a new toolbar entry on the given $textarea jQuery object.


$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
$textarea.wikiEditor( 'addToToolbar', {
section: 'secondary',
section: 'emoticons',
group : 'format',
group: 'faces',
tools: {
tools: {
strikethrough: {
smile: {
label: 'Barrer',
label: 'Smile!', // or use mw.message( key ).escaped() for a localized label, see above
type: 'button',
type: 'button',
icon: wgScriptPath+ '/skins/DarkVector/images/cjnext_toolbar/stroke_icon.png',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "<s>",
pre: ":)" // text to be inserted
post: "</s>"
}
}
}
}
}
}
}
}
});
} );




} );
} );
}
}

Version du 29 août 2023 à 09:52

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', {
	section: 'emoticons',
	group: 'faces',
	tools: {
		smile: {
			label: 'Smile!', // or use mw.message( key ).escaped() for a localized label, see above
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: ":)" // text to be inserted
				}
			}
		}
	}
} );


} );
}