User:קיפודנחש/personalEdittools

From Wikipedia, the free encyclopedia

General[edit]

personalEdittools script lets the user define personal "Edit tools".

In this context, an "Edit tool" is a button-like tool, that injects its content into the edit-box when pressed, optionally enveloping the selected text in the edit box.

To use it, one has to add to Special:Mypage/common.js the following line:

importScript('User:קיפודנחש/personalEdittools.js');

and define the edit tools to be used in the personal page Special:Mypage/Edit tools.

The documentation of the syntax of the "Edit tools" page can be found at mw:Extension:Charinsert.

Buttons[edit]

Buttons are enclosed within "charinsert" tags. e.g.,

<charinsert><u>+</u></charinsert>
this will create a button that looks like so: <u></u>

note the "+" sign. this has a special meaning: it does not show on the button itself, but if there is any selected text in the edit box, the underline tag will envelope it. otherwise, after the injection of the tags to the edit page, the edit caret will be at the location of the "+".

a single pair of "charinsert" tags can be used for many buttons: whenever a space encountered, it means a new button is to be created. If you want the button to include spaces, this can be accomplished by enclosing it in a "nowiki" tag.

Namespaces[edit]

You can define some of the tools that to only be visible in specific namespaces. This is done by enclosing the buttons in a html element with specific ID and style. the ID is personal-edittools-NAMESPACE, and the style is "display:none;".

For instance, the following line in your "Edit tools" page will add a button {{Smiley}} and {{Smile3}}, but only in User talk namespace. note that the 2nd one adds ~~~~. to prevent wikipedia from converting this to your signature when saving the "Edittools" page, we add the "+" between the first ~~ and the 2nd.

<span id="personal-edittools-User_talk" style="display:none"><charinsert>{{Smiley}}  {{Smile3|~~+~~}}</charinsert></span>

You can use different html elements (e.g., "div", "p" etc), not just "span" as in the example. The element can contain any number of buttons.

The namespace names are listed below.

  • Main space: "Article" (note that this is not the "real" name of article space: the real name is an empty string, but the script uses "Article" instead)
  • Talk
  • User
  • User_talk
  • Wikipedia: "Project"
  • Wikipedia talk: Project_talk
  • File
  • File_talk
  • Mediawiki
  • Mediawiki_talk
  • Template
  • Template_talk
  • Help
  • Help_talk
  • Category
  • Category_talk

Descriptive text[edit]

Anything on the "Edit tools" page which is not enclosed within "charinsert" tags, will appear in the "Personal edit tools" box as is, without becoming a button.

Appearance[edit]

By default, the "Buttons" look like links. However, you can make them appear mode like "real" buttons by including the following segment in your Special:Mypage/common.css page:

css to make buttons more buttonlike
 
/**
 * Styling for links generated by [[MediaWiki:Edittools]]
 * @source www.mediawiki.org/wiki/Extension:CharInsert#Styling
 * @updated 2012-02-29
 */
.mw-charinsert-buttons {
        margin-top: 10px;
        border: 1px solid #aaaaaa;
        padding: 1px;
        text-align: center;
        font-size: 110%;
}
.mw-charinsert-buttons a {
        color: black;
        background-color: #cde !important;
        font-weight: bold;
        font-size: .9em;
        text-decoration: none;
        border: thin #069 outset;
        border-radius: 4px;
        -moz-box-shadow:    3px 3px 3px #999;
        -webkit-box-shadow: 3px 3px 3px #999;
        box-shadow:         3px 3px 3px #999;
        margin: 0.2em;
        padding: 0 .1em .1em;
}
.mw-charinsert-buttons a:hover,
.mw-charinsert-buttons a:active {
        background-color: #bcd;
        border-style: inset;
}
.client-js .mw-edittools-section {
        display: inline;
}
.client-js .mw-edittools-section input[type="button"] {
        font-size: 0.9em;
        padding-left: 1px;
        padding-right: 1px;
        margin-left: 1px;
}