Difference between revisions of "MediaWiki:Common.js"
From SCI Wiki
Jump to navigationJump to search(63 intermediate revisions by the same user not shown) | |||
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. */ | ||
+ | // Underscore | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Underscore', | ||
+ | imageFile: '/buttons/FormatUnderscore.png', | ||
+ | speedTip: "Underscore", | ||
+ | tagOpen: "<u>", | ||
+ | tagClose: "</u>", | ||
+ | sampleText: "Text here" | ||
+ | }); | ||
+ | |||
+ | // Strikethrough | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Strikethrough', | ||
+ | imageFile: '/buttons/FormatStrike.png', | ||
+ | speedTip: "Strikethrough", | ||
+ | tagOpen: "<strike>", | ||
+ | tagClose: "</strike>", | ||
+ | sampleText: "Text here" | ||
+ | }); | ||
+ | |||
+ | // Align Left | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-AlignLeft', | ||
+ | imageFile: '/buttons/AlignLeft.png', | ||
+ | speedTip: "Align Left", | ||
+ | tagOpen: "<div align=\"left\">", | ||
+ | tagClose: "</div>", | ||
+ | sampleText: "content here" | ||
+ | }); | ||
+ | |||
+ | // Align Center | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-AlignCenter', | ||
+ | imageFile: '/buttons/AlignCenter.png', | ||
+ | speedTip: "Align Center", | ||
+ | tagOpen: "<div align=\"center\">", | ||
+ | tagClose: "</div>", | ||
+ | sampleText: "content here" | ||
+ | }); | ||
+ | |||
+ | // Align Right | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-AlignRight', | ||
+ | imageFile: '/buttons/AlignRight.png', | ||
+ | speedTip: "Align Right", | ||
+ | tagOpen: "<div align=\"right\">", | ||
+ | tagClose: "</div>", | ||
+ | sampleText: "content here" | ||
+ | }); | ||
+ | |||
+ | // Justify | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Justify', | ||
+ | imageFile: '/buttons/AlignJustify.png', | ||
+ | speedTip: "Justify", | ||
+ | tagOpen: "<div align=\"justify\">", | ||
+ | tagClose: "</div>", | ||
+ | sampleText: "" | ||
+ | }); | ||
+ | |||
+ | // Indent | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Indent', | ||
+ | imageFile: '/buttons/Indent.png', | ||
+ | speedTip: "Indent", | ||
+ | tagOpen: "<blockquote>", | ||
+ | tagClose: "</blockquote>", | ||
+ | sampleText: "Insert comment here" | ||
+ | }); | ||
+ | |||
+ | // Offset | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Offset', | ||
+ | imageFile: '/buttons/Offset.png', | ||
+ | speedTip: "Offset", | ||
+ | tagOpen: "<blockquote class=\"offset\">", | ||
+ | tagClose: "</blockquote>", | ||
+ | sampleText: "Text here" | ||
+ | }); | ||
+ | |||
+ | // Quote | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Quote', | ||
+ | imageFile: 'http://wiki.sierrahelp.com/buttons/Quote.png', | ||
+ | speedTip: "Quote", | ||
+ | tagOpen: "<div class=\"Quote\">\n{{Quote|Attrib = \n}}\n", | ||
+ | tagClose: "\n</div>", | ||
+ | sampleText: "Quoted text here" | ||
+ | }); | ||
+ | |||
+ | // Alert | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Alert', | ||
+ | imageFile: '/buttons/Red.png', | ||
+ | speedTip: "Alert", | ||
+ | tagOpen: "<span class=\"Alert\">", | ||
+ | tagClose: "</span>", | ||
+ | sampleText: "Text here" | ||
+ | }); | ||
+ | |||
+ | // Inactive | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Inactive', | ||
+ | imageFile: '/buttons/Gray.png', | ||
+ | speedTip: "Inactive", | ||
+ | tagOpen: "<span class=\"Inactive\">", | ||
+ | tagClose: "</span>", | ||
+ | sampleText: "Text here" | ||
+ | }); | ||
+ | |||
+ | // Add Reference | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Reference', | ||
+ | imageFile: '/buttons/Reference.png', | ||
+ | speedTip: "Add Reference", | ||
+ | tagOpen: "<ref>", | ||
+ | tagClose: "</ref>", | ||
+ | sampleText: "Text here" | ||
+ | }); | ||
+ | |||
+ | // Add Citation Required Notice | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-CitationWarning', | ||
+ | imageFile: '/buttons/CitationWarning.png', | ||
+ | speedTip: "Add Reference", | ||
+ | tagOpen: "{{CitationReq}}" | ||
+ | }); | ||
+ | |||
+ | // Wikipedia Link | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Wikipedia', | ||
+ | imageFile: '/buttons/Wikipedia.png', | ||
+ | speedTip: "Wikipedia Link", | ||
+ | tagOpen: "[[w:|", | ||
+ | tagClose: "]]", | ||
+ | sampleText: "Text here" | ||
+ | }); | ||
+ | |||
+ | // Redirect | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Redirect', | ||
+ | imageFile: '/buttons/Redirect.png', | ||
+ | speedTip: "Redirect", | ||
+ | tagOpen: "#REDIRECT [[", | ||
+ | tagClose: "]]", | ||
+ | sampleText: "code here" | ||
+ | }); | ||
− | // | + | // Superscript |
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: 'mw-customeditbutton- | + | imageId: 'mw-customeditbutton-Superscript', |
− | imageFile: '// | + | imageFile: '/buttons/Superscript.png', |
− | speedTip: " | + | speedTip: "Superscript", |
− | tagOpen: " | + | tagOpen: "<sup>", |
− | tagClose: ")", | + | tagClose: "</sup>", |
− | sampleText: " | + | sampleText: "Text here" |
+ | }); | ||
+ | |||
+ | // Subscript | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Subscript', | ||
+ | imageFile: '/buttons/Subscript.png', | ||
+ | speedTip: "Subscript", | ||
+ | tagOpen: "<sub>", | ||
+ | tagClose: "</sub>", | ||
+ | sampleText: "Text here" | ||
+ | }); | ||
+ | |||
+ | // Half | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Half', | ||
+ | imageFile: '/buttons/Half.png', | ||
+ | speedTip: "Half", | ||
+ | tagOpen: "½", | ||
+ | tagClose: "", | ||
+ | sampleText: "" | ||
+ | }); | ||
+ | |||
+ | // Quarter | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Quarter', | ||
+ | imageFile: '/buttons/Quarter.png', | ||
+ | speedTip: "Quarter", | ||
+ | tagOpen: "¼", | ||
+ | tagClose: "", | ||
+ | sampleText: "" | ||
+ | }); | ||
+ | |||
+ | // Copyright | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Copyright', | ||
+ | imageFile: '/buttons/Copyright.png', | ||
+ | speedTip: "Copyright", | ||
+ | tagOpen: "©", | ||
+ | tagClose: "", | ||
+ | sampleText: "" | ||
+ | }); | ||
+ | |||
+ | // Comment | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Comment', | ||
+ | imageFile: '/buttons/Comment.png', | ||
+ | speedTip: "Comment", | ||
+ | tagOpen: "<!-- ", | ||
+ | tagClose: " -->", | ||
+ | sampleText: "Insert comment here" | ||
+ | }); | ||
+ | |||
+ | // Non-breaking space | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-NoBreak', | ||
+ | imageFile: '/buttons/NoBreak.png', | ||
+ | speedTip: "Non-breaking Space", | ||
+ | tagOpen: " ", | ||
+ | tagClose: "", | ||
+ | sampleText: "" | ||
+ | }); | ||
+ | |||
+ | // New Line | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-NewLine', | ||
+ | imageFile: '/buttons/NewLine.png', | ||
+ | speedTip: "New Line", | ||
+ | tagOpen: "", | ||
+ | tagClose: "<br />\n", | ||
+ | sampleText: "" | ||
+ | }); | ||
+ | |||
+ | // Table | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-Table', | ||
+ | imageFile: '/buttons/Table.png', | ||
+ | speedTip: "Table", | ||
+ | tagOpen: "{| cellpadding=\"10\" align=\"center\" width=\"85%\"\n|- \n|align=\"center\"| ", | ||
+ | tagClose: "\n|}", | ||
+ | sampleText: "Insert content here" | ||
+ | }); | ||
+ | |||
+ | // Add template | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-NewTemplate', | ||
+ | imageFile: '/buttons/Template.png', | ||
+ | speedTip: "Add template", | ||
+ | tagOpen: "{{", | ||
+ | tagClose: "}}", | ||
+ | sampleText: "Template Name" | ||
}); | }); | ||
− | // | + | // AGI Code |
− | + | mw.toolbar.addButton({ | |
− | + | imageId: 'mw-customeditbutton-AGI', | |
− | + | imageFile: '/buttons/AGI.png', | |
− | + | speedTip: "AGI Code", | |
− | + | tagOpen: "<div class=\"CodeBlockHeader\">AGI Code:</div>\n<syntaxhighlight lang=\"agi\">\n", | |
− | + | tagClose: "</syntaxhighlight>", | |
− | sampleText: | + | sampleText: "code here" |
}); | }); | ||
+ | // SCI Code | ||
+ | mw.toolbar.addButton({ | ||
+ | imageId: 'mw-customeditbutton-SCI', | ||
+ | imageFile: '/buttons/SCI.png', | ||
+ | speedTip: "SCI Code", | ||
+ | tagOpen: "<div class=\"CodeBlockHeader\">SCI Code:</div>\n<syntaxhighlight lang=\"sci\">\n", | ||
+ | tagClose: "</syntaxhighlight>", | ||
+ | sampleText: "code here" | ||
+ | }); | ||
− | + | // Code | |
− | + | mw.toolbar.addButton({ | |
− | + | imageId: 'mw-customeditbutton-Code', | |
− | + | imageFile: '/buttons/code.png', | |
− | + | speedTip: "Code", | |
− | + | tagOpen: "<code>", | |
− | + | tagClose: "</code>", | |
− | + | sampleText: "code here" | |
− | |||
− | |||
− | |||
− | |||
}); | }); | ||
− | + | // Preformatted | |
− | + | mw.toolbar.addButton({ | |
− | + | imageId: 'mw-customeditbutton-Pre', | |
− | + | imageFile: '/buttons/pre.png', | |
− | + | speedTip: "Preformatted", | |
− | + | tagOpen: "<pre>", | |
− | + | tagClose: "</pre>", | |
− | + | sampleText: "code here" | |
− | + | }); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | // Clear | |
− | + | mw.toolbar.addButton({ | |
− | + | imageId: 'mw-customeditbutton-Clear', | |
− | + | imageFile: '/buttons/Clear.png', | |
− | + | speedTip: "Clear", | |
− | + | tagOpen: "<div>", | |
− | + | tagClose: "</div>", | |
− | + | sampleText: "Text here" | |
− | + | }); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 13:28, 8 September 2020
/* Any JavaScript here will be loaded for all users on every page load. */
// Underscore
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Underscore',
imageFile: '/buttons/FormatUnderscore.png',
speedTip: "Underscore",
tagOpen: "<u>",
tagClose: "</u>",
sampleText: "Text here"
});
// Strikethrough
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Strikethrough',
imageFile: '/buttons/FormatStrike.png',
speedTip: "Strikethrough",
tagOpen: "<strike>",
tagClose: "</strike>",
sampleText: "Text here"
});
// Align Left
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-AlignLeft',
imageFile: '/buttons/AlignLeft.png',
speedTip: "Align Left",
tagOpen: "<div align=\"left\">",
tagClose: "</div>",
sampleText: "content here"
});
// Align Center
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-AlignCenter',
imageFile: '/buttons/AlignCenter.png',
speedTip: "Align Center",
tagOpen: "<div align=\"center\">",
tagClose: "</div>",
sampleText: "content here"
});
// Align Right
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-AlignRight',
imageFile: '/buttons/AlignRight.png',
speedTip: "Align Right",
tagOpen: "<div align=\"right\">",
tagClose: "</div>",
sampleText: "content here"
});
// Justify
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Justify',
imageFile: '/buttons/AlignJustify.png',
speedTip: "Justify",
tagOpen: "<div align=\"justify\">",
tagClose: "</div>",
sampleText: ""
});
// Indent
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Indent',
imageFile: '/buttons/Indent.png',
speedTip: "Indent",
tagOpen: "<blockquote>",
tagClose: "</blockquote>",
sampleText: "Insert comment here"
});
// Offset
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Offset',
imageFile: '/buttons/Offset.png',
speedTip: "Offset",
tagOpen: "<blockquote class=\"offset\">",
tagClose: "</blockquote>",
sampleText: "Text here"
});
// Quote
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Quote',
imageFile: 'http://wiki.sierrahelp.com/buttons/Quote.png',
speedTip: "Quote",
tagOpen: "<div class=\"Quote\">\n{{Quote|Attrib = \n}}\n",
tagClose: "\n</div>",
sampleText: "Quoted text here"
});
// Alert
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Alert',
imageFile: '/buttons/Red.png',
speedTip: "Alert",
tagOpen: "<span class=\"Alert\">",
tagClose: "</span>",
sampleText: "Text here"
});
// Inactive
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Inactive',
imageFile: '/buttons/Gray.png',
speedTip: "Inactive",
tagOpen: "<span class=\"Inactive\">",
tagClose: "</span>",
sampleText: "Text here"
});
// Add Reference
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Reference',
imageFile: '/buttons/Reference.png',
speedTip: "Add Reference",
tagOpen: "<ref>",
tagClose: "</ref>",
sampleText: "Text here"
});
// Add Citation Required Notice
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-CitationWarning',
imageFile: '/buttons/CitationWarning.png',
speedTip: "Add Reference",
tagOpen: "{{CitationReq}}"
});
// Wikipedia Link
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Wikipedia',
imageFile: '/buttons/Wikipedia.png',
speedTip: "Wikipedia Link",
tagOpen: "[[w:|",
tagClose: "]]",
sampleText: "Text here"
});
// Redirect
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Redirect',
imageFile: '/buttons/Redirect.png',
speedTip: "Redirect",
tagOpen: "#REDIRECT [[",
tagClose: "]]",
sampleText: "code here"
});
// Superscript
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Superscript',
imageFile: '/buttons/Superscript.png',
speedTip: "Superscript",
tagOpen: "<sup>",
tagClose: "</sup>",
sampleText: "Text here"
});
// Subscript
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Subscript',
imageFile: '/buttons/Subscript.png',
speedTip: "Subscript",
tagOpen: "<sub>",
tagClose: "</sub>",
sampleText: "Text here"
});
// Half
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Half',
imageFile: '/buttons/Half.png',
speedTip: "Half",
tagOpen: "½",
tagClose: "",
sampleText: ""
});
// Quarter
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Quarter',
imageFile: '/buttons/Quarter.png',
speedTip: "Quarter",
tagOpen: "¼",
tagClose: "",
sampleText: ""
});
// Copyright
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Copyright',
imageFile: '/buttons/Copyright.png',
speedTip: "Copyright",
tagOpen: "©",
tagClose: "",
sampleText: ""
});
// Comment
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Comment',
imageFile: '/buttons/Comment.png',
speedTip: "Comment",
tagOpen: "<!-- ",
tagClose: " -->",
sampleText: "Insert comment here"
});
// Non-breaking space
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-NoBreak',
imageFile: '/buttons/NoBreak.png',
speedTip: "Non-breaking Space",
tagOpen: " ",
tagClose: "",
sampleText: ""
});
// New Line
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-NewLine',
imageFile: '/buttons/NewLine.png',
speedTip: "New Line",
tagOpen: "",
tagClose: "<br />\n",
sampleText: ""
});
// Table
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Table',
imageFile: '/buttons/Table.png',
speedTip: "Table",
tagOpen: "{| cellpadding=\"10\" align=\"center\" width=\"85%\"\n|- \n|align=\"center\"| ",
tagClose: "\n|}",
sampleText: "Insert content here"
});
// Add template
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-NewTemplate',
imageFile: '/buttons/Template.png',
speedTip: "Add template",
tagOpen: "{{",
tagClose: "}}",
sampleText: "Template Name"
});
// AGI Code
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-AGI',
imageFile: '/buttons/AGI.png',
speedTip: "AGI Code",
tagOpen: "<div class=\"CodeBlockHeader\">AGI Code:</div>\n<syntaxhighlight lang=\"agi\">\n",
tagClose: "</syntaxhighlight>",
sampleText: "code here"
});
// SCI Code
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-SCI',
imageFile: '/buttons/SCI.png',
speedTip: "SCI Code",
tagOpen: "<div class=\"CodeBlockHeader\">SCI Code:</div>\n<syntaxhighlight lang=\"sci\">\n",
tagClose: "</syntaxhighlight>",
sampleText: "code here"
});
// Code
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Code',
imageFile: '/buttons/code.png',
speedTip: "Code",
tagOpen: "<code>",
tagClose: "</code>",
sampleText: "code here"
});
// Preformatted
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Pre',
imageFile: '/buttons/pre.png',
speedTip: "Preformatted",
tagOpen: "<pre>",
tagClose: "</pre>",
sampleText: "code here"
});
// Clear
mw.toolbar.addButton({
imageId: 'mw-customeditbutton-Clear',
imageFile: '/buttons/Clear.png',
speedTip: "Clear",
tagOpen: "<div>",
tagClose: "</div>",
sampleText: "Text here"
});