User:Userscripts/Extra editbuttons/source2.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
//Create 'custombutton' function: function custombutton(s,o,c,t,i) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": http://upload.wikimedia.org/wikipedia/commons/ + "i", "speedTip": "s", "tagOpen": "o", "tagClose": "c", "sampleText": "t"} } // This is based on the original code on Wikipedia:Tools/Editing tools // // The original code was on the project page and needed to be cut and paste to the user's // monobook.js page. However, this caused problems with the quote marks. So I have moved // it to its own page. // // I do not know a lot about Javascript so please do not ask for a complicated change // // See the [[User:MarkS/Extra edit buttons]] for changes log //Template button function wincb1() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png", "speedTip": "Template", "tagOpen": "{{", "tagClose": "}}", "sampleText": "Template name"} } //Strike-Out Button function wincb2() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png", "speedTip": "Strike", "tagOpen": "<s>", "tagClose": "</s>", "sampleText": "Strike-through text"} } //Left-Text Button function wincb3() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/e/ea/Button_align_left.png", "speedTip": "Left-Align", "tagOpen": "<div style='text-align: left; direction: ltr; margin-left: 1em;'>\n", "tagClose": "\n</div>", "sampleText": "Left-aligned text"} } //Center-Text Button function wincb4() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/5/5f/Button_center.png", "speedTip": "Center", "tagOpen": "<div style='text-align: center;'>\n", "tagClose": "\n</div>", "sampleText": "Centered text"} } //Table button function wincb5() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png", "speedTip": "Table", "tagOpen": "\n{| border='1' \n|- \n| 1 || 2\n|- \n| 3 || 4", "tagClose": "\n|}\n", "sampleText": ""} } //Line break button function wincb6() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png", "speedTip": "Line break", "tagOpen": "<br />", "tagClose": "", "sampleText": ""} } //Advanced line break button function wincb6a() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a2/Button_linebreak_advanced.gif", "speedTip": "Line break", "tagOpen": "<br style='clear: ", "tagClose": ";'/>", "sampleText": "all"} } //Superscript function wincb7() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png", "speedTip": "Superscript", "tagOpen": "<sup>", "tagClose": "</sup>", "sampleText": "Superscript text"} } //Subscript function wincb8() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png", "speedTip": "Subscript", "tagOpen": "<sub>", "tagClose": "</sub>", "sampleText": "Subscript text"} } //Small Text function wincb9() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png", "speedTip": "Small", "tagOpen": "<small>", "tagClose": "</small>", "sampleText": "Small Text"} } //Comment function wincb10() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png", "speedTip": "Insert hidden Comment", "tagOpen": "<!--", "tagClose": "-->", "sampleText": "Comment"} } //Gallery function wincb11() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png", "speedTip": "Insert a picture gallery", "tagOpen": "\n<gallery>\n", "tagClose": "\n</gallery>", "sampleText": "Image:FileName.jpg|Caption1\\Image:FileName2.jpg|Caption2"} } //Secondary Headline function wincb12() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/e/e9/Button_headline2.png", "speedTip": "Secondary headline", "tagOpen": "\n===", "tagClose": "===", "sampleText": "Secondary headline"} } //Tabs function wincb13() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/8e/Button_shifting.png", "speedTip": "Insert tab(s)", "tagOpen": ":", "tagClose": "", "sampleText": ":"} } //Block Quote function wincb14() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png", "speedTip": "Insert block of quoted text", "tagOpen": "<blockquote style='border: 1px solid blue; padding: 2em;'>\n", "tagClose": "\n</blockquote>", "sampleText": "Block quote"} } //Colour function wincb15() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/1e/Button_font_color.png", "speedTip": "Insert colored text", "tagOpen": "<span style='color: ColorName'>", "tagClose": "</span>", "sampleText": "Span of text"} } //Code function wincb16() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/2/23/Button_code.png", "speedTip": "Insert code", "tagOpen": "<code>", "tagClose": "</code>", "sampleText": "Code"} } //Sub-Link function wincb17() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/9/93/Button_sub_link.png", "speedTip": "Insert link to sub-page", "tagOpen": "[[Page#", "tagClose": "]]", "sampleText": "Sub_page"} } //Definition List function wincb18() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/d/d3/Button_definition_list.png", "speedTip": "Insert definition list", "tagOpen": "\n; ", "tagClose": " : ", "sampleText": "Insert text"} } //Category button function wincb19() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/5a/Button_category_alt.png", "speedTip": "Category", "tagOpen": "[[Category:", "tagClose": "]]", "sampleText": "Category title"} } //Reference link button function wincb20() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png", "speedTip": "<ref>", "tagOpen": "<ref>", "tagClose": "</ref>", "sampleText": "Insert reference material"} } //Advanced reference link button function wincb20a() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/c/cd/Button_reflink_advanced.gif", "speedTip": "Reflink", "tagOpen": "<ref name='", "tagClose": "", "sampleText": "Insert name of reference"} mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/1c/Button_reflink_advanced_2.gif", "speedTip": "Reflink", "tagOpen": "'>", "tagClose": "</ref>", "sampleText": "Insert reference material"} mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/28/Button_reflink_advanced_3.gif", "speedTip": "Reflink", "tagOpen": "", "tagClose": "'/>", "sampleText": ""} } //Reference button function wincb21() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a0/Button_references_alt.png", "speedTip": "Reference footer", "tagOpen": "==Notes==\n<div class='references-small'>", "tagClose": "<references/>\n</div>", "sampleText": ""} } //Redirect button function wincb22() { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png", "speedTip": "Redirect", "tagOpen": "#REDIRECT [[", "tagClose": "]]", "sampleText": "Target"} }