Wikipedia:WikiProject User scripts/Fulfilled requests

This page contains requests for user scripts that have been recently fulfilled. The make a new request, please see WikiProject User scripts/Requests. For older fulfilled requests, please see WikiProject User scripts/Fulfilled requests/Archive index.

Add speedy deletion templates to a page
How about a script to allow me to post a speedy deletion template on a page. - PatricknoddyTALK (reply here) | HISTORY  11:19, 17 March 2007 (UTC)


 * Although I can't find it right now, I'm pretty sure we already have something like that.
 * WP:TWINKLE can do that. —Grim Revenant 09:59, 18 May 2007 (UTC)

Change all talk page links in a category to point to their main page
I'm not sure if this is possible. Here's what I would like. When browsing a category, such as Category:Unassessed-Class Environment articles, I want the script to point all the links in the category to point to the article and not the talk page of the article. So for example in the category, instead of pointing to Talk:Algae, it'll point to Algae. Is that possible? Right now when assessing articles, I have to click on the link which takes me to the talk page. Then I have to go to the article to review it. I want to skip that first step. MahangaTalk to me 02:36, 19 March 2007 (UTC)


 * Give this a try (adds an action button). --Splarka (rant) 07:32, 19 March 2007 (UTC)

function catSwapButton { if(document.title.indexOf('Category:' == 0)) { addPortletLink('p-cactions','javascript:catSwap;','De-Talkify','ca-catswap','change category links from talk pages to article pages'); } } addOnloadHook(catSwapButton)

function catSwap { var cat = document.getElementById('mw-pages'); cat.innerHTML = cat.innerHTML.replace(/Talk\:/g,'').replace(/[_\s]talk\:/g,':'); }


 * Thank you!

Highlight watchlist items by pattern
A script that allows a user to add a wildcard, and any items in his watchlist that contain that wildcard will be colored in a different color. This is especially useful for users who are monitoring things like many of the DYK templates. Yonatan talk 20:23, 19 March 2007 (UTC)


 * Here is a crude version (someone else could write it with regex support and a more compact array method I suppose). Note that this can be expanded to search the title="", by changing  to   below.

 var wstyle = []; // Watchlist styler, matches word or word fragments in the innerHTML of links on your watchlist page. // Accepts 'color' and 'bgcol' parameters (link color and background color), either or both. // Add as many as your browser can handle. wstyle[wstyle.length] = { 'match': 'Hydrogen', 'color': '#ffff00', 'bgcol': '#00ff00'} wstyle[wstyle.length] = { 'match': 'MediaWiki', 'color': '#ff0000'} wstyle[wstyle.length] = { 'match': 'Talk:', 'bgcol': '#000000'}

function watchlistStyle { if(document.title.indexOf('My watchlist -') != 0) return; var links = document.getElementById('bodyContent').getElementsByTagName('a'); for(var i=0;i < links.length;i++) { for(var k=0;k < wstyle.length;k++) { if(links[i].innerHTML.indexOf(wstyle[k].match)!= -1) { if(wstyle[k].color) links[i].style.color = wstyle[k].color if(wstyle[k].bgcol) links[i].style.backgroundColor = wstyle[k].bgcol }   }  } } addOnloadHook(watchlistStyle)
 * Note that this can also be done in just CSS if your browser supports 2.1 (any Firefox should work), eg:

