Wikisource:Tools and scripts/More editing buttons

From Wikisource
Jump to: navigation, search

Contents

[edit] Instructions

  • How to install:
  1. Go to your monobook.js or vector page (Special:MyPage/vector.js)
  2. Edit the page and copy the code highlighted below, it starts with if and ends with };, then save the page.
  3. Bypass your browser's cache by using the instruction on that page to reload.
  4. You should see the new edit buttons when you edit a page.
  • How to use:

Most buttons work with a selection,

  1. make a selection to highlight the text and click the button, or
  2. click the button to add the code at the insertion point, then paste or type to replace selection.

You can use the code to design new edit buttons, and add them in this page for other editors to use.

[edit] List of extra buttons

[edit] Strikethrough

Button link: Button strike.png
What it does: Crosses out highlighted text. Converts "apple" to "<s>apple</s>", which looks like "apple".

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/c/c9/Button_strike.png",
  "Strikethrough",
  '<s>',
  '</s>',
  "Insert text here"
);

[edit] Underline

Button link: Button underline.png
What it does: Underlines highlighted text. Converts "apple" to "<u>apple</u>", which looks like "apple".

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/f/fd/Button_underline.png",
  "Underline",
  '<u>',
  '</u>',
  "Insert text here"
);

[edit] Link to Wikipedia article

Button link: Button link to Wikipedia.png
What it does: Creates a link from the highlighted text to the respective Wikipedia article entry. Converts "apple" to "[[w:apple|]]", which looks like "apple". Allows the reader to research biographies, events, descriptions and other information when reading our Wikisource texts. This can also be substituted to link to any other Wikimedia sister project by simply changing the piped link structure in the code.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/7/7f/Button_link_to_Wikipedia.png",
  "Wikipedia link",
  '[[w:',
  '|]]',
  "Insert link here"
);

[edit] Link to Wiktionary entry

Button link: Button wikification.png
What it does: Creates a link from the highlighted text to the respective Wiktionary entry. Converts "apple" to "[[wikt:apple|]]", which looks like "apple". Allows the reader to research the meanings of terms on our Wikisource texts. Useful for unusual or ancient terms. This can also be substituted to link to any other Wikimedia sister project by simply changing the piped link structure in the code.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/0/0d/Button_wikification.png",
  "Wiktionary link",
  '[[wikt:',
  '|]]',
  "Insert link here"
);

[edit] Link to Author page on Wikisource

Button link: Button biocitas.png
What it does: Creates a link from the highlighted text to the respective author page. Converts "William Shakespeare" to "[[Author:William Shakespeare|]]", which looks like "William Shakespeare". Notice that the Author: prefix is not visible. This can be changed by removing the " | " from the link.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/8/83/Button_biocitas.png",
  "Author link",
  '[[Author:',
  '|]]',
  "Insert link here"
);

[edit] Link to a subpage

Button link: Button Link DifferentName.png
What it does: Creates a link from the highlighted text to a subpage from the current page. On the page The Double Dealer, converts the text "Act I" to "[[/Act I|]]", which looks like "/Act I". The actual Wikisource link would be The Double Dealer/Act I.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/0/0c/Button_Link_DifferentName.png",
  "Subpage",
  '[[/',
  '|]]',
  "Insert link here"
);

[edit] Poem

Button link: Button definition list.png
What it does: Converts highlighted text to poem format, allowing for better representation of the original work.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/d/d3/Button_definition_list.png",
  "Poem",
  '<poem>',
  '</poem>',
  "Insert text here"
);

[edit] Align text left

Button link: Button align left.png
What it does: Aligns highlighted text to the left-hand side of the screen.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/e/ea/Button_align_left.png",
  "Align Left",
  '<div style="text-align:left">',
  '</div>',
  "Insert text here"
);

[edit] Align text center

Button link: Button center.png
What it does: Centers text accross the screen.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/5/5f/Button_center.png",
  "Centered text",
  '<center>',
  '</center>',
  "Insert text here"
);

