User talk:Conrad.Irwin/edittools.js

Latest comment: 8 years ago by Erutuon in topic Problems

This allows users (for the moment) to add their own sections to the edittools box. It may, in the future, replace the current Edittools methodology and thus greatly reduce the 28KB that is added to each edit page. It works by using XmlHTTPRequest to fetch User:Username/edittools and then, providing the page is correctly formatted, adds the sections to the top of the Edittools dropdown list. To use it you need to add the following to your User:Username/common.js (Special:MyPage/common.js) file.

document.write('<script type="text/javascript" src="/w/index.php?title=User:Conrad.Irwin/edittools.js&action=raw"></script>');

You can then add entries to your User:Username/edittools (Special:MyPage/edittools) file.

An example, if fairly pointless User:edittools, can be found at User:Conrad.Irwin/edittools. The syntax is reasonably straightforward.

 
<p id="Section_Name"><charinsert>l i s t of c h a r a c t e r s</charinsert></p>

If you want to be more adventurous, you can wrap groups of <charinsert>s within <span>s so that the line spacing is right, or add [[links]] or other text between the sections for clarity. You should note that you cannot include block level elements (p, div, ol, ul, etc.) in this, or it will break in internet explorer.

To include templates, you need to make sure that you have no spaces in the template name, and that you wrap at least one of the opening brackets in <nowiki>. For example <nowiki>{{</nowiki>en-verb}}.

Future use edit

It may be possible in the future to have sections for all users that are not initially loaded. This would mean that they have to be requested each time they are used (though I believe they are cached). In order to create such sections, you would need to be a sysop, and the sections should be at Mediawiki:edittools/Section Name. In order to help with server load, and to speed up the sections, you can manually add the sections that you use frequently to your User:Username/edittools. To do this, you need to add

<p id="Section Name">{{Mediawiki:Edittools/Section Name}}</p>

To your edittools, though obviously a template can be created so that it becomes {{Edittools|Section Name}}.

MediaWiki:Edittools/Section Name edit

These should not contain the <p> tags, as those are included in the MediaWiki:Edittools proper, and the user pages. Instead they should contain the contents (i.e. the <charinsert>s and any spans or links that are required. Again, and even more importantly here, they must not contain block level elements (p, div, ol, ul, etc.) or it will break internet explorer.

MediaWiki:Edittools edit

This will contain some of the more common sections, and merely references to the others. Everything should, as now, be wrapped in a <div> For example,

<div id="editpage-specialchars">
<p id="Alphabet"><span title="Lowercase Latin"><charinsert>a b c d e f g h i j k l m n o p q r s t u v w x y z</charinsert></span></p>
<p id="Ancient_Egyptian" class="delayload" />
<p id="Templates">'''English:''' <nowiki>{[</nowiki>en-verb}} '''French:''' <nowiki>{{</nowiki>fr-verb}}
</div>

Discussion edit

This looks very promising, but I have a question: is there a way to make something not visible on the edit, but still show up when the link is clicked, eg. have it show like {{plural of|}}, but actually add {{plural of|foo|lang=French}}? If not I'll just add a |lang=French, but having it included would be a great time- and placesaver. Circeus

No, at the moment this is just a wrapper for the Mediawiki edittools, so it only supports what they support. I should really devise a better syntax to allow that kind of thing - it comes in very useful for diacritics and other modifiers that it doesn't make sense to display alone. Conrad.Irwin 01:52, 27 July 2008 (UTC)Reply

Above you mention that <div> will break IE. The next line you say to use <div> Does this mean the first one is old news and IE has fixed itself, or am I reading it wrong? Amina (sack36) 01:46, 27 July 2008 (UTC)Reply

The surrounding <div> must be a div, but it mustn't contain any other divs - hope that's clearer. Conrad.Irwin

Problems edit

Is this stuff working anylonger? --Harald Khan Ճ 18:37, 4 October 2010 (UTC)Reply

Turns out I simply had to switch from Special:MyPage/monobook.js to Special:MyPage/vector.js. I suppose the introduction at the top should be changed? Njardarlogar 16:37, 3 March 2011 (UTC)Reply
Made it so. Mglovesfun (talk) 16:41, 3 March 2011 (UTC)Reply
I changed it to Special:MyPage/common.js so that it can work no matter what skin is being used. --Yair rand (talk) 16:43, 3 March 2011 (UTC)Reply

Not working again. Anyone else? Njardarlogar 13:43, 15 May 2011 (UTC)Reply

I too am experiencing problem OrenBochman 17:19, 17 June 2011 (UTC)Reply

It's not working for me either. — Eru·tuon 02:44, 7 April 2016 (UTC)Reply

I got it to work by putting importScript('User:Conrad.Irwin/edittools.js'); in my common.js. — Eru·tuon 04:37, 7 April 2016 (UTC)Reply

"edittools-" edit

The string "edittools-" has been added the beginning of each option of the drop-down box: <option value="edittools-Templates">edittools-Templates</option><option value="edittools-Headers">edittools-Headers</option>, etc. Is this by design? Can it be changed to lack that prefix? It just makes the drop-down box take up more room on the line.​—msh210 (talk) 15:25, 11 October 2011 (UTC)Reply

Return to the user page of "Conrad.Irwin/edittools.js".