User:Mdoc7/monobook.js

// 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

function InsertButtonsToToolBar { if(typeof mwCustomEditButtons === 'undefined') return; //Strike-Out Button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png", "speedTip": "Strike", "tagOpen": " ", "tagClose": " ", "sampleText": "Strike-through text"} //Left-Text Button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/e/ea/Button_align_left.png", "speedTip": "Left-Align", "tagOpen": " \n", "tagClose": "\n ", "sampleText": "Left-aligned text"} //Center-Text Button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/5/5f/Button_center.png", "speedTip": "Center", "tagOpen": " \n", "tagClose": "\n ", "sampleText": "Centered text"} //Table button 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 mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png", "speedTip": "Line break", "tagOpen": " ", "tagClose": "", "sampleText": ""} //Superscript mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png", "speedTip": "Superscript", "tagOpen": " ", "tagClose": " ", "sampleText": "Superscript text"} //Subscript mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png", "speedTip": "Subscript", "tagOpen": " ", "tagClose": " ", "sampleText": "Subscript text"} //Small Text mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png", "speedTip": "Small", "tagOpen": " ", "tagClose": " ", "sampleText": "Small Text"} //Comment mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png", "speedTip": "Insert hidden Comment", "tagOpen": "", "sampleText": "Comment"} //Gallery mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png", "speedTip": "Insert a picture gallery", "tagOpen": "\n", "sampleText": "Image:FileName.jpg|Caption1\\Image:FileName2.jpg|Caption2"} //Secondary Headline 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 mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/8e/Button_shifting.png", "speedTip": "Insert tab(s)", "tagOpen": ":", "tagClose": "", "sampleText": ":"} //Block Quote mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png", "speedTip": "Insert block of quoted text", "tagOpen": "\n", "tagClose": "\n ", "sampleText": "Block quote"} //Colour mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/1e/Button_font_color.png", "speedTip": "Insert colored text", "tagOpen": " ", "tagClose": " ", "sampleText": "Span of text"} //Code mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/2/23/Button_code.png", "speedTip": "Insert code", "tagOpen": " ", "sampleText": "Code"} //Sub-Link mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/9/93/Button_sub_link.png", "speedTip": "Insert link to sub-page", "tagOpen": "Page", "sampleText": "Sub_page"} //Definition List 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"} //Template button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png", "speedTip": "Template", "tagOpen": "", "sampleText": "Template name"} //Category button 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 mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png", "speedTip": " ", "sampleText": "Insert reference material"} //Reference button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a0/Button_references_alt.png", "speedTip": "Reference footer", "tagOpen": " ", "tagClose": "", "sampleText": ""} } $(InsertButtonsToToolBar);

//This code will change ISBN links to point to the url of your choice, //instead of Special:Book_sources. // //How to use it: // //First, you must copy this code to your user javascript page. This is //at User: /monobook.js. My username is Lunchboxhero so //my javascript page is User:Lunchboxhero/monobook.js. You must be logged //in to edit your javascript page. // //Once you have copied the code and saved the page, you need to refresh your //browser's cache. For Mozilla/Safari/Konqueror: hold down Shift while clicking //Reload (or press Ctrl-Shift-R), IE: press Ctrl-F5, Opera: press F5. // //The code should now work, as long as you are logged in. // //You can change the destination url by simply modifying the quoted url that //follows document.links[i].href= // //Good luck, and if you have any questions, leave me a comment on the discussion //page of User:Lunchboxhero/monobook.js. // //(Every line that starts with "//" is a comment and can be discarded.)

//Retrieved from "http://en.wikipedia.org/wiki/User:Lunchboxhero/monobook.js" function externISBN { for (var i = 0; i < document.links.length; i++) {               var ln = document.links[i].href.match(/isbn=(.*)/); if (ln) { document.links[i].href='http://www.amazon.com/exec/obidos/ASIN/'+RegExp.$1; }   } } $(externISBN);