Manual talk:Custom edit buttons

Placing username and timestamps (by ~)
Hi, I want to place templates with this button. One of them needs username (3x ~) and timestamp (5x ~) as attributes, but I cannot add them to Common.js because they alway get replaced when I save. Is there any way to do this? if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/7/74/Button_comment.png", "speedTip": "Insert comment", "tagOpen": "{\{NKS|name|timestamp}}\n",  < here is the problem, ~ should be there instead "tagClose": "\n{\{NKE}}", "sampleText": "comment"} } --87.176.88.157 14:34, 27 November 2009 (UTC)

Is this supposed to be an extension? -- Anon  Diss  05:18, 7 March 2008 (UTC)
 * I agree, it looks like it should be made into an extension, currently you have to modify the codebase which is not good practise. --Zven 19:01, 20 March 2008 (UTC)

It looks like the slashes used for escaping newlines and apostrophes are out of whack. It was easy enough to fix the extra slashes for he apostrophes, but I'm not sure how to properly escape the newlines needed for the gallery and table. Can someone figure it out? --66.142.154.217 09:50, 20 March 2008 (UTC)
 * Figured it out, to escape a newline you need to use " instead of an apostrophe. I updated the article to reflect this and removed the buttons that are in mediawiki by default, to remove confusion and potential future problems --66.142.154.217 10:10, 20 March 2008 (UTC)
 * Using "\n" makes a like break in "open" but it doesn't work in "close". Please help.

Example: 'open'	=>	" \n", 'close'	=>	'\n ',

will result in: Text\n

insteaf of

Text --Yakushi.kabuto 10:35, 7 April 2008 (UTC)
 * \n doesn't work with single quotes, only with double quotes, so use "\n ". --Catrope 12:15, 8 April 2008 (UTC)


 * If you break the line into multiple strings that are concatenated you can avoid a lot of the conversion problems. (Also, you can escape double quotes with \")
 * IE "\n{" + "{PAGENAME}" + "}\n{" + "{TemplateX|Var1=\"alpha\"}" + "}\n",
 * Extra splits of the string cause no harm. Split it wherever you think there might be a problem. All my other JS function on the same page die when there is a problem. -_- ~JSarvis

will not work
I can not get Custom edit buttons to work I am using 1.6

I have MediaWiki:Common.js or do I place it in monobook.js?

--60.231.4.249 14:27, 22 May 2008 (UTC)

Is this page outdated ?
The FAQ states a different code and the one provided here didn't work for me on MediaWiki 1.15.1 (neither in Common.js, nor in the user/skin.js). The code from the FAQ works, but only in Common.js. Is there another way, to have custom buttons, or should it be working anyway? -- Sidcom 23:10, 22 February 2010 (UTC)