[edit] Align text right

Button link: Button align right.png
What it does: Aligns highlighted text to the right-hand side of the screen.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/a/a5/Button_align_right.png",
  "Align Right",
  '<div style="text-align:right">',
  '</div>',
  "Insert text here"
);

[edit] Big text

Button link: Button big.png
What it does: Converts highlighted text to a bigger font size. Converts "big" to "<big>big</big>", which looks like "big". Useful for headers and title pages of works.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/5/56/Button_big.png",
  "Big",
  '<big>',
  '</big>',
  "Insert text here"
);

[edit] Small text

Button link: Button small.png
What it does: Converts highlighted text to a smaller font size.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/5/58/Button_small.png",
  "Small",
  '<small>',
  '</small>',
  "Insert text here"
);

[edit] Font size

Button link: Button paragraphe 5.png
What it does: This converts highlighted text to a specific font size which is customizable by changing the size number.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_paragraphe_5.png",
  "Font size",
  '<font size="5">',
  '</font>',
  "Insert text here"
);

[edit] Add notes and references

Button link: Button reflink.png
What it does: Converts highlighted text into a footnote. Converts "This is a footnote." to "<ref>This is a footnote.</ref>", which looks like "[1]". To show the footnote, place "<references/>" anywhere on the page (though usually at the end), which looks like this:

  1. This is a footnote.
mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",
  "Reference",
  '<ref>',
  '</ref>',
  "Insert text here"
);

[edit] Indentation

Button link: Button shifting.png
What it does: Adds an indentation to the first sentence of a paragraph. To use, simply put the cursor at the beginning of the paragraph and press the button link.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/8/8e/Button_shifting.png",
  "Insert indent",
  '<div style="text-indent: 3em">',
  '',
  ""
);

[edit] Noinclude

Button link: Button noinclude.png
What it does: Wraps the text in <noinclude> tags.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/d/d5/Button_noinclude.png",
  "Noinclude",
  '<noinclude>',
  '</noinclude>',
  "Insert text here"
);

[edit] Section begin & end

[edit] Begin

Button link: Tag green.png
What it does: Creates a<section begin=LABEL /> tag for use in text transclusion.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/0/06/Tag_green.png",
  "section begin",
  '<section begin=',
  ' />',
  ""
);

[edit] End

Button link: Tag red.png
What it does: Creates a<section end=LABEL /> tag for use in text transclusion.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/d/dd/Tag_red.png",
  "section begin",
  '<section end=',
  ' />',
  ""
);


[edit] Relative link

Button link: Button relative link.png
What it does: Wraps the text in a relative link ([[../link location/]]).

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/2/23/Button_relative_link.png",
  "Relative link",
  '[[../',
  '/]]',
  ""
);


[edit] Dashes

[edit] M-dash

Button link: Button m-dash.png
What it does: Inserts an m-dash (—)

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/8/8b/Button_m-dash.png",
  "M-dash",
  '—',
  '',
  ""
);


[edit] N-dash

Button link: Button n-dash.png
What it does: Inserts an n-dash (—)

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/8/8b/Button_n-dash.png",
  "N-dash",
  '–',
  '',
  ""
);

[edit] Small caps

Button link: Button romain.png
What it does: Wraps text in a {{sc}} template.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/4/4e/Button_romain.png",
  "Small caps",
  '{{sc|',
  '}}',
  ""
);

[edit] Transcluded pages

Button link: Button indented transcluded pages.png
What it does: Inserts a <pages/> tag. This is the "usual" method of transcluding pages.

mw.toolbar.insertButton(
  "http://upload.wikimedia.org/wikipedia/commons/7/74/Button_indented_transcluded_pages.png",
  "transcluded pages",
  '<pages index="',
  '" from= to= />',
  ""
);
Personal tools
Variants
Actions
Navigation
Toolbox
Print/export