+ queue = [];
+ $toolbar = false;
+ slice = Array.prototype.slice;
+
+ /**
+ * Internal helper that does the actual insertion
+ * of the button into the toolbar.
+ * See mw.toolbar.addButton for parameter documentation.
+ */
+ function insertButton( b /* imageFile */, speedTip, tagOpen, tagClose, sampleText, imageId, selectText ) {
+ // Backwards compatibility
+ if ( typeof b !== 'object' ) {
+ b = {
+ imageFile: b,
+ speedTip: speedTip,
+ tagOpen: tagOpen,
+ tagClose: tagClose,
+ sampleText: sampleText,
+ imageId: imageId,
+ selectText: selectText
+ };
+ }
+ var $image = $( '<img>', {
+ width : 23,
+ height: 22,
+ src : b.imageFile,
+ alt : b.speedTip,
+ title : b.speedTip,
+ id : b.imageId || undefined,
+ 'class': 'mw-toolbar-editbutton'
+ } ).click( function () {
+ toolbar.insertTags( b.tagOpen, b.tagClose, b.sampleText, b.selectText );
+ return false;
+ } );
+
+ $toolbar.append( $image );
+ return true;
+ }