body.page-Special_Watchlist a[title*="MediaWiki"] {color: #ff0000; background-color:#000000;}
 * --Splarka (rant) 23:22, 19 March 2007 (UTC)

Post a random smiley to a random user
Could someone make me a script that posts a random smiley to a random user all in one go? For more information on what I mean, see WP:BOTREQ, at the very bottom, specefically. ♠  TomasBat  ( @ )  ( Contribs )  ( Sign! ) 20:34, 17 April 2007 (UTC)


 * I'm dealing with this on the user's talk page (this is something of a niche request anyway, and it probably isn't appropriate for the scripts list due to the havoc this might cause if overused, and given its nature it'll probably spread by talkpage spam anyway). --ais523 14:51, 18 April 2007 (UTC)

"New pages" link in "interaction" portlet
Could someone make a script that would add a link to Special:NewPages to the "interaction" box on the side of the page? Mr.Z-man  talk ¢  22:44, 22 April 2007 (UTC)


 * This should work:

addOnloadHook(function {    addPortletLink("p-interaction", wgArticlePath.replace(/\$1/, 'Special:Newpages'), "New pages", "n-newpages", "View a list of recently created pages"); });
 * Be aware that changes have been made in the recent past to MediaWiki:Sidebar that could break this in the future. Particularly, the id for p-interaction could change. I've attempted to get some interest in addressing this issue at MediaWiki talk:Sidebar and Village pump (technical), but there has been zero response to my dismay. Mike Dillon 23:34, 22 April 2007 (UTC)


 * Yep, that works great. Thanks! Mr.Z-man  talk ¢  00:10, 23 April 2007 (UTC)

Pre-defined edit summary drop-down
I would be really glad about a script that creates a drop-down menu over the edit summary line. From that menu you should be able to choose some pre-defined edit summaries. Reason: Doing stupid tasks sometimes require extensive summaries in order to avoid confusion among others. Furthermore, it is simply nice to have kind of "standardized" summaries for always the same task. The summaries in the menu should be definable in the monobook. — Pill (talk) 18:22, 30 April 2007 (UTC)


 * IIRC wikEd (User:Cacycle/wikEd) does something like this (among many other things), but it's probably overkill for such a simple task. Maybe the relevant part of the code could be made into a separate script? --ais523 10:40, 1 May 2007 (UTC)
 * There's no more simple variant? — Pill (talk) 22:17, 5 May 2007 (UTC)
 * Well, I have a feeling that either me or Mike Dillon will eventually write this script. Remind me in a week if that doesn't happen. — Alex Smotrov 00:44, 6 May 2007 (UTC)

This might work for you. Mike Dillon 04:02, 8 May 2007 (UTC)

var predefinedSummaries = { "stuff": "Doing stuff", "things": "Doing things" }; addOnloadHook(function {    var summary = document.getElementById("wpSummary");    if (!summary) return;

var dropdown = document.createElement("select"); dropdown.style.width = "15%";

for (var label in predefinedSummaries) { var option = document.createElement("option"); option.setAttribute("value", predefinedSummaries[label]); option.appendChild(document.createTextNode(label)); dropdown.appendChild(option); }

dropdown.onchange = function { summary.value = summary.value.replace(/(\/\*.*?\*\/\s+)?.*/,           "$1" + dropdown.options[dropdown.selectedIndex].value); };

summary.parentNode.insertBefore(dropdown, summary.nextSibling); });

Voting script
It would be really usefull if there was a script that added three extra buttons to the toolbar, one for a support, oppose, and neutral vote respectively, maybe something like this:


 * [[Image:Symbol support vote.svg|15px]] Support. Comment (optional) ~
 * [[Image:Symbol oppose vote.svg|15px]] Oppose. Comment (optional) ~
 * [[Image:Symbol neutral vote.svg|15px]] Neutral. Comment (optional) ~

Seeing as voting is an essential part of Wikipedia, this could also standartise the procedure and save time. If someone doesn't want to leave a comment, he simply removes the Comment part. Thanks. —May the Edit be with you, always. (T-borg) (drop me a line) 21:15, 13 May 2007 (UTC)

if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/ba/Button_conserver.png", "speedTip": "Support", "tagOpen": "* \'\'\'Support\'\'\'. ", "tagClose": " ~", "sampleText": "\'\'comment\'\'"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/f/fc/Button_supp.png", "speedTip": "Oppose", "tagOpen": "* \'\'\'Oppose\'\'\'. ", "tagClose": " ~", "sampleText": "\'\'comment\'\'"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/4e/Button_neutre.png", "speedTip": "Neutral", "tagOpen": "* \'\'\'Neutral\'\'\'. ", "tagClose": " ~", "sampleText": "\'\'comment\'\'"}; }
 * Hint: you can probably also put in some simple logic to only trigger it on voting pages (if it were established site-wide). --Splarka (rant) 07:25, 14 May 2007 (UTC)
 * A script such as this would run counter to guidelines here on the English Wikipedia: see WP:!VOTE. Generally speaking, decisions should be made via consensus rather than voting. Templates showing [[Image:Symbol support vote.svg|15px]] Support and similar have been deleted several times at TfD for such reasons (e.g. see Template:Support's deletion log, which dates back to June 2005). There was a standalone program to do something like this called 'WikiVoter', but there was a backlash against it (people assumed that the name implied that it did nothing but add votes), and it was renamed WikiDiscussion Manager. This script appears to be something that does simply add votes, so I would recommend not using it. --ais523 07:49, 14 May 2007 (UTC)

I see. Thanks for clearing things up. —May the Edit be with you, always. (T-borg) (drop me a line) 07:52, 14 May 2007 (UTC)

"Add edit section 0" doesn't work on Safari 3
As the subject says, this script stopped working after an upgrade to Safari 3. Any way to fix it? --.anaconda 16:02, 3 July 2007 (UTC)
 * I don't have Safari to test it on, but here's a simplified version of the script I've just written that may avoid the problem:


 * Works, thank you :-) --.anaconda 22:50, 3 July 2007 (UTC)

Don't show articles in My Contributions where I'm the last contributor
I've looked and looked and can't find what I'm after. I'd like a script that, when I'm looking at My Contributions, only shows the articles where I'm not the most recent contributor. (Or, more specifically, a script that gives me the option to view the contributions that way.) <font color="DarkGray">... <font color="DarkOrange">disco <font color="DarkOliveGreen">spinster <font color="DarkGray">talk  00:31, 25 September 2007 (UTC)
 * Should just be a trivial tweak to User:ais523/topcontrib.js (which colours the lines corresponding to articles where you aren't top, rather than hiding them). I'll look into it. --ais523 07:25, 25 September 2007 (UTC)
 * Here you go: User:ais523/hidetopcontrib.js puts a tab on Special:Contributions which hides (on all screens of results) all top edits and (on the first screen of results, and less reliably on later screens) all pages on which you have the top edit. --ais523 07:35, 25 September 2007 (UTC)
 * Wonderful, thanks! Could you add a way to toggle between "hide top" and "show top"?  <font color="DarkGray">... <font color="DarkOrange">disco <font color="DarkOliveGreen">spinster  <font color="DarkGray">talk  12:52, 25 September 2007 (UTC)
 * Done, bypass your cache to see the changes. --ais523 13:19, 26 September 2007 (UTC)
 * Brilliant! Thanks so much. <font color="DarkGray">... <font color="DarkOrange">disco <font color="DarkOliveGreen">spinster  <font color="DarkGray">talk  14:02, 26 September 2007 (UTC)