Difference between revisions of "MediaWiki:Common.js"
From SCI Wiki
Jump to navigationJump to search(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
/* 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 | // Underscore | ||
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: 'mw-customeditbutton- | + | imageId: 'mw-customeditbutton-Underscore', |
imageFile: '/buttons/FormatUnderscore.png', | imageFile: '/buttons/FormatUnderscore.png', | ||
speedTip: "Underscore", | speedTip: "Underscore", | ||
tagOpen: "<u>", | tagOpen: "<u>", | ||
− | tagClose: " </u>", | + | tagClose: "</u>", |
sampleText: "Text here" | sampleText: "Text here" | ||
}); | }); | ||
Line 15: | Line 14: | ||
// Strikethrough | // Strikethrough | ||
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: 'mw-customeditbutton- | + | imageId: 'mw-customeditbutton-Strikethrough', |
− | imageFile: '/buttons/ | + | imageFile: '/buttons/FormatStrike.png', |
speedTip: "Strikethrough", | speedTip: "Strikethrough", | ||
tagOpen: "<strike>", | tagOpen: "<strike>", | ||
Line 23: | Line 22: | ||
}); | }); | ||
− | // | + | // 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({ | mw.toolbar.addButton({ | ||
− | imageId: 'mw-customeditbutton- | + | imageId: 'mw-customeditbutton-Justify', |
− | imageFile: '/buttons/ | + | imageFile: '/buttons/AlignJustify.png', |
− | speedTip: " | + | speedTip: "Justify", |
− | tagOpen: "< | + | tagOpen: "<div align=\"justify\">", |
− | tagClose: " | + | tagClose: "</div>", |
− | sampleText: " | + | sampleText: "" |
}); | }); | ||
− | // | + | // Indent |
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: ' | + | imageId: 'mw-customeditbutton-Indent', |
− | imageFile: '/buttons/ | + | imageFile: '/buttons/Indent.png', |
− | speedTip: " | + | speedTip: "Indent", |
tagOpen: "<blockquote>", | tagOpen: "<blockquote>", | ||
tagClose: "</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" | sampleText: "Insert comment here" | ||
}); | }); | ||
Line 45: | Line 212: | ||
// Non-breaking space | // Non-breaking space | ||
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: ' | + | imageId: 'mw-customeditbutton-NoBreak', |
− | imageFile: '/buttons/ | + | imageFile: '/buttons/NoBreak.png', |
speedTip: "Non-breaking Space", | speedTip: "Non-breaking Space", | ||
tagOpen: " ", | tagOpen: " ", | ||
Line 53: | Line 220: | ||
}); | }); | ||
− | // Line | + | // New Line |
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: 'mw-customeditbutton- | + | imageId: 'mw-customeditbutton-NewLine', |
− | imageFile: '/buttons/ | + | imageFile: '/buttons/NewLine.png', |
speedTip: "New Line", | speedTip: "New Line", | ||
tagOpen: "", | tagOpen: "", | ||
Line 62: | Line 229: | ||
sampleText: "" | sampleText: "" | ||
}); | }); | ||
− | |||
// Table | // Table | ||
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: '', | + | imageId: 'mw-customeditbutton-Table', |
− | imageFile: '/buttons/ | + | imageFile: '/buttons/Table.png', |
speedTip: "Table", | speedTip: "Table", | ||
tagOpen: "{| cellpadding=\"10\" align=\"center\" width=\"85%\"\n|- \n|align=\"center\"| ", | tagOpen: "{| cellpadding=\"10\" align=\"center\" width=\"85%\"\n|- \n|align=\"center\"| ", | ||
Line 74: | Line 240: | ||
}); | }); | ||
− | + | // Add template | |
− | // | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: '', | + | imageId: 'mw-customeditbutton-NewTemplate', |
− | imageFile: '/buttons/ | + | imageFile: '/buttons/Template.png', |
− | speedTip: " | + | speedTip: "Add template", |
− | tagOpen: " | + | tagOpen: "{{", |
− | tagClose: " | + | tagClose: "}}", |
− | sampleText: " | + | sampleText: "Template Name" |
}); | }); | ||
− | + | ||
− | // | + | // AGI Code |
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: '', | + | imageId: 'mw-customeditbutton-AGI', |
− | imageFile: '/buttons/ | + | imageFile: '/buttons/AGI.png', |
− | speedTip: " | + | speedTip: "AGI Code", |
− | tagOpen: "<div | + | tagOpen: "<div class=\"CodeBlockHeader\">AGI Code:</div>\n<syntaxhighlight lang=\"agi\">\n", |
− | + | tagClose: "</syntaxhighlight>", | |
− | + | sampleText: "code here" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | tagClose: "</ | ||
− | sampleText: "" | ||
}); | }); | ||
// SCI Code | // SCI Code | ||
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: 'SCI', | + | imageId: 'mw-customeditbutton-SCI', |
imageFile: '/buttons/SCI.png', | imageFile: '/buttons/SCI.png', | ||
speedTip: "SCI Code", | speedTip: "SCI Code", | ||
− | tagOpen: "<div class=\"CodeBlockHeader\">Code:</div>\n<syntaxhighlight lang=\"sci\">\n", | + | tagOpen: "<div class=\"CodeBlockHeader\">SCI Code:</div>\n<syntaxhighlight lang=\"sci\">\n", |
tagClose: "</syntaxhighlight>", | tagClose: "</syntaxhighlight>", | ||
sampleText: "code here" | sampleText: "code here" | ||
Line 127: | Line 272: | ||
// Code | // Code | ||
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: ' | + | imageId: 'mw-customeditbutton-Code', |
imageFile: '/buttons/code.png', | imageFile: '/buttons/code.png', | ||
speedTip: "Code", | speedTip: "Code", | ||
Line 137: | Line 282: | ||
// Preformatted | // Preformatted | ||
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: ' | + | imageId: 'mw-customeditbutton-Pre', |
imageFile: '/buttons/pre.png', | imageFile: '/buttons/pre.png', | ||
speedTip: "Preformatted", | speedTip: "Preformatted", | ||
Line 145: | Line 290: | ||
}); | }); | ||
− | // | + | // Clear |
mw.toolbar.addButton({ | mw.toolbar.addButton({ | ||
− | imageId: ' | + | imageId: 'mw-customeditbutton-Clear', |
− | + | imageFile: '/buttons/Clear.png', | |
− | + | speedTip: "Clear", | |
− | + | tagOpen: "<div>", | |
− | + | tagClose: "</div>", | |
− | |||
− | |||
− | |||
− | |||
− | mw | ||
− | |||
− | imageFile: '/buttons/ | ||
− | speedTip: " | ||
− | tagOpen: "< | ||
− | tagClose: "</ | ||
sampleText: "Text here" | 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"
});