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
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@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
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@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@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
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@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@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@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Thanks very much - I'll give it a go.
On Nov 15, 2007 6:52 PM, Jim Wilson wilson.jim.r@gmail.com 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@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@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@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
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@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@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@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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
Actually, it isn't the whole boilerplate that I'm wanting to make insertable via a toolbar button, just extra, optional, sections to the boilerplate. However, it would make things easier for the user if I made the boilerplate a template and then used the code below to allow users to insert it into a blank page via a button, instead of cutting and pasting the boilerplate over - and then create another button for the extra sections.
I assume the method below would indeed insert the contents of the template, and not just '{{Template:Boilerplate}}'.
Derrick
On Nov 15, 2007 7:49 PM, Jim Hu jimhu@tamu.edu wrote:
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@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@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@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
It would insert {{Template:Boilerplate}}. But you should be able to use {{subst:Template:Boilerplate}}, which should replace the whole thing when saved. But it will still only insert {{subst:Template:Boilerplate}} in that edit session.
You may find it easier to have users create pages from a Boilerplate template and then edit them, instead of starting with a blank page and pasting in the Boilerplate. There are a number of extensions that can do this, e.g. Extension:Boilerplate if I recall correctly.
Jim
On Nov 15, 2007, at 2:14 PM, Derrick Farnell wrote:
Actually, it isn't the whole boilerplate that I'm wanting to make insertable via a toolbar button, just extra, optional, sections to the boilerplate. However, it would make things easier for the user if I made the boilerplate a template and then used the code below to allow users to insert it into a blank page via a button, instead of cutting and pasting the boilerplate over
- and then create another button for the extra sections.
I assume the method below would indeed insert the contents of the template, and not just '{{Template:Boilerplate}}'.
Derrick
On Nov 15, 2007 7:49 PM, Jim Hu jimhu@tamu.edu wrote:
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@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@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@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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
That's sounds very promising - I'll have a look at those extensions.
Thanks very much!
Derrick
On Nov 15, 2007 9:18 PM, Jim Hu jimhu@tamu.edu wrote:
It would insert {{Template:Boilerplate}}. But you should be able to use {{subst:Template:Boilerplate}}, which should replace the whole thing when saved. But it will still only insert {{subst:Template:Boilerplate}} in that edit session.
You may find it easier to have users create pages from a Boilerplate template and then edit them, instead of starting with a blank page and pasting in the Boilerplate. There are a number of extensions that can do this, e.g. Extension:Boilerplate if I recall correctly.
Jim
On Nov 15, 2007, at 2:14 PM, Derrick Farnell wrote:
Actually, it isn't the whole boilerplate that I'm wanting to make insertable via a toolbar button, just extra, optional, sections to the boilerplate. However, it would make things easier for the user if I made the boilerplate a template and then used the code below to allow users to insert it into a blank page via a button, instead of cutting and pasting the boilerplate over
- and then create another button for the extra sections.
I assume the method below would indeed insert the contents of the template, and not just '{{Template:Boilerplate}}'.
Derrick
On Nov 15, 2007 7:49 PM, Jim Hu jimhu@tamu.edu wrote:
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@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@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@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Re adding the edit toolbar button, I've now added the code to the bottom of this page:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but the extra button doesn't appear in the toolbar. Any ideas about what I've done wrong?!
Derrick
On Nov 15, 2007 9:59 PM, Derrick Farnell derrick.farnell@gmail.com wrote:
That's sounds very promising - I'll have a look at those extensions.
Thanks very much!
Derrick
On Nov 15, 2007 9:18 PM, Jim Hu <jimhu@tamu.edu > wrote:
It would insert {{Template:Boilerplate}}. But you should be able to use {{subst:Template:Boilerplate}}, which should replace the whole thing when saved. But it will still only insert {{subst:Template:Boilerplate}} in that edit session.
You may find it easier to have users create pages from a Boilerplate template and then edit them, instead of starting with a blank page and pasting in the Boilerplate. There are a number of extensions that can do this, e.g. Extension:Boilerplate if I recall correctly.
Jim
On Nov 15, 2007, at 2:14 PM, Derrick Farnell wrote:
Actually, it isn't the whole boilerplate that I'm wanting to make insertable via a toolbar button, just extra, optional, sections to the boilerplate. However, it would make things easier for the user if I made the boilerplate a template and then used the code below to allow users to insert it into a blank page via a button, instead of cutting and pasting the boilerplate over
- and then create another button for the extra sections.
I assume the method below would indeed insert the contents of the template, and not just '{{Template:Boilerplate}}'.
Derrick
On Nov 15, 2007 7:49 PM, Jim Hu jimhu@tamu.edu wrote:
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@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@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@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@lists.wikimedia.org > http://lists.wikimedia.org/mailman/listinfo/mediawiki-l > _______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
I think the ==Subheadings== need to be inside the part that is commented out.
JH
On Nov 18, 2007, at 2:12 AM, Derrick Farnell wrote:
Re adding the edit toolbar button, I've now added the code to the bottom of this page:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but the extra button doesn't appear in the toolbar. Any ideas about what I've done wrong?!
Derrick
<snip>
I've now added that extra code as it appears in your Common.js file:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but it still didn't work.
Is there perhaps another file that I should also be changing? Like a file more directly associated with the editor than common.js?
Derrick
On Nov 18, 2007 11:49 PM, Jim Hu jimhu@tamu.edu wrote:
I think the ==Subheadings== need to be inside the part that is commented out.
JH
On Nov 18, 2007, at 2:12 AM, Derrick Farnell wrote:
Re adding the edit toolbar button, I've now added the code to the bottom of this page:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but the extra button doesn't appear in the toolbar. Any ideas about what I've done wrong?!
Derrick
<snip>
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
I copied this part from yours into a test wiki and it works for me (note that this is the only thing in Common.js in the test, other parts of what you have may be causing the problem):
/** ****************************************************** == Extra toolbar options == *<nowiki> * Description: UNDOCUMENTED * Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]] */
//This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All. // This is based on the original code on Wikipedia:Tools/Editing tools // To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://www.chainsofreason.org/w/images/ extra_buttons/link_button.png", "speedTip": "Redirect", "tagOpen": "", "tagClose": "", "sampleText": "First line of template text\n" + "Second line of template text\n" + "Third and final line of template text." }; }
/*</nowiki>*/
On Nov 19, 2007, at 2:04 AM, Derrick Farnell wrote:
I've now added that extra code as it appears in your Common.js file:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but it still didn't work.
Is there perhaps another file that I should also be changing? Like a file more directly associated with the editor than common.js?
Derrick
On Nov 18, 2007 11:49 PM, Jim Hu jimhu@tamu.edu wrote:
I think the ==Subheadings== need to be inside the part that is commented out.
JH
On Nov 18, 2007, at 2:12 AM, Derrick Farnell wrote:
Re adding the edit toolbar button, I've now added the code to the bottom of this page:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but the extra button doesn't appear in the toolbar. Any ideas about what I've done wrong?!
Derrick
<snip>
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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
I've got it now: it works when I put the ==subheadings== between /* and */, which is probably what you were meaning before, but I didn't realise these symbols were code for commenting-out.
Thanks a lot for your help!
Best, Derrick
On Nov 19, 2007 5:08 PM, Jim Hu jimhu@tamu.edu wrote:
I copied this part from yours into a test wiki and it works for me (note that this is the only thing in Common.js in the test, other parts of what you have may be causing the problem):
/** ****************************************************** == Extra toolbar options == *<nowiki>
- Description: UNDOCUMENTED
- Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R.
Koot]] */
//This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All. // This is based on the original code on Wikipedia:Tools/Editing tools // To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://www.chainsofreason.org/w/images/ extra_buttons/link_button.png", "speedTip": "Redirect", "tagOpen": "", "tagClose": "", "sampleText": "First line of template text\n" + "Second line of template text\n" + "Third and final line of template text." }; }
/*</nowiki>*/
On Nov 19, 2007, at 2:04 AM, Derrick Farnell wrote:
I've now added that extra code as it appears in your Common.js file:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but it still didn't work.
Is there perhaps another file that I should also be changing? Like a file more directly associated with the editor than common.js?
Derrick
On Nov 18, 2007 11:49 PM, Jim Hu jimhu@tamu.edu wrote:
I think the ==Subheadings== need to be inside the part that is commented out.
JH
On Nov 18, 2007, at 2:12 AM, Derrick Farnell wrote:
Re adding the edit toolbar button, I've now added the code to the bottom of this page:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but the extra button doesn't appear in the toolbar. Any ideas about what I've done wrong?!
Derrick
<snip>
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
I've now discovered that when the 'sampleText' to be inserted via the custom button is changed from the example text given below to the following lines:
:*see also: {{hide| ::*link 1 ::*link 2}}
then the button no longer shows. I assume this has something to do with the symbols used. Is there any way around this? I've changed the text back to normal text: http://www.chainsofreason.org/wiki/MediaWiki:Common.js (see right at the bottom) - and it works again.
Derrick
On Nov 19, 2007 7:45 PM, Derrick Farnell derrick.farnell@gmail.com wrote:
I've got it now: it works when I put the ==subheadings== between /* and */, which is probably what you were meaning before, but I didn't realise these symbols were code for commenting-out.
Thanks a lot for your help!
Best, Derrick
On Nov 19, 2007 5:08 PM, Jim Hu jimhu@tamu.edu wrote:
I copied this part from yours into a test wiki and it works for me (note that this is the only thing in Common.js in the test, other parts of what you have may be causing the problem):
/** ****************************************************** == Extra toolbar options == *<nowiki>
- Description: UNDOCUMENTED
- Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R.
Koot]] */
//This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All. // This is based on the original code on Wikipedia:Tools/Editing tools // To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://www.chainsofreason.org/w/images/ extra_buttons/link_button.png", "speedTip": "Redirect", "tagOpen": "", "tagClose": "", "sampleText": "First line of template text\n" + "Second line of template text\n" + "Third and final line of template text." }; }
/*</nowiki>*/
On Nov 19, 2007, at 2:04 AM, Derrick Farnell wrote:
I've now added that extra code as it appears in your Common.js file:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but it still didn't work.
Is there perhaps another file that I should also be changing? Like a file more directly associated with the editor than common.js?
Derrick
On Nov 18, 2007 11:49 PM, Jim Hu jimhu@tamu.edu wrote:
I think the ==Subheadings== need to be inside the part that is commented out.
JH
On Nov 18, 2007, at 2:12 AM, Derrick Farnell wrote:
Re adding the edit toolbar button, I've now added the code to the bottom of this page:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
but the extra button doesn't appear in the toolbar. Any ideas about what I've done wrong?!
Derrick
<snip>
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@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@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Derrick Farnell wrote :
I've now discovered that when the 'sampleText' to be inserted via the custom button is changed from the example text given below to the following lines:
:*see also: {{hide| ::*link 1 ::*link 2}}
then the button no longer shows. I assume this has something to do with the symbols used. Is there any way around this? I've changed the text back to normal text: http://www.chainsofreason.org/wiki/MediaWiki:Common.js (see right at the bottom) - and it works again.
Did you forget to use "" ?
"sampleText": ":*see also: {{hide|\n" + "::*link 1\n" + "::*link 2}}"
works for me, it inserts
:*see also: {{hide| ::*link 1 ::*link 2
in my text
(BTW http://www.chainsofreason.org/w/images/extra_buttons/link_button.png returns a "404 not found" error, so your image seems not to be there anymore)
Thanks for your help Alexis. I did use the double quotes. I've now replaced the lines of normal text with the lines of wikitext:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
(at the bottom of the page)
and the toolbar button disappears again. Also, the show/hide functionality - created by the first section of the code on the above page - no longer works too. *However*, when I delete Template:Hide, which is used to implement the show/hide functionality, the button appears, and when pressed inserts the wikitext. So the problem is obviously due to the fact that the wikitext that I want users to be able to insert using the button contains the wikitext for the hide template. Removing the template removes the problem (of course, in your case, the template never existed in the first place). But now I don't have the show/hide functionality!
Any ideas how I can have both?! I don't know any javascript, and very little wikitext.
Derrick
(BTW, re the missing button image, it's now located at
http://www.chainsofreason.org/w/images/extra_buttons/see_also.png)
On Nov 22, 2007 9:35 AM, Alexis Moinet alexis.moinet@fpms.ac.be wrote:
Derrick Farnell wrote :
I've now discovered that when the 'sampleText' to be inserted via the
custom
button is changed from the example text given below to the following
lines:
:*see also: {{hide| ::*link 1 ::*link 2}}
then the button no longer shows. I assume this has something to do with
the
symbols used. Is there any way around this? I've changed the text back
to
normal text: http://www.chainsofreason.org/wiki/MediaWiki:Common.js (see right at the bottom) - and it works again.
Did you forget to use "" ?
"sampleText": ":*see also: {{hide|\n" + "::*link 1\n" + "::*link 2}}"
works for me, it inserts
:*see also: {{hide| ::*link 1 ::*link 2
in my text
(BTW http://www.chainsofreason.org/w/images/extra_buttons/link_button.pngreturns a "404 not found" error, so your image seems not to be there anymore)
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Derrick Farnell wrote :
Thanks for your help Alexis. I did use the double quotes. I've now replaced the lines of normal text with the lines of wikitext:
http://www.chainsofreason.org/wiki/MediaWiki:Common.js
(at the bottom of the page)
and the toolbar button disappears again. Also, the show/hide functionality - created by the first section of the code on the above page - no longer works too. *However*, when I delete Template:Hide, which is used to implement the show/hide functionality, the button appears, and when pressed inserts the wikitext. So the problem is obviously due to the fact that the wikitext that I want users to be able to insert using the button contains the wikitext for the hide template. Removing the template removes the problem (of course, in your case, the template never existed in the first place). But now I don't have the show/hide functionality!
Any ideas how I can have both?! I don't know any javascript, and very little wikitext.
indeed if I create the hide template, I still have the button (NB : I don't have any <nowiki> tag in my code) but the template content is directly inserted instead of " {{hide|\n "
however, if I use the opening and closing tags, it does the trick. In my MediaWiki:Common.js, I only have this :
if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "test.png", "speedTip": "see also", "tagOpen": ":*see also: {{", "tagClose": "}}", "sampleText": "hide|\n" + "::*link 1\n" + "::*link 2" }; }
and it worked (don't forget to force-refresh your browser)
On Nov 22, 2007 1:27 PM, Alexis Moinet alexis.moinet@fpms.ac.be wrote:
indeed if I create the hide template, I still have the button (NB : I don't have any <nowiki> tag in my code) but the template content is directly inserted instead of " {{hide|\n "
however, if I use the opening and closing tags, it does the trick. In my MediaWiki:Common.js, I only have this :
if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "test.png", "speedTip": "see also", "tagOpen": ":*see also: {{", "tagClose": "}}", "sampleText": "hide|\n" + "::*link 1\n" + "::*link 2" }; }
and it worked (don't forget to force-refresh your browser)
It worked! I never would have thought of using the open and close tags in that way - very clever! Thanks so much for your help! Best, Derrick
mediawiki-l@lists.wikimedia.org