Difference between revisions of "MediaWiki:Common.js"

From SCI Wiki
Jump to navigationJump to search
Line 2: Line 2:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
  
 +
 +
// Wikipedia Link
 +
mw.toolbar.addButton({
 +
        imageId: 'mw-customeditbutton-myspecialbutton',
 +
        imageFile: '/buttons/WP.png',
 +
        speedTip: "Wikipedia Link",
 +
        tagOpen: "[[w:|",
 +
        tagClose: "]]",
 +
        sampleText: "Text here"
 +
});
  
 
// Underscore
 
// Underscore
Line 29: Line 39:
 
         speedTip: "Alert",
 
         speedTip: "Alert",
 
         tagOpen: "<span class=\"Alert\">",
 
         tagOpen: "<span class=\"Alert\">",
 +
        tagClose: "</span>",
 +
        sampleText: "Text here"
 +
});
 +
 +
// Inactive
 +
mw.toolbar.addButton({
 +
        imageId: 'Inactive',
 +
        imageFile: '/buttons/gray.png',
 +
        speedTip: "Inactive",
 +
        tagOpen: "<span class=\"Inactive\">",
 
         tagClose: "</span>",
 
         tagClose: "</span>",
 
         sampleText: "Text here"
 
         sampleText: "Text here"

Revision as of 12:40, 11 October 2013

/* Any JavaScript here will be loaded for all users on every page load. */


// Wikipedia Link
mw.toolbar.addButton({
        imageId: 'mw-customeditbutton-myspecialbutton',
        imageFile: '/buttons/WP.png',
        speedTip: "Wikipedia Link",
        tagOpen: "[[w:|",
        tagClose: "]]",
        sampleText: "Text here"
});

// Underscore
mw.toolbar.addButton({
        imageId: 'mw-customeditbutton-myspecialbutton',
        imageFile: '/buttons/FormatUnderscore.png',
        speedTip: "Underscore",
        tagOpen: "<u>",
        tagClose: "</u>",
        sampleText: "Text here"
});

// Strikethrough
mw.toolbar.addButton({
        imageId: 'mw-customeditbutton-myspecialbutton',
        imageFile: '/buttons/formatStrike.png',
        speedTip: "Strikethrough",
        tagOpen: "<strike>",
        tagClose: "</strike>",
        sampleText: "Text here"
});

// Alert
mw.toolbar.addButton({
        imageId: 'Alert',
        imageFile: '/buttons/red.png',
        speedTip: "Alert",
        tagOpen: "<span class=\"Alert\">",
        tagClose: "</span>",
        sampleText: "Text here"
});

// Inactive
mw.toolbar.addButton({
        imageId: 'Inactive',
        imageFile: '/buttons/gray.png',
        speedTip: "Inactive",
        tagOpen: "<span class=\"Inactive\">",
        tagClose: "</span>",
        sampleText: "Text here"
});

// Comment
mw.toolbar.addButton({
        imageId: 'mw-customeditbutton-myspecialbutton',
        imageFile: '/buttons/comment.png',
        speedTip: "Comment",
        tagOpen: "<!-- ",
        tagClose: " -->",
        sampleText: "Insert comment here"
});

// Block Quote
mw.toolbar.addButton({
        imageId: 'blockquote',
        imageFile: '/buttons/blockquote.png',
        speedTip: "Blockquote",
        tagOpen: "<blockquote>",
        tagClose: "</blockquote>",
        sampleText: "Insert comment here"
});

// Non-breaking space
mw.toolbar.addButton({
        imageId: 'nobreak',
        imageFile: '/buttons/nobreak.png',
        speedTip: "Non-breaking Space",
        tagOpen: "&nbsp;",
        tagClose: "",
        sampleText: ""
});

// Line Break
mw.toolbar.addButton({
        imageId: 'mw-customeditbutton-myspecialbutton',
        imageFile: '/buttons/br.png',
        speedTip: "New Line",
        tagOpen: "",
        tagClose: "<br />\n",
        sampleText: ""
});


// Table
mw.toolbar.addButton({
        imageId: '',
        imageFile: '/buttons/table.png',
        speedTip: "Table",
        tagOpen: "{| cellpadding=\"10\" align=\"center\" width=\"85%\"\n|- \n|align=\"center\"| ",
        tagClose: "\n|}",
        sampleText: "Insert content here"
});


// Align Left
mw.toolbar.addButton({
        imageId: '',
        imageFile: '/buttons/alignLeft.png',
        speedTip: "Align Left",
        tagOpen: "<div align=\"left\">",
        tagClose: "</div>",
        sampleText: "content here"
});

// Align Center
mw.toolbar.addButton({
        imageId: '',
        imageFile: '/buttons/alignCenter.png',
        speedTip: "Align Center",
        tagOpen: "<div align=\"center\">",
        tagClose: "</div>",
        sampleText: "content here"
});

// Align Right
mw.toolbar.addButton({
        imageId: '',
        imageFile: '/buttons/alignRight.png',
        speedTip: "Align Right",
        tagOpen: "<div align=\"right\">",
        tagClose: "</div>",
        sampleText: "content here"
});

// Justify
mw.toolbar.addButton({
        imageId: 'justify',
        imageFile: '/buttons/alignJustify.png',
        speedTip: "Justify",
        tagOpen: "<div align=\"justify\">",
        tagClose: "</div>",
        sampleText: ""
});

// SCI Code
mw.toolbar.addButton({
        imageId: 'SCI',
        imageFile: '/buttons/SCI.png',
        speedTip: "SCI Code",
        tagOpen: "<div class=\"CodeBlockHeader\">Code:</div>\n<syntaxhighlight lang=\"sci\">\n",
        tagClose: "</syntaxhighlight>",
        sampleText: "code here"
});

// Code
mw.toolbar.addButton({
        imageId: 'code',
        imageFile: '/buttons/code.png',
        speedTip: "Code",
        tagOpen: "<code>",
        tagClose: "</code>",
        sampleText: "code here"
});

// Preformatted
mw.toolbar.addButton({
        imageId: 'pre',
        imageFile: '/buttons/pre.png',
        speedTip: "Preformatted",
        tagOpen: "<pre>",
        tagClose: "</pre>",
        sampleText: "code here"
});

// Redirect
mw.toolbar.addButton({
        imageId: 'Redirect',
        imageFile: '/buttons/redirect.png',
        speedTip: "Redirect",
        tagOpen: "#REDIRECT [[",
        tagClose: "]]",
        sampleText: "code here"
});