MediaWiki:Editbar.js

Revision as of 12:41, 4 March 2010 by Cogniac (Talk | contribs) (Created page with '* * Remove buttons from default edit menu.: function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) { if (imageId == 'mw-editbutton-media' || im…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences
/**
 * Remove buttons from default edit menu.
 */
function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) {
    if (imageId == 'mw-editbutton-media' || imageId == 'mw-editbutton-hr')
        return;

    mwEditButtons.push({
        'imageId' : imageId,
        'imageFile' : imageFile,
        'speedTip' : speedTip,
        'tagOpen' : tagOpen,
        'tagClose' : tagClose,
        'sampleText' : sampleText
    });
}

/**
 * Adds a custom button.
 */
function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText) {
    mwCustomEditButtons.push({
        'imageFile' : imageFile,
        'speedTip' : speedTip,
        'tagOpen' : tagOpen,
        'tagClose' : tagClose,
        'sampleText' : sampleText
    });
}

/**
 * Add extra buttons to the edit menu.
 */
if (mwCustomEditButtons) {
    addCustomButton('images/0/07/Editbar_Underline.png', 'Underlined text', '{{Underline|', '}}', 'Underlined text');
    addCustomButton('images/9/9f/Editbar_Line_Break.png', 'Line Break', '{{Line Break}}', '', '');
    addCustomButton('images/a/a0/Editbar_Redirect.png', 'Redirect', '#REDIRECT [[', ']]', 'Target page name');
}