You might also consider making the boilerplate a
Template page
instead of hardcoding it into the js. That way you can edit it in
the wiki.
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "url of the button image",
"speedTip": "Custom text",
"tagOpen": "",
"tagClose": "",
"sampleText": "{{TemplatePageName}}\n" +
};
Jim H.
On Nov 15, 2007, at 12:52 PM, Jim Wilson wrote:
> The chunk of wiki text is actually over
> several lines - is this solution only for inserting single lines?
If you want to insert multiple lines, your addition may look more
like this:
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "url of the button image",
"speedTip": "Custom text",
"tagOpen": "",
"tagClose": "",
"sampleText":
"First line of template text\n" +
"Second line of template text\n" +
"Third and final line of template text."
};
On Nov 15, 2007 12:08 PM, Derrick Farnell
<derrick.farnell(a)gmail.com> wrote:
> Thanks very much for your help. The chunk of wiki text is actually
> over
> several lines - is this solution only for inserting single lines?
>
> Derrick
>
>
> On Nov 15, 2007 4:18 PM, Jim Hu <jimhu(a)tamu.edu> wrote:
>
>> It may be hard without any programming knowledge...
>>
>> The extra buttons at wikipedia are controlled by javascript in the
>> page Mediawiki:Common.js. I've made this a bit easier to read on
>> our
>> wiki:
>>
>>
http://ecoliwiki.net/colipedia/index.php/
>> MediaWiki:Common.js#Extra_toolbar_options
>>
>> What you need to do is define another button handler for your
>> desired
>> text.
>>
>> mwCustomEditButtons[mwCustomEditButtons.length] = {
>> "imageFile": "url of the button image",
>> "speedTip": "Custom text",
>> "tagOpen": "",
>> "tagClose": "",
>> "sampleText": "insert custom text here"};
>>
>> I think that will work. Haven't tried it, though.
>>
>> Jim
>>
>>
>> On Nov 15, 2007, at 7:46 AM, Derrick Farnell wrote:
>>
>>> Hi
>>>
>>> I'd like users of my wiki (
www.chainsofreason.org) to be able to
>>> add a
>>> particular chunk of wikitext to a page by simply clicking on a
>>> button in the
>>> edit page toolbar, but have been unable to find a suitable
>>> extension. Is
>>> there some relatively easy way to achieve this? I don't have any
>>> programming
>>> knowledge.
>>>
>>> Derrick
>>> Chains of Reason
>>>
www.chainsofreason.org
>>> _______________________________________________
>>> MediaWiki-l mailing list
>>> MediaWiki-l(a)lists.wikimedia.org
>>>
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>
>> =====================================
>> Jim Hu
>> Associate Professor
>> Dept. of Biochemistry and Biophysics
>> 2128 TAMU
>> Texas A&M Univ.
>> College Station, TX 77843-2128
>> 979-862-4054
>>
>>
>> _______________________________________________
>> MediaWiki-l mailing list
>> MediaWiki-l(a)lists.wikimedia.org
>>
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l(a)lists.wikimedia.org
>
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
=====================================
Jim Hu
Associate Professor
Dept. of Biochemistry and Biophysics
2128 TAMU
Texas A&M Univ.
College Station, TX 77843-2128
979-862-4054
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org