Manual talk:Custom edit buttons
From MediaWiki.org
Is this supposed to be an extension? --AnonDiss 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' => "<s>\n", 'close' => '\n</s>',
will result in:
<s> Text\n</s>
insteaf of
<s> Text </s>
--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
[edit] 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?
<source lang="javascript">
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://imsaw.com/mediawiki/images/7/74/Button_comment.png",
"speedTip": "Comment visible only for editors",
"tagOpen": "<!-- ",
"tagClose": " -->",
"sampleText": "Insert comment here"}
}
</source>
--60.231.4.249 14:27, 22 May 2008 (UTC)

