Mediawiki/How to add buttons to the page edit shortcut menu

From Bjoern Hassler

Jump to: navigation, search

Modify MediaWiki:Common.js by adding (e.g.)

function addInsertButton(img, speedTip, tagOpen, tagClose, sampleText){
 mwCustomEditButtons[mwCustomEditButtons.length] =
 {'imageFile': img,
  'speedTip': speedTip,
  'tagOpen': tagOpen,
  'tagClose': tagClose,
  'sampleText': sampleText};
}
addInsertButton("/resources/strike.png", "strike through", "","","strike through");
addInsertButton("/resources/underline.png", "underline", "","","underline");
addInsertButton("/resources/box.png", "box", "{"+"{box\n|text=","\n}}","box");
addInsertButton("/resources/comment.png", "comment", "{"+"{comment\n|text=","\n}}","comment");
addInsertButton("/resources/noinclude.png", "noinclude", "","","noinclude");
addInsertButton("/resources/includeonly.png", "includeonly", "","includeonly");


(This solution was pulled from the web somewhere ... there are lots of variants on this!)

Btw. the images for the edit menu live in skins/common/images, e.g.