User:Tygrrr/monobook.js
From Wiktionary
Note - After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh); Konqueror: click Reload or press F5; Opera: clear the cache in Tools → Preferences; Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.
/*********************************************************************** EXTRA EDIT BUTTONS ***********************************************************************/ // Extra edit page buttons [[Wikipedia:Tools/Editing_tools#Misc._Editing_tools]] // 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 have taken this from simple:user:Huji/monobook.js and modified it. I do not know how to do this from scratch so if you want it for yourself, you're better off using another source. // // See the [[User:MarkS/Extra edit buttons]] for changes log function InsertButtonsToToolBar() { d = new Date(); todayISO = d.getFullYear()+"-"; if (d.getMonth > 8) { todayISO += (d.getMonth()+1)+"-"; } else { todayISO += "0"+(d.getMonth()+1)+"-"; } if (d.getDay > 9) { todayISO += d.getDate(); } else { todayISO += "0"+d.getDate(); } //Other spelling button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/4e/Button_romain.png", "speedTip": "Other spellings", "tagOpen": "===Other spellings===*[[", "tagClose": "]]", "sampleText": "word"} //Pronunciation button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/7a/Button_haut_parleur.png", "speedTip": "Pronunciation", "tagOpen": "===Pronunciation===*{{IPA|", "tagClose": "}}", "sampleText": "pronunciation"} //Homophone button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/49/Button_talk.png", "speedTip": "Homophone", "tagOpen": "====Homophones====*[[", "tagClose": "]]", "sampleText": "word"} //Noun button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/29/Button_user.png", "speedTip": "Noun", "tagOpen": "==Noun=={{noun|", "tagClose": "}}", "sampleText": "word"} //Plural button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/ba/Button_conserver.png", "speedTip": "Plural of", "tagOpen": "#{{plural of|", "tagClose": "}}", "sampleText": "word"} //Verb button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/f/fc/Button_user_talk.png", "speedTip": "Verb", "tagOpen": "==Verb=={{verb|", "tagClose": "}}", "sampleText": "word|words|worded|wording"} //Third-person singular button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/35/Sister_icon.png", "speedTip": "3rd person", "tagOpen": "#{{third-person singular of|", "tagClose": "}}", "sampleText": "word"} //Past button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png", "speedTip": "Past", "tagOpen": "#{{past tense and participle of|", "tagClose": "}}", "sampleText": "word"} //Present participle button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/44/Button_comillas_latinas.png", "speedTip": "Present participle", "tagOpen": "#{{present participle of|", "tagClose": "}}", "sampleText": "word"} //Definition button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/3e/Sharp_button.png", "speedTip": "Definition", "tagOpen": "#", "tagClose": ".", "sampleText": "Full sentence definition"} //Example button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/11/Btn_toolbar_liste.png", "speedTip": "Example", "tagOpen": "#:''", "tagClose": ".''", "sampleText": "Example sentence"} //Category button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/b6/Button_category_link.png", "speedTip": "Category", "tagOpen": "[[Category:", "tagClose": "]]", "sampleText": "Category title"} //Template button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png", "speedTip": "Template", "tagOpen": "{{", "tagClose": "}}", "sampleText": "Template:"} //English interwiki button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/c/cb/Button_wikipedia.png", "speedTip": "EN interwiki", "tagOpen": "[[en:", "tagClose": "]]", "sampleText": "English article"} //My signature button mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/d/d1/Button_mysignature.png", "speedTip": "My sig", "tagOpen": "{{subst:", "tagClose": "user:Tygrrr/sig}}", "sampleText": ""} } addOnloadHook( InsertButtonsToToolBar ); /* Put some functions in the toolbox for the anti-vandal whack-a-mole game. Documented at http://en.wikipedia.org/wiki/User:Kbh3rd/Vandal_warning_toolbox Modified version of simple:user:Pilotguy/whackamole.js */ // <pre><nowiki> // ************** // Warnings // ************** function whackEdit (message, msg2, summary) { var f = document.editform ; var tbox = document.editform.wpTextbox1 ; var a = "" + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (msg2 != "") { a = prompt ("Article name?\n(Empty+OK for a generic message.)\n(Cancel now aborts.)", a) ; if (a == null) return ; if (a != null && a != "") { message = message.replace(/\|/,"|"+a) ; summary += " in [[" + a + "]]" ; } else { message = msg2 ; } } f.wpTextbox1.value += message + " {{subst:user:Tygrrr/sig}} ~~~~~ \n" ; f.wpSummary.value = summary ; f.wpMinoredit.checked=true; f.wpWatchthis.checked=false; f.wpTextbox1.focus(); if (f.wpTextbox1.scrollTop || true) f.wpTextbox1.scrollTop = f.wpTextbox1.scrollHeight ; } function whackWelcome () { whackEdit ("{{subst:welcome}}", "{{subst:welcome}}", "welcome!"); } function whackAnon () { whackEdit ("{{subst:anon}}", "{{subst:anon}}", "welcome anon"); } function whackWarn1 () { whackEdit ("{{subst:test|}}", "{{subst:test}}", "test"); } function whackWarn2 () { whackEdit ("{{subst:test2|}}", "{{subst:test2}}", "test2"); } function whackWarn3 () { whackEdit ("{{subst:test3|}}", "{{subst:test3}}", "test3"); } function whackWarn4 () { whackEdit ("{{subst:test4|}}", "{{subst:test4}}", "test4"); } function whackWarn4im () { whackEdit ("{{subst:test4im|}}", "{{subst:test4im}}", "test4im"); } function whackArticle () { whackEdit ("{{subst:testarticle}}", "{{subst:testarticle}}", "testarticle"); } function whackBlocked () { whackEdit ("{{subst:test5|}}", "{{subst:test5}}", "blocked"); } function whackBlocked () { whackEdit ("{{subst:blocked|}}", "{{subst:blocked}}", "indef"); } function whackBlocked2(){whackEdit ("[[Image:Modern_clock_chris_kemps_01.png|left|32px]]" + "You have been temporarily [[Wikipedia:Bans_and_blocks|blocked from editing]] because of your disruptive edits." + " You are [[Help:How_to_edit|invited to contribute]]" + " in a [[Wikipedia:Rules|constructive manner]] as soon as the block expires.", "", "Blocked"); } // ************************************************** // Installation // ************************************************** window.whack_addlilink=function(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); if(id) { if(key && title) ta[id] = [key, title]; else if(key) ta[id] = [key, '']; else if(title) ta[id] = ['', title]; } // re-render the title and accesskeys from existing code in wikibits.js akeytt(); return li; } window.whack_addToolboxLink=function(url, name, id){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; whack_addlilink(tb, url, name, id); } window.playWhackMoles=function() { if (document.title.match("Editing User talk:") ) { whack_addToolboxLink('javascript:{whackWelcome();};void(0);', 'Welcome', 'toolbox_welcome'); whack_addToolboxLink('javascript:{whackWarn1();};void(0);', 'Test1', 'toolbox_warn1'); whack_addToolboxLink('javascript:{whackWarn2();};void(0);', 'Test2', 'toolbox_warn2'); whack_addToolboxLink('javascript:{whackWarn3();};void(0);', 'Test3', 'toolbox_warn3'); whack_addToolboxLink('javascript:{whackWarn4();};void(0);', 'Test4', 'toolbox_warn4'); whack_addToolboxLink('javascript:{whackBlocked();};void(0);', 'Test5', 'toolbox_block'); } else { whack_addToolboxLink('http://simple.wiktionary.org/wiki/Special:Newpages', 'New pages', 'toolbox_googlelookup'); whack_addToolboxLink ('http://simple.wiktionary.org/wiki/Special:Withoutinterwiki', 'Pages w/o interwiki', 'toolbox_googlelookup'); whack_addToolboxLink ('http://simple.wiktionary.org/wiki/Special:Categories', 'Categories', 'toolbox_googlelookup'); whack_addToolboxLink ('http://simple.wiktionary.org/w/index.php?title=Special%3ACategoryTree&target=Fundamental&mode=categories', 'CategoryTree', 'toolbox_googlelookup'); whack_addToolboxLink('http://simple.wiktionary.org/wiki/Special:Uncategorizedcategories', 'Uncategorized cats', 'toolbox_googlelookup'); whack_addToolboxLink('http://simple.wiktionary.org/wiki/Special:Uncategorizedpages', 'Uncategorized pages', 'toolbox_googlelookup'); whack_addToolboxLink('http://simple.wiktionary.org/wiki/Special:Wantedcategories', 'Wanted categories', 'toolbox_googlelookup'); } } // onload window.simpleAddOnload=function(f) { if (window.addEventListener) window.addEventListener("load", f, false); else if (window.attachEvent) window.attachEvent("onload",f); } simpleAddOnload(playWhackMoles); // </nowiki></pre> importScript('User:Conrad.Irwin/creation.js');