User:Jfiling/monobook.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
//<pre><nowiki /************* afd Helper ************/ // see User:Jnothman/afd_helper document.write('<script type="text/javascript"' + 'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/automod.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); afdh_signature = '~~'+'~'; afdh_summaryprompt = true; afdh_shortcuts = Array(); afdh_shortcuts['d'] = 'Delete'; afdh_shortcuts['k'] = 'Keep'; afdh_shortcuts['m'] = 'Merge'; afdh_shortcuts['mv'] = 'Move'; afdh_shortcuts['rd'] = 'Redirect'; afdh_shortcuts['rw'] = 'Rewrite'; afdh_shortcuts['t'] = 'Transwiki'; afdh_shortcuts['wd'] = 'Weak delete'; afdh_shortcuts['sd'] = 'Strong delete'; afdh_shortcuts['sp'] = 'Speedy delete'; afdh_shortcuts['sk'] = 'Strong keep'; afdh_shortcuts['wk'] = 'Weak keep'; afdh_shortcuts['c'] = 'Comment'; afdh_commscs = Array(); afdh_commscs['pn'] = 'per nom.'; function afd_helper() { if (auto_mod()) return; var anchors = new Array(); { var oldanchors = document.getElementById('bodyContent').getElementsByTagName('a'); for (var i=0; i < oldanchors.length; i++) anchors[i] = oldanchors[i]; } var url_re = /\?title=Wikipedia:Articles_for_deletion\/([^&]+)&action=edit&/; var url, matches; for (var i=0; i < anchors.length; i++) { if (!(matches = anchors[i].href.match(url_re)) || (matches[1].substr(0, 4) == 'Log/')) continue; var na = document.createElement('a'); na.href = "javascript:afd_vote('"+anchors[i].href.replace(/'/g, '\\\'').replace(/\%27/g, '\\\'')+"')"; na.title = "Vote on deletion of "+unescape(matches[1]); var inlink = document.createElement('sup'); inlink.appendChild(document.createTextNode('vote')); na.appendChild(inlink); anchors[i].parentNode.insertBefore(na, anchors[i].nextSibling); } if (am_get_title().indexOf(':') == -1) am_add_li('tb', 'javascript:afd_nominate()', 'Nominate AFD', '', 'Nominate this article for deletion'); } function afd_vote(edit_link) { var shortcuts_list = ''; for (var key in afdh_shortcuts) shortcuts_list += key + ': ' + afdh_shortcuts[key] + '; '; var vote = window.prompt("Enter your vote. (Shortcuts available are: "+shortcuts_list+")"); if (!vote) return; if (afdh_shortcuts[vote.toLowerCase()]) vote = afdh_shortcuts[vote.toLowerCase()]; shortcuts_list = ''; for (var key in afdh_commscs) shortcuts_list += key + ': ' + afdh_commscs[key] + '; '; var comment = window.prompt("Enter your comment. (Shortcuts available are: "+shortcuts_list+")"); if (typeof comment != 'string') return; if (afdh_commscs[comment.toLowerCase()]) comment = afdh_commscs[comment.toLowerCase()]; var summary = vote; if (afdh_summaryprompt) if (!(summary = window.prompt("Enter the edit summary:", summary))) summary = vote; var url = edit_link + '&amaddafter='+escape("* '''"+vote+"''' "+comment+" "+afdh_signature+" ~~"+"~~"+"~") + '&amsummary='+escape(summary); if (window.location.href.indexOf("/Log/") == -1) window.location.href = url; else window.open(url, "afd_helper_vote"); } function afd_nominate() { var title = am_get_title(); var log_date = window.prompt("This should be the date of the latest AFD log. Change it if necessary.", am_guess_date()); if (!log_date) return; var reason = window.prompt("Please justify your AFD nomination of "+title+":"); if (!reason) return; window.open(am_make_url(title, '{{'+'subst:afd}}', '', 'nomination for [[WP:AFD|deletion]]'), 'afdhn1'); window.open(am_make_url('Wikipedia:Articles for deletion/Log/'+log_date, '', '{{'+'subst:afd3|pg='+title+'}}', 'Nominating [['+title+']] for deletion'), 'afdhn3'); window.location.href = am_make_url('Wikipedia:Articles for deletion/'+title, '', '{{'+'subst:afd2|pg='+title+'|text='+reason+' '+afdh_signature+" ~~"+"~~"+"~"+'}}', 'nominated for deletion'); } addOnloadHook(afd_helper); //</nowiki></pre> function addLink(where, url, name, id, title, key, after){ //* where is the id of the toolbar where the button should be added; // i.e. one of "p-cactions", "p-personal", or "p-navigation". //* url is the URL which will be called when the button is clicked. // javascript: urls can be used to do more complex things. //* name is what will appear as the name of the button. //* id is the id of the button; it's best to define one. // Use a prefix to make sure its unique. Optional. //* title is the tooltip title that gives a longer description // of the button; if you define a accesskey, mention it here. Optional. //* key is the char you want for the accesskey. Optional. //* after is the id of the button you want to follow this one. Optional. 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); var tabs = document.getElementById(where).getElementsByTagName('ul')[0]; if(after) { tabs.insertBefore(li,document.getElementById(after)); } else { 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; } // This script adds "Google search" and "Yahoo! search" links to the toolbox. Requires Wikipedia:WikiProject User scripts/Scripts/addLink. addOnloadHook(function () { // add onload handler using code from wikibits.js var title; if (!(title = document.getElementById('t-whatlinkshere') )) return; if (!(title = title.getElementsByTagName('a')[0] )) return; if (!(title = title.href )) return; if (!(title = title.replace(/^.*\/wiki\/Special:Whatlinkshere\//, '') )) return; if (!(title = title.replace(/^(Talk|User|Wikipedia|Image|MediaWiki|Template|Help|Category|Portal)(_talk)?:/, '') )) return; if (!(title = title.replace(/("|%22)/g, '') )) return; if (!(title = title.replace(/_/g, '%20') )) return; addLink('p-tb', 'http://www.google.com/search?q=%22'+title+'%22%20-Wikipedia&ie=utf-8&oe=utf-8', 'Google search', 't-googlesearch', 'Search Google for "'+decodeURIComponent(title)+'"', 'G', null); addLink('p-tb', 'http://search.yahoo.com/search?p=%22'+title+'%22%20-Wikipedia&ei=UTF-8', 'Yahoo! search', 't-yahoosearch', 'Search Yahoo! for "'+decodeURIComponent(title)+'"', 'Y', null); }); //<nowiki> Admin-like RC Patrol tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:VoA/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //</nowiki>[[Category:Wikipedians who use RC script ]] // [[User:Lupin/popups.js]] - please include this line document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); popupLastModified=true; popupPreviews=true; popupFixRedirs=true;